@roxyapi/ui 0.6.0 → 0.7.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.
Files changed (137) hide show
  1. package/AGENTS.md +13 -0
  2. package/README.md +1 -1
  3. package/THEMING.md +1 -1
  4. package/dist/cdn/components/ashtakavarga-grid.js +1 -1
  5. package/dist/cdn/components/ashtakavarga-grid.js.map +2 -2
  6. package/dist/cdn/components/biorhythm-chart.js +3 -3
  7. package/dist/cdn/components/biorhythm-chart.js.map +2 -2
  8. package/dist/cdn/components/choghadiya-grid.js +1 -1
  9. package/dist/cdn/components/choghadiya-grid.js.map +2 -2
  10. package/dist/cdn/components/compatibility-card.js +1 -1
  11. package/dist/cdn/components/compatibility-card.js.map +2 -2
  12. package/dist/cdn/components/dasha-timeline.js +3 -3
  13. package/dist/cdn/components/dasha-timeline.js.map +4 -4
  14. package/dist/cdn/components/divisional-chart.js +67 -1
  15. package/dist/cdn/components/divisional-chart.js.map +2 -2
  16. package/dist/cdn/components/endpoint-form.js +2 -2
  17. package/dist/cdn/components/endpoint-form.js.map +2 -2
  18. package/dist/cdn/components/guna-milan.js +1 -1
  19. package/dist/cdn/components/guna-milan.js.map +2 -2
  20. package/dist/cdn/components/hexagram.js +1 -1
  21. package/dist/cdn/components/hexagram.js.map +2 -2
  22. package/dist/cdn/components/horoscope-card.js +1 -1
  23. package/dist/cdn/components/horoscope-card.js.map +2 -2
  24. package/dist/cdn/components/kp-chart.js +1 -1
  25. package/dist/cdn/components/kp-chart.js.map +2 -2
  26. package/dist/cdn/components/kp-ruling-planets.js +1 -1
  27. package/dist/cdn/components/kp-ruling-planets.js.map +2 -2
  28. package/dist/cdn/components/location-search.js +1 -1
  29. package/dist/cdn/components/location-search.js.map +2 -2
  30. package/dist/cdn/components/nakshatra-card.js +1 -1
  31. package/dist/cdn/components/nakshatra-card.js.map +2 -2
  32. package/dist/cdn/components/natal-chart.js +12 -3
  33. package/dist/cdn/components/natal-chart.js.map +2 -2
  34. package/dist/cdn/components/numerology-card.js +2 -2
  35. package/dist/cdn/components/numerology-card.js.map +2 -2
  36. package/dist/cdn/components/panchang-table.js +3 -3
  37. package/dist/cdn/components/panchang-table.js.map +3 -3
  38. package/dist/cdn/components/shadbala-table.js +1 -1
  39. package/dist/cdn/components/shadbala-table.js.map +2 -2
  40. package/dist/cdn/components/synastry-chart.js +8 -2
  41. package/dist/cdn/components/synastry-chart.js.map +2 -2
  42. package/dist/cdn/components/transits-table.js +2 -2
  43. package/dist/cdn/components/transits-table.js.map +2 -2
  44. package/dist/cdn/components/vedic-kundli.js +67 -1
  45. package/dist/cdn/components/vedic-kundli.js.map +2 -2
  46. package/dist/cdn/components/vedic-planets-table.js +3 -3
  47. package/dist/cdn/components/vedic-planets-table.js.map +4 -4
  48. package/dist/cdn/components/yoga-list.js +2 -2
  49. package/dist/cdn/components/yoga-list.js.map +2 -2
  50. package/dist/cdn/roxy-ui.js +84 -3
  51. package/dist/cdn/roxy-ui.js.map +4 -4
  52. package/dist/components/ashtakavarga-grid.js +1 -1
  53. package/dist/components/ashtakavarga-grid.js.map +3 -3
  54. package/dist/components/biorhythm-chart.js +1 -1
  55. package/dist/components/biorhythm-chart.js.map +2 -2
  56. package/dist/components/choghadiya-grid.js +1 -1
  57. package/dist/components/choghadiya-grid.js.map +2 -2
  58. package/dist/components/compatibility-card.js +1 -1
  59. package/dist/components/compatibility-card.js.map +2 -2
  60. package/dist/components/dasha-timeline.d.ts.map +1 -1
  61. package/dist/components/dasha-timeline.js +1 -1
  62. package/dist/components/dasha-timeline.js.map +4 -4
  63. package/dist/components/divisional-chart.js +67 -1
  64. package/dist/components/divisional-chart.js.map +2 -2
  65. package/dist/components/endpoint-form.js +1 -1
  66. package/dist/components/endpoint-form.js.map +2 -2
  67. package/dist/components/guna-milan.js +1 -1
  68. package/dist/components/guna-milan.js.map +2 -2
  69. package/dist/components/hexagram.js +1 -1
  70. package/dist/components/hexagram.js.map +2 -2
  71. package/dist/components/horoscope-card.js +1 -1
  72. package/dist/components/horoscope-card.js.map +2 -2
  73. package/dist/components/kp-chart.js +1 -1
  74. package/dist/components/kp-chart.js.map +2 -2
  75. package/dist/components/kp-ruling-planets.js +1 -1
  76. package/dist/components/kp-ruling-planets.js.map +2 -2
  77. package/dist/components/location-search.js +1 -1
  78. package/dist/components/location-search.js.map +2 -2
  79. package/dist/components/nakshatra-card.js +1 -1
  80. package/dist/components/nakshatra-card.js.map +2 -2
  81. package/dist/components/natal-chart.js +10 -1
  82. package/dist/components/natal-chart.js.map +2 -2
  83. package/dist/components/numerology-card.js +1 -1
  84. package/dist/components/numerology-card.js.map +2 -2
  85. package/dist/components/panchang-table.d.ts +22 -1
  86. package/dist/components/panchang-table.d.ts.map +1 -1
  87. package/dist/components/panchang-table.js +1 -1
  88. package/dist/components/panchang-table.js.map +3 -3
  89. package/dist/components/shadbala-table.js +1 -1
  90. package/dist/components/shadbala-table.js.map +2 -2
  91. package/dist/components/synastry-chart.js +7 -1
  92. package/dist/components/synastry-chart.js.map +2 -2
  93. package/dist/components/transits-table.js +1 -1
  94. package/dist/components/transits-table.js.map +2 -2
  95. package/dist/components/vedic-kundli.js +67 -1
  96. package/dist/components/vedic-kundli.js.map +2 -2
  97. package/dist/components/vedic-planets-table.d.ts +14 -0
  98. package/dist/components/vedic-planets-table.d.ts.map +1 -1
  99. package/dist/components/vedic-planets-table.js +1 -1
  100. package/dist/components/vedic-planets-table.js.map +4 -4
  101. package/dist/components/yoga-list.js +1 -1
  102. package/dist/components/yoga-list.js.map +2 -2
  103. package/dist/index.cjs +82 -1
  104. package/dist/index.cjs.map +4 -4
  105. package/dist/index.js +82 -1
  106. package/dist/index.js.map +4 -4
  107. package/dist/styles/tokens.css +4 -4
  108. package/dist/types/types.gen.d.ts +679 -40
  109. package/dist/types/types.gen.d.ts.map +1 -1
  110. package/dist/version.d.ts +1 -1
  111. package/package.json +1 -1
  112. package/src/components/ashtakavarga-grid.ts +1 -1
  113. package/src/components/biorhythm-chart.ts +1 -1
  114. package/src/components/choghadiya-grid.ts +1 -1
  115. package/src/components/compatibility-card.ts +2 -2
  116. package/src/components/dasha-timeline.ts +10 -19
  117. package/src/components/endpoint-form.ts +2 -2
  118. package/src/components/guna-milan.ts +1 -1
  119. package/src/components/hexagram.ts +3 -3
  120. package/src/components/horoscope-card.ts +1 -1
  121. package/src/components/kp-chart.ts +1 -1
  122. package/src/components/kp-ruling-planets.ts +1 -1
  123. package/src/components/location-search.ts +1 -1
  124. package/src/components/nakshatra-card.ts +1 -1
  125. package/src/components/natal-chart.ts +5 -5
  126. package/src/components/numerology-card.ts +2 -2
  127. package/src/components/panchang-table.ts +112 -18
  128. package/src/components/shadbala-table.ts +1 -1
  129. package/src/components/synastry-chart.ts +4 -4
  130. package/src/components/transits-table.ts +1 -1
  131. package/src/components/vedic-planets-table.ts +221 -3
  132. package/src/components/yoga-list.ts +1 -1
  133. package/src/styles/tokens.css +4 -4
  134. package/src/types/types.gen.ts +680 -41
  135. package/src/utils/kundli-styles.ts +2 -2
  136. package/src/utils/tablist.ts +1 -1
  137. package/src/version.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/numerology-card.ts", "../../src/utils/base-styles.ts", "../../src/utils/markup-data.ts", "../../src/utils/string.ts"],
