@zodiacs/engine 0.1.1-rc.16 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +1478 -0
  2. package/LICENSING.md +184 -30
  3. package/NOTICE +81 -14
  4. package/README.md +345 -67
  5. package/dist/{api-VOW6Umy5.d.ts → api-ChL1N2Sr.d.ts} +44 -7
  6. package/dist/ayanamsa-ClFzkKmV.d.ts +135 -0
  7. package/dist/calc.d.ts +218 -21
  8. package/dist/calc.js +580 -160
  9. package/dist/chunk-2PZYJQV5.js +83 -0
  10. package/dist/chunk-47ERTK5X.js +27 -0
  11. package/dist/{chunk-O3NJRGJ2.js → chunk-4XOYTBLS.js} +1 -1
  12. package/dist/chunk-767FTO7O.js +48 -0
  13. package/dist/{chunk-N4B5JNMA.js → chunk-7Y2F2IWN.js} +40 -28
  14. package/dist/chunk-B4M2Y7FT.js +96 -0
  15. package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
  16. package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
  17. package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
  18. package/dist/chunk-I3L4POY7.js +18 -0
  19. package/dist/{chunk-I7O5EGFV.js → chunk-LNGURVNH.js} +3 -3
  20. package/dist/{chunk-4NV4ZEFZ.js → chunk-NNOSOOWS.js} +4 -4
  21. package/dist/chunk-OVXQQEXL.js +41 -0
  22. package/dist/{chunk-WOU7JVD3.js → chunk-QLIEEICB.js} +205 -194
  23. package/dist/chunk-RMBWKZI2.js +130 -0
  24. package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
  25. package/dist/{chunk-L6ZHWJZ6.js → chunk-TZVPZHZM.js} +51 -29
  26. package/dist/chunk-WBTWY2OB.js +478 -0
  27. package/dist/chunk-Y4E3WJU5.js +87 -0
  28. package/dist/chunk-YPU3MDNI.js +852 -0
  29. package/dist/conventions.d.ts +70 -0
  30. package/dist/conventions.js +26 -0
  31. package/dist/crossings.d.ts +22 -10
  32. package/dist/crossings.js +1 -1
  33. package/dist/de440-pack.d.ts +43 -0
  34. package/dist/de440-pack.js +16 -0
  35. package/dist/de440.d.ts +113 -0
  36. package/dist/de440.js +19 -0
  37. package/dist/deltat.d.ts +28 -3
  38. package/dist/deltat.js +1 -1
  39. package/dist/ephemeris-exTSqBgb.d.ts +60 -0
  40. package/dist/geo.d.ts +46 -13
  41. package/dist/geo.js +4 -2
  42. package/dist/{houses-q1O2GGp4.d.ts → houses-Bh7GCnPi.d.ts} +14 -4
  43. package/dist/houses-extra.d.ts +22 -7
  44. package/dist/houses-extra.js +4 -2
  45. package/dist/index.d.ts +36 -49
  46. package/dist/index.js +54 -34
  47. package/dist/{internal-math-CmJ9xtaW.d.ts → internal-math-CxenuGfm.d.ts} +41 -27
  48. package/dist/internal-math.d.ts +4 -3
  49. package/dist/internal-math.js +14 -12
  50. package/dist/internal.d.ts +16 -7
  51. package/dist/internal.js +27 -6
  52. package/dist/lite-composite.js +114 -0
  53. package/dist/lite-declinations.js +253 -0
  54. package/dist/lite-dignities.js +333 -0
  55. package/dist/lite-sect.js +72 -0
  56. package/dist/lite.d.ts +82 -0
  57. package/dist/lite.js +4 -0
  58. package/dist/receipt.d.ts +3 -268
  59. package/dist/receipt.js +202 -89
  60. package/dist/reference-span-CILpclrz.d.ts +40 -0
  61. package/dist/{rulers-9wljfVaO.d.ts → rulers-CSSWtiWF.d.ts} +7 -2
  62. package/dist/sky.d.ts +26 -10
  63. package/dist/sky.js +23 -14
  64. package/dist/techniques.d.ts +160 -21
  65. package/dist/techniques.js +157 -89
  66. package/dist/time-bands-CZA9AlLg.d.ts +36 -0
  67. package/dist/time-scale-DIFNa0gz.d.ts +47 -0
  68. package/dist/time.d.ts +81 -0
  69. package/dist/time.js +74 -0
  70. package/dist/timing.d.ts +55 -17
  71. package/dist/timing.js +33 -45
  72. package/dist/types-DpPdtXgO.d.ts +335 -0
  73. package/dist/vedic.d.ts +150 -123
  74. package/dist/vedic.js +398 -440
  75. package/dist/window.d.ts +102 -80
  76. package/dist/window.js +108 -51
  77. package/dist/zone-history-BxmDCcTK.d.ts +290 -0
  78. package/package.json +26 -3
  79. package/dist/chunk-2OWGBT3O.js +0 -219
  80. package/dist/types-B4MCoCCS.d.ts +0 -228
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-KFTJMMG7.js";
7
7
  import {
8
8
  validateBirthSettings
9
- } from "./chunk-PFGUCNOK.js";
9
+ } from "./chunk-BMDASNPB.js";
10
10
 
11
11
  // src/geo/calendar.ts
