import tables from "./vedic-chart-tables.json"; export type VargaDignity = "exalted" | "own" | "debilitated"; const EXALTATION: Readonly> = tables.exaltation; const DEBILITATION: Readonly> = tables.debilitation; const SIGN_LORDS: Readonly> = tables.signLords; const NODE_OWN_SIGN: Readonly> = tables.nodeOwnSign; const VARGA_MEANING: Readonly> = tables.vargaMeaning; /** * Sign dignity of a body inside a divisional chart. * * Same precedence as `jyotish_engine._get_dignity_level` (exalted, then own * sign, then debilitated) without the parts that need a D1 degree or the whole * chart: no moolatrikona band, no neecha bhanga, no friendship. The tables are * the engine's; `tests/test_chart_page_vedic_tables_contract.py` pins them. */ export function vargaDignity(planet: string, sign: string): VargaDignity | null { if (EXALTATION[planet] === sign) return "exalted"; if (SIGN_LORDS[sign] === planet || NODE_OWN_SIGN[planet] === sign) return "own"; if (DEBILITATION[planet] === sign) return "debilitated"; return null; } export const VARGA_DIGNITY_LABEL: Record = { exalted: "入旺", own: "自宫", debilitated: "落陷", }; /** The engine's own one-line use of a D-number chart (`VargaType.meaning`). */ export function vargaMeaning(division: number): string | null { return VARGA_MEANING[String(division)] ?? null; }