kaabalah 3.0.0 → 3.2.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.
@@ -15,6 +15,8 @@ declare enum Planet {
15
15
  PLUTO = 9,
16
16
  MEAN_NODE = 10,
17
17
  TRUE_NODE = 11,
18
+ LILITH_MEAN = 12,
19
+ LILITH_TRUE = 13,
18
20
  CHIRON = 15
19
21
  }
20
22
  declare enum HouseSystem {
@@ -31,11 +33,18 @@ declare enum HouseSystem {
31
33
  ALCABITIUS = "B"
32
34
  }
33
35
  declare enum CalcFlag {
36
+ JPL_EPH = 1,
34
37
  SWISS_EPH = 2,
35
38
  MOSHIER = 4,
36
39
  HELIOCENTRIC = 8,
37
40
  TRUE_POS = 16,
38
- SPEED = 32
41
+ J2000 = 32,
42
+ NONUT = 64,
43
+ SPEED3 = 128,
44
+ SPEED = 256,
45
+ EQUATORIAL = 2048,
46
+ TOPOCTR = 32768,
47
+ SIDEREAL = 65536
39
48
  }
40
49
 
41
50
  /**
@@ -15,6 +15,8 @@ declare enum Planet {
15
15
  PLUTO = 9,
16
16
  MEAN_NODE = 10,
17
17
  TRUE_NODE = 11,
18
+ LILITH_MEAN = 12,
19
+ LILITH_TRUE = 13,
18
20
  CHIRON = 15
19
21
  }
20
22
  declare enum HouseSystem {
@@ -31,11 +33,18 @@ declare enum HouseSystem {
31
33
  ALCABITIUS = "B"
32
34
  }
33
35
  declare enum CalcFlag {
36
+ JPL_EPH = 1,
34
37
  SWISS_EPH = 2,
35
38
  MOSHIER = 4,
36
39
  HELIOCENTRIC = 8,
37
40
  TRUE_POS = 16,
38
- SPEED = 32
41
+ J2000 = 32,
42
+ NONUT = 64,
43
+ SPEED3 = 128,
44
+ SPEED = 256,
45
+ EQUATORIAL = 2048,
46
+ TOPOCTR = 32768,
47
+ SIDEREAL = 65536
39
48
  }
40
49
 
41
50
  /**
@@ -1,41 +1,41 @@
1
1
  'use strict';
2
2
 
3
- var chunkSZXDOHKV_js = require('../chunk-SZXDOHKV.js');
3
+ var chunk3JIIZ45K_js = require('../chunk-3JIIZ45K.js');
4
4
  require('../chunk-2TUXWMP5.js');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "CalcFlag", {
9
9
  enumerable: true,
10
- get: function () { return chunkSZXDOHKV_js.CalcFlag; }
10
+ get: function () { return chunk3JIIZ45K_js.CalcFlag; }
11
11
  });
12
12
  Object.defineProperty(exports, "HouseSystem", {
13
13
  enumerable: true,
14
- get: function () { return chunkSZXDOHKV_js.HouseSystem; }
14
+ get: function () { return chunk3JIIZ45K_js.HouseSystem; }
15
15
  });
16
16
  Object.defineProperty(exports, "Planet", {
17
17
  enumerable: true,
18
- get: function () { return chunkSZXDOHKV_js.Planet; }
18
+ get: function () { return chunk3JIIZ45K_js.Planet; }
19
19
  });
20
20
  Object.defineProperty(exports, "closeSwissEph", {
21
21
  enumerable: true,
22
- get: function () { return chunkSZXDOHKV_js.closeSwissEph; }
22
+ get: function () { return chunk3JIIZ45K_js.closeSwissEph; }
23
23
  });
24
24
  Object.defineProperty(exports, "formatDegreeMinutes", {
25
25
  enumerable: true,
26
- get: function () { return chunkSZXDOHKV_js.formatDegreeMinutes; }
26
+ get: function () { return chunk3JIIZ45K_js.formatDegreeMinutes; }
27
27
  });
28
28
  Object.defineProperty(exports, "getBirthChart", {
29
29
  enumerable: true,
30
- get: function () { return chunkSZXDOHKV_js.getBirthChart; }
30
+ get: function () { return chunk3JIIZ45K_js.getBirthChart; }
31
31
  });
32
32
  Object.defineProperty(exports, "getSwissEph", {
33
33
  enumerable: true,
34
- get: function () { return chunkSZXDOHKV_js.getSwissEph; }
34
+ get: function () { return chunk3JIIZ45K_js.getSwissEph; }
35
35
  });
36
36
  Object.defineProperty(exports, "getZodiacPosition", {
37
37
  enumerable: true,
38
- get: function () { return chunkSZXDOHKV_js.getZodiacPosition; }
38
+ get: function () { return chunk3JIIZ45K_js.getZodiacPosition; }
39
39
  });
40
40
  //# sourceMappingURL=index.js.map
41
41
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- export { CalcFlag, HouseSystem, Planet, closeSwissEph, formatDegreeMinutes, getBirthChart, getSwissEph, getZodiacPosition } from '../chunk-AV7WBVPS.mjs';
1
+ export { CalcFlag, HouseSystem, Planet, closeSwissEph, formatDegreeMinutes, getBirthChart, getSwissEph, getZodiacPosition } from '../chunk-O2LE2NXP.mjs';
2
2
  import '../chunk-PY5SMMJB.mjs';
3
3
  //# sourceMappingURL=index.mjs.map
4
4
  //# sourceMappingURL=index.mjs.map
@@ -3050,6 +3050,8 @@ var Planet = /* @__PURE__ */ ((Planet2) => {
3050
3050
  Planet2[Planet2["PLUTO"] = 9] = "PLUTO";
3051
3051
  Planet2[Planet2["MEAN_NODE"] = 10] = "MEAN_NODE";
3052
3052
  Planet2[Planet2["TRUE_NODE"] = 11] = "TRUE_NODE";
3053
+ Planet2[Planet2["LILITH_MEAN"] = 12] = "LILITH_MEAN";
3054
+ Planet2[Planet2["LILITH_TRUE"] = 13] = "LILITH_TRUE";
3053
3055
  Planet2[Planet2["CHIRON"] = 15] = "CHIRON";
3054
3056
  return Planet2;
3055
3057
  })(Planet || {});
@@ -3068,13 +3070,25 @@ var HouseSystem = /* @__PURE__ */ ((HouseSystem2) => {
3068
3070
  return HouseSystem2;
3069
3071
  })(HouseSystem || {});
3070
3072
  var CalcFlag = /* @__PURE__ */ ((CalcFlag2) => {
3073
+ CalcFlag2[CalcFlag2["JPL_EPH"] = 1] = "JPL_EPH";
3071
3074
  CalcFlag2[CalcFlag2["SWISS_EPH"] = 2] = "SWISS_EPH";
3072
3075
  CalcFlag2[CalcFlag2["MOSHIER"] = 4] = "MOSHIER";
3073
3076
  CalcFlag2[CalcFlag2["HELIOCENTRIC"] = 8] = "HELIOCENTRIC";
3074
3077
  CalcFlag2[CalcFlag2["TRUE_POS"] = 16] = "TRUE_POS";
3075
- CalcFlag2[CalcFlag2["SPEED"] = 32] = "SPEED";
3078
+ CalcFlag2[CalcFlag2["J2000"] = 32] = "J2000";
3079
+ CalcFlag2[CalcFlag2["NONUT"] = 64] = "NONUT";
3080
+ CalcFlag2[CalcFlag2["SPEED3"] = 128] = "SPEED3";
3081
+ CalcFlag2[CalcFlag2["SPEED"] = 256] = "SPEED";
3082
+ CalcFlag2[CalcFlag2["EQUATORIAL"] = 2048] = "EQUATORIAL";
3083
+ CalcFlag2[CalcFlag2["TOPOCTR"] = 32768] = "TOPOCTR";
3084
+ CalcFlag2[CalcFlag2["SIDEREAL"] = 65536] = "SIDEREAL";
3076
3085
  return CalcFlag2;
3077
3086
  })(CalcFlag || {});
3087
+ var SE_AST_OFFSET = 1e4;
3088
+ var BODY = {
3089
+ MEAN_APOGEE: 12,
3090
+ // Lilith mean
3091
+ OSC_APOGEE: 13};
3078
3092
  var SwissEph = class {
3079
3093
  /**
3080
3094
  * Constructor that accepts a pre-initialized Swiss Ephemeris module
@@ -3086,13 +3100,17 @@ var SwissEph = class {
3086
3100
  this.swe_house_pos = null;
3087
3101
  this.swe_set_ephe_path = null;
3088
3102
  this.swe_close = null;
3103
+ this.swe_set_topo = null;
3104
+ this.swe_set_sid_mode = null;
3089
3105
  this.module = module;
3090
3106
  this.swe_julday = this.module.cwrap("swe_julday", "number", ["number", "number", "number", "number", "number"]);
3091
3107
  this.swe_calc_ut = this.module.cwrap("swe_calc_ut", "number", ["number", "number", "number", "number"]);
3092
- this.swe_houses = this.module.cwrap("swe_houses", "number", ["number", "number", "number", "string", "number", "number"]);
3108
+ this.swe_houses = this.module.cwrap("swe_houses", "number", ["number", "number", "number", "number", "number", "number"]);
3093
3109
  this.swe_house_pos = this.module.cwrap("swe_house_pos", "number", ["number", "number", "number", "string", "number", "number"]);
3094
3110
  this.swe_set_ephe_path = this.module.cwrap("swe_set_ephe_path", null, ["number"]);
3095
3111
  this.swe_close = this.module.cwrap("swe_close", null, []);
3112
+ this.swe_set_topo = this.module.cwrap("swe_set_topo", null, ["number", "number", "number"]);
3113
+ this.swe_set_sid_mode = this.module.cwrap("swe_set_sid_mode", null, ["number", "number", "number"]);
3096
3114
  }
3097
3115
  checkInitialized() {
3098
3116
  if (!this.module) {
@@ -3151,7 +3169,7 @@ var SwissEph = class {
3151
3169
  latitude: this.module.getValue(resultPtr + 8, "double"),
3152
3170
  distance: this.module.getValue(resultPtr + 16, "double")
3153
3171
  };
3154
- if (flags & 32 /* SPEED */) {
3172
+ if (flags & 256 /* SPEED */) {
3155
3173
  position.longitudeSpeed = this.module.getValue(resultPtr + 24, "double");
3156
3174
  position.latitudeSpeed = this.module.getValue(resultPtr + 32, "double");
3157
3175
  position.distanceSpeed = this.module.getValue(resultPtr + 40, "double");
@@ -3183,7 +3201,8 @@ var SwissEph = class {
3183
3201
  const housesPtr = memoryPtr;
3184
3202
  const ascmcPtr = memoryPtr + 12 * 8;
3185
3203
  try {
3186
- const ret = this.swe_houses(julday, latitude, longitude, hsys.toString(), housesPtr, ascmcPtr);
3204
+ const hsysCode = hsys.charCodeAt(0);
3205
+ const ret = this.swe_houses(julday, latitude, longitude, hsysCode, housesPtr, ascmcPtr);
3187
3206
  if (ret < 0) {
3188
3207
  throw new Error(`Houses calculation failed with error code ${ret}`);
3189
3208
  }
@@ -3192,9 +3211,27 @@ var SwissEph = class {
3192
3211
  const value = this.module.getValue(housesPtr + i * 8, "double");
3193
3212
  houses.push(value);
3194
3213
  }
3195
- const ascendant = this.module.getValue(ascmcPtr, "double");
3214
+ const ascendant = this.module.getValue(ascmcPtr + 0, "double");
3196
3215
  const mc = this.module.getValue(ascmcPtr + 8, "double");
3197
- return { ascendant, mc, houses };
3216
+ const armc = this.module.getValue(ascmcPtr + 16, "double");
3217
+ const vertex = this.module.getValue(ascmcPtr + 24, "double");
3218
+ const equasc = this.module.getValue(ascmcPtr + 32, "double");
3219
+ const coasc1 = this.module.getValue(ascmcPtr + 40, "double");
3220
+ const coasc2 = this.module.getValue(ascmcPtr + 48, "double");
3221
+ const polasc = this.module.getValue(ascmcPtr + 56, "double");
3222
+ return {
3223
+ ascendant,
3224
+ mc,
3225
+ houses,
3226
+ ascmc: {
3227
+ armc,
3228
+ vertex,
3229
+ equasc,
3230
+ coasc1,
3231
+ coasc2,
3232
+ polasc
3233
+ }
3234
+ };
3198
3235
  } finally {
3199
3236
  this.module._free(memoryPtr);
3200
3237
  }
@@ -3208,10 +3245,42 @@ var SwissEph = class {
3208
3245
  this.swe_close();
3209
3246
  }
3210
3247
  }
3248
+ /**
3249
+ * Set topocentric observer
3250
+ */
3251
+ setTopocentric(longitude, latitude, altitudeMeters = 0) {
3252
+ this.checkInitialized();
3253
+ if (!this.swe_set_topo) {
3254
+ throw new Error("Topocentric calculation function not available");
3255
+ }
3256
+ this.swe_set_topo(longitude, latitude, altitudeMeters);
3257
+ }
3258
+ /**
3259
+ * Set sidereal mode
3260
+ * Ex.: mode=1 (Lahiri). See Swiss Ephemeris mode table.
3261
+ */
3262
+ setSiderealMode(mode, t0 = 0, ayan_t0 = 0) {
3263
+ this.checkInitialized();
3264
+ this.swe_set_sid_mode?.(mode, t0, ayan_t0);
3265
+ }
3266
+ /**
3267
+ * Asteroid by MPC number
3268
+ */
3269
+ calculateAsteroidPosition(julday, mpcNumber, flags = 2 /* SWISS_EPH */) {
3270
+ return this.calculatePlanetPosition(julday, SE_AST_OFFSET + mpcNumber, flags);
3271
+ }
3272
+ /**
3273
+ * Lilith mean (12) and true (13)
3274
+ */
3275
+ calculateLilith(julday, kind = "mean", flags = 2 /* SWISS_EPH */) {
3276
+ const id = kind === "mean" ? BODY.MEAN_APOGEE : BODY.OSC_APOGEE;
3277
+ return this.calculatePlanetPosition(julday, id, flags);
3278
+ }
3211
3279
  };
3212
3280
 
3213
3281
  // src/astrology/swisseph.ts
3214
3282
  var swissEph = null;
3283
+ var DEFAULT_FLAGS = 2 /* SWISS_EPH */ | 256 /* SPEED */;
3215
3284
  async function getSwissEph(options = {}) {
3216
3285
  if (swissEph) {
3217
3286
  return;
@@ -3236,6 +3305,7 @@ async function calculatePlanetaryPositions(date) {
3236
3305
  try {
3237
3306
  checkInitialization();
3238
3307
  const julday = swissEph.getJulianDay(date);
3308
+ const flags = DEFAULT_FLAGS;
3239
3309
  const planets = {
3240
3310
  sun: 0 /* SUN */,
3241
3311
  moon: 1 /* MOON */,
@@ -3243,12 +3313,21 @@ async function calculatePlanetaryPositions(date) {
3243
3313
  venus: 3 /* VENUS */,
3244
3314
  mars: 4 /* MARS */,
3245
3315
  jupiter: 5 /* JUPITER */,
3246
- saturn: 6 /* SATURN */
3316
+ saturn: 6 /* SATURN */,
3317
+ uranus: 7 /* URANUS */,
3318
+ neptune: 8 /* NEPTUNE */,
3319
+ pluto: 9 /* PLUTO */,
3320
+ meanNode: 10 /* MEAN_NODE */,
3321
+ trueNode: 11 /* TRUE_NODE */,
3322
+ // TODO: add chiron through seas_18.se1, seas_18.se2 and seasnam.txt files
3323
+ // chiron: Planet.CHIRON,
3324
+ lilithMean: 12 /* LILITH_MEAN */,
3325
+ lilithTrue: 13 /* LILITH_TRUE */
3247
3326
  };
3248
3327
  const positions = {};
3249
3328
  for (const [name, id] of Object.entries(planets)) {
3250
3329
  try {
3251
- positions[name] = swissEph.calculatePlanetPosition(julday, id);
3330
+ positions[name] = swissEph.calculatePlanetPosition(julday, id, flags);
3252
3331
  } catch (error) {
3253
3332
  throw new Error(`Failed to calculate position for ${name}: ${error}`);
3254
3333
  }
@@ -3367,5 +3446,5 @@ exports.formatDegreeMinutes = formatDegreeMinutes;
3367
3446
  exports.getBirthChart = getBirthChart;
3368
3447
  exports.getSwissEph = getSwissEph;
3369
3448
  exports.getZodiacPosition = getZodiacPosition;
3370
- //# sourceMappingURL=chunk-SZXDOHKV.js.map
3371
- //# sourceMappingURL=chunk-SZXDOHKV.js.map
3449
+ //# sourceMappingURL=chunk-3JIIZ45K.js.map
3450
+ //# sourceMappingURL=chunk-3JIIZ45K.js.map