12
- var GREGORIAN_ADOPTION_SOURCES = Object.freeze({
12
+ var GREGORIAN_ADOPTION_SOURCES = /* @__PURE__ */ Object.freeze({
13
13
  tzdb: "IANA tzdata 2025c, file calendars, quoting H. Grotefend, Taschenbuch der Zeitrechnung, ed. O. Grotefend (1941), pp. 26-28",
14
14
  "grotefend-1891": "H. Grotefend, Zeitrechnung des deutschen Mittelalters und der Neuzeit, vol. 1 (1891), pp. 133-134",
15
15
  "grotefend-1898": "H. Grotefend, Taschenbuch der Zeitrechnung des deutschen Mittelalters und der Neuzeit (1898), pp. 23-24"
@@ -33,8 +33,8 @@ PT|Portugal|-|1582-10-15|t18|
33
33
  RU|Russia|Soviet Russia|1918-02-14|t|Grotefend 1891, 1898: still Julian. Duchy of Prussia, now partly Kaliningrad, 1612-09-02 (Grotefend 1898: 1612-09-01).
34
34
  SE|Sweden|-|1753-03-01|t18|From 1 March 1700 to 30 February 1712 Swedish dates are one day ahead of the Julian (Grotefend 1898).`;
35
35
  var SOURCE_KEYS = { t: "tzdb", 1: "grotefend-1891", 8: "grotefend-1898" };
36
- var GREGORIAN_ADOPTION = Object.freeze(
37
- ROWS.split("\n").map((line) => {
36
+ var GREGORIAN_ADOPTION = /* @__PURE__ */ Object.freeze(
37
+ /* @__PURE__ */ ROWS.split("\n").map((line) => {
38
38
  const [code, country, region, firstGregorian, sources, note] = line.split("|");
39
39
  const day = julianDayNumber(parseCalendarDate(firstGregorian, "gregorian"), "gregorian");
40
40
  return Object.freeze({
@@ -52,15 +52,21 @@ function gregorianAdoption(country) {
52
52
  return GREGORIAN_ADOPTION.find((row) => row.code === country || row.country === country);
53
53
  }
54
54
  function calendarNote(gregorianDate, calendar, country) {
55
+ if (!parseCalendarDate(gregorianDate, "gregorian")) throw new RangeError("gregorianDate must be a valid Gregorian date, YYYY-MM-DD.");
56
+ if (calendar !== "gregorian" && calendar !== "julian") throw new RangeError('calendar must be "gregorian" or "julian".');
57
+ if (typeof country !== "string" || !country.trim()) throw new RangeError("country must be a nonempty string.");
58
+ return noteFor(gregorianDate, calendar, country);
59
+ }
60
+ function noteFor(gregorianDate, calendar, country) {
55
61
  const adoption = gregorianAdoption(country);
56
62
  if (!adoption) return null;
57
63
  const julian = calendar === "julian";
58
- if (gregorianDate >= adoption.firstGregorian) return julian ? { kind: "new-style", adoption } : null;
64
+ if (gregorianDate.length > 10 || gregorianDate >= adoption.firstGregorian) return julian ? { kind: "new-style", adoption } : null;
59
65
  return julian ? null : { kind: "old-style", adoption };
60
66
  }
61
67
 
62
68
  // src/tzdb/tzdb-2025c.ts
63
- var TZDB = Object.freeze({
69
+ var TZDB = /* @__PURE__ */ Object.freeze({
64
70
  version: "2025c",
65
71
  sha256: "4aa79e4effee53fc4029ffe5f6ebe97937282ebcdf386d5d2da91ce84142f957",
66
72
  form: "main+backzone"
@@ -237,7 +243,7 @@ function firstChange(clockAt, lo, hi) {
237
243
  }
238
244
  return hi;
239
245
  }
240
- function readClock(wallMs, clockAt, samples) {
246
+ function readClock(wallMs, clockAt, samples, fold) {
241
247
  const readings = [];
242
248
  for (const offset of new Set(samples.map(clockAt))) {
243
249
  const utcMs2 = wallMs - offset * 1e3;
@@ -247,7 +253,7 @@ function readClock(wallMs, clockAt, samples) {
247
253
  }
248
254
  const [first, second] = readings.sort((a, b) => a.utcMs - b.utcMs);
249
255
  if (first) {
250
- return second ? { chosen: first, kind: "fold", at: firstChange(clockAt, first.utcMs, second.utcMs) } : { chosen: first, kind: null, at: null };
256
+ return second ? { chosen: fold === "later" ? second : first, kind: "fold", at: firstChange(clockAt, first.utcMs, second.utcMs) } : { chosen: first, kind: null, at: null };
251
257
  }
252
258
  let lo = wallMs - PROBE - DAY;
253
259
  let hi = wallMs + PROBE + DAY;
@@ -284,15 +290,14 @@ function birthplaceClock(history, wallMs, longitude, zoneAt) {
284
290
  lineEnds: era.slice(0, -1).map(([until]) => until)
285
291
  };
286
292
  }
287
- function readOptions(options) {
288
- if (options === void 0) return { calendar: "gregorian" };
293
+ function readOptions(options = {}) {
289
294
  if (!options || typeof options !== "object" || Array.isArray(options)) {
290
295
  throw new RangeError("options must be an object.");
291
296
  }
292
297
  for (const key of Object.getOwnPropertyNames(options)) {
293
- if (!["longitude", "calendar", "country"].includes(key)) throw new RangeError(`Unknown local time option "${key}".`);
298
+ if (!["longitude", "calendar", "country", "fold"].includes(key)) throw new RangeError(`Unknown local time option "${key}".`);
294
299
  }
295
- const { longitude, calendar = "gregorian", country } = options;
300
+ const { longitude, calendar = "gregorian", country, fold = "earlier" } = options;
296
301
  if (longitude !== void 0 && !(typeof longitude === "number" && Math.abs(longitude) <= 180)) {
297
302
  throw new RangeError("longitude must be between -180 and 180 degrees.");
298
303
  }
@@ -300,12 +305,13 @@ function readOptions(options) {
300
305
  if (country !== void 0 && (typeof country !== "string" || !country.trim())) {
301
306
  throw new RangeError("country must be a nonempty string.");
302
307
  }
303
- return { longitude, calendar, country };
308
+ if (fold !== "earlier" && fold !== "later") throw new RangeError('fold must be "earlier" or "later".');
309
+ return { longitude, calendar, country, fold };
304
310
  }
305
311
  var pad = (value, width = 2) => String(value).padStart(width, "0");
306
312
  function resolveLocalToUtc(date, time, timeZone, options) {
307
313
  offsetFormatter(timeZone);
308
- const { longitude, calendar, country } = readOptions(options);
314
+ const { longitude, calendar, country, fold } = readOptions(options);
309
315
  const written = parseCalendarDate(date, calendar);
310
316
  const hhmm = typeof time === "string" ? /^([01]\d|2[0-3]):([0-5]\d)$/u.exec(time) : null;
311
317
  if (!written || !hhmm) {
@@ -318,14 +324,14 @@ function resolveLocalToUtc(date, time, timeZone, options) {
318
324
  wall.setUTCFullYear(civil.year, civil.month - 1, civil.day);
319
325
  const wallMs = wall.setUTCHours(Number(hhmm[1]), Number(hhmm[2]));
320
326
  const loaded = FIXED_ZONE.test(timeZone) ? null : loadedHistory(timeZone);
321
- if (loaded === void 0 && wallMs < DAY) throw notLoaded();
327
+ if (loaded === void 0 && wallMs < DAY) throw new ZoneHistoryNotLoadedError();
322
328
  const history = loaded ?? null;
323
329
  const zoneAt = zoneClock(timeZone, history);
324
330
  const place = longitude !== void 0 && history ? birthplaceClock(history, wallMs, longitude, zoneAt) : null;
325
331
  const samples = [wallMs - PROBE, wallMs, wallMs + PROBE, ...place ? [place.endMs - 1, place.endMs, place.legalFrom] : []];
326
332
  const clockAt = place ? place.clockAt : zoneAt;
327
- const zoneReading = readClock(wallMs, zoneAt, samples);
328
- const reading = place ? readClock(wallMs, clockAt, samples) : zoneReading;
333
+ const zoneReading = readClock(wallMs, zoneAt, samples, fold);
334
+ const reading = place ? readClock(wallMs, clockAt, samples, fold) : zoneReading;
329
335
  const { chosen, kind } = reading;
330
336
  const inEra = !!place && chosen.utcMs < place.endMs;
331
337
  const count = history && chosen.utcMs < 0 ? typeIndexAt(history, chosen.utcMs) : -1;
@@ -352,7 +358,7 @@ function resolveLocalToUtc(date, time, timeZone, options) {
352
358
  };
353
359
  }
354
360
  const lmt = inEra || !place && history?.zoneEraEnd != null && chosen.utcMs < history.zoneEraEnd;
355
- const flags = kind ? [kind === "gap" ? "dst-gap" : "dst-fold"] : [];
361
+ const flags = kind ? [`dst-${kind}`] : [];
356
362
  if (lmt) flags.push("lmt");
357
363
  const localMeanTime = longitude !== void 0 && place && (inEra || kind === "gap" && reading.at === place.endMs) ? { longitude, zoneOffsetMinutes: zoneReading.chosen.offset / 60 } : null;
358
364
  const zone = shipped ? {
@@ -375,14 +381,14 @@ function resolveLocalToUtc(date, time, timeZone, options) {
375
381
  localMeanTime,
376
382
  zone,
377
383
  intlOffsetMinutes: shipped ? offsetAt(timeZone, chosen.utcMs) : null,
378
- calendarNote: country === void 0 ? null : calendarNote(gregorianDate, calendar, country),
384
+ calendarNote: country === void 0 ? null : noteFor(gregorianDate, calendar, country),
379
385
  localResolution: {
380
386
  date: gregorianDate,
381
387
  time,
382
388
  timeZone,
383
389
  offsetMinutes,
384
390
  gapShiftMinutes: kind === "gap" && transition ? transition.offsetAfterMinutes - transition.offsetBeforeMinutes : 0,
385
- policy: { fold: "earlier", gap: "shift-forward" },
391
+ policy: { fold: kind === "fold" ? fold : "earlier", gap: "shift-forward" },
386
392
  calendar,
387
393
  writtenDate: date,
388
394
  tzdbVersion: zone.tzdbVersion,
@@ -406,12 +412,15 @@ function zoneOffsetAt(timeZone, utcMilliseconds) {
406
412
  validateInstant(utcMilliseconds);
407
413
  offsetFormatter(timeZone);
408
414
  const loaded = FIXED_ZONE.test(timeZone) ? null : loadedHistory(timeZone);
409
- if (loaded === void 0 && utcMilliseconds < 0) throw notLoaded();
415
+ if (loaded === void 0 && utcMilliseconds < 0) throw new ZoneHistoryNotLoadedError();
410
416
  return zoneClock(timeZone, loaded ?? null)(utcMilliseconds) / 60;
411
417
  }
412
- function notLoaded() {
413
- return new Error("The zone's history before 1970 is not loaded: await prepareLocalTime(date, timeZone) first.");
414
- }
418
+ var ZoneHistoryNotLoadedError = class extends Error {
419
+ name = "ZoneHistoryNotLoadedError";
420
+ constructor() {
421
+ super("The zone's history before 1970 is not loaded: await prepareLocalTime(date, timeZone) first.");
422
+ }
423
+ };
415
424
  var LOCAL_BIRTH_KEYS = [
416
425
  "date",
417
426
  "time",
@@ -421,7 +430,8 @@ var LOCAL_BIRTH_KEYS = [
421
430
  "houseSystem",
422
431
  "timeKnown",
423
432
  "calendar",
424
- "country"
433
+ "country",
434
+ "fold"
425
435
  ];
426
436
  function resolveLocalBirth(input) {
427
437
  if (!input || typeof input !== "object" || Array.isArray(input)) {
@@ -432,15 +442,16 @@ function resolveLocalBirth(input) {
432
442
  }
433
443
  const fields = Object.fromEntries(LOCAL_BIRTH_KEYS.map((key) => [key, input[key]]));
434
444
  const settings = validateBirthSettings(fields);
435
- const time = fields.time;
445
+ const { time, calendar, country, fold } = fields;
436
446
  const timeKnown = settings.timeKnown ?? time !== void 0;
437
447
  if (timeKnown && time === void 0) {
438
448
  throw new RangeError("time is required when timeKnown is true.");
439
449
  }
440
450
  const resolution = resolveLocalToUtc(fields.date, time === void 0 ? "12:00" : time, fields.timeZone, {
441
451
  longitude: settings.longitude,
442
- calendar: fields.calendar,
443
- country: fields.country
452
+ calendar,
453
+ country,
454
+ fold
444
455
  });
445
456
  return {
446
457
  birth: {
@@ -468,6 +479,7 @@ export {
468
479
  resolveLocalToUtc,
469
480
  prepareLocalTime,
470
481
  zoneOffsetAt,
482
+ ZoneHistoryNotLoadedError,
471
483
  resolveLocalBirth,
472
484
  resolveBirth
473
485
  };
@@ -0,0 +1,96 @@
1
+ // src/aspects.ts
2
+ var ASPECT_TYPES = /* @__PURE__ */ Object.freeze([
3
+ "conjunction",
4
+ "sextile",
5
+ "square",
6
+ "trine",
7
+ "opposition"
8
+ ]);
9
+ var ASPECTS = /* @__PURE__ */ Object.freeze([
10
+ /* @__PURE__ */ Object.freeze({ type: "conjunction", angle: 0, orb: 8, luminaryOrb: 10 }),
11
+ /* @__PURE__ */ Object.freeze({ type: "sextile", angle: 60, orb: 4, luminaryOrb: 5 }),
12
+ /* @__PURE__ */ Object.freeze({ type: "square", angle: 90, orb: 7, luminaryOrb: 8 }),
13
+ /* @__PURE__ */ Object.freeze({ type: "trine", angle: 120, orb: 7, luminaryOrb: 8 }),
14
+ /* @__PURE__ */ Object.freeze({ type: "opposition", angle: 180, orb: 8, luminaryOrb: 10 })
15
+ ]);
16
+ var LUMINARIES = /* @__PURE__ */ new Set(["Sun", "Moon"]);
17
+ var ASPECT_BODY_NAMES = /* @__PURE__ */ Object.freeze([
18
+ "Sun",
19
+ "Moon",
20
+ "Mercury",
21
+ "Venus",
22
+ "Mars",
23
+ "Jupiter",
24
+ "Saturn",
25
+ "Uranus",
26
+ "Neptune",
27
+ "Pluto"
28
+ ]);
29
+ var ASPECT_BODY_SET = /* @__PURE__ */ new Set(ASPECT_BODY_NAMES);
30
+ var ASPECT_BODIES = /* @__PURE__ */ new Set(ASPECT_BODY_NAMES);
31
+ var STATIONARY_RELATIVE_SPEED = 1e-9;
32
+ function aspectMotion(a, b, angle) {
33
+ const relative = a.speed - b.speed;
34
+ if (!(Math.abs(relative) >= STATIONARY_RELATIVE_SPEED)) return "stationary";
35
+ const wrapped = ((a.lon - b.lon) % 360 + 360) % 360;
36
+ const signed = wrapped > 180 ? wrapped - 360 : wrapped;
37
+ const deviation = Math.abs(signed) - angle;
38
+ if (deviation === 0) return "separating";
39
+ return Math.sign(deviation) * Math.sign(signed) * relative < 0 ? "applying" : "separating";
40
+ }
41
+ function separation(a, b) {
42
+ const difference = Math.abs(((a - b) % 360 + 360) % 360);
43
+ return difference > 180 ? 360 - difference : difference;
44
+ }
45
+ function matchAspect(aBody, aLongitude, bBody, bLongitude) {
46
+ const distance = separation(aLongitude, bLongitude);
47
+ const hasLuminary = LUMINARIES.has(aBody) || LUMINARIES.has(bBody);
48
+ let best = null;
49
+ for (const definition of ASPECTS) {
50
+ const orb = Math.abs(distance - definition.angle);
51
+ const maximum = hasLuminary ? definition.luminaryOrb : definition.orb;
52
+ if (orb <= maximum && (!best || orb < best.orb)) {
53
+ best = { definition, orb };
54
+ }
55
+ }
56
+ return best;
57
+ }
58
+ function findAspects(bodies) {
59
+ const candidates = bodies.filter((body) => ASPECT_BODY_SET.has(body.body));
60
+ const aspects = [];
61
+ for (let first = 0; first < candidates.length; first += 1) {
62
+ for (let second = first + 1; second < candidates.length; second += 1) {
63
+ const a = candidates[first];
64
+ const b = candidates[second];
65
+ if (!a || !b) continue;
66
+ const match = matchAspect(a.body, a.lon, b.body, b.lon);
67
+ if (!match) continue;
68
+ aspects.push({
69
+ a: a.body,
70
+ b: b.body,
71
+ type: match.definition.type,
72
+ orb: match.orb,
73
+ applying: aspectMotion(a, b, match.definition.angle) === "applying"
74
+ });
75
+ }
76
+ }
77
+ return aspects.sort((a, b) => a.orb - b.orb);
78
+ }
79
+
80
+ // src/types.ts
81
+ var ENGINE_VERSION = "1.1.0";
82
+ var EPHEMERIS = /* @__PURE__ */ Object.freeze({ name: "astronomy-engine", version: "2.1.19" });
83
+
84
+ export {
85
+ ASPECT_TYPES,
86
+ ASPECTS,
87
+ ASPECT_BODY_SET,
88
+ ASPECT_BODIES,
89
+ STATIONARY_RELATIVE_SPEED,
90
+ aspectMotion,
91
+ separation,
92
+ matchAspect,
93
+ findAspects,
94
+ ENGINE_VERSION,
95
+ EPHEMERIS
96
+ };
@@ -1,17 +1,18 @@
1
1
  import {
2
2
  DELTA_T_MODEL,
3
3
  deltaTAt
4
- } from "./chunk-ONBZ4HK7.js";
4
+ } from "./chunk-BHJXUY67.js";
5
5
 
6
6
  // src/reference-span.ts
7
- var REFERENCE_SPAN = Object.freeze({
7
+ var REFERENCE_SPAN = /* @__PURE__ */ Object.freeze({
8
8
  from: "1800-01-01T00:00:00.000Z",
9
9
  to: "2200-01-01T00:00:00.000Z"
10
10
  });
11
- var EPHEMERIS_SPAN = Object.freeze({
11
+ var EPHEMERIS_SPAN = /* @__PURE__ */ Object.freeze({
12
+ /** The scale of the bounds, as a label, like `fromTT` and `toTT`: not a TimeScaleName, which is lowercase. */
12
13
  timeScale: "TT",
13
14
  /** Days of Terrestrial Time from J2000.0, 2000-01-01T12:00 TT, inclusive. */
14
- daysFromJ2000: Object.freeze({ from: -73e4, to: 73e4 }),
15
+ daysFromJ2000: /* @__PURE__ */ Object.freeze({ from: -73e4, to: 73e4 }),
15
16
  /** The same bounds as Terrestrial Time labels (not UTC). */
16
17
  fromTT: "0001-04-30T12:00:00",
17
18
  toTT: "3998-09-03T12:00:00"
@@ -24,16 +25,16 @@ function outsideReferenceSpan(utc) {
24
25
  }
25
26
 
26
27
  // src/time-scale-data.ts
27
- var LEAP_SECOND_LIST = Object.freeze({
28
+ var LEAP_SECOND_LIST = /* @__PURE__ */ Object.freeze({
28
29
  source: "IERS leap-seconds.list, retrieved 2026-09-29",
29
30
  sha256: "db5a895f16853b03bfc865e8d68f9fc8710ef1740e3400c701cd46a5bbbc3433",
30
31
  /** The list's last update. */
31
32
  updated: "2026-07-06",
32
33
  /** The list's expiry: after it the last value is carried, not known. */
33
34
  expires: "2027-06-28",
34
- changes: Object.freeze([[41317, 10], [41499, 11], [41683, 12], [42048, 13], [42413, 14], [42778, 15], [43144, 16], [43509, 17], [43874, 18], [44239, 19], [44786, 20], [45151, 21], [45516, 22], [46247, 23], [47161, 24], [47892, 25], [48257, 26], [48804, 27], [49169, 28], [49534, 29], [50083, 30], [50630, 31], [51179, 32], [53736, 33], [54832, 34], [56109, 35], [57204, 36], [57754, 37]].map((change) => Object.freeze(change)))
35
+ changes: /* @__PURE__ */ Object.freeze(/* @__PURE__ */ [[41317, 10], [41499, 11], [41683, 12], [42048, 13], [42413, 14], [42778, 15], [43144, 16], [43509, 17], [43874, 18], [44239, 19], [44786, 20], [45151, 21], [45516, 22], [46247, 23], [47161, 24], [47892, 25], [48257, 26], [48804, 27], [49169, 28], [49534, 29], [50083, 30], [50630, 31], [51179, 32], [53736, 33], [54832, 34], [56109, 35], [57204, 36], [57754, 37]].map((change) => Object.freeze(change)))
35
36
  });
36
- var UT1_DATA = Object.freeze({
37
+ var UT1_DATA = /* @__PURE__ */ Object.freeze({
37
38
  version: "2026-09-24",
38
39
  source: "IERS finals2000A.all (Bulletin A), Last-Modified 2026-09-24T17:37:44Z",
39
40
  sha256: "cc80680ec05c91b65e7d02c6068fe0d44dd0998dc880551975092d2d14aa8e18",
@@ -61,26 +62,26 @@ var UT1_DATA = Object.freeze({
61
62
  /** The prediction's formal error every 10 days after observedTo, and on its last day, µs. */
62
63
  predictedErrors: [108, 934, 2308, 3408, 4391, 5301, 6160, 6979, 7766, 8526, 9264, 9982, 10683, 11369, 12041, 12701, 13349, 13986, 14614, 15233, 15844, 16447, 17042, 17630, 18212, 18788, 19358, 19922, 20481, 21035, 21584, 22128, 22668, 23203, 23735, 24262, 24786, 25306, 25410]
63
64
  });
65
+ var UT1_FROM_MS = 63072e6;
66
+ var UT1_FINALS_FROM_MS = 947808e5;
67
+ var UT1_OBSERVED_TO_MS = 1790208e6;
68
+ var UT1_TO_MS = 18224352e5;
69
+ var UT1_GRID_BEFORE = 122;
70
+ var LEAP_SECONDS_EXPIRE_MS = 18141408e5;
64
71
 
65
72
  // src/time-scale.ts
66
- var TIME_SCALE_NAMES = Object.freeze(["utc", "ut1", "tt"]);
73
+ var TIME_SCALE_NAMES = /* @__PURE__ */ Object.freeze(["utc", "ut1", "tt"]);
67
74
  var DELTA_T_IERS_MODEL = "iers-utc/1";
68
75
  var DAY = 864e5;
69
76
  var J2000_MS = Date.UTC(2e3, 0, 1, 12);
70
77
  var MJD_UNIX = 40587;
71
78
  var LEAP_SECONDS_FROM = Date.UTC(1972, 0, 1);
72
- var TABLE_FROM = (UT1_DATA.from - MJD_UNIX) * DAY;
73
- var FINALS_FROM = (UT1_DATA.finalsFrom - MJD_UNIX) * DAY;
74
- var TABLE_TO = (UT1_DATA.to - MJD_UNIX) * DAY;
75
- var OBSERVED_TO = (UT1_DATA.observedTo - MJD_UNIX) * DAY;
76
- var EXPIRES = Date.parse(`${LEAP_SECOND_LIST.expires}T00:00:00Z`);
77
- var GRID_BEFORE = Math.floor((UT1_DATA.finalsFrom - UT1_DATA.from - 1) / UT1_DATA.step);
78
79
  var UT1_FALLBACK_BAND = 0.9;
79
80
  var ALPHABET = "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~";
80
81
  var knots;
81
82
  function decode() {
82
83
  const { packed, radix, first, slope } = UT1_DATA;
83
- const count = GRID_BEFORE + Math.ceil((UT1_DATA.to - UT1_DATA.finalsFrom) / UT1_DATA.step) + 1;
84
+ const count = UT1_GRID_BEFORE + Math.ceil((UT1_DATA.to - UT1_DATA.finalsFrom) / UT1_DATA.step) + 1;
84
85
  const values = new Float64Array(count);
85
86
  values[0] = first;
86
87
  let step = slope;
@@ -110,27 +111,27 @@ function taiMinusUtcAtTai(taiMs) {
110
111
  }
111
112
  function ut1MinusTai(utcMs) {
112
113
  knots ??= decode();
113
- const days = (utcMs - FINALS_FROM) / DAY;
114
- const gridFrom = -GRID_BEFORE * UT1_DATA.step;
114
+ const days = (utcMs - UT1_FINALS_FROM_MS) / DAY;
115
+ const gridFrom = -UT1_GRID_BEFORE * UT1_DATA.step;
115
116
  if (days < gridFrom) {
116
- const fraction2 = (utcMs - TABLE_FROM) / DAY / (gridFrom - (UT1_DATA.from - UT1_DATA.finalsFrom));
117
+ const fraction2 = (utcMs - UT1_FROM_MS) / DAY / (gridFrom - (UT1_DATA.from - UT1_DATA.finalsFrom));
117
118
  return (UT1_DATA.head + fraction2 * (knots[0] - UT1_DATA.head)) / 1e3;
118
119
  }
119
120
  const last = knots.length - 1;
120
- const k = Math.min(last - 1, GRID_BEFORE + Math.floor(days / UT1_DATA.step));
121
- const start = (k - GRID_BEFORE) * UT1_DATA.step;
121
+ const k = Math.min(last - 1, UT1_GRID_BEFORE + Math.floor(days / UT1_DATA.step));
122
+ const start = (k - UT1_GRID_BEFORE) * UT1_DATA.step;
122
123
  const end = k + 1 === last ? UT1_DATA.to - UT1_DATA.finalsFrom : start + UT1_DATA.step;
123
124
  const fraction = (days - start) / (end - start);
124
125
  return (knots[k] + fraction * (knots[k + 1] - knots[k])) / 1e3;
125
126
  }
126
127
  function ut1Sigma(utcMs) {
127
- if (utcMs < FINALS_FROM) return UT1_DATA.earlyError / 1e6 + UT1_DATA.bound;
128
- if (utcMs <= OBSERVED_TO) {
128
+ if (utcMs < UT1_FINALS_FROM_MS) return UT1_DATA.earlyError / 1e6 + UT1_DATA.bound;
129
+ if (utcMs <= UT1_OBSERVED_TO_MS) {
129
130
  const year = new Date(utcMs).getUTCFullYear() - UT1_DATA.firstYear;
130
131
  const errors2 = UT1_DATA.observedErrors;
131
132
  return errors2[Math.max(0, Math.min(errors2.length - 1, year))] / 1e6 + UT1_DATA.bound;
132
133
  }
133
- const days = (utcMs - OBSERVED_TO) / DAY - 1;
134
+ const days = (utcMs - UT1_OBSERVED_TO_MS) / DAY - 1;
134
135
  const errors = UT1_DATA.predictedErrors;
135
136
  const k = Math.max(0, Math.min(errors.length - 2, Math.floor(days / 10)));
136
137
  const span = k + 1 === errors.length - 1 ? UT1_DATA.to - UT1_DATA.observedTo - 1 - 10 * k : 10;
@@ -142,11 +143,11 @@ function tableUt1MinusUtc(utcMs, taiMinusUtc) {
142
143
  return {
143
144
  seconds: ut1MinusTai(utcMs) + taiMinusUtc,
144
145
  sigma: ut1Sigma(utcMs),
145
- source: utcMs <= OBSERVED_TO ? "observed" : "predicted"
146
+ source: utcMs <= UT1_OBSERVED_TO_MS ? "observed" : "predicted"
146
147
  };
147
148
  }
148
149
  function ut1MinusUtcAt(utcMs) {
149
- if (utcMs < TABLE_FROM || utcMs > TABLE_TO) return fallback();
150
+ if (utcMs < UT1_FROM_MS || utcMs > UT1_TO_MS) return fallback();
150
151
  return tableUt1MinusUtc(utcMs, taiMinusUtcAt(utcMs));
151
152
  }
152
153
  var modelDeltaT = (ut1Ms) => deltaTAt((ut1Ms - J2000_MS) / DAY);
@@ -168,10 +169,10 @@ function timeBasis(ms, scale = "utc", pin) {
168
169
  return record(ms, ms + (ut1MinusUtc?.seconds ?? 0) * 1e3, deltaT, "pinned", ut1MinusUtc, null);
169
170
  }
170
171
  const utc = scale === "tt" ? ms - modelDeltaT(ms).seconds * 1e3 : ms;
171
- if (utc < LEAP_SECONDS_FROM || utc > TABLE_TO) {
172
+ if (utc < LEAP_SECONDS_FROM || utc > UT1_TO_MS) {
172
173
  let ut1Ms2 = ms;
173
174
  if (scale === "tt") for (let round = 0; round < 4; round += 1) ut1Ms2 = ms - modelDeltaT(ut1Ms2).seconds * 1e3;
174
- return record(ut1Ms2, ut1Ms2, modelDeltaT(ut1Ms2), "delta-t", utc > TABLE_TO && scale !== "ut1" ? fallback() : null, null);
175
+ return record(ut1Ms2, ut1Ms2, modelDeltaT(ut1Ms2), "delta-t", utc > UT1_TO_MS && scale !== "ut1" ? fallback() : null, null);
175
176
  }
176
177
  let taiMs;
177
178
  let taiMinusUtc;
@@ -199,7 +200,7 @@ function timeBasis(ms, scale = "utc", pin) {
199
200
  },
200
201
  "iers",
201
202
  scale === "ut1" ? { ...ut1, seconds: (ut1Ms - utcMs) / 1e3 } : ut1,
202
- { taiMinusUtc, listed: utcMs < EXPIRES }
203
+ { taiMinusUtc, listed: utcMs < LEAP_SECONDS_EXPIRE_MS }
203
204
  );
204
205
  }
205
206
  var MODEL_KNOTS_FROM = (1941 - 2e3) * 365.25;
@@ -1,12 +1,12 @@
1
1
  // src/deltat.ts
2
2
  var DELTA_T_MODEL = "zodiacs-deltat/1";
3
- var DELTA_T_TABLE = Object.freeze({
3
+ var DELTA_T_TABLE = /* @__PURE__ */ Object.freeze({
4
4
  version: "2026-09-24",
5
5
  digest: "6371988c510a1c6c",
6
6
  from: 1941,
7
7
  observedTo: 61307,
8
8
  predictedTo: 61680,
9
- knots: Object.freeze([
9
+ knots: /* @__PURE__ */ Object.freeze([
10
10
  2482,
11
11
  48,
12
12
  47,
@@ -261,6 +261,7 @@ function sigma(t) {
261
261
  return v;
262
262
  }
263
263
  function deltaTAt(ut) {
264
+ if (!Number.isFinite(ut)) throw new RangeError("deltaTAt takes a finite UT: days since 2000-01-01T12:00 on UT1.");
264
265
  const t = 2e3 + ut / 365.25;
265
266
  if (!X) init();
266
267
  return {
@@ -273,6 +274,7 @@ function deltaTAt(ut) {
273
274
  };
274
275
  }
275
276
  function deltaT(ut) {
277
+ if (!Number.isFinite(ut)) throw new RangeError("deltaT takes a finite UT: days since 2000-01-01T12:00 on UT1.");
276
278
  if (!X) init();
277
279
  return seconds(2e3 + ut / 365.25);
278
280
  }
@@ -41,15 +41,15 @@ function validateBirthSettings(birth) {
41
41
  ...latitude === void 0 ? {} : { latitude, longitude }
42
42
  };
43
43
  }
44
- var FLAGS = [
45
- "dst-gap",
46
- "dst-fold",
47
- "lmt",
44
+ var DERIVED_FLAGS = [
48
45
  "no-time",
49
46
  "polar-fallback",
50
- "outside-reference-span"
47
+ "outside-reference-span",
48
+ "delta-t-extrapolated",
49
+ "de440-unavailable",
50
+ "outside-de440-span"
51
51
  ];
52
- var DERIVED_FLAGS = ["no-time", "polar-fallback", "outside-reference-span"];
52
+ var FLAGS = ["dst-gap", "dst-fold", "lmt", ...DERIVED_FLAGS];
53
53
  function snapshotFlags(value) {
54
54
  const length = Array.isArray(value) ? Object.getOwnPropertyDescriptor(value, "length")?.value : void 0;
55
55
  if (typeof length !== "number" || !Number.isInteger(length) || length < 0 || length > 64) {
@@ -0,0 +1,18 @@
1
+ // src/time-bands.ts
2
+ var isBand = (value) => typeof value === "number" && value >= 0 && value <= 1e10;
3
+ function timeBands(record) {
4
+ const { deltaT, timeScale } = Object(record);
5
+ const { input, basis, ut1MinusUtc } = Object(timeScale);
6
+ const d = deltaT?.sigma === null ? 0 : deltaT?.sigma;
7
+ const u = ut1MinusUtc === null ? 0 : ut1MinusUtc?.sigma;
8
+ if (!isBand(d) || !isBand(u) || !["utc", "ut1", "tt"].includes(input) || !["iers", "delta-t", "pinned"].includes(basis)) {
9
+ throw new RangeError("timeBands takes the deltaT and timeScale that a time basis, a chart or a calc instant records.");
10
+ }
11
+ if (input === "tt") return { tt: 0, ut1: d };
12
+ if (input === "ut1") return { tt: d, ut1: 0 };
13
+ return { tt: basis === "iers" ? 0 : basis === "pinned" ? u : Math.hypot(u, d), ut1: u };
14
+ }
15
+
16
+ export {
17
+ timeBands
18
+ };
@@ -1,9 +1,9 @@
1
+ import {
2
+ computeBodies
3
+ } from "./chunk-QLIEEICB.js";
1
4
  import {
2
5
  dateFrom
3
6
  } from "./chunk-CPALRSPC.js";
4
- import {
5
- computeBodies
6
- } from "./chunk-WOU7JVD3.js";
7
7
 
8
8
  // src/progressions.ts
9
9
  var PROGRESSION_DAYS_PER_YEAR = 365.2422;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  normalizeLongitude
3
- } from "./chunk-2OWGBT3O.js";
3
+ } from "./chunk-RMBWKZI2.js";
4
4
 
5
5
  // src/houses.ts
6
6
  var DEG = Math.PI / 180;
7
7
  var RAD = 180 / Math.PI;
8
- var HOUSE_SYSTEMS = [
8
+ var HOUSE_SYSTEMS = /* @__PURE__ */ Object.freeze([
9
9
  "whole",
10
10
  "placidus",
11
11
  "porphyry",
@@ -19,8 +19,8 @@ var HOUSE_SYSTEMS = [
19
19
  "alcabitius",
20
20
  "morinus",
21
21
  "meridian"
22
- ];
23
- var POLAR_UNDEFINED_HOUSE_SYSTEMS = ["placidus", "koch"];
22
+ ]);
23
+ var POLAR_UNDEFINED_HOUSE_SYSTEMS = /* @__PURE__ */ Object.freeze(["placidus", "koch"]);
24
24
  var POLAR_FALLBACK = "whole";
25
25
  var PLACIDUS_POLAR_FALLBACK = POLAR_FALLBACK;
26
26
  function isPolarUndefinedHouseSystem(system) {
@@ -0,0 +1,41 @@
1
+ // src/convention-ids.ts
2
+ var NAMESPACE = /^[A-Za-z][A-Za-z0-9-]*$/u;
3
+ var VALUE = /^[^\s\p{Cc}\p{Cf}\p{Cs}]+$/u;
4
+ function conventionId(namespace, value) {
5
+ if (typeof namespace !== "string" || !NAMESPACE.test(namespace))
6
+ throw new RangeError("A convention namespace is a letter, then letters, digits or hyphens.");
7
+ if (typeof value !== "string" || !VALUE.test(value))
8
+ throw new RangeError("A convention value is not empty and has no white space, control character or lone surrogate.");
9
+ return `${namespace}:${value}`;
10
+ }
11
+ function natalConventionIds(envelope) {
12
+ const { receipt, result } = envelope;
13
+ const ids = /* @__PURE__ */ new Set();
14
+ for (const fields of [receipt.conventions, receipt.coverage])
15
+ for (const [key, value] of Object.entries(fields)) ids.add(conventionId(key, value));
16
+ const { requested, actual, absenceReason } = receipt.houses;
17
+ for (const system of [requested, actual]) if (system !== null) ids.add(conventionId("house", system));
18
+ if (absenceReason !== null) ids.add(conventionId("house-absence", absenceReason));
19
+ for (const flag of [...receipt.inputFlags, ...receipt.resultFlags]) ids.add(conventionId("flag", flag));
20
+ ids.add(conventionId("reference", receipt.reference));
21
+ if (receipt.timeScale !== void 0) ids.add(conventionId("time-scale", receipt.timeScale));
22
+ const ephemeris = receipt.engine.ephemeris;
23
+ if (ephemeris !== void 0)
24
+ ids.add(conventionId("ephemeris", `${ephemeris.name}@${ephemeris.version}`));
25
+ if (result.deltaT !== void 0) {
26
+ ids.add(conventionId("deltat-model", result.deltaT.model));
27
+ ids.add(conventionId("deltat-segment", result.deltaT.segment));
28
+ }
29
+ if (result.timeScale !== void 0) {
30
+ ids.add(conventionId("time-scale", result.timeScale.input));
31
+ ids.add(conventionId("time-basis", result.timeScale.basis));
32
+ if (result.timeScale.ut1MinusUtc !== null)
33
+ ids.add(conventionId("ut1-source", result.timeScale.ut1MinusUtc.source));
34
+ }
35
+ return [...ids].sort();
36
+ }
37
+
38
+ export {
39
+ conventionId,
40
+ natalConventionIds
41
+ };