kaabalah 6.2.1 → 6.2.3

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 (34) hide show
  1. package/README.md +45 -1
  2. package/dist/{chunk-SDSFI577.mjs → chunk-2RGUI5FG.mjs} +345 -10
  3. package/dist/chunk-2RGUI5FG.mjs.map +1 -0
  4. package/dist/{chunk-L3HJSZML.js → chunk-3KJSW6ZP.js} +6 -6
  5. package/dist/{chunk-L3HJSZML.js.map → chunk-3KJSW6ZP.js.map} +1 -1
  6. package/dist/{chunk-BOGH5XQA.mjs → chunk-RWX6HFS5.mjs} +3 -3
  7. package/dist/{chunk-BOGH5XQA.mjs.map → chunk-RWX6HFS5.mjs.map} +1 -1
  8. package/dist/{chunk-Y62OU26O.js → chunk-WSSELKIB.js} +351 -9
  9. package/dist/chunk-WSSELKIB.js.map +1 -0
  10. package/dist/cli.js +61 -2
  11. package/dist/cli.js.map +1 -1
  12. package/dist/core/index.d.mts +2 -4
  13. package/dist/core/index.d.ts +2 -4
  14. package/dist/{constants-C0XjrYIG.d.mts → correspondence-model-DWXbAjC-.d.mts} +279 -1
  15. package/dist/{constants-C0XjrYIG.d.ts → correspondence-model-DWXbAjC-.d.ts} +279 -1
  16. package/dist/gematria/index.d.mts +1 -2
  17. package/dist/gematria/index.d.ts +1 -2
  18. package/dist/index.d.mts +2 -3
  19. package/dist/index.d.ts +2 -3
  20. package/dist/index.js +49 -21
  21. package/dist/index.mjs +2 -2
  22. package/dist/semantic/index.d.mts +1 -1
  23. package/dist/semantic/index.d.ts +1 -1
  24. package/dist/semantic/index.js +8 -8
  25. package/dist/semantic/index.mjs +2 -2
  26. package/dist/tarot/index.d.mts +65 -3
  27. package/dist/tarot/index.d.ts +65 -3
  28. package/dist/tarot/index.js +42 -14
  29. package/dist/tarot/index.mjs +1 -1
  30. package/package.json +1 -1
  31. package/dist/chunk-SDSFI577.mjs.map +0 -1
  32. package/dist/chunk-Y62OU26O.js.map +0 -1
  33. package/dist/correspondence-model-BrtIu5tW.d.mts +0 -281
  34. package/dist/correspondence-model-CpFOWeBr.d.ts +0 -281
@@ -4,6 +4,12 @@ var chunkTMN4PYVG_js = require('./chunk-TMN4PYVG.js');
4
4
  var chunkHAMDOCS5_js = require('./chunk-HAMDOCS5.js');
5
5
 
6
6
  // src/tarot/index.ts
