@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.
- package/CHANGELOG.md +797 -6
- package/LICENSING.md +354 -21
- package/NOTICE +166 -9
- package/README.md +327 -84
- package/dist/api-VOW6Umy5.d.ts +197 -0
- package/dist/calc.d.ts +279 -0
- package/dist/calc.js +853 -0
- package/dist/{chunk-NAJ735VN.js → chunk-2OWGBT3O.js} +1 -1
- package/dist/{chunk-4OSOCZY2.js → chunk-4NV4ZEFZ.js} +21 -6
- package/dist/chunk-A3U2ZS2W.js +29 -0
- package/dist/chunk-I7O5EGFV.js +25 -0
- package/dist/chunk-KFTJMMG7.js +61 -0
- package/dist/chunk-KHBLFXFG.js +227 -0
- package/dist/chunk-L6ZHWJZ6.js +355 -0
- package/dist/chunk-N4B5JNMA.js +473 -0
- package/dist/chunk-O3NJRGJ2.js +56 -0
- package/dist/{chunk-RETEVD4F.js → chunk-WOU7JVD3.js} +293 -154
- 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 +28 -166
- package/dist/houses-extra.d.ts +81 -0
- package/dist/houses-extra.js +337 -0
- package/dist/houses-q1O2GGp4.d.ts +128 -0
- package/dist/index.d.ts +8 -201
- package/dist/index.js +38 -315
- package/dist/internal-math-CmJ9xtaW.d.ts +160 -0
- package/dist/internal-math.d.ts +3 -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 +74 -29
- package/dist/receipt.js +194 -33
- package/dist/rulers-9wljfVaO.d.ts +10 -0
- package/dist/sky.d.ts +158 -0
- package/dist/sky.js +377 -0
- package/dist/techniques.d.ts +410 -0
- package/dist/techniques.js +830 -0
- package/dist/timing.d.ts +473 -0
- package/dist/timing.js +904 -0
- package/dist/{types-CeafogFp.d.ts → types-B4MCoCCS.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 +393 -0
- package/dist/vedic.js +930 -0
- package/dist/window.d.ts +178 -0
- package/dist/window.js +961 -0
- package/package.json +31 -3
- package/dist/chunk-GFT24GFR.js +0 -25
- package/dist/internal-math-BE2hcSHd.d.ts +0 -271
package/dist/geo.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { H as HouseSystem,
|
|
1
|
+
import { H as HouseSystem, f as BirthInput } from './types-B4MCoCCS.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 };
|
package/dist/geo.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
GREGORIAN_ADOPTION,
|
|
3
|
+
GREGORIAN_ADOPTION_SOURCES,
|
|
4
|
+
TZDB,
|
|
5
|
+
calendarNote,
|
|
6
|
+
gregorianAdoption,
|
|
7
|
+
offsetAt,
|
|
8
|
+
prepareLocalTime,
|
|
9
|
+
resolveBirth,
|
|
10
|
+
resolveLocalBirth,
|
|
11
|
+
resolveLocalToUtc,
|
|
12
|
+
zoneOffsetAt
|
|
13
|
+
} from "./chunk-N4B5JNMA.js";
|
|
14
|
+
import {
|
|
15
|
+
gregorianToJulian,
|
|
16
|
+
julianToGregorian
|
|
17
|
+
} from "./chunk-KFTJMMG7.js";
|
|
18
|
+
import "./chunk-PFGUCNOK.js";
|
|
4
19
|
|
|
5
20
|
// src/geo/geonames.ts
|
|
6
21
|
var fold = (value) => value.normalize("NFD").replace(/[\u0300-\u036f]/gu, "").toLowerCase();
|
|
@@ -141,172 +156,19 @@ function createGeoNamesClient(options) {
|
|
|
141
156
|
}
|
|
142
157
|
};
|
|
143
158
|
}
|
|
144
|
-
|
|
145
|
-
// src/geo/timezone.ts
|
|
146
|
-
var offsetFormatters = /* @__PURE__ */ new Map();
|
|
147
|
-
var wallFormatters = /* @__PURE__ */ new Map();
|
|
148
|
-
function validateTimeZone(timeZone) {
|
|
149
|
-
if (typeof timeZone !== "string" || timeZone.trim().length === 0) {
|
|
150
|
-
throw new RangeError("timeZone must be an explicit nonempty timezone string.");
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function offsetFormatter(timeZone) {
|
|
154
|
-
validateTimeZone(timeZone);
|
|
155
|
-
let formatter = offsetFormatters.get(timeZone);
|
|
156
|
-
if (!formatter) {
|
|
157
|
-
formatter = new Intl.DateTimeFormat("en-US", {
|
|
158
|
-
timeZone,
|
|
159
|
-
calendar: "gregory",
|
|
160
|
-
numberingSystem: "latn",
|
|
161
|
-
timeZoneName: "longOffset"
|
|
162
|
-
});
|
|
163
|
-
offsetFormatters.set(timeZone, formatter);
|
|
164
|
-
}
|
|
165
|
-
return formatter;
|
|
166
|
-
}
|
|
167
|
-
function wallFormatter(timeZone) {
|
|
168
|
-
validateTimeZone(timeZone);
|
|
169
|
-
let formatter = wallFormatters.get(timeZone);
|
|
170
|
-
if (!formatter) {
|
|
171
|
-
formatter = new Intl.DateTimeFormat("en-US", {
|
|
172
|
-
timeZone,
|
|
173
|
-
calendar: "gregory",
|
|
174
|
-
numberingSystem: "latn",
|
|
175
|
-
era: "short",
|
|
176
|
-
year: "numeric",
|
|
177
|
-
month: "2-digit",
|
|
178
|
-
day: "2-digit",
|
|
179
|
-
hour: "2-digit",
|
|
180
|
-
minute: "2-digit",
|
|
181
|
-
second: "2-digit",
|
|
182
|
-
fractionalSecondDigits: 3,
|
|
183
|
-
hourCycle: "h23"
|
|
184
|
-
});
|
|
185
|
-
wallFormatters.set(timeZone, formatter);
|
|
186
|
-
}
|
|
187
|
-
return formatter;
|
|
188
|
-
}
|
|
189
|
-
function offsetAt(timeZone, utcMilliseconds) {
|
|
190
|
-
if (typeof utcMilliseconds !== "number" || !Number.isFinite(utcMilliseconds)) {
|
|
191
|
-
throw new RangeError("utcMilliseconds must be a finite epoch-millisecond timestamp.");
|
|
192
|
-
}
|
|
193
|
-
const name = offsetFormatter(timeZone).formatToParts(utcMilliseconds).find((part) => part.type === "timeZoneName")?.value;
|
|
194
|
-
const match = (name ?? "GMT").match(/^GMT(?:([+-])(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?)?$/u);
|
|
195
|
-
if (!match) {
|
|
196
|
-
throw new RangeError(`Could not read UTC offset for timezone: ${timeZone}`);
|
|
197
|
-
}
|
|
198
|
-
const sign = match[1] === "-" ? -1 : 1;
|
|
199
|
-
return sign * (Number(match[2] ?? 0) * 60 + Number(match[3] ?? 0) + Number(match[4] ?? 0) / 60);
|
|
200
|
-
}
|
|
201
|
-
function wallStringAt(timeZone, utcMilliseconds) {
|
|
202
|
-
const parts = wallFormatter(timeZone).formatToParts(utcMilliseconds);
|
|
203
|
-
const part = (type) => parts.find((candidate) => candidate.type === type)?.value ?? "";
|
|
204
|
-
const era = part("era");
|
|
205
|
-
if (era !== "AD" && era !== "BC") {
|
|
206
|
-
throw new RangeError(`Could not read Gregorian era for timezone: ${timeZone}`);
|
|
207
|
-
}
|
|
208
|
-
const year = era === "BC" ? 1 - Number(part("year")) : Number(part("year"));
|
|
209
|
-
const isoYear = year >= 0 && year <= 9999 ? String(year).padStart(4, "0") : `${year < 0 ? "-" : "+"}${String(Math.abs(year)).padStart(6, "0")}`;
|
|
210
|
-
return `${isoYear}-${part("month").padStart(2, "0")}-${part("day").padStart(2, "0")}T${part("hour").padStart(2, "0")}:${part("minute").padStart(2, "0")}:${part("second").padStart(2, "0")}.${part("fractionalSecond").padStart(3, "0")}`;
|
|
211
|
-
}
|
|
212
|
-
function wallMilliseconds(date, time) {
|
|
213
|
-
if (typeof date !== "string" || typeof time !== "string") {
|
|
214
|
-
throw new RangeError("Local date/time must use YYYY-MM-DD and HH:MM strings.");
|
|
215
|
-
}
|
|
216
|
-
const dateMatch = date.match(/^(\d{4})-(\d{2})-(\d{2})$/u);
|
|
217
|
-
const timeMatch = time.match(/^(\d{2}):(\d{2})$/u);
|
|
218
|
-
if (!dateMatch || dateMatch[0] !== date || !timeMatch || timeMatch[0] !== time) {
|
|
219
|
-
throw new RangeError("Local date/time must use YYYY-MM-DD and HH:MM.");
|
|
220
|
-
}
|
|
221
|
-
const year = Number(dateMatch[1]);
|
|
222
|
-
const month = Number(dateMatch[2]);
|
|
223
|
-
const day = Number(dateMatch[3]);
|
|
224
|
-
const hour = Number(timeMatch[1]);
|
|
225
|
-
const minute = Number(timeMatch[2]);
|
|
226
|
-
if (month < 1 || month > 12 || hour > 23 || minute > 59) {
|
|
227
|
-
throw new RangeError("Local date/time contains an out-of-range field.");
|
|
228
|
-
}
|
|
229
|
-
const check = /* @__PURE__ */ new Date(0);
|
|
230
|
-
check.setUTCFullYear(year, month - 1, day);
|
|
231
|
-
check.setUTCHours(hour, minute, 0, 0);
|
|
232
|
-
if (check.getUTCFullYear() !== year || check.getUTCMonth() !== month - 1 || check.getUTCDate() !== day) {
|
|
233
|
-
throw new RangeError("Local date is not a calendar date.");
|
|
234
|
-
}
|
|
235
|
-
return check.getTime();
|
|
236
|
-
}
|
|
237
|
-
function resolveLocalToUtc(date, time, timeZone) {
|
|
238
|
-
const localMilliseconds = wallMilliseconds(date, time);
|
|
239
|
-
const wall = `${date}T${time}:00.000`;
|
|
240
|
-
const sampledOffsets = [
|
|
241
|
-
offsetAt(timeZone, localMilliseconds - 36 * 36e5),
|
|
242
|
-
offsetAt(timeZone, localMilliseconds),
|
|
243
|
-
offsetAt(timeZone, localMilliseconds + 36 * 36e5)
|
|
244
|
-
];
|
|
245
|
-
const candidates = [...new Set(sampledOffsets)];
|
|
246
|
-
const matches = [];
|
|
247
|
-
for (const offset of candidates) {
|
|
248
|
-
const utcMilliseconds = localMilliseconds - Math.round(offset * 6e4);
|
|
249
|
-
if (wallStringAt(timeZone, utcMilliseconds) === wall) {
|
|
250
|
-
matches.push({
|
|
251
|
-
utcMilliseconds,
|
|
252
|
-
offset: offsetAt(timeZone, utcMilliseconds)
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
const flags = [];
|
|
257
|
-
let chosen;
|
|
258
|
-
if (matches.length === 1) {
|
|
259
|
-
const match = matches[0];
|
|
260
|
-
if (!match) throw new Error("Timezone match disappeared.");
|
|
261
|
-
chosen = match;
|
|
262
|
-
} else if (matches.length > 1) {
|
|
263
|
-
matches.sort((a, b) => a.utcMilliseconds - b.utcMilliseconds);
|
|
264
|
-
const match = matches[0];
|
|
265
|
-
if (!match) throw new Error("Timezone fold match disappeared.");
|
|
266
|
-
chosen = match;
|
|
267
|
-
flags.push("dst-fold");
|
|
268
|
-
} else {
|
|
269
|
-
const before = offsetAt(timeZone, localMilliseconds - 36 * 36e5);
|
|
270
|
-
const utcMilliseconds = localMilliseconds - Math.round(before * 6e4);
|
|
271
|
-
chosen = {
|
|
272
|
-
utcMilliseconds,
|
|
273
|
-
offset: offsetAt(timeZone, utcMilliseconds)
|
|
274
|
-
};
|
|
275
|
-
flags.push("dst-gap");
|
|
276
|
-
}
|
|
277
|
-
if (Math.abs(chosen.offset % 1) > 1e-9) flags.push("lmt");
|
|
278
|
-
return {
|
|
279
|
-
utc: new Date(chosen.utcMilliseconds),
|
|
280
|
-
offsetMinutes: chosen.offset,
|
|
281
|
-
flags
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
function resolveBirth(input) {
|
|
285
|
-
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
286
|
-
throw new RangeError("birth must be an object containing a local date and timezone.");
|
|
287
|
-
}
|
|
288
|
-
const settings = validateBirthSettings(input);
|
|
289
|
-
const time = input.time;
|
|
290
|
-
const timeKnown = settings.timeKnown ?? time !== void 0;
|
|
291
|
-
if (timeKnown && time === void 0) {
|
|
292
|
-
throw new RangeError("time is required when timeKnown is true.");
|
|
293
|
-
}
|
|
294
|
-
const resolution = resolveLocalToUtc(
|
|
295
|
-
input.date,
|
|
296
|
-
time === void 0 ? "12:00" : time,
|
|
297
|
-
input.timeZone
|
|
298
|
-
);
|
|
299
|
-
return {
|
|
300
|
-
utc: resolution.utc,
|
|
301
|
-
timeKnown,
|
|
302
|
-
houseSystem: settings.houseSystem ?? "whole",
|
|
303
|
-
flags: resolution.flags,
|
|
304
|
-
...settings.latitude === void 0 ? {} : { latitude: settings.latitude, longitude: settings.longitude }
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
159
|
export {
|
|
160
|
+
GREGORIAN_ADOPTION,
|
|
161
|
+
GREGORIAN_ADOPTION_SOURCES,
|
|
162
|
+
TZDB,
|
|
163
|
+
calendarNote,
|
|
308
164
|
createGeoNamesClient,
|
|
165
|
+
gregorianAdoption,
|
|
166
|
+
gregorianToJulian,
|
|
167
|
+
julianToGregorian,
|
|
309
168
|
offsetAt,
|
|
169
|
+
prepareLocalTime,
|
|
310
170
|
resolveBirth,
|
|
311
|
-
|
|
171
|
+
resolveLocalBirth,
|
|
172
|
+
resolveLocalToUtc,
|
|
173
|
+
zoneOffsetAt
|
|
312
174
|
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { A as AngleInput } from './houses-q1O2GGp4.js';
|
|
2
|
+
import { H as HouseSystem, A as Angles } from './types-B4MCoCCS.js';
|
|
3
|
+
import './deltat.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `@zodiacs/engine/houses`: the house position of a body with ecliptic
|
|
7
|
+
* latitude, the co-ascendants and the polar ascendant, and the speeds of the
|
|
8
|
+
* cusps and the angles. Every function takes the `AngleInput` that
|
|
9
|
+
* `computeAngles` and `computeHouses` take. The entry imports no ephemeris
|
|
10
|
+
* and no module of the root entry. docs/houses.md gives each definition and
|
|
11
|
+
* its source.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The rate of sidereal time: degrees of RAMC per day of UT1,
|
|
18
|
+
* 360.98564736629 (J. Meeus, Astronomical Algorithms, 2nd ed., eq. 12.4).
|
|
19
|
+
* Speeds are derivatives with respect to the RAMC times this rate.
|
|
20
|
+
*/
|
|
21
|
+
declare const SIDEREAL_RATE = 360.98564736629;
|
|
22
|
+
/** A body's ecliptic longitude and latitude, degrees; the latitude defaults to 0. */
|
|
23
|
+
interface EclipticPosition {
|
|
24
|
+
lon: number;
|
|
25
|
+
lat?: number;
|
|
26
|
+
}
|
|
27
|
+
/** The four points of Swiss Ephemeris's `ascmc[4]` to `ascmc[7]`, degrees in [0, 360). */
|
|
28
|
+
interface CoAscendants {
|
|
29
|
+
/** The ecliptic point at right ascension RAMC + 90°: the ascendant at latitude 0. */
|
|
30
|
+
equatorialAscendant: number;
|
|
31
|
+
/** Walter Koch's: the ascendant for RAMC + 180° at the latitude, plus 180°. */
|
|
32
|
+
kochCoAscendant: number;
|
|
33
|
+
/** Michael Munkasey's: the ascendant for the RAMC at the colatitude. */
|
|
34
|
+
munkaseyCoAscendant: number;
|
|
35
|
+
/** Michael Munkasey's polar ascendant: the ascendant for RAMC + 180° at the latitude. */
|
|
36
|
+
polarAscendant: number;
|
|
37
|
+
}
|
|
38
|
+
/** Speeds in degrees per day, at the sidereal rate, with latitude and obliquity fixed. */
|
|
39
|
+
interface HouseSpeeds {
|
|
40
|
+
/** The system of the cusps: the one asked for, or whole sign where Placidus or Koch falls back. */
|
|
41
|
+
system: HouseSystem;
|
|
42
|
+
fellBack: boolean;
|
|
43
|
+
/** In the order of `computeHouses`'s cusps: index 0 is the 1st house. */
|
|
44
|
+
cusps: number[];
|
|
45
|
+
/** The ascendant and descendant share a speed, as do the midheaven and imum coeli. */
|
|
46
|
+
angles: Angles;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The house position of a body in `system`, as Swiss Ephemeris's
|
|
50
|
+
* `swe_house_pos` defines it: a number in [1, 13) whose integer part is the
|
|
51
|
+
* house and whose fraction is how far through the house the body is, so that
|
|
52
|
+
* (position − 1) × 30 is its mundane position in degrees. The body's ecliptic
|
|
53
|
+
* latitude enters through the system's own house circles (docs/houses.md).
|
|
54
|
+
* `null` where the system does not define a position: Koch, where the body
|
|
55
|
+
* lies outside the house circles of its half of the sky or the midheaven
|
|
56
|
+
* never rises; Topocentric, where no circle passes through a body that never
|
|
57
|
+
* rises or sets. Invalid input throws RangeError.
|
|
58
|
+
*/
|
|
59
|
+
declare function housePosition(system: HouseSystem, input: AngleInput, body: EclipticPosition): number | null;
|
|
60
|
+
/**
|
|
61
|
+
* The equatorial ascendant, Koch's and Munkasey's co-ascendants and
|
|
62
|
+
* Munkasey's polar ascendant (Swiss Ephemeris's `ascmc[4]` to `ascmc[7]`).
|
|
63
|
+
* Each is the ecliptic point of an oblique ascension under a pole, taken as
|
|
64
|
+
* the formula gives it: inside the polar circle (and, for Munkasey's
|
|
65
|
+
* co-ascendant, within 90° − ε of the equator) it can lie west of the
|
|
66
|
+
* meridian, and it is not turned east as the ascendant is.
|
|
67
|
+
*/
|
|
68
|
+
declare function coAscendants(input: AngleInput): CoAscendants;
|
|
69
|
+
/**
|
|
70
|
+
* The speeds of the cusps `computeHouses(system, input, …)` returns and of
|
|
71
|
+
* the four angles, in degrees per day: each derivative with respect to the
|
|
72
|
+
* RAMC, found analytically, times {@link SIDEREAL_RATE}, with the latitude
|
|
73
|
+
* and the obliquity held fixed. Where Placidus or Koch falls back to whole
|
|
74
|
+
* signs, the cusps are whole-sign cusps, whose speed is 0 except where the
|
|
75
|
+
* ascendant changes sign. A speed is not defined at the instants where a cusp
|
|
76
|
+
* jumps: whole-sign cusps at a change of sign, and every cusp that turns with
|
|
77
|
+
* the ascendant inside the polar circle. Invalid input throws RangeError.
|
|
78
|
+
*/
|
|
79
|
+
declare function houseSpeeds(system: HouseSystem, input: AngleInput): HouseSpeeds;
|
|
80
|
+
|
|
81
|
+
export { AngleInput, type CoAscendants, type EclipticPosition, type HouseSpeeds, SIDEREAL_RATE, coAscendants, housePosition, houseSpeeds };
|