4
- "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport type {\n\tCalculateExpressionResponse,\n\tCalculateLifePathResponse,\n\tCalculatePersonalYearResponse,\n\tGenerateNumerologyChartResponse,\n} from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\nimport { humanize } from '../utils/string.js';\n\ntype NumerologyData =\n\t| CalculateLifePathResponse\n\t| CalculateExpressionResponse\n\t| CalculatePersonalYearResponse\n\t| GenerateNumerologyChartResponse;\n\n/**\n * Numerology card. Renders /numerology/{life-path,expression,personal-year,chart}.\n * Use the `type` attribute to switch the layout.\n */\n@customElement('roxy-numerology-card')\nexport class RoxyNumerologyCard extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.card{background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);display:grid}.hero{align-items:center;gap:var(--roxy-space-md,1rem);display:flex}.numeral{font-size:4rem;line-height:1;font-weight:var(--roxy-weight-bold,600);color:var(--roxy-accent-fg,#b45309);font-variant-numeric:tabular-nums}.label{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.06em;margin:0}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.meaning{color:var(--roxy-fg,#0a0a0a);margin:0}.calc{font-family:var(--roxy-font-mono);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 30%, transparent);padding:var(--roxy-space-sm,.5rem);border-radius:var(--roxy-radius-sm,4px);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.chips{gap:var(--roxy-space-xs,.25rem);flex-wrap:wrap;display:flex}.chips span{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);padding:2px 8px}.cores{gap:var(--roxy-space-sm,.5rem);border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.cores .item{align-items:baseline;gap:var(--roxy-space-xs,.25rem);font-size:var(--roxy-text-sm,.875rem);display:flex}.cores .item span:first-child{color:var(--roxy-muted,#71717a);text-transform:capitalize}.cores .item strong{color:var(--roxy-accent-fg,#b45309);font-variant-numeric:tabular-nums;font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600)}.karmic{background:color-mix(in srgb, var(--roxy-warning,#ea580c) 12%, transparent);border:1px solid color-mix(in srgb, var(--roxy-warning,#ea580c) 32%, transparent);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);border-radius:var(--roxy-radius-md,8px);font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a)}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: NumerologyData | null = null;\n\n\t@property({ type: String, reflect: true })\n\ttype: 'life-path' | 'expression' | 'personal-year' | 'chart' = 'life-path';\n\n\trender() {\n\t\tconst d = this.data;\n\t\tif (!d)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No numerology data</div>`;\n\n\t\tconst headerLabel = LABELS[this.type] ?? this.type;\n\n\t\tif ('coreNumbers' in d) return this.renderChart(d, headerLabel);\n\t\tif ('personalYear' in d) return this.renderPersonalYear(d, headerLabel);\n\t\treturn this.renderNumberCard(\n\t\t\td as CalculateLifePathResponse | CalculateExpressionResponse,\n\t\t\theaderLabel,\n\t\t);\n\t}\n\n\tprivate renderNumberCard(\n\t\td: CalculateLifePathResponse | CalculateExpressionResponse,\n\t\theaderLabel: string,\n\t) {\n\t\tconst keywords = d.meaning?.keywords ?? [];\n\t\treturn html`<article class=\"card\" aria-label=\"${headerLabel}\"><div class=\"hero\">${typeof d.number === 'number' ? html`<div class=\"numeral\">${d.number}</div>` : nothing}<div><p class=\"label\">${headerLabel}</p>${d.meaning?.title ? html`<h2 class=\"title\">${d.meaning.title}</h2>` : nothing}</div></div>${d.meaning?.description ? html`<p class=\"meaning\">${d.meaning.description}</p>` : nothing} ${d.calculation ? html`<pre class=\"calc\">${d.calculation}</pre>` : nothing} ${\n\t\t\t\tkeywords.length > 0\n\t\t\t\t\t? html`<div class=\"chips\">${keywords.map((k) => html`<span>${k}</span>`)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\td.hasKarmicDebt && d.karmicDebtNumber\n\t\t\t\t\t? html`<div class=\"karmic\">Karmic debt ${d.karmicDebtNumber}. ${karmicDebtText(d.karmicDebtMeaning)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n\n\tprivate renderPersonalYear(\n\t\td: CalculatePersonalYearResponse,\n\t\theaderLabel: string,\n\t) {\n\t\treturn html`<article class=\"card\" aria-label=\"${headerLabel}\"><div class=\"hero\">${typeof d.personalYear === 'number' ? html`<div class=\"numeral\">${d.personalYear}</div>` : nothing}<div><p class=\"label\">${headerLabel}</p>${d.theme ? html`<h2 class=\"title\">${d.theme}</h2>` : nothing}</div></div>${d.forecast ? html`<p class=\"meaning\">${d.forecast}</p>` : nothing} ${d.advice ? html`<p>${d.advice}</p>` : nothing}</article>`;\n\t}\n\n\tprivate renderChart(d: GenerateNumerologyChartResponse, headerLabel: string) {\n\t\tconst cores = Object.entries(d.coreNumbers).filter(\n\t\t\t([, v]) => v !== null && v !== undefined,\n\t\t);\n\t\treturn html`<article class=\"card\" aria-label=\"${headerLabel}\"><div><p class=\"label\">${headerLabel}</p>${d.profile?.name ? html`<h2 class=\"title\">${d.profile.name}</h2>` : nothing}</div>${\n\t\t\t\tcores.length > 0\n\t\t\t\t\t? html`<div class=\"cores\">${cores.map(\n\t\t\t\t\t\t\t([k, v]) => html`<div class=\"item\"><span>${humanize(k)}</span> <strong>${v.number ?? ''}</strong></div>`,\n\t\t\t\t\t\t)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n}\n\nconst LABELS: Record<string, string> = {\n\t'life-path': 'Life Path',\n\texpression: 'Expression',\n\t'personal-year': 'Personal Year',\n\tchart: 'Numerology chart',\n};\n\ntype KarmicDebtMeaning = CalculateLifePathResponse['karmicDebtMeaning'];\n\nfunction karmicDebtText(value: KarmicDebtMeaning | undefined): string {\n\tif (!value) return '';\n\treturn [value.description, value.challenge, value.resolution]\n\t\t.filter(Boolean)\n\t\t.join(' ');\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-numerology-card': RoxyNumerologyCard;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `capitalize`: title-cases the first character, lowercases the rest. Used\n * when matching API-supplied planet/sign names against the glyph maps in\n * `tokens/index.ts`, which use canonical TitleCase keys.\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn s\n\t\t.replace(/[_-]+/g, ' ')\n\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t.replace(/^\\w/, (c) => c.toUpperCase());\n}\n"],
5
- "mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBCDxC,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCM1B,IAAME,EAAkB,YAKxB,SAASC,EAAaC,EAAsB,CAC3C,OACCA,EAAG,WAAa,UAAYA,EAAG,aAAa,MAAM,IAAM,kBAE1D,CA2CO,IAAMC,EAAN,KAAsE,CAG5E,YAAYC,EAAgB,CAC3B,KAAK,KAAOA,EACZA,EAAK,cAAc,IAAI,CACxB,CAEA,eAAgB,CAGf,GAAI,KAAK,KAAK,MAAQ,KAAM,OAE5B,IAAMC,EAAS,KAAK,KAAK,EACrBA,IAAW,SAEf,KAAK,KAAK,KAAOA,EACjB,KAAK,KAAK,cAAc,EACzB,CAKQ,MAAsB,CAC7B,IAAMC,EAAS,KAAK,iBAAiB,EACrC,OAAOA,EAAS,KAAK,MAAMA,EAAO,WAAW,EAAI,MAClD,CAKQ,kBAAmC,CAC1C,QAAWC,KAAS,MAAM,KAAK,KAAK,KAAK,QAAQ,EAChD,GAAIN,EAAaM,CAAK,GAAKA,EAAM,UAAU,SAASP,CAAe,EAClE,OAAOO,EAGT,OAAO,IACR,CAEQ,MAAMC,EAAoC,CACjD,GAAKA,GAAM,KAAK,EAChB,GAAI,CACH,O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AE,cAAiB,SAAWC,yBAA4BD,EAAE,YAAY,SAAWK,CAAO,yBAAyBH,CAAW,OAAOF,EAAE,MAAQC,sBAAyBD,EAAE,KAAK,QAAUK,CAAO,eAAeL,EAAE,SAAWC,uBAA0BD,EAAE,QAAQ,OAASK,CAAO,IAAIL,EAAE,OAASC,OAAUD,EAAE,MAAM,OAASK,CAAO,YAC3Z,CAEQ,YAAYL,EAAoCE,EAAqB,CAC5E,IAAMM,EAAQ,OAAO,QAAQR,EAAE,WAAW,EAAE,OAC3C,CAAC,CAAC,CAAES,CAAC,IAAMA,GAAM,IAClB,EACA,OAAOR,sCAAyCC,CAAW,2BAA2BA,CAAW,OAAOF,EAAE,SAAS,KAAOC,sBAAyBD,EAAE,QAAQ,IAAI,QAAUK,CAAO,SAChLG,EAAM,OAAS,EACZP,uBAA0BO,EAAM,IAChC,CAAC,CAACF,EAAGG,CAAC,IAAMR,4BAA+BS,EAASJ,CAAC,CAAC,mBAAmBG,EAAE,QAAU,EAAE,iBACxF,CAAC,SACAJ,CACJ,YACF,CACD,EAtEaR,EACL,OAAS,CACfc,EACAC,4oEACD,EAWAC,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GAdlBjB,EAeZ,oBAGAgB,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAjB7BjB,EAkBZ,oBAlBYA,EAANgB,EAAA,CADNE,EAAc,sBAAsB,GACxBlB,GAwEb,IAAMM,EAAiC,CACtC,YAAa,YACb,WAAY,aACZ,gBAAiB,gBACjB,MAAO,kBACR,EAIA,SAASI,EAAeS,EAA8C,CACrE,OAAKA,EACE,CAACA,EAAM,YAAaA,EAAM,UAAWA,EAAM,UAAU,EAC1D,OAAO,OAAO,EACd,KAAK,GAAG,EAHS,EAIpB",
4
+ "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport type {\n\tCalculateExpressionResponse,\n\tCalculateLifePathResponse,\n\tCalculatePersonalYearResponse,\n\tGenerateNumerologyChartResponse,\n} from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\nimport { humanize } from '../utils/string.js';\n\ntype NumerologyData =\n\t| CalculateLifePathResponse\n\t| CalculateExpressionResponse\n\t| CalculatePersonalYearResponse\n\t| GenerateNumerologyChartResponse;\n\n/**\n * Numerology card. Renders /numerology/{life-path,expression,personal-year,chart}.\n * Use the `type` attribute to switch the layout.\n */\n@customElement('roxy-numerology-card')\nexport class RoxyNumerologyCard extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.card{background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);display:grid}.hero{align-items:center;gap:var(--roxy-space-md,1rem);display:flex}.numeral{font-size:4rem;line-height:1;font-weight:var(--roxy-weight-bold,600);color:var(--roxy-accent-ink,#b45309);font-variant-numeric:tabular-nums}.label{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.06em;margin:0}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.meaning{color:var(--roxy-fg,#0a0a0a);margin:0}.calc{font-family:var(--roxy-font-mono);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 30%, transparent);padding:var(--roxy-space-sm,.5rem);border-radius:var(--roxy-radius-sm,4px);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.chips{gap:var(--roxy-space-xs,.25rem);flex-wrap:wrap;display:flex}.chips span{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);padding:2px 8px}.cores{gap:var(--roxy-space-sm,.5rem);border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.cores .item{align-items:baseline;gap:var(--roxy-space-xs,.25rem);font-size:var(--roxy-text-sm,.875rem);display:flex}.cores .item span:first-child{color:var(--roxy-muted,#71717a);text-transform:capitalize}.cores .item strong{color:var(--roxy-accent-ink,#b45309);font-variant-numeric:tabular-nums;font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600)}.karmic{background:color-mix(in srgb, var(--roxy-warning,#ea580c) 12%, transparent);border:1px solid color-mix(in srgb, var(--roxy-warning,#ea580c) 32%, transparent);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);border-radius:var(--roxy-radius-md,8px);font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a)}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: NumerologyData | null = null;\n\n\t@property({ type: String, reflect: true })\n\ttype: 'life-path' | 'expression' | 'personal-year' | 'chart' = 'life-path';\n\n\trender() {\n\t\tconst d = this.data;\n\t\tif (!d)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No numerology data</div>`;\n\n\t\tconst headerLabel = LABELS[this.type] ?? this.type;\n\n\t\tif ('coreNumbers' in d) return this.renderChart(d, headerLabel);\n\t\tif ('personalYear' in d) return this.renderPersonalYear(d, headerLabel);\n\t\treturn this.renderNumberCard(\n\t\t\td as CalculateLifePathResponse | CalculateExpressionResponse,\n\t\t\theaderLabel,\n\t\t);\n\t}\n\n\tprivate renderNumberCard(\n\t\td: CalculateLifePathResponse | CalculateExpressionResponse,\n\t\theaderLabel: string,\n\t) {\n\t\tconst keywords = d.meaning?.keywords ?? [];\n\t\treturn html`<article class=\"card\" aria-label=\"${headerLabel}\"><div class=\"hero\">${typeof d.number === 'number' ? html`<div class=\"numeral\">${d.number}</div>` : nothing}<div><p class=\"label\">${headerLabel}</p>${d.meaning?.title ? html`<h2 class=\"title\">${d.meaning.title}</h2>` : nothing}</div></div>${d.meaning?.description ? html`<p class=\"meaning\">${d.meaning.description}</p>` : nothing} ${d.calculation ? html`<pre class=\"calc\">${d.calculation}</pre>` : nothing} ${\n\t\t\t\tkeywords.length > 0\n\t\t\t\t\t? html`<div class=\"chips\">${keywords.map((k) => html`<span>${k}</span>`)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\td.hasKarmicDebt && d.karmicDebtNumber\n\t\t\t\t\t? html`<div class=\"karmic\">Karmic debt ${d.karmicDebtNumber}. ${karmicDebtText(d.karmicDebtMeaning)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n\n\tprivate renderPersonalYear(\n\t\td: CalculatePersonalYearResponse,\n\t\theaderLabel: string,\n\t) {\n\t\treturn html`<article class=\"card\" aria-label=\"${headerLabel}\"><div class=\"hero\">${typeof d.personalYear === 'number' ? html`<div class=\"numeral\">${d.personalYear}</div>` : nothing}<div><p class=\"label\">${headerLabel}</p>${d.theme ? html`<h2 class=\"title\">${d.theme}</h2>` : nothing}</div></div>${d.forecast ? html`<p class=\"meaning\">${d.forecast}</p>` : nothing} ${d.advice ? html`<p>${d.advice}</p>` : nothing}</article>`;\n\t}\n\n\tprivate renderChart(d: GenerateNumerologyChartResponse, headerLabel: string) {\n\t\tconst cores = Object.entries(d.coreNumbers).filter(\n\t\t\t([, v]) => v !== null && v !== undefined,\n\t\t);\n\t\treturn html`<article class=\"card\" aria-label=\"${headerLabel}\"><div><p class=\"label\">${headerLabel}</p>${d.profile?.name ? html`<h2 class=\"title\">${d.profile.name}</h2>` : nothing}</div>${\n\t\t\t\tcores.length > 0\n\t\t\t\t\t? html`<div class=\"cores\">${cores.map(\n\t\t\t\t\t\t\t([k, v]) => html`<div class=\"item\"><span>${humanize(k)}</span> <strong>${v.number ?? ''}</strong></div>`,\n\t\t\t\t\t\t)}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}</article>`;\n\t}\n}\n\nconst LABELS: Record<string, string> = {\n\t'life-path': 'Life Path',\n\texpression: 'Expression',\n\t'personal-year': 'Personal Year',\n\tchart: 'Numerology chart',\n};\n\ntype KarmicDebtMeaning = CalculateLifePathResponse['karmicDebtMeaning'];\n\nfunction karmicDebtText(value: KarmicDebtMeaning | undefined): string {\n\tif (!value) return '';\n\treturn [value.description, value.challenge, value.resolution]\n\t\t.filter(Boolean)\n\t\t.join(' ');\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-numerology-card': RoxyNumerologyCard;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `capitalize`: title-cases the first character, lowercases the rest. Used\n * when matching API-supplied planet/sign names against the glyph maps in\n * `tokens/index.ts`, which use canonical TitleCase keys.\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn s\n\t\t.replace(/[_-]+/g, ' ')\n\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t.replace(/^\\w/, (c) => c.toUpperCase());\n}\n"],
5
+ "mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBCDxC,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCM1B,IAAME,EAAkB,YAKxB,SAASC,EAAaC,EAAsB,CAC3C,OACCA,EAAG,WAAa,UAAYA,EAAG,aAAa,MAAM,IAAM,kBAE1D,CA2CO,IAAMC,EAAN,KAAsE,CAG5E,YAAYC,EAAgB,CAC3B,KAAK,KAAOA,EACZA,EAAK,cAAc,IAAI,CACxB,CAEA,eAAgB,CAGf,GAAI,KAAK,KAAK,MAAQ,KAAM,OAE5B,IAAMC,EAAS,KAAK,KAAK,EACrBA,IAAW,SAEf,KAAK,KAAK,KAAOA,EACjB,KAAK,KAAK,cAAc,EACzB,CAKQ,MAAsB,CAC7B,IAAMC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,WAAY,aACZ,gBAAiB,gBACjB,MAAO,kBACR,EAIA,SAASI,EAAeS,EAA8C,CACrE,OAAKA,EACE,CAACA,EAAM,YAAaA,EAAM,UAAWA,EAAM,UAAU,EAC1D,OAAO,OAAO,EACd,KAAK,GAAG,EAHS,EAIpB",
6
6
  "names": ["css", "html", "LitElement", "nothing", "customElement", "property", "css", "baseStyles", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "text", "humanize", "s", "c", "RoxyNumerologyCard", "LitElement", "MarkupDataController", "d", "html", "headerLabel", "LABELS", "keywords", "nothing", "k", "karmicDebtText", "cores", "v", "humanize", "baseStyles", "css", "__decorateClass", "property", "customElement", "value"]
7
7
  }
@@ -1,15 +1,36 @@
1
1
  import { LitElement } from 'lit';
2
2
  import type { GetBasicPanchangResponse, GetDetailedPanchangResponse } from '../types/index.js';
3
3
  type PanchangData = GetBasicPanchangResponse | GetDetailedPanchangResponse;
4
- /** Panchang table for /vedic-astrology/panchang/{basic,detailed}. */
4
+ /**
5
+ * Panchang table for /vedic-astrology/panchang/{basic,detailed}.
6
+ *
7
+ * @remarks
8
+ * The main grid lists the five limbs (tithi, nakshatra, yoga, karana, vara),
9
+ * sun and moon timings, and, in detailed mode, the sunrise placements a reader
10
+ * scans first: Moon rashi, Sun rashi, Sun nakshatra, and the current hora. The
11
+ * detailed mode then groups every timed window into two sections, auspicious
12
+ * (the fixed muhurtas plus each Amrit Kalam) and inauspicious (Rahu Kaal,
13
+ * Yamaganda, Gulika, plus each Dur Muhurta and Varjyam), so a consumer can act
14
+ * on timing without parsing the raw response.
15
+ */
5
16
  export declare class RoxyPanchangTable extends LitElement {
6
17
  static styles: import("lit").CSSResult[];
7
18
  constructor();
8
19
  data: PanchangData | null;
9
20
  detail: 'basic' | 'detailed';
10
21
  render(): import("lit").TemplateResult<1>;
22
+ /** Renders one row per [label, period] pair, dropping any with no range. */
23
+ private renderPeriodRows;
24
+ /** Expands an array of periods into labeled rows, numbering when more than one. */
25
+ private expandWindows;
11
26
  private renderTransitionRow;
12
27
  private formatPart;
28
+ /** "English (Sanskrit)" label for the Moon or Sun rashi at sunrise. */
29
+ private formatRashi;
30
+ /** Sun nakshatra with pada and lord, the form a panchang reader expects. */
31
+ private formatSunNakshatra;
32
+ /** Current planetary hora with its active window. */
33
+ private formatHora;
13
34
  }