7
+ var DEFAULT_TAROT_TREE_ID = "kaabalah";
8
+ var TAROT_TREE_IDS = [
9
+ "kaabalah",
10
+ "hermetic-qabalah",
11
+ "lurianic-kabbalah"
12
+ ];
7
13
  var majorArcana = [
8
14
  "01_the_magician",
9
15
  "02_the_high_priestess",
@@ -28,7 +34,7 @@ var majorArcana = [
28
34
  "21_the_fool",
29
35
  "22_the_world"
30
36
  ];
31
- var ARKANNUS = [
37
+ var RAW_ARKANNUS = [
32
38
  // Major Arcana (1-22)
33
39
  {
34
40
  number: 1,
@@ -903,9 +909,6 @@ var TAROT_DECK_METADATA = [
903
909
  label: "Rider Waite"
904
910
  }
905
911
  ];
906
- var MAJOR_ARCANA_CARDS = ARKANNUS.filter(
907
- (card) => card.type === "major" && majorArcana.includes(card.tarotCardFilename)
908
- );
909
912
  var tarotArchetypeCache;
910
913
  var tarotCardProfileCache;
911
914
  function normalizePathSlug(pathSlug) {
@@ -914,12 +917,98 @@ function normalizePathSlug(pathSlug) {
914
917
  function normalizeTarotLookupKey(value) {
915
918
  return value.trim().toLowerCase();
916
919
  }
920
+ var TAROT_TREE_PARTS = {
921
+ kaabalah: ["tarot"]
922
+ };
923
+ var TAROT_ARK_ANNU_ID_BY_NAME = new Map(
924
+ RAW_ARKANNUS.map((card) => [
925
+ normalizeTarotLookupKey(card.tarotCard),
926
+ chunkHAMDOCS5_js.id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard)
927
+ ])
928
+ );
929
+ var TAROT_ARK_ANNU_ID_BY_FILENAME = new Map(
930
+ RAW_ARKANNUS.map((card) => [
931
+ normalizeTarotLookupKey(card.tarotCardFilename),
932
+ chunkHAMDOCS5_js.id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard)
933
+ ])
934
+ );
935
+ function getTarotTreeWorkspace(treeId = DEFAULT_TAROT_TREE_ID) {
936
+ const parts = TAROT_TREE_PARTS[treeId];
937
+ if (!parts) {
938
+ return void 0;
939
+ }
940
+ return chunkTMN4PYVG_js.getCanonicalTree({
941
+ system: treeId,
942
+ parts: [...parts]
943
+ });
944
+ }
945
+ function getDirectTarotCardNumber(tarotArkAnnuId, treeId = DEFAULT_TAROT_TREE_ID) {
946
+ const tree = getTarotTreeWorkspace(treeId);
947
+ if (!tree) {
948
+ return void 0;
949
+ }
950
+ const match = tree.getCorrespondences(tarotArkAnnuId, {
951
+ type: "number" /* NUMBER */,
952
+ depth: 1,
953
+ limit: 1
954
+ })[0];
955
+ if (!match) {
956
+ return void 0;
957
+ }
958
+ return Number.parseInt(chunkHAMDOCS5_js.parseId(match.node.id), 10);
959
+ }
960
+ function buildDefaultArkannus(cards) {
961
+ const tree = getTarotTreeWorkspace(DEFAULT_TAROT_TREE_ID);
962
+ const resolveNumber = (tarotCardName) => {
963
+ if (!tree) {
964
+ return void 0;
965
+ }
966
+ const match = tree.getCorrespondences(
967
+ chunkHAMDOCS5_js.id("tarotArkAnnu" /* TAROT_ARK_ANNU */, tarotCardName),
968
+ {
969
+ type: "number" /* NUMBER */,
970
+ depth: 1,
971
+ limit: 1
972
+ }
973
+ )[0];
974
+ if (!match) {
975
+ return void 0;
976
+ }
977
+ return Number.parseInt(chunkHAMDOCS5_js.parseId(match.node.id), 10);
978
+ };
979
+ return [...cards].map((card) => ({
980
+ ...card,
981
+ number: resolveNumber(card.tarotCard) ?? card.number
982
+ })).sort((left, right) => {
983
+ if (left.number !== right.number) {
984
+ return left.number - right.number;
985
+ }
986
+ return left.tarotCard.localeCompare(right.tarotCard);
987
+ });
988
+ }
989
+ var ARKANNUS = buildDefaultArkannus(RAW_ARKANNUS);
990
+ var TAROT_COURT_RANKS = [
991
+ "king",
992
+ "queen",
993
+ "knight",
994
+ "page"
995
+ ];
996
+ var MAJOR_ARCANA_CARDS = ARKANNUS.filter(
997
+ (card) => card.type === "major" && majorArcana.includes(card.tarotCardFilename)
998
+ );
917
999
  function toTarotCardKind(card) {
918
1000
  if (card.type === "major") {
919
1001
  return "major";
920
1002
  }
921
1003
  return card.type === "minor" ? "minor" : "court";
922
1004
  }
1005
+ function toTarotCourtRank(card) {
1006
+ if (card.type !== "daat+royalship") {
1007
+ return void 0;
1008
+ }
1009
+ const [rank] = card.tarotCardFilename.split("_");
1010
+ return TAROT_COURT_RANKS.includes(rank) ? rank : void 0;
1011
+ }
923
1012
  function toTarotAssetPathType(card) {
924
1013
  return card.type;
925
1014
  }
@@ -941,6 +1030,180 @@ function toAstrologyCorrespondence(node) {
941
1030
  label: chunkHAMDOCS5_js.parseId(node.id)
942
1031
  };
943
1032
  }
1033
+ function getTarotCorrespondenceTree(treeId = DEFAULT_TAROT_TREE_ID) {
1034
+ return chunkTMN4PYVG_js.getCanonicalTree({
1035
+ system: treeId,
1036
+ parts: ["westernAstrology", "tarot"]
1037
+ });
1038
+ }
1039
+ function getCorrespondenceNodes(tree, sourceId, type, depth = 1, limit) {
1040
+ return tree.getCorrespondences(sourceId, {
1041
+ type,
1042
+ depth,
1043
+ limit
1044
+ }).map(({ node }) => node);
1045
+ }
1046
+ function getFirstCorrespondenceNode(tree, sourceId, type, depth = 1) {
1047
+ return getCorrespondenceNodes(tree, sourceId, type, depth, 1)[0];
1048
+ }
1049
+ function toCorrespondenceNode(node) {
1050
+ if (!node) {
1051
+ return void 0;
1052
+ }
1053
+ return {
1054
+ id: node.id,
1055
+ label: chunkHAMDOCS5_js.parseId(node.id)
1056
+ };
1057
+ }
1058
+ function toUniqueCorrespondenceNodes(nodes) {
1059
+ const seen = /* @__PURE__ */ new Set();
1060
+ return nodes.flatMap((node) => {
1061
+ const key = String(node.id);
1062
+ if (seen.has(key)) {
1063
+ return [];
1064
+ }
1065
+ seen.add(key);
1066
+ return [toCorrespondenceNode(node)];
1067
+ });
1068
+ }
1069
+ function toTarotCorrespondenceProfileBase(card) {
1070
+ return {
1071
+ tarotArkAnnuId: card.tarotArkAnnuId,
1072
+ tarotCardNumber: card.tarotCardNumber,
1073
+ tarotCardName: card.tarotCardName,
1074
+ tarotCardFilename: card.tarotCardFilename,
1075
+ tarotMeaning: card.tarotMeaning,
1076
+ suit: card.suit
1077
+ };
1078
+ }
1079
+ function resolveTarotCardProfileForTree(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
1080
+ if ("tarotCardNumber" in lookup) {
1081
+ return getTarotCardByNumber(lookup.tarotCardNumber, treeId);
1082
+ }
1083
+ return getTarotCardProfile(lookup);
1084
+ }
1085
+ function buildMajorCorrespondenceProfile(card, tree) {
1086
+ const pathNode = getFirstCorrespondenceNode(
1087
+ tree,
1088
+ card.tarotArkAnnuId,
1089
+ "path" /* PATH */
1090
+ );
1091
+ const hebrewLetterNode = pathNode ? getFirstCorrespondenceNode(
1092
+ tree,
1093
+ pathNode.id,
1094
+ "hebrewLetter" /* HEBREW_LETTER */
1095
+ ) : void 0;
1096
+ const pathNumberNode = pathNode ? getFirstCorrespondenceNode(tree, pathNode.id, "number" /* NUMBER */) : void 0;
1097
+ const pathNumber = pathNumberNode ? Number.parseInt(chunkHAMDOCS5_js.parseId(pathNumberNode.id), 10) : Number.NaN;
1098
+ const fromSphereNode = pathNode?.data?.from ? tree.getNode(pathNode.data.from) : void 0;
1099
+ const toSphereNode = pathNode?.data?.to ? tree.getNode(pathNode.data.to) : void 0;
1100
+ if (!pathNode || !hebrewLetterNode || !fromSphereNode || !toSphereNode || !Number.isFinite(pathNumber)) {
1101
+ return void 0;
1102
+ }
1103
+ return {
1104
+ ...toTarotCorrespondenceProfileBase(card),
1105
+ kind: "major",
1106
+ correspondences: {
1107
+ astrology: getCorrespondenceNodes(
1108
+ tree,
1109
+ pathNode.id,
1110
+ [
1111
+ "westernElement" /* WESTERN_ELEMENT */,
1112
+ "planet" /* PLANET */,
1113
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
1114
+ ]
1115
+ ).map(
1116
+ (node) => toAstrologyCorrespondence(
1117
+ node
1118
+ )
1119
+ ),
1120
+ path: {
1121
+ pathId: pathNode.id,
1122
+ pathNumber,
1123
+ pathSlug: chunkHAMDOCS5_js.parseId(hebrewLetterNode.id).toLowerCase(),
1124
+ meaning: pathNode.data?.meaning,
1125
+ hebrewLetter: toCorrespondenceNode(hebrewLetterNode),
1126
+ fromSphere: toCorrespondenceNode(
1127
+ fromSphereNode
1128
+ ),
1129
+ toSphere: toCorrespondenceNode(
1130
+ toSphereNode
1131
+ )
1132
+ }
1133
+ }
1134
+ };
1135
+ }
1136
+ function buildCourtCorrespondenceProfile(card, tree) {
1137
+ const suitNode = getFirstCorrespondenceNode(
1138
+ tree,
1139
+ card.tarotArkAnnuId,
1140
+ "tarotSuit" /* TAROT_SUIT */
1141
+ );
1142
+ if (!card.courtRank) {
1143
+ return void 0;
1144
+ }
1145
+ if (card.courtRank === "page") {
1146
+ const elementNode = suitNode ? getFirstCorrespondenceNode(
1147
+ tree,
1148
+ suitNode.id,
1149
+ "westernElement" /* WESTERN_ELEMENT */
1150
+ ) : void 0;
1151
+ if (!elementNode) {
1152
+ return void 0;
1153
+ }
1154
+ return {
1155
+ ...toTarotCorrespondenceProfileBase(card),
1156
+ kind: "court",
1157
+ courtRank: "page",
1158
+ correspondences: {
1159
+ element: toCorrespondenceNode(elementNode)
1160
+ }
1161
+ };
1162
+ }
1163
+ const signNode = getFirstCorrespondenceNode(
1164
+ tree,
1165
+ card.tarotArkAnnuId,
1166
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
1167
+ );
1168
+ if (!signNode) {
1169
+ return void 0;
1170
+ }
1171
+ return {
1172
+ ...toTarotCorrespondenceProfileBase(card),
1173
+ kind: "court",
1174
+ courtRank: card.courtRank,
1175
+ correspondences: {
1176
+ sign: toCorrespondenceNode(signNode),
1177
+ planets: toUniqueCorrespondenceNodes(
1178
+ getCorrespondenceNodes(
1179
+ tree,
1180
+ signNode.id,
1181
+ "planet" /* PLANET */
1182
+ )
1183
+ )
1184
+ }
1185
+ };
1186
+ }
1187
+ function buildMinorCorrespondenceProfile(card, tree) {
1188
+ const sphereNode = getFirstCorrespondenceNode(
1189
+ tree,
1190
+ card.tarotArkAnnuId,
1191
+ "sphere" /* SPHERE */
1192
+ );
1193
+ if (!sphereNode) {
1194
+ return void 0;
1195
+ }
1196
+ return {
1197
+ ...toTarotCorrespondenceProfileBase(card),
1198
+ kind: "minor",
1199
+ correspondences: {
1200
+ sphere: toCorrespondenceNode(sphereNode),
1201
+ planets: toUniqueCorrespondenceNodes(
1202
+ getCorrespondenceNodes(tree, sphereNode.id, "planet" /* PLANET */)
1203
+ )
1204
+ }
1205
+ };
1206
+ }
944
1207
  function buildDescriptionsByDeck(tarotArkAnnu) {
945
1208
  const descriptions = {};
946
1209
  for (const deck of TAROT_DECK_METADATA) {
@@ -1050,6 +1313,7 @@ function getTarotCardProfileCache() {
1050
1313
  kind: toTarotCardKind(card),
1051
1314
  assetPathType: toTarotAssetPathType(card),
1052
1315
  suit: card.suit,
1316
+ courtRank: toTarotCourtRank(card),
1053
1317
  availableDeckIds,
1054
1318
  descriptionsByDeck
1055
1319
  };
@@ -1093,6 +1357,25 @@ function buildTarotRepresentation(card, deck) {
1093
1357
  description
1094
1358
  };
1095
1359
  }
1360
+ function resolveTarotArkAnnuId(lookup) {
1361
+ if ("pathSlug" in lookup || "pathId" in lookup) {
1362
+ return getTarotArchetype(lookup)?.tarotArkAnnuId;
1363
+ }
1364
+ if ("tarotArkAnnuId" in lookup) {
1365
+ return lookup.tarotArkAnnuId;
1366
+ }
1367
+ if ("tarotCardName" in lookup) {
1368
+ return TAROT_ARK_ANNU_ID_BY_NAME.get(
1369
+ normalizeTarotLookupKey(lookup.tarotCardName)
1370
+ );
1371
+ }
1372
+ if ("tarotCardFilename" in lookup) {
1373
+ return TAROT_ARK_ANNU_ID_BY_FILENAME.get(
1374
+ normalizeTarotLookupKey(lookup.tarotCardFilename)
1375
+ );
1376
+ }
1377
+ return void 0;
1378
+ }
1096
1379
  function getTarotCardProfile(lookup) {
1097
1380
  const cache = getTarotCardProfileCache();
1098
1381
  if ("pathSlug" in lookup || "pathId" in lookup) {
@@ -1112,11 +1395,48 @@ function getTarotCardProfile(lookup) {
1112
1395
  normalizeTarotLookupKey(lookup.tarotCardFilename)
1113
1396
  );
1114
1397
  }
1115
- return cache.byTarotCardNumber.get(lookup.tarotCardNumber);
1398
+ return getTarotCardByNumber(lookup.tarotCardNumber);
1116
1399
  }
1117
1400
  function listTarotDecks() {
1118
1401
  return TAROT_DECK_METADATA.map(({ id: id2, label }) => ({ id: id2, label }));
1119
1402
  }
1403
+ function listTarotTrees() {
1404
+ return [...TAROT_TREE_IDS];
1405
+ }
1406
+ function getTarotCardNumber(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
1407
+ if ("tarotCardNumber" in lookup) {
1408
+ return getTarotCardByNumber(lookup.tarotCardNumber, treeId)?.tarotCardNumber;
1409
+ }
1410
+ const tarotArkAnnuId = resolveTarotArkAnnuId(lookup);
1411
+ if (!tarotArkAnnuId) {
1412
+ return void 0;
1413
+ }
1414
+ return getDirectTarotCardNumber(tarotArkAnnuId, treeId);
1415
+ }
1416
+ function getTarotCardByNumber(cardNumber, treeId = DEFAULT_TAROT_TREE_ID) {
1417
+ const tree = getTarotTreeWorkspace(treeId);
1418
+ if (!tree) {
1419
+ return void 0;
1420
+ }
1421
+ const match = tree.getCorrespondences(chunkHAMDOCS5_js.id("number" /* NUMBER */, cardNumber), {
1422
+ type: "tarotArkAnnu" /* TAROT_ARK_ANNU */,
1423
+ depth: 1,
1424
+ limit: 1
1425
+ })[0];
1426
+ if (!match) {
1427
+ return void 0;
1428
+ }
1429
+ const profile = getTarotCardProfile({
1430
+ tarotArkAnnuId: match.node.id
1431
+ });
1432
+ if (!profile || profile.tarotCardNumber === cardNumber) {
1433
+ return profile;
1434
+ }
1435
+ return {
1436
+ ...profile,
1437
+ tarotCardNumber: cardNumber
1438
+ };
1439
+ }
1120
1440
  function getTarotArchetype(lookup) {
1121
1441
  const cache = getTarotArchetypeCache();
1122
1442
  if ("pathSlug" in lookup) {
@@ -1132,6 +1452,21 @@ function getTarotArchetype(lookup) {
1132
1452
  }
1133
1453
  return cache.byTarotCardNumber.get(lookup.tarotCardNumber);
1134
1454
  }
1455
+ function getTarotCorrespondenceProfile(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
1456
+ const card = resolveTarotCardProfileForTree(lookup, treeId);
1457
+ if (!card) {
1458
+ return void 0;
1459
+ }
1460
+ const tree = getTarotCorrespondenceTree(treeId);
1461
+ switch (card.kind) {
1462
+ case "major":
1463
+ return buildMajorCorrespondenceProfile(card, tree);
1464
+ case "court":
1465
+ return buildCourtCorrespondenceProfile(card, tree);
1466
+ case "minor":
1467
+ return buildMinorCorrespondenceProfile(card, tree);
1468
+ }
1469
+ }
1135
1470
  function getTarotRepresentations(lookup) {
1136
1471
  const card = getTarotCardProfile(lookup);
1137
1472
  if (!card) {
@@ -1849,7 +2184,7 @@ function cloneSpreadDefinition(spread) {
1849
2184
  } : void 0
1850
2185
  };
1851
2186
  }
1852
- function getTarotCardByNumber(cardNumber) {
2187
+ function getTarotDeckCardByNumber(cardNumber) {
1853
2188
  return TAROT_CARD_BY_NUMBER.get(cardNumber);
1854
2189
  }
1855
2190
  function getTarotSpreadRuleForValidation(slot) {
@@ -2098,7 +2433,7 @@ function validateTarotSpreadSelection(input) {
2098
2433
  });
2099
2434
  continue;
2100
2435
  }
2101
- const tarotCard = getTarotCardByNumber(selectedCard.cardNumber);
2436
+ const tarotCard = getTarotDeckCardByNumber(selectedCard.cardNumber);
2102
2437
  if (!tarotCard) {
2103
2438
  errors.push({
2104
2439
  code: "CARD_NOT_FOUND",
@@ -2229,17 +2564,24 @@ function drawTarotSpread(options) {
2229
2564
  }
2230
2565
 
2231
2566
  exports.ARKANNUS = ARKANNUS;
2567
+ exports.DEFAULT_TAROT_TREE_ID = DEFAULT_TAROT_TREE_ID;
2232
2568
  exports.TAROT_IMAGE_BASE_URL = TAROT_IMAGE_BASE_URL;
2569
+ exports.TAROT_TREE_IDS = TAROT_TREE_IDS;
2233
2570
  exports.drawTarotSpread = drawTarotSpread;
2234
2571
  exports.getTarotArchetype = getTarotArchetype;
2572
+ exports.getTarotCardByNumber = getTarotCardByNumber;
2573
+ exports.getTarotCardNumber = getTarotCardNumber;
2574
+ exports.getTarotCardProfile = getTarotCardProfile;
2575
+ exports.getTarotCorrespondenceProfile = getTarotCorrespondenceProfile;
2235
2576
  exports.getTarotRepresentation = getTarotRepresentation;
2236
2577
  exports.getTarotRepresentations = getTarotRepresentations;
2237
2578
  exports.getTarotSpread = getTarotSpread;
2238
2579
  exports.listTarotDecks = listTarotDecks;
2239
2580
  exports.listTarotSpreads = listTarotSpreads;
2581
+ exports.listTarotTrees = listTarotTrees;
2240
2582
  exports.majorArcana = majorArcana;
2241
2583
  exports.resolveTarotImageUrl = resolveTarotImageUrl;
2242
2584
  exports.shuffleTarotDeck = shuffleTarotDeck;
2243
2585
  exports.validateTarotSpreadSelection = validateTarotSpreadSelection;
2244
- //# sourceMappingURL=chunk-Y62OU26O.js.map
2245
- //# sourceMappingURL=chunk-Y62OU26O.js.map
2586
+ //# sourceMappingURL=chunk-WSSELKIB.js.map
2587
+ //# sourceMappingURL=chunk-WSSELKIB.js.map