kaabalah 6.8.1 → 6.9.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/astrology/index.d.mts +8 -2
- package/dist/astrology/index.d.ts +8 -2
- package/dist/astrology/index.js +56 -52
- package/dist/astrology/index.mjs +1 -1
- package/dist/{chunk-WLML6SVX.js → chunk-3C235FNN.js} +23 -10
- package/dist/chunk-3C235FNN.js.map +1 -0
- package/dist/{chunk-LQX6PW35.js → chunk-47BAJUYW.js} +70 -103
- package/dist/chunk-47BAJUYW.js.map +1 -0
- package/dist/{chunk-SHKAAZHT.mjs → chunk-7LIIEUJB.mjs} +67 -43
- package/dist/chunk-7LIIEUJB.mjs.map +1 -0
- package/dist/{chunk-SYLFUBAB.js → chunk-CW6QDSMF.js} +41 -34
- package/dist/chunk-CW6QDSMF.js.map +1 -0
- package/dist/{chunk-K33NFXSD.js → chunk-FCAIGKB5.js} +163 -139
- package/dist/chunk-FCAIGKB5.js.map +1 -0
- package/dist/{chunk-36XZ5WR2.js → chunk-M2FTEWY2.js} +991 -985
- package/dist/chunk-M2FTEWY2.js.map +1 -0
- package/dist/{chunk-5K4OQ4UB.mjs → chunk-NOZKIUGP.mjs} +60 -43
- package/dist/chunk-NOZKIUGP.mjs.map +1 -0
- package/dist/{chunk-QS5XAAAG.mjs → chunk-OSMB2MJR.mjs} +23 -16
- package/dist/chunk-OSMB2MJR.mjs.map +1 -0
- package/dist/{chunk-7YU7TRCG.mjs → chunk-PEHDLSUH.mjs} +11 -7
- package/dist/chunk-PEHDLSUH.mjs.map +1 -0
- package/dist/{chunk-VJ6RW5H4.js → chunk-Q7YAKPBH.js} +63 -42
- package/dist/chunk-Q7YAKPBH.js.map +1 -0
- package/dist/{chunk-3UJPBUY4.mjs → chunk-RAQDVWNK.mjs} +9 -12
- package/dist/chunk-RAQDVWNK.mjs.map +1 -0
- package/dist/{chunk-BEFGGHIJ.js → chunk-SWWLTDR6.js} +11 -6
- package/dist/chunk-SWWLTDR6.js.map +1 -0
- package/dist/{chunk-5HXSHALQ.mjs → chunk-THD4XOYR.mjs} +16 -4
- package/dist/chunk-THD4XOYR.mjs.map +1 -0
- package/dist/{chunk-UZ42PN5T.js → chunk-UNXDDLZS.js} +10 -13
- package/dist/chunk-UNXDDLZS.js.map +1 -0
- package/dist/{chunk-6N5YC2WD.mjs → chunk-X5HGLMEF.mjs} +20 -53
- package/dist/chunk-X5HGLMEF.mjs.map +1 -0
- package/dist/{chunk-ITESL6GR.mjs → chunk-Y3TLBFPD.mjs} +982 -976
- package/dist/chunk-Y3TLBFPD.mjs.map +1 -0
- package/dist/cli.js +8879 -6554
- package/dist/cli.js.map +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +65 -49
- package/dist/core/index.mjs +2 -2
- package/dist/{correspondence-model-DWXbAjC-.d.mts → correspondence-model-JSyDWwmn.d.mts} +19 -1
- package/dist/{correspondence-model-DWXbAjC-.d.ts → correspondence-model-JSyDWwmn.d.ts} +19 -1
- package/dist/data-CdjlIcAo.d.mts +33 -0
- package/dist/data-_b06lgY6.d.ts +33 -0
- package/dist/gematria/index.d.mts +1 -1
- package/dist/gematria/index.d.ts +1 -1
- package/dist/gematria/index.js +5 -5
- package/dist/gematria/index.mjs +2 -2
- package/dist/index.d.mts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +228 -204
- package/dist/index.mjs +8 -8
- package/dist/numerology/index.d.mts +21 -0
- package/dist/numerology/index.d.ts +21 -0
- package/dist/numerology/index.js +18 -18
- package/dist/numerology/index.mjs +3 -3
- package/dist/semantic/index.d.mts +2 -2
- package/dist/semantic/index.d.ts +2 -2
- package/dist/semantic/index.js +26 -26
- package/dist/semantic/index.mjs +7 -7
- package/dist/{swisseph.node-2PWBQLWG.mjs → swisseph.node-53QCJWTI.mjs} +4 -3
- package/dist/swisseph.node-53QCJWTI.mjs.map +1 -0
- package/dist/{swisseph.node-NWM75JF3.js → swisseph.node-CGBZTQ5N.js} +4 -3
- package/dist/swisseph.node-CGBZTQ5N.js.map +1 -0
- package/dist/swisseph.node-GPVFDOB6.wasm +0 -0
- package/dist/swisseph.node.js +1 -1
- package/dist/swisseph.node.wasm +0 -0
- package/dist/swisseph.web-GPVFDOB6.wasm +0 -0
- package/dist/{wasm/build/swisseph.web-CK57WSU3.mjs → swisseph.web-SRINFOJC.mjs} +4 -3
- package/dist/swisseph.web-SRINFOJC.mjs.map +1 -0
- package/dist/{wasm/build/swisseph.web-GPTWPXKT.js → swisseph.web-XCF4GL2M.js} +4 -3
- package/dist/swisseph.web-XCF4GL2M.js.map +1 -0
- package/dist/swisseph.web.js +1 -1
- package/dist/swisseph.web.wasm +0 -0
- package/dist/tarot/index.d.mts +102 -126
- package/dist/tarot/index.d.ts +102 -126
- package/dist/tarot/index.js +23 -23
- package/dist/tarot/index.mjs +3 -3
- package/dist/{topology-CSSfYL2c.d.mts → topology-CH3hsIqO.d.mts} +2 -1
- package/dist/{topology-Bbgniegh.d.ts → topology-DXYTpDvj.d.ts} +2 -1
- package/dist/visual/index.d.mts +9 -3
- package/dist/visual/index.d.ts +9 -3
- package/dist/visual/index.js +48 -44
- package/dist/visual/index.mjs +3 -3
- package/dist/wasm/build/{swisseph.node-2PWBQLWG.mjs → swisseph.node-53QCJWTI.mjs} +4 -3
- package/dist/wasm/build/swisseph.node-53QCJWTI.mjs.map +1 -0
- package/dist/wasm/build/{swisseph.node-NWM75JF3.js → swisseph.node-CGBZTQ5N.js} +4 -3
- package/dist/wasm/build/swisseph.node-CGBZTQ5N.js.map +1 -0
- package/dist/wasm/build/swisseph.node-GPVFDOB6.wasm +0 -0
- package/dist/wasm/build/swisseph.node.js +1 -1
- package/dist/wasm/build/swisseph.node.wasm +0 -0
- package/dist/wasm/build/swisseph.web-GPVFDOB6.wasm +0 -0
- package/dist/{swisseph.web-CK57WSU3.mjs → wasm/build/swisseph.web-SRINFOJC.mjs} +4 -3
- package/dist/wasm/build/swisseph.web-SRINFOJC.mjs.map +1 -0
- package/dist/{swisseph.web-GPTWPXKT.js → wasm/build/swisseph.web-XCF4GL2M.js} +4 -3
- package/dist/wasm/build/swisseph.web-XCF4GL2M.js.map +1 -0
- package/dist/wasm/build/swisseph.web.js +1 -1
- package/dist/wasm/build/swisseph.web.wasm +0 -0
- package/package.json +2 -1
- package/wasm/build/swisseph.node.js +1 -1
- package/wasm/build/swisseph.node.wasm +0 -0
- package/wasm/build/swisseph.web.js +1 -1
- package/wasm/build/swisseph.web.wasm +0 -0
- package/dist/chunk-36XZ5WR2.js.map +0 -1
- package/dist/chunk-3UJPBUY4.mjs.map +0 -1
- package/dist/chunk-5HXSHALQ.mjs.map +0 -1
- package/dist/chunk-5K4OQ4UB.mjs.map +0 -1
- package/dist/chunk-6N5YC2WD.mjs.map +0 -1
- package/dist/chunk-7YU7TRCG.mjs.map +0 -1
- package/dist/chunk-BEFGGHIJ.js.map +0 -1
- package/dist/chunk-ITESL6GR.mjs.map +0 -1
- package/dist/chunk-K33NFXSD.js.map +0 -1
- package/dist/chunk-LQX6PW35.js.map +0 -1
- package/dist/chunk-QS5XAAAG.mjs.map +0 -1
- package/dist/chunk-SHKAAZHT.mjs.map +0 -1
- package/dist/chunk-SYLFUBAB.js.map +0 -1
- package/dist/chunk-UZ42PN5T.js.map +0 -1
- package/dist/chunk-VJ6RW5H4.js.map +0 -1
- package/dist/chunk-WLML6SVX.js.map +0 -1
- package/dist/swisseph-YPVN5VCI.wasm +0 -0
- package/dist/swisseph.js +0 -30
- package/dist/swisseph.node-2K5IHMKE.wasm +0 -0
- package/dist/swisseph.node-2PWBQLWG.mjs.map +0 -1
- package/dist/swisseph.node-NWM75JF3.js.map +0 -1
- package/dist/swisseph.wasm +0 -0
- package/dist/swisseph.web-2K5IHMKE.wasm +0 -0
- package/dist/swisseph.web-CK57WSU3.mjs.map +0 -1
- package/dist/swisseph.web-GPTWPXKT.js.map +0 -1
- package/dist/wasm/build/swisseph-YPVN5VCI.wasm +0 -0
- package/dist/wasm/build/swisseph.js +0 -30
- package/dist/wasm/build/swisseph.node-2K5IHMKE.wasm +0 -0
- package/dist/wasm/build/swisseph.node-2PWBQLWG.mjs.map +0 -1
- package/dist/wasm/build/swisseph.node-NWM75JF3.js.map +0 -1
- package/dist/wasm/build/swisseph.wasm +0 -0
- package/dist/wasm/build/swisseph.web-2K5IHMKE.wasm +0 -0
- package/dist/wasm/build/swisseph.web-CK57WSU3.mjs.map +0 -1
- package/dist/wasm/build/swisseph.web-GPTWPXKT.js.map +0 -1
- package/dist/webassembly.md +0 -127
- package/wasm/build/swisseph-YPVN5VCI.wasm +0 -0
- package/wasm/build/swisseph.d.ts +0 -12
- package/wasm/build/swisseph.js +0 -30
- package/wasm/build/swisseph.wasm +0 -0
- package/wasm/build/webassembly.md +0 -127
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getCanonicalTree } from './chunk-
|
|
2
|
-
import { id, parseId } from './chunk-
|
|
1
|
+
import { getCanonicalTree } from './chunk-X5HGLMEF.mjs';
|
|
2
|
+
import { id, parseId } from './chunk-NOZKIUGP.mjs';
|
|
3
3
|
|
|
4
|
-
// src/tarot/
|
|
4
|
+
// src/tarot/data.ts
|
|
5
5
|
var DEFAULT_TAROT_TREE_ID = "kaabalah";
|
|
6
6
|
var TAROT_TREE_IDS = [
|
|
7
7
|
"kaabalah",
|
|
@@ -857,31 +857,6 @@ var RAW_ARKANNUS = [
|
|
|
857
857
|
suit: "pentacles"
|
|
858
858
|
}
|
|
859
859
|
];
|
|
860
|
-
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
861
|
-
var shuffleArray = (array) => {
|
|
862
|
-
const newArray = [...array];
|
|
863
|
-
for (let i = newArray.length - 1; i > 0; i--) {
|
|
864
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
865
|
-
[newArray[i], newArray[j]] = [newArray[j], newArray[i]];
|
|
866
|
-
}
|
|
867
|
-
return newArray;
|
|
868
|
-
};
|
|
869
|
-
async function shuffleTarotDeck(cards, includeInvertedCards = false, shuffleCount = 6, shuffleDelay = 300) {
|
|
870
|
-
let shuffledCards = shuffleArray([...cards]);
|
|
871
|
-
if (includeInvertedCards) {
|
|
872
|
-
const halfIndex = Math.floor(shuffledCards.length / 2);
|
|
873
|
-
shuffledCards = [
|
|
874
|
-
...shuffledCards.slice(0, halfIndex).map((card) => ({ ...card, isInverted: true })),
|
|
875
|
-
...shuffledCards.slice(halfIndex)
|
|
876
|
-
];
|
|
877
|
-
}
|
|
878
|
-
for (let i = 0; i < shuffleCount; i++) {
|
|
879
|
-
shuffledCards = shuffleArray(shuffledCards);
|
|
880
|
-
await sleep(shuffleDelay);
|
|
881
|
-
}
|
|
882
|
-
return shuffledCards;
|
|
883
|
-
}
|
|
884
|
-
var TAROT_IMAGE_BASE_URL = "https://kaabalah-app.s3.us-east-1.amazonaws.com/tarot";
|
|
885
860
|
var TAROT_DECK_METADATA = [
|
|
886
861
|
{
|
|
887
862
|
id: "papus_pt",
|
|
@@ -907,29 +882,11 @@ var TAROT_DECK_METADATA = [
|
|
|
907
882
|
label: "Rider Waite"
|
|
908
883
|
}
|
|
909
884
|
];
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
function normalizePathSlug(pathSlug) {
|
|
913
|
-
return pathSlug.trim().replace(/^\/?path\//i, "").toLowerCase();
|
|
914
|
-
}
|
|
915
|
-
function normalizeTarotLookupKey(value) {
|
|
916
|
-
return value.trim().toLowerCase();
|
|
917
|
-
}
|
|
885
|
+
|
|
886
|
+
// src/tarot/arkannus.ts
|
|
918
887
|
var TAROT_TREE_PARTS = {
|
|
919
888
|
kaabalah: ["tarot"]
|
|
920
889
|
};
|
|
921
|
-
var TAROT_ARK_ANNU_ID_BY_NAME = new Map(
|
|
922
|
-
RAW_ARKANNUS.map((card) => [
|
|
923
|
-
normalizeTarotLookupKey(card.tarotCard),
|
|
924
|
-
id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard)
|
|
925
|
-
])
|
|
926
|
-
);
|
|
927
|
-
var TAROT_ARK_ANNU_ID_BY_FILENAME = new Map(
|
|
928
|
-
RAW_ARKANNUS.map((card) => [
|
|
929
|
-
normalizeTarotLookupKey(card.tarotCardFilename),
|
|
930
|
-
id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard)
|
|
931
|
-
])
|
|
932
|
-
);
|
|
933
890
|
function getTarotTreeWorkspace(treeId = DEFAULT_TAROT_TREE_ID) {
|
|
934
891
|
const parts = TAROT_TREE_PARTS[treeId];
|
|
935
892
|
if (!parts) {
|
|
@@ -985,577 +942,79 @@ function buildDefaultArkannus(cards) {
|
|
|
985
942
|
});
|
|
986
943
|
}
|
|
987
944
|
var ARKANNUS = buildDefaultArkannus(RAW_ARKANNUS);
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
"
|
|
992
|
-
"
|
|
945
|
+
|
|
946
|
+
// src/tarot/spreads.ts
|
|
947
|
+
var TAROT_SPREAD_MINOR_RANKS = [
|
|
948
|
+
"ace",
|
|
949
|
+
"2",
|
|
950
|
+
"3",
|
|
951
|
+
"4",
|
|
952
|
+
"5",
|
|
953
|
+
"6",
|
|
954
|
+
"7",
|
|
955
|
+
"8",
|
|
956
|
+
"9",
|
|
957
|
+
"10"
|
|
993
958
|
];
|
|
994
|
-
var
|
|
995
|
-
|
|
959
|
+
var EVENT_INNER_SLOT_KEYS = [
|
|
960
|
+
"inner-1",
|
|
961
|
+
"inner-2",
|
|
962
|
+
"inner-3",
|
|
963
|
+
"inner-4",
|
|
964
|
+
"inner-5",
|
|
965
|
+
"inner-6",
|
|
966
|
+
"inner-7"
|
|
967
|
+
];
|
|
968
|
+
var TAROT_CARD_BY_NUMBER = new Map(
|
|
969
|
+
ARKANNUS.map((card) => [card.number, card])
|
|
996
970
|
);
|
|
997
|
-
function
|
|
998
|
-
if (card.type === "major") {
|
|
999
|
-
return "major";
|
|
1000
|
-
}
|
|
1001
|
-
return card.type === "minor" ? "minor" : "court";
|
|
1002
|
-
}
|
|
1003
|
-
function toTarotCourtRank(card) {
|
|
1004
|
-
if (card.type !== "daat+royalship") {
|
|
1005
|
-
return void 0;
|
|
1006
|
-
}
|
|
1007
|
-
const [rank] = card.tarotCardFilename.split("_");
|
|
1008
|
-
return TAROT_COURT_RANKS.includes(rank) ? rank : void 0;
|
|
1009
|
-
}
|
|
1010
|
-
function toTarotAssetPathType(card) {
|
|
1011
|
-
return card.type;
|
|
1012
|
-
}
|
|
1013
|
-
function buildTarotAssetPath(card) {
|
|
1014
|
-
if (card.assetPathType === "major") {
|
|
1015
|
-
return `major/${card.tarotCardFilename}`;
|
|
1016
|
-
}
|
|
1017
|
-
if (!card.suit) {
|
|
1018
|
-
throw new Error(
|
|
1019
|
-
`Missing suit metadata required to resolve tarot image path for ${card.tarotCardName}.`
|
|
1020
|
-
);
|
|
1021
|
-
}
|
|
1022
|
-
return `${card.assetPathType}/${card.suit}/${card.tarotCardFilename}`;
|
|
1023
|
-
}
|
|
1024
|
-
function toAstrologyCorrespondence(node) {
|
|
1025
|
-
return {
|
|
1026
|
-
type: node.type,
|
|
1027
|
-
id: node.id,
|
|
1028
|
-
label: parseId(node.id)
|
|
1029
|
-
};
|
|
1030
|
-
}
|
|
1031
|
-
function getTarotCorrespondenceTree(treeId = DEFAULT_TAROT_TREE_ID) {
|
|
1032
|
-
return getCanonicalTree({
|
|
1033
|
-
system: treeId,
|
|
1034
|
-
parts: ["westernAstrology", "tarot"]
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
function getCorrespondenceNodes(tree, sourceId, type, depth = 1, limit) {
|
|
1038
|
-
return tree.getCorrespondences(sourceId, {
|
|
1039
|
-
type,
|
|
1040
|
-
depth,
|
|
1041
|
-
limit
|
|
1042
|
-
}).map(({ node }) => node);
|
|
1043
|
-
}
|
|
1044
|
-
function getFirstCorrespondenceNode(tree, sourceId, type, depth = 1) {
|
|
1045
|
-
return getCorrespondenceNodes(tree, sourceId, type, depth, 1)[0];
|
|
1046
|
-
}
|
|
1047
|
-
function toCorrespondenceNode(node) {
|
|
1048
|
-
if (!node) {
|
|
1049
|
-
return void 0;
|
|
1050
|
-
}
|
|
971
|
+
function createEventOuterSlot(index, temporalPhase) {
|
|
1051
972
|
return {
|
|
1052
|
-
|
|
1053
|
-
label:
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
973
|
+
slotKey: `outer-${index}`,
|
|
974
|
+
label: String(index),
|
|
975
|
+
order: index,
|
|
976
|
+
minCards: 1,
|
|
977
|
+
maxCards: 1,
|
|
978
|
+
validationRules: {
|
|
979
|
+
allowedTypes: ["minor", "daat+royalship"]
|
|
980
|
+
},
|
|
981
|
+
manualSelectionRules: {
|
|
982
|
+
allowedTypes: ["minor", "daat+royalship"]
|
|
983
|
+
},
|
|
984
|
+
drawRules: {
|
|
985
|
+
allowedTypes: ["minor", "daat+royalship"]
|
|
986
|
+
},
|
|
987
|
+
metadata: {
|
|
988
|
+
displayLabel: String(index),
|
|
989
|
+
groupKey: "outer",
|
|
990
|
+
temporalPhase
|
|
1062
991
|
}
|
|
1063
|
-
seen.add(key);
|
|
1064
|
-
return [toCorrespondenceNode(node)];
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1067
|
-
function toTarotCorrespondenceProfileBase(card) {
|
|
1068
|
-
return {
|
|
1069
|
-
tarotArkAnnuId: card.tarotArkAnnuId,
|
|
1070
|
-
tarotCardNumber: card.tarotCardNumber,
|
|
1071
|
-
tarotCardName: card.tarotCardName,
|
|
1072
|
-
tarotCardFilename: card.tarotCardFilename,
|
|
1073
|
-
tarotMeaning: card.tarotMeaning,
|
|
1074
|
-
suit: card.suit
|
|
1075
992
|
};
|
|
1076
993
|
}
|
|
1077
|
-
function
|
|
1078
|
-
if ("tarotCardNumber" in lookup) {
|
|
1079
|
-
return getTarotCardByNumber(lookup.tarotCardNumber, treeId);
|
|
1080
|
-
}
|
|
1081
|
-
return getTarotCardProfile(lookup);
|
|
1082
|
-
}
|
|
1083
|
-
function buildMajorCorrespondenceProfile(card, tree) {
|
|
1084
|
-
const pathNode = getFirstCorrespondenceNode(
|
|
1085
|
-
tree,
|
|
1086
|
-
card.tarotArkAnnuId,
|
|
1087
|
-
"path" /* PATH */
|
|
1088
|
-
);
|
|
1089
|
-
const hebrewLetterNode = pathNode ? getFirstCorrespondenceNode(
|
|
1090
|
-
tree,
|
|
1091
|
-
pathNode.id,
|
|
1092
|
-
"hebrewLetter" /* HEBREW_LETTER */
|
|
1093
|
-
) : void 0;
|
|
1094
|
-
const pathNumberNode = pathNode ? getFirstCorrespondenceNode(tree, pathNode.id, "number" /* NUMBER */) : void 0;
|
|
1095
|
-
const pathNumber = pathNumberNode ? Number.parseInt(parseId(pathNumberNode.id), 10) : Number.NaN;
|
|
1096
|
-
const fromSphereNode = pathNode?.data?.from ? tree.getNode(pathNode.data.from) : void 0;
|
|
1097
|
-
const toSphereNode = pathNode?.data?.to ? tree.getNode(pathNode.data.to) : void 0;
|
|
1098
|
-
if (!pathNode || !hebrewLetterNode || !fromSphereNode || !toSphereNode || !Number.isFinite(pathNumber)) {
|
|
1099
|
-
return void 0;
|
|
1100
|
-
}
|
|
994
|
+
function createEventInnerSlot(index, label, note) {
|
|
1101
995
|
return {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
fromSphere: toCorrespondenceNode(
|
|
1125
|
-
fromSphereNode
|
|
1126
|
-
),
|
|
1127
|
-
toSphere: toCorrespondenceNode(
|
|
1128
|
-
toSphereNode
|
|
1129
|
-
)
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
};
|
|
1133
|
-
}
|
|
1134
|
-
function buildCourtCorrespondenceProfile(card, tree) {
|
|
1135
|
-
const suitNode = getFirstCorrespondenceNode(
|
|
1136
|
-
tree,
|
|
1137
|
-
card.tarotArkAnnuId,
|
|
1138
|
-
"tarotSuit" /* TAROT_SUIT */
|
|
1139
|
-
);
|
|
1140
|
-
if (!card.courtRank) {
|
|
1141
|
-
return void 0;
|
|
1142
|
-
}
|
|
1143
|
-
if (card.courtRank === "page") {
|
|
1144
|
-
const elementNode = suitNode ? getFirstCorrespondenceNode(
|
|
1145
|
-
tree,
|
|
1146
|
-
suitNode.id,
|
|
1147
|
-
"westernElement" /* WESTERN_ELEMENT */
|
|
1148
|
-
) : void 0;
|
|
1149
|
-
if (!elementNode) {
|
|
1150
|
-
return void 0;
|
|
1151
|
-
}
|
|
1152
|
-
return {
|
|
1153
|
-
...toTarotCorrespondenceProfileBase(card),
|
|
1154
|
-
kind: "court",
|
|
1155
|
-
courtRank: "page",
|
|
1156
|
-
correspondences: {
|
|
1157
|
-
element: toCorrespondenceNode(elementNode)
|
|
1158
|
-
}
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
const signNode = getFirstCorrespondenceNode(
|
|
1162
|
-
tree,
|
|
1163
|
-
card.tarotArkAnnuId,
|
|
1164
|
-
"westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
|
|
1165
|
-
);
|
|
1166
|
-
if (!signNode) {
|
|
1167
|
-
return void 0;
|
|
1168
|
-
}
|
|
1169
|
-
return {
|
|
1170
|
-
...toTarotCorrespondenceProfileBase(card),
|
|
1171
|
-
kind: "court",
|
|
1172
|
-
courtRank: card.courtRank,
|
|
1173
|
-
correspondences: {
|
|
1174
|
-
sign: toCorrespondenceNode(signNode),
|
|
1175
|
-
planets: toUniqueCorrespondenceNodes(
|
|
1176
|
-
getCorrespondenceNodes(
|
|
1177
|
-
tree,
|
|
1178
|
-
signNode.id,
|
|
1179
|
-
"planet" /* PLANET */
|
|
1180
|
-
)
|
|
1181
|
-
)
|
|
1182
|
-
}
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
function buildMinorCorrespondenceProfile(card, tree) {
|
|
1186
|
-
const sphereNode = getFirstCorrespondenceNode(
|
|
1187
|
-
tree,
|
|
1188
|
-
card.tarotArkAnnuId,
|
|
1189
|
-
"sphere" /* SPHERE */
|
|
1190
|
-
);
|
|
1191
|
-
if (!sphereNode) {
|
|
1192
|
-
return void 0;
|
|
1193
|
-
}
|
|
1194
|
-
return {
|
|
1195
|
-
...toTarotCorrespondenceProfileBase(card),
|
|
1196
|
-
kind: "minor",
|
|
1197
|
-
correspondences: {
|
|
1198
|
-
sphere: toCorrespondenceNode(sphereNode),
|
|
1199
|
-
planets: toUniqueCorrespondenceNodes(
|
|
1200
|
-
getCorrespondenceNodes(tree, sphereNode.id, "planet" /* PLANET */)
|
|
1201
|
-
)
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
}
|
|
1205
|
-
function buildDescriptionsByDeck(tarotArkAnnu) {
|
|
1206
|
-
const descriptions = {};
|
|
1207
|
-
for (const deck of TAROT_DECK_METADATA) {
|
|
1208
|
-
if (!deck.descriptiveDataKey) {
|
|
1209
|
-
continue;
|
|
1210
|
-
}
|
|
1211
|
-
const description = tarotArkAnnu.data?.descriptiveData?.[deck.descriptiveDataKey];
|
|
1212
|
-
if (!description) {
|
|
1213
|
-
continue;
|
|
1214
|
-
}
|
|
1215
|
-
descriptions[deck.id] = { ...description };
|
|
1216
|
-
}
|
|
1217
|
-
return descriptions;
|
|
1218
|
-
}
|
|
1219
|
-
function getTarotArchetypeCache() {
|
|
1220
|
-
if (tarotArchetypeCache) {
|
|
1221
|
-
return tarotArchetypeCache;
|
|
1222
|
-
}
|
|
1223
|
-
const tree = getCanonicalTree({
|
|
1224
|
-
system: "kaabalah",
|
|
1225
|
-
parts: ["westernAstrology", "tarot"]
|
|
1226
|
-
});
|
|
1227
|
-
const archetypes = MAJOR_ARCANA_CARDS.map((card) => {
|
|
1228
|
-
const pathId = id("path" /* PATH */, card.number);
|
|
1229
|
-
const path = tree.getNode(pathId);
|
|
1230
|
-
const hebrewLetter = tree.getCorrespondences(pathId, {
|
|
1231
|
-
type: "hebrewLetter" /* HEBREW_LETTER */,
|
|
1232
|
-
limit: 1
|
|
1233
|
-
})[0]?.node;
|
|
1234
|
-
const tarotArkAnnu = tree.getCorrespondences(pathId, {
|
|
1235
|
-
type: "tarotArkAnnu" /* TAROT_ARK_ANNU */,
|
|
1236
|
-
limit: 1
|
|
1237
|
-
})[0]?.node;
|
|
1238
|
-
if (!path || !hebrewLetter || !tarotArkAnnu) {
|
|
1239
|
-
throw new Error(
|
|
1240
|
-
`Missing canonical tarot archetype metadata for ${pathId}.`
|
|
1241
|
-
);
|
|
1242
|
-
}
|
|
1243
|
-
const astrology = tree.getCorrespondences(pathId, {
|
|
1244
|
-
type: [
|
|
1245
|
-
"westernElement" /* WESTERN_ELEMENT */,
|
|
1246
|
-
"planet" /* PLANET */,
|
|
1247
|
-
"westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
|
|
1248
|
-
]
|
|
1249
|
-
}).map(
|
|
1250
|
-
({ node }) => toAstrologyCorrespondence(
|
|
1251
|
-
node
|
|
1252
|
-
)
|
|
1253
|
-
);
|
|
1254
|
-
const descriptionsByDeck = buildDescriptionsByDeck(tarotArkAnnu);
|
|
1255
|
-
return {
|
|
1256
|
-
canonicalId: pathId,
|
|
1257
|
-
kind: "major",
|
|
1258
|
-
pathId,
|
|
1259
|
-
pathNumber: card.number,
|
|
1260
|
-
pathSlug: parseId(hebrewLetter.id).toLowerCase(),
|
|
1261
|
-
hebrewLetterId: hebrewLetter.id,
|
|
1262
|
-
hebrewLetter: parseId(hebrewLetter.id),
|
|
1263
|
-
pathMeaning: path.data?.meaning,
|
|
1264
|
-
tarotArkAnnuId: tarotArkAnnu.id,
|
|
1265
|
-
tarotCardNumber: card.number,
|
|
1266
|
-
tarotCardName: parseId(tarotArkAnnu.id),
|
|
1267
|
-
tarotCardFilename: card.tarotCardFilename,
|
|
1268
|
-
tarotMeaning: descriptionsByDeck.papus_pt?.meaning ?? card.meaning,
|
|
1269
|
-
astrology,
|
|
1270
|
-
availableDeckIds: TAROT_DECK_METADATA.map((deck) => deck.id),
|
|
1271
|
-
descriptionsByDeck
|
|
1272
|
-
};
|
|
1273
|
-
});
|
|
1274
|
-
tarotArchetypeCache = {
|
|
1275
|
-
archetypes,
|
|
1276
|
-
byPathId: new Map(archetypes.map((archetype) => [archetype.pathId, archetype])),
|
|
1277
|
-
byPathSlug: new Map(
|
|
1278
|
-
archetypes.map((archetype) => [archetype.pathSlug, archetype])
|
|
1279
|
-
),
|
|
1280
|
-
byTarotCardFilename: new Map(
|
|
1281
|
-
archetypes.map((archetype) => [archetype.tarotCardFilename, archetype])
|
|
1282
|
-
),
|
|
1283
|
-
byTarotCardNumber: new Map(
|
|
1284
|
-
archetypes.map((archetype) => [archetype.tarotCardNumber, archetype])
|
|
1285
|
-
)
|
|
1286
|
-
};
|
|
1287
|
-
return tarotArchetypeCache;
|
|
1288
|
-
}
|
|
1289
|
-
function getTarotCardProfileCache() {
|
|
1290
|
-
if (tarotCardProfileCache) {
|
|
1291
|
-
return tarotCardProfileCache;
|
|
1292
|
-
}
|
|
1293
|
-
const tree = getCanonicalTree({
|
|
1294
|
-
system: "kaabalah",
|
|
1295
|
-
parts: ["westernAstrology", "tarot"]
|
|
1296
|
-
});
|
|
1297
|
-
const availableDeckIds = TAROT_DECK_METADATA.map((deck) => deck.id);
|
|
1298
|
-
const profiles = ARKANNUS.map((card) => {
|
|
1299
|
-
const tarotArkAnnuId = id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard);
|
|
1300
|
-
const tarotArkAnnu = tree.getNode(tarotArkAnnuId);
|
|
1301
|
-
if (!tarotArkAnnu) {
|
|
1302
|
-
throw new Error(`Missing canonical tarot metadata for ${tarotArkAnnuId}.`);
|
|
1303
|
-
}
|
|
1304
|
-
const descriptionsByDeck = buildDescriptionsByDeck(tarotArkAnnu);
|
|
1305
|
-
return {
|
|
1306
|
-
tarotArkAnnuId,
|
|
1307
|
-
tarotCardNumber: card.number,
|
|
1308
|
-
tarotCardName: card.tarotCard,
|
|
1309
|
-
tarotCardFilename: card.tarotCardFilename,
|
|
1310
|
-
tarotMeaning: descriptionsByDeck.papus_pt?.meaning ?? card.meaning,
|
|
1311
|
-
kind: toTarotCardKind(card),
|
|
1312
|
-
assetPathType: toTarotAssetPathType(card),
|
|
1313
|
-
suit: card.suit,
|
|
1314
|
-
courtRank: toTarotCourtRank(card),
|
|
1315
|
-
availableDeckIds,
|
|
1316
|
-
descriptionsByDeck
|
|
1317
|
-
};
|
|
1318
|
-
});
|
|
1319
|
-
tarotCardProfileCache = {
|
|
1320
|
-
profiles,
|
|
1321
|
-
byTarotArkAnnuId: new Map(
|
|
1322
|
-
profiles.map((profile) => [String(profile.tarotArkAnnuId), profile])
|
|
1323
|
-
),
|
|
1324
|
-
byTarotCardName: new Map(
|
|
1325
|
-
profiles.map((profile) => [
|
|
1326
|
-
normalizeTarotLookupKey(profile.tarotCardName),
|
|
1327
|
-
profile
|
|
1328
|
-
])
|
|
1329
|
-
),
|
|
1330
|
-
byTarotCardFilename: new Map(
|
|
1331
|
-
profiles.map((profile) => [
|
|
1332
|
-
normalizeTarotLookupKey(profile.tarotCardFilename),
|
|
1333
|
-
profile
|
|
1334
|
-
])
|
|
1335
|
-
),
|
|
1336
|
-
byTarotCardNumber: new Map(
|
|
1337
|
-
profiles.map((profile) => [profile.tarotCardNumber, profile])
|
|
1338
|
-
)
|
|
1339
|
-
};
|
|
1340
|
-
return tarotCardProfileCache;
|
|
1341
|
-
}
|
|
1342
|
-
function buildTarotRepresentation(card, deck) {
|
|
1343
|
-
const description = card.descriptionsByDeck[deck.id];
|
|
1344
|
-
const assetPath = buildTarotAssetPath(card);
|
|
1345
|
-
const imageUrl = `${TAROT_IMAGE_BASE_URL}/${deck.id}/${assetPath}.jpg`;
|
|
1346
|
-
return {
|
|
1347
|
-
card,
|
|
1348
|
-
archetype: card.kind === "major" ? getTarotArchetype({ tarotCardNumber: card.tarotCardNumber }) : void 0,
|
|
1349
|
-
deck: { id: deck.id, label: deck.label },
|
|
1350
|
-
assetPath,
|
|
1351
|
-
imageUrl,
|
|
1352
|
-
label: `${card.tarotCardName} - ${deck.label}`,
|
|
1353
|
-
altText: `${card.tarotCardName} - ${deck.label}`,
|
|
1354
|
-
cardLabel: description?.name ?? card.tarotCardName,
|
|
1355
|
-
description
|
|
1356
|
-
};
|
|
1357
|
-
}
|
|
1358
|
-
function resolveTarotArkAnnuId(lookup) {
|
|
1359
|
-
if ("pathSlug" in lookup || "pathId" in lookup) {
|
|
1360
|
-
return getTarotArchetype(lookup)?.tarotArkAnnuId;
|
|
1361
|
-
}
|
|
1362
|
-
if ("tarotArkAnnuId" in lookup) {
|
|
1363
|
-
return lookup.tarotArkAnnuId;
|
|
1364
|
-
}
|
|
1365
|
-
if ("tarotCardName" in lookup) {
|
|
1366
|
-
return TAROT_ARK_ANNU_ID_BY_NAME.get(
|
|
1367
|
-
normalizeTarotLookupKey(lookup.tarotCardName)
|
|
1368
|
-
);
|
|
1369
|
-
}
|
|
1370
|
-
if ("tarotCardFilename" in lookup) {
|
|
1371
|
-
return TAROT_ARK_ANNU_ID_BY_FILENAME.get(
|
|
1372
|
-
normalizeTarotLookupKey(lookup.tarotCardFilename)
|
|
1373
|
-
);
|
|
1374
|
-
}
|
|
1375
|
-
return void 0;
|
|
1376
|
-
}
|
|
1377
|
-
function getTarotCardProfile(lookup) {
|
|
1378
|
-
const cache = getTarotCardProfileCache();
|
|
1379
|
-
if ("pathSlug" in lookup || "pathId" in lookup) {
|
|
1380
|
-
const archetype = getTarotArchetype(lookup);
|
|
1381
|
-
return archetype ? cache.byTarotCardNumber.get(archetype.tarotCardNumber) : void 0;
|
|
1382
|
-
}
|
|
1383
|
-
if ("tarotArkAnnuId" in lookup) {
|
|
1384
|
-
return cache.byTarotArkAnnuId.get(String(lookup.tarotArkAnnuId));
|
|
1385
|
-
}
|
|
1386
|
-
if ("tarotCardName" in lookup) {
|
|
1387
|
-
return cache.byTarotCardName.get(
|
|
1388
|
-
normalizeTarotLookupKey(lookup.tarotCardName)
|
|
1389
|
-
);
|
|
1390
|
-
}
|
|
1391
|
-
if ("tarotCardFilename" in lookup) {
|
|
1392
|
-
return cache.byTarotCardFilename.get(
|
|
1393
|
-
normalizeTarotLookupKey(lookup.tarotCardFilename)
|
|
1394
|
-
);
|
|
1395
|
-
}
|
|
1396
|
-
return getTarotCardByNumber(lookup.tarotCardNumber);
|
|
1397
|
-
}
|
|
1398
|
-
function listTarotDecks() {
|
|
1399
|
-
return TAROT_DECK_METADATA.map(({ id: id2, label }) => ({ id: id2, label }));
|
|
1400
|
-
}
|
|
1401
|
-
function listTarotTrees() {
|
|
1402
|
-
return [...TAROT_TREE_IDS];
|
|
1403
|
-
}
|
|
1404
|
-
function getTarotCardNumber(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
|
|
1405
|
-
if ("tarotCardNumber" in lookup) {
|
|
1406
|
-
return getTarotCardByNumber(lookup.tarotCardNumber, treeId)?.tarotCardNumber;
|
|
1407
|
-
}
|
|
1408
|
-
const tarotArkAnnuId = resolveTarotArkAnnuId(lookup);
|
|
1409
|
-
if (!tarotArkAnnuId) {
|
|
1410
|
-
return void 0;
|
|
1411
|
-
}
|
|
1412
|
-
return getDirectTarotCardNumber(tarotArkAnnuId, treeId);
|
|
1413
|
-
}
|
|
1414
|
-
function getTarotCardByNumber(cardNumber, treeId = DEFAULT_TAROT_TREE_ID) {
|
|
1415
|
-
const tree = getTarotTreeWorkspace(treeId);
|
|
1416
|
-
if (!tree) {
|
|
1417
|
-
return void 0;
|
|
1418
|
-
}
|
|
1419
|
-
const match = tree.getCorrespondences(id("number" /* NUMBER */, cardNumber), {
|
|
1420
|
-
type: "tarotArkAnnu" /* TAROT_ARK_ANNU */,
|
|
1421
|
-
depth: 1,
|
|
1422
|
-
limit: 1
|
|
1423
|
-
})[0];
|
|
1424
|
-
if (!match) {
|
|
1425
|
-
return void 0;
|
|
1426
|
-
}
|
|
1427
|
-
const profile = getTarotCardProfile({
|
|
1428
|
-
tarotArkAnnuId: match.node.id
|
|
1429
|
-
});
|
|
1430
|
-
if (!profile || profile.tarotCardNumber === cardNumber) {
|
|
1431
|
-
return profile;
|
|
1432
|
-
}
|
|
1433
|
-
return {
|
|
1434
|
-
...profile,
|
|
1435
|
-
tarotCardNumber: cardNumber
|
|
1436
|
-
};
|
|
1437
|
-
}
|
|
1438
|
-
function getTarotArchetype(lookup) {
|
|
1439
|
-
const cache = getTarotArchetypeCache();
|
|
1440
|
-
if ("pathSlug" in lookup) {
|
|
1441
|
-
return cache.byPathSlug.get(normalizePathSlug(lookup.pathSlug));
|
|
1442
|
-
}
|
|
1443
|
-
if ("pathId" in lookup) {
|
|
1444
|
-
return cache.byPathId.get(String(lookup.pathId));
|
|
1445
|
-
}
|
|
1446
|
-
if ("tarotCardFilename" in lookup) {
|
|
1447
|
-
return cache.byTarotCardFilename.get(
|
|
1448
|
-
lookup.tarotCardFilename.toLowerCase()
|
|
1449
|
-
);
|
|
1450
|
-
}
|
|
1451
|
-
return cache.byTarotCardNumber.get(lookup.tarotCardNumber);
|
|
1452
|
-
}
|
|
1453
|
-
function getTarotCorrespondenceProfile(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
|
|
1454
|
-
const card = resolveTarotCardProfileForTree(lookup, treeId);
|
|
1455
|
-
if (!card) {
|
|
1456
|
-
return void 0;
|
|
1457
|
-
}
|
|
1458
|
-
const tree = getTarotCorrespondenceTree(treeId);
|
|
1459
|
-
switch (card.kind) {
|
|
1460
|
-
case "major":
|
|
1461
|
-
return buildMajorCorrespondenceProfile(card, tree);
|
|
1462
|
-
case "court":
|
|
1463
|
-
return buildCourtCorrespondenceProfile(card, tree);
|
|
1464
|
-
case "minor":
|
|
1465
|
-
return buildMinorCorrespondenceProfile(card, tree);
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
function getTarotRepresentations(lookup) {
|
|
1469
|
-
const card = getTarotCardProfile(lookup);
|
|
1470
|
-
if (!card) {
|
|
1471
|
-
return [];
|
|
1472
|
-
}
|
|
1473
|
-
return TAROT_DECK_METADATA.map(
|
|
1474
|
-
(deck) => buildTarotRepresentation(card, deck)
|
|
1475
|
-
);
|
|
1476
|
-
}
|
|
1477
|
-
function getTarotRepresentation(lookup, deckId) {
|
|
1478
|
-
const card = getTarotCardProfile(lookup);
|
|
1479
|
-
const deck = TAROT_DECK_METADATA.find((candidate) => candidate.id === deckId);
|
|
1480
|
-
if (!card || !deck) {
|
|
1481
|
-
return void 0;
|
|
1482
|
-
}
|
|
1483
|
-
return buildTarotRepresentation(card, deck);
|
|
1484
|
-
}
|
|
1485
|
-
function resolveTarotImageUrl(lookup, deckId) {
|
|
1486
|
-
return getTarotRepresentation(lookup, deckId)?.imageUrl;
|
|
1487
|
-
}
|
|
1488
|
-
var TAROT_SPREAD_MINOR_RANKS = [
|
|
1489
|
-
"ace",
|
|
1490
|
-
"2",
|
|
1491
|
-
"3",
|
|
1492
|
-
"4",
|
|
1493
|
-
"5",
|
|
1494
|
-
"6",
|
|
1495
|
-
"7",
|
|
1496
|
-
"8",
|
|
1497
|
-
"9",
|
|
1498
|
-
"10"
|
|
1499
|
-
];
|
|
1500
|
-
var EVENT_INNER_SLOT_KEYS = [
|
|
1501
|
-
"inner-1",
|
|
1502
|
-
"inner-2",
|
|
1503
|
-
"inner-3",
|
|
1504
|
-
"inner-4",
|
|
1505
|
-
"inner-5",
|
|
1506
|
-
"inner-6",
|
|
1507
|
-
"inner-7"
|
|
1508
|
-
];
|
|
1509
|
-
var TAROT_CARD_BY_NUMBER = new Map(
|
|
1510
|
-
ARKANNUS.map((card) => [card.number, card])
|
|
1511
|
-
);
|
|
1512
|
-
function createEventOuterSlot(index, temporalPhase) {
|
|
1513
|
-
return {
|
|
1514
|
-
slotKey: `outer-${index}`,
|
|
1515
|
-
label: String(index),
|
|
1516
|
-
order: index,
|
|
1517
|
-
minCards: 1,
|
|
1518
|
-
maxCards: 1,
|
|
1519
|
-
validationRules: {
|
|
1520
|
-
allowedTypes: ["minor", "daat+royalship"]
|
|
1521
|
-
},
|
|
1522
|
-
manualSelectionRules: {
|
|
1523
|
-
allowedTypes: ["minor", "daat+royalship"]
|
|
1524
|
-
},
|
|
1525
|
-
drawRules: {
|
|
1526
|
-
allowedTypes: ["minor", "daat+royalship"]
|
|
1527
|
-
},
|
|
1528
|
-
metadata: {
|
|
1529
|
-
displayLabel: String(index),
|
|
1530
|
-
groupKey: "outer",
|
|
1531
|
-
temporalPhase
|
|
1532
|
-
}
|
|
1533
|
-
};
|
|
1534
|
-
}
|
|
1535
|
-
function createEventInnerSlot(index, label, note) {
|
|
1536
|
-
return {
|
|
1537
|
-
slotKey: `inner-${index}`,
|
|
1538
|
-
label,
|
|
1539
|
-
order: 100 + index,
|
|
1540
|
-
minCards: 1,
|
|
1541
|
-
maxCards: 1,
|
|
1542
|
-
validationRules: {
|
|
1543
|
-
allowedTypes: ["major"]
|
|
1544
|
-
},
|
|
1545
|
-
manualSelectionRules: {
|
|
1546
|
-
allowedTypes: ["major"],
|
|
1547
|
-
excludedCardFilenames: [
|
|
1548
|
-
"01_the_magician",
|
|
1549
|
-
"02_the_high_priestess"
|
|
1550
|
-
]
|
|
1551
|
-
},
|
|
1552
|
-
drawRules: {
|
|
1553
|
-
allowedTypes: ["major"]
|
|
1554
|
-
},
|
|
1555
|
-
metadata: {
|
|
1556
|
-
displayLabel: `${index}.`,
|
|
1557
|
-
groupKey: "inner",
|
|
1558
|
-
note
|
|
996
|
+
slotKey: `inner-${index}`,
|
|
997
|
+
label,
|
|
998
|
+
order: 100 + index,
|
|
999
|
+
minCards: 1,
|
|
1000
|
+
maxCards: 1,
|
|
1001
|
+
validationRules: {
|
|
1002
|
+
allowedTypes: ["major"]
|
|
1003
|
+
},
|
|
1004
|
+
manualSelectionRules: {
|
|
1005
|
+
allowedTypes: ["major"],
|
|
1006
|
+
excludedCardFilenames: [
|
|
1007
|
+
"01_the_magician",
|
|
1008
|
+
"02_the_high_priestess"
|
|
1009
|
+
]
|
|
1010
|
+
},
|
|
1011
|
+
drawRules: {
|
|
1012
|
+
allowedTypes: ["major"]
|
|
1013
|
+
},
|
|
1014
|
+
metadata: {
|
|
1015
|
+
displayLabel: `${index}.`,
|
|
1016
|
+
groupKey: "inner",
|
|
1017
|
+
note
|
|
1559
1018
|
}
|
|
1560
1019
|
};
|
|
1561
1020
|
}
|
|
@@ -2130,437 +1589,984 @@ var TAROT_SPREADS = [
|
|
|
2130
1589
|
note: "The querent's energy in this reading."
|
|
2131
1590
|
}
|
|
2132
1591
|
}
|
|
2133
|
-
],
|
|
2134
|
-
specialRules: {
|
|
2135
|
-
inquirerCard: {
|
|
2136
|
-
slotKey: "inquirer",
|
|
2137
|
-
sourceSlotKeys: [...EVENT_INNER_SLOT_KEYS],
|
|
2138
|
-
cardNumbersByGender: {
|
|
2139
|
-
man: 1,
|
|
2140
|
-
woman: 2
|
|
2141
|
-
}
|
|
1592
|
+
],
|
|
1593
|
+
specialRules: {
|
|
1594
|
+
inquirerCard: {
|
|
1595
|
+
slotKey: "inquirer",
|
|
1596
|
+
sourceSlotKeys: [...EVENT_INNER_SLOT_KEYS],
|
|
1597
|
+
cardNumbersByGender: {
|
|
1598
|
+
man: 1,
|
|
1599
|
+
woman: 2
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
];
|
|
1605
|
+
var TAROT_SPREAD_BY_ID = new Map(
|
|
1606
|
+
TAROT_SPREADS.map((spread) => [spread.spreadId, spread])
|
|
1607
|
+
);
|
|
1608
|
+
function cloneCardConstraint(constraint) {
|
|
1609
|
+
if (!constraint) {
|
|
1610
|
+
return void 0;
|
|
1611
|
+
}
|
|
1612
|
+
return {
|
|
1613
|
+
allowedTypes: constraint.allowedTypes ? [...constraint.allowedTypes] : void 0,
|
|
1614
|
+
requiredRank: constraint.requiredRank,
|
|
1615
|
+
allowedCardFilenames: constraint.allowedCardFilenames ? [...constraint.allowedCardFilenames] : void 0,
|
|
1616
|
+
excludedCardFilenames: constraint.excludedCardFilenames ? [...constraint.excludedCardFilenames] : void 0
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
function cloneSlotDefinition(slot) {
|
|
1620
|
+
return {
|
|
1621
|
+
...slot,
|
|
1622
|
+
validationRules: cloneCardConstraint(slot.validationRules),
|
|
1623
|
+
manualSelectionRules: cloneCardConstraint(slot.manualSelectionRules),
|
|
1624
|
+
drawRules: cloneCardConstraint(slot.drawRules),
|
|
1625
|
+
metadata: slot.metadata ? { ...slot.metadata } : void 0
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
function cloneSpreadDefinition(spread) {
|
|
1629
|
+
return {
|
|
1630
|
+
...spread,
|
|
1631
|
+
contextRequirements: spread.contextRequirements ? [...spread.contextRequirements] : void 0,
|
|
1632
|
+
slots: spread.slots.map(cloneSlotDefinition),
|
|
1633
|
+
specialRules: spread.specialRules?.inquirerCard ? {
|
|
1634
|
+
inquirerCard: {
|
|
1635
|
+
slotKey: spread.specialRules.inquirerCard.slotKey,
|
|
1636
|
+
sourceSlotKeys: [...spread.specialRules.inquirerCard.sourceSlotKeys],
|
|
1637
|
+
cardNumbersByGender: {
|
|
1638
|
+
...spread.specialRules.inquirerCard.cardNumbersByGender
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
} : void 0
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
function getTarotDeckCardByNumber(cardNumber) {
|
|
1645
|
+
return TAROT_CARD_BY_NUMBER.get(cardNumber);
|
|
1646
|
+
}
|
|
1647
|
+
function getTarotSpreadRuleForValidation(slot) {
|
|
1648
|
+
return slot.validationRules ?? slot.drawRules ?? slot.manualSelectionRules;
|
|
1649
|
+
}
|
|
1650
|
+
function getTarotSpreadRuleForDraw(slot) {
|
|
1651
|
+
return slot.drawRules ?? slot.validationRules ?? slot.manualSelectionRules;
|
|
1652
|
+
}
|
|
1653
|
+
function getTarotMinorRank(card) {
|
|
1654
|
+
if (card.type !== "minor") {
|
|
1655
|
+
return void 0;
|
|
1656
|
+
}
|
|
1657
|
+
const rank = card.tarotCardFilename.split("_")[0];
|
|
1658
|
+
return TAROT_SPREAD_MINOR_RANKS.includes(rank) ? rank : void 0;
|
|
1659
|
+
}
|
|
1660
|
+
function matchesTarotSpreadConstraint(card, constraint) {
|
|
1661
|
+
if (!constraint) {
|
|
1662
|
+
return true;
|
|
1663
|
+
}
|
|
1664
|
+
if (constraint.allowedTypes && !constraint.allowedTypes.includes(card.type)) {
|
|
1665
|
+
return false;
|
|
1666
|
+
}
|
|
1667
|
+
if (constraint.allowedCardFilenames && !constraint.allowedCardFilenames.includes(card.tarotCardFilename)) {
|
|
1668
|
+
return false;
|
|
1669
|
+
}
|
|
1670
|
+
if (constraint.excludedCardFilenames && constraint.excludedCardFilenames.includes(card.tarotCardFilename)) {
|
|
1671
|
+
return false;
|
|
1672
|
+
}
|
|
1673
|
+
if (constraint.requiredRank) {
|
|
1674
|
+
return getTarotMinorRank(card) === constraint.requiredRank;
|
|
1675
|
+
}
|
|
1676
|
+
return true;
|
|
1677
|
+
}
|
|
1678
|
+
function randomIndex(length, rng) {
|
|
1679
|
+
if (length <= 0) {
|
|
1680
|
+
throw new Error("Cannot draw from an empty pool.");
|
|
1681
|
+
}
|
|
1682
|
+
const raw = rng();
|
|
1683
|
+
if (!Number.isFinite(raw)) {
|
|
1684
|
+
throw new Error("Tarot spread RNG must return a finite number.");
|
|
1685
|
+
}
|
|
1686
|
+
const normalized = Math.min(Math.max(raw, 0), 1 - Number.EPSILON);
|
|
1687
|
+
return Math.floor(normalized * length);
|
|
1688
|
+
}
|
|
1689
|
+
function withSpreadCardOrientation(card, includeInverted, rng) {
|
|
1690
|
+
return {
|
|
1691
|
+
...card,
|
|
1692
|
+
isInverted: includeInverted ? rng() < 0.5 : false
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
function resolveTarotSpreadSelectionCard(card, slot, tarotCard) {
|
|
1696
|
+
return {
|
|
1697
|
+
...card,
|
|
1698
|
+
slot,
|
|
1699
|
+
card: {
|
|
1700
|
+
...tarotCard,
|
|
1701
|
+
isInverted: card.isInverted ?? false
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1705
|
+
function sortResolvedTarotSpreadCards(resolvedCards) {
|
|
1706
|
+
return [...resolvedCards].sort((left, right) => {
|
|
1707
|
+
if (left.slot.order !== right.slot.order) {
|
|
1708
|
+
return left.slot.order - right.slot.order;
|
|
1709
|
+
}
|
|
1710
|
+
return left.card.number - right.card.number;
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
function validateEventInquirerCard(spread, resolvedCards, context, errors) {
|
|
1714
|
+
const inquirerRule = spread.specialRules?.inquirerCard;
|
|
1715
|
+
if (!inquirerRule) {
|
|
1716
|
+
return;
|
|
1717
|
+
}
|
|
1718
|
+
if (!context?.inquirerGender) {
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1721
|
+
const inquirerCardNumber = inquirerRule.cardNumbersByGender[context.inquirerGender];
|
|
1722
|
+
const sourceCards = resolvedCards.filter(
|
|
1723
|
+
(card) => inquirerRule.sourceSlotKeys.includes(card.slotKey)
|
|
1724
|
+
);
|
|
1725
|
+
const inquirerCards = resolvedCards.filter(
|
|
1726
|
+
(card) => card.slotKey === inquirerRule.slotKey
|
|
1727
|
+
);
|
|
1728
|
+
if (inquirerCards.length !== 1) {
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
const sourceContainsGenderCard = sourceCards.some(
|
|
1732
|
+
(card) => card.card.number === inquirerCardNumber
|
|
1733
|
+
);
|
|
1734
|
+
const totalGenderCardCount = [...sourceCards, ...inquirerCards].filter(
|
|
1735
|
+
(card) => card.card.number === inquirerCardNumber
|
|
1736
|
+
).length;
|
|
1737
|
+
if (totalGenderCardCount !== 1) {
|
|
1738
|
+
errors.push({
|
|
1739
|
+
code: "INVALID_INQUIRER_CARD",
|
|
1740
|
+
slotKey: inquirerRule.slotKey,
|
|
1741
|
+
cardNumber: inquirerCardNumber,
|
|
1742
|
+
message: "Event Reading must contain the gendered inquirer card exactly once across the major arcana band and inquirer slot."
|
|
1743
|
+
});
|
|
1744
|
+
return;
|
|
1745
|
+
}
|
|
1746
|
+
if (!sourceContainsGenderCard && inquirerCards[0].card.number !== inquirerCardNumber) {
|
|
1747
|
+
errors.push({
|
|
1748
|
+
code: "INVALID_INQUIRER_CARD",
|
|
1749
|
+
slotKey: inquirerRule.slotKey,
|
|
1750
|
+
cardNumber: inquirerCards[0].card.number,
|
|
1751
|
+
message: "When the inquirer card was not drawn in the seven major slots, it must occupy the Inquirer slot."
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
function pickTarotCardFromPool(pool, constraint, rng) {
|
|
1756
|
+
const candidateIndexes = pool.reduce((indexes, card, index) => {
|
|
1757
|
+
if (matchesTarotSpreadConstraint(card, constraint)) {
|
|
1758
|
+
indexes.push(index);
|
|
1759
|
+
}
|
|
1760
|
+
return indexes;
|
|
1761
|
+
}, []);
|
|
1762
|
+
if (candidateIndexes.length === 0) {
|
|
1763
|
+
throw new Error("Unable to draw a tarot card that satisfies the spread rule.");
|
|
1764
|
+
}
|
|
1765
|
+
const pickedIndex = candidateIndexes[randomIndex(candidateIndexes.length, rng)];
|
|
1766
|
+
const [pickedCard] = pool.splice(pickedIndex, 1);
|
|
1767
|
+
return pickedCard;
|
|
1768
|
+
}
|
|
1769
|
+
function buildResolvedDrawnCard(slot, card, includeInverted, rng) {
|
|
1770
|
+
const drawnCard = withSpreadCardOrientation(card, includeInverted, rng);
|
|
1771
|
+
return {
|
|
1772
|
+
slotKey: slot.slotKey,
|
|
1773
|
+
cardNumber: drawnCard.number,
|
|
1774
|
+
isInverted: drawnCard.isInverted ?? false,
|
|
1775
|
+
slot,
|
|
1776
|
+
card: drawnCard
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
function drawDefaultTarotSpread(spread, includeInverted, rng) {
|
|
1780
|
+
const deckPool = [...ARKANNUS];
|
|
1781
|
+
const drawnCards = [];
|
|
1782
|
+
for (const slot of spread.slots.slice().sort((left, right) => left.order - right.order)) {
|
|
1783
|
+
const drawRule = getTarotSpreadRuleForDraw(slot);
|
|
1784
|
+
for (let index = 0; index < slot.maxCards; index += 1) {
|
|
1785
|
+
const card = pickTarotCardFromPool(deckPool, drawRule, rng);
|
|
1786
|
+
drawnCards.push(
|
|
1787
|
+
buildResolvedDrawnCard(slot, card, includeInverted, rng)
|
|
1788
|
+
);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
return drawnCards;
|
|
1792
|
+
}
|
|
1793
|
+
function drawEventReadingSpread(spread, includeInverted, rng, context) {
|
|
1794
|
+
const inquirerRule = spread.specialRules?.inquirerCard;
|
|
1795
|
+
if (!inquirerRule || !context?.inquirerGender) {
|
|
1796
|
+
throw new Error(
|
|
1797
|
+
"Event Reading draw requires `context.inquirerGender`."
|
|
1798
|
+
);
|
|
1799
|
+
}
|
|
1800
|
+
const slotsByKey = new Map(
|
|
1801
|
+
spread.slots.map((slot) => [slot.slotKey, slot])
|
|
1802
|
+
);
|
|
1803
|
+
const outerPool = ARKANNUS.filter(
|
|
1804
|
+
(card) => card.type === "minor" || card.type === "daat+royalship"
|
|
1805
|
+
);
|
|
1806
|
+
const majorPool = ARKANNUS.filter((card) => card.type === "major");
|
|
1807
|
+
const drawnCards = [];
|
|
1808
|
+
for (const slot of spread.slots.filter((candidate) => candidate.metadata?.groupKey === "outer").sort((left, right) => left.order - right.order)) {
|
|
1809
|
+
const card = pickTarotCardFromPool(outerPool, getTarotSpreadRuleForDraw(slot), rng);
|
|
1810
|
+
drawnCards.push(buildResolvedDrawnCard(slot, card, includeInverted, rng));
|
|
1811
|
+
}
|
|
1812
|
+
for (const slotKey of inquirerRule.sourceSlotKeys) {
|
|
1813
|
+
const slot = slotsByKey.get(slotKey);
|
|
1814
|
+
if (!slot) {
|
|
1815
|
+
throw new Error(`Missing Event Reading slot definition for ${slotKey}.`);
|
|
1816
|
+
}
|
|
1817
|
+
const card = pickTarotCardFromPool(majorPool, getTarotSpreadRuleForDraw(slot), rng);
|
|
1818
|
+
drawnCards.push(buildResolvedDrawnCard(slot, card, includeInverted, rng));
|
|
1819
|
+
}
|
|
1820
|
+
const genderedInquirerCardNumber = inquirerRule.cardNumbersByGender[context.inquirerGender];
|
|
1821
|
+
const sourceContainsGenderedCard = drawnCards.some(
|
|
1822
|
+
(card) => inquirerRule.sourceSlotKeys.includes(card.slotKey) && card.card.number === genderedInquirerCardNumber
|
|
1823
|
+
);
|
|
1824
|
+
const inquirerSlot = slotsByKey.get(inquirerRule.slotKey);
|
|
1825
|
+
if (!inquirerSlot) {
|
|
1826
|
+
throw new Error(
|
|
1827
|
+
`Missing Event Reading slot definition for ${inquirerRule.slotKey}.`
|
|
1828
|
+
);
|
|
1829
|
+
}
|
|
1830
|
+
if (!sourceContainsGenderedCard) {
|
|
1831
|
+
const genderedCardIndex = majorPool.findIndex(
|
|
1832
|
+
(card) => card.number === genderedInquirerCardNumber
|
|
1833
|
+
);
|
|
1834
|
+
if (genderedCardIndex < 0) {
|
|
1835
|
+
throw new Error(
|
|
1836
|
+
"Unable to assign the Event Reading inquirer card from the remaining major arcana."
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
const [genderedCard] = majorPool.splice(genderedCardIndex, 1);
|
|
1840
|
+
drawnCards.push(
|
|
1841
|
+
buildResolvedDrawnCard(inquirerSlot, genderedCard, includeInverted, rng)
|
|
1842
|
+
);
|
|
1843
|
+
} else {
|
|
1844
|
+
const replacement = pickTarotCardFromPool(
|
|
1845
|
+
majorPool,
|
|
1846
|
+
getTarotSpreadRuleForDraw(inquirerSlot),
|
|
1847
|
+
rng
|
|
1848
|
+
);
|
|
1849
|
+
drawnCards.push(
|
|
1850
|
+
buildResolvedDrawnCard(inquirerSlot, replacement, includeInverted, rng)
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1853
|
+
return drawnCards;
|
|
1854
|
+
}
|
|
1855
|
+
function listTarotSpreads() {
|
|
1856
|
+
return TAROT_SPREADS.map(cloneSpreadDefinition);
|
|
1857
|
+
}
|
|
1858
|
+
function getTarotSpread(spreadId) {
|
|
1859
|
+
const spread = TAROT_SPREAD_BY_ID.get(spreadId);
|
|
1860
|
+
return spread ? cloneSpreadDefinition(spread) : void 0;
|
|
1861
|
+
}
|
|
1862
|
+
function validateTarotSpreadSelection(input) {
|
|
1863
|
+
const spread = TAROT_SPREAD_BY_ID.get(input.spreadId);
|
|
1864
|
+
const errors = [];
|
|
1865
|
+
if (!spread) {
|
|
1866
|
+
return {
|
|
1867
|
+
ok: false,
|
|
1868
|
+
isComplete: false,
|
|
1869
|
+
errors: [
|
|
1870
|
+
{
|
|
1871
|
+
code: "UNKNOWN_SPREAD",
|
|
1872
|
+
message: `Unknown tarot spread: ${input.spreadId}.`
|
|
1873
|
+
}
|
|
1874
|
+
],
|
|
1875
|
+
resolvedCards: []
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
const slotsByKey = new Map(
|
|
1879
|
+
spread.slots.map((slot) => [slot.slotKey, slot])
|
|
1880
|
+
);
|
|
1881
|
+
const seenCardNumbers = /* @__PURE__ */ new Set();
|
|
1882
|
+
const resolvedCards = [];
|
|
1883
|
+
for (const selectedCard of input.cards) {
|
|
1884
|
+
const slot = slotsByKey.get(selectedCard.slotKey);
|
|
1885
|
+
if (!slot) {
|
|
1886
|
+
errors.push({
|
|
1887
|
+
code: "UNKNOWN_SLOT",
|
|
1888
|
+
slotKey: selectedCard.slotKey,
|
|
1889
|
+
message: `Unknown slot for ${spread.label}: ${selectedCard.slotKey}.`
|
|
1890
|
+
});
|
|
1891
|
+
continue;
|
|
1892
|
+
}
|
|
1893
|
+
const tarotCard = getTarotDeckCardByNumber(selectedCard.cardNumber);
|
|
1894
|
+
if (!tarotCard) {
|
|
1895
|
+
errors.push({
|
|
1896
|
+
code: "CARD_NOT_FOUND",
|
|
1897
|
+
slotKey: selectedCard.slotKey,
|
|
1898
|
+
cardNumber: selectedCard.cardNumber,
|
|
1899
|
+
message: `Unknown tarot card number: ${selectedCard.cardNumber}.`
|
|
1900
|
+
});
|
|
1901
|
+
continue;
|
|
1902
|
+
}
|
|
1903
|
+
if (seenCardNumbers.has(tarotCard.number)) {
|
|
1904
|
+
errors.push({
|
|
1905
|
+
code: "DUPLICATE_CARD",
|
|
1906
|
+
slotKey: selectedCard.slotKey,
|
|
1907
|
+
cardNumber: tarotCard.number,
|
|
1908
|
+
message: `Tarot card ${tarotCard.number} is duplicated across the spread.`
|
|
1909
|
+
});
|
|
1910
|
+
continue;
|
|
1911
|
+
}
|
|
1912
|
+
seenCardNumbers.add(tarotCard.number);
|
|
1913
|
+
resolvedCards.push(
|
|
1914
|
+
resolveTarotSpreadSelectionCard(selectedCard, slot, tarotCard)
|
|
1915
|
+
);
|
|
1916
|
+
}
|
|
1917
|
+
let isComplete = true;
|
|
1918
|
+
for (const slot of spread.slots) {
|
|
1919
|
+
const slotCards = resolvedCards.filter(
|
|
1920
|
+
(selectedCard) => selectedCard.slotKey === slot.slotKey
|
|
1921
|
+
);
|
|
1922
|
+
if (slotCards.length < slot.minCards) {
|
|
1923
|
+
isComplete = false;
|
|
1924
|
+
if (!input.allowPartial) {
|
|
1925
|
+
errors.push({
|
|
1926
|
+
code: "MISSING_REQUIRED_CARDS",
|
|
1927
|
+
slotKey: slot.slotKey,
|
|
1928
|
+
message: `${spread.label} requires ${slot.minCards} card(s) for ${slot.label}.`
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
if (slotCards.length > slot.maxCards) {
|
|
1933
|
+
isComplete = false;
|
|
1934
|
+
errors.push({
|
|
1935
|
+
code: "TOO_MANY_CARDS",
|
|
1936
|
+
slotKey: slot.slotKey,
|
|
1937
|
+
message: `${spread.label} allows at most ${slot.maxCards} card(s) for ${slot.label}.`
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
const validationRule = getTarotSpreadRuleForValidation(slot);
|
|
1941
|
+
for (const slotCard of slotCards) {
|
|
1942
|
+
if (validationRule?.allowedTypes && !validationRule.allowedTypes.includes(slotCard.card.type)) {
|
|
1943
|
+
errors.push({
|
|
1944
|
+
code: "INVALID_CARD_TYPE",
|
|
1945
|
+
slotKey: slot.slotKey,
|
|
1946
|
+
cardNumber: slotCard.card.number,
|
|
1947
|
+
message: `${slot.label} does not accept ${slotCard.card.type} cards.`
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
if (validationRule?.requiredRank && getTarotMinorRank(slotCard.card) !== validationRule.requiredRank) {
|
|
1951
|
+
errors.push({
|
|
1952
|
+
code: "INVALID_CARD_RANK",
|
|
1953
|
+
slotKey: slot.slotKey,
|
|
1954
|
+
cardNumber: slotCard.card.number,
|
|
1955
|
+
message: `${slot.label} requires a ${validationRule.requiredRank} minor arcana card.`
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
if (validationRule?.allowedCardFilenames && !validationRule.allowedCardFilenames.includes(slotCard.card.tarotCardFilename)) {
|
|
1959
|
+
errors.push({
|
|
1960
|
+
code: "DISALLOWED_CARD",
|
|
1961
|
+
slotKey: slot.slotKey,
|
|
1962
|
+
cardNumber: slotCard.card.number,
|
|
1963
|
+
message: `${slotCard.card.tarotCard} is not allowed in ${slot.label}.`
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
if (validationRule?.excludedCardFilenames && validationRule.excludedCardFilenames.includes(slotCard.card.tarotCardFilename)) {
|
|
1967
|
+
errors.push({
|
|
1968
|
+
code: "DISALLOWED_CARD",
|
|
1969
|
+
slotKey: slot.slotKey,
|
|
1970
|
+
cardNumber: slotCard.card.number,
|
|
1971
|
+
message: `${slotCard.card.tarotCard} is excluded from ${slot.label}.`
|
|
1972
|
+
});
|
|
2142
1973
|
}
|
|
2143
1974
|
}
|
|
2144
1975
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
return void 0;
|
|
1976
|
+
if (spread.contextRequirements?.includes("inquirerGender") && !input.context?.inquirerGender) {
|
|
1977
|
+
isComplete = false;
|
|
1978
|
+
errors.push({
|
|
1979
|
+
code: "MISSING_CONTEXT",
|
|
1980
|
+
message: `${spread.label} requires \`context.inquirerGender\`.`
|
|
1981
|
+
});
|
|
2152
1982
|
}
|
|
1983
|
+
validateEventInquirerCard(spread, resolvedCards, input.context, errors);
|
|
1984
|
+
const sortedResolvedCards = sortResolvedTarotSpreadCards(resolvedCards);
|
|
2153
1985
|
return {
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
1986
|
+
ok: errors.length === 0,
|
|
1987
|
+
isComplete,
|
|
1988
|
+
spread: cloneSpreadDefinition(spread),
|
|
1989
|
+
resolvedCards: sortedResolvedCards,
|
|
1990
|
+
errors
|
|
2158
1991
|
};
|
|
2159
1992
|
}
|
|
2160
|
-
function
|
|
1993
|
+
function drawTarotSpread(options) {
|
|
1994
|
+
const spread = TAROT_SPREAD_BY_ID.get(options.spreadId);
|
|
1995
|
+
if (!spread) {
|
|
1996
|
+
throw new Error(`Unknown tarot spread: ${options.spreadId}.`);
|
|
1997
|
+
}
|
|
1998
|
+
const rng = options.rng ?? Math.random;
|
|
1999
|
+
const includeInverted = options.includeInverted ?? false;
|
|
2000
|
+
const drawnCards = spread.spreadId === "event-reading" ? drawEventReadingSpread(spread, includeInverted, rng, options.context) : drawDefaultTarotSpread(spread, includeInverted, rng);
|
|
2001
|
+
const validation = validateTarotSpreadSelection({
|
|
2002
|
+
spreadId: spread.spreadId,
|
|
2003
|
+
cards: drawnCards.map((card) => ({
|
|
2004
|
+
slotKey: card.slotKey,
|
|
2005
|
+
cardNumber: card.cardNumber,
|
|
2006
|
+
isInverted: card.isInverted
|
|
2007
|
+
})),
|
|
2008
|
+
context: options.context
|
|
2009
|
+
});
|
|
2010
|
+
if (!validation.ok) {
|
|
2011
|
+
throw new Error(
|
|
2012
|
+
`Generated an invalid tarot spread selection for ${spread.label}: ${validation.errors.map((error) => error.message).join(" ")}`
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2161
2015
|
return {
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
metadata: slot.metadata ? { ...slot.metadata } : void 0
|
|
2016
|
+
spread: cloneSpreadDefinition(spread),
|
|
2017
|
+
deckId: options.deckId ?? "rider-waite",
|
|
2018
|
+
context: options.context,
|
|
2019
|
+
cards: sortResolvedTarotSpreadCards(drawnCards)
|
|
2167
2020
|
};
|
|
2168
2021
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2022
|
+
|
|
2023
|
+
// src/tarot/index.ts
|
|
2024
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2025
|
+
var shuffleArray = (array, rng = Math.random) => {
|
|
2026
|
+
const newArray = [...array];
|
|
2027
|
+
for (let i = newArray.length - 1; i > 0; i--) {
|
|
2028
|
+
const j = Math.floor(rng() * (i + 1));
|
|
2029
|
+
[newArray[i], newArray[j]] = [newArray[j], newArray[i]];
|
|
2030
|
+
}
|
|
2031
|
+
return newArray;
|
|
2032
|
+
};
|
|
2033
|
+
async function shuffleTarotDeck(cards, includeInvertedCards = false, shuffleCount = 6, shuffleDelay = 300, rng = Math.random) {
|
|
2034
|
+
let shuffledCards = shuffleArray([...cards], rng);
|
|
2035
|
+
if (includeInvertedCards) {
|
|
2036
|
+
const halfIndex = Math.floor(shuffledCards.length / 2);
|
|
2037
|
+
shuffledCards = [
|
|
2038
|
+
...shuffledCards.slice(0, halfIndex).map((card) => ({ ...card, isInverted: true })),
|
|
2039
|
+
...shuffledCards.slice(halfIndex)
|
|
2040
|
+
];
|
|
2041
|
+
}
|
|
2042
|
+
for (let i = 0; i < shuffleCount; i++) {
|
|
2043
|
+
shuffledCards = shuffleArray(shuffledCards, rng);
|
|
2044
|
+
await sleep(shuffleDelay);
|
|
2045
|
+
}
|
|
2046
|
+
return shuffledCards;
|
|
2184
2047
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2048
|
+
var TAROT_IMAGE_BASE_URL = "https://kaabalah-app.s3.us-east-1.amazonaws.com/tarot";
|
|
2049
|
+
var tarotArchetypeCache;
|
|
2050
|
+
var tarotCardProfileCache;
|
|
2051
|
+
function normalizePathSlug(pathSlug) {
|
|
2052
|
+
return pathSlug.trim().replace(/^\/?path\//i, "").toLowerCase();
|
|
2187
2053
|
}
|
|
2188
|
-
function
|
|
2189
|
-
return
|
|
2054
|
+
function normalizeTarotLookupKey(value) {
|
|
2055
|
+
return value.trim().toLowerCase();
|
|
2190
2056
|
}
|
|
2191
|
-
|
|
2192
|
-
|
|
2057
|
+
var TAROT_ARK_ANNU_ID_BY_NAME = new Map(
|
|
2058
|
+
ARKANNUS.map((card) => [
|
|
2059
|
+
normalizeTarotLookupKey(card.tarotCard),
|
|
2060
|
+
id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard)
|
|
2061
|
+
])
|
|
2062
|
+
);
|
|
2063
|
+
var TAROT_ARK_ANNU_ID_BY_FILENAME = new Map(
|
|
2064
|
+
ARKANNUS.map((card) => [
|
|
2065
|
+
normalizeTarotLookupKey(card.tarotCardFilename),
|
|
2066
|
+
id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard)
|
|
2067
|
+
])
|
|
2068
|
+
);
|
|
2069
|
+
var TAROT_COURT_RANKS = [
|
|
2070
|
+
"king",
|
|
2071
|
+
"queen",
|
|
2072
|
+
"knight",
|
|
2073
|
+
"page"
|
|
2074
|
+
];
|
|
2075
|
+
var MAJOR_ARCANA_CARDS = ARKANNUS.filter(
|
|
2076
|
+
(card) => card.type === "major" && majorArcana.includes(card.tarotCardFilename)
|
|
2077
|
+
);
|
|
2078
|
+
function toTarotCardKind(card) {
|
|
2079
|
+
if (card.type === "major") {
|
|
2080
|
+
return "major";
|
|
2081
|
+
}
|
|
2082
|
+
return card.type === "minor" ? "minor" : "court";
|
|
2193
2083
|
}
|
|
2194
|
-
function
|
|
2195
|
-
if (card.type !== "
|
|
2084
|
+
function toTarotCourtRank(card) {
|
|
2085
|
+
if (card.type !== "daat+royalship") {
|
|
2196
2086
|
return void 0;
|
|
2197
2087
|
}
|
|
2198
|
-
const rank = card.tarotCardFilename.split("_")
|
|
2199
|
-
return
|
|
2088
|
+
const [rank] = card.tarotCardFilename.split("_");
|
|
2089
|
+
return TAROT_COURT_RANKS.includes(rank) ? rank : void 0;
|
|
2200
2090
|
}
|
|
2201
|
-
function
|
|
2202
|
-
|
|
2203
|
-
return true;
|
|
2204
|
-
}
|
|
2205
|
-
if (constraint.allowedTypes && !constraint.allowedTypes.includes(card.type)) {
|
|
2206
|
-
return false;
|
|
2207
|
-
}
|
|
2208
|
-
if (constraint.allowedCardFilenames && !constraint.allowedCardFilenames.includes(card.tarotCardFilename)) {
|
|
2209
|
-
return false;
|
|
2210
|
-
}
|
|
2211
|
-
if (constraint.excludedCardFilenames && constraint.excludedCardFilenames.includes(card.tarotCardFilename)) {
|
|
2212
|
-
return false;
|
|
2213
|
-
}
|
|
2214
|
-
if (constraint.requiredRank) {
|
|
2215
|
-
return getTarotMinorRank(card) === constraint.requiredRank;
|
|
2216
|
-
}
|
|
2217
|
-
return true;
|
|
2091
|
+
function toTarotAssetPathType(card) {
|
|
2092
|
+
return card.type;
|
|
2218
2093
|
}
|
|
2219
|
-
function
|
|
2220
|
-
if (
|
|
2221
|
-
|
|
2094
|
+
function buildTarotAssetPath(card) {
|
|
2095
|
+
if (card.assetPathType === "major") {
|
|
2096
|
+
return `major/${card.tarotCardFilename}`;
|
|
2222
2097
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2098
|
+
if (!card.suit) {
|
|
2099
|
+
throw new Error(
|
|
2100
|
+
`Missing suit metadata required to resolve tarot image path for ${card.tarotCardName}.`
|
|
2101
|
+
);
|
|
2226
2102
|
}
|
|
2227
|
-
|
|
2228
|
-
return Math.floor(normalized * length);
|
|
2103
|
+
return `${card.assetPathType}/${card.suit}/${card.tarotCardFilename}`;
|
|
2229
2104
|
}
|
|
2230
|
-
function
|
|
2105
|
+
function toAstrologyCorrespondence(node) {
|
|
2231
2106
|
return {
|
|
2232
|
-
|
|
2233
|
-
|
|
2107
|
+
type: node.type,
|
|
2108
|
+
id: node.id,
|
|
2109
|
+
label: parseId(node.id)
|
|
2234
2110
|
};
|
|
2235
2111
|
}
|
|
2236
|
-
function
|
|
2112
|
+
function getTarotCorrespondenceTree(treeId = DEFAULT_TAROT_TREE_ID) {
|
|
2113
|
+
return getCanonicalTree({
|
|
2114
|
+
system: treeId,
|
|
2115
|
+
parts: ["westernAstrology", "tarot"]
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
function getCorrespondenceNodes(tree, sourceId, type, depth = 1, limit) {
|
|
2119
|
+
return tree.getCorrespondences(sourceId, {
|
|
2120
|
+
type,
|
|
2121
|
+
depth,
|
|
2122
|
+
limit
|
|
2123
|
+
}).map(({ node }) => node);
|
|
2124
|
+
}
|
|
2125
|
+
function getFirstCorrespondenceNode(tree, sourceId, type, depth = 1) {
|
|
2126
|
+
return getCorrespondenceNodes(tree, sourceId, type, depth, 1)[0];
|
|
2127
|
+
}
|
|
2128
|
+
function toCorrespondenceNode(node) {
|
|
2129
|
+
if (!node) {
|
|
2130
|
+
return void 0;
|
|
2131
|
+
}
|
|
2237
2132
|
return {
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
card: {
|
|
2241
|
-
...tarotCard,
|
|
2242
|
-
isInverted: card.isInverted ?? false
|
|
2243
|
-
}
|
|
2133
|
+
id: node.id,
|
|
2134
|
+
label: parseId(node.id)
|
|
2244
2135
|
};
|
|
2245
2136
|
}
|
|
2246
|
-
function
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2137
|
+
function toUniqueCorrespondenceNodes(nodes) {
|
|
2138
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2139
|
+
return nodes.flatMap((node) => {
|
|
2140
|
+
const key = String(node.id);
|
|
2141
|
+
if (seen.has(key)) {
|
|
2142
|
+
return [];
|
|
2250
2143
|
}
|
|
2251
|
-
|
|
2144
|
+
seen.add(key);
|
|
2145
|
+
return [toCorrespondenceNode(node)];
|
|
2252
2146
|
});
|
|
2253
2147
|
}
|
|
2254
|
-
function
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2148
|
+
function toTarotCorrespondenceProfileBase(card) {
|
|
2149
|
+
return {
|
|
2150
|
+
tarotArkAnnuId: card.tarotArkAnnuId,
|
|
2151
|
+
tarotCardNumber: card.tarotCardNumber,
|
|
2152
|
+
tarotCardName: card.tarotCardName,
|
|
2153
|
+
tarotCardFilename: card.tarotCardFilename,
|
|
2154
|
+
tarotMeaning: card.tarotMeaning,
|
|
2155
|
+
suit: card.suit
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
function resolveTarotCardProfileForTree(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
|
|
2159
|
+
if ("tarotCardNumber" in lookup) {
|
|
2160
|
+
return getTarotCardByNumber(lookup.tarotCardNumber, treeId);
|
|
2261
2161
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2162
|
+
return getTarotCardProfile(lookup);
|
|
2163
|
+
}
|
|
2164
|
+
function buildMajorCorrespondenceProfile(card, tree) {
|
|
2165
|
+
const pathNode = getFirstCorrespondenceNode(
|
|
2166
|
+
tree,
|
|
2167
|
+
card.tarotArkAnnuId,
|
|
2168
|
+
"path" /* PATH */
|
|
2268
2169
|
);
|
|
2269
|
-
|
|
2270
|
-
|
|
2170
|
+
const hebrewLetterNode = pathNode ? getFirstCorrespondenceNode(
|
|
2171
|
+
tree,
|
|
2172
|
+
pathNode.id,
|
|
2173
|
+
"hebrewLetter" /* HEBREW_LETTER */
|
|
2174
|
+
) : void 0;
|
|
2175
|
+
const pathNumberNode = pathNode ? getFirstCorrespondenceNode(tree, pathNode.id, "number" /* NUMBER */) : void 0;
|
|
2176
|
+
const pathNumber = pathNumberNode ? Number.parseInt(parseId(pathNumberNode.id), 10) : Number.NaN;
|
|
2177
|
+
const fromSphereNode = pathNode?.data?.from ? tree.getNode(pathNode.data.from) : void 0;
|
|
2178
|
+
const toSphereNode = pathNode?.data?.to ? tree.getNode(pathNode.data.to) : void 0;
|
|
2179
|
+
if (!pathNode || !hebrewLetterNode || !fromSphereNode || !toSphereNode || !Number.isFinite(pathNumber)) {
|
|
2180
|
+
return void 0;
|
|
2271
2181
|
}
|
|
2272
|
-
|
|
2273
|
-
(card)
|
|
2182
|
+
return {
|
|
2183
|
+
...toTarotCorrespondenceProfileBase(card),
|
|
2184
|
+
kind: "major",
|
|
2185
|
+
correspondences: {
|
|
2186
|
+
astrology: getCorrespondenceNodes(
|
|
2187
|
+
tree,
|
|
2188
|
+
pathNode.id,
|
|
2189
|
+
[
|
|
2190
|
+
"westernElement" /* WESTERN_ELEMENT */,
|
|
2191
|
+
"planet" /* PLANET */,
|
|
2192
|
+
"westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
|
|
2193
|
+
]
|
|
2194
|
+
).map(
|
|
2195
|
+
(node) => toAstrologyCorrespondence(
|
|
2196
|
+
node
|
|
2197
|
+
)
|
|
2198
|
+
),
|
|
2199
|
+
path: {
|
|
2200
|
+
pathId: pathNode.id,
|
|
2201
|
+
pathNumber,
|
|
2202
|
+
pathSlug: parseId(hebrewLetterNode.id).toLowerCase(),
|
|
2203
|
+
meaning: pathNode.data?.meaning,
|
|
2204
|
+
hebrewLetter: toCorrespondenceNode(hebrewLetterNode),
|
|
2205
|
+
fromSphere: toCorrespondenceNode(
|
|
2206
|
+
fromSphereNode
|
|
2207
|
+
),
|
|
2208
|
+
toSphere: toCorrespondenceNode(
|
|
2209
|
+
toSphereNode
|
|
2210
|
+
)
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
2214
|
+
}
|
|
2215
|
+
function buildCourtCorrespondenceProfile(card, tree) {
|
|
2216
|
+
const suitNode = getFirstCorrespondenceNode(
|
|
2217
|
+
tree,
|
|
2218
|
+
card.tarotArkAnnuId,
|
|
2219
|
+
"tarotSuit" /* TAROT_SUIT */
|
|
2274
2220
|
);
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
).length;
|
|
2278
|
-
if (totalGenderCardCount !== 1) {
|
|
2279
|
-
errors.push({
|
|
2280
|
-
code: "INVALID_INQUIRER_CARD",
|
|
2281
|
-
slotKey: inquirerRule.slotKey,
|
|
2282
|
-
cardNumber: inquirerCardNumber,
|
|
2283
|
-
message: "Event Reading must contain the gendered inquirer card exactly once across the major arcana band and inquirer slot."
|
|
2284
|
-
});
|
|
2285
|
-
return;
|
|
2221
|
+
if (!card.courtRank) {
|
|
2222
|
+
return void 0;
|
|
2286
2223
|
}
|
|
2287
|
-
if (
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2224
|
+
if (card.courtRank === "page") {
|
|
2225
|
+
const elementNode = suitNode ? getFirstCorrespondenceNode(
|
|
2226
|
+
tree,
|
|
2227
|
+
suitNode.id,
|
|
2228
|
+
"westernElement" /* WESTERN_ELEMENT */
|
|
2229
|
+
) : void 0;
|
|
2230
|
+
if (!elementNode) {
|
|
2231
|
+
return void 0;
|
|
2232
|
+
}
|
|
2233
|
+
return {
|
|
2234
|
+
...toTarotCorrespondenceProfileBase(card),
|
|
2235
|
+
kind: "court",
|
|
2236
|
+
courtRank: "page",
|
|
2237
|
+
correspondences: {
|
|
2238
|
+
element: toCorrespondenceNode(elementNode)
|
|
2239
|
+
}
|
|
2240
|
+
};
|
|
2294
2241
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2242
|
+
const signNode = getFirstCorrespondenceNode(
|
|
2243
|
+
tree,
|
|
2244
|
+
card.tarotArkAnnuId,
|
|
2245
|
+
"westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
|
|
2246
|
+
);
|
|
2247
|
+
if (!signNode) {
|
|
2248
|
+
return void 0;
|
|
2249
|
+
}
|
|
2250
|
+
return {
|
|
2251
|
+
...toTarotCorrespondenceProfileBase(card),
|
|
2252
|
+
kind: "court",
|
|
2253
|
+
courtRank: card.courtRank,
|
|
2254
|
+
correspondences: {
|
|
2255
|
+
sign: toCorrespondenceNode(signNode),
|
|
2256
|
+
planets: toUniqueCorrespondenceNodes(
|
|
2257
|
+
getCorrespondenceNodes(
|
|
2258
|
+
tree,
|
|
2259
|
+
signNode.id,
|
|
2260
|
+
"planet" /* PLANET */
|
|
2261
|
+
)
|
|
2262
|
+
)
|
|
2300
2263
|
}
|
|
2301
|
-
|
|
2302
|
-
}, []);
|
|
2303
|
-
if (candidateIndexes.length === 0) {
|
|
2304
|
-
throw new Error("Unable to draw a tarot card that satisfies the spread rule.");
|
|
2305
|
-
}
|
|
2306
|
-
const pickedIndex = candidateIndexes[randomIndex(candidateIndexes.length, rng)];
|
|
2307
|
-
const [pickedCard] = pool.splice(pickedIndex, 1);
|
|
2308
|
-
return pickedCard;
|
|
2264
|
+
};
|
|
2309
2265
|
}
|
|
2310
|
-
function
|
|
2311
|
-
const
|
|
2266
|
+
function buildMinorCorrespondenceProfile(card, tree) {
|
|
2267
|
+
const sphereNode = getFirstCorrespondenceNode(
|
|
2268
|
+
tree,
|
|
2269
|
+
card.tarotArkAnnuId,
|
|
2270
|
+
"sphere" /* SPHERE */
|
|
2271
|
+
);
|
|
2272
|
+
if (!sphereNode) {
|
|
2273
|
+
return void 0;
|
|
2274
|
+
}
|
|
2312
2275
|
return {
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2276
|
+
...toTarotCorrespondenceProfileBase(card),
|
|
2277
|
+
kind: "minor",
|
|
2278
|
+
correspondences: {
|
|
2279
|
+
sphere: toCorrespondenceNode(sphereNode),
|
|
2280
|
+
planets: toUniqueCorrespondenceNodes(
|
|
2281
|
+
getCorrespondenceNodes(tree, sphereNode.id, "planet" /* PLANET */)
|
|
2282
|
+
)
|
|
2283
|
+
}
|
|
2318
2284
|
};
|
|
2319
2285
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const
|
|
2322
|
-
const
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
);
|
|
2286
|
+
function buildDescriptionsByDeck(tarotArkAnnu) {
|
|
2287
|
+
const descriptions = {};
|
|
2288
|
+
for (const deck of TAROT_DECK_METADATA) {
|
|
2289
|
+
if (!deck.descriptiveDataKey) {
|
|
2290
|
+
continue;
|
|
2291
|
+
}
|
|
2292
|
+
const description = tarotArkAnnu.data?.descriptiveData?.[deck.descriptiveDataKey];
|
|
2293
|
+
if (!description) {
|
|
2294
|
+
continue;
|
|
2330
2295
|
}
|
|
2296
|
+
descriptions[deck.id] = { ...description };
|
|
2331
2297
|
}
|
|
2332
|
-
return
|
|
2298
|
+
return descriptions;
|
|
2333
2299
|
}
|
|
2334
|
-
function
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
throw new Error(
|
|
2338
|
-
"Event Reading draw requires `context.inquirerGender`."
|
|
2339
|
-
);
|
|
2340
|
-
}
|
|
2341
|
-
const slotsByKey = new Map(
|
|
2342
|
-
spread.slots.map((slot) => [slot.slotKey, slot])
|
|
2343
|
-
);
|
|
2344
|
-
const outerPool = ARKANNUS.filter(
|
|
2345
|
-
(card) => card.type === "minor" || card.type === "daat+royalship"
|
|
2346
|
-
);
|
|
2347
|
-
const majorPool = ARKANNUS.filter((card) => card.type === "major");
|
|
2348
|
-
const drawnCards = [];
|
|
2349
|
-
for (const slot of spread.slots.filter((candidate) => candidate.metadata?.groupKey === "outer").sort((left, right) => left.order - right.order)) {
|
|
2350
|
-
const card = pickTarotCardFromPool(outerPool, getTarotSpreadRuleForDraw(slot), rng);
|
|
2351
|
-
drawnCards.push(buildResolvedDrawnCard(slot, card, includeInverted, rng));
|
|
2300
|
+
function getTarotArchetypeCache() {
|
|
2301
|
+
if (tarotArchetypeCache) {
|
|
2302
|
+
return tarotArchetypeCache;
|
|
2352
2303
|
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2304
|
+
const tree = getCanonicalTree({
|
|
2305
|
+
system: "kaabalah",
|
|
2306
|
+
parts: ["westernAstrology", "tarot"]
|
|
2307
|
+
});
|
|
2308
|
+
const archetypes = MAJOR_ARCANA_CARDS.map((card) => {
|
|
2309
|
+
const pathId = id("path" /* PATH */, card.number);
|
|
2310
|
+
const path = tree.getNode(pathId);
|
|
2311
|
+
const hebrewLetter = tree.getCorrespondences(pathId, {
|
|
2312
|
+
type: "hebrewLetter" /* HEBREW_LETTER */,
|
|
2313
|
+
limit: 1
|
|
2314
|
+
})[0]?.node;
|
|
2315
|
+
const tarotArkAnnu = tree.getCorrespondences(pathId, {
|
|
2316
|
+
type: "tarotArkAnnu" /* TAROT_ARK_ANNU */,
|
|
2317
|
+
limit: 1
|
|
2318
|
+
})[0]?.node;
|
|
2319
|
+
if (!path || !hebrewLetter || !tarotArkAnnu) {
|
|
2320
|
+
throw new Error(
|
|
2321
|
+
`Missing canonical tarot archetype metadata for ${pathId}.`
|
|
2322
|
+
);
|
|
2357
2323
|
}
|
|
2358
|
-
const
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
`Missing Event Reading slot definition for ${inquirerRule.slotKey}.`
|
|
2324
|
+
const astrology = tree.getCorrespondences(pathId, {
|
|
2325
|
+
type: [
|
|
2326
|
+
"westernElement" /* WESTERN_ELEMENT */,
|
|
2327
|
+
"planet" /* PLANET */,
|
|
2328
|
+
"westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
|
|
2329
|
+
]
|
|
2330
|
+
}).map(
|
|
2331
|
+
({ node }) => toAstrologyCorrespondence(
|
|
2332
|
+
node
|
|
2333
|
+
)
|
|
2369
2334
|
);
|
|
2335
|
+
const descriptionsByDeck = buildDescriptionsByDeck(tarotArkAnnu);
|
|
2336
|
+
return {
|
|
2337
|
+
canonicalId: pathId,
|
|
2338
|
+
kind: "major",
|
|
2339
|
+
pathId,
|
|
2340
|
+
pathNumber: card.number,
|
|
2341
|
+
pathSlug: parseId(hebrewLetter.id).toLowerCase(),
|
|
2342
|
+
hebrewLetterId: hebrewLetter.id,
|
|
2343
|
+
hebrewLetter: parseId(hebrewLetter.id),
|
|
2344
|
+
pathMeaning: path.data?.meaning,
|
|
2345
|
+
tarotArkAnnuId: tarotArkAnnu.id,
|
|
2346
|
+
tarotCardNumber: card.number,
|
|
2347
|
+
tarotCardName: parseId(tarotArkAnnu.id),
|
|
2348
|
+
tarotCardFilename: card.tarotCardFilename,
|
|
2349
|
+
tarotMeaning: descriptionsByDeck.papus_pt?.meaning ?? card.meaning,
|
|
2350
|
+
astrology,
|
|
2351
|
+
availableDeckIds: TAROT_DECK_METADATA.map((deck) => deck.id),
|
|
2352
|
+
descriptionsByDeck
|
|
2353
|
+
};
|
|
2354
|
+
});
|
|
2355
|
+
tarotArchetypeCache = {
|
|
2356
|
+
archetypes,
|
|
2357
|
+
byPathId: new Map(archetypes.map((archetype) => [archetype.pathId, archetype])),
|
|
2358
|
+
byPathSlug: new Map(
|
|
2359
|
+
archetypes.map((archetype) => [archetype.pathSlug, archetype])
|
|
2360
|
+
),
|
|
2361
|
+
byTarotCardFilename: new Map(
|
|
2362
|
+
archetypes.map((archetype) => [archetype.tarotCardFilename, archetype])
|
|
2363
|
+
),
|
|
2364
|
+
byTarotCardNumber: new Map(
|
|
2365
|
+
archetypes.map((archetype) => [archetype.tarotCardNumber, archetype])
|
|
2366
|
+
)
|
|
2367
|
+
};
|
|
2368
|
+
return tarotArchetypeCache;
|
|
2369
|
+
}
|
|
2370
|
+
function getTarotCardProfileCache() {
|
|
2371
|
+
if (tarotCardProfileCache) {
|
|
2372
|
+
return tarotCardProfileCache;
|
|
2370
2373
|
}
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2374
|
+
const tree = getCanonicalTree({
|
|
2375
|
+
system: "kaabalah",
|
|
2376
|
+
parts: ["westernAstrology", "tarot"]
|
|
2377
|
+
});
|
|
2378
|
+
const availableDeckIds = TAROT_DECK_METADATA.map((deck) => deck.id);
|
|
2379
|
+
const profiles = ARKANNUS.map((card) => {
|
|
2380
|
+
const tarotArkAnnuId = id("tarotArkAnnu" /* TAROT_ARK_ANNU */, card.tarotCard);
|
|
2381
|
+
const tarotArkAnnu = tree.getNode(tarotArkAnnuId);
|
|
2382
|
+
if (!tarotArkAnnu) {
|
|
2383
|
+
throw new Error(`Missing canonical tarot metadata for ${tarotArkAnnuId}.`);
|
|
2379
2384
|
}
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2382
|
-
|
|
2385
|
+
const descriptionsByDeck = buildDescriptionsByDeck(tarotArkAnnu);
|
|
2386
|
+
return {
|
|
2387
|
+
tarotArkAnnuId,
|
|
2388
|
+
tarotCardNumber: card.number,
|
|
2389
|
+
tarotCardName: card.tarotCard,
|
|
2390
|
+
tarotCardFilename: card.tarotCardFilename,
|
|
2391
|
+
tarotMeaning: descriptionsByDeck.papus_pt?.meaning ?? card.meaning,
|
|
2392
|
+
kind: toTarotCardKind(card),
|
|
2393
|
+
assetPathType: toTarotAssetPathType(card),
|
|
2394
|
+
suit: card.suit,
|
|
2395
|
+
courtRank: toTarotCourtRank(card),
|
|
2396
|
+
availableDeckIds,
|
|
2397
|
+
descriptionsByDeck
|
|
2398
|
+
};
|
|
2399
|
+
});
|
|
2400
|
+
tarotCardProfileCache = {
|
|
2401
|
+
profiles,
|
|
2402
|
+
byTarotArkAnnuId: new Map(
|
|
2403
|
+
profiles.map((profile) => [String(profile.tarotArkAnnuId), profile])
|
|
2404
|
+
),
|
|
2405
|
+
byTarotCardName: new Map(
|
|
2406
|
+
profiles.map((profile) => [
|
|
2407
|
+
normalizeTarotLookupKey(profile.tarotCardName),
|
|
2408
|
+
profile
|
|
2409
|
+
])
|
|
2410
|
+
),
|
|
2411
|
+
byTarotCardFilename: new Map(
|
|
2412
|
+
profiles.map((profile) => [
|
|
2413
|
+
normalizeTarotLookupKey(profile.tarotCardFilename),
|
|
2414
|
+
profile
|
|
2415
|
+
])
|
|
2416
|
+
),
|
|
2417
|
+
byTarotCardNumber: new Map(
|
|
2418
|
+
profiles.map((profile) => [profile.tarotCardNumber, profile])
|
|
2419
|
+
)
|
|
2420
|
+
};
|
|
2421
|
+
return tarotCardProfileCache;
|
|
2422
|
+
}
|
|
2423
|
+
function buildTarotRepresentation(card, deck) {
|
|
2424
|
+
const description = card.descriptionsByDeck[deck.id];
|
|
2425
|
+
const assetPath = buildTarotAssetPath(card);
|
|
2426
|
+
const imageUrl = `${TAROT_IMAGE_BASE_URL}/${deck.id}/${assetPath}.jpg`;
|
|
2427
|
+
return {
|
|
2428
|
+
card,
|
|
2429
|
+
archetype: card.kind === "major" ? getTarotArchetype({ tarotCardNumber: card.tarotCardNumber }) : void 0,
|
|
2430
|
+
deck: { id: deck.id, label: deck.label },
|
|
2431
|
+
assetPath,
|
|
2432
|
+
imageUrl,
|
|
2433
|
+
label: `${card.tarotCardName} - ${deck.label}`,
|
|
2434
|
+
altText: `${card.tarotCardName} - ${deck.label}`,
|
|
2435
|
+
cardLabel: description?.name ?? card.tarotCardName,
|
|
2436
|
+
description
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2439
|
+
function resolveTarotArkAnnuId(lookup) {
|
|
2440
|
+
if ("pathSlug" in lookup || "pathId" in lookup) {
|
|
2441
|
+
return getTarotArchetype(lookup)?.tarotArkAnnuId;
|
|
2442
|
+
}
|
|
2443
|
+
if ("tarotArkAnnuId" in lookup) {
|
|
2444
|
+
return lookup.tarotArkAnnuId;
|
|
2445
|
+
}
|
|
2446
|
+
if ("tarotCardName" in lookup) {
|
|
2447
|
+
return TAROT_ARK_ANNU_ID_BY_NAME.get(
|
|
2448
|
+
normalizeTarotLookupKey(lookup.tarotCardName)
|
|
2383
2449
|
);
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
rng
|
|
2450
|
+
}
|
|
2451
|
+
if ("tarotCardFilename" in lookup) {
|
|
2452
|
+
return TAROT_ARK_ANNU_ID_BY_FILENAME.get(
|
|
2453
|
+
normalizeTarotLookupKey(lookup.tarotCardFilename)
|
|
2389
2454
|
);
|
|
2390
|
-
|
|
2391
|
-
|
|
2455
|
+
}
|
|
2456
|
+
return void 0;
|
|
2457
|
+
}
|
|
2458
|
+
function getTarotCardProfile(lookup) {
|
|
2459
|
+
const cache = getTarotCardProfileCache();
|
|
2460
|
+
if ("pathSlug" in lookup || "pathId" in lookup) {
|
|
2461
|
+
const archetype = getTarotArchetype(lookup);
|
|
2462
|
+
return archetype ? cache.byTarotCardNumber.get(archetype.tarotCardNumber) : void 0;
|
|
2463
|
+
}
|
|
2464
|
+
if ("tarotArkAnnuId" in lookup) {
|
|
2465
|
+
return cache.byTarotArkAnnuId.get(String(lookup.tarotArkAnnuId));
|
|
2466
|
+
}
|
|
2467
|
+
if ("tarotCardName" in lookup) {
|
|
2468
|
+
return cache.byTarotCardName.get(
|
|
2469
|
+
normalizeTarotLookupKey(lookup.tarotCardName)
|
|
2392
2470
|
);
|
|
2393
2471
|
}
|
|
2394
|
-
|
|
2472
|
+
if ("tarotCardFilename" in lookup) {
|
|
2473
|
+
return cache.byTarotCardFilename.get(
|
|
2474
|
+
normalizeTarotLookupKey(lookup.tarotCardFilename)
|
|
2475
|
+
);
|
|
2476
|
+
}
|
|
2477
|
+
return getTarotCardByNumber(lookup.tarotCardNumber);
|
|
2395
2478
|
}
|
|
2396
|
-
function
|
|
2397
|
-
return
|
|
2479
|
+
function listTarotDecks() {
|
|
2480
|
+
return TAROT_DECK_METADATA.map(({ id: id2, label }) => ({ id: id2, label }));
|
|
2398
2481
|
}
|
|
2399
|
-
function
|
|
2400
|
-
|
|
2401
|
-
return spread ? cloneSpreadDefinition(spread) : void 0;
|
|
2482
|
+
function listTarotTrees() {
|
|
2483
|
+
return [...TAROT_TREE_IDS];
|
|
2402
2484
|
}
|
|
2403
|
-
function
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
if (!spread) {
|
|
2407
|
-
return {
|
|
2408
|
-
ok: false,
|
|
2409
|
-
isComplete: false,
|
|
2410
|
-
errors: [
|
|
2411
|
-
{
|
|
2412
|
-
code: "UNKNOWN_SPREAD",
|
|
2413
|
-
message: `Unknown tarot spread: ${input.spreadId}.`
|
|
2414
|
-
}
|
|
2415
|
-
],
|
|
2416
|
-
resolvedCards: []
|
|
2417
|
-
};
|
|
2485
|
+
function getTarotCardNumber(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
|
|
2486
|
+
if ("tarotCardNumber" in lookup) {
|
|
2487
|
+
return getTarotCardByNumber(lookup.tarotCardNumber, treeId)?.tarotCardNumber;
|
|
2418
2488
|
}
|
|
2419
|
-
const
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
const seenCardNumbers = /* @__PURE__ */ new Set();
|
|
2423
|
-
const resolvedCards = [];
|
|
2424
|
-
for (const selectedCard of input.cards) {
|
|
2425
|
-
const slot = slotsByKey.get(selectedCard.slotKey);
|
|
2426
|
-
if (!slot) {
|
|
2427
|
-
errors.push({
|
|
2428
|
-
code: "UNKNOWN_SLOT",
|
|
2429
|
-
slotKey: selectedCard.slotKey,
|
|
2430
|
-
message: `Unknown slot for ${spread.label}: ${selectedCard.slotKey}.`
|
|
2431
|
-
});
|
|
2432
|
-
continue;
|
|
2433
|
-
}
|
|
2434
|
-
const tarotCard = getTarotDeckCardByNumber(selectedCard.cardNumber);
|
|
2435
|
-
if (!tarotCard) {
|
|
2436
|
-
errors.push({
|
|
2437
|
-
code: "CARD_NOT_FOUND",
|
|
2438
|
-
slotKey: selectedCard.slotKey,
|
|
2439
|
-
cardNumber: selectedCard.cardNumber,
|
|
2440
|
-
message: `Unknown tarot card number: ${selectedCard.cardNumber}.`
|
|
2441
|
-
});
|
|
2442
|
-
continue;
|
|
2443
|
-
}
|
|
2444
|
-
if (seenCardNumbers.has(tarotCard.number)) {
|
|
2445
|
-
errors.push({
|
|
2446
|
-
code: "DUPLICATE_CARD",
|
|
2447
|
-
slotKey: selectedCard.slotKey,
|
|
2448
|
-
cardNumber: tarotCard.number,
|
|
2449
|
-
message: `Tarot card ${tarotCard.number} is duplicated across the spread.`
|
|
2450
|
-
});
|
|
2451
|
-
continue;
|
|
2452
|
-
}
|
|
2453
|
-
seenCardNumbers.add(tarotCard.number);
|
|
2454
|
-
resolvedCards.push(
|
|
2455
|
-
resolveTarotSpreadSelectionCard(selectedCard, slot, tarotCard)
|
|
2456
|
-
);
|
|
2489
|
+
const tarotArkAnnuId = resolveTarotArkAnnuId(lookup);
|
|
2490
|
+
if (!tarotArkAnnuId) {
|
|
2491
|
+
return void 0;
|
|
2457
2492
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
isComplete = false;
|
|
2465
|
-
if (!input.allowPartial) {
|
|
2466
|
-
errors.push({
|
|
2467
|
-
code: "MISSING_REQUIRED_CARDS",
|
|
2468
|
-
slotKey: slot.slotKey,
|
|
2469
|
-
message: `${spread.label} requires ${slot.minCards} card(s) for ${slot.label}.`
|
|
2470
|
-
});
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
if (slotCards.length > slot.maxCards) {
|
|
2474
|
-
isComplete = false;
|
|
2475
|
-
errors.push({
|
|
2476
|
-
code: "TOO_MANY_CARDS",
|
|
2477
|
-
slotKey: slot.slotKey,
|
|
2478
|
-
message: `${spread.label} allows at most ${slot.maxCards} card(s) for ${slot.label}.`
|
|
2479
|
-
});
|
|
2480
|
-
}
|
|
2481
|
-
const validationRule = getTarotSpreadRuleForValidation(slot);
|
|
2482
|
-
for (const slotCard of slotCards) {
|
|
2483
|
-
if (validationRule?.allowedTypes && !validationRule.allowedTypes.includes(slotCard.card.type)) {
|
|
2484
|
-
errors.push({
|
|
2485
|
-
code: "INVALID_CARD_TYPE",
|
|
2486
|
-
slotKey: slot.slotKey,
|
|
2487
|
-
cardNumber: slotCard.card.number,
|
|
2488
|
-
message: `${slot.label} does not accept ${slotCard.card.type} cards.`
|
|
2489
|
-
});
|
|
2490
|
-
}
|
|
2491
|
-
if (validationRule?.requiredRank && getTarotMinorRank(slotCard.card) !== validationRule.requiredRank) {
|
|
2492
|
-
errors.push({
|
|
2493
|
-
code: "INVALID_CARD_RANK",
|
|
2494
|
-
slotKey: slot.slotKey,
|
|
2495
|
-
cardNumber: slotCard.card.number,
|
|
2496
|
-
message: `${slot.label} requires a ${validationRule.requiredRank} minor arcana card.`
|
|
2497
|
-
});
|
|
2498
|
-
}
|
|
2499
|
-
if (validationRule?.allowedCardFilenames && !validationRule.allowedCardFilenames.includes(slotCard.card.tarotCardFilename)) {
|
|
2500
|
-
errors.push({
|
|
2501
|
-
code: "DISALLOWED_CARD",
|
|
2502
|
-
slotKey: slot.slotKey,
|
|
2503
|
-
cardNumber: slotCard.card.number,
|
|
2504
|
-
message: `${slotCard.card.tarotCard} is not allowed in ${slot.label}.`
|
|
2505
|
-
});
|
|
2506
|
-
}
|
|
2507
|
-
if (validationRule?.excludedCardFilenames && validationRule.excludedCardFilenames.includes(slotCard.card.tarotCardFilename)) {
|
|
2508
|
-
errors.push({
|
|
2509
|
-
code: "DISALLOWED_CARD",
|
|
2510
|
-
slotKey: slot.slotKey,
|
|
2511
|
-
cardNumber: slotCard.card.number,
|
|
2512
|
-
message: `${slotCard.card.tarotCard} is excluded from ${slot.label}.`
|
|
2513
|
-
});
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2493
|
+
return getDirectTarotCardNumber(tarotArkAnnuId, treeId);
|
|
2494
|
+
}
|
|
2495
|
+
function getTarotCardByNumber(cardNumber, treeId = DEFAULT_TAROT_TREE_ID) {
|
|
2496
|
+
const tree = getTarotTreeWorkspace(treeId);
|
|
2497
|
+
if (!tree) {
|
|
2498
|
+
return void 0;
|
|
2516
2499
|
}
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2500
|
+
const match = tree.getCorrespondences(id("number" /* NUMBER */, cardNumber), {
|
|
2501
|
+
type: "tarotArkAnnu" /* TAROT_ARK_ANNU */,
|
|
2502
|
+
depth: 1,
|
|
2503
|
+
limit: 1
|
|
2504
|
+
})[0];
|
|
2505
|
+
if (!match) {
|
|
2506
|
+
return void 0;
|
|
2507
|
+
}
|
|
2508
|
+
const profile = getTarotCardProfile({
|
|
2509
|
+
tarotArkAnnuId: match.node.id
|
|
2510
|
+
});
|
|
2511
|
+
if (!profile || profile.tarotCardNumber === cardNumber) {
|
|
2512
|
+
return profile;
|
|
2523
2513
|
}
|
|
2524
|
-
validateEventInquirerCard(spread, resolvedCards, input.context, errors);
|
|
2525
|
-
const sortedResolvedCards = sortResolvedTarotSpreadCards(resolvedCards);
|
|
2526
2514
|
return {
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
spread: cloneSpreadDefinition(spread),
|
|
2530
|
-
resolvedCards: sortedResolvedCards,
|
|
2531
|
-
errors
|
|
2515
|
+
...profile,
|
|
2516
|
+
tarotCardNumber: cardNumber
|
|
2532
2517
|
};
|
|
2533
2518
|
}
|
|
2534
|
-
function
|
|
2535
|
-
const
|
|
2536
|
-
if (
|
|
2537
|
-
|
|
2519
|
+
function getTarotArchetype(lookup) {
|
|
2520
|
+
const cache = getTarotArchetypeCache();
|
|
2521
|
+
if ("pathSlug" in lookup) {
|
|
2522
|
+
return cache.byPathSlug.get(normalizePathSlug(lookup.pathSlug));
|
|
2538
2523
|
}
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
slotKey: card.slotKey,
|
|
2546
|
-
cardNumber: card.cardNumber,
|
|
2547
|
-
isInverted: card.isInverted
|
|
2548
|
-
})),
|
|
2549
|
-
context: options.context
|
|
2550
|
-
});
|
|
2551
|
-
if (!validation.ok) {
|
|
2552
|
-
throw new Error(
|
|
2553
|
-
`Generated an invalid tarot spread selection for ${spread.label}: ${validation.errors.map((error) => error.message).join(" ")}`
|
|
2524
|
+
if ("pathId" in lookup) {
|
|
2525
|
+
return cache.byPathId.get(String(lookup.pathId));
|
|
2526
|
+
}
|
|
2527
|
+
if ("tarotCardFilename" in lookup) {
|
|
2528
|
+
return cache.byTarotCardFilename.get(
|
|
2529
|
+
lookup.tarotCardFilename.toLowerCase()
|
|
2554
2530
|
);
|
|
2555
2531
|
}
|
|
2556
|
-
return
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2532
|
+
return cache.byTarotCardNumber.get(lookup.tarotCardNumber);
|
|
2533
|
+
}
|
|
2534
|
+
function getTarotCorrespondenceProfile(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
|
|
2535
|
+
const card = resolveTarotCardProfileForTree(lookup, treeId);
|
|
2536
|
+
if (!card) {
|
|
2537
|
+
return void 0;
|
|
2538
|
+
}
|
|
2539
|
+
const tree = getTarotCorrespondenceTree(treeId);
|
|
2540
|
+
switch (card.kind) {
|
|
2541
|
+
case "major":
|
|
2542
|
+
return buildMajorCorrespondenceProfile(card, tree);
|
|
2543
|
+
case "court":
|
|
2544
|
+
return buildCourtCorrespondenceProfile(card, tree);
|
|
2545
|
+
case "minor":
|
|
2546
|
+
return buildMinorCorrespondenceProfile(card, tree);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
function getTarotRepresentations(lookup) {
|
|
2550
|
+
const card = getTarotCardProfile(lookup);
|
|
2551
|
+
if (!card) {
|
|
2552
|
+
return [];
|
|
2553
|
+
}
|
|
2554
|
+
return TAROT_DECK_METADATA.map(
|
|
2555
|
+
(deck) => buildTarotRepresentation(card, deck)
|
|
2556
|
+
);
|
|
2557
|
+
}
|
|
2558
|
+
function getTarotRepresentation(lookup, deckId) {
|
|
2559
|
+
const card = getTarotCardProfile(lookup);
|
|
2560
|
+
const deck = TAROT_DECK_METADATA.find((candidate) => candidate.id === deckId);
|
|
2561
|
+
if (!card || !deck) {
|
|
2562
|
+
return void 0;
|
|
2563
|
+
}
|
|
2564
|
+
return buildTarotRepresentation(card, deck);
|
|
2565
|
+
}
|
|
2566
|
+
function resolveTarotImageUrl(lookup, deckId) {
|
|
2567
|
+
return getTarotRepresentation(lookup, deckId)?.imageUrl;
|
|
2562
2568
|
}
|
|
2563
2569
|
|
|
2564
2570
|
export { ARKANNUS, DEFAULT_TAROT_TREE_ID, TAROT_IMAGE_BASE_URL, TAROT_TREE_IDS, drawTarotSpread, getTarotArchetype, getTarotCardByNumber, getTarotCardNumber, getTarotCardProfile, getTarotCorrespondenceProfile, getTarotRepresentation, getTarotRepresentations, getTarotSpread, listTarotDecks, listTarotSpreads, listTarotTrees, majorArcana, resolveTarotImageUrl, shuffleTarotDeck, validateTarotSpreadSelection };
|
|
2565
2571
|
//# sourceMappingURL=out.js.map
|
|
2566
|
-
//# sourceMappingURL=chunk-
|
|
2572
|
+
//# sourceMappingURL=chunk-Y3TLBFPD.mjs.map
|