kaabalah 5.4.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -57,7 +57,7 @@ function parsFortunae(asc, sunLon, moonLon, diurnal) {
57
57
  const val = diurnal ? asc + moonLon - sunLon : asc + sunLon - moonLon;
58
58
  return normalizeAngle(val);
59
59
  }
60
- var Planet, VirtualNodes, PLANET_AND_NODE_NAMES, HouseSystem, CalcFlag, SE_AST_OFFSET, BODY, normalizeAngle, SwissEph;
60
+ var Planet, VirtualNodes, PLANET_AND_NODE_NAMES, HouseSystem, CalcFlag, RiseTransitFlag, SE_ECL2HOR, SE_EQU2HOR, SE_AST_OFFSET, BODY, normalizeAngle, SwissEph;
61
61
  var init_swisseph = __esm({
62
62
  "wasm/src/swisseph.ts"() {
63
63
  "use strict";
@@ -130,6 +130,17 @@ var init_swisseph = __esm({
130
130
  CalcFlag2[CalcFlag2["SIDEREAL"] = 65536] = "SIDEREAL";
131
131
  return CalcFlag2;
132
132
  })(CalcFlag || {});
133
+ RiseTransitFlag = /* @__PURE__ */ ((RiseTransitFlag2) => {
134
+ RiseTransitFlag2[RiseTransitFlag2["RISE"] = 1] = "RISE";
135
+ RiseTransitFlag2[RiseTransitFlag2["SET"] = 2] = "SET";
136
+ RiseTransitFlag2[RiseTransitFlag2["UPPER_MERIDIAN"] = 4] = "UPPER_MERIDIAN";
137
+ RiseTransitFlag2[RiseTransitFlag2["LOWER_MERIDIAN"] = 8] = "LOWER_MERIDIAN";
138
+ RiseTransitFlag2[RiseTransitFlag2["DISC_CENTER"] = 256] = "DISC_CENTER";
139
+ RiseTransitFlag2[RiseTransitFlag2["NO_REFRACTION"] = 512] = "NO_REFRACTION";
140
+ return RiseTransitFlag2;
141
+ })(RiseTransitFlag || {});
142
+ SE_ECL2HOR = 0;
143
+ SE_EQU2HOR = 1;
133
144
  SE_AST_OFFSET = 1e4;
134
145
  BODY = {
135
146
  MEAN_APOGEE: 12,
@@ -156,6 +167,8 @@ var init_swisseph = __esm({
156
167
  this.swe_close = null;
157
168
  this.swe_set_topo = null;
158
169
  this.swe_set_sid_mode = null;
170
+ this.swe_azalt_fn = null;
171
+ this.swe_rise_trans_fn = null;
159
172
  this.module = module2;
160
173
  this.swe_julday = this.module.cwrap("swe_julday", "number", [
161
174
  "number",
@@ -200,6 +213,16 @@ var init_swisseph = __esm({
200
213
  null,
201
214
  ["number", "number", "number"]
202
215
  );
216
+ this.swe_azalt_fn = this.module.cwrap(
217
+ "swe_azalt",
218
+ null,
219
+ ["number", "number", "number", "number", "number", "number", "number"]
220
+ );
221
+ this.swe_rise_trans_fn = this.module.cwrap(
222
+ "swe_rise_trans",
223
+ "number",
224
+ ["number", "number", "number", "number", "number", "number", "number", "number", "number", "number"]
225
+ );
203
226
  }
204
227
  checkInitialized() {
205
228
  if (!this.module) {
@@ -406,6 +429,105 @@ var init_swisseph = __esm({
406
429
  const id2 = kind === "mean" ? BODY.MEAN_APOGEE : BODY.OSC_APOGEE;
407
430
  return this.calculatePlanetPosition(julday, id2, flags);
408
431
  }
432
+ /**
433
+ * Convert ecliptic (or equatorial) coordinates to horizon coordinates.
434
+ * Returns azimuth (0=south, 90=west, 180=north, 270=east) and altitude.
435
+ */
436
+ azalt(julday, longitude, latitude, altitude, xinLon, xinLat, xinDist, fromEquatorial = false) {
437
+ this.checkInitialized();
438
+ if (!this.swe_azalt_fn) {
439
+ throw new Error("swe_azalt function not available");
440
+ }
441
+ const BYTES = 8;
442
+ const geoPtr = this.module._malloc(3 * BYTES);
443
+ const xinPtr = this.module._malloc(3 * BYTES);
444
+ const xazPtr = this.module._malloc(3 * BYTES);
445
+ if (!geoPtr || !xinPtr || !xazPtr) {
446
+ if (geoPtr) this.module._free(geoPtr);
447
+ if (xinPtr) this.module._free(xinPtr);
448
+ if (xazPtr) this.module._free(xazPtr);
449
+ throw new Error("Memory allocation failed for azalt");
450
+ }
451
+ try {
452
+ this.module.setValue(geoPtr, longitude, "double");
453
+ this.module.setValue(geoPtr + BYTES, latitude, "double");
454
+ this.module.setValue(geoPtr + 2 * BYTES, altitude, "double");
455
+ this.module.setValue(xinPtr, xinLon, "double");
456
+ this.module.setValue(xinPtr + BYTES, xinLat, "double");
457
+ this.module.setValue(xinPtr + 2 * BYTES, xinDist, "double");
458
+ this.swe_azalt_fn(
459
+ julday,
460
+ fromEquatorial ? SE_EQU2HOR : SE_ECL2HOR,
461
+ geoPtr,
462
+ 0,
463
+ // atpress (0 = default 1013.25 mbar)
464
+ 0,
465
+ // attemp (0 = default 15°C)
466
+ xinPtr,
467
+ xazPtr
468
+ );
469
+ return {
470
+ azimuth: this.module.getValue(xazPtr, "double"),
471
+ trueAltitude: this.module.getValue(xazPtr + BYTES, "double"),
472
+ apparentAltitude: this.module.getValue(xazPtr + 2 * BYTES, "double")
473
+ };
474
+ } finally {
475
+ this.module._free(geoPtr);
476
+ this.module._free(xinPtr);
477
+ this.module._free(xazPtr);
478
+ }
479
+ }
480
+ /**
481
+ * Find the next rise, set, or meridian transit of a planet.
482
+ * Returns the Julian day of the event.
483
+ */
484
+ riseTransit(julday, planet, rsmi, longitude, latitude, altitude = 0, flags = 2 /* SWISS_EPH */) {
485
+ this.checkInitialized();
486
+ if (!this.swe_rise_trans_fn) {
487
+ throw new Error("swe_rise_trans function not available");
488
+ }
489
+ const BYTES = 8;
490
+ const geoPtr = this.module._malloc(3 * BYTES);
491
+ const tretPtr = this.module._malloc(BYTES);
492
+ const ERR_BYTES = 512;
493
+ const errPtr = this.module._malloc(ERR_BYTES);
494
+ if (!geoPtr || !tretPtr || !errPtr) {
495
+ if (geoPtr) this.module._free(geoPtr);
496
+ if (tretPtr) this.module._free(tretPtr);
497
+ if (errPtr) this.module._free(errPtr);
498
+ throw new Error("Memory allocation failed for riseTransit");
499
+ }
500
+ this.module.HEAP8.fill(0, errPtr, errPtr + ERR_BYTES);
501
+ try {
502
+ this.module.setValue(geoPtr, longitude, "double");
503
+ this.module.setValue(geoPtr + BYTES, latitude, "double");
504
+ this.module.setValue(geoPtr + 2 * BYTES, altitude, "double");
505
+ const ret = this.swe_rise_trans_fn(
506
+ julday,
507
+ planet,
508
+ 0,
509
+ // starname pointer (0 = planet, not fixed star)
510
+ flags,
511
+ rsmi,
512
+ geoPtr,
513
+ 0,
514
+ // atpress
515
+ 0,
516
+ // attemp
517
+ tretPtr,
518
+ errPtr
519
+ );
520
+ if (ret < 0) {
521
+ const msg = this.module.UTF8ToString(errPtr);
522
+ throw new Error(msg || `swe_rise_trans failed with code ${ret}`);
523
+ }
524
+ return this.module.getValue(tretPtr, "double");
525
+ } finally {
526
+ this.module._free(geoPtr);
527
+ this.module._free(tretPtr);
528
+ this.module._free(errPtr);
529
+ }
530
+ }
409
531
  };
410
532
  }
411
533
  });
@@ -6908,6 +7030,31 @@ var require_swisseph_node = __commonJS({
6908
7030
  });
6909
7031
 
6910
7032
  // src/astrology/swisseph.ts
7033
+ var swisseph_exports = {};
7034
+ __export(swisseph_exports, {
7035
+ CalcFlag: () => CalcFlag,
7036
+ HouseSystem: () => HouseSystem,
7037
+ PLANET_AND_NODE_NAMES: () => PLANET_AND_NODE_NAMES,
7038
+ Planet: () => Planet,
7039
+ REQUIRED_EPHE_FILES: () => REQUIRED_EPHE_FILES,
7040
+ RiseTransitFlag: () => RiseTransitFlag,
7041
+ VirtualNodes: () => VirtualNodes,
7042
+ calcParsFortunae: () => calcParsFortunae,
7043
+ calculateAsteroidPosition: () => calculateAsteroidPosition,
7044
+ calculateAzalt: () => calculateAzalt,
7045
+ calculateEquatorialPosition: () => calculateEquatorialPosition,
7046
+ calculateHouses: () => calculateHouses,
7047
+ calculatePlanetaryPositions: () => calculatePlanetaryPositions,
7048
+ calculateRiseTransit: () => calculateRiseTransit,
7049
+ calculateSinglePlanetPosition: () => calculateSinglePlanetPosition,
7050
+ closeSwissEph: () => closeSwissEph,
7051
+ getJulianDay: () => getJulianDay,
7052
+ getSwissEph: () => getSwissEph,
7053
+ inspectVirtualEphemerisPath: () => inspectVirtualEphemerisPath,
7054
+ normalizeAngle: () => normalizeAngle,
7055
+ resolveNodeEphemerisPath: () => resolveNodeEphemerisPath,
7056
+ toUtcDate: () => toUtcDate
7057
+ });
6911
7058
  function normalizeVirtualPath(path) {
6912
7059
  if (path === "/") {
6913
7060
  return path;
@@ -7141,6 +7288,34 @@ function calculateSinglePlanetPosition(date, planet) {
7141
7288
  const julday = swissEph.getJulianDay(date);
7142
7289
  return swissEph.calculatePlanetPosition(julday, planet, DEFAULT_FLAGS);
7143
7290
  }
7291
+ function calculateEquatorialPosition(date, planet) {
7292
+ checkInitialization();
7293
+ const julday = swissEph.getJulianDay(date);
7294
+ const pos = swissEph.calculatePlanetPosition(
7295
+ julday,
7296
+ planet,
7297
+ 2 /* SWISS_EPH */ | 2048 /* EQUATORIAL */
7298
+ );
7299
+ return {
7300
+ rightAscension: pos.longitude,
7301
+ declination: pos.latitude,
7302
+ distance: pos.distance
7303
+ };
7304
+ }
7305
+ function getJulianDay(date) {
7306
+ checkInitialization();
7307
+ return swissEph.getJulianDay(date);
7308
+ }
7309
+ function calculateRiseTransit(date, planet, latitude, longitude, event) {
7310
+ checkInitialization();
7311
+ const julday = swissEph.getJulianDay(date);
7312
+ return swissEph.riseTransit(julday, planet, event, longitude, latitude);
7313
+ }
7314
+ function calculateAzalt(date, latitude, longitude, eclLon, eclLat, dist) {
7315
+ checkInitialization();
7316
+ const julday = swissEph.getJulianDay(date);
7317
+ return swissEph.azalt(julday, longitude, latitude, 0, eclLon, eclLat, dist);
7318
+ }
7144
7319
  async function calculatePlanetaryPositions(date) {
7145
7320
  try {
7146
7321
  checkInitialization();
@@ -7195,6 +7370,20 @@ async function calculateHouses(date, latitude, longitude, houseSystem, options =
7195
7370
  throw error;
7196
7371
  }
7197
7372
  }
7373
+ async function calculateAsteroidPosition(date, mpcNumber) {
7374
+ try {
7375
+ checkInitialization();
7376
+ const julday = swissEph.getJulianDay(date);
7377
+ return swissEph.calculateAsteroidPosition(
7378
+ julday,
7379
+ mpcNumber,
7380
+ DEFAULT_FLAGS
7381
+ );
7382
+ } catch (error) {
7383
+ console.error("Error calculating asteroid:", error);
7384
+ throw error;
7385
+ }
7386
+ }
7198
7387
  function calcParsFortunae(asc, sunLon, moonLon, isDiurnal) {
7199
7388
  return parsFortunae(asc, sunLon, moonLon, isDiurnal);
7200
7389
  }
@@ -7321,6 +7510,201 @@ var init_swisseph2 = __esm({
7321
7510
  }
7322
7511
  });
7323
7512
 
7513
+ // src/astrology/astrocartography.ts
7514
+ var astrocartography_exports = {};
7515
+ __export(astrocartography_exports, {
7516
+ ASTROCARTOGRAPHY_DEFAULT_PLANETS: () => ASTROCARTOGRAPHY_DEFAULT_PLANETS,
7517
+ computeAstrocartographyMap: () => computeAstrocartographyMap,
7518
+ computeEquatorialPositions: () => computeEquatorialPositions,
7519
+ computeGMST: () => computeGMST,
7520
+ computeHorizonLongitude: () => computeHorizonLongitude,
7521
+ computeICLongitude: () => computeICLongitude,
7522
+ computeMCLongitude: () => computeMCLongitude,
7523
+ findParansAtLatitude: () => findParansAtLatitude,
7524
+ geographicAngularDifference: () => geographicAngularDifference,
7525
+ queryAstrocartographyLocation: () => queryAstrocartographyLocation
7526
+ });
7527
+ function computeGMST(julianDay) {
7528
+ return normalizeAngle(
7529
+ 280.46061837 + 360.98564736629 * (julianDay - 2451545)
7530
+ );
7531
+ }
7532
+ function computeMCLongitude(gmst, ra) {
7533
+ return toGeoLon(normalizeAngle(gmst - ra));
7534
+ }
7535
+ function computeICLongitude(gmst, ra) {
7536
+ return toGeoLon(normalizeAngle(gmst - ra + 180));
7537
+ }
7538
+ function computeHorizonLongitude(gmst, ra, dec, latitude, angle) {
7539
+ const tanPhi = Math.tan(latitude * DEG);
7540
+ const tanDelta = Math.tan(dec * DEG);
7541
+ const cosH = -(tanPhi * tanDelta);
7542
+ if (Math.abs(cosH) > 1) return null;
7543
+ const H = Math.acos(cosH) / DEG;
7544
+ const lon = angle === "AC" ? normalizeAngle(gmst - ra - H) : normalizeAngle(gmst - ra + H);
7545
+ return toGeoLon(lon);
7546
+ }
7547
+ function geographicAngularDifference(a, b) {
7548
+ const d = normalizeAngle(a - b);
7549
+ return d > 180 ? 360 - d : d;
7550
+ }
7551
+ function toGeoLon(deg360) {
7552
+ const n = normalizeAngle(deg360);
7553
+ return n > 180 ? n - 360 : n;
7554
+ }
7555
+ function computeEquatorialPositions(date, planets = ASTROCARTOGRAPHY_DEFAULT_PLANETS) {
7556
+ const result = {};
7557
+ for (const p of planets) {
7558
+ const name = PLANET_AND_NODE_NAMES[p];
7559
+ const eq = calculateEquatorialPosition(date, p);
7560
+ result[name] = {
7561
+ ra: eq.rightAscension,
7562
+ dec: eq.declination,
7563
+ planetId: p
7564
+ };
7565
+ }
7566
+ return result;
7567
+ }
7568
+ function findParansAtLatitude(equatorialPositions, gmst, latitude, paranOrb = 1) {
7569
+ const ANGLES = ["MC", "IC", "AC", "DC"];
7570
+ const lines = [];
7571
+ for (const [name, eq] of Object.entries(equatorialPositions)) {
7572
+ for (const angle of ANGLES) {
7573
+ let lon;
7574
+ if (angle === "MC") lon = computeMCLongitude(gmst, eq.ra);
7575
+ else if (angle === "IC") lon = computeICLongitude(gmst, eq.ra);
7576
+ else lon = computeHorizonLongitude(gmst, eq.ra, eq.dec, latitude, angle);
7577
+ if (lon !== null) {
7578
+ lines.push({ planet: name, angle, longitude: lon });
7579
+ }
7580
+ }
7581
+ }
7582
+ const parans = [];
7583
+ for (let i = 0; i < lines.length; i++) {
7584
+ for (let j = i + 1; j < lines.length; j++) {
7585
+ const a = lines[i];
7586
+ const b = lines[j];
7587
+ if (a.planet === b.planet) continue;
7588
+ if (a.angle === b.angle) continue;
7589
+ const dist = geographicAngularDifference(a.longitude, b.longitude);
7590
+ if (dist <= paranOrb) {
7591
+ parans.push({
7592
+ latitude,
7593
+ planetA: a.planet,
7594
+ angleA: a.angle,
7595
+ longitudeA: a.longitude,
7596
+ planetB: b.planet,
7597
+ angleB: b.angle,
7598
+ longitudeB: b.longitude
7599
+ });
7600
+ }
7601
+ }
7602
+ }
7603
+ return parans;
7604
+ }
7605
+ function queryAstrocartographyLocation(date, options) {
7606
+ const {
7607
+ latitude,
7608
+ longitude,
7609
+ orb = 2,
7610
+ planets = ASTROCARTOGRAPHY_DEFAULT_PLANETS,
7611
+ paranOrb = 1
7612
+ } = options;
7613
+ const jd = getJulianDay(date);
7614
+ const gmst = computeGMST(jd);
7615
+ const positions = computeEquatorialPositions(date, planets);
7616
+ const lines = [];
7617
+ const ANGLES = ["MC", "IC", "AC", "DC"];
7618
+ for (const [name, eq] of Object.entries(positions)) {
7619
+ for (const angle of ANGLES) {
7620
+ let lineLon;
7621
+ if (angle === "MC") lineLon = computeMCLongitude(gmst, eq.ra);
7622
+ else if (angle === "IC") lineLon = computeICLongitude(gmst, eq.ra);
7623
+ else
7624
+ lineLon = computeHorizonLongitude(
7625
+ gmst,
7626
+ eq.ra,
7627
+ eq.dec,
7628
+ latitude,
7629
+ angle
7630
+ );
7631
+ if (lineLon === null) continue;
7632
+ const dist = geographicAngularDifference(longitude, lineLon);
7633
+ lines.push({
7634
+ planet: name,
7635
+ angle,
7636
+ distance: Math.round(dist * 1e3) / 1e3,
7637
+ active: dist <= orb,
7638
+ longitude: Math.round(lineLon * 1e3) / 1e3
7639
+ });
7640
+ }
7641
+ }
7642
+ lines.sort((a, b) => a.distance - b.distance);
7643
+ const activeLines = lines.filter((l) => l.active);
7644
+ const parans = findParansAtLatitude(positions, gmst, latitude, paranOrb);
7645
+ return { queryLatitude: latitude, queryLongitude: longitude, orb, lines, activeLines, parans };
7646
+ }
7647
+ function computeAstrocartographyMap(date, options = {}) {
7648
+ const {
7649
+ latitudeStep = 1,
7650
+ latitudeRange = 66.5,
7651
+ planets = ASTROCARTOGRAPHY_DEFAULT_PLANETS
7652
+ } = options;
7653
+ const jd = getJulianDay(date);
7654
+ const gmst = computeGMST(jd);
7655
+ const positions = computeEquatorialPositions(date, planets);
7656
+ const meridianLines = [];
7657
+ const horizonLines = [];
7658
+ for (const [name, eq] of Object.entries(positions)) {
7659
+ meridianLines.push({
7660
+ planet: name,
7661
+ angle: "MC",
7662
+ longitude: Math.round(computeMCLongitude(gmst, eq.ra) * 1e3) / 1e3
7663
+ });
7664
+ meridianLines.push({
7665
+ planet: name,
7666
+ angle: "IC",
7667
+ longitude: Math.round(computeICLongitude(gmst, eq.ra) * 1e3) / 1e3
7668
+ });
7669
+ for (const angle of ["AC", "DC"]) {
7670
+ const points = [];
7671
+ for (let lat = -latitudeRange; lat <= latitudeRange; lat += latitudeStep) {
7672
+ const lon = computeHorizonLongitude(gmst, eq.ra, eq.dec, lat, angle);
7673
+ if (lon !== null) {
7674
+ points.push({
7675
+ latitude: Math.round(lat * 1e3) / 1e3,
7676
+ longitude: Math.round(lon * 1e3) / 1e3
7677
+ });
7678
+ }
7679
+ }
7680
+ horizonLines.push({ planet: name, angle, points });
7681
+ }
7682
+ }
7683
+ return { meridianLines, horizonLines };
7684
+ }
7685
+ var ASTROCARTOGRAPHY_DEFAULT_PLANETS, DEG;
7686
+ var init_astrocartography = __esm({
7687
+ "src/astrology/astrocartography.ts"() {
7688
+ "use strict";
7689
+ init_swisseph2();
7690
+ ASTROCARTOGRAPHY_DEFAULT_PLANETS = [
7691
+ 0 /* SUN */,
7692
+ 1 /* MOON */,
7693
+ 2 /* MERCURY */,
7694
+ 3 /* VENUS */,
7695
+ 4 /* MARS */,
7696
+ 5 /* JUPITER */,
7697
+ 6 /* SATURN */,
7698
+ 7 /* URANUS */,
7699
+ 8 /* NEPTUNE */,
7700
+ 9 /* PLUTO */,
7701
+ 15 /* CHIRON */,
7702
+ 11 /* TRUE_NODE */
7703
+ ];
7704
+ DEG = Math.PI / 180;
7705
+ }
7706
+ });
7707
+
7324
7708
  // src/astrology/aspects.ts
7325
7709
  function getAspectMatch(lonA, lonB, specs = DEFAULT_ASPECT_SPECS) {
7326
7710
  const a = normalizeAngle(lonA);
@@ -7759,6 +8143,7 @@ var init_firdaria = __esm({
7759
8143
  // src/astrology/index.ts
7760
8144
  var astrology_exports = {};
7761
8145
  __export(astrology_exports, {
8146
+ ASTROCARTOGRAPHY_DEFAULT_PLANETS: () => ASTROCARTOGRAPHY_DEFAULT_PLANETS,
7762
8147
  CalcFlag: () => CalcFlag,
7763
8148
  DEFAULT_ASPECT_SPECS: () => DEFAULT_ASPECT_SPECS,
7764
8149
  DOMICILE_RULERS: () => DOMICILE_RULERS,
@@ -7766,16 +8151,25 @@ __export(astrology_exports, {
7766
8151
  HouseSystem: () => HouseSystem,
7767
8152
  PLANET_AND_NODE_NAMES: () => PLANET_AND_NODE_NAMES,
7768
8153
  Planet: () => Planet,
8154
+ RiseTransitFlag: () => RiseTransitFlag,
7769
8155
  SIGNS: () => SIGNS,
7770
8156
  SLOW_PLANETS: () => SLOW_PLANETS,
7771
8157
  VirtualNodes: () => VirtualNodes,
7772
8158
  closeSwissEph: () => closeSwissEph,
7773
8159
  computeAspects: () => computeAspects,
8160
+ computeAstrocartographyMap: () => computeAstrocartographyMap,
8161
+ computeEquatorialPositions: () => computeEquatorialPositions,
8162
+ computeGMST: () => computeGMST,
8163
+ computeHorizonLongitude: () => computeHorizonLongitude,
8164
+ computeICLongitude: () => computeICLongitude,
8165
+ computeMCLongitude: () => computeMCLongitude,
7774
8166
  computeMidpoints: () => computeMidpoints,
7775
8167
  computeSynastryAspects: () => computeSynastryAspects,
7776
8168
  computeTransitAspects: () => computeTransitAspects,
7777
8169
  findHouseOf: () => findHouseOf,
8170
+ findParansAtLatitude: () => findParansAtLatitude,
7778
8171
  formatDegreeMinutes: () => formatDegreeMinutes,
8172
+ geographicAngularDifference: () => geographicAngularDifference,
7779
8173
  getAnnualProfection: () => getAnnualProfection,
7780
8174
  getAspectMatch: () => getAspectMatch,
7781
8175
  getBirthChart: () => getBirthChart,
@@ -7797,6 +8191,7 @@ __export(astrology_exports, {
7797
8191
  getTransitRange: () => getTransitRange,
7798
8192
  getZodiacPosition: () => getZodiacPosition,
7799
8193
  normalizeAngle: () => normalizeAngle,
8194
+ queryAstrocartographyLocation: () => queryAstrocartographyLocation,
7800
8195
  shorterArcMidpoint: () => shorterArcMidpoint
7801
8196
  });
7802
8197
  function validateInputs(options) {
@@ -8304,6 +8699,7 @@ var init_astrology = __esm({
8304
8699
  "src/astrology/index.ts"() {
8305
8700
  "use strict";
8306
8701
  init_swisseph2();
8702
+ init_astrocartography();
8307
8703
  init_aspects();
8308
8704
  init_dignity();
8309
8705
  init_decans();
@@ -8339,7 +8735,7 @@ var import_config3 = require("dotenv/config");
8339
8735
  // package.json
8340
8736
  var package_default = {
8341
8737
  name: "kaabalah",
8342
- version: "5.4.0",
8738
+ version: "5.5.0",
8343
8739
  description: "The de-facto library for any esoteric calculations and tooling",
8344
8740
  engines: {
8345
8741
  node: ">=18.18.0"
@@ -8671,7 +9067,7 @@ var COMMANDS = [
8671
9067
  { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
8672
9068
  ],
8673
9069
  examples: [
8674
- "kaabalah astrology:transits 2001-10-02 19:45 --lat=-22.738 --lon=-47.334 --transit-date=2026-03-17 --json --compact",
9070
+ "kaabalah astrology:transits 1990-06-15 14:30 --lat=48.856 --lon=2.352 --transit-date=2026-03-17 --json --compact",
8675
9071
  "kaabalah astrology:transits 1990-01-15 14:30 --lat=40.71 --lon=-74 --from=2026-03-01 --to=2026-04-01 --json",
8676
9072
  "kaabalah astrology:transits 1990-01-15 --lat=40.71 --lon=-74 --aspects=major --transit-planets=saturn,pluto --json"
8677
9073
  ]
@@ -8698,7 +9094,7 @@ var COMMANDS = [
8698
9094
  { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
8699
9095
  ],
8700
9096
  examples: [
8701
- "kaabalah astrology:solar-return 2001-10-02 19:45 --lat=-22.738 --lon=-47.334 --year=2025 --json --compact",
9097
+ "kaabalah astrology:solar-return 1990-06-15 14:30 --lat=48.856 --lon=2.352 --year=2025 --json --compact",
8702
9098
  "kaabalah astrology:solar-return 1990-01-15 14:30 --lat=40.71 --lon=-74 --year=2026 --sr-lat=34.05 --sr-lon=-118.24 --json"
8703
9099
  ]
8704
9100
  },
@@ -8719,7 +9115,7 @@ var COMMANDS = [
8719
9115
  { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
8720
9116
  ],
8721
9117
  examples: [
8722
- "kaabalah astrology:profections 2001-10-02 19:45 --lat=-22.738 --lon=-47.334 --year=2026 --json --compact"
9118
+ "kaabalah astrology:profections 1990-06-15 14:30 --lat=48.856 --lon=2.352 --year=2026 --json --compact"
8723
9119
  ]
8724
9120
  },
8725
9121
  {
@@ -8739,7 +9135,7 @@ var COMMANDS = [
8739
9135
  { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
8740
9136
  ],
8741
9137
  examples: [
8742
- "kaabalah astrology:profections:monthly 2001-10-02 19:45 --lat=-22.738 --lon=-47.334 --year=2026 --json --compact"
9138
+ "kaabalah astrology:profections:monthly 1990-06-15 14:30 --lat=48.856 --lon=2.352 --year=2026 --json --compact"
8743
9139
  ]
8744
9140
  },
8745
9141
  {
@@ -8760,8 +9156,8 @@ var COMMANDS = [
8760
9156
  { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
8761
9157
  ],
8762
9158
  examples: [
8763
- "kaabalah astrology:firdaria 2001-10-02 19:45 --lat=-22.738 --lon=-47.334 --json --compact",
8764
- "kaabalah astrology:firdaria 2001-10-02 19:45 --lat=-22.738 --lon=-47.334 --target-date=2030-01-01 --json"
9159
+ "kaabalah astrology:firdaria 1990-06-15 14:30 --lat=48.856 --lon=2.352 --json --compact",
9160
+ "kaabalah astrology:firdaria 1990-06-15 14:30 --lat=48.856 --lon=2.352 --target-date=2030-01-01 --json"
8765
9161
  ]
8766
9162
  },
8767
9163
  {
@@ -8788,6 +9184,54 @@ var COMMANDS = [
8788
9184
  "kaabalah astrology:dodecatemoria 227.5 --json"
8789
9185
  ]
8790
9186
  },
9187
+ {
9188
+ name: "astrology:astrocartography",
9189
+ description: "Generate Astro*Carto*Graphy map (MC/IC/AC/DC lines for all planets)",
9190
+ args: [
9191
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9192
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9193
+ ],
9194
+ flags: [
9195
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9196
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9197
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9198
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9199
+ { name: "latitude-step", type: "number", description: "Degrees between latitude samples for AC/DC lines (default: 1)" },
9200
+ { name: "latitude-range", type: "number", description: "Maximum latitude to sweep (default: 66.5)" },
9201
+ { name: "house-system", type: "string", description: "House system (default: placidus)" },
9202
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9203
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9204
+ ],
9205
+ examples: [
9206
+ "kaabalah astrology:astrocartography 1990-06-15 14:30 --lat=48.856 --lon=2.352 --json --compact",
9207
+ "kaabalah astrology:astrocartography 1990-01-15 14:30 --lat=40.71 --lon=-74 --latitude-step=5 --json"
9208
+ ]
9209
+ },
9210
+ {
9211
+ name: "astrology:astrocartography:query",
9212
+ description: "Query a location for nearby astrocartography planetary lines and parans",
9213
+ args: [
9214
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9215
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9216
+ ],
9217
+ flags: [
9218
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9219
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9220
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9221
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9222
+ { name: "query-lat", type: "number", description: "Query latitude (-90 to 90)" },
9223
+ { name: "query-lon", type: "number", description: "Query longitude (-180 to 180)" },
9224
+ { name: "orb", type: "number", description: "Maximum distance in degrees to consider a line active (default: 2)" },
9225
+ { name: "paran-orb", type: "number", description: "Paran crossing orb in degrees (default: 1)" },
9226
+ { name: "house-system", type: "string", description: "House system (default: placidus)" },
9227
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9228
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9229
+ ],
9230
+ examples: [
9231
+ "kaabalah astrology:astrocartography:query 1990-06-15 14:30 --lat=48.856 --lon=2.352 --query-lat=51.5 --query-lon=-0.12 --orb=3 --json --compact",
9232
+ `kaabalah astrology:astrocartography:query --input-json='{"natal":{"date":"1990-06-15","time":"14:30","lat":48.856,"lon":2.352},"queryLat":51.5,"queryLon":-0.12,"orb":3}' --json --compact`
9233
+ ]
9234
+ },
8791
9235
  {
8792
9236
  name: "help",
8793
9237
  description: "Show help message",
@@ -10562,6 +11006,170 @@ Birth Chart: ${input.dateStr} ${input.timeStr}
10562
11006
  closeSwissEph2();
10563
11007
  }
10564
11008
  }
11009
+ async function cmdAstrologyAstrocartography(args, flags, inputPayload, executionContext) {
11010
+ const natalPayload = inputPayload?.natal;
11011
+ const effectiveArgs = natalPayload ? [] : args;
11012
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
11013
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
11014
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
11015
+ const { closeSwissEph: closeSwissEph2 } = astroModule;
11016
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
11017
+ astroModule.closeSwissEph();
11018
+ });
11019
+ const runtimePaths = getAstrologyRuntimePaths(flags);
11020
+ try {
11021
+ await initWasm(runtimePaths, executionContext);
11022
+ } catch (err) {
11023
+ releaseSwissEphCleanup();
11024
+ closeSwissEph2();
11025
+ executionContext.throwIfInterrupted();
11026
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
11027
+ }
11028
+ try {
11029
+ const { computeAstrocartographyMap: computeAstrocartographyMap2 } = await Promise.resolve().then(() => (init_astrocartography(), astrocartography_exports));
11030
+ const { toUtcDate: toUtcDate2 } = await Promise.resolve().then(() => (init_swisseph2(), swisseph_exports));
11031
+ const latStep = inputPayload?.latitudeStep != null ? Number(inputPayload.latitudeStep) : getFlagNumber(flags, "latitude-step");
11032
+ const latRange = inputPayload?.latitudeRange != null ? Number(inputPayload.latitudeRange) : getFlagNumber(flags, "latitude-range");
11033
+ const utcDate = await toUtcDate2(natalInput.birthDate, natalInput.latitude, natalInput.longitude, natalInput.timeZoneSettings);
11034
+ const map = computeAstrocartographyMap2(utcDate, {
11035
+ latitudeStep: latStep ?? 1,
11036
+ latitudeRange: latRange ?? 66.5
11037
+ });
11038
+ executionContext.throwIfInterrupted();
11039
+ if (isJsonMode(flags)) {
11040
+ outputJson({
11041
+ ...map,
11042
+ input: {
11043
+ date: natalInput.dateStr,
11044
+ time: natalInput.timeStr,
11045
+ lat: natalInput.latitude,
11046
+ lon: natalInput.longitude
11047
+ }
11048
+ }, flags);
11049
+ return;
11050
+ }
11051
+ console.log(`
11052
+ Astro*Carto*Graphy Map
11053
+ `);
11054
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
11055
+ console.log(`
11056
+ Meridian Lines (MC/IC):
11057
+ `);
11058
+ for (const line of map.meridianLines) {
11059
+ console.log(` ${line.planet.padEnd(14)} ${line.angle.padEnd(4)} ${line.longitude > 0 ? "+" : ""}${line.longitude.toFixed(2)}\xB0`);
11060
+ }
11061
+ console.log(`
11062
+ Horizon Lines (AC/DC): ${map.horizonLines.length} lines with ${map.horizonLines.reduce((s, l) => s + l.points.length, 0)} total points`);
11063
+ console.log();
11064
+ } catch (err) {
11065
+ rethrowInterruptedOrError(err, executionContext);
11066
+ } finally {
11067
+ releaseSwissEphCleanup();
11068
+ closeSwissEph2();
11069
+ }
11070
+ }
11071
+ async function cmdAstrologyAstrocartographyQuery(args, flags, inputPayload, executionContext) {
11072
+ const natalPayload = inputPayload?.natal;
11073
+ const effectiveArgs = natalPayload ? [] : args;
11074
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
11075
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
11076
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
11077
+ const { closeSwissEph: closeSwissEph2 } = astroModule;
11078
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
11079
+ astroModule.closeSwissEph();
11080
+ });
11081
+ const runtimePaths = getAstrologyRuntimePaths(flags);
11082
+ try {
11083
+ await initWasm(runtimePaths, executionContext);
11084
+ } catch (err) {
11085
+ releaseSwissEphCleanup();
11086
+ closeSwissEph2();
11087
+ executionContext.throwIfInterrupted();
11088
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
11089
+ }
11090
+ try {
11091
+ const { queryAstrocartographyLocation: queryAstrocartographyLocation2 } = await Promise.resolve().then(() => (init_astrocartography(), astrocartography_exports));
11092
+ const { toUtcDate: toUtcDate2 } = await Promise.resolve().then(() => (init_swisseph2(), swisseph_exports));
11093
+ const queryLat = inputPayload?.queryLat != null ? Number(inputPayload.queryLat) : getFlagNumber(flags, "query-lat");
11094
+ const queryLon = inputPayload?.queryLon != null ? Number(inputPayload.queryLon) : getFlagNumber(flags, "query-lon");
11095
+ const orb = inputPayload?.orb != null ? Number(inputPayload.orb) : getFlagNumber(flags, "orb");
11096
+ const paranOrb = inputPayload?.paranOrb != null ? Number(inputPayload.paranOrb) : getFlagNumber(flags, "paran-orb");
11097
+ if (queryLat == null || queryLon == null) {
11098
+ exitWithError("MISSING_ARGUMENT", "Query location is required. Use --query-lat=<N> --query-lon=<N>.", flags);
11099
+ }
11100
+ if (queryLat < -90 || queryLat > 90) {
11101
+ exitWithError("INVALID_ARGUMENT", `query-lat must be between -90 and 90, got ${queryLat}.`, flags);
11102
+ }
11103
+ if (queryLon < -180 || queryLon > 180) {
11104
+ exitWithError("INVALID_ARGUMENT", `query-lon must be between -180 and 180, got ${queryLon}.`, flags);
11105
+ }
11106
+ const utcDate = await toUtcDate2(natalInput.birthDate, natalInput.latitude, natalInput.longitude, natalInput.timeZoneSettings);
11107
+ const result = queryAstrocartographyLocation2(utcDate, {
11108
+ latitude: queryLat,
11109
+ longitude: queryLon,
11110
+ orb: orb ?? 2,
11111
+ paranOrb: paranOrb ?? 1
11112
+ });
11113
+ executionContext.throwIfInterrupted();
11114
+ if (isJsonMode(flags)) {
11115
+ outputJson({
11116
+ ...result,
11117
+ input: {
11118
+ natal: {
11119
+ date: natalInput.dateStr,
11120
+ time: natalInput.timeStr,
11121
+ lat: natalInput.latitude,
11122
+ lon: natalInput.longitude
11123
+ },
11124
+ queryLat,
11125
+ queryLon,
11126
+ orb: orb ?? 2
11127
+ }
11128
+ }, flags);
11129
+ return;
11130
+ }
11131
+ console.log(`
11132
+ Astrocartography Location Query
11133
+ `);
11134
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
11135
+ console.log(` Query: (${queryLat}, ${queryLon}) Orb: ${orb ?? 2}\xB0`);
11136
+ if (result.activeLines.length > 0) {
11137
+ console.log(`
11138
+ Active Lines (within ${orb ?? 2}\xB0 orb):
11139
+ `);
11140
+ for (const line of result.activeLines) {
11141
+ console.log(` ${line.planet.padEnd(14)} ${line.angle.padEnd(4)} ${line.distance.toFixed(2)}\xB0 away (line at ${line.longitude > 0 ? "+" : ""}${line.longitude.toFixed(2)}\xB0)`);
11142
+ }
11143
+ } else {
11144
+ console.log(`
11145
+ No active lines within ${orb ?? 2}\xB0 orb.`);
11146
+ }
11147
+ console.log(`
11148
+ All Lines (sorted by proximity):
11149
+ `);
11150
+ for (const line of result.lines.slice(0, 20)) {
11151
+ const marker = line.active ? "*" : " ";
11152
+ console.log(` ${marker} ${line.planet.padEnd(14)} ${line.angle.padEnd(4)} ${line.distance.toFixed(2)}\xB0`);
11153
+ }
11154
+ if (result.lines.length > 20) {
11155
+ console.log(` ... and ${result.lines.length - 20} more`);
11156
+ }
11157
+ if (result.parans.length > 0) {
11158
+ console.log(`
11159
+ Parans at latitude ${queryLat}\xB0:
11160
+ `);
11161
+ for (const p of result.parans) {
11162
+ console.log(` ${p.planetA} ${p.angleA} x ${p.planetB} ${p.angleB}`);
11163
+ }
11164
+ }
11165
+ console.log();
11166
+ } catch (err) {
11167
+ rethrowInterruptedOrError(err, executionContext);
11168
+ } finally {
11169
+ releaseSwissEphCleanup();
11170
+ closeSwissEph2();
11171
+ }
11172
+ }
10565
11173
 
10566
11174
  // src/core/constants.ts
10567
11175
  var FOUR_WORLDS = {
@@ -20467,6 +21075,12 @@ async function runCli(argv) {
20467
21075
  case "astrology:firdaria":
20468
21076
  await cmdAstrologyFirdaria(args.slice(1), flags, inputPayload, execution);
20469
21077
  return;
21078
+ case "astrology:astrocartography":
21079
+ await cmdAstrologyAstrocartography(args.slice(1), flags, inputPayload, execution);
21080
+ return;
21081
+ case "astrology:astrocartography:query":
21082
+ await cmdAstrologyAstrocartographyQuery(args.slice(1), flags, inputPayload, execution);
21083
+ return;
20470
21084
  case "astrology:decans":
20471
21085
  cmdAstrologyDecans(args.slice(1), flags, inputPayload);
20472
21086
  return;