14
35
  declare global {
15
36
  interface HTMLElementTagNameMap {
@@ -1 +1 @@
1
- {"version":3,"file":"panchang-table.d.ts","sourceRoot":"","sources":["../../src/components/panchang-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAErD,OAAO,KAAK,EACX,wBAAwB,EACxB,2BAA2B,EAC3B,MAAM,mBAAmB,CAAC;AAK3B,KAAK,YAAY,GAAG,wBAAwB,GAAG,2BAA2B,CAAC;AAG3E,qEAAqE;AACrE,qBACa,iBAAkB,SAAQ,UAAU;IAChD,MAAM,CAAC,MAAM,4BA6DX;;IAWF,IAAI,EAAE,YAAY,GAAG,IAAI,CAAQ;IAGjC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAc;IAE1C,MAAM;IAuIN,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,UAAU;CAqBlB;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,qBAAqB,EAAE,iBAAiB,CAAC;KACzC;CACD"}
1
+ {"version":3,"file":"panchang-table.d.ts","sourceRoot":"","sources":["../../src/components/panchang-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAErD,OAAO,KAAK,EACX,wBAAwB,EACxB,2BAA2B,EAC3B,MAAM,mBAAmB,CAAC;AAK3B,KAAK,YAAY,GAAG,wBAAwB,GAAG,2BAA2B,CAAC;AAG3E;;;;;;;;;;;GAWG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IAChD,MAAM,CAAC,MAAM,4BA6DX;;IAWF,IAAI,EAAE,YAAY,GAAG,IAAI,CAAQ;IAGjC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAc;IAE1C,MAAM;IAkKN,4EAA4E;IAC5E,OAAO,CAAC,gBAAgB;IAYxB,mFAAmF;IACnF,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,UAAU;IAsBlB,uEAAuE;IACvE,OAAO,CAAC,WAAW;IAOnB,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB;IAU1B,qDAAqD;IACrD,OAAO,CAAC,UAAU;CAKlB;AAOD,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,qBAAqB,EAAE,iBAAiB,CAAC;KACzC;CACD"}
@@ -1,2 +1,2 @@
1
- var v=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var p=(e,r,a,t)=>{for(var n=t>1?void 0:t?$(r,a):r,s=e.length-1,l;s>=0;s--)(l=e[s])&&(n=(t?l(r,a,n):l(n))||n);return t&&n&&v(r,a,n),n};import{css as S,html as i,LitElement as P,nothing as c}from"lit";import{customElement as A,property as b}from"lit/decorators.js";import{css as w}from"lit";var g=w`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function d(e){if(typeof e!="string"||e.length===0||/^\d{4}-\d{2}-\d{2}$/.test(e))return"";let a=/^\d{2}:\d{2}(:\d{2})?$/.test(e)?`1970-01-01T${e}`:e,t=new Date(a);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",hour12:!0})}function x(e){if(typeof e!="string"||e.length===0)return"";let r=new Date(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00`:e);return Number.isNaN(r.getTime())?e:r.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function y(e){if(!e)return"";let r=d(e.start),a=d(e.end);return r&&a?`${r} - ${a}`:r||a||""}var k="roxy-data";function T(e){return e.nodeName==="SCRIPT"&&e.getAttribute("type")==="application/json"}var f=class{constructor(r){this.host=r,r.addController(this)}hostConnected(){if(this.host.data!=null)return;let r=this.read();r!==void 0&&(this.host.data=r,this.host.requestUpdate())}read(){let r=this.findInlineScript();return r?this.parse(r.textContent):void 0}findInlineScript(){for(let r of Array.from(this.host.children))if(T(r)&&r.classList.contains(k))return r;return null}parse(r){if(r?.trim())try{return JSON.parse(r)}catch{return}}};var u=class extends P{constructor(){super();this.data=null;this.detail="detailed";new f(this)}render(){let a=this.data;if(!a)return i`<div class="roxy-empty" role="status">No panchang data</div>`;let t="sunrise"in a?a:null,n=[["Tithi",this.formatPart(a.tithi)],["Nakshatra",this.formatPart(a.nakshatra)],["Yoga",this.formatPart(a.yoga)],["Karana",this.formatPart(a.karana)]];t&&n.push(["Vara",this.formatPart(t.vara)]);let s=t?[["Brahma Muhurta",t.brahmaMuhurta],["Abhijit Muhurta",t.abhijitMuhurta],["Vijaya Muhurta",t.vijayaMuhurta],["Godhuli Muhurta",t.godhuliMuhurta],["Nishita Muhurta",t.nishitaMuhurta],["Pratah Sandhya",t.pratahSandhya],["Sayahna Sandhya",t.sayahnaSandhya]]:[],l=t?[["Rahu Kaal",t.rahuKaal],["Yamaganda",t.yamaganda],["Gulika",t.gulika]]:[],m=t&&"transitions"in t?t.transitions:void 0;return i`<div class="wrap" aria-label="Panchang"><header class="head"><h2 class="title">Panchang</h2><span class="date">${t?x(t.date):""}</span></header><table><tbody>${n.map(([o,h])=>i`<tr><th>${o}</th><td>${h}</td></tr>`)} ${t?.sunrise?i`<tr><th>Sunrise</th><td>${d(t.sunrise)}</td></tr>`:c} ${t?.sunset?i`<tr><th>Sunset</th><td>${d(t.sunset)}</td></tr>`:c} ${t?.moonrise?i`<tr><th>Moonrise</th><td>${d(t.moonrise)}</td></tr>`:c} ${t?.moonset?i`<tr><th>Moonset</th><td>${d(t.moonset)}</td></tr>`:c}</tbody></table>${m?i`<div class="section">Next transitions</div><table><tbody>${this.renderTransitionRow("Tithi",m.tithi)} ${this.renderTransitionRow("Nakshatra",m.nakshatra)} ${this.renderTransitionRow("Yoga",m.yoga)} ${this.renderTransitionRow("Karana",m.karana)}</tbody></table>`:c} ${this.detail==="detailed"&&(s.some(o=>!!o[1])||l.some(o=>!!o[1]))?i`<div class="section">Auspicious muhurtas</div><table><tbody>${s.filter(([,o])=>!!o).map(([o,h])=>i`<tr><th>${o}</th><td>${y(h)}</td></tr>`)}</tbody></table><div class="section">Inauspicious periods</div><table><tbody>${l.filter(([,o])=>!!o).map(([o,h])=>i`<tr><th>${o}</th><td>${y(h)}</td></tr>`)}</tbody></table>`:c}</div>`}renderTransitionRow(a,t){if(!t?.endsAt)return c;let n=d(t.endsAt),s=t.next?` \u2192 ${t.next}`:"";return i`<tr><th>${a}</th><td>ends ${n}${s}</td></tr>`}formatPart(a){if(!a)return"";if(typeof a=="string")return a;if(typeof a=="object"){let t=a;return[t.name,t.paksha?`(${t.paksha} paksha)`:"",t.lord?`\xB7 ${t.lord}`:"",t.phase].filter(Boolean).join(" ")}return String(a)}};u.styles=[g,S`.wrap{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);background:var(--roxy-bg,#fff);box-shadow:var(--roxy-shadow-sm);overflow:hidden}.head{padding:var(--roxy-space-md,1rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);justify-content:space-between;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.date{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}tbody tr:nth-child(odd){background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 24%, transparent)}th,td{padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);text-align:left;vertical-align:top}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:capitalize;width:38%}td{color:var(--roxy-fg,#0a0a0a);font-variant-numeric:tabular-nums}.section{border-top:1px solid var(--roxy-border,#e4e4e7);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;letter-spacing:.06em}`],p([b({attribute:!1})],u.prototype,"data",2),p([b({type:String,reflect:!0})],u.prototype,"detail",2),u=p([A("roxy-panchang-table")],u);export{u as RoxyPanchangTable};
1
+ var w=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var l=(a,e,r,t)=>{for(var n=t>1?void 0:t?P(e,r):e,o=a.length-1,c;o>=0;o--)(c=a[o])&&(n=(t?c(e,r,n):c(n))||n);return t&&n&&w(e,r,n),n};import{css as R,html as s,LitElement as A,nothing as m}from"lit";import{customElement as M,property as k}from"lit/decorators.js";import{css as S}from"lit";var v=S`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function d(a){if(typeof a!="string"||a.length===0||/^\d{4}-\d{2}-\d{2}$/.test(a))return"";let r=/^\d{2}:\d{2}(:\d{2})?$/.test(a)?`1970-01-01T${a}`:a,t=new Date(r);return Number.isNaN(t.getTime())?a:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",hour12:!0})}function $(a){if(typeof a!="string"||a.length===0)return"";let e=new Date(/^\d{4}-\d{2}-\d{2}$/.test(a)?`${a}T00:00:00`:a);return Number.isNaN(e.getTime())?a:e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function g(a){if(!a)return"";let e=d(a.start),r=d(a.end);return e&&r?`${e} - ${r}`:e||r||""}var T="roxy-data";function N(a){return a.nodeName==="SCRIPT"&&a.getAttribute("type")==="application/json"}var p=class{constructor(e){this.host=e,e.addController(this)}hostConnected(){if(this.host.data!=null)return;let e=this.read();e!==void 0&&(this.host.data=e,this.host.requestUpdate())}read(){let e=this.findInlineScript();return e?this.parse(e.textContent):void 0}findInlineScript(){for(let e of Array.from(this.host.children))if(N(e)&&e.classList.contains(T))return e;return null}parse(e){if(e?.trim())try{return JSON.parse(e)}catch{return}}};var u=class extends A{constructor(){super();this.data=null;this.detail="detailed";new p(this)}render(){let r=this.data;if(!r)return s`<div class="roxy-empty" role="status">No panchang data</div>`;let t="sunrise"in r?r:null,n=[["Tithi",this.formatPart(r.tithi)],["Nakshatra",this.formatPart(r.nakshatra)],["Yoga",this.formatPart(r.yoga)],["Karana",this.formatPart(r.karana)]];t&&n.push(["Vara",this.formatPart(t.vara)]);let o=t?[["Moon sign",this.formatRashi(t.moonSign)],["Sun sign",this.formatRashi(t.sunSign)],["Sun nakshatra",this.formatSunNakshatra(t.sunNakshatra)],["Hora",this.formatHora(t.hora)]].filter(i=>!!i[1]):[],c=t?[["Brahma Muhurta",t.brahmaMuhurta],["Abhijit Muhurta",t.abhijitMuhurta],["Vijaya Muhurta",t.vijayaMuhurta],["Godhuli Muhurta",t.godhuliMuhurta],["Nishita Muhurta",t.nishitaMuhurta],["Pratah Sandhya",t.pratahSandhya],["Sayahna Sandhya",t.sayahnaSandhya]]:[],y=t?this.expandWindows("Amrit Kalam",t.amritKalam):[],x=t?[["Rahu Kaal",t.rahuKaal],["Yamaganda",t.yamaganda],["Gulika",t.gulika]]:[],b=t?[...this.expandWindows("Dur Muhurta",t.durMuhurta),...this.expandWindows("Varjyam",t.varjyam)]:[],h=t&&"transitions"in t?t.transitions:void 0;return s`<div class="wrap" aria-label="Panchang"><header class="head"><h2 class="title">Panchang</h2><span class="date">${t?$(t.date):""}</span></header><table><tbody>${n.map(([i,f])=>s`<tr><th>${i}</th><td>${f}</td></tr>`)} ${t?.sunrise?s`<tr><th>Sunrise</th><td>${d(t.sunrise)}</td></tr>`:m} ${t?.sunset?s`<tr><th>Sunset</th><td>${d(t.sunset)}</td></tr>`:m} ${t?.moonrise?s`<tr><th>Moonrise</th><td>${d(t.moonrise)}</td></tr>`:m} ${t?.moonset?s`<tr><th>Moonset</th><td>${d(t.moonset)}</td></tr>`:m} ${o.map(([i,f])=>s`<tr><th>${i}</th><td>${f}</td></tr>`)}</tbody></table>${h?s`<div class="section">Next transitions</div><table><tbody>${this.renderTransitionRow("Tithi",h.tithi)} ${this.renderTransitionRow("Nakshatra",h.nakshatra)} ${this.renderTransitionRow("Yoga",h.yoga)} ${this.renderTransitionRow("Karana",h.karana)}</tbody></table>`:m} ${this.detail==="detailed"&&(c.some(i=>!!i[1])||y.length>0||x.some(i=>!!i[1])||b.length>0)?s`<div class="section">Auspicious muhurtas</div><table><tbody>${this.renderPeriodRows([...c.filter(i=>!!i[1]),...y])}</tbody></table><div class="section">Inauspicious periods</div><table><tbody>${this.renderPeriodRows([...x.filter(i=>!!i[1]),...b])}</tbody></table>`:m}</div>`}renderPeriodRows(r){return r.map(([t,n])=>{let o=g(n);return o?s`<tr><th>${t}</th><td>${o}</td></tr>`:m})}expandWindows(r,t){return!t||t.length===0?[]:t.map((n,o)=>[t.length>1?`${r} ${o+1}`:r,n])}renderTransitionRow(r,t){if(!t?.endsAt)return m;let n=d(t.endsAt),o=t.next?` \u2192 ${t.next}`:"";return s`<tr><th>${r}</th><td>ends ${n}${o}</td></tr>`}formatPart(r){if(!r)return"";if(typeof r=="string")return r;if(typeof r=="object"){let t=r;return[t.name,t.paksha?`(${t.paksha} paksha)`:"",t.lord?`\xB7 ${t.lord}`:"",t.phase].filter(Boolean).join(" ")}return String(r)}formatRashi(r){return r?.name?r.sanskritName&&r.sanskritName!==r.name?`${r.name} (${r.sanskritName})`:r.name:""}formatSunNakshatra(r){return r?.name?[r.name,typeof r.pada=="number"?`pada ${r.pada}`:"",r.lord?`\xB7 ${r.lord}`:""].filter(Boolean).join(" "):""}formatHora(r){if(!r?.current)return"";let t=g(r);return t?`${r.current} (${t})`:r.current}};u.styles=[v,R`.wrap{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);background:var(--roxy-bg,#fff);box-shadow:var(--roxy-shadow-sm);overflow:hidden}.head{padding:var(--roxy-space-md,1rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);justify-content:space-between;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.date{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}tbody tr:nth-child(odd){background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 24%, transparent)}th,td{padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);text-align:left;vertical-align:top}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:capitalize;width:38%}td{color:var(--roxy-fg,#0a0a0a);font-variant-numeric:tabular-nums}.section{border-top:1px solid var(--roxy-border,#e4e4e7);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;letter-spacing:.06em}`],l([k({attribute:!1})],u.prototype,"data",2),l([k({type:String,reflect:!0})],u.prototype,"detail",2),u=l([M("roxy-panchang-table")],u);export{u as RoxyPanchangTable};
2
2
  //# sourceMappingURL=panchang-table.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/panchang-table.ts", "../../src/utils/base-styles.ts", "../../src/utils/format.ts", "../../src/utils/markup-data.ts"],
4
- "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport type {\n\tGetBasicPanchangResponse,\n\tGetDetailedPanchangResponse,\n} from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatDate, formatTime, formatTimeRange } from '../utils/format.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\n\ntype PanchangData = GetBasicPanchangResponse | GetDetailedPanchangResponse;\ntype PanchangTime = GetDetailedPanchangResponse['rahuKaal'];\n\n/** Panchang table for /vedic-astrology/panchang/{basic,detailed}. */\n@customElement('roxy-panchang-table')\nexport class RoxyPanchangTable extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.wrap{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);background:var(--roxy-bg,#fff);box-shadow:var(--roxy-shadow-sm);overflow:hidden}.head{padding:var(--roxy-space-md,1rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);justify-content:space-between;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.date{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}tbody tr:nth-child(odd){background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 24%, transparent)}th,td{padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);text-align:left;vertical-align:top}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:capitalize;width:38%}td{color:var(--roxy-fg,#0a0a0a);font-variant-numeric:tabular-nums}.section{border-top:1px solid var(--roxy-border,#e4e4e7);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;letter-spacing:.06em}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: PanchangData | null = null;\n\n\t@property({ type: String, reflect: true })\n\tdetail: 'basic' | 'detailed' = 'detailed';\n\n\trender() {\n\t\tconst d = this.data;\n\t\tif (!d)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No panchang data</div>`;\n\t\tconst detailed = 'sunrise' in d ? d : null;\n\n\t\tconst fivefold: Array<[string, string]> = [\n\t\t\t['Tithi', this.formatPart(d.tithi)],\n\t\t\t['Nakshatra', this.formatPart(d.nakshatra)],\n\t\t\t['Yoga', this.formatPart(d.yoga)],\n\t\t\t['Karana', this.formatPart(d.karana)],\n\t\t];\n\t\tif (detailed) fivefold.push(['Vara', this.formatPart(detailed.vara)]);\n\n\t\tconst muhurtas: Array<[string, PanchangTime | undefined]> = detailed\n\t\t\t? [\n\t\t\t\t\t['Brahma Muhurta', detailed.brahmaMuhurta],\n\t\t\t\t\t['Abhijit Muhurta', detailed.abhijitMuhurta],\n\t\t\t\t\t['Vijaya Muhurta', detailed.vijayaMuhurta],\n\t\t\t\t\t['Godhuli Muhurta', detailed.godhuliMuhurta],\n\t\t\t\t\t['Nishita Muhurta', detailed.nishitaMuhurta],\n\t\t\t\t\t['Pratah Sandhya', detailed.pratahSandhya],\n\t\t\t\t\t['Sayahna Sandhya', detailed.sayahnaSandhya],\n\t\t\t\t]\n\t\t\t: [];\n\n\t\tconst inauspicious: Array<[string, PanchangTime | undefined]> = detailed\n\t\t\t? [\n\t\t\t\t\t['Rahu Kaal', detailed.rahuKaal],\n\t\t\t\t\t['Yamaganda', detailed.yamaganda],\n\t\t\t\t\t['Gulika', detailed.gulika],\n\t\t\t\t]\n\t\t\t: [];\n\n\t\tconst transitions =\n\t\t\tdetailed && 'transitions' in detailed ? detailed.transitions : undefined;\n\n\t\treturn html`<div class=\"wrap\" aria-label=\"Panchang\"><header class=\"head\"><h2 class=\"title\">Panchang</h2><span class=\"date\">${detailed ? formatDate(detailed.date) : ''}</span></header><table><tbody>${fivefold.map(\n\t\t\t\t\t\t([k, v]) => html`<tr><th>${k}</th><td>${v}</td></tr>`,\n\t\t\t\t\t)} ${\n\t\t\t\t\t\tdetailed?.sunrise\n\t\t\t\t\t\t\t? html`<tr><th>Sunrise</th><td>${formatTime(detailed.sunrise)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tdetailed?.sunset\n\t\t\t\t\t\t\t? html`<tr><th>Sunset</th><td>${formatTime(detailed.sunset)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tdetailed?.moonrise\n\t\t\t\t\t\t\t? html`<tr><th>Moonrise</th><td>${formatTime(detailed.moonrise)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tdetailed?.moonset\n\t\t\t\t\t\t\t? html`<tr><th>Moonset</th><td>${formatTime(detailed.moonset)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t}</tbody></table>${\n\t\t\t\ttransitions\n\t\t\t\t\t? html`<div class=\"section\">Next transitions</div><table><tbody>${this.renderTransitionRow('Tithi', transitions.tithi)} ${this.renderTransitionRow('Nakshatra', transitions.nakshatra)} ${this.renderTransitionRow('Yoga', transitions.yoga)} ${this.renderTransitionRow('Karana', transitions.karana)}</tbody></table>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tthis.detail === 'detailed' &&\n\t\t\t\t(muhurtas.some((m) => !!m[1]) || inauspicious.some((m) => !!m[1]))\n\t\t\t\t\t? html`<div class=\"section\">Auspicious muhurtas</div><table><tbody>${muhurtas\n\t\t\t\t\t\t\t\t\t.filter(([, v]) => !!v)\n\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t([k, v]) => html`<tr><th>${k}</th><td>${formatTimeRange(v)}</td></tr>`,\n\t\t\t\t\t\t\t\t\t)}</tbody></table><div class=\"section\">Inauspicious periods</div><table><tbody>${inauspicious\n\t\t\t\t\t\t\t\t\t.filter(([, v]) => !!v)\n\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t([k, v]) => html`<tr><th>${k}</th><td>${formatTimeRange(v)}</td></tr>`,\n\t\t\t\t\t\t\t\t\t)}</tbody></table>`\n\t\t\t\t\t: nothing\n\t\t\t}</div>`;\n\t}\n\n\tprivate renderTransitionRow(\n\t\tlabel: string,\n\t\tt: { endsAt?: string; next?: string } | undefined,\n\t) {\n\t\tif (!t?.endsAt) return nothing;\n\t\tconst when = formatTime(t.endsAt);\n\t\tconst next = t.next ? ` \u2192 ${t.next}` : '';\n\t\treturn html`<tr><th>${label}</th><td>ends ${when}${next}</td></tr>`;\n\t}\n\n\tprivate formatPart(v: unknown): string {\n\t\tif (!v) return '';\n\t\tif (typeof v === 'string') return v;\n\t\tif (typeof v === 'object') {\n\t\t\tconst obj = v as {\n\t\t\t\tname?: string;\n\t\t\t\tlord?: string;\n\t\t\t\tphase?: string;\n\t\t\t\tpaksha?: string;\n\t\t\t\tend?: string;\n\t\t\t};\n\t\t\tconst parts = [\n\t\t\t\tobj.name,\n\t\t\t\tobj.paksha ? `(${obj.paksha} paksha)` : '',\n\t\t\t\tobj.lord ? `\u00B7 ${obj.lord}` : '',\n\t\t\t\tobj.phase,\n\t\t\t].filter(Boolean);\n\t\t\treturn parts.join(' ');\n\t\t}\n\t\treturn String(v);\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-panchang-table': RoxyPanchangTable;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n */\n\nexport function formatTime(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(input)) return '';\n\tconst bareTime = /^\\d{2}:\\d{2}(:\\d{2})?$/.test(input);\n\tconst iso = bareTime ? `1970-01-01T${input}` : input;\n\tconst d = new Date(iso);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(undefined, {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\thour12: true,\n\t});\n}\n\nexport function formatDate(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst d = new Date(\n\t\t/^\\d{4}-\\d{2}-\\d{2}$/.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t});\n}\n\nexport function formatTimeRange(\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(t.start);\n\tconst end = formatTime(t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toFixed(dp).replace(/\\.?0+$/, '');\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated\n * canonical name (`SEMI_SEXTILE` \u2192 `semi-sextile`). Accepts any aspect-shaped\n * object so both natal and synastry inter-aspect entries can share this.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '').toLowerCase().replace(/_/g, '-');\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],
5
- "mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBCDxC,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCAnB,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C,mBACHE,CACJ,QACF,CAEQ,oBACPG,EACA,EACC,CACD,GAAI,CAAC,GAAG,OAAQ,OAAOH,EACvB,IAAMI,EAAOL,EAAW,EAAE,MAAM,EAC1BM,EAAO,EAAE,KAAO,WAAM,EAAE,IAAI,GAAK,GACvC,OAAOf,YAAea,CAAK,iBAAiBC,CAAI,GAAGC,CAAI,YACxD,CAEQ,WAAWP,EAAoB,CACtC,GAAI,CAACA,EAAG,MAAO,GACf,GAAI,OAAOA,GAAM,SAAU,OAAOA,EAClC,GAAI,OAAOA,GAAM,SAAU,CAC1B,IAAMQ,EAAMR,EAaZ,MANc,CACbQ,EAAI,KACJA,EAAI,OAAS,IAAIA,EAAI,MAAM,WAAa,GACxCA,EAAI,KAAO,QAAKA,EAAI,IAAI,GAAK,GAC7BA,EAAI,KACL,EAAE,OAAO,OAAO,EACH,KAAK,GAAG,CACtB,CACA,OAAO,OAAOR,CAAC,CAChB,CACD,EA9HaZ,EACL,OAAS,CACfqB,EACAC,uuCACD,EAWAC,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GAdlBxB,EAeZ,oBAGAuB,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAjB7BxB,EAkBZ,sBAlBYA,EAANuB,EAAA,CADNE,EAAc,qBAAqB,GACvBzB",
6
- "names": ["css", "html", "LitElement", "nothing", "customElement", "property", "css", "baseStyles", "formatTime", "input", "iso", "d", "formatDate", "formatTimeRange", "t", "start", "end", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "text", "RoxyPanchangTable", "LitElement", "MarkupDataController", "d", "html", "detailed", "fivefold", "muhurtas", "inauspicious", "transitions", "formatDate", "k", "v", "formatTime", "nothing", "m", "formatTimeRange", "label", "when", "next", "obj", "baseStyles", "css", "__decorateClass", "property", "customElement"]
4
+ "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport type {\n\tGetBasicPanchangResponse,\n\tGetDetailedPanchangResponse,\n} from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatDate, formatTime, formatTimeRange } from '../utils/format.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\n\ntype PanchangData = GetBasicPanchangResponse | GetDetailedPanchangResponse;\ntype PanchangTime = GetDetailedPanchangResponse['rahuKaal'];\n\n/**\n * Panchang table for /vedic-astrology/panchang/{basic,detailed}.\n *\n * @remarks\n * The main grid lists the five limbs (tithi, nakshatra, yoga, karana, vara),\n * sun and moon timings, and, in detailed mode, the sunrise placements a reader\n * scans first: Moon rashi, Sun rashi, Sun nakshatra, and the current hora. The\n * detailed mode then groups every timed window into two sections, auspicious\n * (the fixed muhurtas plus each Amrit Kalam) and inauspicious (Rahu Kaal,\n * Yamaganda, Gulika, plus each Dur Muhurta and Varjyam), so a consumer can act\n * on timing without parsing the raw response.\n */\n@customElement('roxy-panchang-table')\nexport class RoxyPanchangTable extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.wrap{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);background:var(--roxy-bg,#fff);box-shadow:var(--roxy-shadow-sm);overflow:hidden}.head{padding:var(--roxy-space-md,1rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);justify-content:space-between;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.date{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}tbody tr:nth-child(odd){background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 24%, transparent)}th,td{padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);text-align:left;vertical-align:top}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:capitalize;width:38%}td{color:var(--roxy-fg,#0a0a0a);font-variant-numeric:tabular-nums}.section{border-top:1px solid var(--roxy-border,#e4e4e7);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;letter-spacing:.06em}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: PanchangData | null = null;\n\n\t@property({ type: String, reflect: true })\n\tdetail: 'basic' | 'detailed' = 'detailed';\n\n\trender() {\n\t\tconst d = this.data;\n\t\tif (!d)\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No panchang data</div>`;\n\t\tconst detailed = 'sunrise' in d ? d : null;\n\n\t\tconst fivefold: Array<[string, string]> = [\n\t\t\t['Tithi', this.formatPart(d.tithi)],\n\t\t\t['Nakshatra', this.formatPart(d.nakshatra)],\n\t\t\t['Yoga', this.formatPart(d.yoga)],\n\t\t\t['Karana', this.formatPart(d.karana)],\n\t\t];\n\t\tif (detailed) fivefold.push(['Vara', this.formatPart(detailed.vara)]);\n\n\t\tconst placements: Array<[string, string]> = detailed\n\t\t\t? [\n\t\t\t\t\t['Moon sign', this.formatRashi(detailed.moonSign)],\n\t\t\t\t\t['Sun sign', this.formatRashi(detailed.sunSign)],\n\t\t\t\t\t['Sun nakshatra', this.formatSunNakshatra(detailed.sunNakshatra)],\n\t\t\t\t\t['Hora', this.formatHora(detailed.hora)],\n\t\t\t\t].filter((row): row is [string, string] => Boolean(row[1]))\n\t\t\t: [];\n\n\t\tconst muhurtas: Array<[string, PanchangTime | undefined]> = detailed\n\t\t\t? [\n\t\t\t\t\t['Brahma Muhurta', detailed.brahmaMuhurta],\n\t\t\t\t\t['Abhijit Muhurta', detailed.abhijitMuhurta],\n\t\t\t\t\t['Vijaya Muhurta', detailed.vijayaMuhurta],\n\t\t\t\t\t['Godhuli Muhurta', detailed.godhuliMuhurta],\n\t\t\t\t\t['Nishita Muhurta', detailed.nishitaMuhurta],\n\t\t\t\t\t['Pratah Sandhya', detailed.pratahSandhya],\n\t\t\t\t\t['Sayahna Sandhya', detailed.sayahnaSandhya],\n\t\t\t\t]\n\t\t\t: [];\n\n\t\tconst auspiciousWindows: Array<[string, PanchangTime]> = detailed\n\t\t\t? this.expandWindows('Amrit Kalam', detailed.amritKalam)\n\t\t\t: [];\n\n\t\tconst inauspicious: Array<[string, PanchangTime | undefined]> = detailed\n\t\t\t? [\n\t\t\t\t\t['Rahu Kaal', detailed.rahuKaal],\n\t\t\t\t\t['Yamaganda', detailed.yamaganda],\n\t\t\t\t\t['Gulika', detailed.gulika],\n\t\t\t\t]\n\t\t\t: [];\n\n\t\tconst inauspiciousWindows: Array<[string, PanchangTime]> = detailed\n\t\t\t? [\n\t\t\t\t\t...this.expandWindows('Dur Muhurta', detailed.durMuhurta),\n\t\t\t\t\t...this.expandWindows('Varjyam', detailed.varjyam),\n\t\t\t\t]\n\t\t\t: [];\n\n\t\tconst transitions =\n\t\t\tdetailed && 'transitions' in detailed ? detailed.transitions : undefined;\n\n\t\treturn html`<div class=\"wrap\" aria-label=\"Panchang\"><header class=\"head\"><h2 class=\"title\">Panchang</h2><span class=\"date\">${detailed ? formatDate(detailed.date) : ''}</span></header><table><tbody>${fivefold.map(\n\t\t\t\t\t\t([k, v]) => html`<tr><th>${k}</th><td>${v}</td></tr>`,\n\t\t\t\t\t)} ${\n\t\t\t\t\t\tdetailed?.sunrise\n\t\t\t\t\t\t\t? html`<tr><th>Sunrise</th><td>${formatTime(detailed.sunrise)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tdetailed?.sunset\n\t\t\t\t\t\t\t? html`<tr><th>Sunset</th><td>${formatTime(detailed.sunset)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tdetailed?.moonrise\n\t\t\t\t\t\t\t? html`<tr><th>Moonrise</th><td>${formatTime(detailed.moonrise)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tdetailed?.moonset\n\t\t\t\t\t\t\t? html`<tr><th>Moonset</th><td>${formatTime(detailed.moonset)}</td></tr>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${placements.map(\n\t\t\t\t\t\t([k, v]) => html`<tr><th>${k}</th><td>${v}</td></tr>`,\n\t\t\t\t\t)}</tbody></table>${\n\t\t\t\ttransitions\n\t\t\t\t\t? html`<div class=\"section\">Next transitions</div><table><tbody>${this.renderTransitionRow('Tithi', transitions.tithi)} ${this.renderTransitionRow('Nakshatra', transitions.nakshatra)} ${this.renderTransitionRow('Yoga', transitions.yoga)} ${this.renderTransitionRow('Karana', transitions.karana)}</tbody></table>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tthis.detail === 'detailed' &&\n\t\t\t\t(\n\t\t\t\t\tmuhurtas.some((m) => !!m[1]) ||\n\t\t\t\t\t\tauspiciousWindows.length > 0 ||\n\t\t\t\t\t\tinauspicious.some((m) => !!m[1]) ||\n\t\t\t\t\t\tinauspiciousWindows.length > 0\n\t\t\t\t)\n\t\t\t\t\t? html`<div class=\"section\">Auspicious muhurtas</div><table><tbody>${this.renderPeriodRows([\n\t\t\t\t\t\t\t\t\t...muhurtas.filter(\n\t\t\t\t\t\t\t\t\t\t(m): m is [string, PanchangTime] => !!m[1],\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t...auspiciousWindows,\n\t\t\t\t\t\t\t\t])}</tbody></table><div class=\"section\">Inauspicious periods</div><table><tbody>${this.renderPeriodRows([\n\t\t\t\t\t\t\t\t\t...inauspicious.filter(\n\t\t\t\t\t\t\t\t\t\t(m): m is [string, PanchangTime] => !!m[1],\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t...inauspiciousWindows,\n\t\t\t\t\t\t\t\t])}</tbody></table>`\n\t\t\t\t\t: nothing\n\t\t\t}</div>`;\n\t}\n\n\t/** Renders one row per [label, period] pair, dropping any with no range. */\n\tprivate renderPeriodRows(rows: Array<[string, PanchangTime]>) {\n\t\treturn rows.map(([k, v]) => {\n\t\t\tconst range = formatTimeRange(v);\n\t\t\treturn range\n\t\t\t\t? html`<tr><th>${k}</th><td>${range}</td></tr>`\n\t\t\t\t: nothing;\n\t\t});\n\t}\n\n\t/** Expands an array of periods into labeled rows, numbering when more than one. */\n\tprivate expandWindows(\n\t\tlabel: string,\n\t\twindows: PanchangTime[] | undefined,\n\t): Array<[string, PanchangTime]> {\n\t\tif (!windows || windows.length === 0) return [];\n\t\treturn windows.map((w, i) => [\n\t\t\twindows.length > 1 ? `${label} ${i + 1}` : label,\n\t\t\tw,\n\t\t]);\n\t}\n\n\tprivate renderTransitionRow(\n\t\tlabel: string,\n\t\tt: { endsAt?: string; next?: string } | undefined,\n\t) {\n\t\tif (!t?.endsAt) return nothing;\n\t\tconst when = formatTime(t.endsAt);\n\t\tconst next = t.next ? ` \u2192 ${t.next}` : '';\n\t\treturn html`<tr><th>${label}</th><td>ends ${when}${next}</td></tr>`;\n\t}\n\n\tprivate formatPart(v: unknown): string {\n\t\tif (!v) return '';\n\t\tif (typeof v === 'string') return v;\n\t\tif (typeof v === 'object') {\n\t\t\tconst obj = v as {\n\t\t\t\tname?: string;\n\t\t\t\tlord?: string;\n\t\t\t\tphase?: string;\n\t\t\t\tpaksha?: string;\n\t\t\t\tend?: string;\n\t\t\t};\n\t\t\tconst parts = [\n\t\t\t\tobj.name,\n\t\t\t\tobj.paksha ? `(${obj.paksha} paksha)` : '',\n\t\t\t\tobj.lord ? `\u00B7 ${obj.lord}` : '',\n\t\t\t\tobj.phase,\n\t\t\t].filter(Boolean);\n\t\t\treturn parts.join(' ');\n\t\t}\n\t\treturn String(v);\n\t}\n\n\t/** \"English (Sanskrit)\" label for the Moon or Sun rashi at sunrise. */\n\tprivate formatRashi(r: RashiPlacement | undefined): string {\n\t\tif (!r?.name) return '';\n\t\treturn r.sanskritName && r.sanskritName !== r.name\n\t\t\t? `${r.name} (${r.sanskritName})`\n\t\t\t: r.name;\n\t}\n\n\t/** Sun nakshatra with pada and lord, the form a panchang reader expects. */\n\tprivate formatSunNakshatra(n: SunNakshatra | undefined): string {\n\t\tif (!n?.name) return '';\n\t\tconst parts = [\n\t\t\tn.name,\n\t\t\ttypeof n.pada === 'number' ? `pada ${n.pada}` : '',\n\t\t\tn.lord ? `\u00B7 ${n.lord}` : '',\n\t\t].filter(Boolean);\n\t\treturn parts.join(' ');\n\t}\n\n\t/** Current planetary hora with its active window. */\n\tprivate formatHora(h: Hora | undefined): string {\n\t\tif (!h?.current) return '';\n\t\tconst range = formatTimeRange(h);\n\t\treturn range ? `${h.current} (${range})` : h.current;\n\t}\n}\n\ntype PanchangPlacements = GetDetailedPanchangResponse;\ntype RashiPlacement = PanchangPlacements['moonSign'];\ntype SunNakshatra = PanchangPlacements['sunNakshatra'];\ntype Hora = PanchangPlacements['hora'];\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-panchang-table': RoxyPanchangTable;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n */\n\nexport function formatTime(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(input)) return '';\n\tconst bareTime = /^\\d{2}:\\d{2}(:\\d{2})?$/.test(input);\n\tconst iso = bareTime ? `1970-01-01T${input}` : input;\n\tconst d = new Date(iso);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(undefined, {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\thour12: true,\n\t});\n}\n\nexport function formatDate(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst d = new Date(\n\t\t/^\\d{4}-\\d{2}-\\d{2}$/.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t});\n}\n\nexport function formatTimeRange(\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(t.start);\n\tconst end = formatTime(t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toFixed(dp).replace(/\\.?0+$/, '');\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated\n * canonical name (`SEMI_SEXTILE` \u2192 `semi-sextile`). Accepts any aspect-shaped\n * object so both natal and synastry inter-aspect entries can share this.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '').toLowerCase().replace(/_/g, '-');\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n"],
5
+ "mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAAC,MAAgB,oBCDxC,OAAS,OAAAC,MAAW,MAMb,IAAMC,EAAaD,myCCAnB,SAASE,EAAWC,EAAwB,CAElD,GADI,OAAOA,GAAU,UAAYA,EAAM,SAAW,GAC9C,sBAAsB,KAAKA,CAAK,EAAG,MAAO,GAE9C,IAAMC,EADW,yBAAyB,KAAKD,CAAK,EAC7B,cAAcA,CAAK,GAAKA,EACzCE,EAAI,IAAI,KAAKD,CAAG,EACtB,OAAI,OAAO,MAAMC,EAAE,QAAQ,CAAC,EAAUF,EAC/BE,EAAE,mBAAmB,OAAW,CACtC,K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AAK,GAAG,KACD,EAAE,cAAgB,EAAE,eAAiB,EAAE,KAC3C,GAAG,EAAE,IAAI,KAAK,EAAE,YAAY,IAC5B,EAAE,KAHgB,EAItB,CAGQ,mBAAmBc,EAAqC,CAC/D,OAAKA,GAAG,KACM,CACbA,EAAE,KACF,OAAOA,EAAE,MAAS,SAAW,QAAQA,EAAE,IAAI,GAAK,GAChDA,EAAE,KAAO,QAAKA,EAAE,IAAI,GAAK,EAC1B,EAAE,OAAO,OAAO,EACH,KAAK,GAAG,EANA,EAOtB,CAGQ,WAAWC,EAA6B,CAC/C,GAAI,CAACA,GAAG,QAAS,MAAO,GACxB,IAAMV,EAAQC,EAAgBS,CAAC,EAC/B,OAAOV,EAAQ,GAAGU,EAAE,OAAO,KAAKV,CAAK,IAAMU,EAAE,OAC9C,CACD,EA3Ma/B,EACL,OAAS,CACfgC,EACAC,uuCACD,EAWAC,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GAdlBnC,EAeZ,oBAGAkC,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAjB7BnC,EAkBZ,sBAlBYA,EAANkC,EAAA,CADNE,EAAc,qBAAqB,GACvBpC",
6
+ "names": ["css", "html", "LitElement", "nothing", "customElement", "property", "css", "baseStyles", "formatTime", "input", "iso", "d", "formatDate", "formatTimeRange", "t", "start", "end", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "text", "RoxyPanchangTable", "LitElement", "MarkupDataController", "d", "html", "detailed", "fivefold", "placements", "row", "muhurtas", "auspiciousWindows", "inauspicious", "inauspiciousWindows", "transitions", "formatDate", "k", "v", "formatTime", "nothing", "m", "rows", "range", "formatTimeRange", "label", "windows", "w", "i", "when", "next", "obj", "n", "h", "baseStyles", "css", "__decorateClass", "property", "customElement"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var R=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var m=(a,e,r,t)=>{for(var n=t>1?void 0:t?L(e,r):e,o=a.length-1,i;o>=0;o--)(i=a[o])&&(n=(t?i(e,r,n):i(n))||n);return t&&n&&R(e,r,n),n};import{css as P,html as d,LitElement as T,nothing as x}from"lit";import{customElement as q,property as z}from"lit/decorators.js";var b={Sun:"\u2609",Moon:"\u263D",Mercury:"\u263F",Venus:"\u2640",Earth:"\u2641",Mars:"\u2642",Jupiter:"\u2643",Saturn:"\u2644",Uranus:"\u2645",Neptune:"\u2646",Pluto:"\u2647",Rahu:"\u260A",Ketu:"\u260B",Ascendant:"Asc",Lagna:"La",NorthNode:"\u260A",SouthNode:"\u260B","North node":"\u260A","South node":"\u260B",Chiron:"\u26B7",Lilith:"\u26B8","Black moon lilith":"\u26B8"};var A=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],M=A.map(a=>a.toLowerCase());import{css as $}from"lit";var h=$`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function l(a,e=1){return typeof a!="number"||!Number.isFinite(a)?"":a.toFixed(e).replace(/\.?0+$/,"")}var N="roxy-data";function C(a){return a.nodeName==="SCRIPT"&&a.getAttribute("type")==="application/json"}var u=class{constructor(e){this.host=e,e.addController(this)}hostConnected(){if(this.host.data!=null)return;let e=this.read();e!==void 0&&(this.host.data=e,this.host.requestUpdate())}read(){let e=this.findInlineScript();return e?this.parse(e.textContent):void 0}findInlineScript(){for(let e of Array.from(this.host.children))if(C(e)&&e.classList.contains(N))return e;return null}parse(e){if(e?.trim())try{return JSON.parse(e)}catch{return}}};function v(a){return a?a.charAt(0).toUpperCase()+a.slice(1).toLowerCase():""}var y=[{key:"sthanaBala",label:"Sthana",color:"var(--roxy-info, #0284c7)"},{key:"digBala",label:"Dig",color:"var(--roxy-success, #16a34a)"},{key:"kalaBala",label:"Kala",color:"var(--roxy-warning, #ea580c)"},{key:"chestaBala",label:"Chesta",color:"var(--roxy-accent, #f59e0b)"},{key:"naisargikaBala",label:"Naisargika",color:"var(--roxy-secondary, #475569)"},{key:"drikBala",label:"Drik",color:"var(--roxy-danger, #dc2626)"}],c=class extends T{constructor(){super();this.data=null;new u(this)}render(){if(!this.data?.planets?.length)return d`<div class="roxy-empty" role="status">No shadbala data</div>`;let r=[...this.data.planets].sort((t,n)=>t.relativeRank-n.relativeRank);return d`<div class="wrap" aria-label="Shadbala planetary strength"><div class="head"><h2 class="title">Shadbala</h2><p class="subtitle">${r.length} planets ranked by strength</p></div><div role="list" aria-label="Planet strength bars">${r.map(t=>this.renderPlanetRow(t))}</div><div class="legend" aria-label="Strength component legend">${y.map(t=>d`<div class="legend-row"><span class="legend-swatch" style="background:${t.color}" aria-hidden="true"></span> ${t.label}</div>`)}</div></div>`}renderPlanetRow(r){let t=b[v(r.planet)]??"",n=y.map(s=>Math.max(0,r[s.key])),o=n.reduce((s,p)=>s+p,0),i=typeof r.strengthRatio=="number"&&r.strengthRatio>=1,w=i?"adequacy-badge--adequate":"adequacy-badge--weak",k=i?"adequate":"weak",f=l(r.totalRupas,2)&&l(r.minRequired,2)?`${l(r.totalRupas,2)} / ${l(r.minRequired,2)} R`:"";return d`<div class="planet-row" role="listitem" aria-label="${r.planet} shadbala"><div class="planet-label"><span class="glyph" aria-hidden="true">${t}</span> ${r.planet} <span class="rank-badge" aria-label="rank ${r.relativeRank}">#${r.relativeRank}</span></div><div class="bar-wrap"><div class="bar" role="img" aria-label="Strength components for ${r.planet}">${o>0?y.map((s,p)=>{let g=n[p];if(g<=0)return x;let S=g/o*100;return d`<div class="bar-segment" style="flex-grow:${S};background:${s.color}" title="${s.label}: ${l(g,1)}"></div>`}):x}</div></div><div class="pills">${f?d`<span class="rupas-label">${f}</span>`:x} <span class="${`adequacy-badge ${w}`}">${k}</span></div></div>`}};c.styles=[h,P`.wrap{gap:var(--roxy-space-md,1rem);display:grid}.head{justify-content:space-between;align-items:baseline;gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.subtitle{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem);margin:0}.planet-row{align-items:center;gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-sm,.5rem) 0;border-bottom:1px solid var(--roxy-border,#e4e4e7);grid-template-columns:8rem 1fr auto;display:grid}.planet-row:last-of-type{border-bottom:none}.planet-label{font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);align-items:center;gap:6px;display:flex}.glyph{font-size:1.2em;line-height:1}.bar-wrap{flex-direction:column;gap:4px;display:flex}.bar{border-radius:var(--roxy-radius-sm,4px);background:var(--roxy-border,#e4e4e7);height:12px;display:flex;overflow:hidden}.bar-segment{height:100%;transition:flex-grow var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1))}.pills{flex-direction:column;align-items:flex-end;gap:4px;display:flex}.rupas-label{font-variant-numeric:tabular-nums;font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);white-space:nowrap}.adequacy-badge{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);font-weight:var(--roxy-weight-bold,600);padding:1px 6px;display:inline-block}.adequacy-badge--adequate{background:color-mix(in srgb, var(--roxy-success,#16a34a) 12%, transparent);color:var(--roxy-success-fg,#166534)}.adequacy-badge--weak{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 12%, transparent);color:var(--roxy-danger-fg,#991b1b)}.rank-badge{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-accent-fg,#b45309);font-weight:var(--roxy-weight-bold,600)}.legend{gap:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.legend-row{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);align-items:center;gap:6px;display:flex}.legend-swatch{border-radius:var(--roxy-radius-sm,4px);flex-shrink:0;width:10px;height:10px;display:inline-block}@container (width<=480px){.planet-row{grid-template-rows:auto auto;grid-template-columns:6rem 1fr}.pills{flex-direction:row;grid-column:1/-1;justify-content:flex-start;align-items:center}}`],m([z({attribute:!1})],c.prototype,"data",2),c=m([q("roxy-shadbala-table")],c);export{c as RoxyShadbalaTable};
1
+ var R=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var m=(a,e,r,t)=>{for(var n=t>1?void 0:t?L(e,r):e,o=a.length-1,i;o>=0;o--)(i=a[o])&&(n=(t?i(e,r,n):i(n))||n);return t&&n&&R(e,r,n),n};import{css as P,html as d,LitElement as T,nothing as x}from"lit";import{customElement as q,property as z}from"lit/decorators.js";var b={Sun:"\u2609",Moon:"\u263D",Mercury:"\u263F",Venus:"\u2640",Earth:"\u2641",Mars:"\u2642",Jupiter:"\u2643",Saturn:"\u2644",Uranus:"\u2645",Neptune:"\u2646",Pluto:"\u2647",Rahu:"\u260A",Ketu:"\u260B",Ascendant:"Asc",Lagna:"La",NorthNode:"\u260A",SouthNode:"\u260B","North node":"\u260A","South node":"\u260B",Chiron:"\u26B7",Lilith:"\u26B8","Black moon lilith":"\u26B8"};var A=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],M=A.map(a=>a.toLowerCase());import{css as $}from"lit";var h=$`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function l(a,e=1){return typeof a!="number"||!Number.isFinite(a)?"":a.toFixed(e).replace(/\.?0+$/,"")}var N="roxy-data";function C(a){return a.nodeName==="SCRIPT"&&a.getAttribute("type")==="application/json"}var u=class{constructor(e){this.host=e,e.addController(this)}hostConnected(){if(this.host.data!=null)return;let e=this.read();e!==void 0&&(this.host.data=e,this.host.requestUpdate())}read(){let e=this.findInlineScript();return e?this.parse(e.textContent):void 0}findInlineScript(){for(let e of Array.from(this.host.children))if(C(e)&&e.classList.contains(N))return e;return null}parse(e){if(e?.trim())try{return JSON.parse(e)}catch{return}}};function v(a){return a?a.charAt(0).toUpperCase()+a.slice(1).toLowerCase():""}var y=[{key:"sthanaBala",label:"Sthana",color:"var(--roxy-info, #0284c7)"},{key:"digBala",label:"Dig",color:"var(--roxy-success, #16a34a)"},{key:"kalaBala",label:"Kala",color:"var(--roxy-warning, #ea580c)"},{key:"chestaBala",label:"Chesta",color:"var(--roxy-accent, #f59e0b)"},{key:"naisargikaBala",label:"Naisargika",color:"var(--roxy-secondary, #475569)"},{key:"drikBala",label:"Drik",color:"var(--roxy-danger, #dc2626)"}],c=class extends T{constructor(){super();this.data=null;new u(this)}render(){if(!this.data?.planets?.length)return d`<div class="roxy-empty" role="status">No shadbala data</div>`;let r=[...this.data.planets].sort((t,n)=>t.relativeRank-n.relativeRank);return d`<div class="wrap" aria-label="Shadbala planetary strength"><div class="head"><h2 class="title">Shadbala</h2><p class="subtitle">${r.length} planets ranked by strength</p></div><div role="list" aria-label="Planet strength bars">${r.map(t=>this.renderPlanetRow(t))}</div><div class="legend" aria-label="Strength component legend">${y.map(t=>d`<div class="legend-row"><span class="legend-swatch" style="background:${t.color}" aria-hidden="true"></span> ${t.label}</div>`)}</div></div>`}renderPlanetRow(r){let t=b[v(r.planet)]??"",n=y.map(s=>Math.max(0,r[s.key])),o=n.reduce((s,p)=>s+p,0),i=typeof r.strengthRatio=="number"&&r.strengthRatio>=1,w=i?"adequacy-badge--adequate":"adequacy-badge--weak",k=i?"adequate":"weak",f=l(r.totalRupas,2)&&l(r.minRequired,2)?`${l(r.totalRupas,2)} / ${l(r.minRequired,2)} R`:"";return d`<div class="planet-row" role="listitem" aria-label="${r.planet} shadbala"><div class="planet-label"><span class="glyph" aria-hidden="true">${t}</span> ${r.planet} <span class="rank-badge" aria-label="rank ${r.relativeRank}">#${r.relativeRank}</span></div><div class="bar-wrap"><div class="bar" role="img" aria-label="Strength components for ${r.planet}">${o>0?y.map((s,p)=>{let g=n[p];if(g<=0)return x;let S=g/o*100;return d`<div class="bar-segment" style="flex-grow:${S};background:${s.color}" title="${s.label}: ${l(g,1)}"></div>`}):x}</div></div><div class="pills">${f?d`<span class="rupas-label">${f}</span>`:x} <span class="${`adequacy-badge ${w}`}">${k}</span></div></div>`}};c.styles=[h,P`.wrap{gap:var(--roxy-space-md,1rem);display:grid}.head{justify-content:space-between;align-items:baseline;gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.subtitle{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem);margin:0}.planet-row{align-items:center;gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-sm,.5rem) 0;border-bottom:1px solid var(--roxy-border,#e4e4e7);grid-template-columns:8rem 1fr auto;display:grid}.planet-row:last-of-type{border-bottom:none}.planet-label{font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);align-items:center;gap:6px;display:flex}.glyph{font-size:1.2em;line-height:1}.bar-wrap{flex-direction:column;gap:4px;display:flex}.bar{border-radius:var(--roxy-radius-sm,4px);background:var(--roxy-border,#e4e4e7);height:12px;display:flex;overflow:hidden}.bar-segment{height:100%;transition:flex-grow var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1))}.pills{flex-direction:column;align-items:flex-end;gap:4px;display:flex}.rupas-label{font-variant-numeric:tabular-nums;font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);white-space:nowrap}.adequacy-badge{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);font-weight:var(--roxy-weight-bold,600);padding:1px 6px;display:inline-block}.adequacy-badge--adequate{background:color-mix(in srgb, var(--roxy-success,#16a34a) 12%, transparent);color:var(--roxy-success-fg,#166534)}.adequacy-badge--weak{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 12%, transparent);color:var(--roxy-danger-fg,#991b1b)}.rank-badge{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.legend{gap:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.legend-row{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);align-items:center;gap:6px;display:flex}.legend-swatch{border-radius:var(--roxy-radius-sm,4px);flex-shrink:0;width:10px;height:10px;display:inline-block}@container (width<=480px){.planet-row{grid-template-rows:auto auto;grid-template-columns:6rem 1fr}.pills{flex-direction:row;grid-column:1/-1;justify-content:flex-start;align-items:center}}`],m([z({attribute:!1})],c.prototype,"data",2),c=m([q("roxy-shadbala-table")],c);export{c as RoxyShadbalaTable};
2
2
  //# sourceMappingURL=shadbala-table.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/shadbala-table.ts", "../../src/tokens/index.ts", "../../src/utils/base-styles.ts", "../../src/utils/format.ts", "../../src/utils/markup-data.ts", "../../src/utils/string.ts"],
4
- "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { PLANET_GLYPH } from '../tokens/index.js';\nimport type { ShadbalaResponse } from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatNumber } from '../utils/format.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\nimport { capitalize } from '../utils/string.js';\n\ntype Planet = ShadbalaResponse['planets'][number];\n\n/** CSS variable and display name for each of the 6 bala components. */\nconst BALA_COMPONENTS: Array<{\n\tkey: keyof Pick<\n\t\tPlanet,\n\t\t| 'sthanaBala'\n\t\t| 'digBala'\n\t\t| 'kalaBala'\n\t\t| 'chestaBala'\n\t\t| 'naisargikaBala'\n\t\t| 'drikBala'\n\t>;\n\tlabel: string;\n\tcolor: string;\n}> = [\n\t{ key: 'sthanaBala', label: 'Sthana', color: 'var(--roxy-info, #0284c7)' },\n\t{ key: 'digBala', label: 'Dig', color: 'var(--roxy-success, #16a34a)' },\n\t{ key: 'kalaBala', label: 'Kala', color: 'var(--roxy-warning, #ea580c)' },\n\t{ key: 'chestaBala', label: 'Chesta', color: 'var(--roxy-accent, #f59e0b)' },\n\t{\n\t\tkey: 'naisargikaBala',\n\t\tlabel: 'Naisargika',\n\t\tcolor: 'var(--roxy-secondary, #475569)',\n\t},\n\t{ key: 'drikBala', label: 'Drik', color: 'var(--roxy-danger, #dc2626)' },\n];\n\n/**\n * Shadbala six-fold planetary strength table with stacked bar visualization.\n * Pass `data` from /vedic-astrology/shadbala.\n */\n@customElement('roxy-shadbala-table')\nexport class RoxyShadbalaTable extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.wrap{gap:var(--roxy-space-md,1rem);display:grid}.head{justify-content:space-between;align-items:baseline;gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.subtitle{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem);margin:0}.planet-row{align-items:center;gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-sm,.5rem) 0;border-bottom:1px solid var(--roxy-border,#e4e4e7);grid-template-columns:8rem 1fr auto;display:grid}.planet-row:last-of-type{border-bottom:none}.planet-label{font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);align-items:center;gap:6px;display:flex}.glyph{font-size:1.2em;line-height:1}.bar-wrap{flex-direction:column;gap:4px;display:flex}.bar{border-radius:var(--roxy-radius-sm,4px);background:var(--roxy-border,#e4e4e7);height:12px;display:flex;overflow:hidden}.bar-segment{height:100%;transition:flex-grow var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1))}.pills{flex-direction:column;align-items:flex-end;gap:4px;display:flex}.rupas-label{font-variant-numeric:tabular-nums;font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);white-space:nowrap}.adequacy-badge{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);font-weight:var(--roxy-weight-bold,600);padding:1px 6px;display:inline-block}.adequacy-badge--adequate{background:color-mix(in srgb, var(--roxy-success,#16a34a) 12%, transparent);color:var(--roxy-success-fg,#166534)}.adequacy-badge--weak{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 12%, transparent);color:var(--roxy-danger-fg,#991b1b)}.rank-badge{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-accent-fg,#b45309);font-weight:var(--roxy-weight-bold,600)}.legend{gap:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.legend-row{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);align-items:center;gap:6px;display:flex}.legend-swatch{border-radius:var(--roxy-radius-sm,4px);flex-shrink:0;width:10px;height:10px;display:inline-block}@container (width<=480px){.planet-row{grid-template-rows:auto auto;grid-template-columns:6rem 1fr}.pills{flex-direction:row;grid-column:1/-1;justify-content:flex-start;align-items:center}}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: ShadbalaResponse | null = null;\n\n\trender() {\n\t\tif (!this.data?.planets?.length) {\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No shadbala data</div>`;\n\t\t}\n\n\t\tconst sorted = [...this.data.planets].sort(\n\t\t\t(a, b) => a.relativeRank - b.relativeRank,\n\t\t);\n\n\t\treturn html`<div class=\"wrap\" aria-label=\"Shadbala planetary strength\"><div class=\"head\"><h2 class=\"title\">Shadbala</h2><p class=\"subtitle\">${sorted.length} planets ranked by strength</p></div><div role=\"list\" aria-label=\"Planet strength bars\">${sorted.map((p) => this.renderPlanetRow(p))}</div><div class=\"legend\" aria-label=\"Strength component legend\">${BALA_COMPONENTS.map(\n\t\t\t\t\t(b) => html`<div class=\"legend-row\"><span class=\"legend-swatch\" style=\"background:${b.color}\" aria-hidden=\"true\"></span> ${b.label}</div>`,\n\t\t\t\t)}</div></div>`;\n\t}\n\n\tprivate renderPlanetRow(p: Planet) {\n\t\tconst glyph = PLANET_GLYPH[capitalize(p.planet)] ?? '';\n\n\t\t// Compute positive component values (drikBala can be negative)\n\t\tconst values = BALA_COMPONENTS.map((b) => Math.max(0, p[b.key] as number));\n\t\tconst total = values.reduce((s, v) => s + v, 0);\n\n\t\tconst isAdequate =\n\t\t\ttypeof p.strengthRatio === 'number' && p.strengthRatio >= 1;\n\t\tconst badgeClass = isAdequate\n\t\t\t? 'adequacy-badge--adequate'\n\t\t\t: 'adequacy-badge--weak';\n\t\tconst badgeLabel = isAdequate ? 'adequate' : 'weak';\n\n\t\tconst rupasStr =\n\t\t\tformatNumber(p.totalRupas, 2) && formatNumber(p.minRequired, 2)\n\t\t\t\t? `${formatNumber(p.totalRupas, 2)} / ${formatNumber(p.minRequired, 2)} R`\n\t\t\t\t: '';\n\n\t\treturn html`<div class=\"planet-row\" role=\"listitem\" aria-label=\"${p.planet} shadbala\"><div class=\"planet-label\"><span class=\"glyph\" aria-hidden=\"true\">${glyph}</span> ${p.planet} <span class=\"rank-badge\" aria-label=\"rank ${p.relativeRank}\">#${p.relativeRank}</span></div><div class=\"bar-wrap\"><div class=\"bar\" role=\"img\" aria-label=\"Strength components for ${p.planet}\">${\n\t\t\t\t\t\ttotal > 0\n\t\t\t\t\t\t\t? BALA_COMPONENTS.map((b, i) => {\n\t\t\t\t\t\t\t\t\tconst v = values[i];\n\t\t\t\t\t\t\t\t\tif (v <= 0) return nothing;\n\t\t\t\t\t\t\t\t\tconst grow = (v / total) * 100;\n\t\t\t\t\t\t\t\t\treturn html`<div class=\"bar-segment\" style=\"flex-grow:${grow};background:${b.color}\" title=\"${b.label}: ${formatNumber(v, 1)}\"></div>`;\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t}</div></div><div class=\"pills\">${rupasStr ? html`<span class=\"rupas-label\">${rupasStr}</span>` : nothing} <span class=\"${`adequacy-badge ${badgeClass}`}\">${badgeLabel}</span></div></div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-shadbala-table': RoxyShadbalaTable;\n\t}\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n */\n\nexport const PLANET_GLYPH: Record<string, string> = {\n\tSun: '\u2609',\n\tMoon: '\u263D',\n\tMercury: '\u263F',\n\tVenus: '\u2640',\n\tEarth: '\u2641',\n\tMars: '\u2642',\n\tJupiter: '\u2643',\n\tSaturn: '\u2644',\n\tUranus: '\u2645',\n\tNeptune: '\u2646',\n\tPluto: '\u2647',\n\tRahu: '\u260A',\n\tKetu: '\u260B',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n\tNorthNode: '\u260A',\n\tSouthNode: '\u260B',\n\t'North node': '\u260A',\n\t'South node': '\u260B',\n\tChiron: '\u26B7',\n\tLilith: '\u26B8',\n\t'Black moon lilith': '\u26B8',\n};\n\nexport const PLANET_ABBR: Record<string, string> = {\n\tSun: 'Su',\n\tMoon: 'Mo',\n\tMercury: 'Me',\n\tVenus: 'Ve',\n\tMars: 'Ma',\n\tJupiter: 'Ju',\n\tSaturn: 'Sa',\n\tUranus: 'Ur',\n\tNeptune: 'Ne',\n\tPluto: 'Pl',\n\tRahu: 'Ra',\n\tKetu: 'Ke',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n};\n\nexport const SIGN_GLYPH: Record<string, string> = {\n\tAries: '\u2648',\n\tTaurus: '\u2649',\n\tGemini: '\u264A',\n\tCancer: '\u264B',\n\tLeo: '\u264C',\n\tVirgo: '\u264D',\n\tLibra: '\u264E',\n\tScorpio: '\u264F',\n\tSagittarius: '\u2650',\n\tCapricorn: '\u2651',\n\tAquarius: '\u2652',\n\tPisces: '\u2653',\n};\n\nexport const SIGN_ABBR: Record<string, string> = {\n\tAries: 'Ar',\n\tTaurus: 'Ta',\n\tGemini: 'Ge',\n\tCancer: 'Cn',\n\tLeo: 'Le',\n\tVirgo: 'Vi',\n\tLibra: 'Li',\n\tScorpio: 'Sc',\n\tSagittarius: 'Sg',\n\tCapricorn: 'Cp',\n\tAquarius: 'Aq',\n\tPisces: 'Pi',\n};\n\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Lowercase rashi keys in canonical zodiac order. Derived from `SIGNS_ORDER`\n * so the two stay in lockstep. The /vedic-astrology/birth-chart response\n * carries planet buckets keyed by these names.\n */\nexport const RASHI_KEYS = SIGNS_ORDER.map((s) =>\n\ts.toLowerCase(),\n) as readonly Lowercase<(typeof SIGNS_ORDER)[number]>[];\n\n/** Aspect symbols. Used by synastry and natal chart aspect tables. */\nexport const ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\topposition: '\u260D',\n\ttrine: '\u25B3',\n\tsquare: '\u25A1',\n\tsextile: '\u2731',\n\tquincunx: '\u22BB',\n\tsemisextile: '\u22BC',\n};\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nexport const TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n\tHeaven: '\u2630',\n\tLake: '\u2631',\n\tFire: '\u2632',\n\tThunder: '\u2633',\n\tWind: '\u2634',\n\tWater: '\u2635',\n\tMountain: '\u2636',\n\tEarth: '\u2637',\n};\n\n/** Moon phase emoji set. Used by moon phase card. */\nexport const MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n */\n\nexport function formatTime(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(input)) return '';\n\tconst bareTime = /^\\d{2}:\\d{2}(:\\d{2})?$/.test(input);\n\tconst iso = bareTime ? `1970-01-01T${input}` : input;\n\tconst d = new Date(iso);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(undefined, {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\thour12: true,\n\t});\n}\n\nexport function formatDate(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst d = new Date(\n\t\t/^\\d{4}-\\d{2}-\\d{2}$/.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t});\n}\n\nexport function formatTimeRange(\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(t.start);\n\tconst end = formatTime(t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toFixed(dp).replace(/\\.?0+$/, '');\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated\n * canonical name (`SEMI_SEXTILE` \u2192 `semi-sextile`). Accepts any aspect-shaped\n * object so both natal and synastry inter-aspect entries can share this.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '').toLowerCase().replace(/_/g, '-');\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `capitalize`: title-cases the first character, lowercases the rest. Used\n * when matching API-supplied planet/sign names against the glyph maps in\n * `tokens/index.ts`, which use canonical TitleCase keys.\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn s\n\t\t.replace(/[_-]+/g, ' ')\n\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t.replace(/^\\w/, (c) => c.toUpperCase());\n}\n"],
5
- "mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,YAAA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AC,EACnEM,EAAQD,EAAO,OAAO,CAAC,EAAGE,IAAM,EAAIA,EAAG,CAAC,EAExCC,EACL,OAAOP,EAAE,eAAkB,UAAYA,EAAE,eAAiB,EACrDQ,EAAaD,EAChB,2BACA,uBACGE,EAAaF,EAAa,WAAa,OAEvCG,EACLC,EAAaX,EAAE,WAAY,CAAC,GAAKW,EAAaX,EAAE,YAAa,CAAC,EAC3D,GAAGW,EAAaX,EAAE,WAAY,CAAC,CAAC,MAAMW,EAAaX,EAAE,YAAa,CAAC,CAAC,KACpE,GAEJ,OAAOJ,wDAA2DI,EAAE,MAAM,+EAA+EC,CAAK,WAAWD,EAAE,MAAM,8CAA8CA,EAAE,YAAY,MAAMA,EAAE,YAAY,sGAAsGA,EAAE,MAAM,KAC3WK,EAAQ,EACLb,EAAgB,IAAI,CAACO,EAAGa,IAAM,CAC9B,IAAMN,EAAIF,EAAOQ,CAAC,EAClB,GAAIN,GAAK,EAAG,OAAOO,EACnB,IAAMC,EAAQR,EAAID,EAAS,IAC3B,OAAOT,8CAAiDkB,CAAI,eAAef,EAAE,KAAK,YAAYA,EAAE,KAAK,KAAKY,EAAaL,EAAG,CAAC,CAAC,UAC7H,CAAC,EACAO,CACJ,kCAAkCH,EAAWd,8BAAiCc,CAAQ,UAAYG,CAAO,iBAAiB,kBAAkBL,CAAU,EAAE,KAAKC,CAAU,qBAC3K,CACD,EA7DahB,EACL,OAAS,CACfsB,EACAC,m5EACD,EAWAC,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GAdlBzB,EAeZ,oBAfYA,EAANwB,EAAA,CADNE,EAAc,qBAAqB,GACvB1B",
4
+ "sourcesContent": ["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { PLANET_GLYPH } from '../tokens/index.js';\nimport type { ShadbalaResponse } from '../types/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatNumber } from '../utils/format.js';\nimport { MarkupDataController } from '../utils/markup-data.js';\nimport { capitalize } from '../utils/string.js';\n\ntype Planet = ShadbalaResponse['planets'][number];\n\n/** CSS variable and display name for each of the 6 bala components. */\nconst BALA_COMPONENTS: Array<{\n\tkey: keyof Pick<\n\t\tPlanet,\n\t\t| 'sthanaBala'\n\t\t| 'digBala'\n\t\t| 'kalaBala'\n\t\t| 'chestaBala'\n\t\t| 'naisargikaBala'\n\t\t| 'drikBala'\n\t>;\n\tlabel: string;\n\tcolor: string;\n}> = [\n\t{ key: 'sthanaBala', label: 'Sthana', color: 'var(--roxy-info, #0284c7)' },\n\t{ key: 'digBala', label: 'Dig', color: 'var(--roxy-success, #16a34a)' },\n\t{ key: 'kalaBala', label: 'Kala', color: 'var(--roxy-warning, #ea580c)' },\n\t{ key: 'chestaBala', label: 'Chesta', color: 'var(--roxy-accent, #f59e0b)' },\n\t{\n\t\tkey: 'naisargikaBala',\n\t\tlabel: 'Naisargika',\n\t\tcolor: 'var(--roxy-secondary, #475569)',\n\t},\n\t{ key: 'drikBala', label: 'Drik', color: 'var(--roxy-danger, #dc2626)' },\n];\n\n/**\n * Shadbala six-fold planetary strength table with stacked bar visualization.\n * Pass `data` from /vedic-astrology/shadbala.\n */\n@customElement('roxy-shadbala-table')\nexport class RoxyShadbalaTable extends LitElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.wrap{gap:var(--roxy-space-md,1rem);display:grid}.head{justify-content:space-between;align-items:baseline;gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.subtitle{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem);margin:0}.planet-row{align-items:center;gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-sm,.5rem) 0;border-bottom:1px solid var(--roxy-border,#e4e4e7);grid-template-columns:8rem 1fr auto;display:grid}.planet-row:last-of-type{border-bottom:none}.planet-label{font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);align-items:center;gap:6px;display:flex}.glyph{font-size:1.2em;line-height:1}.bar-wrap{flex-direction:column;gap:4px;display:flex}.bar{border-radius:var(--roxy-radius-sm,4px);background:var(--roxy-border,#e4e4e7);height:12px;display:flex;overflow:hidden}.bar-segment{height:100%;transition:flex-grow var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1))}.pills{flex-direction:column;align-items:flex-end;gap:4px;display:flex}.rupas-label{font-variant-numeric:tabular-nums;font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);white-space:nowrap}.adequacy-badge{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);font-weight:var(--roxy-weight-bold,600);padding:1px 6px;display:inline-block}.adequacy-badge--adequate{background:color-mix(in srgb, var(--roxy-success,#16a34a) 12%, transparent);color:var(--roxy-success-fg,#166534)}.adequacy-badge--weak{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 12%, transparent);color:var(--roxy-danger-fg,#991b1b)}.rank-badge{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.legend{gap:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.legend-row{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);align-items:center;gap:6px;display:flex}.legend-swatch{border-radius:var(--roxy-radius-sm,4px);flex-shrink:0;width:10px;height:10px;display:inline-block}@container (width<=480px){.planet-row{grid-template-rows:auto auto;grid-template-columns:6rem 1fr}.pills{flex-direction:row;grid-column:1/-1;justify-content:flex-start;align-items:center}}`,\n\t];\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Enables hydrating `data` from a direct-child\n\t\t// <script type=\"application/json\" class=\"roxy-data\"> for server-rendered\n\t\t// and cached consumers. The JavaScript `data` property still wins.\n\t\tnew MarkupDataController(this);\n\t}\n\n\t@property({ attribute: false })\n\tdata: ShadbalaResponse | null = null;\n\n\trender() {\n\t\tif (!this.data?.planets?.length) {\n\t\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No shadbala data</div>`;\n\t\t}\n\n\t\tconst sorted = [...this.data.planets].sort(\n\t\t\t(a, b) => a.relativeRank - b.relativeRank,\n\t\t);\n\n\t\treturn html`<div class=\"wrap\" aria-label=\"Shadbala planetary strength\"><div class=\"head\"><h2 class=\"title\">Shadbala</h2><p class=\"subtitle\">${sorted.length} planets ranked by strength</p></div><div role=\"list\" aria-label=\"Planet strength bars\">${sorted.map((p) => this.renderPlanetRow(p))}</div><div class=\"legend\" aria-label=\"Strength component legend\">${BALA_COMPONENTS.map(\n\t\t\t\t\t(b) => html`<div class=\"legend-row\"><span class=\"legend-swatch\" style=\"background:${b.color}\" aria-hidden=\"true\"></span> ${b.label}</div>`,\n\t\t\t\t)}</div></div>`;\n\t}\n\n\tprivate renderPlanetRow(p: Planet) {\n\t\tconst glyph = PLANET_GLYPH[capitalize(p.planet)] ?? '';\n\n\t\t// Compute positive component values (drikBala can be negative)\n\t\tconst values = BALA_COMPONENTS.map((b) => Math.max(0, p[b.key] as number));\n\t\tconst total = values.reduce((s, v) => s + v, 0);\n\n\t\tconst isAdequate =\n\t\t\ttypeof p.strengthRatio === 'number' && p.strengthRatio >= 1;\n\t\tconst badgeClass = isAdequate\n\t\t\t? 'adequacy-badge--adequate'\n\t\t\t: 'adequacy-badge--weak';\n\t\tconst badgeLabel = isAdequate ? 'adequate' : 'weak';\n\n\t\tconst rupasStr =\n\t\t\tformatNumber(p.totalRupas, 2) && formatNumber(p.minRequired, 2)\n\t\t\t\t? `${formatNumber(p.totalRupas, 2)} / ${formatNumber(p.minRequired, 2)} R`\n\t\t\t\t: '';\n\n\t\treturn html`<div class=\"planet-row\" role=\"listitem\" aria-label=\"${p.planet} shadbala\"><div class=\"planet-label\"><span class=\"glyph\" aria-hidden=\"true\">${glyph}</span> ${p.planet} <span class=\"rank-badge\" aria-label=\"rank ${p.relativeRank}\">#${p.relativeRank}</span></div><div class=\"bar-wrap\"><div class=\"bar\" role=\"img\" aria-label=\"Strength components for ${p.planet}\">${\n\t\t\t\t\t\ttotal > 0\n\t\t\t\t\t\t\t? BALA_COMPONENTS.map((b, i) => {\n\t\t\t\t\t\t\t\t\tconst v = values[i];\n\t\t\t\t\t\t\t\t\tif (v <= 0) return nothing;\n\t\t\t\t\t\t\t\t\tconst grow = (v / total) * 100;\n\t\t\t\t\t\t\t\t\treturn html`<div class=\"bar-segment\" style=\"flex-grow:${grow};background:${b.color}\" title=\"${b.label}: ${formatNumber(v, 1)}\"></div>`;\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t}</div></div><div class=\"pills\">${rupasStr ? html`<span class=\"rupas-label\">${rupasStr}</span>` : nothing} <span class=\"${`adequacy-badge ${badgeClass}`}\">${badgeLabel}</span></div></div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-shadbala-table': RoxyShadbalaTable;\n\t}\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n */\n\nexport const PLANET_GLYPH: Record<string, string> = {\n\tSun: '\u2609',\n\tMoon: '\u263D',\n\tMercury: '\u263F',\n\tVenus: '\u2640',\n\tEarth: '\u2641',\n\tMars: '\u2642',\n\tJupiter: '\u2643',\n\tSaturn: '\u2644',\n\tUranus: '\u2645',\n\tNeptune: '\u2646',\n\tPluto: '\u2647',\n\tRahu: '\u260A',\n\tKetu: '\u260B',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n\tNorthNode: '\u260A',\n\tSouthNode: '\u260B',\n\t'North node': '\u260A',\n\t'South node': '\u260B',\n\tChiron: '\u26B7',\n\tLilith: '\u26B8',\n\t'Black moon lilith': '\u26B8',\n};\n\nexport const PLANET_ABBR: Record<string, string> = {\n\tSun: 'Su',\n\tMoon: 'Mo',\n\tMercury: 'Me',\n\tVenus: 'Ve',\n\tMars: 'Ma',\n\tJupiter: 'Ju',\n\tSaturn: 'Sa',\n\tUranus: 'Ur',\n\tNeptune: 'Ne',\n\tPluto: 'Pl',\n\tRahu: 'Ra',\n\tKetu: 'Ke',\n\tAscendant: 'Asc',\n\tLagna: 'La',\n};\n\nexport const SIGN_GLYPH: Record<string, string> = {\n\tAries: '\u2648',\n\tTaurus: '\u2649',\n\tGemini: '\u264A',\n\tCancer: '\u264B',\n\tLeo: '\u264C',\n\tVirgo: '\u264D',\n\tLibra: '\u264E',\n\tScorpio: '\u264F',\n\tSagittarius: '\u2650',\n\tCapricorn: '\u2651',\n\tAquarius: '\u2652',\n\tPisces: '\u2653',\n};\n\nexport const SIGN_ABBR: Record<string, string> = {\n\tAries: 'Ar',\n\tTaurus: 'Ta',\n\tGemini: 'Ge',\n\tCancer: 'Cn',\n\tLeo: 'Le',\n\tVirgo: 'Vi',\n\tLibra: 'Li',\n\tScorpio: 'Sc',\n\tSagittarius: 'Sg',\n\tCapricorn: 'Cp',\n\tAquarius: 'Aq',\n\tPisces: 'Pi',\n};\n\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Lowercase rashi keys in canonical zodiac order. Derived from `SIGNS_ORDER`\n * so the two stay in lockstep. The /vedic-astrology/birth-chart response\n * carries planet buckets keyed by these names.\n */\nexport const RASHI_KEYS = SIGNS_ORDER.map((s) =>\n\ts.toLowerCase(),\n) as readonly Lowercase<(typeof SIGNS_ORDER)[number]>[];\n\n/** Aspect symbols. Used by synastry and natal chart aspect tables. */\nexport const ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\topposition: '\u260D',\n\ttrine: '\u25B3',\n\tsquare: '\u25A1',\n\tsextile: '\u2731',\n\tquincunx: '\u22BB',\n\tsemisextile: '\u22BC',\n};\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nexport const TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n\tHeaven: '\u2630',\n\tLake: '\u2631',\n\tFire: '\u2632',\n\tThunder: '\u2633',\n\tWind: '\u2634',\n\tWater: '\u2635',\n\tMountain: '\u2636',\n\tEarth: '\u2637',\n};\n\n/** Moon phase emoji set. Used by moon phase card. */\nexport const MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n */\n\nexport function formatTime(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (/^\\d{4}-\\d{2}-\\d{2}$/.test(input)) return '';\n\tconst bareTime = /^\\d{2}:\\d{2}(:\\d{2})?$/.test(input);\n\tconst iso = bareTime ? `1970-01-01T${input}` : input;\n\tconst d = new Date(iso);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(undefined, {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\thour12: true,\n\t});\n}\n\nexport function formatDate(input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst d = new Date(\n\t\t/^\\d{4}-\\d{2}-\\d{2}$/.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(undefined, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t});\n}\n\nexport function formatTimeRange(\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(t.start);\n\tconst end = formatTime(t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toFixed(dp).replace(/\\.?0+$/, '');\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated\n * canonical name (`SEMI_SEXTILE` \u2192 `semi-sextile`). Accepts any aspect-shaped\n * object so both natal and synastry inter-aspect entries can share this.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '').toLowerCase().replace(/_/g, '-');\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `capitalize`: title-cases the first character, lowercases the rest. Used\n * when matching API-supplied planet/sign names against the glyph maps in\n * `tokens/index.ts`, which use canonical TitleCase keys.\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn s\n\t\t.replace(/[_-]+/g, ' ')\n\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t.replace(/^\\w/, (c) => c.toUpperCase());\n}\n"],
5
+ "mappings": "wMAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,cAAAC,EAAY,WAAAC,MAAe,MAC/C,OAAS,iBAAAC,EAAe,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W,CAAC,EACnEM,EAAQD,EAAO,OAAO,CAAC,EAAGE,IAAM,EAAIA,EAAG,CAAC,EAExCC,EACL,OAAOP,EAAE,eAAkB,UAAYA,EAAE,eAAiB,EACrDQ,EAAaD,EAChB,2BACA,uBACGE,EAAaF,EAAa,WAAa,OAEvCG,EACLC,EAAaX,EAAE,WAAY,CAAC,GAAKW,EAAaX,EAAE,YAAa,CAAC,EAC3D,GAAGW,EAAaX,EAAE,WAAY,CAAC,CAAC,MAAMW,EAAaX,EAAE,YAAa,CAAC,CAAC,KACpE,GAEJ,OAAOJ,wDAA2DI,EAAE,MAAM,+EAA+EC,CAAK,WAAWD,EAAE,MAAM,8CAA8CA,EAAE,YAAY,MAAMA,EAAE,YAAY,sGAAsGA,EAAE,MAAM,KAC3WK,EAAQ,EACLb,EAAgB,IAAI,CAACO,EAAGa,IAAM,CAC9B,IAAMN,EAAIF,EAAOQ,CAAC,EAClB,GAAIN,GAAK,EAAG,OAAOO,EACnB,IAAMC,EAAQR,EAAID,EAAS,IAC3B,OAAOT,8CAAiDkB,CAAI,eAAef,EAAE,KAAK,YAAYA,EAAE,KAAK,KAAKY,EAAaL,EAAG,CAAC,CAAC,UAC7H,CAAC,EACAO,CACJ,kCAAkCH,EAAWd,8BAAiCc,CAAQ,UAAYG,CAAO,iBAAiB,kBAAkBL,CAAU,EAAE,KAAKC,CAAU,qBAC3K,CACD,EA7DahB,EACL,OAAS,CACfsB,EACAC,o5EACD,EAWAC,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GAdlBzB,EAeZ,oBAfYA,EAANwB,EAAA,CADNE,EAAc,qBAAqB,GACvB1B",
6
6
  "names": ["css", "html", "LitElement", "nothing", "customElement", "property", "PLANET_GLYPH", "SIGNS_ORDER", "RASHI_KEYS", "s", "css", "baseStyles", "formatNumber", "value", "dp", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "text", "capitalize", "s", "BALA_COMPONENTS", "RoxyShadbalaTable", "LitElement", "MarkupDataController", "html", "sorted", "a", "b", "p", "glyph", "PLANET_GLYPH", "capitalize", "values", "total", "v", "isAdequate", "badgeClass", "badgeLabel", "rupasStr", "formatNumber", "i", "nothing", "grow", "baseStyles", "css", "__decorateClass", "property", "customElement"]
7
7
  }
