@roxyapi/ui 0.27.5 → 0.27.6

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 (73) hide show
  1. package/components-catalog.json +128 -127
  2. package/dist/cdn/components/endpoint-form.js +1 -1
  3. package/dist/cdn/components/endpoint-form.js.map +1 -1
  4. package/dist/cdn/components/ephemeris-table.js +4 -4
  5. package/dist/cdn/components/ephemeris-table.js.map +3 -3
  6. package/dist/cdn/locales/de.js +1 -1
  7. package/dist/cdn/locales/de.js.map +2 -2
  8. package/dist/cdn/locales/es.js +1 -1
  9. package/dist/cdn/locales/es.js.map +2 -2
  10. package/dist/cdn/locales/fr.js +1 -1
  11. package/dist/cdn/locales/fr.js.map +2 -2
  12. package/dist/cdn/locales/hi.js +1 -1
  13. package/dist/cdn/locales/hi.js.map +2 -2
  14. package/dist/cdn/locales/pt.js +1 -1
  15. package/dist/cdn/locales/pt.js.map +2 -2
  16. package/dist/cdn/locales/ru.js +1 -1
  17. package/dist/cdn/locales/ru.js.map +2 -2
  18. package/dist/cdn/locales/tr.js +1 -1
  19. package/dist/cdn/locales/tr.js.map +2 -2
  20. package/dist/cdn/roxy-ui.js +27 -27
  21. package/dist/cdn/roxy-ui.js.map +3 -3
  22. package/dist/components/endpoint-form.js +1 -1
  23. package/dist/components/endpoint-form.js.map +1 -1
  24. package/dist/components/ephemeris-table.d.ts +34 -0
  25. package/dist/components/ephemeris-table.d.ts.map +1 -1
  26. package/dist/components/ephemeris-table.js +1 -1
  27. package/dist/components/ephemeris-table.js.map +3 -3
  28. package/dist/i18n/chrome-strings.d.ts +1 -1
  29. package/dist/i18n/chrome-strings.d.ts.map +1 -1
  30. package/dist/index.cjs +27 -27
  31. package/dist/index.cjs.map +3 -3
  32. package/dist/index.js +34 -34
  33. package/dist/index.js.map +3 -3
  34. package/dist/locales/de.d.ts.map +1 -1
  35. package/dist/locales/de.js +1 -1
  36. package/dist/locales/de.js.map +2 -2
  37. package/dist/locales/es.d.ts.map +1 -1
  38. package/dist/locales/es.js +1 -1
  39. package/dist/locales/es.js.map +2 -2
  40. package/dist/locales/fr.d.ts.map +1 -1
  41. package/dist/locales/fr.js +1 -1
  42. package/dist/locales/fr.js.map +2 -2
  43. package/dist/locales/hi.d.ts.map +1 -1
  44. package/dist/locales/hi.js +1 -1
  45. package/dist/locales/hi.js.map +2 -2
  46. package/dist/locales/pt.d.ts.map +1 -1
  47. package/dist/locales/pt.js +1 -1
  48. package/dist/locales/pt.js.map +2 -2
  49. package/dist/locales/ru.d.ts.map +1 -1
  50. package/dist/locales/ru.js +1 -1
  51. package/dist/locales/ru.js.map +2 -2
  52. package/dist/locales/tr.d.ts.map +1 -1
  53. package/dist/locales/tr.js +1 -1
  54. package/dist/locales/tr.js.map +2 -2
  55. package/dist/schemas/post--vedic-astrology-daily.json +1 -0
  56. package/dist/types/index.d.ts +1 -1
  57. package/dist/types/index.d.ts.map +1 -1
  58. package/dist/types/types.gen.d.ts +718 -0
  59. package/dist/types/types.gen.d.ts.map +1 -1
  60. package/dist/version.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/src/components/ephemeris-table.ts +105 -2
  63. package/src/i18n/chrome-strings.ts +1 -0
  64. package/src/locales/de.ts +1 -0
  65. package/src/locales/es.ts +1 -0
  66. package/src/locales/fr.ts +1 -0
  67. package/src/locales/hi.ts +1 -0
  68. package/src/locales/pt.ts +1 -0
  69. package/src/locales/ru.ts +1 -0
  70. package/src/locales/tr.ts +1 -0
  71. package/src/types/index.ts +1 -1
  72. package/src/types/types.gen.ts +723 -0
  73. package/src/version.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/endpoint-form.ts", "../../src/generated/api-languages.ts", "../../src/i18n/lang.ts", "../../src/i18n/localized-element.ts", "../../src/utils/string.ts", "../../src/i18n/registry.ts", "../../src/i18n/locale-controller.ts", "../../src/tokens/index.ts", "../../src/utils/base-styles.ts", "../../src/utils/disclosure.ts", "../../src/utils/field-schema.ts", "../../src/version.ts"],
4
- "sourcesContent": ["import { css, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { apiLang } from '../i18n/lang.js';\nimport { RoxyLocalizedElement } from '../i18n/localized-element.js';\nimport { fieldLabel, optionLabel } from '../i18n/registry.js';\nimport { signGlyph } from '../tokens/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { chevron, disclosureStyles } from '../utils/disclosure.js';\nimport {\n\tbuildFormModel,\n\tderiveSubmitLabel,\n\ttype FieldDef,\n\ttype FormModel,\n\tisZodiacEnum,\n\tLOCATION_PAIR,\n\tLOCATION_TRIO,\n\ttype OpenApiDoc,\n\ttype OperationSchema,\n\tsliceFileName,\n} from '../utils/field-schema.js';\nimport { humanize } from '../utils/string.js';\nimport { ROXY_UI_VERSION } from '../version.js';\n\n/** Production spec, fetched when no slice is available and no explicit `spec-url` is set. */\nconst PROD_SPEC_URL = 'https://roxyapi.com/api/v2/openapi.json';\n\n/** Version-pinned jsDelivr base for the digested per-operation schema slices, mirroring the wrapper CDN pinning so a slice matches the bundle it ships beside. */\nconst SLICE_BASE = `https://cdn.jsdelivr.net/npm/@roxyapi/ui@${ROXY_UI_VERSION}/dist/schemas`;\n\nconst specCache = new Map<string, Promise<OpenApiDoc>>();\n\n/**\n * A spec fetch that came back with a non-2xx status, carrying the STATUS rather than a sentence.\n *\n * @remarks\n * The visible wording is composed by the element, in the element's language, and never here: {@link loadSpec} shares one cached promise across every form on the page, so a message built at throw time would freeze the first mounter's language onto every later one. Same split as everywhere else in this library, the machine value travels and the display copy is made where the reader is.\n */\nclass SpecHttpError extends Error {\n\tconstructor(readonly status: number) {\n\t\tsuper(`HTTP ${status}`);\n\t}\n}\n\n/** The endpoint is absent from the document that was loaded. Carries the two parts the message names, for the reason {@link SpecHttpError} gives. */\nclass SpecMissingOperationError extends Error {\n\tconstructor(\n\t\treadonly method: string,\n\t\treadonly path: string,\n\t) {\n\t\tsuper(`Endpoint ${method} ${path} not found in OpenAPI spec`);\n\t}\n}\n\n/**\n * Drop every cached spec promise.\n\n * @remarks\n * Test-only, and deliberately NOT re-exported from the package entry. The cache is module state shared by every test file in a single `bun test` process, and it only self-evicts on rejection, so one file that resolves a spec leaves a warm entry that silently satisfies a later file assertion about fetching. That made slice-fallback coverage pass or fail purely on file order.\n\n * @internal\n */\nexport function resetSpecCache(): void {\n\tspecCache.clear();\n}\n\nasync function loadSpec(url: string): Promise<OpenApiDoc> {\n\tlet pending = specCache.get(url);\n\tif (!pending) {\n\t\tpending = fetch(url)\n\t\t\t.then(async (res) => {\n\t\t\t\tif (!res.ok) throw new SpecHttpError(res.status);\n\t\t\t\treturn (await res.json()) as OpenApiDoc;\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\t// Evict the rejected promise BEFORE rethrowing so subsequent\n\t\t\t\t// callers (the user clicking Retry, a remount) hit the network\n\t\t\t\t// again instead of replaying the cached failure forever.\n\t\t\t\tspecCache.delete(url);\n\t\t\t\tthrow err;\n\t\t\t});\n\t\tspecCache.set(url, pending);\n\t}\n\treturn pending;\n}\n\n/** A fresh seed for a hidden `seed` field, so each submit is a new draw unless the caller pinned one. */\nfunction randomSeed(): string {\n\treturn (\n\t\tglobalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2)\n\t);\n}\n\n/** Parse an array-field text value into a real array: JSON when it parses to one, else comma-separated tokens. */\nfunction parseArrayValue(raw: string): unknown {\n\tconst trimmed = raw.trim();\n\tif (!trimmed) return [];\n\ttry {\n\t\tconst parsed = JSON.parse(trimmed);\n\t\tif (Array.isArray(parsed)) return parsed;\n\t} catch {\n\t\t// Not JSON: fall through to comma splitting.\n\t}\n\treturn trimmed\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean);\n}\n\n/**\n * Schema-driven form. Pass `endpoint` (e.g. \"vedic-astrology/birth-chart\"). The form digests the operation's request schema into a spec-derived input for each parameter (a zodiac tile grid, a date or time input, a city search, a toggle) with progressive disclosure, and emits a `roxy-submit` CustomEvent carrying the validated payload. The caller decides what to do (call the SDK, render a chart, navigate).\n *\n * @remarks\n * Schema resolution order: an explicit `spec-url` fetches that full spec and digests it (unchanged, the demo path); otherwise the form tries a small version-pinned per-operation slice from the CDN, and on any miss falls back to fetching the production spec. Each input kind is chosen purely from the parameter shape (see {@link ../utils/field-schema.ts}), so a new endpoint gets a working, on-brand form with no per-endpoint code.\n *\n * The visitor-facing `lang` parameter is never rendered: a site owner sets the element `lang` attribute, and the form routes it to the query string on submit. Optional parameters collapse under one Advanced disclosure; a form whose only required field is an enum submits on selection.\n *\n * **Two languages are in play here and they are different answers.** {@link RoxyLocalizedElement.effectiveLang} is the DISPLAY tag, region included, and it is what every `t()` call and the city search read. {@link RoxyEndpointForm.requestLang} is the WIRE value, region stripped and unsupported languages omitted, and it is what reaches `?lang=`. Swapping them is silent in both directions: the request one demotes every regional visitor, and the display one is a 400.\n *\n * **Field labels and option text ARE translated now, and they arrive over the network rather than from a catalogue.** They are keyed by the WIRE NAME the spec uses, not by the English text, because that English text is itself computed here by `humanize()`: there is no constant for a source-keyed catalogue to key on, which is why the chrome catalogue could never reach them. {@link RoxyEndpointForm.fieldText} and {@link RoxyEndpointForm.optionText} read a map baked into the per-language payload at build time and published through the same registry the chrome strings use. It rides the `locales/{lang}.js` download a translated page already makes, so it costs no extra request, needs no network at render time, and cannot flash English before correcting itself.\n *\n * **`humanize()` remains, as the fallback, and that is what makes this safe.** The payload is cosmetic and never awaited: a form draws immediately, an offline page or a blocked request renders exactly what it rendered before labels existed, and a language with no translation for a given key falls back to English server-side. There is no state in which a missing label breaks a form. Operation SUMMARIES and field DESCRIPTIONS are deliberately NOT in that map: a description is developer-facing reference prose, most of it collapsed behind a disclosure, and the widget already states the same contract language-neutrally through its input type and bounds. GROUP names stay catalogued rather than fetched, because the spec has nine of them: see {@link RoxyEndpointForm.groupName}.\n */\n@customElement('roxy-endpoint-form')\nexport class RoxyEndpointForm extends RoxyLocalizedElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tdisclosureStyles,\n\t\tcss`form{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);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);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.fields{align-items:start;gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));display:grid}.fields:empty{display:none}.person-group{background:var(--roxy-surface,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);min-inline-size:0;margin:0;display:grid}.person-group legend{padding:0 var(--roxy-space-xs,.25rem);font-weight:var(--roxy-weight-bold,600)}.field{gap:var(--roxy-space-xs,.25rem);flex-direction:column;min-width:0;display:flex}.tiles-field{grid-column:1/-1}label,.label{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569)}.req{color:var(--roxy-danger-fg,#991b1b);margin-left:4px}input,select{box-sizing:border-box;width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);font-family:inherit}input:focus,select:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.help{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}.help-details>summary{cursor:pointer;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);align-items:center;gap:4px;display:flex}.help-details .help-lead{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.help-details .help-full{margin-top:var(--roxy-space-xs,.25rem);display:block}.location-block{gap:var(--roxy-space-xs,.25rem);grid-column:1/-1;display:grid}.tiles{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(5.5rem,1fr));display:grid}.tile{min-height:44px;padding:var(--roxy-space-sm,.5rem);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease), background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-direction:column;justify-content:center;align-items:center;gap:2px;display:flex}.tile:hover{border-color:var(--roxy-accent,#f59e0b)}.tile[aria-checked=true]{border-color:var(--roxy-accent,#f59e0b);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 12%, transparent);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.tile:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.tile-glyph{font-size:1.35em;line-height:1}.toggle-row{align-items:center;gap:var(--roxy-space-sm,.5rem);display:flex}.toggle{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);background:var(--roxy-border,#e4e4e7);cursor:pointer;width:44px;height:26px;transition:background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0;padding:0;position:relative}.toggle[aria-checked=true]{background:var(--roxy-accent,#f59e0b);border-color:var(--roxy-accent,#f59e0b)}.toggle .knob{background:var(--roxy-bg,#fff);width:20px;height:20px;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);border-radius:50%;position:absolute;top:2px;left:2px}.toggle[aria-checked=true] .knob{transform:translate(18px)}.toggle:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.toggle-label{cursor:pointer}@media (prefers-reduced-motion:reduce){.tile,.toggle,.toggle .knob{transition:none}}.advanced{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.advanced>summary{cursor:pointer;font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-fg,#0a0a0a);align-items:center;gap:6px;display:flex}.advanced[open]>summary{margin-bottom:var(--roxy-space-md,1rem)}.advanced .fields,.advanced .person-group{margin-top:var(--roxy-space-md,1rem)}.validation-error{gap:var(--roxy-space-xs,.25rem);padding:var(--roxy-space-md,1rem);background:color-mix(in srgb, var(--roxy-danger,#dc2626) 8%, transparent);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);display:grid}button.submit{background:var(--roxy-accent-ink,#b45309);color:var(--roxy-bg,#fff);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-lg,1.5rem);font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600);cursor:pointer;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));border:0;justify-self:start}button.submit:hover{transform:scale(1.02)}button.submit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}@media (prefers-reduced-motion:reduce){button.submit{transition:none}}.spec-error{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}`,\n\t];\n\n\t@property({ type: String, attribute: 'data-endpoint' })\n\tendpoint = 'vedic-astrology/birth-chart';\n\n\t@property({ type: String })\n\tmethod: 'GET' | 'POST' = 'POST';\n\n\t/** Explicit OpenAPI spec URL. When set, the form fetches and digests that full spec (the demo path). When empty, it resolves a version-pinned slice first, then the production spec. */\n\t@property({ type: String, attribute: 'spec-url' })\n\tspecUrl = '';\n\n\t/** Override the submit-button label. Empty derives an outcome-first label from the endpoint. */\n\t@property({ type: String, attribute: 'submit-label' })\n\tsubmitLabel = '';\n\n\t/** Browser-safe publishable key, forwarded to the slotted city search so the natal or synastry form can geocode. */\n\t@property({ type: String, attribute: 'publishable-key' })\n\tpublishableKey?: string;\n\n\t/** Prefill values, keyed by field name (nested per group). Used by `remember` mode and to restore the previous submission. JS property only. */\n\t@property({ attribute: false })\n\tinitialValues?: Record<string, unknown>;\n\n\t@state()\n\tprivate fields: FieldDef[] = [];\n\n\t@state()\n\tprivate formTitle = '';\n\n\t@state()\n\tprivate hasLang = false;\n\n\t@state()\n\tprivate values: Record<string, unknown> = {};\n\n\t@state()\n\tprivate loaded = false;\n\n\t@state()\n\tprivate specError: string | null = null;\n\n\t@state()\n\tprivate validationErrors: string[] = [];\n\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback();\n\t\tvoid this.loadSchema();\n\t}\n\n\tprivate async loadSchema() {\n\t\tthis.specError = null;\n\t\ttry {\n\t\t\tthis.applyModel(await this.resolveModel());\n\t\t} catch (err) {\n\t\t\t// The banner reads in the page language; the event keeps the canonical\n\t\t\t// English, because a listener is code and a developer console is not a\n\t\t\t// localized surface.\n\t\t\tthis.specError = this.specErrorMessage(err);\n\t\t\tthis.loaded = true;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-spec-error', {\n\t\t\t\t\tdetail: {\n\t\t\t\t\t\turl: this.specUrl || PROD_SPEC_URL,\n\t\t\t\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t\t\t\t},\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\t/** The failure sentence a visitor reads. Composed here rather than at the throw, so the shared spec-cache promise cannot freeze one form's language onto another. A message from anywhere else (a browser network error) is a wire fact and passes through untranslated. */\n\tprivate specErrorMessage(err: unknown): string {\n\t\tif (err instanceof SpecHttpError)\n\t\t\treturn this.t('HTTP error {{status}}', { status: err.status });\n\t\tif (err instanceof SpecMissingOperationError)\n\t\t\treturn this.t('Endpoint {{method}} {{path}} not found in OpenAPI spec', {\n\t\t\t\tmethod: err.method,\n\t\t\t\tpath: err.path,\n\t\t\t});\n\t\treturn err instanceof Error ? err.message : String(err);\n\t}\n\n\t/** Resolve the form model: explicit spec-url wins; else a version-pinned slice; else the production spec. */\n\tprivate async resolveModel(): Promise<FormModel> {\n\t\tif (this.specUrl) return this.modelFromSpec(this.specUrl);\n\t\tconst slice = await this.tryLoadSlice();\n\t\treturn slice ?? this.modelFromSpec(PROD_SPEC_URL);\n\t}\n\n\t/** Fetch and digest one operation from a full OpenAPI document. */\n\tprivate async modelFromSpec(url: string): Promise<FormModel> {\n\t\tconst spec = await loadSpec(url);\n\t\tconst path = `/${this.endpoint.replace(/^\\//, '')}`;\n\t\tconst op = spec.paths?.[path]?.[this.method.toLowerCase()] as\n\t\t\t| OperationSchema\n\t\t\t| undefined;\n\t\tif (!op) throw new SpecMissingOperationError(this.method, path);\n\t\treturn buildFormModel(op, spec.components?.schemas ?? {}, this.endpoint);\n\t}\n\n\t/** Try the small precomputed slice; return null on any miss so the caller falls back to the full spec. */\n\tprivate async tryLoadSlice(): Promise<FormModel | null> {\n\t\ttry {\n\t\t\tconst res = await fetch(\n\t\t\t\t`${SLICE_BASE}/${sliceFileName(this.method, this.endpoint)}`,\n\t\t\t);\n\t\t\tif (!res.ok) return null;\n\t\t\treturn (await res.json()) as FormModel;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate applyModel(model: FormModel) {\n\t\tthis.fields = model.fields;\n\t\tthis.formTitle = model.title;\n\t\tthis.hasLang = model.hasLang;\n\t\t// Pre-fill: schema defaults first, then any remembered/initial values (only\n\t\t// for fields this endpoint has) so a stale stored payload from another\n\t\t// endpoint cannot inject unknown keys. Remembered values are nested per\n\t\t// group, so read them by group.\n\t\tconst init: Record<string, unknown> = {};\n\t\tfor (const f of model.fields) {\n\t\t\tif (f.default !== undefined) init[f.key] = f.default;\n\t\t\tconst remembered = f.group\n\t\t\t\t? (\n\t\t\t\t\t\tthis.initialValues?.[f.group] as Record<string, unknown> | undefined\n\t\t\t\t\t)?.[f.name]\n\t\t\t\t: this.initialValues?.[f.name];\n\t\t\tif (remembered !== undefined) init[f.key] = remembered;\n\t\t}\n\t\tthis.values = init;\n\t\tthis.loaded = true;\n\t}\n\n\tprivate retryLoadSchema = () => {\n\t\tthis.loaded = false;\n\t\tthis.specError = null;\n\t\tvoid this.loadSchema();\n\t};\n\n\tprivate setValue(name: string, value: unknown) {\n\t\tthis.values = { ...this.values, [name]: value };\n\t}\n\n\t/** The field's render role: a hidden autogenerated seed, a hidden defaulted limit/offset, a suppressed location coordinate, or a normally rendered input. */\n\tprivate roleOf(\n\t\tf: FieldDef,\n\t): 'seed' | 'hidden-default' | 'location' | 'normal' {\n\t\tif (f.name === 'seed') return 'seed';\n\t\tif ((f.name === 'limit' || f.name === 'offset') && !f.required)\n\t\t\treturn 'hidden-default';\n\t\tif (\n\t\t\t(LOCATION_TRIO as readonly string[]).includes(f.name) &&\n\t\t\tthis.groupHasLocation(f.group)\n\t\t)\n\t\t\treturn 'location';\n\t\t// A flat timezone in a group with no coordinates of its own is still suppressed when a\n\t\t// location group has claimed it, otherwise the prefixed shape shows a raw decimal-hours\n\t\t// box beside two city searches that already know the answer.\n\t\tif (\n\t\t\tf.name === 'timezone' &&\n\t\t\tthis.locationGroups().some((g) => this.timezoneFieldFor(g)?.key === f.key)\n\t\t)\n\t\t\treturn 'location';\n\t\treturn 'normal';\n\t}\n\n\t/** True when the field renders its own input (as opposed to being hidden or replaced by the city search). */\n\tprivate isRendered(f: FieldDef): boolean {\n\t\treturn this.roleOf(f) === 'normal';\n\t}\n\n\t/** Ordered, de-duplicated group keys (undefined flat group plus each named object). */\n\tprivate groupKeys(): (string | undefined)[] {\n\t\tconst keys: (string | undefined)[] = [];\n\t\tfor (const f of this.fields)\n\t\t\tif (!keys.includes(f.group)) keys.push(f.group);\n\t\treturn keys;\n\t}\n\n\t/** True when the fields in `group` (or the flat top level) carry a latitude+longitude pair, so a location-search can autofill them. Timezone is NOT required here, see {@link LOCATION_PAIR}. */\n\tprivate groupHasLocation(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_PAIR.every((n) => inGroup.some((f) => f.name === n));\n\t}\n\n\t/**\n\t * Location groups in field order. Order is load-bearing: when a request carries coordinate\n\t * groups but only ONE unprefixed top-level `timezone`, the FIRST group owns it, because that\n\t * timezone belongs to the primary moment (`generateRelocationChart` has one `timezone` and it is\n\t * the birth timezone). Without an owner both city boxes would write the same key and the second\n\t * pick would silently overwrite the first with the wrong offset.\n\t */\n\tprivate locationGroups(): (string | undefined)[] {\n\t\treturn this.groupKeys().filter((g) => this.groupHasLocation(g));\n\t}\n\n\t/**\n\t * The timezone field a group's city search should fill, or undefined when there is none.\n\t *\n\t * Prefers a timezone inside the group (the nested `person1`/`person2` shape has its own). Falls\n\t * back to an unowned flat `timezone` for the first location group only, which is what makes the\n\t * prefixed shape work without leaving a decimal-hours box for a visitor to guess at.\n\t */\n\tprivate timezoneFieldFor(group?: string): FieldDef | undefined {\n\t\tconst own = this.fields.find(\n\t\t\t(f) => f.group === group && f.name === 'timezone',\n\t\t);\n\t\tif (own) return own;\n\t\tif (this.locationGroups()[0] !== group) return undefined;\n\t\treturn this.fields.find(\n\t\t\t(f) => f.group === undefined && f.name === 'timezone',\n\t\t);\n\t}\n\n\t/**\n\t * True when the location block must show a required mark, i.e. ANY member of the trio is required. The block is a single city-search input that fills all three, so if even one is required (e.g. bodygraph requires `timezone` while `latitude`/`longitude` are optional) the input is required and `collectMissing` blocks submit without it. Requiring ALL three understated that: the asterisk went missing on a block the form still enforced, which reads as optional to a non-technical embedder.\n\t */\n\tprivate locationRequired(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_TRIO.some((n) =>\n\t\t\tinGroup.some((f) => f.name === n && f.required),\n\t\t);\n\t}\n\n\t/** A named group is a required input when any of its leaf fields is required or it carries a location. */\n\tprivate groupIsRequired(group: string): boolean {\n\t\treturn (\n\t\t\tthis.groupHasLocation(group) ||\n\t\t\tthis.fields.some((f) => f.group === group && f.required)\n\t\t);\n\t}\n\n\t/**\n\t * The single visible required enum field, when the whole form reduces to exactly one: no location block, no named group, one required rendered enum. This is what turns the horoscope form into a tap-to-load sign grid; returns null otherwise.\n\t */\n\tprivate get singleEnumField(): FieldDef | null {\n\t\tif (this.groupKeys().some((g) => this.groupHasLocation(g))) return null;\n\t\tif (this.groupKeys().some((g) => g !== undefined)) return null;\n\t\tconst req = this.fields.filter((f) => f.required && this.isRendered(f));\n\t\tconst only = req[0];\n\t\tif (req.length !== 1 || !only) return null;\n\t\treturn only.kind === 'tiles' || only.kind === 'select' ? only : null;\n\t}\n\n\t/** The submit-button label. A caller-supplied one is theirs and is printed verbatim; the derived verb is ours, so it goes through the catalogue. {@link deriveSubmitLabel} returns the canonical English verb, which IS the catalogue key. */\n\tprivate effectiveSubmitLabel(): string {\n\t\treturn this.submitLabel || this.t(deriveSubmitLabel(this.endpoint));\n\t}\n\n\t/**\n\t * The value this form may put on `?lang=`, or undefined to leave the request on the API default.\n\t *\n\t * @remarks\n\t * NOT the display language, and the name says so: `effectiveLang()` on the base class is the full display tag every `t()` reads. `?lang=es-AR` is a 400 and `?lang=es` is a 200, and the language resolves from `<html lang>` rather than only from an attribute a developer typed, so the unfiltered tag reaching the query string would break every regional and every untranslated locale. {@link apiLang} does both narrowings; this method exists so the submit path reads as one call.\n\t */\n\tprivate requestLang(): string | undefined {\n\t\treturn apiLang(this);\n\t}\n\n\t/**\n\t * The words this form writes over a request field, and the options under it.\n\t *\n\t * @remarks\n\t * `humanize()` is the FALLBACK, not the default, and it stays because it has to: the labels\n\t * arrive over the network and a form must draw before they land, on an offline page, and when\n\t * the request fails. So the worst case is exactly what this form rendered before labels\n\t * existed, and the best case is a translated one, with no state in between where it breaks.\n\t *\n\t * Keyed by WIRE NAME rather than by the English text, because the English text is itself\n\t * computed here by `humanize()`; there is no constant to key on. Same reason the label map is\n\t * a separate key space from the chrome catalogue.\n\t */\n\tprivate fieldText(name: string): string {\n\t\treturn fieldLabel(this.requestLang(), name) ?? humanize(name);\n\t}\n\n\t/** The option text under one field, falling back the same way. */\n\tprivate optionText(field: string, value: string): string {\n\t\treturn optionLabel(this.requestLang(), field, value) ?? humanize(value);\n\t}\n\n\t/**\n\t * Location-select handler bound to a group: fills that group's coordinate keys plus whichever\n\t * timezone field it owns.\n\t *\n\t * Keys are LOOKED UP from the model rather than built as `group.name`. That assumption held only\n\t * while every group came from object nesting; a prefixed group stores under the original wire\n\t * name (`birthLatitude`), so constructing `birth.latitude` would write a key the request builder\n\t * never reads and the coordinates would silently stay empty.\n\t */\n\tprivate onLocationFor(group?: string) {\n\t\treturn (e: Event) => {\n\t\t\tconst detail = (e as CustomEvent).detail as {\n\t\t\t\tlatitude?: number;\n\t\t\t\tlongitude?: number;\n\t\t\t\ttimezone?: string;\n\t\t\t\tutcOffset?: number;\n\t\t\t};\n\t\t\tif (!detail) return;\n\t\t\tconst keyOf = (name: string) =>\n\t\t\t\tthis.fields.find((f) => f.group === group && f.name === name)?.key;\n\t\t\tconst next: Record<string, unknown> = { ...this.values };\n\t\t\tconst lat = keyOf('latitude');\n\t\t\tconst lon = keyOf('longitude');\n\t\t\tif (lat) next[lat] = detail.latitude;\n\t\t\tif (lon) next[lon] = detail.longitude;\n\t\t\tconst tz = this.timezoneFieldFor(group);\n\t\t\tif (tz) next[tz.key] = detail.timezone ?? detail.utcOffset;\n\t\t\tthis.values = next;\n\t\t};\n\t}\n\n\tprivate selectTile(f: FieldDef, value: string) {\n\t\tthis.setValue(f.key, value);\n\t\tif (this.singleEnumField?.key === f.key) this.submit();\n\t}\n\n\t/** Roving-tabindex arrow-key navigation for a tile radiogroup, modeled on the shared tablist pattern (selection follows focus). */\n\tprivate onTilesKeyDown(f: FieldDef) {\n\t\treturn (e: KeyboardEvent) => {\n\t\t\tconst opts = f.enum ?? [];\n\t\t\tif (opts.length === 0) return;\n\t\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\t\tlet next: number;\n\t\t\tif (e.key === 'Home') next = 0;\n\t\t\telse if (e.key === 'End') next = opts.length - 1;\n\t\t\telse if (e.key === 'ArrowRight' || e.key === 'ArrowDown')\n\t\t\t\tnext = cur === -1 ? 0 : (cur + 1) % opts.length;\n\t\t\telse if (e.key === 'ArrowLeft' || e.key === 'ArrowUp')\n\t\t\t\tnext =\n\t\t\t\t\tcur === -1 ? opts.length - 1 : (cur - 1 + opts.length) % opts.length;\n\t\t\telse return;\n\t\t\te.preventDefault();\n\t\t\tconst value = opts[next];\n\t\t\tif (value === undefined) return;\n\t\t\tthis.selectTile(f, value);\n\t\t\tconst root = e.currentTarget as HTMLElement;\n\t\t\trequestAnimationFrame(() =>\n\t\t\t\troot.querySelector<HTMLButtonElement>(`[data-tile='${next}']`)?.focus(),\n\t\t\t);\n\t\t};\n\t}\n\n\tprivate onSubmit = (e: Event) => {\n\t\te.preventDefault();\n\t\tthis.submit();\n\t};\n\n\t/** Validate, then emit `roxy-submit` with the reconstructed payload, the spec query keys, and whether the form was a single-enum sticky picker. */\n\tprivate submit() {\n\t\tconst missing = this.collectMissing();\n\t\tif (missing.keys.length > 0) {\n\t\t\tthis.validationErrors = missing.labels;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-validation-error', {\n\t\t\t\t\tdetail: { missing: missing.keys },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis.validationErrors = [];\n\t\tconst out: Record<string, unknown> = {};\n\t\tfor (const f of this.fields) {\n\t\t\tlet v = this.values[f.key];\n\t\t\t// A hidden seed autogenerates per submit unless a value was remembered.\n\t\t\tif (f.name === 'seed' && (v === undefined || v === '')) v = randomSeed();\n\t\t\tif (v === undefined || v === '') continue;\n\t\t\tif (f.kind === 'array' && typeof v === 'string') v = parseArrayValue(v);\n\t\t\tif (f.group) {\n\t\t\t\tconst g = (out[f.group] as Record<string, unknown> | undefined) ?? {};\n\t\t\t\tg[f.name] = v;\n\t\t\t\tout[f.group] = g;\n\t\t\t} else {\n\t\t\t\tout[f.name] = v;\n\t\t\t}\n\t\t}\n\t\t// The spec knows which parameters belong in the query string; the listener\n\t\t// does not. Report them (including a site-owner lang) so a POST with a query\n\t\t// parameter reaches the API correctly instead of being dropped in the body.\n\t\tconst queryKeys = this.fields.filter((f) => f.inQuery).map((f) => f.name);\n\t\tconst lang = this.requestLang();\n\t\tif (this.hasLang && lang) {\n\t\t\tout.lang = lang;\n\t\t\tqueryKeys.push('lang');\n\t\t}\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('roxy-submit', {\n\t\t\t\tdetail: {\n\t\t\t\t\tendpoint: this.endpoint,\n\t\t\t\t\tvalues: out,\n\t\t\t\t\tqueryKeys,\n\t\t\t\t\tsticky: this.singleEnumField != null,\n\t\t\t\t},\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** Required fields left empty, with the location trio collapsed to one entry per group. Seed and hidden defaults never block. */\n\tprivate collectMissing(): { keys: string[]; labels: string[] } {\n\t\tconst keys: string[] = [];\n\t\tconst labels: string[] = [];\n\t\tconst locGroups = new Set<string | undefined>();\n\t\tfor (const f of this.fields) {\n\t\t\tif (!f.required) continue;\n\t\t\tconst isLocation = this.roleOf(f) === 'location';\n\t\t\tif (!this.isRendered(f) && !isLocation) continue;\n\t\t\tconst v = this.values[f.key];\n\t\t\tif (v !== undefined && v !== '') continue;\n\t\t\tkeys.push(f.key);\n\t\t\tif (isLocation) {\n\t\t\t\tlocGroups.add(f.group);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// The group half translates and the field half cannot, which is not a\n\t\t\t// half-measure: this names a block the visitor has to go back to, so the word\n\t\t\t// in the message has to be the word printed on the fieldset legend. A message\n\t\t\t// saying `Person 1` over a legend reading `Persona 1` points at nothing.\n\t\t\tlabels.push(\n\t\t\t\tf.group\n\t\t\t\t\t? `${this.groupName(f.group)} ${this.fieldText(f.name)}`\n\t\t\t\t\t: this.fieldText(f.name),\n\t\t\t);\n\t\t}\n\t\tfor (const g of locGroups) {\n\t\t\tlabels.push(this.locationLabel(g));\n\t\t}\n\t\treturn { keys, labels };\n\t}\n\n\tprivate reqMark(f: FieldDef) {\n\t\treturn f.required\n\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t: nothing;\n\t}\n\n\t/** A description under a field: rendered inline when short, collapsed behind a disclosure showing its first line when long. */\n\tprivate description(f: FieldDef) {\n\t\tif (!f.description) return nothing;\n\t\tif (f.description.length <= 120) {\n\t\t\treturn html`<small class=\"help\">${f.description}</small>`;\n\t\t}\n\t\tconst lead = f.description.split('. ')[0] ?? f.description;\n\t\treturn html`<details class=\"help-details\"><summary><span class=\"help-lead\">${lead}</span>${chevron()}</summary><small class=\"help help-full\">${f.description}</small></details>`;\n\t}\n\n\tprivate renderTiles(f: FieldDef) {\n\t\tconst labelId = `roxy-form-${f.key}-label`;\n\t\tconst zodiac = !!f.enum && isZodiacEnum(f.enum);\n\t\tconst opts = f.enum ?? [];\n\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\tconst active = cur === -1 ? 0 : cur;\n\t\treturn html`<div class=\"field tiles-field\"><span class=\"label\" id=\"${labelId}\">${this.fieldText(f.name)}${this.reqMark(f)}</span><div class=\"tiles\" role=\"radiogroup\" aria-labelledby=\"${labelId}\" @keydown=\"${this.onTilesKeyDown(f)}\">${opts.map((opt, i) => {\n\t\t\t\t\tconst selected = this.values[f.key] === opt;\n\t\t\t\t\tconst glyph = zodiac ? signGlyph(opt) : undefined;\n\t\t\t\t\treturn html`<button type=\"button\" class=\"tile\" role=\"radio\" data-tile=\"${i}\" aria-checked=\"${selected ? 'true' : 'false'}\" tabindex=\"${i === active ? '0' : '-1'}\" @click=\"${() => this.selectTile(f, opt)}\">${\n\t\t\t\t\t\t\tglyph\n\t\t\t\t\t\t\t\t? html`<span class=\"tile-glyph\" aria-hidden=\"true\">${glyph}</span>`\n\t\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t\t} <span class=\"tile-label\">${this.optionText(f.name, opt)}</span></button>`;\n\t\t\t\t})}</div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderSelect(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${this.fieldText(f.name)}${this.reqMark(f)}</label> <select id=\"${id}\" ?required=\"${f.required}\" @change=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(f.key, (e.target as HTMLSelectElement).value)}\"><option value=\"\">${this.t('Choose')}</option>${(f.enum ?? []).map(\n\t\t\t\t\t(\n\t\t\t\t\t\topt,\n\t\t\t\t\t) => html`<option value=\"${opt}\" ?selected=\"${this.values[f.key] === opt}\">${this.optionText(f.name, opt)}</option>`,\n\t\t\t\t)}</select> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderToggle(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst checked = this.values[f.key] === true;\n\t\treturn html`<div class=\"field\"><div class=\"toggle-row\"><button type=\"button\" id=\"${id}\" class=\"toggle\" role=\"switch\" aria-checked=\"${checked ? 'true' : 'false'}\" @click=\"${() => this.setValue(f.key, !checked)}\"><span class=\"knob\"></span></button> <label class=\"toggle-label\" for=\"${id}\">${this.fieldText(f.name)}${this.reqMark(f)}</label></div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderInput(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst type =\n\t\t\tf.kind === 'datetime'\n\t\t\t\t? 'datetime-local'\n\t\t\t\t: f.kind === 'number'\n\t\t\t\t\t? 'number'\n\t\t\t\t\t: f.kind;\n\t\tconst placeholder =\n\t\t\tf.kind === 'array'\n\t\t\t\t? this.t('Comma separated')\n\t\t\t\t: f.example != null\n\t\t\t\t\t? String(f.example)\n\t\t\t\t\t: '';\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${this.fieldText(f.name)}${this.reqMark(f)}</label> <input id=\"${id}\" type=\"${f.kind === 'array' ? 'text' : type}\" ?required=\"${f.required}\" min=\"${ifDefined(f.min)}\" max=\"${ifDefined(f.max)}\" step=\"${f.kind === 'number' ? 'any' : nothing}\" placeholder=\"${placeholder || nothing}\" .value=\"${(this.values[f.key] ?? '') as string}\" @input=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tf.key,\n\t\t\t\t\t\tthis.coerce(f.kind, (e.target as HTMLInputElement).value),\n\t\t\t\t\t)}\"> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderField(f: FieldDef) {\n\t\tswitch (f.kind) {\n\t\t\tcase 'tiles':\n\t\t\t\treturn this.renderTiles(f);\n\t\t\tcase 'select':\n\t\t\t\treturn this.renderSelect(f);\n\t\t\tcase 'toggle':\n\t\t\t\treturn this.renderToggle(f);\n\t\t\tdefault:\n\t\t\t\treturn this.renderInput(f);\n\t\t}\n\t}\n\n\t/**\n\t * The fields this group's city search actually fills, named in the help text.\n\t *\n\t * Not the hardcoded \"latitude, longitude, timezone\" it used to say: a group does not always own a\n\t * timezone. `generateRelocationChart` has one top-level `timezone` that belongs to the birth\n\t * moment, so the relocation block fills coordinates only, and promising a timezone there would be\n\t * a visible lie on the one form that made this method necessary.\n\t */\n\tprivate locationFillList(group?: string): string {\n\t\tconst names = [...LOCATION_PAIR] as string[];\n\t\tif (this.timezoneFieldFor(group)) names.push('timezone');\n\t\treturn names.join(', ');\n\t}\n\n\t/**\n\t * The name of one request group, translated, falling back to the humanized English.\n\t *\n\t * @remarks\n\t * A group name is the one derived label that is also ENUMERABLE. A field label is `humanize()` over one of 909 spec field names, but a group is `humanize()` over the names an object-valued property or a coordinate prefix can take, and the whole spec has nine across 176 operations. So each is a catalogue entry, and the English token that used to sit inside translated prose (`Local de Natal Chart`, `\u041C\u0435\u0441\u0442\u043E (Birth Data)`) is gone. A tenth group appearing in the spec still renders: `t()` returns its source string on a miss, so it degrades to the humanized English rather than to a blank or a key.\n\t *\n\t * **The lookup folds case, and that is what makes `natalChart` work.** `humanize` produces `Natal Chart` while the catalogue carries `Natal chart` for the card heading, and {@link lookupKey} folds both to one key on write and on read, so this reuses the shipped translation. Adding the capitalized twin instead would SILENTLY OVERWRITE that heading in every locale rather than reading as a duplicate, which is why `i18n/chrome-strings.ts` carries no entry for it.\n\t */\n\tprivate groupName(group: string): string {\n\t\treturn this.t(humanize(group));\n\t}\n\n\t/**\n\t * The name of one location block, and of the same block in a validation message, which is why it is a method rather than two literals.\n\t *\n\t * The placeholder carries the group rather than the form concatenating a name in front of a translated noun, so a translator owns the word order: `Person 1 location` is English syntax, and Turkish suffixes the head noun, Hindi takes a genitive, Russian a parenthetical and German a colon. The four shapes are deliberately different and normalizing them breaks three languages.\n\t */\n\tprivate locationLabel(group?: string): string {\n\t\treturn group\n\t\t\t? this.t('{{group}} location', { group: this.groupName(group) })\n\t\t\t: this.t('Birth location');\n\t}\n\n\t/**\n\t * One city search standing in for a group's raw coordinates.\n\t *\n\t * `lang` is forwarded EXPLICITLY and that line is load-bearing: the city search lives inside this shadow root, and the `closest('[lang]')` link of the resolution chain stops at a shadow boundary, so without it the dropdown renders its own empty state and its refusal message in English on a fully translated page. The same trap is documented for every composing component in `docs/authoring.md`.\n\t */\n\tprivate locationBlock(group?: string) {\n\t\treturn html`<div class=\"location-block\"><label>${this.locationLabel(group)}${\n\t\t\t\t\tthis.locationRequired(group)\n\t\t\t\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</label><roxy-location-search publishable-key=\"${ifDefined(this.publishableKey)}\" lang=\"${ifDefined(this.effectiveLang())}\" @roxy-location-select=\"${this.onLocationFor(group)}\" placeholder=\"${\n\t\t\t\t\tgroup\n\t\t\t\t\t\t? this.t('{{group}} city', { group: this.groupName(group) })\n\t\t\t\t\t\t: this.t('City of birth')\n\t\t\t\t}\"></roxy-location-search><small class=\"help\">${this.t('Fills {{fields}}. Pick a city to autofill.', {\n\t\t\t\t\tfields: this.locationFillList(group),\n\t\t\t\t})}</small></div>`;\n\t}\n\n\tprivate groupCard(group: string) {\n\t\tconst fields = this.fields.filter(\n\t\t\t(f) => f.group === group && this.isRendered(f),\n\t\t);\n\t\treturn html`<fieldset class=\"person-group\"><legend>${this.groupName(group)}</legend>${this.groupHasLocation(group) ? this.locationBlock(group) : nothing}<div class=\"fields\">${fields.map((f) => this.renderField(f))}</div></fieldset>`;\n\t}\n\n\trender() {\n\t\tif (!this.loaded) {\n\t\t\treturn html`<form><div class=\"roxy-skeleton\" style=\"height:8rem\"></div></form>`;\n\t\t}\n\t\tif (this.specError) {\n\t\t\treturn html`<div class=\"spec-error\" role=\"alert\">${this.t('Schema load failed: {{message}}', { message: this.specError })} <button type=\"button\" class=\"submit\" @click=\"${this.retryLoadSchema}\">${this.t('Retry')}</button></div>`;\n\t\t}\n\n\t\tconst flat = this.fields.filter((f) => !f.group && this.isRendered(f));\n\t\tconst flatReq = flat.filter((f) => f.required);\n\t\tconst flatOpt = flat.filter((f) => !f.required);\n\t\tconst named = this.groupKeys().filter((g): g is string => g !== undefined);\n\t\tconst reqGroups = named.filter((g) => this.groupIsRequired(g));\n\t\tconst optGroups = named.filter((g) => !this.groupIsRequired(g));\n\t\tconst hasAdvanced = flatOpt.length > 0 || optGroups.length > 0;\n\n\t\treturn html`<form @submit=\"${this.onSubmit}\"><h2 class=\"title\">${this.formTitle}</h2>${\n\t\t\t\tthis.validationErrors.length > 0\n\t\t\t\t\t? html`<div class=\"validation-error\" role=\"alert\"><strong>${this.t('Please complete:')}</strong> ${this.validationErrors.join(', ')}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}<div class=\"fields\">${flatReq.map((f) => this.renderField(f))}</div>${this.groupHasLocation(undefined) ? this.locationBlock(undefined) : nothing} ${reqGroups.map((g) => this.groupCard(g))} ${\n\t\t\t\thasAdvanced\n\t\t\t\t\t? html`<details class=\"advanced\"><summary>${this.t('Advanced')}${chevron()}</summary><div class=\"fields\">${flatOpt.map((f) => this.renderField(f))}</div>${optGroups.map((g) => this.groupCard(g))}</details>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tthis.singleEnumField\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<button class=\"submit\" type=\"submit\">${this.effectiveSubmitLabel()}</button>`\n\t\t\t}</form>`;\n\t}\n\n\tprivate coerce(kind: string, v: string): unknown {\n\t\tif (v === '') return undefined;\n\t\tif (kind === 'number') {\n\t\t\tconst n = Number(v);\n\t\t\treturn Number.isFinite(n) ? n : undefined;\n\t\t}\n\t\treturn v;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-endpoint-form': RoxyEndpointForm;\n\t}\n}\n", "// Generated by scripts/sync-bindings.ts (the `lang` query enum in specs/openapi.json). Do not edit.\n\n/**\n * Every language tag the API accepts on `?lang=`.\n *\n * @remarks\n * A self-fetch resolves the site language from the DOM, which means ANY value a\n * host page happens to carry can reach the query string. The API rejects an\n * unlisted tag with a 400, so a page in a language we do not translate would\n * stop working the moment the language chain was completed. Membership is\n * checked against this list before `lang` is sent, and a miss simply omits the\n * parameter, leaving the endpoint on its English default.\n */\nexport const API_LANGUAGES: readonly string[] = [\"de\",\"en\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\"];\n", "/**\n * Where a component's language comes from, and what is safe to send to the API.\n *\n * @remarks\n * Two different answers, and conflating them is the whole reason this file is separate from the catalogue:\n *\n * - {@link resolveLang} answers \"what language is this PAGE in\", and keeps the full tag, because `es-AR` is a legitimate thing for a catalogue to want to differ on.\n * - {@link apiLang} answers \"what may go on the query string\", which is a narrower question with a hard edge: `?lang=es-AR` is a 400, `?lang=es` is a 200.\n *\n * The full tag is not a nicety the catalogue happens to tolerate: `utils/format.ts` hands it to `Intl`, which reads the region and writes `15 de ene de 1990` for `es-AR` where it writes `15 ene 1990` for `es`. Passing the API answer to a formatter demotes every regional visitor to the base language and nothing fails, so the two values are never interchangeable.\n */\n\nimport { API_LANGUAGES } from '../generated/api-languages.js';\n\n/**\n * The site-owner language for an element, resolved through the four-link chain the revamp design specifies.\n *\n * @remarks\n * 1. the element's own `lang` attribute (the explicit per-embed override),\n * 2. the nearest ancestor carrying `lang`, so one wrapper localizes a whole section,\n * 3. `document.documentElement.lang`, which is what makes this work on a real CMS with no markup change at all: WordPress emits `<html lang=\"es-AR\">` on every page of a Spanish site,\n * 4. nothing, which the callers read as English.\n *\n * Only link 1 used to be implemented, so a component on a fully Spanish page rendered English chrome and there was no way to fix it except hand-editing every embed.\n *\n * `navigator.language` is deliberately NOT in the chain. It is the VISITOR's preference, not the site's: it fragments the API cache across every locale a visitor might carry and silently serves two people different content from the same URL.\n *\n * Link 2 uses `closest`, which stops at a shadow boundary. A component composed INSIDE another component's shadow root therefore cannot see the host page, which is why every composing component forwards `lang` to its children explicitly.\n */\nexport function resolveLang(el: HTMLElement): string | undefined {\n\t// Native accessor, never a Lit @property: declaring one would shadow\n\t// HTMLElement.lang and break the platform attribute for every consumer.\n\tif (el.lang) return el.lang;\n\tif (typeof document === 'undefined') return undefined;\n\tconst inherited = el.closest?.('[lang]')?.getAttribute('lang');\n\tif (inherited) return inherited;\n\treturn document.documentElement.lang || undefined;\n}\n\n/**\n * The value safe to put on `?lang=`, or `undefined` to leave the request on the API default.\n *\n * @remarks\n * Two narrowings, both of which are load-bearing the moment {@link resolveLang} starts reading `<html lang>`:\n *\n * - **The region is dropped.** A regional tag is a 400, so a Spanish WordPress site would go from English-but-working to broken the day the language chain was completed. `es-AR`, `es-419` and `ES` all send `es`.\n * - **An unsupported language is omitted, not sent.** The chain now surfaces whatever the host page carries, including languages the API does not translate, and an unlisted tag is the same 400. Omitting it degrades to English, which is the behaviour those pages already had.\n */\nexport function apiLang(el: HTMLElement): string | undefined {\n\tconst tag = resolveLang(el);\n\tif (!tag) return undefined;\n\tconst base = tag.toLowerCase().split('-')[0] as string;\n\treturn API_LANGUAGES.includes(base) ? base : undefined;\n}\n", "import { LitElement } from 'lit';\nimport { resolveLang } from './lang.js';\nimport { LocaleController } from './locale-controller.js';\nimport { translate } from './registry.js';\n\n/**\n * The base every element that writes WORDS extends: it resolves the page language and translates its own chrome.\n *\n * @remarks\n * This is deliberately smaller than {@link RoxyDataElement}, and the split is what makes the widgets translatable at all. `<roxy-endpoint-form>` and `<roxy-location-search>` are the two declared widgets: they fetch, they hold state, and they are NOT data components, so they cannot inherit the data base without dragging its controlled-mode hydration, its self-fetch controller and its own form rendering (which renders the form, so the form inheriting it would compose itself). They extended `LitElement` directly instead, which meant they had no `t()` and no {@link LocaleController}, so a Spanish page rendered a Spanish result card over an English form and neither widget re-rendered when a deferred locale payload landed.\n *\n * So the mechanism lives here ONCE and all three inherit it. There is no second translator, no second registry and no second way to resolve a language: adding one is how a catalogue entry and a call site drift apart.\n *\n * Two costs are why this is its own module rather than a second export of `utils/base-element.ts`. Every `dist/cdn/components/*.js` is a self-contained IIFE, so importing the data base into the city search would compile `FetchController`, `MarkupDataController` and the interpretation accordion into a bundle that uses none of them. And `utils/base-element.ts` imports THIS file, so putting the class there would close a cycle the moment a widget imported it.\n */\nexport abstract class RoxyLocalizedElement extends LitElement {\n\tconstructor() {\n\t\tsuper();\n\t\t// Re-render if a chrome-string catalogue lands after this element upgraded.\n\t\t// A host page loads the payload as its own script tag, so it can arrive\n\t\t// after first paint and there is nothing the site owner could do about it.\n\t\tnew LocaleController(this);\n\t}\n\n\t/**\n\t * The chrome string for this element's language, keyed by its own English source text.\n\t *\n\t * @remarks\n\t * Pass the English copy, never a key. With no catalogue registered the source string is returned unchanged, so an English page pays nothing and a language we do not ship degrades to English rather than to a visible key.\n\t *\n\t * Chrome only. A value the API returned (a planet, a sign, an aspect, a house system) is NOT translated here: it is rendered as the response carries it, so the words on the chart and the words in the response can never disagree. The same holds for a label derived from a spec field NAME through `humanize()`: a catalogue keyed on English source text cannot reach a string computed per response. A derived name is catalogued only where the set it comes from is CLOSED and small enough to enumerate against the spec, which is true of the nine form group names and of nothing else so far.\n\t *\n\t * @example\n\t * ```ts\n\t * this.t('Aspect grid'); // 'Cuadricula de aspectos' under lang=\"es\"\n\t * this.t('{{count}} planets', { count: 12 }); // '12 planetas'\n\t * ```\n\t */\n\tprotected t(source: string, vars?: Record<string, string | number>): string {\n\t\treturn translate(this.effectiveLang(), source, vars);\n\t}\n\n\t/** {@link RoxyLocalizedElement.t} as a value, bound once, for a shared render helper that has no host of its own and therefore cannot resolve a page language (`utils/hd-reading.ts`). Named `translator` and not `translate` because `HTMLElement.translate` is a real DOM property and shadowing it with a protected member makes every `@customElement` decorator in the library fail to typecheck. */\n\tprotected readonly translator = (\n\t\tsource: string,\n\t\tvars?: Record<string, string | number>,\n\t): string => this.t(source, vars);\n\n\t/**\n\t * Site-owner language for this element: the `lang` attribute, the nearest ancestor carrying one, or the document. Protected so a component that composes another can forward it (a child inside this shadow root cannot reach the host page on its own).\n\t *\n\t * Full tag, region included. The truncation to what `?lang=` accepts happens where the request is built, in `<roxy-endpoint-form>`.\n\t */\n\tprotected effectiveLang(): string | undefined {\n\t\treturn resolveLang(this);\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 * - `lookupKey`: the ONE normalizer every lookup table in this library is keyed\n * and read by (`tokens/index.ts` glyphs and abbreviations, `i18n/` chrome\n * strings).\n * - `capitalize`: title-cases the first character, lowercases the rest. A\n * DISPLAY helper only; it is not a lookup key (see `lookupKey`).\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\n/**\n * Fold a name to the canonical key its lookup table is stored under: lower case, every run of spaces, underscores and hyphens collapsed to one space, trimmed.\n *\n * @remarks\n * This exists because a GUESSED key spelling is a defect class this repo has now shipped twice. The glyph tables were keyed off whatever {@link capitalize} happened to produce (`North node`), while the API returns `North Node`, so every call site that reached the table without first calling `capitalize` missed and fell through to a fabricated abbreviation. Aspects hit the same wall from the other side: `/aspects` returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`.\n *\n * One normalizer, applied when a table is DEFINED and again when it is READ, removes the whole class: no call site has to remember a convention, and no table has to guess a spelling. Use it for every new table keyed by an API-supplied name.\n *\n * @example\n * ```ts\n * lookupKey('North Node'); // 'north node'\n * lookupKey('SEMI_SEXTILE'); // 'semi sextile'\n * lookupKey('semi-sextile'); // 'semi sextile'\n * ```\n */\nexport function lookupKey(s: string): string {\n\treturn s\n\t\t.toLowerCase()\n\t\t.replace(/[\\s_-]+/g, ' ')\n\t\t.trim();\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 (\n\t\ts\n\t\t\t.replace(/[_-]+/g, ' ')\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t\t// Split a trailing/embedded digit off a word so \"person1\" reads \"Person 1\"\n\t\t\t// and every group legend and field label spaces its ordinal.\n\t\t\t.replace(/([a-z])([0-9])/g, '$1 $2')\n\t\t\t.replace(/^\\w/, (c) => c.toUpperCase())\n\t);\n}\n", "/**\n * The chrome-string catalogue: one resolver reading one registry, so a translation can arrive from anywhere without a component changing.\n *\n * @remarks\n * **The key IS the canonical English string**, folded through {@link lookupKey}. There is no invented key vocabulary to keep in sync with the copy, which is the same rule the glyph tables in `tokens/index.ts` follow (they key off the exact value the API returns). Two consequences that are the whole point:\n *\n * - **English costs zero bytes.** A miss returns the source string, so the English build ships no catalogue at all, and a site that never loads a locale payload is byte-identical to one built before this file existed.\n * - **A missing translation degrades to English, never to a key.** The failure mode of a keyed catalogue is a raw `natal.tabs.wheel` rendered at a customer; here the worst case is the English word.\n *\n * **The registry lives on `globalThis`, not in module scope, because it has to.** Every `dist/cdn/components/*.js` is a self-contained IIFE with its own copy of this module, so a `Map` here would be invisible to the second component on the page. One global object, written by the locale payload and read by every bundle, is what makes `dist/cdn/locales/es.js` a single download that translates all of them.\n *\n * Load order is not guaranteed on a real host (WordPress enqueues scripts in an order the plugin does not fully control, and a payload may be deferred), so {@link onLocaleChange} lets an element that has already rendered in English re-render when its catalogue lands.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Shared mutable state, addressed by a name rather than a module binding so every bundle on the page reaches the same object. */\ninterface LocaleRegistry {\n\t/** Language tag (lower case) to catalogue, keyed by {@link lookupKey} of the English source string. */\n\tcatalogs: Record<string, Record<string, string>>;\n\t/**\n\t * Language tag (lower case) to the API's field-label map: `fields` keyed by wire name,\n\t * `enums` keyed `{fieldName}.{value}`.\n\t *\n\t * A SEPARATE key space from `catalogs` on purpose. A chrome string is keyed by the English\n\t * text a component writes, which is a constant in our source; a field label is keyed by a\n\t * name that only the OpenAPI spec knows, computed per operation, so no catalogue keyed on\n\t * English source text can ever reach it. Same registry because the delivery problem is\n\t * identical (a payload that may land after first paint), so it reuses one global object and\n\t * one listener set rather than growing a second of each.\n\t */\n\tfieldLabels: Record<string, FieldLabels>;\n\t/** Language tags whose fetch is in flight or done, so N forms on a page cost ONE request. */\n\trequested: Set<string>;\n\t/** Elements waiting to re-render when a catalogue arrives. */\n\tlisteners: Set<() => void>;\n}\n\n/** The `/languages/field-labels` payload, minus the echoed `lang`. */\nexport interface FieldLabels {\n\tfields: Record<string, string>;\n\tenums: Record<string, string>;\n}\n\nconst GLOBAL_KEY = '__ROXY_UI_I18N__';\n\nfunction registry(): LocaleRegistry {\n\tconst holder = globalThis as unknown as Record<string, LocaleRegistry>;\n\tconst existing = holder[GLOBAL_KEY];\n\tif (existing) return existing;\n\tconst created: LocaleRegistry = {\n\t\tcatalogs: {},\n\t\tfieldLabels: {},\n\t\trequested: new Set(),\n\t\tlisteners: new Set(),\n\t};\n\tholder[GLOBAL_KEY] = created;\n\treturn created;\n}\n\n/**\n * Publish a catalogue for a language tag and wake every mounted element.\n *\n * @remarks\n * The catalogue is authored keyed by the English source string, exactly as it appears at the call site, and normalized here. That keeps the source file readable and diffable against the component that renders it, while the runtime lookup stays a single property read.\n *\n * This is the ONLY way into the registry, so a catalogue can later come from a static file, a server response, or a host page inlining a script tag, without a component knowing the difference.\n */\nexport function registerLocale(\n\tlang: string,\n\tcatalog: Record<string, string>,\n): void {\n\tconst reg = registry();\n\tconst normalized: Record<string, string> = {};\n\tfor (const [source, translated] of Object.entries(catalog)) {\n\t\tnormalized[lookupKey(source)] = translated;\n\t}\n\treg.catalogs[lang.toLowerCase()] = normalized;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/**\n * Replace `{{name}}` placeholders. Copied from the API-side translator so both sides of the product interpolate identically; an unknown placeholder is left verbatim rather than blanked, so a typo in a catalogue is visible instead of silently eating the value.\n */\nexport function interpolate(\n\ttemplate: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!vars) return template;\n\treturn template.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) =>\n\t\tkey in vars ? String(vars[key] ?? '') : match,\n\t);\n}\n\n/**\n * The chrome string for `lang`, falling back to the English `source` it is keyed by.\n *\n * @remarks\n * A regional tag resolves against its base language, so `es-AR` and `es-419` both read the `es` catalogue and a site does not have to know which tags we happen to ship. An exact regional catalogue still wins if one is ever registered.\n */\nexport function translate(\n\tlang: string | undefined,\n\tsource: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!lang) return interpolate(source, vars);\n\tconst { catalogs } = registry();\n\tconst tag = lang.toLowerCase();\n\tconst catalog = catalogs[tag] ?? catalogs[tag.split('-')[0] as string];\n\treturn interpolate(catalog?.[lookupKey(source)] ?? source, vars);\n}\n\n/**\n * Publish a field-label map for a language tag and wake every mounted element.\n *\n * @remarks\n * Exported so a host that already has the payload (a server-rendered page, a test, a WordPress\n * plugin inlining it) can supply it without a network call, exactly as {@link registerLocale}\n * allows for chrome strings.\n */\nexport function registerFieldLabels(lang: string, labels: FieldLabels): void {\n\tconst reg = registry();\n\treg.fieldLabels[lang.toLowerCase()] = labels;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/** The field-label map for `lang`, resolving a regional tag against its base language. */\nfunction labelsFor(lang: string | undefined): FieldLabels | undefined {\n\tif (!lang) return undefined;\n\tconst { fieldLabels } = registry();\n\tconst tag = lang.toLowerCase();\n\treturn fieldLabels[tag] ?? fieldLabels[tag.split('-')[0] as string];\n}\n\n/**\n * The label for a request field name, or `undefined` when nothing has been published.\n *\n * @remarks\n * Returning `undefined` rather than the name is deliberate: the caller owns the fallback, which is\n * `humanize()`, and that keeps this resolver honest about what it actually knows. A form renders\n * identically to before until a payload arrives.\n */\nexport function fieldLabel(\n\tlang: string | undefined,\n\tname: string,\n): string | undefined {\n\treturn labelsFor(lang)?.fields[name];\n}\n\n/** The label for one selectable option, keyed `{fieldName}.{value}` as the API publishes it. */\nexport function optionLabel(\n\tlang: string | undefined,\n\tfield: string,\n\tvalue: string,\n): string | undefined {\n\treturn labelsFor(lang)?.enums[`${field}.${value}`];\n}\n\n/** Subscribe to catalogue arrivals. Returns the unsubscribe, so an element can drop it on disconnect. */\nexport function onLocaleChange(listener: () => void): () => void {\n\tconst { listeners } = registry();\n\tlisteners.add(listener);\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t};\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport { onLocaleChange } from './registry.js';\n\n/**\n * Re-renders its host when a chrome-string catalogue arrives.\n *\n * @remarks\n * Without this the catalogue would have to be on the page BEFORE the elements upgrade, which is not something a component can require of a real host. WordPress orders enqueued scripts by dependency and a site owner can add `defer` to any of them; a CDN embed is two independent `<script src>` tags. Any of those can land the locale payload after the first paint, and the visible result would be a chart that renders in English on a Spanish page for no reason the site owner can see or fix.\n *\n * Mirrors `MarkupDataController`: constructed in {@link RoxyDataElement}'s constructor, subscribes on connect, drops the subscription on disconnect. Registration is idempotent and a re-register of the same language simply re-renders, so a payload loaded twice is harmless.\n */\nexport class LocaleController implements ReactiveController {\n\tprivate readonly host: ReactiveControllerHost;\n\tprivate unsubscribe?: () => void;\n\n\tconstructor(host: ReactiveControllerHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected(): void {\n\t\tthis.unsubscribe = onLocaleChange(() => this.host.requestUpdate());\n\t}\n\n\thostDisconnected(): void {\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\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 * @remarks\n * **Every table here is keyed by {@link lookupKey} and read ONLY through the accessor beside it.** The raw records are deliberately not exported: a component that indexes a record directly has to guess the key convention, and a guessed spelling is what shipped `No North Node R`, `So South Node R` and `Bl Black Moon Lilith` into a live customer's natal chart. The API returns `North Node` with a space; the table was keyed `North node`, the spelling {@link capitalize} happens to produce, so every call site that forgot to call `capitalize` first missed the table.\n *\n * **A miss returns `undefined`, never a manufactured abbreviation.** The old `?? name.slice(0, 2)` fallback is what made the defect survive review: a failed lookup renders as a plausible two-letter code that reads exactly like an intentional abbreviation, so nothing about the output says \"this is broken\". A caller that can omit the glyph should omit it (`?? ''`); a caller that must show something falls back to the FULL name, which is visibly wrong at the size these slots are drawn.\n *\n * `tests/tokens.test.ts` resolves every body, sign and aspect name the committed spec can emit against these tables, so a vocabulary the API gains cannot ship unglyphed.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Look one name up in a normalized table. The single read path for every map in this file. */\nconst resolve = (\n\ttable: Record<string, string>,\n\tname: string | undefined | null,\n): string | undefined => (name ? table[lookupKey(name)] : undefined);\n\nconst 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\t'north node': '\u260A',\n\t'south node': '\u260B',\n\tchiron: '\u26B7',\n\tlilith: '\u26B8',\n\t'black moon lilith': '\u26B8',\n};\n\n/** Astrological glyph for a planet or point, or `undefined` when the library has none for it. */\nexport const planetGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_GLYPH, name);\n\nconst 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\n/** Two-letter graha code for the tight cells of a North/South Indian kundli, or `undefined`. */\nexport const planetAbbr = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_ABBR, name);\n\nconst 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\n/** Zodiac glyph for a sign name in any case, or `undefined`. */\nexport const signGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(SIGN_GLYPH, name);\n\nconst 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\n/** Two-letter rashi code for kundli cells and grid headers, or `undefined`. */\nexport const signAbbr = (name: string | undefined | null): string | undefined =>\n\tresolve(SIGN_ABBR, name);\n\n/** The twelve signs in zodiacal order. Display values, not lookup keys: read them through {@link signGlyph} / {@link signAbbr}. */\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 * Glyph per aspect. Used by the natal, transit and synastry aspect tables.\n *\n * @remarks\n * These are the nine aspects Unicode itself defines as a set, in its Miscellaneous Symbols block note: `260C, 26BA, 2220, 26B9, 25A1, 25B3, 26BC, 26BB, 260D` for 0, 30, 45, 60, 90, 120, 135, 150 and 180 degrees. That is exactly the vocabulary the API returns, so every aspect resolves to a real glyph and none falls through to a truncated slug.\n *\n * Do not substitute the visually similar maths operators. Unicode lists `\u22BB` XOR and `\u22BC` NAND as cross-references FROM the real quincunx and semisextile glyphs, so they look like safe stand-ins and are easy to pair the wrong way round, which renders a 150 degree quincunx with the 30 degree semisextile symbol. An astrologer reads the glyph, not the tooltip.\n */\nconst ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\tsemisextile: '\u26BA',\n\t'semi sextile': '\u26BA',\n\tsemisquare: '\u2220',\n\t'semi square': '\u2220',\n\tsextile: '\u26B9',\n\tsquare: '\u25A1',\n\ttrine: '\u25B3',\n\tsesquiquadrate: '\u26BC',\n\tquincunx: '\u26BB',\n\topposition: '\u260D',\n};\n\n/** Aspect glyph for any of the separator forms the endpoints use (`SEMI_SEXTILE`, `SEMI SEXTILE`, `semi-sextile`), or `undefined`. */\nexport const aspectSymbol = (\n\tname: string | undefined | null,\n): string | undefined => resolve(ASPECT_SYMBOL, name);\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nconst 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};\n\n/** Trigram glyph for a trigram name in any case, or `undefined`. */\nexport const trigramGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(TRIGRAM_GLYPH, name);\n\n/** Moon phase emoji set. Used by the moon phase card. */\nconst 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\n/**\n * Emoji for a lunar phase, or `undefined`.\n *\n * @remarks\n * The live API suffixes most phase names (`Waxing Gibbous Moon`) and calls the third quarter `Third Quarter Moon`, while only new and full moon carry the suffix in the table. Both reconciliations live here rather than in the card, so any component reading a phase name resolves the same eight phases from the same four spellings.\n */\nexport const moonPhaseEmoji = (\n\tname: string | undefined | null,\n): string | undefined => {\n\tif (!name) return undefined;\n\tconst key = lookupKey(name);\n\tconst bare = key.replace(/ moon$/, '');\n\tconst alias = bare === 'third quarter' ? 'last quarter' : bare;\n\treturn MOON_PHASE_EMOJI[key] ?? MOON_PHASE_EMOJI[alias];\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}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif))}@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-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { TemplateResult } from 'lit';\nimport { css, html } from 'lit';\n\n/**\n * Disclosure chevron for `<details>`/`<summary>` accordions. Replaces the\n * browser default triangle with a thin chevron that rotates when the host\n * `<details>` opens. Render it inside the `<summary>` and pair with\n * {@link disclosureStyles}.\n */\nexport function chevron(): TemplateResult {\n\treturn html`<svg class=\"roxy-chevron\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\"><path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n}\n\n/**\n * Shared `<details>` accordion styling: hides the native disclosure triangle\n * and rotates the {@link chevron} 180 degrees when the accordion is open.\n * Import into any component that renders disclosure accordions so the chevron\n * looks and behaves identically.\n */\nexport const disclosureStyles = css`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;\n", "/**\n * Pure, framework-free schema layer shared by the self-fetch form. It turns one OpenAPI operation into a digested list of {@link FieldDef}s whose {@link InputKind} decides which input widget renders, with zero Lit or DOM dependency so the build-time slice generator ({@link ../../../scripts/build-schemas.ts}) and the taxonomy-coverage test consume the exact same classification the browser does.\n *\n * @remarks\n * The registry is by SHAPE, never by name: {@link classifyInput} inspects `enum` / `type` / `format` only, so a new API parameter gets a working widget with no code change, and the taxonomy gate fails loudly (via a `null` return) the day a genuinely new shape appears. Name-driven behaviour (suppressing `lang`, hiding `seed` / `limit` / `offset`, replacing the latitude+longitude+timezone trio with a city search) is a separate render-time concern layered on top by the form, never encoded here.\n */\n\nimport { SIGNS_ORDER } from '../tokens/index.js';\nimport { humanize } from './string.js';\n\n/** A JSON `$ref` node, before resolution against `components.schemas`. */\nexport interface OpenApiSchemaRef {\n\t$ref?: string;\n}\n\n/** The subset of an OpenAPI 3 schema object the form reads. */\nexport interface OpenApiSchema extends OpenApiSchemaRef {\n\t/** A plain name in 3.0, or an ARRAY in 3.1 where nullability is spelled `['number', 'null']`. Read it through {@link scalarType}, never compare it directly. */\n\ttype?: string | string[];\n\tformat?: string;\n\tdescription?: string;\n\tenum?: string[];\n\tdefault?: unknown;\n\tminimum?: number;\n\tmaximum?: number;\n\tproperties?: Record<string, OpenApiSchema>;\n\trequired?: string[];\n\titems?: OpenApiSchema;\n\texample?: unknown;\n\tanyOf?: OpenApiSchema[];\n\toneOf?: OpenApiSchema[];\n}\n\n/** One operation's request shape, as read from `spec.paths[path][method]`. */\nexport interface OperationSchema {\n\tsummary?: string;\n\trequestBody?: {\n\t\tcontent?: Record<string, { schema?: OpenApiSchema | OpenApiSchemaRef }>;\n\t};\n\tparameters?: Array<{\n\t\tname: string;\n\t\tin: string;\n\t\trequired?: boolean;\n\t\tschema?: OpenApiSchema;\n\t}>;\n}\n\n/** The minimal OpenAPI document surface the form introspects. */\nexport interface OpenApiDoc {\n\tpaths?: Record<string, Record<string, unknown>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/** The fully typed spec document the build-time scripts read from the committed `specs/openapi.json`: every path item value is an {@link OperationSchema}. The runtime form keeps the looser {@link OpenApiDoc} because a live spec fetch is untrusted input it narrows per operation. */\nexport interface SpecDoc {\n\tpaths: Record<string, Record<string, OperationSchema>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/**\n * The widget kind a parameter resolves to. This is the closed set the taxonomy gate enforces: every request parameter in the spec MUST classify to one of these, or {@link classifyInput} returns `null` and the gate fails, forcing a conscious decision when the API grows a new shape.\n */\nexport type InputKind =\n\t| 'tiles'\n\t| 'select'\n\t| 'toggle'\n\t| 'date'\n\t| 'time'\n\t| 'datetime'\n\t| 'number'\n\t| 'text'\n\t| 'array';\n\n/** A single input the form renders, digested from one schema property or parameter. */\nexport interface FieldDef {\n\t/** Unique storage + input key: the property name, or \"group.name\" for a nested object field. */\n\tkey: string;\n\t/** Schema property name (the label source), e.g. \"date\". */\n\tname: string;\n\t/** Parent object key for a nested schema (person1/person2); undefined for a flat field. */\n\tgroup?: string;\n\t/** True when the spec declares the field as `in: query`, so it belongs in the query string even on a POST. */\n\tinQuery?: boolean;\n\t/** The resolved widget kind. */\n\tkind: InputKind;\n\trequired: boolean;\n\tdescription?: string;\n\tenum?: string[];\n\tmin?: number;\n\tmax?: number;\n\tdefault?: unknown;\n\t/** Spec `example`, used as the placeholder for a text input. */\n\texample?: unknown;\n}\n\n/** The digested form model for one operation. The build-time slice is exactly this shape. */\nexport interface FormModel {\n\t/** Concise heading derived from the operation summary, falling back to the path. */\n\ttitle: string;\n\t/** Every rendered field. The `lang` query parameter is intentionally excluded (routed via the element `lang` attribute instead). */\n\tfields: FieldDef[];\n\t/** True when the operation carries a `lang` query parameter, so the form knows to route an effective language to the query string on submit. */\n\thasLang: boolean;\n}\n\n/** At most this many enum options render as a tile/chip picker; above it a filterable select is used instead. */\nexport const TILE_MAX = 12;\n\n/** The latitude+longitude+timezone trio the form suppresses in favour of a city search. Centralised so the render path and tests agree. */\nexport const LOCATION_TRIO = ['latitude', 'longitude', 'timezone'] as const;\n\n/**\n * The coordinate pair that DEFINES a location group. `timezone` is deliberately absent.\n *\n * @remarks\n * A group qualifies for a city search on latitude+longitude alone, because a timezone is not always\n * part of the group that owns the coordinates: `generateRelocationChart` carries two coordinate\n * pairs and exactly ONE top-level `timezone`, which is the BIRTH timezone (relocating does not move\n * the birth moment), so the relocation pair correctly has no timezone of its own. Requiring all\n * three would leave that operation rendering raw number inputs, which is the bug this exists to\n * prevent.\n */\nexport const LOCATION_PAIR = ['latitude', 'longitude'] as const;\n\n/**\n * Split a flat coordinate property into its group prefix and canonical leaf name, or `null` when the\n * name is not a prefixed coordinate.\n *\n * @remarks\n * **Two shapes carry two locations in one request and this handles the second one.** Most\n * multi-location operations nest per person (`person1`/`person2`, `personA`/`personB`), so object\n * nesting alone already groups them. `generateRelocationChart` is the only operation in the spec\n * that instead puts both pairs at the TOP level and distinguishes them by a name prefix\n * (`birthLatitude` / `relocationLatitude`). Keying the grouping off the prefix as well as off the\n * nesting means both shapes converge on the same group machinery, and a future `partnerLatitude`\n * needs no code change.\n *\n * Matching is deliberately restricted to the coordinate pair. A prefix is NOT harvested from any\n * other field name, so `birthDate` stays an ordinary field in the flat group and does not invent a\n * phantom `birth` group with a lone date in it.\n */\nexport function splitCoordinateName(\n\tname: string,\n): { group: string; leaf: (typeof LOCATION_PAIR)[number] } | null {\n\tconst m = name.match(/^(.+?)(Latitude|Longitude)$/);\n\tif (!m) return null;\n\treturn {\n\t\tgroup: m[1],\n\t\tleaf: m[2].toLowerCase() as (typeof LOCATION_PAIR)[number],\n\t};\n}\n\n/** Canonical lowercase zodiac set, derived from {@link SIGNS_ORDER} so sign detection and the glyph map can never disagree. */\nconst ZODIAC_LOWER = SIGNS_ORDER.map((s) => s.toLowerCase());\n\n/** Resolve a `$ref` (one hop is all the spec uses) against the schema map; pass non-refs through. */\nexport function resolveSchema(\n\tschema: OpenApiSchema | OpenApiSchemaRef | undefined,\n\tall: Record<string, OpenApiSchema>,\n): OpenApiSchema | undefined {\n\tif (!schema) return undefined;\n\tif ('$ref' in schema && schema.$ref) {\n\t\tconst name = schema.$ref.split('/').pop();\n\t\treturn name ? all[name] : undefined;\n\t}\n\treturn schema as OpenApiSchema;\n}\n\n/**\n * Collapse an `anyOf`/`oneOf` union to the single member that decides the widget: an enum member wins (so `houseSystem` as enum-or-string renders as a picker), then any concrete-typed member (so timezone as number-or-string resolves to a real kind), else the first member. Non-union schemas pass through untouched.\n */\nfunction representative(s: OpenApiSchema): OpenApiSchema {\n\tconst union = s.anyOf ?? s.oneOf;\n\tif (!union || union.length === 0) return s;\n\treturn (\n\t\tunion.find((m) => Array.isArray(m.enum)) ??\n\t\tunion.find((m) => scalarType(m) && scalarType(m) !== 'null') ??\n\t\tunion[0] ??\n\t\ts\n\t);\n}\n\n/**\n * Map one resolved schema to its {@link InputKind}, or `null` when the shape is genuinely unhandled. The form treats `null` as a plain text fallback (never crashes); the taxonomy gate treats it as a failure (forces a decision). Object schemas are never passed here: an object with `properties` expands into a group of leaf fields upstream, so it has no leaf kind of its own.\n */\n/**\n * The single scalar type name a schema resolves to, across both OpenAPI spellings.\n *\n * @remarks\n * OpenAPI 3.1 expresses a nullable scalar as `type: ['number', 'null']` where 3.0 wrote `type: 'number', nullable: true`. Every direct `type === 'number'` comparison silently stops matching the day the served document switches, and the field then classifies as UNHANDLED rather than as a number, which is how a whole form degrades to text boxes without one test noticing. The `null` member carries no input information, so the remaining single member IS the type.\n */\nexport function scalarType(s: OpenApiSchema): string | undefined {\n\tif (typeof s.type === 'string') return s.type;\n\tif (!Array.isArray(s.type)) return undefined;\n\tconst real = s.type.filter((t) => t !== 'null');\n\treturn real.length === 1 ? real[0] : undefined;\n}\n\nexport function classifyInput(schema: OpenApiSchema): InputKind | null {\n\tconst s = representative(schema);\n\tconst type = scalarType(s);\n\tif (Array.isArray(s.enum))\n\t\treturn s.enum.length <= TILE_MAX ? 'tiles' : 'select';\n\tif (type === 'boolean') return 'toggle';\n\tif (s.format === 'date') return 'date';\n\tif (s.format === 'time') return 'time';\n\tif (s.format === 'date-time') return 'datetime';\n\tif (type === 'integer' || type === 'number') return 'number';\n\tif (type === 'string') return 'text';\n\tif (type === 'array') return 'array';\n\treturn null;\n}\n\n/** True when an enum's values are exactly the twelve zodiac signs (case-insensitive), so the tiles can carry sign glyphs. */\nexport function isZodiacEnum(values: readonly string[]): boolean {\n\tif (values.length !== 12) return false;\n\tconst lower = new Set(values.map((v) => v.toLowerCase()));\n\treturn ZODIAC_LOWER.every((s) => lower.has(s));\n}\n\n/** One digested leaf field from a resolved schema. Shared by the flat and grouped construction paths so params and body props carry identical metadata (min/max included). */\nfunction toField(\n\tname: string,\n\tresolved: OpenApiSchema,\n\topts: { key: string; group?: string; required: boolean; inQuery?: boolean },\n): FieldDef {\n\tconst rep = representative(resolved);\n\treturn {\n\t\tkey: opts.key,\n\t\tname,\n\t\tgroup: opts.group,\n\t\tinQuery: opts.inQuery,\n\t\tkind: classifyInput(resolved) ?? 'text',\n\t\trequired: opts.required,\n\t\tdescription: rep.description ?? resolved.description,\n\t\tenum: rep.enum,\n\t\tmin: rep.minimum,\n\t\tmax: rep.maximum,\n\t\tdefault: resolved.default ?? rep.default,\n\t\texample: resolved.example ?? rep.example,\n\t};\n}\n\n/**\n * Digest one operation into the {@link FormModel} the form renders. This is the single construction path: body properties (nested objects expand to `group.sub` keys) and path+query parameters flow through {@link toField} identically, so a query integer keeps its min/max the same as a body integer. The `lang` query parameter is dropped from `fields` and surfaced as {@link FormModel.hasLang} instead.\n */\nexport function buildFormModel(\n\top: OperationSchema,\n\tschemas: Record<string, OpenApiSchema>,\n\tendpoint: string,\n): FormModel {\n\tconst fields: FieldDef[] = [];\n\tlet hasLang = false;\n\n\tconst bodyRef = op.requestBody?.content?.['application/json']?.schema;\n\tconst bodySchema = resolveSchema(bodyRef, schemas);\n\tif (bodySchema?.properties) {\n\t\tconst required = new Set(bodySchema.required ?? []);\n\t\tfor (const [name, sub] of Object.entries(bodySchema.properties)) {\n\t\t\tconst resolved = resolveSchema(sub, schemas) ?? {};\n\t\t\tif (resolved.type === 'object' && resolved.properties) {\n\t\t\t\tconst subRequired = new Set(resolved.required ?? []);\n\t\t\t\tfor (const [subName, subSchema] of Object.entries(\n\t\t\t\t\tresolved.properties,\n\t\t\t\t)) {\n\t\t\t\t\tconst r = resolveSchema(subSchema, schemas) ?? {};\n\t\t\t\t\tfields.push(\n\t\t\t\t\t\ttoField(subName, r, {\n\t\t\t\t\t\t\tkey: `${name}.${subName}`,\n\t\t\t\t\t\t\tgroup: name,\n\t\t\t\t\t\t\trequired: required.has(name) && subRequired.has(subName),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// A prefixed coordinate joins a group named after its prefix and reports the\n\t\t\t\t// canonical leaf name, so the trio logic and the city search match it unchanged.\n\t\t\t\t// `key` stays the ORIGINAL property name because it is the storage and wire\n\t\t\t\t// identity: rewriting it to `birth.latitude` would serialise a body the API\n\t\t\t\t// rejects.\n\t\t\t\tconst coord = splitCoordinateName(name);\n\t\t\t\tfields.push(\n\t\t\t\t\tcoord\n\t\t\t\t\t\t? toField(coord.leaf, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\tgroup: coord.group,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: toField(name, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const param of op.parameters ?? []) {\n\t\tif (param.in !== 'path' && param.in !== 'query') continue;\n\t\t// lang is site-owner chrome, not a visitor field: route it through the\n\t\t// element `lang` attribute, never render it in the form.\n\t\tif (param.name === 'lang' && param.in === 'query') {\n\t\t\thasLang = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst resolved = resolveSchema(param.schema, schemas) ?? {};\n\t\tfields.push(\n\t\t\ttoField(param.name, resolved, {\n\t\t\t\tkey: param.name,\n\t\t\t\trequired: !!param.required,\n\t\t\t\tinQuery: param.in === 'query',\n\t\t\t}),\n\t\t);\n\t}\n\n\treturn { title: deriveTitle(op.summary, endpoint), fields, hasLang };\n}\n\n/**\n * Concise form heading. Prefers the operation summary (spec-authored), taking the clause before the first \" - \" so \"Daily horoscope by zodiac sign - Transit-based forecast\" reads as \"Daily horoscope by zodiac sign\", and falls back to the humanized last path segment.\n */\nexport function deriveTitle(\n\tsummary: string | undefined,\n\tendpoint: string,\n): string {\n\tconst lead = summary?.split(' - ')[0]?.trim();\n\tif (lead) return lead;\n\treturn humanize(endpoint.split('/').pop() ?? '');\n}\n\n/**\n * Outcome-first submit-button label keyed off the endpoint intent. Chart and reading endpoints \"Generate\", divination endpoints \"Cast\", comparison endpoints \"Compare\", and lookup/reading GETs \"Get reading\". A generic verb beats a bare \"Submit\" on a widget a visitor never set up.\n *\n * Returns the CANONICAL English verb, which is also its catalogue key: the form translates the result rather than this function doing it, because this module is request-context-free and has no element to resolve a page language from. All four verbs live in `i18n/chrome-strings.ts`, and `tests/i18n.test.ts` runs this function over every operation in the committed spec so a fifth verb cannot be added without a catalogue entry.\n */\nexport function deriveSubmitLabel(endpoint: string): string {\n\tconst e = endpoint.toLowerCase();\n\tif (/compat|synastry|guna|connection|penta|composite/.test(e))\n\t\treturn 'Compare';\n\tif (/\\bcast\\b|\\/draw|iching|hexagram|tarot/.test(e)) return 'Cast';\n\tif (/horoscope|dream|angel|nakshatra|crystal|meaning|reference/.test(e))\n\t\treturn 'Get reading';\n\treturn 'Generate';\n}\n\n/** Deterministic slice filename for one operation, shared by the generator and the runtime loader so both address the same artifact. */\nexport function sliceFileName(method: string, endpoint: string): string {\n\tconst path = endpoint\n\t\t.replace(/^\\//, '')\n\t\t.replace(/[{}]/g, '')\n\t\t.replace(/\\//g, '-');\n\treturn `${method.toLowerCase()}--${path}.json`;\n}\n", "// Generated by scripts/sync-version.ts. Do not edit.\nexport const ROXY_UI_VERSION = '0.27.5';\n"],
4
+ "sourcesContent": ["import { css, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { apiLang } from '../i18n/lang.js';\nimport { RoxyLocalizedElement } from '../i18n/localized-element.js';\nimport { fieldLabel, optionLabel } from '../i18n/registry.js';\nimport { signGlyph } from '../tokens/index.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { chevron, disclosureStyles } from '../utils/disclosure.js';\nimport {\n\tbuildFormModel,\n\tderiveSubmitLabel,\n\ttype FieldDef,\n\ttype FormModel,\n\tisZodiacEnum,\n\tLOCATION_PAIR,\n\tLOCATION_TRIO,\n\ttype OpenApiDoc,\n\ttype OperationSchema,\n\tsliceFileName,\n} from '../utils/field-schema.js';\nimport { humanize } from '../utils/string.js';\nimport { ROXY_UI_VERSION } from '../version.js';\n\n/** Production spec, fetched when no slice is available and no explicit `spec-url` is set. */\nconst PROD_SPEC_URL = 'https://roxyapi.com/api/v2/openapi.json';\n\n/** Version-pinned jsDelivr base for the digested per-operation schema slices, mirroring the wrapper CDN pinning so a slice matches the bundle it ships beside. */\nconst SLICE_BASE = `https://cdn.jsdelivr.net/npm/@roxyapi/ui@${ROXY_UI_VERSION}/dist/schemas`;\n\nconst specCache = new Map<string, Promise<OpenApiDoc>>();\n\n/**\n * A spec fetch that came back with a non-2xx status, carrying the STATUS rather than a sentence.\n *\n * @remarks\n * The visible wording is composed by the element, in the element's language, and never here: {@link loadSpec} shares one cached promise across every form on the page, so a message built at throw time would freeze the first mounter's language onto every later one. Same split as everywhere else in this library, the machine value travels and the display copy is made where the reader is.\n */\nclass SpecHttpError extends Error {\n\tconstructor(readonly status: number) {\n\t\tsuper(`HTTP ${status}`);\n\t}\n}\n\n/** The endpoint is absent from the document that was loaded. Carries the two parts the message names, for the reason {@link SpecHttpError} gives. */\nclass SpecMissingOperationError extends Error {\n\tconstructor(\n\t\treadonly method: string,\n\t\treadonly path: string,\n\t) {\n\t\tsuper(`Endpoint ${method} ${path} not found in OpenAPI spec`);\n\t}\n}\n\n/**\n * Drop every cached spec promise.\n\n * @remarks\n * Test-only, and deliberately NOT re-exported from the package entry. The cache is module state shared by every test file in a single `bun test` process, and it only self-evicts on rejection, so one file that resolves a spec leaves a warm entry that silently satisfies a later file assertion about fetching. That made slice-fallback coverage pass or fail purely on file order.\n\n * @internal\n */\nexport function resetSpecCache(): void {\n\tspecCache.clear();\n}\n\nasync function loadSpec(url: string): Promise<OpenApiDoc> {\n\tlet pending = specCache.get(url);\n\tif (!pending) {\n\t\tpending = fetch(url)\n\t\t\t.then(async (res) => {\n\t\t\t\tif (!res.ok) throw new SpecHttpError(res.status);\n\t\t\t\treturn (await res.json()) as OpenApiDoc;\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\t// Evict the rejected promise BEFORE rethrowing so subsequent\n\t\t\t\t// callers (the user clicking Retry, a remount) hit the network\n\t\t\t\t// again instead of replaying the cached failure forever.\n\t\t\t\tspecCache.delete(url);\n\t\t\t\tthrow err;\n\t\t\t});\n\t\tspecCache.set(url, pending);\n\t}\n\treturn pending;\n}\n\n/** A fresh seed for a hidden `seed` field, so each submit is a new draw unless the caller pinned one. */\nfunction randomSeed(): string {\n\treturn (\n\t\tglobalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2)\n\t);\n}\n\n/** Parse an array-field text value into a real array: JSON when it parses to one, else comma-separated tokens. */\nfunction parseArrayValue(raw: string): unknown {\n\tconst trimmed = raw.trim();\n\tif (!trimmed) return [];\n\ttry {\n\t\tconst parsed = JSON.parse(trimmed);\n\t\tif (Array.isArray(parsed)) return parsed;\n\t} catch {\n\t\t// Not JSON: fall through to comma splitting.\n\t}\n\treturn trimmed\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean);\n}\n\n/**\n * Schema-driven form. Pass `endpoint` (e.g. \"vedic-astrology/birth-chart\"). The form digests the operation's request schema into a spec-derived input for each parameter (a zodiac tile grid, a date or time input, a city search, a toggle) with progressive disclosure, and emits a `roxy-submit` CustomEvent carrying the validated payload. The caller decides what to do (call the SDK, render a chart, navigate).\n *\n * @remarks\n * Schema resolution order: an explicit `spec-url` fetches that full spec and digests it (unchanged, the demo path); otherwise the form tries a small version-pinned per-operation slice from the CDN, and on any miss falls back to fetching the production spec. Each input kind is chosen purely from the parameter shape (see {@link ../utils/field-schema.ts}), so a new endpoint gets a working, on-brand form with no per-endpoint code.\n *\n * The visitor-facing `lang` parameter is never rendered: a site owner sets the element `lang` attribute, and the form routes it to the query string on submit. Optional parameters collapse under one Advanced disclosure; a form whose only required field is an enum submits on selection.\n *\n * **Two languages are in play here and they are different answers.** {@link RoxyLocalizedElement.effectiveLang} is the DISPLAY tag, region included, and it is what every `t()` call and the city search read. {@link RoxyEndpointForm.requestLang} is the WIRE value, region stripped and unsupported languages omitted, and it is what reaches `?lang=`. Swapping them is silent in both directions: the request one demotes every regional visitor, and the display one is a 400.\n *\n * **Field labels and option text ARE translated now, and they arrive over the network rather than from a catalogue.** They are keyed by the WIRE NAME the spec uses, not by the English text, because that English text is itself computed here by `humanize()`: there is no constant for a source-keyed catalogue to key on, which is why the chrome catalogue could never reach them. {@link RoxyEndpointForm.fieldText} and {@link RoxyEndpointForm.optionText} read a map baked into the per-language payload at build time and published through the same registry the chrome strings use. It rides the `locales/{lang}.js` download a translated page already makes, so it costs no extra request, needs no network at render time, and cannot flash English before correcting itself.\n *\n * **`humanize()` remains, as the fallback, and that is what makes this safe.** The payload is cosmetic and never awaited: a form draws immediately, an offline page or a blocked request renders exactly what it rendered before labels existed, and a language with no translation for a given key falls back to English server-side. There is no state in which a missing label breaks a form. Operation SUMMARIES and field DESCRIPTIONS are deliberately NOT in that map: a description is developer-facing reference prose, most of it collapsed behind a disclosure, and the widget already states the same contract language-neutrally through its input type and bounds. GROUP names stay catalogued rather than fetched, because the spec has nine of them: see {@link RoxyEndpointForm.groupName}.\n */\n@customElement('roxy-endpoint-form')\nexport class RoxyEndpointForm extends RoxyLocalizedElement {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tdisclosureStyles,\n\t\tcss`form{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);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);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.fields{align-items:start;gap:var(--roxy-space-md,1rem);grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));display:grid}.fields:empty{display:none}.person-group{background:var(--roxy-surface,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-md,1rem);gap:var(--roxy-space-md,1rem);min-inline-size:0;margin:0;display:grid}.person-group legend{padding:0 var(--roxy-space-xs,.25rem);font-weight:var(--roxy-weight-bold,600)}.field{gap:var(--roxy-space-xs,.25rem);flex-direction:column;min-width:0;display:flex}.tiles-field{grid-column:1/-1}label,.label{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-secondary,#475569)}.req{color:var(--roxy-danger-fg,#991b1b);margin-left:4px}input,select{box-sizing:border-box;width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);font-family:inherit}input:focus,select:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.help{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}.help-details>summary{cursor:pointer;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);align-items:center;gap:4px;display:flex}.help-details .help-lead{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.help-details .help-full{margin-top:var(--roxy-space-xs,.25rem);display:block}.location-block{gap:var(--roxy-space-xs,.25rem);grid-column:1/-1;display:grid}.tiles{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(5.5rem,1fr));display:grid}.tile{min-height:44px;padding:var(--roxy-space-sm,.5rem);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease), background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-direction:column;justify-content:center;align-items:center;gap:2px;display:flex}.tile:hover{border-color:var(--roxy-accent,#f59e0b)}.tile[aria-checked=true]{border-color:var(--roxy-accent,#f59e0b);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 12%, transparent);color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.tile:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.tile-glyph{font-size:1.35em;line-height:1}.toggle-row{align-items:center;gap:var(--roxy-space-sm,.5rem);display:flex}.toggle{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);background:var(--roxy-border,#e4e4e7);cursor:pointer;width:44px;height:26px;transition:background-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0;padding:0;position:relative}.toggle[aria-checked=true]{background:var(--roxy-accent,#f59e0b);border-color:var(--roxy-accent,#f59e0b)}.toggle .knob{background:var(--roxy-bg,#fff);width:20px;height:20px;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);border-radius:50%;position:absolute;top:2px;left:2px}.toggle[aria-checked=true] .knob{transform:translate(18px)}.toggle:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.toggle-label{cursor:pointer}@media (prefers-reduced-motion:reduce){.tile,.toggle,.toggle .knob{transition:none}}.advanced{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.advanced>summary{cursor:pointer;font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-fg,#0a0a0a);align-items:center;gap:6px;display:flex}.advanced[open]>summary{margin-bottom:var(--roxy-space-md,1rem)}.advanced .fields,.advanced .person-group{margin-top:var(--roxy-space-md,1rem)}.validation-error{gap:var(--roxy-space-xs,.25rem);padding:var(--roxy-space-md,1rem);background:color-mix(in srgb, var(--roxy-danger,#dc2626) 8%, transparent);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);display:grid}button.submit{background:var(--roxy-accent-ink,#b45309);color:var(--roxy-bg,#fff);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-lg,1.5rem);font-size:var(--roxy-text-base,1rem);font-weight:var(--roxy-weight-bold,600);cursor:pointer;transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));border:0;justify-self:start}button.submit:hover{transform:scale(1.02)}button.submit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}@media (prefers-reduced-motion:reduce){button.submit{transition:none}}.spec-error{gap:var(--roxy-space-md,1rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}`,\n\t];\n\n\t@property({ type: String, attribute: 'data-endpoint' })\n\tendpoint = 'vedic-astrology/birth-chart';\n\n\t@property({ type: String })\n\tmethod: 'GET' | 'POST' = 'POST';\n\n\t/** Explicit OpenAPI spec URL. When set, the form fetches and digests that full spec (the demo path). When empty, it resolves a version-pinned slice first, then the production spec. */\n\t@property({ type: String, attribute: 'spec-url' })\n\tspecUrl = '';\n\n\t/** Override the submit-button label. Empty derives an outcome-first label from the endpoint. */\n\t@property({ type: String, attribute: 'submit-label' })\n\tsubmitLabel = '';\n\n\t/** Browser-safe publishable key, forwarded to the slotted city search so the natal or synastry form can geocode. */\n\t@property({ type: String, attribute: 'publishable-key' })\n\tpublishableKey?: string;\n\n\t/** Prefill values, keyed by field name (nested per group). Used by `remember` mode and to restore the previous submission. JS property only. */\n\t@property({ attribute: false })\n\tinitialValues?: Record<string, unknown>;\n\n\t@state()\n\tprivate fields: FieldDef[] = [];\n\n\t@state()\n\tprivate formTitle = '';\n\n\t@state()\n\tprivate hasLang = false;\n\n\t@state()\n\tprivate values: Record<string, unknown> = {};\n\n\t@state()\n\tprivate loaded = false;\n\n\t@state()\n\tprivate specError: string | null = null;\n\n\t@state()\n\tprivate validationErrors: string[] = [];\n\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback();\n\t\tvoid this.loadSchema();\n\t}\n\n\tprivate async loadSchema() {\n\t\tthis.specError = null;\n\t\ttry {\n\t\t\tthis.applyModel(await this.resolveModel());\n\t\t} catch (err) {\n\t\t\t// The banner reads in the page language; the event keeps the canonical\n\t\t\t// English, because a listener is code and a developer console is not a\n\t\t\t// localized surface.\n\t\t\tthis.specError = this.specErrorMessage(err);\n\t\t\tthis.loaded = true;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-spec-error', {\n\t\t\t\t\tdetail: {\n\t\t\t\t\t\turl: this.specUrl || PROD_SPEC_URL,\n\t\t\t\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t\t\t\t},\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\t/** The failure sentence a visitor reads. Composed here rather than at the throw, so the shared spec-cache promise cannot freeze one form's language onto another. A message from anywhere else (a browser network error) is a wire fact and passes through untranslated. */\n\tprivate specErrorMessage(err: unknown): string {\n\t\tif (err instanceof SpecHttpError)\n\t\t\treturn this.t('HTTP error {{status}}', { status: err.status });\n\t\tif (err instanceof SpecMissingOperationError)\n\t\t\treturn this.t('Endpoint {{method}} {{path}} not found in OpenAPI spec', {\n\t\t\t\tmethod: err.method,\n\t\t\t\tpath: err.path,\n\t\t\t});\n\t\treturn err instanceof Error ? err.message : String(err);\n\t}\n\n\t/** Resolve the form model: explicit spec-url wins; else a version-pinned slice; else the production spec. */\n\tprivate async resolveModel(): Promise<FormModel> {\n\t\tif (this.specUrl) return this.modelFromSpec(this.specUrl);\n\t\tconst slice = await this.tryLoadSlice();\n\t\treturn slice ?? this.modelFromSpec(PROD_SPEC_URL);\n\t}\n\n\t/** Fetch and digest one operation from a full OpenAPI document. */\n\tprivate async modelFromSpec(url: string): Promise<FormModel> {\n\t\tconst spec = await loadSpec(url);\n\t\tconst path = `/${this.endpoint.replace(/^\\//, '')}`;\n\t\tconst op = spec.paths?.[path]?.[this.method.toLowerCase()] as\n\t\t\t| OperationSchema\n\t\t\t| undefined;\n\t\tif (!op) throw new SpecMissingOperationError(this.method, path);\n\t\treturn buildFormModel(op, spec.components?.schemas ?? {}, this.endpoint);\n\t}\n\n\t/** Try the small precomputed slice; return null on any miss so the caller falls back to the full spec. */\n\tprivate async tryLoadSlice(): Promise<FormModel | null> {\n\t\ttry {\n\t\t\tconst res = await fetch(\n\t\t\t\t`${SLICE_BASE}/${sliceFileName(this.method, this.endpoint)}`,\n\t\t\t);\n\t\t\tif (!res.ok) return null;\n\t\t\treturn (await res.json()) as FormModel;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate applyModel(model: FormModel) {\n\t\tthis.fields = model.fields;\n\t\tthis.formTitle = model.title;\n\t\tthis.hasLang = model.hasLang;\n\t\t// Pre-fill: schema defaults first, then any remembered/initial values (only\n\t\t// for fields this endpoint has) so a stale stored payload from another\n\t\t// endpoint cannot inject unknown keys. Remembered values are nested per\n\t\t// group, so read them by group.\n\t\tconst init: Record<string, unknown> = {};\n\t\tfor (const f of model.fields) {\n\t\t\tif (f.default !== undefined) init[f.key] = f.default;\n\t\t\tconst remembered = f.group\n\t\t\t\t? (\n\t\t\t\t\t\tthis.initialValues?.[f.group] as Record<string, unknown> | undefined\n\t\t\t\t\t)?.[f.name]\n\t\t\t\t: this.initialValues?.[f.name];\n\t\t\tif (remembered !== undefined) init[f.key] = remembered;\n\t\t}\n\t\tthis.values = init;\n\t\tthis.loaded = true;\n\t}\n\n\tprivate retryLoadSchema = () => {\n\t\tthis.loaded = false;\n\t\tthis.specError = null;\n\t\tvoid this.loadSchema();\n\t};\n\n\tprivate setValue(name: string, value: unknown) {\n\t\tthis.values = { ...this.values, [name]: value };\n\t}\n\n\t/** The field's render role: a hidden autogenerated seed, a hidden defaulted limit/offset, a suppressed location coordinate, or a normally rendered input. */\n\tprivate roleOf(\n\t\tf: FieldDef,\n\t): 'seed' | 'hidden-default' | 'location' | 'normal' {\n\t\tif (f.name === 'seed') return 'seed';\n\t\tif ((f.name === 'limit' || f.name === 'offset') && !f.required)\n\t\t\treturn 'hidden-default';\n\t\tif (\n\t\t\t(LOCATION_TRIO as readonly string[]).includes(f.name) &&\n\t\t\tthis.groupHasLocation(f.group)\n\t\t)\n\t\t\treturn 'location';\n\t\t// A flat timezone in a group with no coordinates of its own is still suppressed when a\n\t\t// location group has claimed it, otherwise the prefixed shape shows a raw decimal-hours\n\t\t// box beside two city searches that already know the answer.\n\t\tif (\n\t\t\tf.name === 'timezone' &&\n\t\t\tthis.locationGroups().some((g) => this.timezoneFieldFor(g)?.key === f.key)\n\t\t)\n\t\t\treturn 'location';\n\t\treturn 'normal';\n\t}\n\n\t/** True when the field renders its own input (as opposed to being hidden or replaced by the city search). */\n\tprivate isRendered(f: FieldDef): boolean {\n\t\treturn this.roleOf(f) === 'normal';\n\t}\n\n\t/** Ordered, de-duplicated group keys (undefined flat group plus each named object). */\n\tprivate groupKeys(): (string | undefined)[] {\n\t\tconst keys: (string | undefined)[] = [];\n\t\tfor (const f of this.fields)\n\t\t\tif (!keys.includes(f.group)) keys.push(f.group);\n\t\treturn keys;\n\t}\n\n\t/** True when the fields in `group` (or the flat top level) carry a latitude+longitude pair, so a location-search can autofill them. Timezone is NOT required here, see {@link LOCATION_PAIR}. */\n\tprivate groupHasLocation(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_PAIR.every((n) => inGroup.some((f) => f.name === n));\n\t}\n\n\t/**\n\t * Location groups in field order. Order is load-bearing: when a request carries coordinate\n\t * groups but only ONE unprefixed top-level `timezone`, the FIRST group owns it, because that\n\t * timezone belongs to the primary moment (`generateRelocationChart` has one `timezone` and it is\n\t * the birth timezone). Without an owner both city boxes would write the same key and the second\n\t * pick would silently overwrite the first with the wrong offset.\n\t */\n\tprivate locationGroups(): (string | undefined)[] {\n\t\treturn this.groupKeys().filter((g) => this.groupHasLocation(g));\n\t}\n\n\t/**\n\t * The timezone field a group's city search should fill, or undefined when there is none.\n\t *\n\t * Prefers a timezone inside the group (the nested `person1`/`person2` shape has its own). Falls\n\t * back to an unowned flat `timezone` for the first location group only, which is what makes the\n\t * prefixed shape work without leaving a decimal-hours box for a visitor to guess at.\n\t */\n\tprivate timezoneFieldFor(group?: string): FieldDef | undefined {\n\t\tconst own = this.fields.find(\n\t\t\t(f) => f.group === group && f.name === 'timezone',\n\t\t);\n\t\tif (own) return own;\n\t\tif (this.locationGroups()[0] !== group) return undefined;\n\t\treturn this.fields.find(\n\t\t\t(f) => f.group === undefined && f.name === 'timezone',\n\t\t);\n\t}\n\n\t/**\n\t * True when the location block must show a required mark, i.e. ANY member of the trio is required. The block is a single city-search input that fills all three, so if even one is required (e.g. bodygraph requires `timezone` while `latitude`/`longitude` are optional) the input is required and `collectMissing` blocks submit without it. Requiring ALL three understated that: the asterisk went missing on a block the form still enforced, which reads as optional to a non-technical embedder.\n\t */\n\tprivate locationRequired(group?: string): boolean {\n\t\tconst inGroup = this.fields.filter((f) => f.group === group);\n\t\treturn LOCATION_TRIO.some((n) =>\n\t\t\tinGroup.some((f) => f.name === n && f.required),\n\t\t);\n\t}\n\n\t/** A named group is a required input when any of its leaf fields is required or it carries a location. */\n\tprivate groupIsRequired(group: string): boolean {\n\t\treturn (\n\t\t\tthis.groupHasLocation(group) ||\n\t\t\tthis.fields.some((f) => f.group === group && f.required)\n\t\t);\n\t}\n\n\t/**\n\t * The single visible required enum field, when the whole form reduces to exactly one: no location block, no named group, one required rendered enum. This is what turns the horoscope form into a tap-to-load sign grid; returns null otherwise.\n\t */\n\tprivate get singleEnumField(): FieldDef | null {\n\t\tif (this.groupKeys().some((g) => this.groupHasLocation(g))) return null;\n\t\tif (this.groupKeys().some((g) => g !== undefined)) return null;\n\t\tconst req = this.fields.filter((f) => f.required && this.isRendered(f));\n\t\tconst only = req[0];\n\t\tif (req.length !== 1 || !only) return null;\n\t\treturn only.kind === 'tiles' || only.kind === 'select' ? only : null;\n\t}\n\n\t/** The submit-button label. A caller-supplied one is theirs and is printed verbatim; the derived verb is ours, so it goes through the catalogue. {@link deriveSubmitLabel} returns the canonical English verb, which IS the catalogue key. */\n\tprivate effectiveSubmitLabel(): string {\n\t\treturn this.submitLabel || this.t(deriveSubmitLabel(this.endpoint));\n\t}\n\n\t/**\n\t * The value this form may put on `?lang=`, or undefined to leave the request on the API default.\n\t *\n\t * @remarks\n\t * NOT the display language, and the name says so: `effectiveLang()` on the base class is the full display tag every `t()` reads. `?lang=es-AR` is a 400 and `?lang=es` is a 200, and the language resolves from `<html lang>` rather than only from an attribute a developer typed, so the unfiltered tag reaching the query string would break every regional and every untranslated locale. {@link apiLang} does both narrowings; this method exists so the submit path reads as one call.\n\t */\n\tprivate requestLang(): string | undefined {\n\t\treturn apiLang(this);\n\t}\n\n\t/**\n\t * The words this form writes over a request field, and the options under it.\n\t *\n\t * @remarks\n\t * `humanize()` is the FALLBACK, not the default, and it stays because it has to: the labels\n\t * arrive over the network and a form must draw before they land, on an offline page, and when\n\t * the request fails. So the worst case is exactly what this form rendered before labels\n\t * existed, and the best case is a translated one, with no state in between where it breaks.\n\t *\n\t * Keyed by WIRE NAME rather than by the English text, because the English text is itself\n\t * computed here by `humanize()`; there is no constant to key on. Same reason the label map is\n\t * a separate key space from the chrome catalogue.\n\t */\n\tprivate fieldText(name: string): string {\n\t\treturn fieldLabel(this.requestLang(), name) ?? humanize(name);\n\t}\n\n\t/** The option text under one field, falling back the same way. */\n\tprivate optionText(field: string, value: string): string {\n\t\treturn optionLabel(this.requestLang(), field, value) ?? humanize(value);\n\t}\n\n\t/**\n\t * Location-select handler bound to a group: fills that group's coordinate keys plus whichever\n\t * timezone field it owns.\n\t *\n\t * Keys are LOOKED UP from the model rather than built as `group.name`. That assumption held only\n\t * while every group came from object nesting; a prefixed group stores under the original wire\n\t * name (`birthLatitude`), so constructing `birth.latitude` would write a key the request builder\n\t * never reads and the coordinates would silently stay empty.\n\t */\n\tprivate onLocationFor(group?: string) {\n\t\treturn (e: Event) => {\n\t\t\tconst detail = (e as CustomEvent).detail as {\n\t\t\t\tlatitude?: number;\n\t\t\t\tlongitude?: number;\n\t\t\t\ttimezone?: string;\n\t\t\t\tutcOffset?: number;\n\t\t\t};\n\t\t\tif (!detail) return;\n\t\t\tconst keyOf = (name: string) =>\n\t\t\t\tthis.fields.find((f) => f.group === group && f.name === name)?.key;\n\t\t\tconst next: Record<string, unknown> = { ...this.values };\n\t\t\tconst lat = keyOf('latitude');\n\t\t\tconst lon = keyOf('longitude');\n\t\t\tif (lat) next[lat] = detail.latitude;\n\t\t\tif (lon) next[lon] = detail.longitude;\n\t\t\tconst tz = this.timezoneFieldFor(group);\n\t\t\tif (tz) next[tz.key] = detail.timezone ?? detail.utcOffset;\n\t\t\tthis.values = next;\n\t\t};\n\t}\n\n\tprivate selectTile(f: FieldDef, value: string) {\n\t\tthis.setValue(f.key, value);\n\t\tif (this.singleEnumField?.key === f.key) this.submit();\n\t}\n\n\t/** Roving-tabindex arrow-key navigation for a tile radiogroup, modeled on the shared tablist pattern (selection follows focus). */\n\tprivate onTilesKeyDown(f: FieldDef) {\n\t\treturn (e: KeyboardEvent) => {\n\t\t\tconst opts = f.enum ?? [];\n\t\t\tif (opts.length === 0) return;\n\t\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\t\tlet next: number;\n\t\t\tif (e.key === 'Home') next = 0;\n\t\t\telse if (e.key === 'End') next = opts.length - 1;\n\t\t\telse if (e.key === 'ArrowRight' || e.key === 'ArrowDown')\n\t\t\t\tnext = cur === -1 ? 0 : (cur + 1) % opts.length;\n\t\t\telse if (e.key === 'ArrowLeft' || e.key === 'ArrowUp')\n\t\t\t\tnext =\n\t\t\t\t\tcur === -1 ? opts.length - 1 : (cur - 1 + opts.length) % opts.length;\n\t\t\telse return;\n\t\t\te.preventDefault();\n\t\t\tconst value = opts[next];\n\t\t\tif (value === undefined) return;\n\t\t\tthis.selectTile(f, value);\n\t\t\tconst root = e.currentTarget as HTMLElement;\n\t\t\trequestAnimationFrame(() =>\n\t\t\t\troot.querySelector<HTMLButtonElement>(`[data-tile='${next}']`)?.focus(),\n\t\t\t);\n\t\t};\n\t}\n\n\tprivate onSubmit = (e: Event) => {\n\t\te.preventDefault();\n\t\tthis.submit();\n\t};\n\n\t/** Validate, then emit `roxy-submit` with the reconstructed payload, the spec query keys, and whether the form was a single-enum sticky picker. */\n\tprivate submit() {\n\t\tconst missing = this.collectMissing();\n\t\tif (missing.keys.length > 0) {\n\t\t\tthis.validationErrors = missing.labels;\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('roxy-validation-error', {\n\t\t\t\t\tdetail: { missing: missing.keys },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis.validationErrors = [];\n\t\tconst out: Record<string, unknown> = {};\n\t\tfor (const f of this.fields) {\n\t\t\tlet v = this.values[f.key];\n\t\t\t// A hidden seed autogenerates per submit unless a value was remembered.\n\t\t\tif (f.name === 'seed' && (v === undefined || v === '')) v = randomSeed();\n\t\t\tif (v === undefined || v === '') continue;\n\t\t\tif (f.kind === 'array' && typeof v === 'string') v = parseArrayValue(v);\n\t\t\tif (f.group) {\n\t\t\t\tconst g = (out[f.group] as Record<string, unknown> | undefined) ?? {};\n\t\t\t\tg[f.name] = v;\n\t\t\t\tout[f.group] = g;\n\t\t\t} else {\n\t\t\t\tout[f.name] = v;\n\t\t\t}\n\t\t}\n\t\t// The spec knows which parameters belong in the query string; the listener\n\t\t// does not. Report them (including a site-owner lang) so a POST with a query\n\t\t// parameter reaches the API correctly instead of being dropped in the body.\n\t\tconst queryKeys = this.fields.filter((f) => f.inQuery).map((f) => f.name);\n\t\tconst lang = this.requestLang();\n\t\tif (this.hasLang && lang) {\n\t\t\tout.lang = lang;\n\t\t\tqueryKeys.push('lang');\n\t\t}\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('roxy-submit', {\n\t\t\t\tdetail: {\n\t\t\t\t\tendpoint: this.endpoint,\n\t\t\t\t\tvalues: out,\n\t\t\t\t\tqueryKeys,\n\t\t\t\t\tsticky: this.singleEnumField != null,\n\t\t\t\t},\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** Required fields left empty, with the location trio collapsed to one entry per group. Seed and hidden defaults never block. */\n\tprivate collectMissing(): { keys: string[]; labels: string[] } {\n\t\tconst keys: string[] = [];\n\t\tconst labels: string[] = [];\n\t\tconst locGroups = new Set<string | undefined>();\n\t\tfor (const f of this.fields) {\n\t\t\tif (!f.required) continue;\n\t\t\tconst isLocation = this.roleOf(f) === 'location';\n\t\t\tif (!this.isRendered(f) && !isLocation) continue;\n\t\t\tconst v = this.values[f.key];\n\t\t\tif (v !== undefined && v !== '') continue;\n\t\t\tkeys.push(f.key);\n\t\t\tif (isLocation) {\n\t\t\t\tlocGroups.add(f.group);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// The group half translates and the field half cannot, which is not a\n\t\t\t// half-measure: this names a block the visitor has to go back to, so the word\n\t\t\t// in the message has to be the word printed on the fieldset legend. A message\n\t\t\t// saying `Person 1` over a legend reading `Persona 1` points at nothing.\n\t\t\tlabels.push(\n\t\t\t\tf.group\n\t\t\t\t\t? `${this.groupName(f.group)} ${this.fieldText(f.name)}`\n\t\t\t\t\t: this.fieldText(f.name),\n\t\t\t);\n\t\t}\n\t\tfor (const g of locGroups) {\n\t\t\tlabels.push(this.locationLabel(g));\n\t\t}\n\t\treturn { keys, labels };\n\t}\n\n\tprivate reqMark(f: FieldDef) {\n\t\treturn f.required\n\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t: nothing;\n\t}\n\n\t/** A description under a field: rendered inline when short, collapsed behind a disclosure showing its first line when long. */\n\tprivate description(f: FieldDef) {\n\t\tif (!f.description) return nothing;\n\t\tif (f.description.length <= 120) {\n\t\t\treturn html`<small class=\"help\">${f.description}</small>`;\n\t\t}\n\t\tconst lead = f.description.split('. ')[0] ?? f.description;\n\t\treturn html`<details class=\"help-details\"><summary><span class=\"help-lead\">${lead}</span>${chevron()}</summary><small class=\"help help-full\">${f.description}</small></details>`;\n\t}\n\n\tprivate renderTiles(f: FieldDef) {\n\t\tconst labelId = `roxy-form-${f.key}-label`;\n\t\tconst zodiac = !!f.enum && isZodiacEnum(f.enum);\n\t\tconst opts = f.enum ?? [];\n\t\tconst cur = opts.indexOf(this.values[f.key] as string);\n\t\tconst active = cur === -1 ? 0 : cur;\n\t\treturn html`<div class=\"field tiles-field\"><span class=\"label\" id=\"${labelId}\">${this.fieldText(f.name)}${this.reqMark(f)}</span><div class=\"tiles\" role=\"radiogroup\" aria-labelledby=\"${labelId}\" @keydown=\"${this.onTilesKeyDown(f)}\">${opts.map((opt, i) => {\n\t\t\t\t\tconst selected = this.values[f.key] === opt;\n\t\t\t\t\tconst glyph = zodiac ? signGlyph(opt) : undefined;\n\t\t\t\t\treturn html`<button type=\"button\" class=\"tile\" role=\"radio\" data-tile=\"${i}\" aria-checked=\"${selected ? 'true' : 'false'}\" tabindex=\"${i === active ? '0' : '-1'}\" @click=\"${() => this.selectTile(f, opt)}\">${\n\t\t\t\t\t\t\tglyph\n\t\t\t\t\t\t\t\t? html`<span class=\"tile-glyph\" aria-hidden=\"true\">${glyph}</span>`\n\t\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t\t} <span class=\"tile-label\">${this.optionText(f.name, opt)}</span></button>`;\n\t\t\t\t})}</div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderSelect(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${this.fieldText(f.name)}${this.reqMark(f)}</label> <select id=\"${id}\" ?required=\"${f.required}\" @change=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(f.key, (e.target as HTMLSelectElement).value)}\"><option value=\"\">${this.t('Choose')}</option>${(f.enum ?? []).map(\n\t\t\t\t\t(\n\t\t\t\t\t\topt,\n\t\t\t\t\t) => html`<option value=\"${opt}\" ?selected=\"${this.values[f.key] === opt}\">${this.optionText(f.name, opt)}</option>`,\n\t\t\t\t)}</select> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderToggle(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst checked = this.values[f.key] === true;\n\t\treturn html`<div class=\"field\"><div class=\"toggle-row\"><button type=\"button\" id=\"${id}\" class=\"toggle\" role=\"switch\" aria-checked=\"${checked ? 'true' : 'false'}\" @click=\"${() => this.setValue(f.key, !checked)}\"><span class=\"knob\"></span></button> <label class=\"toggle-label\" for=\"${id}\">${this.fieldText(f.name)}${this.reqMark(f)}</label></div>${this.description(f)}</div>`;\n\t}\n\n\tprivate renderInput(f: FieldDef) {\n\t\tconst id = `roxy-form-${f.key}`;\n\t\tconst type =\n\t\t\tf.kind === 'datetime'\n\t\t\t\t? 'datetime-local'\n\t\t\t\t: f.kind === 'number'\n\t\t\t\t\t? 'number'\n\t\t\t\t\t: f.kind;\n\t\tconst placeholder =\n\t\t\tf.kind === 'array'\n\t\t\t\t? this.t('Comma separated')\n\t\t\t\t: f.example != null\n\t\t\t\t\t? String(f.example)\n\t\t\t\t\t: '';\n\t\treturn html`<div class=\"field\"><label for=\"${id}\">${this.fieldText(f.name)}${this.reqMark(f)}</label> <input id=\"${id}\" type=\"${f.kind === 'array' ? 'text' : type}\" ?required=\"${f.required}\" min=\"${ifDefined(f.min)}\" max=\"${ifDefined(f.max)}\" step=\"${f.kind === 'number' ? 'any' : nothing}\" placeholder=\"${placeholder || nothing}\" .value=\"${(this.values[f.key] ?? '') as string}\" @input=\"${(e: Event) =>\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tf.key,\n\t\t\t\t\t\tthis.coerce(f.kind, (e.target as HTMLInputElement).value),\n\t\t\t\t\t)}\"> ${this.description(f)}</div>`;\n\t}\n\n\tprivate renderField(f: FieldDef) {\n\t\tswitch (f.kind) {\n\t\t\tcase 'tiles':\n\t\t\t\treturn this.renderTiles(f);\n\t\t\tcase 'select':\n\t\t\t\treturn this.renderSelect(f);\n\t\t\tcase 'toggle':\n\t\t\t\treturn this.renderToggle(f);\n\t\t\tdefault:\n\t\t\t\treturn this.renderInput(f);\n\t\t}\n\t}\n\n\t/**\n\t * The fields this group's city search actually fills, named in the help text.\n\t *\n\t * Not the hardcoded \"latitude, longitude, timezone\" it used to say: a group does not always own a\n\t * timezone. `generateRelocationChart` has one top-level `timezone` that belongs to the birth\n\t * moment, so the relocation block fills coordinates only, and promising a timezone there would be\n\t * a visible lie on the one form that made this method necessary.\n\t */\n\tprivate locationFillList(group?: string): string {\n\t\tconst names = [...LOCATION_PAIR] as string[];\n\t\tif (this.timezoneFieldFor(group)) names.push('timezone');\n\t\treturn names.join(', ');\n\t}\n\n\t/**\n\t * The name of one request group, translated, falling back to the humanized English.\n\t *\n\t * @remarks\n\t * A group name is the one derived label that is also ENUMERABLE. A field label is `humanize()` over one of 909 spec field names, but a group is `humanize()` over the names an object-valued property or a coordinate prefix can take, and the whole spec has nine across 176 operations. So each is a catalogue entry, and the English token that used to sit inside translated prose (`Local de Natal Chart`, `\u041C\u0435\u0441\u0442\u043E (Birth Data)`) is gone. A tenth group appearing in the spec still renders: `t()` returns its source string on a miss, so it degrades to the humanized English rather than to a blank or a key.\n\t *\n\t * **The lookup folds case, and that is what makes `natalChart` work.** `humanize` produces `Natal Chart` while the catalogue carries `Natal chart` for the card heading, and {@link lookupKey} folds both to one key on write and on read, so this reuses the shipped translation. Adding the capitalized twin instead would SILENTLY OVERWRITE that heading in every locale rather than reading as a duplicate, which is why `i18n/chrome-strings.ts` carries no entry for it.\n\t */\n\tprivate groupName(group: string): string {\n\t\treturn this.t(humanize(group));\n\t}\n\n\t/**\n\t * The name of one location block, and of the same block in a validation message, which is why it is a method rather than two literals.\n\t *\n\t * The placeholder carries the group rather than the form concatenating a name in front of a translated noun, so a translator owns the word order: `Person 1 location` is English syntax, and Turkish suffixes the head noun, Hindi takes a genitive, Russian a parenthetical and German a colon. The four shapes are deliberately different and normalizing them breaks three languages.\n\t */\n\tprivate locationLabel(group?: string): string {\n\t\treturn group\n\t\t\t? this.t('{{group}} location', { group: this.groupName(group) })\n\t\t\t: this.t('Birth location');\n\t}\n\n\t/**\n\t * One city search standing in for a group's raw coordinates.\n\t *\n\t * `lang` is forwarded EXPLICITLY and that line is load-bearing: the city search lives inside this shadow root, and the `closest('[lang]')` link of the resolution chain stops at a shadow boundary, so without it the dropdown renders its own empty state and its refusal message in English on a fully translated page. The same trap is documented for every composing component in `docs/authoring.md`.\n\t */\n\tprivate locationBlock(group?: string) {\n\t\treturn html`<div class=\"location-block\"><label>${this.locationLabel(group)}${\n\t\t\t\t\tthis.locationRequired(group)\n\t\t\t\t\t\t? html`<span class=\"req\" aria-hidden=\"true\">*</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</label><roxy-location-search publishable-key=\"${ifDefined(this.publishableKey)}\" lang=\"${ifDefined(this.effectiveLang())}\" @roxy-location-select=\"${this.onLocationFor(group)}\" placeholder=\"${\n\t\t\t\t\tgroup\n\t\t\t\t\t\t? this.t('{{group}} city', { group: this.groupName(group) })\n\t\t\t\t\t\t: this.t('City of birth')\n\t\t\t\t}\"></roxy-location-search><small class=\"help\">${this.t('Fills {{fields}}. Pick a city to autofill.', {\n\t\t\t\t\tfields: this.locationFillList(group),\n\t\t\t\t})}</small></div>`;\n\t}\n\n\tprivate groupCard(group: string) {\n\t\tconst fields = this.fields.filter(\n\t\t\t(f) => f.group === group && this.isRendered(f),\n\t\t);\n\t\treturn html`<fieldset class=\"person-group\"><legend>${this.groupName(group)}</legend>${this.groupHasLocation(group) ? this.locationBlock(group) : nothing}<div class=\"fields\">${fields.map((f) => this.renderField(f))}</div></fieldset>`;\n\t}\n\n\trender() {\n\t\tif (!this.loaded) {\n\t\t\treturn html`<form><div class=\"roxy-skeleton\" style=\"height:8rem\"></div></form>`;\n\t\t}\n\t\tif (this.specError) {\n\t\t\treturn html`<div class=\"spec-error\" role=\"alert\">${this.t('Schema load failed: {{message}}', { message: this.specError })} <button type=\"button\" class=\"submit\" @click=\"${this.retryLoadSchema}\">${this.t('Retry')}</button></div>`;\n\t\t}\n\n\t\tconst flat = this.fields.filter((f) => !f.group && this.isRendered(f));\n\t\tconst flatReq = flat.filter((f) => f.required);\n\t\tconst flatOpt = flat.filter((f) => !f.required);\n\t\tconst named = this.groupKeys().filter((g): g is string => g !== undefined);\n\t\tconst reqGroups = named.filter((g) => this.groupIsRequired(g));\n\t\tconst optGroups = named.filter((g) => !this.groupIsRequired(g));\n\t\tconst hasAdvanced = flatOpt.length > 0 || optGroups.length > 0;\n\n\t\treturn html`<form @submit=\"${this.onSubmit}\"><h2 class=\"title\">${this.formTitle}</h2>${\n\t\t\t\tthis.validationErrors.length > 0\n\t\t\t\t\t? html`<div class=\"validation-error\" role=\"alert\"><strong>${this.t('Please complete:')}</strong> ${this.validationErrors.join(', ')}</div>`\n\t\t\t\t\t: nothing\n\t\t\t}<div class=\"fields\">${flatReq.map((f) => this.renderField(f))}</div>${this.groupHasLocation(undefined) ? this.locationBlock(undefined) : nothing} ${reqGroups.map((g) => this.groupCard(g))} ${\n\t\t\t\thasAdvanced\n\t\t\t\t\t? html`<details class=\"advanced\"><summary>${this.t('Advanced')}${chevron()}</summary><div class=\"fields\">${flatOpt.map((f) => this.renderField(f))}</div>${optGroups.map((g) => this.groupCard(g))}</details>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tthis.singleEnumField\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<button class=\"submit\" type=\"submit\">${this.effectiveSubmitLabel()}</button>`\n\t\t\t}</form>`;\n\t}\n\n\tprivate coerce(kind: string, v: string): unknown {\n\t\tif (v === '') return undefined;\n\t\tif (kind === 'number') {\n\t\t\tconst n = Number(v);\n\t\t\treturn Number.isFinite(n) ? n : undefined;\n\t\t}\n\t\treturn v;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-endpoint-form': RoxyEndpointForm;\n\t}\n}\n", "// Generated by scripts/sync-bindings.ts (the `lang` query enum in specs/openapi.json). Do not edit.\n\n/**\n * Every language tag the API accepts on `?lang=`.\n *\n * @remarks\n * A self-fetch resolves the site language from the DOM, which means ANY value a\n * host page happens to carry can reach the query string. The API rejects an\n * unlisted tag with a 400, so a page in a language we do not translate would\n * stop working the moment the language chain was completed. Membership is\n * checked against this list before `lang` is sent, and a miss simply omits the\n * parameter, leaving the endpoint on its English default.\n */\nexport const API_LANGUAGES: readonly string[] = [\"de\",\"en\",\"es\",\"fr\",\"hi\",\"pt\",\"ru\",\"tr\"];\n", "/**\n * Where a component's language comes from, and what is safe to send to the API.\n *\n * @remarks\n * Two different answers, and conflating them is the whole reason this file is separate from the catalogue:\n *\n * - {@link resolveLang} answers \"what language is this PAGE in\", and keeps the full tag, because `es-AR` is a legitimate thing for a catalogue to want to differ on.\n * - {@link apiLang} answers \"what may go on the query string\", which is a narrower question with a hard edge: `?lang=es-AR` is a 400, `?lang=es` is a 200.\n *\n * The full tag is not a nicety the catalogue happens to tolerate: `utils/format.ts` hands it to `Intl`, which reads the region and writes `15 de ene de 1990` for `es-AR` where it writes `15 ene 1990` for `es`. Passing the API answer to a formatter demotes every regional visitor to the base language and nothing fails, so the two values are never interchangeable.\n */\n\nimport { API_LANGUAGES } from '../generated/api-languages.js';\n\n/**\n * The site-owner language for an element, resolved through the four-link chain the revamp design specifies.\n *\n * @remarks\n * 1. the element's own `lang` attribute (the explicit per-embed override),\n * 2. the nearest ancestor carrying `lang`, so one wrapper localizes a whole section,\n * 3. `document.documentElement.lang`, which is what makes this work on a real CMS with no markup change at all: WordPress emits `<html lang=\"es-AR\">` on every page of a Spanish site,\n * 4. nothing, which the callers read as English.\n *\n * Only link 1 used to be implemented, so a component on a fully Spanish page rendered English chrome and there was no way to fix it except hand-editing every embed.\n *\n * `navigator.language` is deliberately NOT in the chain. It is the VISITOR's preference, not the site's: it fragments the API cache across every locale a visitor might carry and silently serves two people different content from the same URL.\n *\n * Link 2 uses `closest`, which stops at a shadow boundary. A component composed INSIDE another component's shadow root therefore cannot see the host page, which is why every composing component forwards `lang` to its children explicitly.\n */\nexport function resolveLang(el: HTMLElement): string | undefined {\n\t// Native accessor, never a Lit @property: declaring one would shadow\n\t// HTMLElement.lang and break the platform attribute for every consumer.\n\tif (el.lang) return el.lang;\n\tif (typeof document === 'undefined') return undefined;\n\tconst inherited = el.closest?.('[lang]')?.getAttribute('lang');\n\tif (inherited) return inherited;\n\treturn document.documentElement.lang || undefined;\n}\n\n/**\n * The value safe to put on `?lang=`, or `undefined` to leave the request on the API default.\n *\n * @remarks\n * Two narrowings, both of which are load-bearing the moment {@link resolveLang} starts reading `<html lang>`:\n *\n * - **The region is dropped.** A regional tag is a 400, so a Spanish WordPress site would go from English-but-working to broken the day the language chain was completed. `es-AR`, `es-419` and `ES` all send `es`.\n * - **An unsupported language is omitted, not sent.** The chain now surfaces whatever the host page carries, including languages the API does not translate, and an unlisted tag is the same 400. Omitting it degrades to English, which is the behaviour those pages already had.\n */\nexport function apiLang(el: HTMLElement): string | undefined {\n\tconst tag = resolveLang(el);\n\tif (!tag) return undefined;\n\tconst base = tag.toLowerCase().split('-')[0] as string;\n\treturn API_LANGUAGES.includes(base) ? base : undefined;\n}\n", "import { LitElement } from 'lit';\nimport { resolveLang } from './lang.js';\nimport { LocaleController } from './locale-controller.js';\nimport { translate } from './registry.js';\n\n/**\n * The base every element that writes WORDS extends: it resolves the page language and translates its own chrome.\n *\n * @remarks\n * This is deliberately smaller than {@link RoxyDataElement}, and the split is what makes the widgets translatable at all. `<roxy-endpoint-form>` and `<roxy-location-search>` are the two declared widgets: they fetch, they hold state, and they are NOT data components, so they cannot inherit the data base without dragging its controlled-mode hydration, its self-fetch controller and its own form rendering (which renders the form, so the form inheriting it would compose itself). They extended `LitElement` directly instead, which meant they had no `t()` and no {@link LocaleController}, so a Spanish page rendered a Spanish result card over an English form and neither widget re-rendered when a deferred locale payload landed.\n *\n * So the mechanism lives here ONCE and all three inherit it. There is no second translator, no second registry and no second way to resolve a language: adding one is how a catalogue entry and a call site drift apart.\n *\n * Two costs are why this is its own module rather than a second export of `utils/base-element.ts`. Every `dist/cdn/components/*.js` is a self-contained IIFE, so importing the data base into the city search would compile `FetchController`, `MarkupDataController` and the interpretation accordion into a bundle that uses none of them. And `utils/base-element.ts` imports THIS file, so putting the class there would close a cycle the moment a widget imported it.\n */\nexport abstract class RoxyLocalizedElement extends LitElement {\n\tconstructor() {\n\t\tsuper();\n\t\t// Re-render if a chrome-string catalogue lands after this element upgraded.\n\t\t// A host page loads the payload as its own script tag, so it can arrive\n\t\t// after first paint and there is nothing the site owner could do about it.\n\t\tnew LocaleController(this);\n\t}\n\n\t/**\n\t * The chrome string for this element's language, keyed by its own English source text.\n\t *\n\t * @remarks\n\t * Pass the English copy, never a key. With no catalogue registered the source string is returned unchanged, so an English page pays nothing and a language we do not ship degrades to English rather than to a visible key.\n\t *\n\t * Chrome only. A value the API returned (a planet, a sign, an aspect, a house system) is NOT translated here: it is rendered as the response carries it, so the words on the chart and the words in the response can never disagree. The same holds for a label derived from a spec field NAME through `humanize()`: a catalogue keyed on English source text cannot reach a string computed per response. A derived name is catalogued only where the set it comes from is CLOSED and small enough to enumerate against the spec, which is true of the nine form group names and of nothing else so far.\n\t *\n\t * @example\n\t * ```ts\n\t * this.t('Aspect grid'); // 'Cuadricula de aspectos' under lang=\"es\"\n\t * this.t('{{count}} planets', { count: 12 }); // '12 planetas'\n\t * ```\n\t */\n\tprotected t(source: string, vars?: Record<string, string | number>): string {\n\t\treturn translate(this.effectiveLang(), source, vars);\n\t}\n\n\t/** {@link RoxyLocalizedElement.t} as a value, bound once, for a shared render helper that has no host of its own and therefore cannot resolve a page language (`utils/hd-reading.ts`). Named `translator` and not `translate` because `HTMLElement.translate` is a real DOM property and shadowing it with a protected member makes every `@customElement` decorator in the library fail to typecheck. */\n\tprotected readonly translator = (\n\t\tsource: string,\n\t\tvars?: Record<string, string | number>,\n\t): string => this.t(source, vars);\n\n\t/**\n\t * Site-owner language for this element: the `lang` attribute, the nearest ancestor carrying one, or the document. Protected so a component that composes another can forward it (a child inside this shadow root cannot reach the host page on its own).\n\t *\n\t * Full tag, region included. The truncation to what `?lang=` accepts happens where the request is built, in `<roxy-endpoint-form>`.\n\t */\n\tprotected effectiveLang(): string | undefined {\n\t\treturn resolveLang(this);\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 * - `lookupKey`: the ONE normalizer every lookup table in this library is keyed\n * and read by (`tokens/index.ts` glyphs and abbreviations, `i18n/` chrome\n * strings).\n * - `capitalize`: title-cases the first character, lowercases the rest. A\n * DISPLAY helper only; it is not a lookup key (see `lookupKey`).\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\n/**\n * Fold a name to the canonical key its lookup table is stored under: lower case, every run of spaces, underscores and hyphens collapsed to one space, trimmed.\n *\n * @remarks\n * This exists because a GUESSED key spelling is a defect class this repo has now shipped twice. The glyph tables were keyed off whatever {@link capitalize} happened to produce (`North node`), while the API returns `North Node`, so every call site that reached the table without first calling `capitalize` missed and fell through to a fabricated abbreviation. Aspects hit the same wall from the other side: `/aspects` returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`.\n *\n * One normalizer, applied when a table is DEFINED and again when it is READ, removes the whole class: no call site has to remember a convention, and no table has to guess a spelling. Use it for every new table keyed by an API-supplied name.\n *\n * @example\n * ```ts\n * lookupKey('North Node'); // 'north node'\n * lookupKey('SEMI_SEXTILE'); // 'semi sextile'\n * lookupKey('semi-sextile'); // 'semi sextile'\n * ```\n */\nexport function lookupKey(s: string): string {\n\treturn s\n\t\t.toLowerCase()\n\t\t.replace(/[\\s_-]+/g, ' ')\n\t\t.trim();\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 (\n\t\ts\n\t\t\t.replace(/[_-]+/g, ' ')\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t\t// Split a trailing/embedded digit off a word so \"person1\" reads \"Person 1\"\n\t\t\t// and every group legend and field label spaces its ordinal.\n\t\t\t.replace(/([a-z])([0-9])/g, '$1 $2')\n\t\t\t.replace(/^\\w/, (c) => c.toUpperCase())\n\t);\n}\n", "/**\n * The chrome-string catalogue: one resolver reading one registry, so a translation can arrive from anywhere without a component changing.\n *\n * @remarks\n * **The key IS the canonical English string**, folded through {@link lookupKey}. There is no invented key vocabulary to keep in sync with the copy, which is the same rule the glyph tables in `tokens/index.ts` follow (they key off the exact value the API returns). Two consequences that are the whole point:\n *\n * - **English costs zero bytes.** A miss returns the source string, so the English build ships no catalogue at all, and a site that never loads a locale payload is byte-identical to one built before this file existed.\n * - **A missing translation degrades to English, never to a key.** The failure mode of a keyed catalogue is a raw `natal.tabs.wheel` rendered at a customer; here the worst case is the English word.\n *\n * **The registry lives on `globalThis`, not in module scope, because it has to.** Every `dist/cdn/components/*.js` is a self-contained IIFE with its own copy of this module, so a `Map` here would be invisible to the second component on the page. One global object, written by the locale payload and read by every bundle, is what makes `dist/cdn/locales/es.js` a single download that translates all of them.\n *\n * Load order is not guaranteed on a real host (WordPress enqueues scripts in an order the plugin does not fully control, and a payload may be deferred), so {@link onLocaleChange} lets an element that has already rendered in English re-render when its catalogue lands.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Shared mutable state, addressed by a name rather than a module binding so every bundle on the page reaches the same object. */\ninterface LocaleRegistry {\n\t/** Language tag (lower case) to catalogue, keyed by {@link lookupKey} of the English source string. */\n\tcatalogs: Record<string, Record<string, string>>;\n\t/**\n\t * Language tag (lower case) to the API's field-label map: `fields` keyed by wire name,\n\t * `enums` keyed `{fieldName}.{value}`.\n\t *\n\t * A SEPARATE key space from `catalogs` on purpose. A chrome string is keyed by the English\n\t * text a component writes, which is a constant in our source; a field label is keyed by a\n\t * name that only the OpenAPI spec knows, computed per operation, so no catalogue keyed on\n\t * English source text can ever reach it. Same registry because the delivery problem is\n\t * identical (a payload that may land after first paint), so it reuses one global object and\n\t * one listener set rather than growing a second of each.\n\t */\n\tfieldLabels: Record<string, FieldLabels>;\n\t/** Language tags whose fetch is in flight or done, so N forms on a page cost ONE request. */\n\trequested: Set<string>;\n\t/** Elements waiting to re-render when a catalogue arrives. */\n\tlisteners: Set<() => void>;\n}\n\n/** The `/languages/field-labels` payload, minus the echoed `lang`. */\nexport interface FieldLabels {\n\tfields: Record<string, string>;\n\tenums: Record<string, string>;\n}\n\nconst GLOBAL_KEY = '__ROXY_UI_I18N__';\n\nfunction registry(): LocaleRegistry {\n\tconst holder = globalThis as unknown as Record<string, LocaleRegistry>;\n\tconst existing = holder[GLOBAL_KEY];\n\tif (existing) return existing;\n\tconst created: LocaleRegistry = {\n\t\tcatalogs: {},\n\t\tfieldLabels: {},\n\t\trequested: new Set(),\n\t\tlisteners: new Set(),\n\t};\n\tholder[GLOBAL_KEY] = created;\n\treturn created;\n}\n\n/**\n * Publish a catalogue for a language tag and wake every mounted element.\n *\n * @remarks\n * The catalogue is authored keyed by the English source string, exactly as it appears at the call site, and normalized here. That keeps the source file readable and diffable against the component that renders it, while the runtime lookup stays a single property read.\n *\n * This is the ONLY way into the registry, so a catalogue can later come from a static file, a server response, or a host page inlining a script tag, without a component knowing the difference.\n */\nexport function registerLocale(\n\tlang: string,\n\tcatalog: Record<string, string>,\n): void {\n\tconst reg = registry();\n\tconst normalized: Record<string, string> = {};\n\tfor (const [source, translated] of Object.entries(catalog)) {\n\t\tnormalized[lookupKey(source)] = translated;\n\t}\n\treg.catalogs[lang.toLowerCase()] = normalized;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/**\n * Replace `{{name}}` placeholders. Copied from the API-side translator so both sides of the product interpolate identically; an unknown placeholder is left verbatim rather than blanked, so a typo in a catalogue is visible instead of silently eating the value.\n */\nexport function interpolate(\n\ttemplate: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!vars) return template;\n\treturn template.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) =>\n\t\tkey in vars ? String(vars[key] ?? '') : match,\n\t);\n}\n\n/**\n * The chrome string for `lang`, falling back to the English `source` it is keyed by.\n *\n * @remarks\n * A regional tag resolves against its base language, so `es-AR` and `es-419` both read the `es` catalogue and a site does not have to know which tags we happen to ship. An exact regional catalogue still wins if one is ever registered.\n */\nexport function translate(\n\tlang: string | undefined,\n\tsource: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!lang) return interpolate(source, vars);\n\tconst { catalogs } = registry();\n\tconst tag = lang.toLowerCase();\n\tconst catalog = catalogs[tag] ?? catalogs[tag.split('-')[0] as string];\n\treturn interpolate(catalog?.[lookupKey(source)] ?? source, vars);\n}\n\n/**\n * Publish a field-label map for a language tag and wake every mounted element.\n *\n * @remarks\n * Exported so a host that already has the payload (a server-rendered page, a test, a WordPress\n * plugin inlining it) can supply it without a network call, exactly as {@link registerLocale}\n * allows for chrome strings.\n */\nexport function registerFieldLabels(lang: string, labels: FieldLabels): void {\n\tconst reg = registry();\n\treg.fieldLabels[lang.toLowerCase()] = labels;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/** The field-label map for `lang`, resolving a regional tag against its base language. */\nfunction labelsFor(lang: string | undefined): FieldLabels | undefined {\n\tif (!lang) return undefined;\n\tconst { fieldLabels } = registry();\n\tconst tag = lang.toLowerCase();\n\treturn fieldLabels[tag] ?? fieldLabels[tag.split('-')[0] as string];\n}\n\n/**\n * The label for a request field name, or `undefined` when nothing has been published.\n *\n * @remarks\n * Returning `undefined` rather than the name is deliberate: the caller owns the fallback, which is\n * `humanize()`, and that keeps this resolver honest about what it actually knows. A form renders\n * identically to before until a payload arrives.\n */\nexport function fieldLabel(\n\tlang: string | undefined,\n\tname: string,\n): string | undefined {\n\treturn labelsFor(lang)?.fields[name];\n}\n\n/** The label for one selectable option, keyed `{fieldName}.{value}` as the API publishes it. */\nexport function optionLabel(\n\tlang: string | undefined,\n\tfield: string,\n\tvalue: string,\n): string | undefined {\n\treturn labelsFor(lang)?.enums[`${field}.${value}`];\n}\n\n/** Subscribe to catalogue arrivals. Returns the unsubscribe, so an element can drop it on disconnect. */\nexport function onLocaleChange(listener: () => void): () => void {\n\tconst { listeners } = registry();\n\tlisteners.add(listener);\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t};\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport { onLocaleChange } from './registry.js';\n\n/**\n * Re-renders its host when a chrome-string catalogue arrives.\n *\n * @remarks\n * Without this the catalogue would have to be on the page BEFORE the elements upgrade, which is not something a component can require of a real host. WordPress orders enqueued scripts by dependency and a site owner can add `defer` to any of them; a CDN embed is two independent `<script src>` tags. Any of those can land the locale payload after the first paint, and the visible result would be a chart that renders in English on a Spanish page for no reason the site owner can see or fix.\n *\n * Mirrors `MarkupDataController`: constructed in {@link RoxyDataElement}'s constructor, subscribes on connect, drops the subscription on disconnect. Registration is idempotent and a re-register of the same language simply re-renders, so a payload loaded twice is harmless.\n */\nexport class LocaleController implements ReactiveController {\n\tprivate readonly host: ReactiveControllerHost;\n\tprivate unsubscribe?: () => void;\n\n\tconstructor(host: ReactiveControllerHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected(): void {\n\t\tthis.unsubscribe = onLocaleChange(() => this.host.requestUpdate());\n\t}\n\n\thostDisconnected(): void {\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\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 * @remarks\n * **Every table here is keyed by {@link lookupKey} and read ONLY through the accessor beside it.** The raw records are deliberately not exported: a component that indexes a record directly has to guess the key convention, and a guessed spelling is what shipped `No North Node R`, `So South Node R` and `Bl Black Moon Lilith` into a live customer's natal chart. The API returns `North Node` with a space; the table was keyed `North node`, the spelling {@link capitalize} happens to produce, so every call site that forgot to call `capitalize` first missed the table.\n *\n * **A miss returns `undefined`, never a manufactured abbreviation.** The old `?? name.slice(0, 2)` fallback is what made the defect survive review: a failed lookup renders as a plausible two-letter code that reads exactly like an intentional abbreviation, so nothing about the output says \"this is broken\". A caller that can omit the glyph should omit it (`?? ''`); a caller that must show something falls back to the FULL name, which is visibly wrong at the size these slots are drawn.\n *\n * `tests/tokens.test.ts` resolves every body, sign and aspect name the committed spec can emit against these tables, so a vocabulary the API gains cannot ship unglyphed.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Look one name up in a normalized table. The single read path for every map in this file. */\nconst resolve = (\n\ttable: Record<string, string>,\n\tname: string | undefined | null,\n): string | undefined => (name ? table[lookupKey(name)] : undefined);\n\nconst 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\t'north node': '\u260A',\n\t'south node': '\u260B',\n\tchiron: '\u26B7',\n\tlilith: '\u26B8',\n\t'black moon lilith': '\u26B8',\n};\n\n/** Astrological glyph for a planet or point, or `undefined` when the library has none for it. */\nexport const planetGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_GLYPH, name);\n\nconst 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\n/** Two-letter graha code for the tight cells of a North/South Indian kundli, or `undefined`. */\nexport const planetAbbr = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_ABBR, name);\n\nconst 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\n/** Zodiac glyph for a sign name in any case, or `undefined`. */\nexport const signGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(SIGN_GLYPH, name);\n\nconst 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\n/** Two-letter rashi code for kundli cells and grid headers, or `undefined`. */\nexport const signAbbr = (name: string | undefined | null): string | undefined =>\n\tresolve(SIGN_ABBR, name);\n\n/** The twelve signs in zodiacal order. Display values, not lookup keys: read them through {@link signGlyph} / {@link signAbbr}. */\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 * Glyph per aspect. Used by the natal, transit and synastry aspect tables.\n *\n * @remarks\n * These are the nine aspects Unicode itself defines as a set, in its Miscellaneous Symbols block note: `260C, 26BA, 2220, 26B9, 25A1, 25B3, 26BC, 26BB, 260D` for 0, 30, 45, 60, 90, 120, 135, 150 and 180 degrees. That is exactly the vocabulary the API returns, so every aspect resolves to a real glyph and none falls through to a truncated slug.\n *\n * Do not substitute the visually similar maths operators. Unicode lists `\u22BB` XOR and `\u22BC` NAND as cross-references FROM the real quincunx and semisextile glyphs, so they look like safe stand-ins and are easy to pair the wrong way round, which renders a 150 degree quincunx with the 30 degree semisextile symbol. An astrologer reads the glyph, not the tooltip.\n */\nconst ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\tsemisextile: '\u26BA',\n\t'semi sextile': '\u26BA',\n\tsemisquare: '\u2220',\n\t'semi square': '\u2220',\n\tsextile: '\u26B9',\n\tsquare: '\u25A1',\n\ttrine: '\u25B3',\n\tsesquiquadrate: '\u26BC',\n\tquincunx: '\u26BB',\n\topposition: '\u260D',\n};\n\n/** Aspect glyph for any of the separator forms the endpoints use (`SEMI_SEXTILE`, `SEMI SEXTILE`, `semi-sextile`), or `undefined`. */\nexport const aspectSymbol = (\n\tname: string | undefined | null,\n): string | undefined => resolve(ASPECT_SYMBOL, name);\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nconst 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};\n\n/** Trigram glyph for a trigram name in any case, or `undefined`. */\nexport const trigramGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(TRIGRAM_GLYPH, name);\n\n/** Moon phase emoji set. Used by the moon phase card. */\nconst 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\n/**\n * Emoji for a lunar phase, or `undefined`.\n *\n * @remarks\n * The live API suffixes most phase names (`Waxing Gibbous Moon`) and calls the third quarter `Third Quarter Moon`, while only new and full moon carry the suffix in the table. Both reconciliations live here rather than in the card, so any component reading a phase name resolves the same eight phases from the same four spellings.\n */\nexport const moonPhaseEmoji = (\n\tname: string | undefined | null,\n): string | undefined => {\n\tif (!name) return undefined;\n\tconst key = lookupKey(name);\n\tconst bare = key.replace(/ moon$/, '');\n\tconst alias = bare === 'third quarter' ? 'last quarter' : bare;\n\treturn MOON_PHASE_EMOJI[key] ?? MOON_PHASE_EMOJI[alias];\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}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif))}@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-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "import type { TemplateResult } from 'lit';\nimport { css, html } from 'lit';\n\n/**\n * Disclosure chevron for `<details>`/`<summary>` accordions. Replaces the\n * browser default triangle with a thin chevron that rotates when the host\n * `<details>` opens. Render it inside the `<summary>` and pair with\n * {@link disclosureStyles}.\n */\nexport function chevron(): TemplateResult {\n\treturn html`<svg class=\"roxy-chevron\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\"><path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n}\n\n/**\n * Shared `<details>` accordion styling: hides the native disclosure triangle\n * and rotates the {@link chevron} 180 degrees when the accordion is open.\n * Import into any component that renders disclosure accordions so the chevron\n * looks and behaves identically.\n */\nexport const disclosureStyles = css`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;\n", "/**\n * Pure, framework-free schema layer shared by the self-fetch form. It turns one OpenAPI operation into a digested list of {@link FieldDef}s whose {@link InputKind} decides which input widget renders, with zero Lit or DOM dependency so the build-time slice generator ({@link ../../../scripts/build-schemas.ts}) and the taxonomy-coverage test consume the exact same classification the browser does.\n *\n * @remarks\n * The registry is by SHAPE, never by name: {@link classifyInput} inspects `enum` / `type` / `format` only, so a new API parameter gets a working widget with no code change, and the taxonomy gate fails loudly (via a `null` return) the day a genuinely new shape appears. Name-driven behaviour (suppressing `lang`, hiding `seed` / `limit` / `offset`, replacing the latitude+longitude+timezone trio with a city search) is a separate render-time concern layered on top by the form, never encoded here.\n */\n\nimport { SIGNS_ORDER } from '../tokens/index.js';\nimport { humanize } from './string.js';\n\n/** A JSON `$ref` node, before resolution against `components.schemas`. */\nexport interface OpenApiSchemaRef {\n\t$ref?: string;\n}\n\n/** The subset of an OpenAPI 3 schema object the form reads. */\nexport interface OpenApiSchema extends OpenApiSchemaRef {\n\t/** A plain name in 3.0, or an ARRAY in 3.1 where nullability is spelled `['number', 'null']`. Read it through {@link scalarType}, never compare it directly. */\n\ttype?: string | string[];\n\tformat?: string;\n\tdescription?: string;\n\tenum?: string[];\n\tdefault?: unknown;\n\tminimum?: number;\n\tmaximum?: number;\n\tproperties?: Record<string, OpenApiSchema>;\n\trequired?: string[];\n\titems?: OpenApiSchema;\n\texample?: unknown;\n\tanyOf?: OpenApiSchema[];\n\toneOf?: OpenApiSchema[];\n}\n\n/** One operation's request shape, as read from `spec.paths[path][method]`. */\nexport interface OperationSchema {\n\tsummary?: string;\n\trequestBody?: {\n\t\tcontent?: Record<string, { schema?: OpenApiSchema | OpenApiSchemaRef }>;\n\t};\n\tparameters?: Array<{\n\t\tname: string;\n\t\tin: string;\n\t\trequired?: boolean;\n\t\tschema?: OpenApiSchema;\n\t}>;\n}\n\n/** The minimal OpenAPI document surface the form introspects. */\nexport interface OpenApiDoc {\n\tpaths?: Record<string, Record<string, unknown>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/** The fully typed spec document the build-time scripts read from the committed `specs/openapi.json`: every path item value is an {@link OperationSchema}. The runtime form keeps the looser {@link OpenApiDoc} because a live spec fetch is untrusted input it narrows per operation. */\nexport interface SpecDoc {\n\tpaths: Record<string, Record<string, OperationSchema>>;\n\tcomponents?: { schemas?: Record<string, OpenApiSchema> };\n}\n\n/**\n * The widget kind a parameter resolves to. This is the closed set the taxonomy gate enforces: every request parameter in the spec MUST classify to one of these, or {@link classifyInput} returns `null` and the gate fails, forcing a conscious decision when the API grows a new shape.\n */\nexport type InputKind =\n\t| 'tiles'\n\t| 'select'\n\t| 'toggle'\n\t| 'date'\n\t| 'time'\n\t| 'datetime'\n\t| 'number'\n\t| 'text'\n\t| 'array';\n\n/** A single input the form renders, digested from one schema property or parameter. */\nexport interface FieldDef {\n\t/** Unique storage + input key: the property name, or \"group.name\" for a nested object field. */\n\tkey: string;\n\t/** Schema property name (the label source), e.g. \"date\". */\n\tname: string;\n\t/** Parent object key for a nested schema (person1/person2); undefined for a flat field. */\n\tgroup?: string;\n\t/** True when the spec declares the field as `in: query`, so it belongs in the query string even on a POST. */\n\tinQuery?: boolean;\n\t/** The resolved widget kind. */\n\tkind: InputKind;\n\trequired: boolean;\n\tdescription?: string;\n\tenum?: string[];\n\tmin?: number;\n\tmax?: number;\n\tdefault?: unknown;\n\t/** Spec `example`, used as the placeholder for a text input. */\n\texample?: unknown;\n}\n\n/** The digested form model for one operation. The build-time slice is exactly this shape. */\nexport interface FormModel {\n\t/** Concise heading derived from the operation summary, falling back to the path. */\n\ttitle: string;\n\t/** Every rendered field. The `lang` query parameter is intentionally excluded (routed via the element `lang` attribute instead). */\n\tfields: FieldDef[];\n\t/** True when the operation carries a `lang` query parameter, so the form knows to route an effective language to the query string on submit. */\n\thasLang: boolean;\n}\n\n/** At most this many enum options render as a tile/chip picker; above it a filterable select is used instead. */\nexport const TILE_MAX = 12;\n\n/** The latitude+longitude+timezone trio the form suppresses in favour of a city search. Centralised so the render path and tests agree. */\nexport const LOCATION_TRIO = ['latitude', 'longitude', 'timezone'] as const;\n\n/**\n * The coordinate pair that DEFINES a location group. `timezone` is deliberately absent.\n *\n * @remarks\n * A group qualifies for a city search on latitude+longitude alone, because a timezone is not always\n * part of the group that owns the coordinates: `generateRelocationChart` carries two coordinate\n * pairs and exactly ONE top-level `timezone`, which is the BIRTH timezone (relocating does not move\n * the birth moment), so the relocation pair correctly has no timezone of its own. Requiring all\n * three would leave that operation rendering raw number inputs, which is the bug this exists to\n * prevent.\n */\nexport const LOCATION_PAIR = ['latitude', 'longitude'] as const;\n\n/**\n * Split a flat coordinate property into its group prefix and canonical leaf name, or `null` when the\n * name is not a prefixed coordinate.\n *\n * @remarks\n * **Two shapes carry two locations in one request and this handles the second one.** Most\n * multi-location operations nest per person (`person1`/`person2`, `personA`/`personB`), so object\n * nesting alone already groups them. `generateRelocationChart` is the only operation in the spec\n * that instead puts both pairs at the TOP level and distinguishes them by a name prefix\n * (`birthLatitude` / `relocationLatitude`). Keying the grouping off the prefix as well as off the\n * nesting means both shapes converge on the same group machinery, and a future `partnerLatitude`\n * needs no code change.\n *\n * Matching is deliberately restricted to the coordinate pair. A prefix is NOT harvested from any\n * other field name, so `birthDate` stays an ordinary field in the flat group and does not invent a\n * phantom `birth` group with a lone date in it.\n */\nexport function splitCoordinateName(\n\tname: string,\n): { group: string; leaf: (typeof LOCATION_PAIR)[number] } | null {\n\tconst m = name.match(/^(.+?)(Latitude|Longitude)$/);\n\tif (!m) return null;\n\treturn {\n\t\tgroup: m[1],\n\t\tleaf: m[2].toLowerCase() as (typeof LOCATION_PAIR)[number],\n\t};\n}\n\n/** Canonical lowercase zodiac set, derived from {@link SIGNS_ORDER} so sign detection and the glyph map can never disagree. */\nconst ZODIAC_LOWER = SIGNS_ORDER.map((s) => s.toLowerCase());\n\n/** Resolve a `$ref` (one hop is all the spec uses) against the schema map; pass non-refs through. */\nexport function resolveSchema(\n\tschema: OpenApiSchema | OpenApiSchemaRef | undefined,\n\tall: Record<string, OpenApiSchema>,\n): OpenApiSchema | undefined {\n\tif (!schema) return undefined;\n\tif ('$ref' in schema && schema.$ref) {\n\t\tconst name = schema.$ref.split('/').pop();\n\t\treturn name ? all[name] : undefined;\n\t}\n\treturn schema as OpenApiSchema;\n}\n\n/**\n * Collapse an `anyOf`/`oneOf` union to the single member that decides the widget: an enum member wins (so `houseSystem` as enum-or-string renders as a picker), then any concrete-typed member (so timezone as number-or-string resolves to a real kind), else the first member. Non-union schemas pass through untouched.\n */\nfunction representative(s: OpenApiSchema): OpenApiSchema {\n\tconst union = s.anyOf ?? s.oneOf;\n\tif (!union || union.length === 0) return s;\n\treturn (\n\t\tunion.find((m) => Array.isArray(m.enum)) ??\n\t\tunion.find((m) => scalarType(m) && scalarType(m) !== 'null') ??\n\t\tunion[0] ??\n\t\ts\n\t);\n}\n\n/**\n * Map one resolved schema to its {@link InputKind}, or `null` when the shape is genuinely unhandled. The form treats `null` as a plain text fallback (never crashes); the taxonomy gate treats it as a failure (forces a decision). Object schemas are never passed here: an object with `properties` expands into a group of leaf fields upstream, so it has no leaf kind of its own.\n */\n/**\n * The single scalar type name a schema resolves to, across both OpenAPI spellings.\n *\n * @remarks\n * OpenAPI 3.1 expresses a nullable scalar as `type: ['number', 'null']` where 3.0 wrote `type: 'number', nullable: true`. Every direct `type === 'number'` comparison silently stops matching the day the served document switches, and the field then classifies as UNHANDLED rather than as a number, which is how a whole form degrades to text boxes without one test noticing. The `null` member carries no input information, so the remaining single member IS the type.\n */\nexport function scalarType(s: OpenApiSchema): string | undefined {\n\tif (typeof s.type === 'string') return s.type;\n\tif (!Array.isArray(s.type)) return undefined;\n\tconst real = s.type.filter((t) => t !== 'null');\n\treturn real.length === 1 ? real[0] : undefined;\n}\n\nexport function classifyInput(schema: OpenApiSchema): InputKind | null {\n\tconst s = representative(schema);\n\tconst type = scalarType(s);\n\tif (Array.isArray(s.enum))\n\t\treturn s.enum.length <= TILE_MAX ? 'tiles' : 'select';\n\tif (type === 'boolean') return 'toggle';\n\tif (s.format === 'date') return 'date';\n\tif (s.format === 'time') return 'time';\n\tif (s.format === 'date-time') return 'datetime';\n\tif (type === 'integer' || type === 'number') return 'number';\n\tif (type === 'string') return 'text';\n\tif (type === 'array') return 'array';\n\treturn null;\n}\n\n/** True when an enum's values are exactly the twelve zodiac signs (case-insensitive), so the tiles can carry sign glyphs. */\nexport function isZodiacEnum(values: readonly string[]): boolean {\n\tif (values.length !== 12) return false;\n\tconst lower = new Set(values.map((v) => v.toLowerCase()));\n\treturn ZODIAC_LOWER.every((s) => lower.has(s));\n}\n\n/** One digested leaf field from a resolved schema. Shared by the flat and grouped construction paths so params and body props carry identical metadata (min/max included). */\nfunction toField(\n\tname: string,\n\tresolved: OpenApiSchema,\n\topts: { key: string; group?: string; required: boolean; inQuery?: boolean },\n): FieldDef {\n\tconst rep = representative(resolved);\n\treturn {\n\t\tkey: opts.key,\n\t\tname,\n\t\tgroup: opts.group,\n\t\tinQuery: opts.inQuery,\n\t\tkind: classifyInput(resolved) ?? 'text',\n\t\trequired: opts.required,\n\t\tdescription: rep.description ?? resolved.description,\n\t\tenum: rep.enum,\n\t\tmin: rep.minimum,\n\t\tmax: rep.maximum,\n\t\tdefault: resolved.default ?? rep.default,\n\t\texample: resolved.example ?? rep.example,\n\t};\n}\n\n/**\n * Digest one operation into the {@link FormModel} the form renders. This is the single construction path: body properties (nested objects expand to `group.sub` keys) and path+query parameters flow through {@link toField} identically, so a query integer keeps its min/max the same as a body integer. The `lang` query parameter is dropped from `fields` and surfaced as {@link FormModel.hasLang} instead.\n */\nexport function buildFormModel(\n\top: OperationSchema,\n\tschemas: Record<string, OpenApiSchema>,\n\tendpoint: string,\n): FormModel {\n\tconst fields: FieldDef[] = [];\n\tlet hasLang = false;\n\n\tconst bodyRef = op.requestBody?.content?.['application/json']?.schema;\n\tconst bodySchema = resolveSchema(bodyRef, schemas);\n\tif (bodySchema?.properties) {\n\t\tconst required = new Set(bodySchema.required ?? []);\n\t\tfor (const [name, sub] of Object.entries(bodySchema.properties)) {\n\t\t\tconst resolved = resolveSchema(sub, schemas) ?? {};\n\t\t\tif (resolved.type === 'object' && resolved.properties) {\n\t\t\t\tconst subRequired = new Set(resolved.required ?? []);\n\t\t\t\tfor (const [subName, subSchema] of Object.entries(\n\t\t\t\t\tresolved.properties,\n\t\t\t\t)) {\n\t\t\t\t\tconst r = resolveSchema(subSchema, schemas) ?? {};\n\t\t\t\t\tfields.push(\n\t\t\t\t\t\ttoField(subName, r, {\n\t\t\t\t\t\t\tkey: `${name}.${subName}`,\n\t\t\t\t\t\t\tgroup: name,\n\t\t\t\t\t\t\trequired: required.has(name) && subRequired.has(subName),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// A prefixed coordinate joins a group named after its prefix and reports the\n\t\t\t\t// canonical leaf name, so the trio logic and the city search match it unchanged.\n\t\t\t\t// `key` stays the ORIGINAL property name because it is the storage and wire\n\t\t\t\t// identity: rewriting it to `birth.latitude` would serialise a body the API\n\t\t\t\t// rejects.\n\t\t\t\tconst coord = splitCoordinateName(name);\n\t\t\t\tfields.push(\n\t\t\t\t\tcoord\n\t\t\t\t\t\t? toField(coord.leaf, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\tgroup: coord.group,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: toField(name, resolved, {\n\t\t\t\t\t\t\t\tkey: name,\n\t\t\t\t\t\t\t\trequired: required.has(name),\n\t\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const param of op.parameters ?? []) {\n\t\tif (param.in !== 'path' && param.in !== 'query') continue;\n\t\t// lang is site-owner chrome, not a visitor field: route it through the\n\t\t// element `lang` attribute, never render it in the form.\n\t\tif (param.name === 'lang' && param.in === 'query') {\n\t\t\thasLang = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst resolved = resolveSchema(param.schema, schemas) ?? {};\n\t\tfields.push(\n\t\t\ttoField(param.name, resolved, {\n\t\t\t\tkey: param.name,\n\t\t\t\trequired: !!param.required,\n\t\t\t\tinQuery: param.in === 'query',\n\t\t\t}),\n\t\t);\n\t}\n\n\treturn { title: deriveTitle(op.summary, endpoint), fields, hasLang };\n}\n\n/**\n * Concise form heading. Prefers the operation summary (spec-authored), taking the clause before the first \" - \" so \"Daily horoscope by zodiac sign - Transit-based forecast\" reads as \"Daily horoscope by zodiac sign\", and falls back to the humanized last path segment.\n */\nexport function deriveTitle(\n\tsummary: string | undefined,\n\tendpoint: string,\n): string {\n\tconst lead = summary?.split(' - ')[0]?.trim();\n\tif (lead) return lead;\n\treturn humanize(endpoint.split('/').pop() ?? '');\n}\n\n/**\n * Outcome-first submit-button label keyed off the endpoint intent. Chart and reading endpoints \"Generate\", divination endpoints \"Cast\", comparison endpoints \"Compare\", and lookup/reading GETs \"Get reading\". A generic verb beats a bare \"Submit\" on a widget a visitor never set up.\n *\n * Returns the CANONICAL English verb, which is also its catalogue key: the form translates the result rather than this function doing it, because this module is request-context-free and has no element to resolve a page language from. All four verbs live in `i18n/chrome-strings.ts`, and `tests/i18n.test.ts` runs this function over every operation in the committed spec so a fifth verb cannot be added without a catalogue entry.\n */\nexport function deriveSubmitLabel(endpoint: string): string {\n\tconst e = endpoint.toLowerCase();\n\tif (/compat|synastry|guna|connection|penta|composite/.test(e))\n\t\treturn 'Compare';\n\tif (/\\bcast\\b|\\/draw|iching|hexagram|tarot/.test(e)) return 'Cast';\n\tif (/horoscope|dream|angel|nakshatra|crystal|meaning|reference/.test(e))\n\t\treturn 'Get reading';\n\treturn 'Generate';\n}\n\n/** Deterministic slice filename for one operation, shared by the generator and the runtime loader so both address the same artifact. */\nexport function sliceFileName(method: string, endpoint: string): string {\n\tconst path = endpoint\n\t\t.replace(/^\\//, '')\n\t\t.replace(/[{}]/g, '')\n\t\t.replace(/\\//g, '-');\n\treturn `${method.toLowerCase()}--${path}.json`;\n}\n", "// Generated by scripts/sync-version.ts. Do not edit.\nexport const ROXY_UI_VERSION = '0.27.6';\n"],
5
5
  "mappings": "4MAAA,OAAS,OAAAA,GAAK,QAAAC,EAAM,WAAAC,MAAe,MACnC,OAAS,iBAAAC,GAAe,YAAAC,EAAU,SAAAC,MAAa,oBAC/C,OAAS,aAAAC,MAAiB,+BCWnB,IAAMC,EAAmC,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI,ECgBjF,SAASC,EAAYC,EAAqC,CAGhE,GAAIA,EAAG,KAAM,OAAOA,EAAG,KACvB,GAAI,OAAO,SAAa,IAAa,OACrC,IAAMC,EAAYD,EAAG,UAAU,QAAQ,GAAG,aAAa,MAAM,EAC7D,OAAIC,GACG,SAAS,gBAAgB,MAAQ,MACzC,CAWO,SAASC,EAAQF,EAAqC,CAC5D,IAAMG,EAAMJ,EAAYC,CAAE,EAC1B,GAAI,CAACG,EAAK,OACV,IAAMC,EAAOD,EAAI,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC,EAC3C,OAAOE,EAAc,SAASD,CAAI,EAAIA,EAAO,MAC9C,CCrDA,OAAS,cAAAE,OAAkB,MC6BpB,S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BAGA6E,EAAA,CADCC,EAAS,CAAE,KAAM,MAAO,CAAC,GAVd9E,EAWZ,sBAIA6E,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,UAAW,CAAC,GAdrC9E,EAeZ,uBAIA6E,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,cAAe,CAAC,GAlBzC9E,EAmBZ,2BAIA6E,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,UAAW,iBAAkB,CAAC,GAtB5C9E,EAuBZ,8BAIA6E,EAAA,CADCC,EAAS,CAAE,UAAW,EAAM,CAAC,GA1BlB9E,EA2BZ,6BAGQ6E,EAAA,CADPE,EAAM,GA7BK/E,EA8BJ,sBAGA6E,EAAA,CADPE,EAAM,GAhCK/E,EAiCJ,yBAGA6E,EAAA,CADPE,EAAM,GAnCK/E,EAoCJ,uBAGA6E,EAAA,CADPE,EAAM,GAtCK/E,EAuCJ,sBAGA6E,EAAA,CADPE,EAAM,GAzCK/E,EA0CJ,sBAGA6E,EAAA,CADPE,EAAM,GA5CK/E,EA6CJ,yBAGA6E,EAAA,CADPE,EAAM,GA/CK/E,EAgDJ,gCAhDIA,EAAN6E,EAAA,CADNG,GAAc,oBAAoB,GACtBhF",
6
6
  "names": ["css", "html", "nothing", "customElement", "property", "state", "ifDefined", "API_LANGUAGES", "resolveLang", "el", "inherited", "apiLang", "tag", "base", "API_LANGUAGES", "LitElement", "lookupKey", "s", "humanize", "s", "c", "GLOBAL_KEY", "registry", "holder", "existing", "created", "interpolate", "template", "vars", "match", "key", "translate", "lang", "source", "catalogs", "registry", "tag", "catalog", "lookupKey", "labelsFor", "lang", "fieldLabels", "registry", "tag", "fieldLabel", "name", "optionLabel", "field", "value", "onLocaleChange", "listener", "listeners", "LocaleController", "host", "onLocaleChange", "RoxyLocalizedElement", "LitElement", "source", "vars", "LocaleController", "translate", "resolveLang", "resolve", "table", "name", "lookupKey", "SIGN_GLYPH", "signGlyph", "name", "resolve", "SIGNS_ORDER", "css", "baseStyles", "css", "html", "chevron", "disclosureStyles", "TILE_MAX", "LOCATION_TRIO", "LOCATION_PAIR", "splitCoordinateName", "name", "m", "ZODIAC_LOWER", "SIGNS_ORDER", "s", "resolveSchema", "schema", "all", "representative", "union", "scalarType", "real", "t", "classifyInput", "type", "isZodiacEnum", "values", "lower", "v", "toField", "resolved", "opts", "rep", "buildFormModel", "op", "schemas", "endpoint", "fields", "hasLang", "bodyRef", "bodySchema", "required", "sub", "subRequired", "subName", "subSchema", "r", "coord", "param", "deriveTitle", "summary", "lead", "humanize", "deriveSubmitLabel", "e", "sliceFileName", "method", "path", "ROXY_UI_VERSION", "PROD_SPEC_URL", "SLICE_BASE", "ROXY_UI_VERSION", "specCache", "SpecHttpError", "status", "SpecMissingOperationError", "method", "path", "resetSpecCache", "loadSpec", "url", "pending", "res", "err", "randomSeed", "parseArrayValue", "raw", "trimmed", "parsed", "s", "RoxyEndpointForm", "RoxyLocalizedElement", "spec", "op", "buildFormModel", "sliceFileName", "model", "init", "f", "remembered", "name", "value", "LOCATION_TRIO", "g", "keys", "group", "inGroup", "LOCATION_PAIR", "n", "own", "req", "only", "deriveSubmitLabel", "apiLang", "fieldLabel", "humanize", "field", "optionLabel", "e", "detail", "keyOf", "next", "lat", "lon", "tz", "opts", "cur", "root", "missing", "out", "v", "queryKeys", "lang", "labels", "locGroups", "isLocation", "html", "nothing", "lead", "chevron", "labelId", "zodiac", "isZodiacEnum", "active", "opt", "i", "selected", "glyph", "signGlyph", "id", "checked", "type", "placeholder", "ifDefined", "names", "fields", "flat", "flatReq", "flatOpt", "named", "reqGroups", "optGroups", "hasAdvanced", "kind", "baseStyles", "disclosureStyles", "css", "__decorateClass", "property", "state", "customElement"]
7
7
  }
@@ -75,6 +75,21 @@ export declare class RoxyEphemerisTable extends RoxyDataElement<EphemerisRespons
75
75
  heading: string;
76
76
  protected renderEmpty(): import("lit").TemplateResult<1>;
77
77
  protected renderData(data: EphemerisResponse): import("lit").TemplateResult<1>;
78
+ /**
79
+ * The glyph-to-name key, above the table it explains.
80
+ *
81
+ * @remarks
82
+ * Every position in this component prints its sign as a glyph, which is how a
83
+ * printed ephemeris prints one and is unreadable to somebody still learning
84
+ * them. The name rides on each cell's `title`, and a title is a hover: it does
85
+ * not exist on touch and it cannot be read down a column. A key that names all
86
+ * of them once is the form the page actually needed.
87
+ *
88
+ * `part="section legend"` rather than a name of its own, because a page hiding
89
+ * legends should hide this one too and the vocabulary is shared across every
90
+ * component.
91
+ */
92
+ private renderSignKey;
78
93
  /** One body across the month: where it started, where it ended, and every change in between. */
79
94
  private renderTrack;
80
95
  /**
@@ -100,6 +115,25 @@ export declare class RoxyEphemerisTable extends RoxyDataElement<EphemerisRespons
100
115
  * that one cell empty instead of shifting the row.
101
116
  */
102
117
  private toViewModel;
118
+ /**
119
+ * The signs this month's table actually prints, in zodiacal order.
120
+ *
121
+ * @remarks
122
+ * Read from the response rather than from the twelve-sign constant, so the key
123
+ * explains the glyphs ON THIS PAGE and nothing else. In practice the Moon
124
+ * crosses every sign in a month, so a full month lists all twelve anyway; a
125
+ * partial range lists only what it contains, which is the point.
126
+ *
127
+ * The label is the API's own localized sign name, taken the same way every
128
+ * other sign name in this component is taken. Translating it here instead
129
+ * would put a second vocabulary on the page and let the key disagree with the
130
+ * cells it explains.
131
+ *
132
+ * Ordered by {@link SIGNS_ORDER} because first-seen order is the order the
133
+ * bodies happen to sit in on the first of the month, which is meaningless to a
134
+ * reader learning the glyphs.
135
+ */
136
+ private toSignKey;
103
137
  }
104
138
  declare global {
105
139
  interface HTMLElementTagNameMap {
@@ -1 +1 @@
1
- {"version":3,"file":"ephemeris-table.d.ts","sourceRoot":"","sources":["../../src/components/ephemeris-table.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,2BAA2B,EAC3B,mCAAmC,EACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAoB3D;;;;;GAKG;AACH,KAAK,iBAAi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