@@ -1,2 +1,8 @@
1
- var G=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var P=(n,t,a,r)=>{for(var o=r>1?void 0:r?H(t,a):t,s=n.length-1,e;s>=0;s--)(e=n[s])&&(o=(r?e(t,a,o):e(o))||o);return r&&o&&G(t,a,o),o};import{css as j,html as c,LitElement as B,nothing as u,svg as v}from"lit";import{customElement as U,property as F}from"lit/decorators.js";var C={Sun:"\u2609",Moon:"\u263D",Mercury:"\u263F",Venus:"\u2640",Earth:"\u2641",Mars:"\u2642",Jupiter:"\u2643",Saturn:"\u2644",Uranus:"\u2645",Neptune:"\u2646",Pluto:"\u2647",Rahu:"\u260A",Ketu:"\u260B",Ascendant:"Asc",Lagna:"La",NorthNode:"\u260A",SouthNode:"\u260B","North node":"\u260A","South node":"\u260B",Chiron:"\u26B7",Lilith:"\u26B8","Black moon lilith":"\u26B8"};var E={Aries:"\u2648",Taurus:"\u2649",Gemini:"\u264A",Cancer:"\u264B",Leo:"\u264C",Virgo:"\u264D",Libra:"\u264E",Scorpio:"\u264F",Sagittarius:"\u2650",Capricorn:"\u2651",Aquarius:"\u2652",Pisces:"\u2653"};var b=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],K=b.map(n=>n.toLowerCase());import{css as O}from"lit";var M=O`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function D(n){let t=n%360;return t<0?t+360:t}function z(n){let t=D(n),a=Math.floor(t/30)%12,r=t%30,o=Math.floor(r),s=(r-o)*60,e=Math.floor(s),p=Math.round((s-e)*60);return{sign:b[a]??"Aries",signIndex:a,degree:o,minute:e,second:p}}function y(n,t,a,r){let o=r*Math.PI/180;return{x:n+a*Math.cos(o),y:t+a*Math.sin(o)}}function k(n,t=1){return typeof n!="number"||!Number.isFinite(n)?"":n.toFixed(t).replace(/\.?0+$/,"")}var _={conjunction:"aspect-conjunction",sextile:"aspect-sextile",square:"aspect-square",trine:"aspect-trine",opposition:"aspect-opposition"};function R(n){return(n.type??"").toLowerCase().replace(/_/g,"-")}var q="roxy-data";function Y(n){return n.nodeName==="SCRIPT"&&n.getAttribute("type")==="application/json"}var w=class{constructor(t){this.host=t,t.addController(this)}hostConnected(){if(this.host.data!=null)return;let t=this.read();t!==void 0&&(this.host.data=t,this.host.requestUpdate())}read(){let t=this.findInlineScript();return t?this.parse(t.textContent):void 0}findInlineScript(){for(let t of Array.from(this.host.children))if(Y(t)&&t.classList.contains(q))return t;return null}parse(t){if(t?.trim())try{return JSON.parse(t)}catch{return}}};function A(n){return n?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():""}var N=360,i=N/2,L=170,V=154,T=124,$=96,S=class extends B{constructor(){super();this.data=null;new w(this)}render(){if(!this.data)return c`<div class="roxy-empty" role="status">No synastry data</div>`;let{person1:a,person2:r,compatibilityScore:o,analysis:s}=this.data,e=this.data.interAspects??[],p=a?.planets??[],g=r?.planets??[],d=typeof o=="number"?Math.round(o):void 0,x=s?.overall,m=s?.strengths??[],l=s?.challenges??[];return p.length>0&&g.length>0?c`<div class="wrap" aria-label="Synastry compatibility chart"><div class="head"><h2 class="title">Synastry</h2>${typeof d=="number"?c`<span class="score" aria-label="${`Score ${d} of 100`}">${d} / 100</span>`:u}</div><svg viewBox="0 0 ${N} ${N}" role="img" aria-label="Dual chart wheel comparing two natal charts"><title>Synastry dual wheel</title><circle class="wheel-line" cx="${i}" cy="${i}" r="${L}" stroke-width="1.5"/><circle class="wheel-line" cx="${i}" cy="${i}" r="${$+14}" stroke-width="0.8"/><circle class="wheel-line" cx="${i}" cy="${i}" r="${$-14}" stroke-width="0.6"/>${this.renderSpokes()} ${this.renderSigns()} ${this.renderInterAspectLines(p,g,e)} ${this.renderRing(p,T,"p1",1)} ${this.renderRing(g,$,"p2",2)} ${this.renderAscendants(this.data)}</svg><div class="legend-row"><span><span class="swatch" style="background:var(--roxy-accent)"></span>Person 1</span> <span><span class="swatch" style="background:var(--roxy-info)"></span>Person 2</span> <span><span class="swatch" style="background:var(--roxy-success)"></span>harmonious</span> <span><span class="swatch" style="background:var(--roxy-danger)"></span>challenging</span></div>${x?c`<p class="summary">${x}</p>`:u} ${e.length>0?this.renderAspects(e):u} ${m.length>0||l.length>0?c`<div class="lists">${m.length?c`<div><h3>Strengths</h3><ul>${m.map(f=>c`<li>${f}</li>`)}</ul></div>`:u} ${l.length?c`<div><h3>Challenges</h3><ul>${l.map(f=>c`<li>${f}</li>`)}</ul></div>`:u}</div>`:u}</div>`:c`<div class="wrap" aria-label="Synastry compatibility chart"><div class="head"><h2 class="title">Synastry</h2>${typeof d=="number"?c`<span class="score" aria-label="${`Score ${d} of 100`}">${d} / 100</span>`:u}</div><div class="missing-planets" role="status">Synastry response missing planet positions. Pass <code>data</code> with <code>person1.planets</code> and <code>person2.planets</code> arrays from the natal-chart endpoint, or use the <code>&lt;roxy-data></code> fallback.</div>${x?c`<p class="summary">${x}</p>`:u} ${e.length>0?this.renderAspects(e):u} ${m.length>0||l.length>0?c`<div class="lists">${m.length?c`<div><h3>Strengths</h3><ul>${m.map(f=>c`<li>${f}</li>`)}</ul></div>`:u} ${l.length?c`<div><h3>Challenges</h3><ul>${l.map(f=>c`<li>${f}</li>`)}</ul></div>`:u}</div>`:u}</div>`}toAngle(a){return 180-a}renderSpokes(){return Array.from({length:12},(a,r)=>{let o=this.toAngle(r*30),s=y(i,i,$-14,o),e=y(i,i,L,o);return v`<line class="wheel-line" x1="${s.x}" y1="${s.y}" x2="${e.x}" y2="${e.y}" stroke-width="0.6">`})}renderSigns(){return b.map((a,r)=>{let o=this.toAngle(r*30+15),s=y(i,i,V,o);return v`<text class="sign" x="${s.x}" y="${s.y}" text-anchor="middle" dominant-baseline="central">${E[a]}</text>`})}renderRing(a,r,o,s){return a.map(e=>{if(!Number.isFinite(e.longitude))return u;let p=this.toAngle(e.longitude),g=y(i,i,r,p),x=y(i,i,r+(s===1?-12:-10),p),m=C[A(e.name)]??e.name.slice(0,2),l=z(e.longitude),h=e.isRetrograde===!0,f=`${l.degree}\xB0${String(l.minute).padStart(2,"0")}'`,I=`${e.name}${h?" retrograde":""} - ${f} ${l.sign}`;return v`<g><text class="${o}" x="${g.x}" y="${g.y}" text-anchor="middle" dominant-baseline="central"><title>${I}</title>${m}<tspan class="person-tag" dy="-0.55em" dx="0.15em">${s}</tspan></text><text class="planet-deg" x="${x.x}" y="${x.y}" text-anchor="middle" dominant-baseline="central">${l.degree}°${h?v`<tspan class="retro">℞</tspan>`:u}</text></g>`})}renderAscendants(a){let r=[],o=(s,e)=>{if(!s)return;let p=b.findIndex(h=>h.toLowerCase()===s.sign.toLowerCase());if(p===-1)return;let g=p*30+s.degree,d=this.toAngle(g),x=e===1?T+14:$+14,m=y(i,i,x,d),l=y(i,i,L+14,d);r.push(v`<g><line class="asc-tick" x1="${m.x}" y1="${m.y}" x2="${l.x}" y2="${l.y}"><text class="asc-label" x="${l.x}" y="${l.y}" text-anchor="middle" dominant-baseline="central">Asc${e}</text></g>`)};return o(a.person1?.ascendant,1),o(a.person2?.ascendant,2),r}renderInterAspectLines(a,r,o){let s=(e,p)=>{let g=A(p);for(let d of e)if(A(d.name)===g&&typeof d.longitude=="number")return d.longitude};return o.map(e=>{let p=s(a,e.planet1),g=s(r,e.planet2);if(p===void 0||g===void 0)return u;let d=y(i,i,T-12,this.toAngle(p)),x=y(i,i,$+8,this.toAngle(g)),m=R(e),l=_[m]??"aspect-other",h=k(e.orb,1);return v`<line class="${`aspect ${l}`}" x1="${d.x}" y1="${d.y}" x2="${x.x}" y2="${x.y}"><title>${e.planet1} ${m} ${e.planet2}${h?` (orb ${h}\xB0)`:""}</title></line>`})}renderAspects(a){return c`<table><thead><tr><th>Planet 1</th><th>Planet 2</th><th>Aspect</th><th>Orb</th><th>Strength</th></tr></thead><tbody>${a.slice(0,12).map(r=>c`<tr><td>${r.planet1}</td><td>${r.planet2}</td><td>${R(r)||""}</td><td class="orb">${k(r.orb,1)}</td><td>${J(r.strength)}</td></tr>`)}</tbody></table>`}};S.styles=[M,j`.wrap{gap:var(--roxy-space-md,1rem);display:grid}.head{justify-content:space-between;align-items:center;gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.score{font-variant-numeric:tabular-nums;font-weight:var(--roxy-weight-bold,600);color:var(--roxy-accent-fg,#b45309);font-size:var(--roxy-text-xl,1.5rem)}svg{aspect-ratio:1;width:100%;max-width:560px;height:auto;margin:0 auto;display:block}.wheel-line{fill:none;stroke:var(--roxy-border,#e4e4e7)}.sign{fill:var(--roxy-secondary,#475569);font-size:14px}.p1{fill:var(--roxy-accent,#f59e0b);font-size:13px;font-weight:600}.p2{fill:var(--roxy-info,#0284c7);font-size:13px;font-weight:600}.person-tag{opacity:.85;font-size:7px;font-weight:700}.planet-deg{fill:var(--roxy-muted,#71717a);font-size:7px;font-family:var(--roxy-font-sans)}.planet-deg .retro{fill:var(--roxy-danger,#dc2626)}.asc-tick{stroke:var(--roxy-accent-fg,#b45309);stroke-width:1px;opacity:.75}.asc-label{fill:var(--roxy-accent-fg,#b45309);font-size:9px;font-weight:700;font-family:var(--roxy-font-sans);letter-spacing:.04em}.aspect{stroke-width:.8px;fill:none;opacity:.5}.aspect-trine,.aspect-sextile{stroke:var(--roxy-success,#16a34a)}.aspect-square,.aspect-opposition{stroke:var(--roxy-danger,#dc2626)}.aspect-conjunction{stroke:var(--roxy-accent-fg,#b45309)}.aspect-other{stroke:var(--roxy-muted,#71717a);opacity:.35}.legend-row{gap:var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);margin-top:calc(var(--roxy-space-xs,.25rem) * -1);flex-wrap:wrap;display:flex}.legend-row .swatch{vertical-align:middle;border-radius:50%;width:8px;height:8px;margin-right:4px;display:inline-block}.summary{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);margin:0}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}th,td{padding:var(--roxy-space-sm,.5rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);text-align:left}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;font-size:var(--roxy-text-xs,.75rem);letter-spacing:.06em}td.orb{font-variant-numeric:tabular-nums;color:var(--roxy-muted,#71717a)}.lists{gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));display:grid}.lists h3{margin:0 0 var(--roxy-space-xs,.25rem) 0;font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.06em}.lists ul{padding-left:var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);margin:0}.missing-planets{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 8%, transparent);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);line-height:1.5}.missing-planets code{font-family:var(--roxy-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);background:color-mix(in srgb, var(--roxy-fg,#0a0a0a) 6%, transparent);border-radius:4px;padding:0 4px;font-size:.95em}`],P([F({attribute:!1})],S.prototype,"data",2),S=P([U("roxy-synastry-chart")],S);function J(n){return typeof n=="number"?Math.round(n).toString():""}export{S as RoxySynastryChart};
1
+ var G=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var P=(n,t,a,r)=>{for(var o=r>1?void 0:r?H(t,a):t,s=n.length-1,e;s>=0;s--)(e=n[s])&&(o=(r?e(t,a,o):e(o))||o);return r&&o&&G(t,a,o),o};import{css as j,html as c,LitElement as B,nothing as u,svg as v}from"lit";import{customElement as U,property as F}from"lit/decorators.js";var C={Sun:"\u2609",Moon:"\u263D",Mercury:"\u263F",Venus:"\u2640",Earth:"\u2641",Mars:"\u2642",Jupiter:"\u2643",Saturn:"\u2644",Uranus:"\u2645",Neptune:"\u2646",Pluto:"\u2647",Rahu:"\u260A",Ketu:"\u260B",Ascendant:"Asc",Lagna:"La",NorthNode:"\u260A",SouthNode:"\u260B","North node":"\u260A","South node":"\u260B",Chiron:"\u26B7",Lilith:"\u26B8","Black moon lilith":"\u26B8"};var E={Aries:"\u2648",Taurus:"\u2649",Gemini:"\u264A",Cancer:"\u264B",Leo:"\u264C",Virgo:"\u264D",Libra:"\u264E",Scorpio:"\u264F",Sagittarius:"\u2650",Capricorn:"\u2651",Aquarius:"\u2652",Pisces:"\u2653"};var b=["Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces"],K=b.map(n=>n.toLowerCase());import{css as O}from"lit";var M=O`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}*,:before,:after{box-sizing:border-box}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function D(n){let t=n%360;return t<0?t+360:t}function z(n){let t=D(n),a=Math.floor(t/30)%12,r=t%30,o=Math.floor(r),s=(r-o)*60,e=Math.floor(s),p=Math.round((s-e)*60);return{sign:b[a]??"Aries",signIndex:a,degree:o,minute:e,second:p}}function y(n,t,a,r){let o=r*Math.PI/180;return{x:n+a*Math.cos(o),y:t+a*Math.sin(o)}}function k(n,t=1){return typeof n!="number"||!Number.isFinite(n)?"":n.toFixed(t).replace(/\.?0+$/,"")}var _={conjunction:"aspect-conjunction",sextile:"aspect-sextile",square:"aspect-square",trine:"aspect-trine",opposition:"aspect-opposition"};function R(n){return(n.type??"").toLowerCase().replace(/_/g,"-")}var q="roxy-data";function Y(n){return n.nodeName==="SCRIPT"&&n.getAttribute("type")==="application/json"}var w=class{constructor(t){this.host=t,t.addController(this)}hostConnected(){if(this.host.data!=null)return;let t=this.read();t!==void 0&&(this.host.data=t,this.host.requestUpdate())}read(){let t=this.findInlineScript();return t?this.parse(t.textContent):void 0}findInlineScript(){for(let t of Array.from(this.host.children))if(Y(t)&&t.classList.contains(q))return t;return null}parse(t){if(t?.trim())try{return JSON.parse(t)}catch{return}}};function A(n){return n?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():""}var N=360,i=N/2,L=170,V=154,T=124,$=96,S=class extends B{constructor(){super();this.data=null;new w(this)}render(){if(!this.data)return c`<div class="roxy-empty" role="status">No synastry data</div>`;let{person1:a,person2:r,compatibilityScore:o,analysis:s}=this.data,e=this.data.interAspects??[],p=a?.planets??[],g=r?.planets??[],d=typeof o=="number"?Math.round(o):void 0,x=s?.overall,m=s?.strengths??[],l=s?.challenges??[];return p.length>0&&g.length>0?c`<div class="wrap" aria-label="Synastry compatibility chart"><div class="head"><h2 class="title">Synastry</h2>${typeof d=="number"?c`<span class="score" aria-label="${`Score ${d} of 100`}">${d} / 100</span>`:u}</div><svg viewBox="0 0 ${N} ${N}" role="img" aria-label="Dual chart wheel comparing two natal charts"><title>Synastry dual wheel</title><circle class="wheel-line" cx="${i}" cy="${i}" r="${L}" stroke-width="1.5"/><circle class="wheel-line" cx="${i}" cy="${i}" r="${$+14}" stroke-width="0.8"/><circle class="wheel-line" cx="${i}" cy="${i}" r="${$-14}" stroke-width="0.6"/>${this.renderSpokes()} ${this.renderSigns()} ${this.renderInterAspectLines(p,g,e)} ${this.renderRing(p,T,"p1",1)} ${this.renderRing(g,$,"p2",2)} ${this.renderAscendants(this.data)}</svg><div class="legend-row"><span><span class="swatch" style="background:var(--roxy-accent)"></span>Person 1</span> <span><span class="swatch" style="background:var(--roxy-info)"></span>Person 2</span> <span><span class="swatch" style="background:var(--roxy-success)"></span>harmonious</span> <span><span class="swatch" style="background:var(--roxy-danger)"></span>challenging</span></div>${x?c`<p class="summary">${x}</p>`:u} ${e.length>0?this.renderAspects(e):u} ${m.length>0||l.length>0?c`<div class="lists">${m.length?c`<div><h3>Strengths</h3><ul>${m.map(h=>c`<li>${h}</li>`)}</ul></div>`:u} ${l.length?c`<div><h3>Challenges</h3><ul>${l.map(h=>c`<li>${h}</li>`)}</ul></div>`:u}</div>`:u}</div>`:c`<div class="wrap" aria-label="Synastry compatibility chart"><div class="head"><h2 class="title">Synastry</h2>${typeof d=="number"?c`<span class="score" aria-label="${`Score ${d} of 100`}">${d} / 100</span>`:u}</div><div class="missing-planets" role="status">Synastry response missing planet positions. Pass <code>data</code> with <code>person1.planets</code> and <code>person2.planets</code> arrays from the natal-chart endpoint, or use the <code>&lt;roxy-data></code> fallback.</div>${x?c`<p class="summary">${x}</p>`:u} ${e.length>0?this.renderAspects(e):u} ${m.length>0||l.length>0?c`<div class="lists">${m.length?c`<div><h3>Strengths</h3><ul>${m.map(h=>c`<li>${h}</li>`)}</ul></div>`:u} ${l.length?c`<div><h3>Challenges</h3><ul>${l.map(h=>c`<li>${h}</li>`)}</ul></div>`:u}</div>`:u}</div>`}toAngle(a){return 180-a}renderSpokes(){return Array.from({length:12},(a,r)=>{let o=this.toAngle(r*30),s=y(i,i,$-14,o),e=y(i,i,L,o);return v`<line class="wheel-line" x1=${s.x} y1=${s.y} x2=${e.x} y2=${e.y} stroke-width="0.6" />`})}renderSigns(){return b.map((a,r)=>{let o=this.toAngle(r*30+15),s=y(i,i,V,o);return v`<text class="sign" x=${s.x} y=${s.y} text-anchor="middle" dominant-baseline="central">${E[a]}</text>`})}renderRing(a,r,o,s){return a.map(e=>{if(!Number.isFinite(e.longitude))return u;let p=this.toAngle(e.longitude),g=y(i,i,r,p),x=y(i,i,r+(s===1?-12:-10),p),m=C[A(e.name)]??e.name.slice(0,2),l=z(e.longitude),f=e.isRetrograde===!0,h=`${l.degree}\xB0${String(l.minute).padStart(2,"0")}'`,I=`${e.name}${f?" retrograde":""} - ${h} ${l.sign}`;return v`<g>
2
+ <text class=${o} x=${g.x} y=${g.y} text-anchor="middle" dominant-baseline="central"><title>${I}</title>${m}<tspan class="person-tag" dy="-0.55em" dx="0.15em">${s}</tspan></text>
3
+ <text class="planet-deg" x=${x.x} y=${x.y} text-anchor="middle" dominant-baseline="central">${l.degree}°${f?v`<tspan class="retro"> ℞</tspan>`:u}</text>
4
+ </g>`})}renderAscendants(a){let r=[],o=(s,e)=>{if(!s)return;let p=b.findIndex(f=>f.toLowerCase()===s.sign.toLowerCase());if(p===-1)return;let g=p*30+s.degree,d=this.toAngle(g),x=e===1?T+14:$+14,m=y(i,i,x,d),l=y(i,i,L+14,d);r.push(v`<g>
5
+ <line class="asc-tick" x1=${m.x} y1=${m.y} x2=${l.x} y2=${l.y} />
6
+ <text class="asc-label" x=${l.x} y=${l.y} text-anchor="middle" dominant-baseline="central">Asc${e}</text>
7
+ </g>`)};return o(a.person1?.ascendant,1),o(a.person2?.ascendant,2),r}renderInterAspectLines(a,r,o){let s=(e,p)=>{let g=A(p);for(let d of e)if(A(d.name)===g&&typeof d.longitude=="number")return d.longitude};return o.map(e=>{let p=s(a,e.planet1),g=s(r,e.planet2);if(p===void 0||g===void 0)return u;let d=y(i,i,T-12,this.toAngle(p)),x=y(i,i,$+8,this.toAngle(g)),m=R(e),l=_[m]??"aspect-other",f=k(e.orb,1);return v`<line class=${`aspect ${l}`} x1=${d.x} y1=${d.y} x2=${x.x} y2=${x.y}><title>${e.planet1} ${m} ${e.planet2}${f?` (orb ${f}\xB0)`:""}</title></line>`})}renderAspects(a){return c`<table><thead><tr><th>Planet 1</th><th>Planet 2</th><th>Aspect</th><th>Orb</th><th>Strength</th></tr></thead><tbody>${a.slice(0,12).map(r=>c`<tr><td>${r.planet1}</td><td>${r.planet2}</td><td>${R(r)||""}</td><td class="orb">${k(r.orb,1)}</td><td>${J(r.strength)}</td></tr>`)}</tbody></table>`}};S.styles=[M,j`.wrap{gap:var(--roxy-space-md,1rem);display:grid}.head{justify-content:space-between;align-items:center;gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.score{font-variant-numeric:tabular-nums;font-weight:var(--roxy-weight-bold,600);color:var(--roxy-accent-ink,#b45309);font-size:var(--roxy-text-xl,1.5rem)}svg{aspect-ratio:1;width:100%;max-width:560px;height:auto;margin:0 auto;display:block}.wheel-line{fill:none;stroke:var(--roxy-border,#e4e4e7)}.sign{fill:var(--roxy-secondary,#475569);font-size:14px}.p1{fill:var(--roxy-accent,#f59e0b);font-size:13px;font-weight:600}.p2{fill:var(--roxy-info,#0284c7);font-size:13px;font-weight:600}.person-tag{opacity:.85;font-size:7px;font-weight:700}.planet-deg{fill:var(--roxy-muted,#71717a);font-size:7px;font-family:var(--roxy-font-sans)}.planet-deg .retro{fill:var(--roxy-danger,#dc2626)}.asc-tick{stroke:var(--roxy-accent-ink,#b45309);stroke-width:1px;opacity:.75}.asc-label{fill:var(--roxy-accent-ink,#b45309);font-size:9px;font-weight:700;font-family:var(--roxy-font-sans);letter-spacing:.04em}.aspect{stroke-width:.8px;fill:none;opacity:.5}.aspect-trine,.aspect-sextile{stroke:var(--roxy-success,#16a34a)}.aspect-square,.aspect-opposition{stroke:var(--roxy-danger,#dc2626)}.aspect-conjunction{stroke:var(--roxy-accent-ink,#b45309)}.aspect-other{stroke:var(--roxy-muted,#71717a);opacity:.35}.legend-row{gap:var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);margin-top:calc(var(--roxy-space-xs,.25rem) * -1);flex-wrap:wrap;display:flex}.legend-row .swatch{vertical-align:middle;border-radius:50%;width:8px;height:8px;margin-right:4px;display:inline-block}.summary{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);margin:0}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}th,td{padding:var(--roxy-space-sm,.5rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);text-align:left}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;font-size:var(--roxy-text-xs,.75rem);letter-spacing:.06em}td.orb{font-variant-numeric:tabular-nums;color:var(--roxy-muted,#71717a)}.lists{gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(14rem,1fr));display:grid}.lists h3{margin:0 0 var(--roxy-space-xs,.25rem) 0;font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.06em}.lists ul{padding-left:var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);margin:0}.missing-planets{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 8%, transparent);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);line-height:1.5}.missing-planets code{font-family:var(--roxy-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);background:color-mix(in srgb, var(--roxy-fg,#0a0a0a) 6%, transparent);border-radius:4px;padding:0 4px;font-size:.95em}`],P([F({attribute:!1})],S.prototype,"data",2),S=P([U("roxy-synastry-chart")],S);function J(n){return typeof n=="number"?Math.round(n).toString():""}export{S as RoxySynastryChart};
2
8
  //# sourceMappingURL=synastry-chart.js.map