@alfadocs/ui-kit-debug 1.12.6 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{actions-cell-renderer-DnSLrgQD.js → actions-cell-renderer-ReurEy5i.js} +2 -2
- package/dist/_chunks/{actions-cell-renderer-DnSLrgQD.js.map → actions-cell-renderer-ReurEy5i.js.map} +1 -1
- package/dist/_chunks/{address-fields-CZP4Wncx.js → address-fields-CZ0pEdEI.js} +4 -4
- package/dist/_chunks/{address-fields-CZP4Wncx.js.map → address-fields-CZ0pEdEI.js.map} +1 -1
- package/dist/_chunks/{ai-prompt-input-DnbfEJnr.js → ai-prompt-input-CrHr-5H8.js} +2 -2
- package/dist/_chunks/{ai-prompt-input-DnbfEJnr.js.map → ai-prompt-input-CrHr-5H8.js.map} +1 -1
- package/dist/_chunks/{anamnesis-summary-rows-BfhxWPO3.js → anamnesis-summary-rows-CRWO8x8g.js} +4 -4
- package/dist/_chunks/{anamnesis-summary-rows-BfhxWPO3.js.map → anamnesis-summary-rows-CRWO8x8g.js.map} +1 -1
- package/dist/_chunks/{audio-recorder-EWBCNIsd.js → audio-recorder-DXG6LTtO.js} +2 -2
- package/dist/_chunks/{audio-recorder-EWBCNIsd.js.map → audio-recorder-DXG6LTtO.js.map} +1 -1
- package/dist/_chunks/{autocomplete-BrONKN8l.js → autocomplete-MpBhz-fG.js} +86 -74
- package/dist/_chunks/{autocomplete-BrONKN8l.js.map → autocomplete-MpBhz-fG.js.map} +1 -1
- package/dist/_chunks/{balance-badge-cell-7L6nzB29.js → balance-badge-cell--iQ_gtmi.js} +4 -4
- package/dist/_chunks/{balance-badge-cell-7L6nzB29.js.map → balance-badge-cell--iQ_gtmi.js.map} +1 -1
- package/dist/_chunks/{bishop-score-Cnu0xs-z.js → bishop-score-CJUVBfAu.js} +2 -2
- package/dist/_chunks/{bishop-score-Cnu0xs-z.js.map → bishop-score-CJUVBfAu.js.map} +1 -1
- package/dist/_chunks/{booking-CBHKdsZl.js → booking-DQbo6mQF.js} +609 -591
- package/dist/_chunks/booking-DQbo6mQF.js.map +1 -0
- package/dist/_chunks/{care-plan-card-aDN4oem9.js → care-plan-card-D-FMfDKH.js} +2 -2
- package/dist/_chunks/{care-plan-card-aDN4oem9.js.map → care-plan-card-D-FMfDKH.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-BEhANdBE.js → care-plan-entry-card-Bvw_9T-d.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-BEhANdBE.js.map → care-plan-entry-card-Bvw_9T-d.js.map} +1 -1
- package/dist/_chunks/{care-plan-header-CkpPyQqG.js → care-plan-header-B5CBE0zu.js} +2 -2
- package/dist/_chunks/{care-plan-header-CkpPyQqG.js.map → care-plan-header-B5CBE0zu.js.map} +1 -1
- package/dist/_chunks/{city-input-towzBenY.js → city-input-DaQc-Hbj.js} +2 -2
- package/dist/_chunks/{city-input-towzBenY.js.map → city-input-DaQc-Hbj.js.map} +1 -1
- package/dist/_chunks/{combobox-DiMLItyu.js → combobox-D7_NLE2Z.js} +89 -81
- package/dist/_chunks/{combobox-DiMLItyu.js.map → combobox-D7_NLE2Z.js.map} +1 -1
- package/dist/_chunks/{contact-profile-card-BMIBr5s9.js → contact-profile-card-BZqi8Hck.js} +38 -36
- package/dist/_chunks/{contact-profile-card-BMIBr5s9.js.map → contact-profile-card-BZqi8Hck.js.map} +1 -1
- package/dist/_chunks/{country-select-UEF9BEeQ.js → country-select-DzbPFktV.js} +2 -2
- package/dist/_chunks/{country-select-UEF9BEeQ.js.map → country-select-DzbPFktV.js.map} +1 -1
- package/dist/_chunks/{document-preview-oyx9RhCo.js → document-preview-CDb-n_W7.js} +2 -2
- package/dist/_chunks/{document-preview-oyx9RhCo.js.map → document-preview-CDb-n_W7.js.map} +1 -1
- package/dist/_chunks/{face-scheme-CZaKm6fG.js → face-scheme-DA2vjqaM.js} +2 -2
- package/dist/_chunks/{face-scheme-CZaKm6fG.js.map → face-scheme-DA2vjqaM.js.map} +1 -1
- package/dist/_chunks/{file-manager-C0y7HBAN.js → file-manager-UsD8e_AB.js} +2 -2
- package/dist/_chunks/{file-manager-C0y7HBAN.js.map → file-manager-UsD8e_AB.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-CxZelpu2.js → gestational-age-calculator-CiOQjzgx.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-CxZelpu2.js.map → gestational-age-calculator-CiOQjzgx.js.map} +1 -1
- package/dist/_chunks/key-value-pair-BIBdZBLg.js +188 -0
- package/dist/_chunks/key-value-pair-BIBdZBLg.js.map +1 -0
- package/dist/_chunks/{link-cell-renderer-CenJx-_7.js → link-cell-renderer-CIASXsVM.js} +4 -4
- package/dist/_chunks/{link-cell-renderer-CenJx-_7.js.map → link-cell-renderer-CIASXsVM.js.map} +1 -1
- package/dist/_chunks/{multi-select-DqL4o0qV.js → multi-select-DYOvx2SJ.js} +56 -48
- package/dist/_chunks/{multi-select-DqL4o0qV.js.map → multi-select-DYOvx2SJ.js.map} +1 -1
- package/dist/_chunks/{muscle-scheme-yfzP_xoJ.js → muscle-scheme-BSJsI4-I.js} +2 -2
- package/dist/_chunks/{muscle-scheme-yfzP_xoJ.js.map → muscle-scheme-BSJsI4-I.js.map} +1 -1
- package/dist/_chunks/{optical-prescription-Dj3Eh5Ok.js → optical-prescription-BvwuqTpl.js} +2 -2
- package/dist/_chunks/{optical-prescription-Dj3Eh5Ok.js.map → optical-prescription-BvwuqTpl.js.map} +1 -1
- package/dist/_chunks/{patient-details-xrqe13az.js → patient-details-BQaUzPqp.js} +5 -5
- package/dist/_chunks/{patient-details-xrqe13az.js.map → patient-details-BQaUzPqp.js.map} +1 -1
- package/dist/_chunks/{patient-search-D5ufYoRc.js → patient-search-HeEUB-_X.js} +2 -2
- package/dist/_chunks/{patient-search-D5ufYoRc.js.map → patient-search-HeEUB-_X.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-CBfuDvJ5.js → patient-summary-card-CvDxhbBR.js} +2 -2
- package/dist/_chunks/{patient-summary-card-CBfuDvJ5.js.map → patient-summary-card-CvDxhbBR.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-YVCcCZ25.js → payment-request-card-lmKLwsDs.js} +2 -2
- package/dist/_chunks/{payment-request-card-YVCcCZ25.js.map → payment-request-card-lmKLwsDs.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-BatZEFar.js → periodontal-chart-B9fphroR.js} +2 -2
- package/dist/_chunks/{periodontal-chart-BatZEFar.js.map → periodontal-chart-B9fphroR.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-card-BBpY_rBc.js → periodontal-chart-card-qEZPXj83.js} +2 -2
- package/dist/_chunks/{periodontal-chart-card-BBpY_rBc.js.map → periodontal-chart-card-qEZPXj83.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-DtToyMyc.js → pregnancy-dating-D2wchD11.js} +2 -2
- package/dist/_chunks/{pregnancy-dating-DtToyMyc.js.map → pregnancy-dating-D2wchD11.js.map} +1 -1
- package/dist/_chunks/{province-select-BDywtmL-.js → province-select-BBc7s7vR.js} +2 -2
- package/dist/_chunks/{province-select-BDywtmL-.js.map → province-select-BBc7s7vR.js.map} +1 -1
- package/dist/_chunks/{select-BW5ecXlX.js → select-Bi8zril7.js} +165 -136
- package/dist/_chunks/select-Bi8zril7.js.map +1 -0
- package/dist/_chunks/{signature-request-DVDTKLjM.js → signature-request-CUe903hj.js} +2 -2
- package/dist/_chunks/{signature-request-DVDTKLjM.js.map → signature-request-CUe903hj.js.map} +1 -1
- package/dist/_chunks/{tabs-CBb2AidH.js → tabs-DqKtTIjZ.js} +2 -2
- package/dist/_chunks/{tabs-CBb2AidH.js.map → tabs-DqKtTIjZ.js.map} +1 -1
- package/dist/_chunks/{tasks-panel-Do5SFp-j.js → tasks-panel-DPCNaRko.js} +2 -2
- package/dist/_chunks/{tasks-panel-Do5SFp-j.js.map → tasks-panel-DPCNaRko.js.map} +1 -1
- package/dist/_chunks/{tooth-scheme-WdyVymQ1.js → tooth-scheme-2IsmbE6w.js} +2 -2
- package/dist/_chunks/{tooth-scheme-WdyVymQ1.js.map → tooth-scheme-2IsmbE6w.js.map} +1 -1
- package/dist/_chunks/{unit-converter-BPumXMA6.js → unit-converter-C6jMjqL9.js} +2 -2
- package/dist/_chunks/{unit-converter-BPumXMA6.js.map → unit-converter-C6jMjqL9.js.map} +1 -1
- package/dist/_chunks/{workflow-map-DE_ribRM.js → workflow-map-wcw3t6g4.js} +2 -2
- package/dist/_chunks/{workflow-map-DE_ribRM.js.map → workflow-map-wcw3t6g4.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/option.d.ts +1 -0
- package/dist/components/_shared/option.d.ts.map +1 -1
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/ai-prompt-input/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/bishop-score/index.js +1 -1
- package/dist/components/booking/booking.d.ts.map +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/care-plan-header/index.js +1 -1
- package/dist/components/city-input/index.js +1 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/country-select/index.js +1 -1
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/key-value-pair/index.js +1 -1
- package/dist/components/key-value-pair/key-value-pair.d.ts +16 -0
- package/dist/components/key-value-pair/key-value-pair.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/muscle-scheme/index.js +1 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/periodontal-chart/index.js +1 -1
- package/dist/components/periodontal-chart-card/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/province-select/index.js +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/select.d.ts +24 -0
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/skeleton-scheme/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/components/tooth-scheme/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/index.js +40 -40
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/signature-request/index.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/booking-CBHKdsZl.js.map +0 -1
- package/dist/_chunks/key-value-pair-BubG4fUa.js +0 -144
- package/dist/_chunks/key-value-pair-BubG4fUa.js.map +0 -1
- package/dist/_chunks/select-BW5ecXlX.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { c as He } from "./index-D2ZczOXr.js";
|
|
|
4
4
|
import { useTranslation as Fe } from "react-i18next";
|
|
5
5
|
import { u as qe } from "./registry-DvAUVLHh.js";
|
|
6
6
|
import { N as se } from "./number-input-Cgu2TtA8.js";
|
|
7
|
-
import { S as he } from "./select-
|
|
7
|
+
import { S as he } from "./select-Bi8zril7.js";
|
|
8
8
|
import { T as Ke } from "./text-area-Bt3p7Pt0.js";
|
|
9
9
|
import { D as v } from "./description-list-CjJqR8WK.js";
|
|
10
10
|
const ye = {
|
|
@@ -1257,4 +1257,4 @@ export {
|
|
|
1257
1257
|
yt as y,
|
|
1258
1258
|
Re as z
|
|
1259
1259
|
};
|
|
1260
|
-
//# sourceMappingURL=optical-prescription-
|
|
1260
|
+
//# sourceMappingURL=optical-prescription-BvwuqTpl.js.map
|
package/dist/_chunks/{optical-prescription-Dj3Eh5Ok.js.map → optical-prescription-BvwuqTpl.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optical-prescription-Dj3Eh5Ok.js","sources":["../../src/components/optical-prescription/optical-prescription.agent.ts","../../src/components/optical-prescription/optical-prescription-data.ts","../../src/components/optical-prescription/optical-prescription-charts.tsx","../../src/components/optical-prescription/optical-prescription.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { OpticalPrescriptionHandle } from './optical-prescription';\nimport type {\n DistanceBand,\n Eye,\n OpticalPrescriptionValue,\n PrismBase,\n RefractionRow,\n} from './optical-prescription-data';\n\n// JSON-Schema fragments derived from the data-model unions. Kept inline so the\n// adapter stays a pure module with no runtime import of the unions.\nconst EYE_SCHEMA = {\n enum: ['od', 'os'],\n description: 'Eye — `od` (right eye) or `os` (left eye).',\n} as const;\nconst BAND_SCHEMA = {\n enum: ['far', 'intermediate', 'near'],\n description:\n 'Distance band — `far` (per lontano), `intermediate`, `near` (per vicino).',\n} as const;\nconst FIELD_SCHEMA = {\n enum: ['sphere', 'cylinder', 'axis', 'add', 'prism', 'base'],\n description:\n 'Refraction column — dioptric `sphere` / `cylinder` / `add` (0.25 steps), `axis` (0–180°), `prism`, or `base` (a direction enum).',\n} as const;\nconst ROW_SCHEMA = {\n type: 'object',\n properties: {\n sphere: { type: 'number' },\n cylinder: { type: 'number' },\n axis: { type: 'number', minimum: 0, maximum: 180 },\n add: { type: 'number' },\n prism: { type: 'number' },\n base: { enum: ['up', 'down', 'in', 'out'] },\n },\n} as const;\nconst VALUE_SCHEMA = {\n type: 'object',\n properties: {\n bands: {\n type: 'object',\n description:\n 'Refraction rows keyed by band (`far` / `intermediate` / `near`) then eye (`od` / `os`).',\n },\n pd: { type: 'number', description: 'Interpupillary distance, mm.' },\n pdRight: {\n type: 'number',\n description: 'Monocular PD, nose centre → OD pupil, mm.',\n },\n pdLeft: {\n type: 'number',\n description: 'Monocular PD, nose centre → OS pupil, mm.',\n },\n lensType: { enum: ['single-vision', 'bifocal', 'progressive'] },\n axisSystem: { enum: ['tabo', 'int'] },\n notes: { type: 'string', description: 'Free-text note — PHI.' },\n },\n required: ['bands'],\n} as const;\n\nexport const opticalPrescriptionAgent: AgentAdapter<OpticalPrescriptionHandle> =\n {\n id: 'optical-prescription',\n // pick — focus an eye row (`focus_eye`, transient, not persisted);\n // edit_inline — `set_cell` edits one refraction cell; set_value — `set_value`\n // replaces the whole prescription.\n capabilities: ['pick', 'edit_inline', 'set_value'],\n state: {\n prescription: {\n // A9: the always-on snapshot carries the refraction numbers + view\n // metadata (PD, lens type, axis system) only — NEVER the free-text\n // clinical note (PHI). The note is fetched deliberately via get_notes\n // (safety: 'phi').\n type: 'object',\n descriptionKey: 'ui.agent.opticalPrescription.state.prescription',\n description:\n 'Current prescription — refraction rows per band/eye plus PD, lens type and axis system. The free-text note is PHI and omitted; read it via get_notes.',\n read: (handle) => {\n // Explicitly project the note-free fields so the PHI note can never\n // leak into the always-on snapshot, even as the value model grows.\n const v = handle.getValue();\n return {\n bands: v.bands,\n pd: v.pd,\n pdRight: v.pdRight,\n pdLeft: v.pdLeft,\n lensType: v.lensType,\n axisSystem: v.axisSystem,\n };\n },\n },\n bands: {\n type: 'string[]',\n descriptionKey: 'ui.agent.opticalPrescription.state.bands',\n description:\n 'Distance bands carrying at least one refraction value (far / intermediate / near).',\n read: (handle) => handle.getBands(),\n },\n },\n actions: {\n focus_eye: {\n safety: 'read',\n argsType: '{ eye: Eye; band?: DistanceBand }',\n argsSchema: {\n type: 'object',\n properties: { eye: EYE_SCHEMA, band: BAND_SCHEMA },\n required: ['eye'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.focusEye',\n description:\n \"Move focus to an eye's row (first editable cell in interactive mode), optionally within a specific band.\",\n invoke: (handle, args: { eye: Eye; band?: DistanceBand }) => {\n handle.focusEye(args.eye, args.band);\n },\n },\n get_row: {\n safety: 'read',\n argsType: '{ band: DistanceBand; eye: Eye }',\n argsSchema: {\n type: 'object',\n properties: { band: BAND_SCHEMA, eye: EYE_SCHEMA },\n required: ['band', 'eye'],\n },\n returns: 'RefractionRow | undefined',\n returnsSchema: ROW_SCHEMA,\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.getRow',\n description: \"Read one eye's refraction row at a distance band.\",\n invoke: (handle, args: { band: DistanceBand; eye: Eye }) =>\n handle.getRow(args.band, args.eye),\n },\n get_notes: {\n // phi (not read): resolves the free-text clinical note, which is PHI.\n // PRS §26 — phi outranks read so the host gates it behind stricter\n // confirm + audit. The always-on state.prescription snapshot stays\n // note-free.\n safety: 'phi',\n returns: 'string',\n returnsSchema: { type: 'string' },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.getNotes',\n description: 'Read the free-text clinical note on the prescription.',\n invoke: (handle) => handle.getValue().notes ?? '',\n },\n set_cell: {\n safety: 'write',\n argsType:\n '{ band: DistanceBand; eye: Eye; field: keyof RefractionRow; value: number | PrismBase | null }',\n argsSchema: {\n type: 'object',\n properties: {\n band: BAND_SCHEMA,\n eye: EYE_SCHEMA,\n field: FIELD_SCHEMA,\n value: {\n description:\n 'New cell value — a number for the dioptric/axis/prism columns, a base-direction string for `base`, or null to clear.',\n },\n },\n required: ['band', 'eye', 'field', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.setCell',\n description:\n 'Set (or clear, with null) a single refraction cell — sphere / cylinder / axis / add / prism / base.',\n invoke: (\n handle,\n args: {\n band: DistanceBand;\n eye: Eye;\n field: keyof RefractionRow;\n value: number | PrismBase | null;\n },\n ) => {\n handle.setCell(args.band, args.eye, args.field, args.value);\n },\n },\n set_value: {\n safety: 'write',\n argsType: '{ value: OpticalPrescriptionValue }',\n argsSchema: {\n type: 'object',\n properties: { value: VALUE_SCHEMA },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.setValue',\n description: 'Replace the entire prescription value.',\n invoke: (handle, args: { value: OpticalPrescriptionValue }) => {\n handle.setValue(args.value);\n },\n },\n clear_band: {\n safety: 'destructive',\n argsType: '{ band: DistanceBand }',\n argsSchema: {\n type: 'object',\n properties: { band: BAND_SCHEMA },\n required: ['band'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.clearBand',\n description: 'Clear every refraction row in a distance band.',\n invoke: (handle, args: { band: DistanceBand }) => {\n handle.clearBand(args.band);\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'optical-prescription' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-eye',\n description:\n 'Each refraction row carries its eye (`od` / `os`) as `data-eye` and its distance band as `data-band`; each editable cell carries the column key as `data-field`. The root `data-mode` attribute exposes interactive vs display. Standard chart figures carry `data-chart` (`tabo` / `powerCross` / `pd` / `prismBase`) plus `data-eye` on the per-eye ones.',\n },\n },\n };\n\n// Re-exported for callers building typed args against the adapter.\nexport type {\n DistanceBand,\n Eye,\n OpticalPrescriptionValue,\n PrismBase,\n RefractionRow,\n};\n","/* ------------------------------------------------------------------ */\n/* OpticalPrescription — value model + formatters. */\n/* */\n/* The kit's glasses optical-prescription (\"prescrizione oculistica */\n/* occhiali\") value model. A prescription is a set of refraction rows */\n/* keyed by distance BAND (far / intermediate / near) and EYE */\n/* (od / os) plus a metadata strip (PD, lens type, axis system, free */\n/* text note). The numeric fields are dioptric (sphere / cylinder / */\n/* add, in 0.25 steps with explicit ± sign) and the axis is 0–180°. */\n/* This module is a pure data/helpers module — no React, no i18n; the */\n/* component resolves every user-visible label via `useTranslation`. */\n/* ------------------------------------------------------------------ */\n\n/* ------------------------------------------------------------------ */\n/* Core vocabulary */\n/* ------------------------------------------------------------------ */\n\n/** International Latin eye abbreviations — `od` = right eye, `os` = left eye. */\nexport type Eye = 'od' | 'os';\n\n/** Distance band — `far` (per lontano), `intermediate`, `near` (per vicino). */\nexport type DistanceBand = 'far' | 'intermediate' | 'near';\n\n/** Prism base direction. */\nexport type PrismBase = 'up' | 'down' | 'in' | 'out';\n\n/** Lens construction. */\nexport type LensType = 'single-vision' | 'bifocal' | 'progressive';\n\n/** Axis notation system — TABO (European) or INT (international). */\nexport type AxisSystem = 'tabo' | 'int';\n\n/** `'interactive'` renders editable inputs; `'display'` is a read-only grid. */\nexport type OpticalPrescriptionMode = 'interactive' | 'display';\n\n/** One eye's refraction at one distance band. All fields optional. */\nexport interface RefractionRow {\n /** Spherical power, dioptres (±, 0.25 steps). */\n sphere?: number;\n /** Cylindrical power, dioptres (±, 0.25 steps). */\n cylinder?: number;\n /** Cylinder axis, 0–180°. */\n axis?: number;\n /** Reading addition, dioptres (+, 0.25 steps). */\n add?: number;\n /** Prismatic power, prism dioptres. */\n prism?: number;\n /** Prism base direction. */\n base?: PrismBase;\n}\n\n/** A full glasses prescription. */\nexport interface OpticalPrescriptionValue {\n /** Refraction rows, keyed by band then eye. */\n bands: Partial<Record<DistanceBand, Partial<Record<Eye, RefractionRow>>>>;\n /** Interpupillary distance (DIP / PD), millimetres. */\n pd?: number;\n /** Monocular PD, right eye (nose centre → OD pupil), millimetres. */\n pdRight?: number;\n /** Monocular PD, left eye (nose centre → OS pupil), millimetres. */\n pdLeft?: number;\n /** Lens construction. */\n lensType?: LensType;\n /** Axis notation system. */\n axisSystem?: AxisSystem;\n /** Free-text clinical note. PHI — never bundle real notes in stories. */\n notes?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Closed sets + ranges */\n/* ------------------------------------------------------------------ */\n\nexport const EYES: readonly Eye[] = ['od', 'os'];\nexport const DISTANCE_BANDS: readonly DistanceBand[] = [\n 'far',\n 'intermediate',\n 'near',\n];\nexport const PRISM_BASES: readonly PrismBase[] = ['up', 'down', 'in', 'out'];\nexport const LENS_TYPES: readonly LensType[] = [\n 'single-vision',\n 'bifocal',\n 'progressive',\n];\nexport const AXIS_SYSTEMS: readonly AxisSystem[] = ['tabo', 'int'];\n\n/** The dioptric columns, in display order. `base` pairs with `prism`. */\nexport const REFRACTION_COLUMNS: readonly (keyof RefractionRow)[] = [\n 'sphere',\n 'cylinder',\n 'axis',\n 'add',\n 'prism',\n 'base',\n];\n\n/** Dioptric step for sphere / cylinder / add. */\nexport const DIOPTRE_STEP = 0.25;\n/** Sphere range, dioptres. */\nexport const SPHERE_MIN = -30;\nexport const SPHERE_MAX = 30;\n/** Cylinder range, dioptres. */\nexport const CYLINDER_MIN = -12;\nexport const CYLINDER_MAX = 12;\n/** Reading addition range, dioptres. */\nexport const ADD_MIN = 0;\nexport const ADD_MAX = 6;\n/** Axis range, degrees. */\nexport const AXIS_MIN = 0;\nexport const AXIS_MAX = 180;\nexport const AXIS_STEP = 1;\n/** Interpupillary distance range, millimetres. */\nexport const PD_MIN = 40;\nexport const PD_MAX = 85;\n/** Prism range, prism dioptres. */\nexport const PRISM_MIN = 0;\nexport const PRISM_MAX = 20;\n\n/* ------------------------------------------------------------------ */\n/* Formatters */\n/* ------------------------------------------------------------------ */\n\n/**\n * Format a number with an explicit leading sign — `+1.50`, `-2.25`. Zero is\n * rendered unsigned (`0.00`). Used for sphere and cylinder, where optometry\n * convention always shows the sign.\n */\nexport function formatSigned(value: number, fractionDigits = 2): string {\n const fixed = Math.abs(value).toFixed(fractionDigits);\n if (value > 0) return `+${fixed}`;\n if (value < 0) return `-${fixed}`;\n return fixed;\n}\n\n/** Sphere power, explicit sign, 2 dp (`+2.00` / `-1.25`). */\nexport function formatSphere(value: number): string {\n return formatSigned(value, 2);\n}\n\n/** Cylinder power, explicit sign, 2 dp. */\nexport function formatCylinder(value: number): string {\n return formatSigned(value, 2);\n}\n\n/** Reading addition — always positive, 2 dp (`+2.00`). */\nexport function formatAdd(value: number): string {\n return `+${Math.abs(value).toFixed(2)}`;\n}\n\n/** Axis, integer degrees with the degree symbol (`90°`). */\nexport function formatAxis(value: number): string {\n const clamped = Math.min(AXIS_MAX, Math.max(AXIS_MIN, Math.round(value)));\n return `${clamped}°`;\n}\n\n/** Prism, 2 dp (`2.00`). */\nexport function formatPrism(value: number): string {\n return value.toFixed(2);\n}\n\n/**\n * Format the numeric value of one refraction column for the read-only grid.\n * `base` is a string enum the component resolves through i18n separately, so it\n * never reaches this numeric formatter; any unhandled field falls through the\n * default branch and is coerced with `String(value)`.\n */\nexport function formatRefraction(\n field: keyof RefractionRow,\n value: number,\n): string {\n switch (field) {\n case 'sphere':\n return formatSphere(value);\n case 'cylinder':\n return formatCylinder(value);\n case 'add':\n return formatAdd(value);\n case 'axis':\n return formatAxis(value);\n case 'prism':\n return formatPrism(value);\n default:\n return String(value);\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Meridian maths (power cross) */\n/* ------------------------------------------------------------------ */\n\n/** Power along one principal meridian, for the optical power cross. */\nexport interface MeridianPower {\n /** Meridian orientation, degrees, normalised to [0, 180). */\n deg: number;\n /** Dioptric power along this meridian. */\n power: number;\n}\n\n/**\n * Normalise an axis to the conventional 0–180° range. Values already in\n * range are kept verbatim (180 stays 180 — the form convention), anything\n * outside wraps modulo 180. Single source of truth so the TABO dial, the\n * power cross, and their labels can never disagree about one meridian.\n */\nexport function normalizeAxis(deg: number): number {\n if (deg >= AXIS_MIN && deg <= AXIS_MAX) return deg;\n return ((deg % 180) + 180) % 180;\n}\n\n/**\n * Resolve a sphero-cylindrical row into its two principal meridians.\n * The cylinder AXIS meridian carries the sphere power; the meridian 90°\n * away carries sphere + cylinder. A row with neither sphere nor cylinder\n * has no cross — returns `undefined`. A missing sphere is plano (0.00);\n * a missing axis defaults to 0°.\n */\nexport function meridianPowers(\n row: RefractionRow | undefined,\n): { primary: MeridianPower; secondary: MeridianPower } | undefined {\n if (!row || (row.sphere === undefined && row.cylinder === undefined)) {\n return undefined;\n }\n const sphere = row.sphere ?? 0;\n const cylinder = row.cylinder ?? 0;\n const axis = normalizeAxis(row.axis ?? 0);\n return {\n primary: { deg: axis, power: sphere },\n secondary: { deg: (axis + 90) % 180, power: sphere + cylinder },\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Immutable helpers */\n/* ------------------------------------------------------------------ */\n\n/** An empty prescription. */\nexport function emptyValue(): OpticalPrescriptionValue {\n return { bands: {} };\n}\n\n/** Read one eye's row at one band (undefined when absent). */\nexport function getRow(\n value: OpticalPrescriptionValue,\n band: DistanceBand,\n eye: Eye,\n): RefractionRow | undefined {\n return value.bands[band]?.[eye];\n}\n\n/**\n * Immutably set (or clear) a single cell. Passing `undefined` / `null` removes\n * the field; emptying a row removes the row, and emptying a band removes the\n * band — so `bandsInValue` and the agent state snapshot stay tight.\n */\nexport function setCell<K extends keyof RefractionRow>(\n value: OpticalPrescriptionValue,\n band: DistanceBand,\n eye: Eye,\n field: K,\n fieldValue: RefractionRow[K] | undefined,\n): OpticalPrescriptionValue {\n const bands = { ...value.bands };\n const bandRows = { ...(bands[band] ?? {}) };\n const row: RefractionRow = { ...(bandRows[eye] ?? {}) };\n\n if (fieldValue === undefined || fieldValue === null) {\n delete row[field];\n } else {\n row[field] = fieldValue;\n }\n\n if (Object.keys(row).length === 0) {\n delete bandRows[eye];\n } else {\n bandRows[eye] = row;\n }\n\n if (Object.keys(bandRows).length === 0) {\n delete bands[band];\n } else {\n bands[band] = bandRows;\n }\n\n return { ...value, bands };\n}\n\n/** Immutably remove every row in a band. */\nexport function clearBand(\n value: OpticalPrescriptionValue,\n band: DistanceBand,\n): OpticalPrescriptionValue {\n if (!value.bands[band]) return value;\n const bands = { ...value.bands };\n delete bands[band];\n return { ...value, bands };\n}\n\n/** The distance bands carrying at least one refraction value, in order. */\nexport function bandsInValue(value: OpticalPrescriptionValue): DistanceBand[] {\n return DISTANCE_BANDS.filter((band) => {\n const rows = value.bands[band];\n if (!rows) return false;\n return EYES.some((eye) => {\n const row = rows[eye];\n return row !== undefined && Object.keys(row).length > 0;\n });\n });\n}\n","/* ------------------------------------------------------------------ */\n/* OpticalPrescription — standard prescription charts. */\n/* */\n/* The graphical elements of a real-world glasses prescription form: */\n/* the TABO axis dial (semicircular 0–180° protractor with the */\n/* cylinder-axis needle), the optical power cross (the two principal */\n/* meridians with their dioptric powers), the PD centration schematic */\n/* (eyes + dimension line, total or monocular split), and the prism */\n/* base rose (BU / BD / BI / BO compass with the base-direction */\n/* arrow). Pure presentational SVG — all user-visible strings arrive */\n/* pre-translated from the parent component; every paint is a token */\n/* via Tailwind arbitrary-property classes (house SVG convention). */\n/* */\n/* Geometry is EXAMINER-VIEW, like the odontogram: OD is drawn to the */\n/* left of OS and nasal (\"in\") points towards the other eye. These are */\n/* physical clinical diagrams — they do not mirror in RTL. */\n/* ------------------------------------------------------------------ */\n\nimport type { ReactElement } from 'react';\nimport {\n normalizeAxis,\n type Eye,\n type PrismBase,\n} from './optical-prescription-data';\n\n/* ------------------------------------------------------------------ */\n/* Chart vocabulary */\n/* ------------------------------------------------------------------ */\n\n/** The standard prescription chart kinds, in display order. */\nexport const CHART_KINDS = ['tabo', 'powerCross', 'pd', 'prismBase'] as const;\nexport type OpticalPrescriptionChart = (typeof CHART_KINDS)[number];\n\n/* ------------------------------------------------------------------ */\n/* Shared paint + layout classes (tokens only) */\n/* ------------------------------------------------------------------ */\n\nconst chromeStroke = 'ds:[stroke:var(--muted-foreground)] ds:[fill:none]';\nconst chromeText = 'ds:[fill:var(--muted-foreground)]';\nconst inkStroke = 'ds:[stroke:var(--foreground)] ds:[fill:none]';\nconst inkText = 'ds:[fill:var(--foreground)]';\nconst needleStroke = 'ds:[stroke:var(--primary)] ds:[fill:none]';\nconst needleFill = 'ds:[fill:var(--primary)]';\n\nconst figureClass = 'ds:m-0 ds:flex ds:flex-col ds:items-center ds:gap-1';\nconst captionClass =\n 'ds:text-[length:var(--font-size-xs)] ds:text-[var(--muted-foreground)] ds:text-center';\n\n/** Polar → SVG cartesian (SVG y grows downwards). Angle in degrees. */\nfunction polar(\n cx: number,\n cy: number,\n r: number,\n deg: number,\n): [number, number] {\n const rad = (deg * Math.PI) / 180;\n return [cx + r * Math.cos(rad), cy - r * Math.sin(rad)];\n}\n\ninterface ChartFigureProps {\n chart: OpticalPrescriptionChart;\n eye?: Eye;\n caption: string;\n /** Optional second caption line — readable HTML echo of values that only\n * appear at small SVG size inside the drawing (low-vision support). */\n detail?: string;\n children: ReactElement;\n}\n\n/** Shared figure shell — carries the `data-chart` (+ `data-eye`) DOM hooks.\n * Captions get `dir=\"auto\"`: the strip pins the FIGURE ORDER LTR (examiner\n * view), but the caption text itself is translated prose and must resolve\n * its own base direction in RTL locales. */\nfunction ChartFigure({\n chart,\n eye,\n caption,\n detail,\n children,\n}: ChartFigureProps) {\n return (\n <figure className={figureClass} data-chart={chart} data-eye={eye}>\n {children}\n <figcaption dir=\"auto\" className={captionClass}>\n {caption}\n {detail !== undefined && (\n <span className=\"ds:block ds:text-[var(--foreground)]\">{detail}</span>\n )}\n </figcaption>\n </figure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* TABO axis dial */\n/* ------------------------------------------------------------------ */\n\nexport interface TaboDialProps {\n eye: Eye;\n /** Cylinder axis, degrees (0–180). */\n axisDeg: number;\n /** Full-sentence accessible description (translated). */\n ariaLabel: string;\n /** Short visible caption (translated). */\n caption: string;\n}\n\nconst TABO_CX = 60;\nconst TABO_CY = 62;\nconst TABO_R = 48;\n/** Tick marks: [angle, length]. Majors at 0/90/180, mids at 45/135. */\nconst TABO_TICKS: ReadonlyArray<[number, number]> = [\n [0, 7],\n [30, 4],\n [45, 5],\n [60, 4],\n [90, 7],\n [120, 4],\n [135, 5],\n [150, 4],\n [180, 7],\n];\nconst TABO_LABELS: readonly number[] = [0, 45, 90, 135, 180];\n\n/**\n * The TABO protractor: an upper semicircle graduated anticlockwise from 0°\n * on the right to 180° on the left (identical for both eyes — that is what\n * distinguishes TABO from older per-eye schemes), with a needle marking the\n * cylinder axis.\n */\nexport function TaboDial({ eye, axisDeg, ariaLabel, caption }: TaboDialProps) {\n const axis = normalizeAxis(axisDeg);\n const [nx, ny] = polar(TABO_CX, TABO_CY, TABO_R - 6, axis);\n return (\n <ChartFigure chart=\"tabo\" eye={eye} caption={caption}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"-4 0 128 76\"\n className=\"ds:w-36\"\n >\n {/* Baseline + arc */}\n <line\n x1={TABO_CX - TABO_R}\n y1={TABO_CY}\n x2={TABO_CX + TABO_R}\n y2={TABO_CY}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <path\n d={`M ${TABO_CX - TABO_R} ${TABO_CY} A ${TABO_R} ${TABO_R} 0 0 1 ${TABO_CX + TABO_R} ${TABO_CY}`}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n {/* Graduation ticks */}\n {TABO_TICKS.map(([deg, len]) => {\n const [x1, y1] = polar(TABO_CX, TABO_CY, TABO_R, deg);\n const [x2, y2] = polar(TABO_CX, TABO_CY, TABO_R - len, deg);\n return (\n <line\n key={deg}\n x1={x1}\n y1={y1}\n x2={x2}\n y2={y2}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n );\n })}\n {/* Degree labels */}\n {TABO_LABELS.map((deg) => {\n const [x, y] = polar(TABO_CX, TABO_CY, TABO_R + 7, deg);\n return (\n <text\n key={deg}\n x={x}\n y={y + 2}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {deg}\n </text>\n );\n })}\n {/* Axis needle */}\n <line\n x1={TABO_CX}\n y1={TABO_CY}\n x2={nx}\n y2={ny}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n className={needleStroke}\n />\n <circle cx={TABO_CX} cy={TABO_CY} r=\"2.5\" className={needleFill} />\n </svg>\n </ChartFigure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Optical power cross */\n/* ------------------------------------------------------------------ */\n\nexport interface PowerCrossProps {\n eye: Eye;\n /** The axis meridian — carries the sphere power. */\n primary: { deg: number; power: number };\n /** The meridian 90° away — carries sphere + cylinder. */\n secondary: { deg: number; power: number };\n /** Pre-formatted power labels (translated / signed). */\n primaryText: string;\n secondaryText: string;\n ariaLabel: string;\n caption: string;\n /** Readable echo of both meridian powers, shown under the caption. */\n detail?: string;\n}\n\nconst CROSS_CX = 75;\nconst CROSS_CY = 56;\nconst CROSS_ARM = 32;\nconst CROSS_LABEL_R = 44;\n\n/**\n * The optical cross: one line per principal meridian, each annotated with\n * its dioptric power (and meridian angle beneath). Labels sit at the upper\n * end of each line — meridians live in [0, 180), so that end never dips\n * below the horizontal.\n */\nexport function PowerCross({\n eye,\n primary,\n secondary,\n primaryText,\n secondaryText,\n ariaLabel,\n caption,\n detail,\n}: PowerCrossProps) {\n const meridians = [\n { ...primary, text: primaryText },\n { ...secondary, text: secondaryText },\n ];\n return (\n <ChartFigure chart=\"powerCross\" eye={eye} caption={caption} detail={detail}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"0 0 150 104\"\n className=\"ds:w-40\"\n >\n {meridians.map(({ deg, text }) => {\n const [x1, y1] = polar(CROSS_CX, CROSS_CY, CROSS_ARM, deg + 180);\n const [x2, y2] = polar(CROSS_CX, CROSS_CY, CROSS_ARM, deg);\n const [lx, ly] = polar(CROSS_CX, CROSS_CY, CROSS_LABEL_R, deg);\n return (\n <g key={deg}>\n <line\n x1={x1}\n y1={y1}\n x2={x2}\n y2={y2}\n strokeWidth=\"1.5\"\n className={inkStroke}\n />\n <text\n x={lx}\n y={ly - 4}\n fontSize=\"9\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {text}\n </text>\n <text\n x={lx}\n y={ly + 5}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {deg}°\n </text>\n </g>\n );\n })}\n </svg>\n </ChartFigure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* PD centration schematic */\n/* ------------------------------------------------------------------ */\n\nexport interface PdSchematicProps {\n /** Total PD label (\"63 mm\") — drawn centred when no split is given. */\n totalText?: string;\n /** Monocular labels (right = OD, drawn on the LEFT — examiner view). */\n rightText?: string;\n leftText?: string;\n ariaLabel: string;\n caption: string;\n /** Readable echo of the measurement, shown under the caption. */\n detail?: string;\n}\n\nconst PD_EYES: ReadonlyArray<[Eye, number]> = [\n ['od', 60],\n ['os', 160],\n];\nconst PD_EYE_Y = 24;\nconst PD_DIM_Y = 50;\n\n/**\n * Two stylised eyes with the pupillary-distance dimension line. With\n * monocular values the line splits at the nose-centre tick — OD's half is\n * drawn on the left (examiner view).\n */\nexport function PdSchematic({\n totalText,\n rightText,\n leftText,\n ariaLabel,\n caption,\n detail,\n}: PdSchematicProps) {\n const split = rightText !== undefined && leftText !== undefined;\n return (\n <ChartFigure chart=\"pd\" caption={caption} detail={detail}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"0 0 220 64\"\n className=\"ds:w-52\"\n >\n {PD_EYES.map(([eye, cx]) => (\n <g key={eye}>\n <ellipse\n cx={cx}\n cy={PD_EYE_Y}\n rx=\"17\"\n ry=\"9\"\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <circle cx={cx} cy={PD_EYE_Y} r=\"3.5\" className={needleFill} />\n {/* Pupil → dimension-line guide */}\n <line\n x1={cx}\n y1={PD_EYE_Y + 10}\n x2={cx}\n y2={PD_DIM_Y + 4}\n strokeWidth=\"1\"\n strokeDasharray=\"2 2\"\n className={chromeStroke}\n />\n </g>\n ))}\n {/* Dimension line with arrowheads */}\n <line\n x1=\"60\"\n y1={PD_DIM_Y}\n x2=\"160\"\n y2={PD_DIM_Y}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n <path\n d={`M 66 ${PD_DIM_Y - 3} L 60 ${PD_DIM_Y} L 66 ${PD_DIM_Y + 3}`}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n <path\n d={`M 154 ${PD_DIM_Y - 3} L 160 ${PD_DIM_Y} L 154 ${PD_DIM_Y + 3}`}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n {split ? (\n <>\n {/* Nose-centre tick + monocular labels (OD left, OS right) */}\n <line\n x1=\"110\"\n y1={PD_DIM_Y - 4}\n x2=\"110\"\n y2={PD_DIM_Y + 4}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n <text\n x=\"85\"\n y={PD_DIM_Y - 6}\n fontSize=\"8\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {rightText}\n </text>\n <text\n x=\"135\"\n y={PD_DIM_Y - 6}\n fontSize=\"8\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {leftText}\n </text>\n </>\n ) : (\n <text\n x=\"110\"\n y={PD_DIM_Y - 6}\n fontSize=\"8\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {totalText}\n </text>\n )}\n </svg>\n </ChartFigure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Prism base rose */\n/* ------------------------------------------------------------------ */\n\nexport interface PrismRoseProps {\n eye: Eye;\n base: PrismBase;\n /** Localised compass labels (BU / BD / BI / BO). */\n labels: Record<PrismBase, string>;\n ariaLabel: string;\n caption: string;\n}\n\nconst ROSE_CX = 60;\nconst ROSE_CY = 52;\nconst ROSE_ARM = 28;\n\n/** Base direction → angle, per eye. Nasal (\"in\") points towards the other\n * eye: OD is drawn to the left of OS (examiner view), so its nasal side is\n * the right of its own rose — and mirrored for OS. */\nfunction baseAngle(eye: Eye, base: PrismBase): number {\n switch (base) {\n case 'up':\n return 90;\n case 'down':\n return 270;\n case 'in':\n return eye === 'od' ? 0 : 180;\n case 'out':\n return eye === 'od' ? 180 : 0;\n }\n}\n\n/**\n * A compass rose showing the prism base direction: chrome cross with the\n * four base labels, and an arrow along the prescribed base.\n */\nexport function PrismRose({\n eye,\n base,\n labels,\n ariaLabel,\n caption,\n}: PrismRoseProps) {\n const angle = baseAngle(eye, base);\n const [ax, ay] = polar(ROSE_CX, ROSE_CY, ROSE_ARM - 6, angle);\n const [hx, hy] = polar(ROSE_CX, ROSE_CY, ROSE_ARM, angle);\n const [w1x, w1y] = polar(ROSE_CX, ROSE_CY, ROSE_ARM - 7, angle + 8);\n const [w2x, w2y] = polar(ROSE_CX, ROSE_CY, ROSE_ARM - 7, angle - 8);\n // Nasal side of the rose (see baseAngle) — labels swap between eyes.\n const rightLabel = eye === 'od' ? labels.in : labels.out;\n const leftLabel = eye === 'od' ? labels.out : labels.in;\n return (\n <ChartFigure chart=\"prismBase\" eye={eye} caption={caption}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"0 0 120 104\"\n className=\"ds:w-32\"\n >\n <line\n x1={ROSE_CX - ROSE_ARM}\n y1={ROSE_CY}\n x2={ROSE_CX + ROSE_ARM}\n y2={ROSE_CY}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <line\n x1={ROSE_CX}\n y1={ROSE_CY - ROSE_ARM}\n x2={ROSE_CX}\n y2={ROSE_CY + ROSE_ARM}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <text\n x={ROSE_CX}\n y={ROSE_CY - ROSE_ARM - 5}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {labels.up}\n </text>\n <text\n x={ROSE_CX}\n y={ROSE_CY + ROSE_ARM + 11}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {labels.down}\n </text>\n <text\n x={ROSE_CX + ROSE_ARM + 10}\n y={ROSE_CY + 2}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {rightLabel}\n </text>\n <text\n x={ROSE_CX - ROSE_ARM - 10}\n y={ROSE_CY + 2}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {leftLabel}\n </text>\n {/* Base-direction arrow */}\n <line\n x1={ROSE_CX}\n y1={ROSE_CY}\n x2={ax}\n y2={ay}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n className={needleStroke}\n />\n <polygon\n points={`${hx},${hy} ${w1x},${w1y} ${w2x},${w2y}`}\n className={needleFill}\n />\n <circle cx={ROSE_CX} cy={ROSE_CY} r=\"2.5\" className={needleFill} />\n </svg>\n </ChartFigure>\n );\n}\n","/* ------------------------------------------------------------------ */\n/* OpticalPrescription — the kit's glasses prescription grid. */\n/* */\n/* The ophthalmology equivalent of ToothScheme: a first-class shipped */\n/* component with an editable (`interactive`) and a read-only */\n/* (`display`) mode over a shared value model. A prescription is laid */\n/* out as one small grid per distance BAND (far / intermediate / near) */\n/* with an OD (right eye) and an OS (left eye) row, plus a metadata */\n/* strip (PD, lens type, axis system, free-text note). */\n/* */\n/* It is NOT an HTML <table>: the grid is a CSS grid of ARIA-table */\n/* cells, so the editable mode lays kit NumberInputs / Selects out in */\n/* the same column tracks as the read-only formatted values. OD / OS */\n/* keep the international Latin abbreviations; the full eye name is the */\n/* accessible label. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useCallback,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type ReactElement,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { NumberInput } from '../number-input';\nimport { Select } from '../select';\nimport { TextArea } from '../text-area';\nimport { DescriptionList } from '../description-list';\nimport { opticalPrescriptionAgent } from './optical-prescription.agent';\nimport {\n ADD_MAX,\n ADD_MIN,\n AXIS_MAX,\n AXIS_MIN,\n AXIS_STEP,\n AXIS_SYSTEMS,\n CYLINDER_MAX,\n CYLINDER_MIN,\n DIOPTRE_STEP,\n EYES,\n LENS_TYPES,\n PD_MAX,\n PD_MIN,\n PRISM_BASES,\n PRISM_MAX,\n PRISM_MIN,\n SPHERE_MAX,\n SPHERE_MIN,\n bandsInValue,\n emptyValue,\n formatAxis,\n formatPrism,\n formatRefraction,\n formatSigned,\n meridianPowers,\n normalizeAxis,\n getRow as getRowData,\n setCell as setCellData,\n clearBand as clearBandData,\n type AxisSystem,\n type DistanceBand,\n type Eye,\n type LensType,\n type OpticalPrescriptionMode,\n type OpticalPrescriptionValue,\n type PrismBase,\n type RefractionRow,\n} from './optical-prescription-data';\nimport {\n CHART_KINDS,\n PdSchematic,\n PowerCross,\n PrismRose,\n TaboDial,\n type OpticalPrescriptionChart,\n} from './optical-prescription-charts';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface OpticalPrescriptionProps {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** `'interactive'` enables editing; `'display'` is a read-only grid. Default `'interactive'`. */\n mode?: OpticalPrescriptionMode;\n /** Controlled prescription value. */\n value?: OpticalPrescriptionValue;\n /** Uncontrolled initial value. */\n defaultValue?: OpticalPrescriptionValue;\n /** Fired whenever the prescription changes. */\n onChange?: (next: OpticalPrescriptionValue) => void;\n /** Distance bands to render, in order. Default `['far', 'near']`. */\n bands?: DistanceBand[];\n /** Render the prism + base columns. Default `false`. */\n showPrism?: boolean;\n /** Render the metadata strip (PD, lens type, axis system, note). Default `true`. */\n metadata?: boolean;\n /** The standard prescription charts (TABO axis dials, power crosses, PD\n * schematic, prism base roses). `true` renders every chart the value\n * carries data for; an array cherry-picks kinds; `false` hides them all.\n * Default `true`. */\n charts?: boolean | OpticalPrescriptionChart[];\n /** The distance band the charts read from. Default: the first rendered\n * band carrying at least one value. */\n chartsBand?: DistanceBand;\n /** Vertical rhythm. Default `'comfortable'`. */\n density?: 'comfortable' | 'compact';\n /** Accessible label override for the prescription region. */\n ariaLabel?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport interface OpticalPrescriptionHandle {\n /** Focus an eye's row (first editable cell in interactive mode), optionally within a band. */\n focusEye: (eye: Eye, band?: DistanceBand) => void;\n /** Read the current prescription value. */\n getValue: () => OpticalPrescriptionValue;\n /** Replace the prescription value. */\n setValue: (next: OpticalPrescriptionValue) => void;\n /** Read one eye's refraction row at a band (undefined when absent). */\n getRow: (band: DistanceBand, eye: Eye) => RefractionRow | undefined;\n /** Set (or clear, with null) a single refraction cell. */\n setCell: (\n band: DistanceBand,\n eye: Eye,\n field: keyof RefractionRow,\n value: number | PrismBase | null,\n ) => void;\n /** Clear every refraction row in a band. */\n clearBand: (band: DistanceBand) => void;\n /** The distance bands carrying at least one value. */\n getBands: () => DistanceBand[];\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst containerVariants = cva('ds:flex ds:flex-col', {\n variants: {\n density: {\n comfortable: 'ds:gap-4',\n compact: 'ds:gap-2',\n },\n },\n defaultVariants: { density: 'comfortable' },\n});\n\n// Literal class strings so Tailwind compiles each grid template (it cannot see\n// a dynamically built class name). Keyed by refraction-column count; the eye\n// column is the leading minmax track outside the repeat().\nconst GRID_TEMPLATE: Record<number, string> = {\n 4: 'ds:[grid-template-columns:minmax(2.75rem,auto)_repeat(4,minmax(0,1fr))]',\n 6: 'ds:[grid-template-columns:minmax(2.75rem,auto)_repeat(6,minmax(0,1fr))]',\n};\n\nconst headerCell =\n 'ds:text-[length:var(--font-size-xs)] ds:font-[var(--font-weight-medium)] ds:text-[var(--muted-foreground)]';\nconst numericCell =\n 'ds:text-end ds:tabular-nums ds:text-[length:var(--font-size-sm)] ds:text-[var(--foreground)]';\n\n/* ------------------------------------------------------------------ */\n/* OpticalPrescription */\n/* ------------------------------------------------------------------ */\n\nexport const OpticalPrescription = forwardRef<\n OpticalPrescriptionHandle,\n OpticalPrescriptionProps\n>(\n (\n {\n id,\n mode = 'interactive',\n value,\n defaultValue,\n onChange,\n bands = ['far', 'near'],\n showPrism = false,\n metadata = true,\n charts = true,\n chartsBand,\n density = 'comfortable',\n ariaLabel,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const reactId = useId();\n const instanceId = id ?? reactId;\n const rootRef = useRef<HTMLDivElement>(null);\n\n const interactive = mode === 'interactive';\n\n const isControlled = value !== undefined;\n const [internal, setInternal] = useState<OpticalPrescriptionValue>(\n defaultValue ?? emptyValue(),\n );\n const current = isControlled ? value : internal;\n const valueRef = useRef<OpticalPrescriptionValue>(current);\n valueRef.current = current;\n\n const commit = useCallback(\n (next: OpticalPrescriptionValue) => {\n if (!isControlled) setInternal(next);\n onChange?.(next);\n },\n [isControlled, onChange],\n );\n\n const setCellFn = useCallback(\n (\n band: DistanceBand,\n eye: Eye,\n field: keyof RefractionRow,\n v: number | PrismBase | null,\n ) => {\n commit(setCellData(valueRef.current, band, eye, field, v ?? undefined));\n },\n [commit],\n );\n\n const setMeta = useCallback(\n (patch: Partial<OpticalPrescriptionValue>) => {\n commit({ ...valueRef.current, ...patch });\n },\n [commit],\n );\n\n const renderedBands = bands;\n const renderedBandsRef = useRef<DistanceBand[]>(renderedBands);\n renderedBandsRef.current = renderedBands;\n\n const columns = useMemo<(keyof RefractionRow)[]>(\n () =>\n showPrism\n ? ['sphere', 'cylinder', 'axis', 'add', 'prism', 'base']\n : ['sphere', 'cylinder', 'axis', 'add'],\n [showPrism],\n );\n\n const focusEye = useCallback((eye: Eye, band?: DistanceBand) => {\n const root = rootRef.current;\n if (!root) return;\n const targetBand = band ?? renderedBandsRef.current[0];\n if (!targetBand) return;\n const row = root.querySelector<HTMLElement>(\n `[data-band=\"${targetBand}\"][data-eye=\"${eye}\"]`,\n );\n if (!row) return;\n // Editable controls win: in interactive mode the first cell's NumberInput /\n // Select is the focus target, NOT the static rowheader (which also matches\n // `[tabindex]`). The NumberInput's decorative spinner buttons carry\n // `tabindex=\"-1\"`, so excluding them lands focus on the real input. Only\n // when the row has no editable control (display mode) do we fall back to\n // the `[tabindex]` rowheader, then the row itself.\n const focusable =\n row.querySelector<HTMLElement>(\n 'input, textarea, button:not([tabindex=\"-1\"])',\n ) ?? row.querySelector<HTMLElement>('[tabindex]');\n (focusable ?? row).focus();\n }, []);\n\n /* ---- Imperative handle + agent registration ---- */\n const handle = useMemo<OpticalPrescriptionHandle>(\n () => ({\n focusEye,\n getValue: () => valueRef.current,\n setValue: (next) => commit(next),\n getRow: (band, eye) => getRowData(valueRef.current, band, eye),\n setCell: setCellFn,\n clearBand: (band) => commit(clearBandData(valueRef.current, band)),\n getBands: () => bandsInValue(valueRef.current),\n }),\n [focusEye, commit, setCellFn],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(opticalPrescriptionAgent, handle, instanceId);\n\n /* ---- Labels ---- */\n const eyeName = useCallback(\n (eye: Eye): string => t(`opticalPrescription.eye.${eye}Name`),\n [t],\n );\n const columnLabel = useCallback(\n (col: keyof RefractionRow): string =>\n t(`opticalPrescription.column.${col}`),\n [t],\n );\n const bandLabel = useCallback(\n (band: DistanceBand): string => t(`opticalPrescription.band.${band}`),\n [t],\n );\n\n /* ---- Cell renderers ---- */\n const renderEditableCell = useCallback(\n (\n band: DistanceBand,\n eye: Eye,\n col: keyof RefractionRow,\n ): ReactElement => {\n const row = getRowData(valueRef.current, band, eye);\n const raw = row?.[col];\n const cellAria = t('opticalPrescription.cellLabel', {\n eye: eyeName(eye),\n column: columnLabel(col),\n band: bandLabel(band),\n });\n\n if (col === 'base') {\n const baseValue: PrismBase | '' = typeof raw === 'string' ? raw : '';\n return (\n <div key={col} role=\"cell\" data-field={col} className=\"ds:min-w-0\">\n <Select<PrismBase>\n size=\"md\"\n clearable\n aria-label={cellAria}\n value={baseValue}\n options={PRISM_BASES.map((b) => ({\n value: b,\n label: t(`opticalPrescription.base.${b}`),\n }))}\n onValueChange={(next) =>\n setCellFn(band, eye, 'base', next === '' ? null : next)\n }\n />\n </div>\n );\n }\n\n const numeric = typeof raw === 'number' ? raw : null;\n const numberProps =\n col === 'axis'\n ? {\n mode: 'integer' as const,\n step: AXIS_STEP,\n min: AXIS_MIN,\n max: AXIS_MAX,\n }\n : col === 'add'\n ? {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: ADD_MIN,\n max: ADD_MAX,\n }\n : col === 'prism'\n ? {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: PRISM_MIN,\n max: PRISM_MAX,\n }\n : col === 'cylinder'\n ? {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: CYLINDER_MIN,\n max: CYLINDER_MAX,\n }\n : {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: SPHERE_MIN,\n max: SPHERE_MAX,\n };\n\n return (\n <div key={col} role=\"cell\" data-field={col} className=\"ds:min-w-0\">\n <NumberInput\n size=\"md\"\n aria-label={cellAria}\n value={numeric}\n {...numberProps}\n onChange={(n) => setCellFn(band, eye, col, n)}\n />\n </div>\n );\n },\n [t, eyeName, columnLabel, bandLabel, setCellFn],\n );\n\n const renderDisplayCell = useCallback(\n (\n band: DistanceBand,\n eye: Eye,\n col: keyof RefractionRow,\n ): ReactElement => {\n const row = getRowData(valueRef.current, band, eye);\n const raw = row?.[col];\n let text: string;\n if (raw === undefined) {\n text = t('opticalPrescription.empty');\n } else if (col === 'base' && typeof raw === 'string') {\n text = t(`opticalPrescription.base.${raw}`);\n } else if (typeof raw === 'number') {\n text = formatRefraction(col, raw);\n } else {\n text = t('opticalPrescription.empty');\n }\n return (\n <span key={col} role=\"cell\" data-field={col} className={numericCell}>\n {text}\n </span>\n );\n },\n [t],\n );\n\n const renderBand = useCallback(\n (band: DistanceBand): ReactElement => {\n const titleId = `${instanceId}-band-${band}`;\n const template = GRID_TEMPLATE[columns.length] ?? GRID_TEMPLATE[4];\n return (\n <section\n key={band}\n className=\"ds:flex ds:flex-col ds:gap-1\"\n aria-labelledby={titleId}\n >\n {/* Band label is a CAPTION, not a document heading: each band is a\n role=\"table\" with this text as its accessible name, so emitting it\n as an <h4> would inject a spurious heading level (and an h2→h4 skip\n when a host page mounts the grid under an h2 section). A <p>\n caption keeps the visual label and the section's accessible name\n without entering the heading outline. */}\n <p\n id={titleId}\n className=\"ds:m-0 ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]\"\n >\n {bandLabel(band)}\n </p>\n <div\n role=\"table\"\n aria-label={bandLabel(band)}\n className={`ds:grid ds:items-center ds:gap-x-2 ds:gap-y-1 ${template}`}\n >\n {/* Header row */}\n <div role=\"row\" className=\"ds:contents\">\n <span\n role=\"columnheader\"\n className={`${headerCell} ds:text-start`}\n >\n {t('opticalPrescription.column.eye')}\n </span>\n {columns.map((col) => (\n <span\n key={col}\n role=\"columnheader\"\n className={`${headerCell} ds:text-end`}\n >\n {columnLabel(col)}\n </span>\n ))}\n </div>\n {/* Eye rows */}\n {EYES.map((eye) => (\n <div\n key={eye}\n role=\"row\"\n data-eye={eye}\n data-band={band}\n className=\"ds:contents\"\n >\n <span\n role=\"rowheader\"\n tabIndex={-1}\n aria-label={eyeName(eye)}\n className=\"ds:text-start ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-semibold)] ds:tabular-nums ds:text-[var(--foreground)] ds:outline-none ds:rounded-[var(--radius-sm)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]\"\n >\n {t(`opticalPrescription.eye.${eye}`)}\n </span>\n {columns.map((col) =>\n interactive\n ? renderEditableCell(band, eye, col)\n : renderDisplayCell(band, eye, col),\n )}\n </div>\n ))}\n </div>\n </section>\n );\n },\n [\n instanceId,\n columns,\n interactive,\n bandLabel,\n columnLabel,\n eyeName,\n renderEditableCell,\n renderDisplayCell,\n t,\n ],\n );\n\n /* ---- Standard prescription charts ---- */\n const enabledCharts = useMemo<readonly OpticalPrescriptionChart[]>(() => {\n if (charts === false) return [];\n if (charts === true) return CHART_KINDS;\n return charts;\n }, [charts]);\n\n const renderCharts = useCallback((): ReactElement | null => {\n if (enabledCharts.length === 0) return null;\n const v = current;\n const withData = bandsInValue(v);\n const band =\n chartsBand ?? renderedBands.find((b) => withData.includes(b));\n const rowOf = (eye: Eye): RefractionRow | undefined =>\n band ? getRowData(v, band, eye) : undefined;\n\n const figures: ReactElement[] = [];\n\n if (enabledCharts.includes('tabo')) {\n for (const eye of EYES) {\n const rawAxis = rowOf(eye)?.axis;\n if (rawAxis === undefined) continue;\n // One normalisation for needle, caption, and aria — so the dial\n // can never disagree with the power cross about the meridian.\n const axis = normalizeAxis(rawAxis);\n figures.push(\n <TaboDial\n key={`tabo-${eye}`}\n eye={eye}\n axisDeg={axis}\n ariaLabel={t('opticalPrescription.charts.tabo.aria', {\n eye: eyeName(eye),\n axis: formatAxis(axis),\n })}\n caption={t('opticalPrescription.charts.tabo.caption', {\n eye: t(`opticalPrescription.eye.${eye}`),\n axis: formatAxis(axis),\n })}\n />,\n );\n }\n }\n\n if (enabledCharts.includes('powerCross')) {\n for (const eye of EYES) {\n const powers = meridianPowers(rowOf(eye));\n if (!powers) continue;\n figures.push(\n <PowerCross\n key={`cross-${eye}`}\n eye={eye}\n primary={powers.primary}\n secondary={powers.secondary}\n primaryText={formatSigned(powers.primary.power, 2)}\n secondaryText={formatSigned(powers.secondary.power, 2)}\n ariaLabel={t('opticalPrescription.charts.powerCross.aria', {\n eye: eyeName(eye),\n primary: formatSigned(powers.primary.power, 2),\n primaryDeg: formatAxis(powers.primary.deg),\n secondary: formatSigned(powers.secondary.power, 2),\n secondaryDeg: formatAxis(powers.secondary.deg),\n })}\n caption={t('opticalPrescription.charts.powerCross.caption', {\n eye: t(`opticalPrescription.eye.${eye}`),\n })}\n // Notation-only echo (signed dioptres @ meridian) at readable\n // HTML size — the in-SVG labels are too small for low vision.\n detail={`${formatSigned(powers.primary.power, 2)} @ ${formatAxis(powers.primary.deg)} · ${formatSigned(powers.secondary.power, 2)} @ ${formatAxis(powers.secondary.deg)}`}\n />,\n );\n }\n }\n\n if (enabledCharts.includes('pd')) {\n const split = v.pdRight !== undefined && v.pdLeft !== undefined;\n if (split || v.pd !== undefined) {\n figures.push(\n <PdSchematic\n key=\"pd\"\n totalText={\n v.pd !== undefined\n ? t('opticalPrescription.pd.value', { value: v.pd })\n : undefined\n }\n rightText={\n split\n ? t('opticalPrescription.pd.value', { value: v.pdRight })\n : undefined\n }\n leftText={\n split\n ? t('opticalPrescription.pd.value', { value: v.pdLeft })\n : undefined\n }\n ariaLabel={\n split\n ? t('opticalPrescription.charts.pd.ariaSplit', {\n right: v.pdRight,\n left: v.pdLeft,\n })\n : t('opticalPrescription.charts.pd.aria', { value: v.pd })\n }\n caption={t('opticalPrescription.charts.pd.caption')}\n detail={\n split\n ? t('opticalPrescription.pd.monocularValue', {\n right: v.pdRight,\n left: v.pdLeft,\n })\n : t('opticalPrescription.pd.value', { value: v.pd })\n }\n />,\n );\n }\n }\n\n if (enabledCharts.includes('prismBase')) {\n for (const eye of EYES) {\n const row = rowOf(eye);\n if (!row || row.prism === undefined || row.prism <= 0 || !row.base) {\n continue;\n }\n figures.push(\n <PrismRose\n key={`prism-${eye}`}\n eye={eye}\n base={row.base}\n labels={{\n up: t('opticalPrescription.charts.prism.baseShort.up'),\n down: t('opticalPrescription.charts.prism.baseShort.down'),\n in: t('opticalPrescription.charts.prism.baseShort.in'),\n out: t('opticalPrescription.charts.prism.baseShort.out'),\n }}\n ariaLabel={t('opticalPrescription.charts.prism.aria', {\n eye: eyeName(eye),\n value: formatPrism(row.prism),\n base: t(`opticalPrescription.base.${row.base}`),\n })}\n caption={t('opticalPrescription.charts.prism.caption', {\n eye: t(`opticalPrescription.eye.${eye}`),\n value: formatPrism(row.prism),\n base: t(\n `opticalPrescription.charts.prism.baseShort.${row.base}`,\n ),\n })}\n />,\n );\n }\n }\n\n if (figures.length === 0) return null;\n return (\n // Examiner-view clinical diagrams (OD drawn to the left of OS, nasal\n // towards the other eye) — physical order like the odontogram, so the\n // strip is pinned LTR and does not mirror in RTL.\n <div\n role=\"group\"\n aria-label={t('opticalPrescription.charts.label')}\n dir=\"ltr\"\n className=\"ds:flex ds:flex-wrap ds:items-end ds:gap-4\"\n >\n {figures}\n </div>\n );\n }, [enabledCharts, current, chartsBand, renderedBands, eyeName, t]);\n\n /* ---- Metadata strip ---- */\n const renderMetadata = useCallback((): ReactElement | null => {\n if (!metadata) return null;\n const v = current;\n\n if (interactive) {\n return (\n <div\n role=\"group\"\n aria-label={t('opticalPrescription.metaLabel')}\n className=\"ds:grid ds:gap-3 ds:grid-cols-[repeat(auto-fit,minmax(8rem,1fr))]\"\n >\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.pd.label')}\n </span>\n <NumberInput\n size=\"md\"\n mode=\"decimal\"\n step={0.5}\n min={PD_MIN}\n max={PD_MAX}\n aria-label={t('opticalPrescription.pd.full')}\n value={v.pd ?? null}\n onChange={(n) => setMeta({ pd: n ?? undefined })}\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.pd.right')}\n </span>\n <NumberInput\n size=\"md\"\n mode=\"decimal\"\n step={0.5}\n min={PD_MIN / 2}\n max={PD_MAX / 2}\n aria-label={t('opticalPrescription.pd.right')}\n value={v.pdRight ?? null}\n onChange={(n) => setMeta({ pdRight: n ?? undefined })}\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.pd.left')}\n </span>\n <NumberInput\n size=\"md\"\n mode=\"decimal\"\n step={0.5}\n min={PD_MIN / 2}\n max={PD_MAX / 2}\n aria-label={t('opticalPrescription.pd.left')}\n value={v.pdLeft ?? null}\n onChange={(n) => setMeta({ pdLeft: n ?? undefined })}\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.lensType.label')}\n </span>\n <Select<LensType>\n size=\"md\"\n clearable\n aria-label={t('opticalPrescription.lensType.label')}\n value={v.lensType ?? ''}\n options={LENS_TYPES.map((lt) => ({\n value: lt,\n label: t(`opticalPrescription.lensType.${lt}`),\n }))}\n onValueChange={(next) =>\n setMeta({ lensType: next === '' ? undefined : next })\n }\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.axisSystem.label')}\n </span>\n <Select<AxisSystem>\n size=\"md\"\n clearable\n aria-label={t('opticalPrescription.axisSystem.label')}\n value={v.axisSystem ?? ''}\n options={AXIS_SYSTEMS.map((as) => ({\n value: as,\n label: t(`opticalPrescription.axisSystem.${as}`),\n }))}\n onValueChange={(next) =>\n setMeta({ axisSystem: next === '' ? undefined : next })\n }\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1 ds:[grid-column:1/-1]\">\n <span className={headerCell}>\n {t('opticalPrescription.notes.label')}\n </span>\n <TextArea\n size=\"md\"\n minRows={2}\n aria-label={t('opticalPrescription.notes.label')}\n placeholder={t('opticalPrescription.notes.placeholder')}\n value={v.notes ?? ''}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) =>\n setMeta({ notes: e.target.value || undefined })\n }\n />\n </div>\n </div>\n );\n }\n\n // Display mode — read-only metadata via DescriptionList.\n const hasAny =\n v.pd !== undefined ||\n (v.pdRight !== undefined && v.pdLeft !== undefined) ||\n v.lensType !== undefined ||\n v.axisSystem !== undefined ||\n (v.notes !== undefined && v.notes !== '');\n if (!hasAny) return null;\n\n return (\n <DescriptionList\n layout=\"inline\"\n labelWidth=\"fixed\"\n density=\"compact\"\n aria-label={t('opticalPrescription.metaLabel')}\n >\n {v.pd !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.pd.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {t('opticalPrescription.pd.value', { value: v.pd })}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.pdRight !== undefined && v.pdLeft !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.pd.monocular')}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {t('opticalPrescription.pd.monocularValue', {\n right: v.pdRight,\n left: v.pdLeft,\n })}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.lensType !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.lensType.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail>\n {t(`opticalPrescription.lensType.${v.lensType}`)}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.axisSystem !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.axisSystem.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail>\n {t(`opticalPrescription.axisSystem.${v.axisSystem}`)}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.notes !== undefined && v.notes !== '' && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.notes.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail>{v.notes}</DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n </DescriptionList>\n );\n }, [metadata, current, interactive, t, setMeta]);\n\n return (\n <div\n ref={rootRef}\n data-component=\"optical-prescription\"\n data-component-id={instanceId}\n data-mode={mode}\n role=\"group\"\n aria-label={ariaLabel ?? t('opticalPrescription.ariaLabel')}\n className={containerVariants({ density, className })}\n >\n {renderedBands.map((band) => renderBand(band))}\n {renderCharts()}\n {renderMetadata()}\n </div>\n );\n },\n);\n\nOpticalPrescription.displayName = 'OpticalPrescription';\n"],"names":["EYE_SCHEMA","BAND_SCHEMA","FIELD_SCHEMA","ROW_SCHEMA","VALUE_SCHEMA","opticalPrescriptionAgent","handle","v","args","EYES","DISTANCE_BANDS","PRISM_BASES","LENS_TYPES","AXIS_SYSTEMS","REFRACTION_COLUMNS","DIOPTRE_STEP","SPHERE_MIN","SPHERE_MAX","CYLINDER_MIN","CYLINDER_MAX","ADD_MIN","ADD_MAX","AXIS_MIN","AXIS_MAX","AXIS_STEP","PD_MIN","PD_MAX","PRISM_MIN","PRISM_MAX","formatSigned","value","fractionDigits","fixed","formatSphere","formatCylinder","formatAdd","formatAxis","formatPrism","formatRefraction","field","normalizeAxis","deg","meridianPowers","row","sphere","cylinder","axis","emptyValue","getRow","band","eye","_a","setCell","fieldValue","bands","bandRows","clearBand","bandsInValue","rows","CHART_KINDS","chromeStroke","chromeText","inkStroke","inkText","needleStroke","needleFill","figureClass","captionClass","polar","cx","cy","r","rad","ChartFigure","chart","caption","detail","children","jsxs","jsx","TABO_CX","TABO_CY","TABO_R","TABO_TICKS","TABO_LABELS","TaboDial","axisDeg","ariaLabel","nx","ny","len","x1","y1","x2","y2","x","y","CROSS_CX","CROSS_CY","CROSS_ARM","CROSS_LABEL_R","PowerCross","primary","secondary","primaryText","secondaryText","meridians","text","lx","ly","PD_EYES","PD_EYE_Y","PD_DIM_Y","PdSchematic","totalText","rightText","leftText","split","Fragment","ROSE_CX","ROSE_CY","ROSE_ARM","baseAngle","base","PrismRose","labels","angle","ax","ay","hx","hy","w1x","w1y","w2x","w2y","rightLabel","leftLabel","containerVariants","cva","GRID_TEMPLATE","headerCell","numericCell","OpticalPrescription","forwardRef","id","mode","defaultValue","onChange","showPrism","metadata","charts","chartsBand","density","className","ref","t","useTranslation","reactId","useId","instanceId","rootRef","useRef","interactive","isControlled","internal","setInternal","useState","current","valueRef","commit","useCallback","next","setCellFn","setCellData","setMeta","patch","renderedBands","renderedBandsRef","columns","useMemo","focusEye","root","targetBand","getRowData","clearBandData","useImperativeHandle","useAgentRegistration","eyeName","columnLabel","col","bandLabel","renderEditableCell","raw","cellAria","Select","b","NumberInput","n","renderDisplayCell","renderBand","titleId","template","enabledCharts","renderCharts","withData","rowOf","figures","rawAxis","powers","renderMetadata","lt","as","TextArea","e","DescriptionList"],"mappings":";;;;;;;;;AAYA,MAAMA,KAAa;AAAA,EACjB,MAAM,CAAC,MAAM,IAAI;AAAA,EACjB,aAAa;AACf,GACMC,KAAc;AAAA,EAClB,MAAM,CAAC,OAAO,gBAAgB,MAAM;AAAA,EACpC,aACE;AACJ,GACMC,KAAe;AAAA,EACnB,MAAM,CAAC,UAAU,YAAY,QAAQ,OAAO,SAAS,MAAM;AAAA,EAC3D,aAC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D,UAAA;AAAA,UAAAuB,EAAc,IAAI,CAAC/H,MAASsJ,GAAWtJ,CAAI,CAAC;AAAA,UAC5C0J,GAAA;AAAA,UACAM,GAAA;AAAA,QAAe;AAAA,MAAA;AAAA,IAAA;AAAA,EAGtB;AACF;AAEAnE,GAAoB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"optical-prescription-BvwuqTpl.js","sources":["../../src/components/optical-prescription/optical-prescription.agent.ts","../../src/components/optical-prescription/optical-prescription-data.ts","../../src/components/optical-prescription/optical-prescription-charts.tsx","../../src/components/optical-prescription/optical-prescription.tsx"],"sourcesContent":["import type { AgentAdapter } from '../../agent/types';\nimport type { OpticalPrescriptionHandle } from './optical-prescription';\nimport type {\n DistanceBand,\n Eye,\n OpticalPrescriptionValue,\n PrismBase,\n RefractionRow,\n} from './optical-prescription-data';\n\n// JSON-Schema fragments derived from the data-model unions. Kept inline so the\n// adapter stays a pure module with no runtime import of the unions.\nconst EYE_SCHEMA = {\n enum: ['od', 'os'],\n description: 'Eye — `od` (right eye) or `os` (left eye).',\n} as const;\nconst BAND_SCHEMA = {\n enum: ['far', 'intermediate', 'near'],\n description:\n 'Distance band — `far` (per lontano), `intermediate`, `near` (per vicino).',\n} as const;\nconst FIELD_SCHEMA = {\n enum: ['sphere', 'cylinder', 'axis', 'add', 'prism', 'base'],\n description:\n 'Refraction column — dioptric `sphere` / `cylinder` / `add` (0.25 steps), `axis` (0–180°), `prism`, or `base` (a direction enum).',\n} as const;\nconst ROW_SCHEMA = {\n type: 'object',\n properties: {\n sphere: { type: 'number' },\n cylinder: { type: 'number' },\n axis: { type: 'number', minimum: 0, maximum: 180 },\n add: { type: 'number' },\n prism: { type: 'number' },\n base: { enum: ['up', 'down', 'in', 'out'] },\n },\n} as const;\nconst VALUE_SCHEMA = {\n type: 'object',\n properties: {\n bands: {\n type: 'object',\n description:\n 'Refraction rows keyed by band (`far` / `intermediate` / `near`) then eye (`od` / `os`).',\n },\n pd: { type: 'number', description: 'Interpupillary distance, mm.' },\n pdRight: {\n type: 'number',\n description: 'Monocular PD, nose centre → OD pupil, mm.',\n },\n pdLeft: {\n type: 'number',\n description: 'Monocular PD, nose centre → OS pupil, mm.',\n },\n lensType: { enum: ['single-vision', 'bifocal', 'progressive'] },\n axisSystem: { enum: ['tabo', 'int'] },\n notes: { type: 'string', description: 'Free-text note — PHI.' },\n },\n required: ['bands'],\n} as const;\n\nexport const opticalPrescriptionAgent: AgentAdapter<OpticalPrescriptionHandle> =\n {\n id: 'optical-prescription',\n // pick — focus an eye row (`focus_eye`, transient, not persisted);\n // edit_inline — `set_cell` edits one refraction cell; set_value — `set_value`\n // replaces the whole prescription.\n capabilities: ['pick', 'edit_inline', 'set_value'],\n state: {\n prescription: {\n // A9: the always-on snapshot carries the refraction numbers + view\n // metadata (PD, lens type, axis system) only — NEVER the free-text\n // clinical note (PHI). The note is fetched deliberately via get_notes\n // (safety: 'phi').\n type: 'object',\n descriptionKey: 'ui.agent.opticalPrescription.state.prescription',\n description:\n 'Current prescription — refraction rows per band/eye plus PD, lens type and axis system. The free-text note is PHI and omitted; read it via get_notes.',\n read: (handle) => {\n // Explicitly project the note-free fields so the PHI note can never\n // leak into the always-on snapshot, even as the value model grows.\n const v = handle.getValue();\n return {\n bands: v.bands,\n pd: v.pd,\n pdRight: v.pdRight,\n pdLeft: v.pdLeft,\n lensType: v.lensType,\n axisSystem: v.axisSystem,\n };\n },\n },\n bands: {\n type: 'string[]',\n descriptionKey: 'ui.agent.opticalPrescription.state.bands',\n description:\n 'Distance bands carrying at least one refraction value (far / intermediate / near).',\n read: (handle) => handle.getBands(),\n },\n },\n actions: {\n focus_eye: {\n safety: 'read',\n argsType: '{ eye: Eye; band?: DistanceBand }',\n argsSchema: {\n type: 'object',\n properties: { eye: EYE_SCHEMA, band: BAND_SCHEMA },\n required: ['eye'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.focusEye',\n description:\n \"Move focus to an eye's row (first editable cell in interactive mode), optionally within a specific band.\",\n invoke: (handle, args: { eye: Eye; band?: DistanceBand }) => {\n handle.focusEye(args.eye, args.band);\n },\n },\n get_row: {\n safety: 'read',\n argsType: '{ band: DistanceBand; eye: Eye }',\n argsSchema: {\n type: 'object',\n properties: { band: BAND_SCHEMA, eye: EYE_SCHEMA },\n required: ['band', 'eye'],\n },\n returns: 'RefractionRow | undefined',\n returnsSchema: ROW_SCHEMA,\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.getRow',\n description: \"Read one eye's refraction row at a distance band.\",\n invoke: (handle, args: { band: DistanceBand; eye: Eye }) =>\n handle.getRow(args.band, args.eye),\n },\n get_notes: {\n // phi (not read): resolves the free-text clinical note, which is PHI.\n // PRS §26 — phi outranks read so the host gates it behind stricter\n // confirm + audit. The always-on state.prescription snapshot stays\n // note-free.\n safety: 'phi',\n returns: 'string',\n returnsSchema: { type: 'string' },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.getNotes',\n description: 'Read the free-text clinical note on the prescription.',\n invoke: (handle) => handle.getValue().notes ?? '',\n },\n set_cell: {\n safety: 'write',\n argsType:\n '{ band: DistanceBand; eye: Eye; field: keyof RefractionRow; value: number | PrismBase | null }',\n argsSchema: {\n type: 'object',\n properties: {\n band: BAND_SCHEMA,\n eye: EYE_SCHEMA,\n field: FIELD_SCHEMA,\n value: {\n description:\n 'New cell value — a number for the dioptric/axis/prism columns, a base-direction string for `base`, or null to clear.',\n },\n },\n required: ['band', 'eye', 'field', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.setCell',\n description:\n 'Set (or clear, with null) a single refraction cell — sphere / cylinder / axis / add / prism / base.',\n invoke: (\n handle,\n args: {\n band: DistanceBand;\n eye: Eye;\n field: keyof RefractionRow;\n value: number | PrismBase | null;\n },\n ) => {\n handle.setCell(args.band, args.eye, args.field, args.value);\n },\n },\n set_value: {\n safety: 'write',\n argsType: '{ value: OpticalPrescriptionValue }',\n argsSchema: {\n type: 'object',\n properties: { value: VALUE_SCHEMA },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.setValue',\n description: 'Replace the entire prescription value.',\n invoke: (handle, args: { value: OpticalPrescriptionValue }) => {\n handle.setValue(args.value);\n },\n },\n clear_band: {\n safety: 'destructive',\n argsType: '{ band: DistanceBand }',\n argsSchema: {\n type: 'object',\n properties: { band: BAND_SCHEMA },\n required: ['band'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.opticalPrescription.actions.clearBand',\n description: 'Clear every refraction row in a distance band.',\n invoke: (handle, args: { band: DistanceBand }) => {\n handle.clearBand(args.band);\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'optical-prescription' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-eye',\n description:\n 'Each refraction row carries its eye (`od` / `os`) as `data-eye` and its distance band as `data-band`; each editable cell carries the column key as `data-field`. The root `data-mode` attribute exposes interactive vs display. Standard chart figures carry `data-chart` (`tabo` / `powerCross` / `pd` / `prismBase`) plus `data-eye` on the per-eye ones.',\n },\n },\n };\n\n// Re-exported for callers building typed args against the adapter.\nexport type {\n DistanceBand,\n Eye,\n OpticalPrescriptionValue,\n PrismBase,\n RefractionRow,\n};\n","/* ------------------------------------------------------------------ */\n/* OpticalPrescription — value model + formatters. */\n/* */\n/* The kit's glasses optical-prescription (\"prescrizione oculistica */\n/* occhiali\") value model. A prescription is a set of refraction rows */\n/* keyed by distance BAND (far / intermediate / near) and EYE */\n/* (od / os) plus a metadata strip (PD, lens type, axis system, free */\n/* text note). The numeric fields are dioptric (sphere / cylinder / */\n/* add, in 0.25 steps with explicit ± sign) and the axis is 0–180°. */\n/* This module is a pure data/helpers module — no React, no i18n; the */\n/* component resolves every user-visible label via `useTranslation`. */\n/* ------------------------------------------------------------------ */\n\n/* ------------------------------------------------------------------ */\n/* Core vocabulary */\n/* ------------------------------------------------------------------ */\n\n/** International Latin eye abbreviations — `od` = right eye, `os` = left eye. */\nexport type Eye = 'od' | 'os';\n\n/** Distance band — `far` (per lontano), `intermediate`, `near` (per vicino). */\nexport type DistanceBand = 'far' | 'intermediate' | 'near';\n\n/** Prism base direction. */\nexport type PrismBase = 'up' | 'down' | 'in' | 'out';\n\n/** Lens construction. */\nexport type LensType = 'single-vision' | 'bifocal' | 'progressive';\n\n/** Axis notation system — TABO (European) or INT (international). */\nexport type AxisSystem = 'tabo' | 'int';\n\n/** `'interactive'` renders editable inputs; `'display'` is a read-only grid. */\nexport type OpticalPrescriptionMode = 'interactive' | 'display';\n\n/** One eye's refraction at one distance band. All fields optional. */\nexport interface RefractionRow {\n /** Spherical power, dioptres (±, 0.25 steps). */\n sphere?: number;\n /** Cylindrical power, dioptres (±, 0.25 steps). */\n cylinder?: number;\n /** Cylinder axis, 0–180°. */\n axis?: number;\n /** Reading addition, dioptres (+, 0.25 steps). */\n add?: number;\n /** Prismatic power, prism dioptres. */\n prism?: number;\n /** Prism base direction. */\n base?: PrismBase;\n}\n\n/** A full glasses prescription. */\nexport interface OpticalPrescriptionValue {\n /** Refraction rows, keyed by band then eye. */\n bands: Partial<Record<DistanceBand, Partial<Record<Eye, RefractionRow>>>>;\n /** Interpupillary distance (DIP / PD), millimetres. */\n pd?: number;\n /** Monocular PD, right eye (nose centre → OD pupil), millimetres. */\n pdRight?: number;\n /** Monocular PD, left eye (nose centre → OS pupil), millimetres. */\n pdLeft?: number;\n /** Lens construction. */\n lensType?: LensType;\n /** Axis notation system. */\n axisSystem?: AxisSystem;\n /** Free-text clinical note. PHI — never bundle real notes in stories. */\n notes?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Closed sets + ranges */\n/* ------------------------------------------------------------------ */\n\nexport const EYES: readonly Eye[] = ['od', 'os'];\nexport const DISTANCE_BANDS: readonly DistanceBand[] = [\n 'far',\n 'intermediate',\n 'near',\n];\nexport const PRISM_BASES: readonly PrismBase[] = ['up', 'down', 'in', 'out'];\nexport const LENS_TYPES: readonly LensType[] = [\n 'single-vision',\n 'bifocal',\n 'progressive',\n];\nexport const AXIS_SYSTEMS: readonly AxisSystem[] = ['tabo', 'int'];\n\n/** The dioptric columns, in display order. `base` pairs with `prism`. */\nexport const REFRACTION_COLUMNS: readonly (keyof RefractionRow)[] = [\n 'sphere',\n 'cylinder',\n 'axis',\n 'add',\n 'prism',\n 'base',\n];\n\n/** Dioptric step for sphere / cylinder / add. */\nexport const DIOPTRE_STEP = 0.25;\n/** Sphere range, dioptres. */\nexport const SPHERE_MIN = -30;\nexport const SPHERE_MAX = 30;\n/** Cylinder range, dioptres. */\nexport const CYLINDER_MIN = -12;\nexport const CYLINDER_MAX = 12;\n/** Reading addition range, dioptres. */\nexport const ADD_MIN = 0;\nexport const ADD_MAX = 6;\n/** Axis range, degrees. */\nexport const AXIS_MIN = 0;\nexport const AXIS_MAX = 180;\nexport const AXIS_STEP = 1;\n/** Interpupillary distance range, millimetres. */\nexport const PD_MIN = 40;\nexport const PD_MAX = 85;\n/** Prism range, prism dioptres. */\nexport const PRISM_MIN = 0;\nexport const PRISM_MAX = 20;\n\n/* ------------------------------------------------------------------ */\n/* Formatters */\n/* ------------------------------------------------------------------ */\n\n/**\n * Format a number with an explicit leading sign — `+1.50`, `-2.25`. Zero is\n * rendered unsigned (`0.00`). Used for sphere and cylinder, where optometry\n * convention always shows the sign.\n */\nexport function formatSigned(value: number, fractionDigits = 2): string {\n const fixed = Math.abs(value).toFixed(fractionDigits);\n if (value > 0) return `+${fixed}`;\n if (value < 0) return `-${fixed}`;\n return fixed;\n}\n\n/** Sphere power, explicit sign, 2 dp (`+2.00` / `-1.25`). */\nexport function formatSphere(value: number): string {\n return formatSigned(value, 2);\n}\n\n/** Cylinder power, explicit sign, 2 dp. */\nexport function formatCylinder(value: number): string {\n return formatSigned(value, 2);\n}\n\n/** Reading addition — always positive, 2 dp (`+2.00`). */\nexport function formatAdd(value: number): string {\n return `+${Math.abs(value).toFixed(2)}`;\n}\n\n/** Axis, integer degrees with the degree symbol (`90°`). */\nexport function formatAxis(value: number): string {\n const clamped = Math.min(AXIS_MAX, Math.max(AXIS_MIN, Math.round(value)));\n return `${clamped}°`;\n}\n\n/** Prism, 2 dp (`2.00`). */\nexport function formatPrism(value: number): string {\n return value.toFixed(2);\n}\n\n/**\n * Format the numeric value of one refraction column for the read-only grid.\n * `base` is a string enum the component resolves through i18n separately, so it\n * never reaches this numeric formatter; any unhandled field falls through the\n * default branch and is coerced with `String(value)`.\n */\nexport function formatRefraction(\n field: keyof RefractionRow,\n value: number,\n): string {\n switch (field) {\n case 'sphere':\n return formatSphere(value);\n case 'cylinder':\n return formatCylinder(value);\n case 'add':\n return formatAdd(value);\n case 'axis':\n return formatAxis(value);\n case 'prism':\n return formatPrism(value);\n default:\n return String(value);\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Meridian maths (power cross) */\n/* ------------------------------------------------------------------ */\n\n/** Power along one principal meridian, for the optical power cross. */\nexport interface MeridianPower {\n /** Meridian orientation, degrees, normalised to [0, 180). */\n deg: number;\n /** Dioptric power along this meridian. */\n power: number;\n}\n\n/**\n * Normalise an axis to the conventional 0–180° range. Values already in\n * range are kept verbatim (180 stays 180 — the form convention), anything\n * outside wraps modulo 180. Single source of truth so the TABO dial, the\n * power cross, and their labels can never disagree about one meridian.\n */\nexport function normalizeAxis(deg: number): number {\n if (deg >= AXIS_MIN && deg <= AXIS_MAX) return deg;\n return ((deg % 180) + 180) % 180;\n}\n\n/**\n * Resolve a sphero-cylindrical row into its two principal meridians.\n * The cylinder AXIS meridian carries the sphere power; the meridian 90°\n * away carries sphere + cylinder. A row with neither sphere nor cylinder\n * has no cross — returns `undefined`. A missing sphere is plano (0.00);\n * a missing axis defaults to 0°.\n */\nexport function meridianPowers(\n row: RefractionRow | undefined,\n): { primary: MeridianPower; secondary: MeridianPower } | undefined {\n if (!row || (row.sphere === undefined && row.cylinder === undefined)) {\n return undefined;\n }\n const sphere = row.sphere ?? 0;\n const cylinder = row.cylinder ?? 0;\n const axis = normalizeAxis(row.axis ?? 0);\n return {\n primary: { deg: axis, power: sphere },\n secondary: { deg: (axis + 90) % 180, power: sphere + cylinder },\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Immutable helpers */\n/* ------------------------------------------------------------------ */\n\n/** An empty prescription. */\nexport function emptyValue(): OpticalPrescriptionValue {\n return { bands: {} };\n}\n\n/** Read one eye's row at one band (undefined when absent). */\nexport function getRow(\n value: OpticalPrescriptionValue,\n band: DistanceBand,\n eye: Eye,\n): RefractionRow | undefined {\n return value.bands[band]?.[eye];\n}\n\n/**\n * Immutably set (or clear) a single cell. Passing `undefined` / `null` removes\n * the field; emptying a row removes the row, and emptying a band removes the\n * band — so `bandsInValue` and the agent state snapshot stay tight.\n */\nexport function setCell<K extends keyof RefractionRow>(\n value: OpticalPrescriptionValue,\n band: DistanceBand,\n eye: Eye,\n field: K,\n fieldValue: RefractionRow[K] | undefined,\n): OpticalPrescriptionValue {\n const bands = { ...value.bands };\n const bandRows = { ...(bands[band] ?? {}) };\n const row: RefractionRow = { ...(bandRows[eye] ?? {}) };\n\n if (fieldValue === undefined || fieldValue === null) {\n delete row[field];\n } else {\n row[field] = fieldValue;\n }\n\n if (Object.keys(row).length === 0) {\n delete bandRows[eye];\n } else {\n bandRows[eye] = row;\n }\n\n if (Object.keys(bandRows).length === 0) {\n delete bands[band];\n } else {\n bands[band] = bandRows;\n }\n\n return { ...value, bands };\n}\n\n/** Immutably remove every row in a band. */\nexport function clearBand(\n value: OpticalPrescriptionValue,\n band: DistanceBand,\n): OpticalPrescriptionValue {\n if (!value.bands[band]) return value;\n const bands = { ...value.bands };\n delete bands[band];\n return { ...value, bands };\n}\n\n/** The distance bands carrying at least one refraction value, in order. */\nexport function bandsInValue(value: OpticalPrescriptionValue): DistanceBand[] {\n return DISTANCE_BANDS.filter((band) => {\n const rows = value.bands[band];\n if (!rows) return false;\n return EYES.some((eye) => {\n const row = rows[eye];\n return row !== undefined && Object.keys(row).length > 0;\n });\n });\n}\n","/* ------------------------------------------------------------------ */\n/* OpticalPrescription — standard prescription charts. */\n/* */\n/* The graphical elements of a real-world glasses prescription form: */\n/* the TABO axis dial (semicircular 0–180° protractor with the */\n/* cylinder-axis needle), the optical power cross (the two principal */\n/* meridians with their dioptric powers), the PD centration schematic */\n/* (eyes + dimension line, total or monocular split), and the prism */\n/* base rose (BU / BD / BI / BO compass with the base-direction */\n/* arrow). Pure presentational SVG — all user-visible strings arrive */\n/* pre-translated from the parent component; every paint is a token */\n/* via Tailwind arbitrary-property classes (house SVG convention). */\n/* */\n/* Geometry is EXAMINER-VIEW, like the odontogram: OD is drawn to the */\n/* left of OS and nasal (\"in\") points towards the other eye. These are */\n/* physical clinical diagrams — they do not mirror in RTL. */\n/* ------------------------------------------------------------------ */\n\nimport type { ReactElement } from 'react';\nimport {\n normalizeAxis,\n type Eye,\n type PrismBase,\n} from './optical-prescription-data';\n\n/* ------------------------------------------------------------------ */\n/* Chart vocabulary */\n/* ------------------------------------------------------------------ */\n\n/** The standard prescription chart kinds, in display order. */\nexport const CHART_KINDS = ['tabo', 'powerCross', 'pd', 'prismBase'] as const;\nexport type OpticalPrescriptionChart = (typeof CHART_KINDS)[number];\n\n/* ------------------------------------------------------------------ */\n/* Shared paint + layout classes (tokens only) */\n/* ------------------------------------------------------------------ */\n\nconst chromeStroke = 'ds:[stroke:var(--muted-foreground)] ds:[fill:none]';\nconst chromeText = 'ds:[fill:var(--muted-foreground)]';\nconst inkStroke = 'ds:[stroke:var(--foreground)] ds:[fill:none]';\nconst inkText = 'ds:[fill:var(--foreground)]';\nconst needleStroke = 'ds:[stroke:var(--primary)] ds:[fill:none]';\nconst needleFill = 'ds:[fill:var(--primary)]';\n\nconst figureClass = 'ds:m-0 ds:flex ds:flex-col ds:items-center ds:gap-1';\nconst captionClass =\n 'ds:text-[length:var(--font-size-xs)] ds:text-[var(--muted-foreground)] ds:text-center';\n\n/** Polar → SVG cartesian (SVG y grows downwards). Angle in degrees. */\nfunction polar(\n cx: number,\n cy: number,\n r: number,\n deg: number,\n): [number, number] {\n const rad = (deg * Math.PI) / 180;\n return [cx + r * Math.cos(rad), cy - r * Math.sin(rad)];\n}\n\ninterface ChartFigureProps {\n chart: OpticalPrescriptionChart;\n eye?: Eye;\n caption: string;\n /** Optional second caption line — readable HTML echo of values that only\n * appear at small SVG size inside the drawing (low-vision support). */\n detail?: string;\n children: ReactElement;\n}\n\n/** Shared figure shell — carries the `data-chart` (+ `data-eye`) DOM hooks.\n * Captions get `dir=\"auto\"`: the strip pins the FIGURE ORDER LTR (examiner\n * view), but the caption text itself is translated prose and must resolve\n * its own base direction in RTL locales. */\nfunction ChartFigure({\n chart,\n eye,\n caption,\n detail,\n children,\n}: ChartFigureProps) {\n return (\n <figure className={figureClass} data-chart={chart} data-eye={eye}>\n {children}\n <figcaption dir=\"auto\" className={captionClass}>\n {caption}\n {detail !== undefined && (\n <span className=\"ds:block ds:text-[var(--foreground)]\">{detail}</span>\n )}\n </figcaption>\n </figure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* TABO axis dial */\n/* ------------------------------------------------------------------ */\n\nexport interface TaboDialProps {\n eye: Eye;\n /** Cylinder axis, degrees (0–180). */\n axisDeg: number;\n /** Full-sentence accessible description (translated). */\n ariaLabel: string;\n /** Short visible caption (translated). */\n caption: string;\n}\n\nconst TABO_CX = 60;\nconst TABO_CY = 62;\nconst TABO_R = 48;\n/** Tick marks: [angle, length]. Majors at 0/90/180, mids at 45/135. */\nconst TABO_TICKS: ReadonlyArray<[number, number]> = [\n [0, 7],\n [30, 4],\n [45, 5],\n [60, 4],\n [90, 7],\n [120, 4],\n [135, 5],\n [150, 4],\n [180, 7],\n];\nconst TABO_LABELS: readonly number[] = [0, 45, 90, 135, 180];\n\n/**\n * The TABO protractor: an upper semicircle graduated anticlockwise from 0°\n * on the right to 180° on the left (identical for both eyes — that is what\n * distinguishes TABO from older per-eye schemes), with a needle marking the\n * cylinder axis.\n */\nexport function TaboDial({ eye, axisDeg, ariaLabel, caption }: TaboDialProps) {\n const axis = normalizeAxis(axisDeg);\n const [nx, ny] = polar(TABO_CX, TABO_CY, TABO_R - 6, axis);\n return (\n <ChartFigure chart=\"tabo\" eye={eye} caption={caption}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"-4 0 128 76\"\n className=\"ds:w-36\"\n >\n {/* Baseline + arc */}\n <line\n x1={TABO_CX - TABO_R}\n y1={TABO_CY}\n x2={TABO_CX + TABO_R}\n y2={TABO_CY}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <path\n d={`M ${TABO_CX - TABO_R} ${TABO_CY} A ${TABO_R} ${TABO_R} 0 0 1 ${TABO_CX + TABO_R} ${TABO_CY}`}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n {/* Graduation ticks */}\n {TABO_TICKS.map(([deg, len]) => {\n const [x1, y1] = polar(TABO_CX, TABO_CY, TABO_R, deg);\n const [x2, y2] = polar(TABO_CX, TABO_CY, TABO_R - len, deg);\n return (\n <line\n key={deg}\n x1={x1}\n y1={y1}\n x2={x2}\n y2={y2}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n );\n })}\n {/* Degree labels */}\n {TABO_LABELS.map((deg) => {\n const [x, y] = polar(TABO_CX, TABO_CY, TABO_R + 7, deg);\n return (\n <text\n key={deg}\n x={x}\n y={y + 2}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {deg}\n </text>\n );\n })}\n {/* Axis needle */}\n <line\n x1={TABO_CX}\n y1={TABO_CY}\n x2={nx}\n y2={ny}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n className={needleStroke}\n />\n <circle cx={TABO_CX} cy={TABO_CY} r=\"2.5\" className={needleFill} />\n </svg>\n </ChartFigure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Optical power cross */\n/* ------------------------------------------------------------------ */\n\nexport interface PowerCrossProps {\n eye: Eye;\n /** The axis meridian — carries the sphere power. */\n primary: { deg: number; power: number };\n /** The meridian 90° away — carries sphere + cylinder. */\n secondary: { deg: number; power: number };\n /** Pre-formatted power labels (translated / signed). */\n primaryText: string;\n secondaryText: string;\n ariaLabel: string;\n caption: string;\n /** Readable echo of both meridian powers, shown under the caption. */\n detail?: string;\n}\n\nconst CROSS_CX = 75;\nconst CROSS_CY = 56;\nconst CROSS_ARM = 32;\nconst CROSS_LABEL_R = 44;\n\n/**\n * The optical cross: one line per principal meridian, each annotated with\n * its dioptric power (and meridian angle beneath). Labels sit at the upper\n * end of each line — meridians live in [0, 180), so that end never dips\n * below the horizontal.\n */\nexport function PowerCross({\n eye,\n primary,\n secondary,\n primaryText,\n secondaryText,\n ariaLabel,\n caption,\n detail,\n}: PowerCrossProps) {\n const meridians = [\n { ...primary, text: primaryText },\n { ...secondary, text: secondaryText },\n ];\n return (\n <ChartFigure chart=\"powerCross\" eye={eye} caption={caption} detail={detail}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"0 0 150 104\"\n className=\"ds:w-40\"\n >\n {meridians.map(({ deg, text }) => {\n const [x1, y1] = polar(CROSS_CX, CROSS_CY, CROSS_ARM, deg + 180);\n const [x2, y2] = polar(CROSS_CX, CROSS_CY, CROSS_ARM, deg);\n const [lx, ly] = polar(CROSS_CX, CROSS_CY, CROSS_LABEL_R, deg);\n return (\n <g key={deg}>\n <line\n x1={x1}\n y1={y1}\n x2={x2}\n y2={y2}\n strokeWidth=\"1.5\"\n className={inkStroke}\n />\n <text\n x={lx}\n y={ly - 4}\n fontSize=\"9\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {text}\n </text>\n <text\n x={lx}\n y={ly + 5}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {deg}°\n </text>\n </g>\n );\n })}\n </svg>\n </ChartFigure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* PD centration schematic */\n/* ------------------------------------------------------------------ */\n\nexport interface PdSchematicProps {\n /** Total PD label (\"63 mm\") — drawn centred when no split is given. */\n totalText?: string;\n /** Monocular labels (right = OD, drawn on the LEFT — examiner view). */\n rightText?: string;\n leftText?: string;\n ariaLabel: string;\n caption: string;\n /** Readable echo of the measurement, shown under the caption. */\n detail?: string;\n}\n\nconst PD_EYES: ReadonlyArray<[Eye, number]> = [\n ['od', 60],\n ['os', 160],\n];\nconst PD_EYE_Y = 24;\nconst PD_DIM_Y = 50;\n\n/**\n * Two stylised eyes with the pupillary-distance dimension line. With\n * monocular values the line splits at the nose-centre tick — OD's half is\n * drawn on the left (examiner view).\n */\nexport function PdSchematic({\n totalText,\n rightText,\n leftText,\n ariaLabel,\n caption,\n detail,\n}: PdSchematicProps) {\n const split = rightText !== undefined && leftText !== undefined;\n return (\n <ChartFigure chart=\"pd\" caption={caption} detail={detail}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"0 0 220 64\"\n className=\"ds:w-52\"\n >\n {PD_EYES.map(([eye, cx]) => (\n <g key={eye}>\n <ellipse\n cx={cx}\n cy={PD_EYE_Y}\n rx=\"17\"\n ry=\"9\"\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <circle cx={cx} cy={PD_EYE_Y} r=\"3.5\" className={needleFill} />\n {/* Pupil → dimension-line guide */}\n <line\n x1={cx}\n y1={PD_EYE_Y + 10}\n x2={cx}\n y2={PD_DIM_Y + 4}\n strokeWidth=\"1\"\n strokeDasharray=\"2 2\"\n className={chromeStroke}\n />\n </g>\n ))}\n {/* Dimension line with arrowheads */}\n <line\n x1=\"60\"\n y1={PD_DIM_Y}\n x2=\"160\"\n y2={PD_DIM_Y}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n <path\n d={`M 66 ${PD_DIM_Y - 3} L 60 ${PD_DIM_Y} L 66 ${PD_DIM_Y + 3}`}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n <path\n d={`M 154 ${PD_DIM_Y - 3} L 160 ${PD_DIM_Y} L 154 ${PD_DIM_Y + 3}`}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n {split ? (\n <>\n {/* Nose-centre tick + monocular labels (OD left, OS right) */}\n <line\n x1=\"110\"\n y1={PD_DIM_Y - 4}\n x2=\"110\"\n y2={PD_DIM_Y + 4}\n strokeWidth=\"1\"\n className={inkStroke}\n />\n <text\n x=\"85\"\n y={PD_DIM_Y - 6}\n fontSize=\"8\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {rightText}\n </text>\n <text\n x=\"135\"\n y={PD_DIM_Y - 6}\n fontSize=\"8\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {leftText}\n </text>\n </>\n ) : (\n <text\n x=\"110\"\n y={PD_DIM_Y - 6}\n fontSize=\"8\"\n textAnchor=\"middle\"\n className={inkText}\n >\n {totalText}\n </text>\n )}\n </svg>\n </ChartFigure>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Prism base rose */\n/* ------------------------------------------------------------------ */\n\nexport interface PrismRoseProps {\n eye: Eye;\n base: PrismBase;\n /** Localised compass labels (BU / BD / BI / BO). */\n labels: Record<PrismBase, string>;\n ariaLabel: string;\n caption: string;\n}\n\nconst ROSE_CX = 60;\nconst ROSE_CY = 52;\nconst ROSE_ARM = 28;\n\n/** Base direction → angle, per eye. Nasal (\"in\") points towards the other\n * eye: OD is drawn to the left of OS (examiner view), so its nasal side is\n * the right of its own rose — and mirrored for OS. */\nfunction baseAngle(eye: Eye, base: PrismBase): number {\n switch (base) {\n case 'up':\n return 90;\n case 'down':\n return 270;\n case 'in':\n return eye === 'od' ? 0 : 180;\n case 'out':\n return eye === 'od' ? 180 : 0;\n }\n}\n\n/**\n * A compass rose showing the prism base direction: chrome cross with the\n * four base labels, and an arrow along the prescribed base.\n */\nexport function PrismRose({\n eye,\n base,\n labels,\n ariaLabel,\n caption,\n}: PrismRoseProps) {\n const angle = baseAngle(eye, base);\n const [ax, ay] = polar(ROSE_CX, ROSE_CY, ROSE_ARM - 6, angle);\n const [hx, hy] = polar(ROSE_CX, ROSE_CY, ROSE_ARM, angle);\n const [w1x, w1y] = polar(ROSE_CX, ROSE_CY, ROSE_ARM - 7, angle + 8);\n const [w2x, w2y] = polar(ROSE_CX, ROSE_CY, ROSE_ARM - 7, angle - 8);\n // Nasal side of the rose (see baseAngle) — labels swap between eyes.\n const rightLabel = eye === 'od' ? labels.in : labels.out;\n const leftLabel = eye === 'od' ? labels.out : labels.in;\n return (\n <ChartFigure chart=\"prismBase\" eye={eye} caption={caption}>\n <svg\n role=\"img\"\n aria-label={ariaLabel}\n viewBox=\"0 0 120 104\"\n className=\"ds:w-32\"\n >\n <line\n x1={ROSE_CX - ROSE_ARM}\n y1={ROSE_CY}\n x2={ROSE_CX + ROSE_ARM}\n y2={ROSE_CY}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <line\n x1={ROSE_CX}\n y1={ROSE_CY - ROSE_ARM}\n x2={ROSE_CX}\n y2={ROSE_CY + ROSE_ARM}\n strokeWidth=\"1\"\n className={chromeStroke}\n />\n <text\n x={ROSE_CX}\n y={ROSE_CY - ROSE_ARM - 5}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {labels.up}\n </text>\n <text\n x={ROSE_CX}\n y={ROSE_CY + ROSE_ARM + 11}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {labels.down}\n </text>\n <text\n x={ROSE_CX + ROSE_ARM + 10}\n y={ROSE_CY + 2}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {rightLabel}\n </text>\n <text\n x={ROSE_CX - ROSE_ARM - 10}\n y={ROSE_CY + 2}\n fontSize=\"7\"\n textAnchor=\"middle\"\n className={chromeText}\n >\n {leftLabel}\n </text>\n {/* Base-direction arrow */}\n <line\n x1={ROSE_CX}\n y1={ROSE_CY}\n x2={ax}\n y2={ay}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n className={needleStroke}\n />\n <polygon\n points={`${hx},${hy} ${w1x},${w1y} ${w2x},${w2y}`}\n className={needleFill}\n />\n <circle cx={ROSE_CX} cy={ROSE_CY} r=\"2.5\" className={needleFill} />\n </svg>\n </ChartFigure>\n );\n}\n","/* ------------------------------------------------------------------ */\n/* OpticalPrescription — the kit's glasses prescription grid. */\n/* */\n/* The ophthalmology equivalent of ToothScheme: a first-class shipped */\n/* component with an editable (`interactive`) and a read-only */\n/* (`display`) mode over a shared value model. A prescription is laid */\n/* out as one small grid per distance BAND (far / intermediate / near) */\n/* with an OD (right eye) and an OS (left eye) row, plus a metadata */\n/* strip (PD, lens type, axis system, free-text note). */\n/* */\n/* It is NOT an HTML <table>: the grid is a CSS grid of ARIA-table */\n/* cells, so the editable mode lays kit NumberInputs / Selects out in */\n/* the same column tracks as the read-only formatted values. OD / OS */\n/* keep the international Latin abbreviations; the full eye name is the */\n/* accessible label. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useCallback,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type ReactElement,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { NumberInput } from '../number-input';\nimport { Select } from '../select';\nimport { TextArea } from '../text-area';\nimport { DescriptionList } from '../description-list';\nimport { opticalPrescriptionAgent } from './optical-prescription.agent';\nimport {\n ADD_MAX,\n ADD_MIN,\n AXIS_MAX,\n AXIS_MIN,\n AXIS_STEP,\n AXIS_SYSTEMS,\n CYLINDER_MAX,\n CYLINDER_MIN,\n DIOPTRE_STEP,\n EYES,\n LENS_TYPES,\n PD_MAX,\n PD_MIN,\n PRISM_BASES,\n PRISM_MAX,\n PRISM_MIN,\n SPHERE_MAX,\n SPHERE_MIN,\n bandsInValue,\n emptyValue,\n formatAxis,\n formatPrism,\n formatRefraction,\n formatSigned,\n meridianPowers,\n normalizeAxis,\n getRow as getRowData,\n setCell as setCellData,\n clearBand as clearBandData,\n type AxisSystem,\n type DistanceBand,\n type Eye,\n type LensType,\n type OpticalPrescriptionMode,\n type OpticalPrescriptionValue,\n type PrismBase,\n type RefractionRow,\n} from './optical-prescription-data';\nimport {\n CHART_KINDS,\n PdSchematic,\n PowerCross,\n PrismRose,\n TaboDial,\n type OpticalPrescriptionChart,\n} from './optical-prescription-charts';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface OpticalPrescriptionProps {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** `'interactive'` enables editing; `'display'` is a read-only grid. Default `'interactive'`. */\n mode?: OpticalPrescriptionMode;\n /** Controlled prescription value. */\n value?: OpticalPrescriptionValue;\n /** Uncontrolled initial value. */\n defaultValue?: OpticalPrescriptionValue;\n /** Fired whenever the prescription changes. */\n onChange?: (next: OpticalPrescriptionValue) => void;\n /** Distance bands to render, in order. Default `['far', 'near']`. */\n bands?: DistanceBand[];\n /** Render the prism + base columns. Default `false`. */\n showPrism?: boolean;\n /** Render the metadata strip (PD, lens type, axis system, note). Default `true`. */\n metadata?: boolean;\n /** The standard prescription charts (TABO axis dials, power crosses, PD\n * schematic, prism base roses). `true` renders every chart the value\n * carries data for; an array cherry-picks kinds; `false` hides them all.\n * Default `true`. */\n charts?: boolean | OpticalPrescriptionChart[];\n /** The distance band the charts read from. Default: the first rendered\n * band carrying at least one value. */\n chartsBand?: DistanceBand;\n /** Vertical rhythm. Default `'comfortable'`. */\n density?: 'comfortable' | 'compact';\n /** Accessible label override for the prescription region. */\n ariaLabel?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport interface OpticalPrescriptionHandle {\n /** Focus an eye's row (first editable cell in interactive mode), optionally within a band. */\n focusEye: (eye: Eye, band?: DistanceBand) => void;\n /** Read the current prescription value. */\n getValue: () => OpticalPrescriptionValue;\n /** Replace the prescription value. */\n setValue: (next: OpticalPrescriptionValue) => void;\n /** Read one eye's refraction row at a band (undefined when absent). */\n getRow: (band: DistanceBand, eye: Eye) => RefractionRow | undefined;\n /** Set (or clear, with null) a single refraction cell. */\n setCell: (\n band: DistanceBand,\n eye: Eye,\n field: keyof RefractionRow,\n value: number | PrismBase | null,\n ) => void;\n /** Clear every refraction row in a band. */\n clearBand: (band: DistanceBand) => void;\n /** The distance bands carrying at least one value. */\n getBands: () => DistanceBand[];\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst containerVariants = cva('ds:flex ds:flex-col', {\n variants: {\n density: {\n comfortable: 'ds:gap-4',\n compact: 'ds:gap-2',\n },\n },\n defaultVariants: { density: 'comfortable' },\n});\n\n// Literal class strings so Tailwind compiles each grid template (it cannot see\n// a dynamically built class name). Keyed by refraction-column count; the eye\n// column is the leading minmax track outside the repeat().\nconst GRID_TEMPLATE: Record<number, string> = {\n 4: 'ds:[grid-template-columns:minmax(2.75rem,auto)_repeat(4,minmax(0,1fr))]',\n 6: 'ds:[grid-template-columns:minmax(2.75rem,auto)_repeat(6,minmax(0,1fr))]',\n};\n\nconst headerCell =\n 'ds:text-[length:var(--font-size-xs)] ds:font-[var(--font-weight-medium)] ds:text-[var(--muted-foreground)]';\nconst numericCell =\n 'ds:text-end ds:tabular-nums ds:text-[length:var(--font-size-sm)] ds:text-[var(--foreground)]';\n\n/* ------------------------------------------------------------------ */\n/* OpticalPrescription */\n/* ------------------------------------------------------------------ */\n\nexport const OpticalPrescription = forwardRef<\n OpticalPrescriptionHandle,\n OpticalPrescriptionProps\n>(\n (\n {\n id,\n mode = 'interactive',\n value,\n defaultValue,\n onChange,\n bands = ['far', 'near'],\n showPrism = false,\n metadata = true,\n charts = true,\n chartsBand,\n density = 'comfortable',\n ariaLabel,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const reactId = useId();\n const instanceId = id ?? reactId;\n const rootRef = useRef<HTMLDivElement>(null);\n\n const interactive = mode === 'interactive';\n\n const isControlled = value !== undefined;\n const [internal, setInternal] = useState<OpticalPrescriptionValue>(\n defaultValue ?? emptyValue(),\n );\n const current = isControlled ? value : internal;\n const valueRef = useRef<OpticalPrescriptionValue>(current);\n valueRef.current = current;\n\n const commit = useCallback(\n (next: OpticalPrescriptionValue) => {\n if (!isControlled) setInternal(next);\n onChange?.(next);\n },\n [isControlled, onChange],\n );\n\n const setCellFn = useCallback(\n (\n band: DistanceBand,\n eye: Eye,\n field: keyof RefractionRow,\n v: number | PrismBase | null,\n ) => {\n commit(setCellData(valueRef.current, band, eye, field, v ?? undefined));\n },\n [commit],\n );\n\n const setMeta = useCallback(\n (patch: Partial<OpticalPrescriptionValue>) => {\n commit({ ...valueRef.current, ...patch });\n },\n [commit],\n );\n\n const renderedBands = bands;\n const renderedBandsRef = useRef<DistanceBand[]>(renderedBands);\n renderedBandsRef.current = renderedBands;\n\n const columns = useMemo<(keyof RefractionRow)[]>(\n () =>\n showPrism\n ? ['sphere', 'cylinder', 'axis', 'add', 'prism', 'base']\n : ['sphere', 'cylinder', 'axis', 'add'],\n [showPrism],\n );\n\n const focusEye = useCallback((eye: Eye, band?: DistanceBand) => {\n const root = rootRef.current;\n if (!root) return;\n const targetBand = band ?? renderedBandsRef.current[0];\n if (!targetBand) return;\n const row = root.querySelector<HTMLElement>(\n `[data-band=\"${targetBand}\"][data-eye=\"${eye}\"]`,\n );\n if (!row) return;\n // Editable controls win: in interactive mode the first cell's NumberInput /\n // Select is the focus target, NOT the static rowheader (which also matches\n // `[tabindex]`). The NumberInput's decorative spinner buttons carry\n // `tabindex=\"-1\"`, so excluding them lands focus on the real input. Only\n // when the row has no editable control (display mode) do we fall back to\n // the `[tabindex]` rowheader, then the row itself.\n const focusable =\n row.querySelector<HTMLElement>(\n 'input, textarea, button:not([tabindex=\"-1\"])',\n ) ?? row.querySelector<HTMLElement>('[tabindex]');\n (focusable ?? row).focus();\n }, []);\n\n /* ---- Imperative handle + agent registration ---- */\n const handle = useMemo<OpticalPrescriptionHandle>(\n () => ({\n focusEye,\n getValue: () => valueRef.current,\n setValue: (next) => commit(next),\n getRow: (band, eye) => getRowData(valueRef.current, band, eye),\n setCell: setCellFn,\n clearBand: (band) => commit(clearBandData(valueRef.current, band)),\n getBands: () => bandsInValue(valueRef.current),\n }),\n [focusEye, commit, setCellFn],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(opticalPrescriptionAgent, handle, instanceId);\n\n /* ---- Labels ---- */\n const eyeName = useCallback(\n (eye: Eye): string => t(`opticalPrescription.eye.${eye}Name`),\n [t],\n );\n const columnLabel = useCallback(\n (col: keyof RefractionRow): string =>\n t(`opticalPrescription.column.${col}`),\n [t],\n );\n const bandLabel = useCallback(\n (band: DistanceBand): string => t(`opticalPrescription.band.${band}`),\n [t],\n );\n\n /* ---- Cell renderers ---- */\n const renderEditableCell = useCallback(\n (\n band: DistanceBand,\n eye: Eye,\n col: keyof RefractionRow,\n ): ReactElement => {\n const row = getRowData(valueRef.current, band, eye);\n const raw = row?.[col];\n const cellAria = t('opticalPrescription.cellLabel', {\n eye: eyeName(eye),\n column: columnLabel(col),\n band: bandLabel(band),\n });\n\n if (col === 'base') {\n const baseValue: PrismBase | '' = typeof raw === 'string' ? raw : '';\n return (\n <div key={col} role=\"cell\" data-field={col} className=\"ds:min-w-0\">\n <Select<PrismBase>\n size=\"md\"\n clearable\n aria-label={cellAria}\n value={baseValue}\n options={PRISM_BASES.map((b) => ({\n value: b,\n label: t(`opticalPrescription.base.${b}`),\n }))}\n onValueChange={(next) =>\n setCellFn(band, eye, 'base', next === '' ? null : next)\n }\n />\n </div>\n );\n }\n\n const numeric = typeof raw === 'number' ? raw : null;\n const numberProps =\n col === 'axis'\n ? {\n mode: 'integer' as const,\n step: AXIS_STEP,\n min: AXIS_MIN,\n max: AXIS_MAX,\n }\n : col === 'add'\n ? {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: ADD_MIN,\n max: ADD_MAX,\n }\n : col === 'prism'\n ? {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: PRISM_MIN,\n max: PRISM_MAX,\n }\n : col === 'cylinder'\n ? {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: CYLINDER_MIN,\n max: CYLINDER_MAX,\n }\n : {\n mode: 'decimal' as const,\n step: DIOPTRE_STEP,\n min: SPHERE_MIN,\n max: SPHERE_MAX,\n };\n\n return (\n <div key={col} role=\"cell\" data-field={col} className=\"ds:min-w-0\">\n <NumberInput\n size=\"md\"\n aria-label={cellAria}\n value={numeric}\n {...numberProps}\n onChange={(n) => setCellFn(band, eye, col, n)}\n />\n </div>\n );\n },\n [t, eyeName, columnLabel, bandLabel, setCellFn],\n );\n\n const renderDisplayCell = useCallback(\n (\n band: DistanceBand,\n eye: Eye,\n col: keyof RefractionRow,\n ): ReactElement => {\n const row = getRowData(valueRef.current, band, eye);\n const raw = row?.[col];\n let text: string;\n if (raw === undefined) {\n text = t('opticalPrescription.empty');\n } else if (col === 'base' && typeof raw === 'string') {\n text = t(`opticalPrescription.base.${raw}`);\n } else if (typeof raw === 'number') {\n text = formatRefraction(col, raw);\n } else {\n text = t('opticalPrescription.empty');\n }\n return (\n <span key={col} role=\"cell\" data-field={col} className={numericCell}>\n {text}\n </span>\n );\n },\n [t],\n );\n\n const renderBand = useCallback(\n (band: DistanceBand): ReactElement => {\n const titleId = `${instanceId}-band-${band}`;\n const template = GRID_TEMPLATE[columns.length] ?? GRID_TEMPLATE[4];\n return (\n <section\n key={band}\n className=\"ds:flex ds:flex-col ds:gap-1\"\n aria-labelledby={titleId}\n >\n {/* Band label is a CAPTION, not a document heading: each band is a\n role=\"table\" with this text as its accessible name, so emitting it\n as an <h4> would inject a spurious heading level (and an h2→h4 skip\n when a host page mounts the grid under an h2 section). A <p>\n caption keeps the visual label and the section's accessible name\n without entering the heading outline. */}\n <p\n id={titleId}\n className=\"ds:m-0 ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]\"\n >\n {bandLabel(band)}\n </p>\n <div\n role=\"table\"\n aria-label={bandLabel(band)}\n className={`ds:grid ds:items-center ds:gap-x-2 ds:gap-y-1 ${template}`}\n >\n {/* Header row */}\n <div role=\"row\" className=\"ds:contents\">\n <span\n role=\"columnheader\"\n className={`${headerCell} ds:text-start`}\n >\n {t('opticalPrescription.column.eye')}\n </span>\n {columns.map((col) => (\n <span\n key={col}\n role=\"columnheader\"\n className={`${headerCell} ds:text-end`}\n >\n {columnLabel(col)}\n </span>\n ))}\n </div>\n {/* Eye rows */}\n {EYES.map((eye) => (\n <div\n key={eye}\n role=\"row\"\n data-eye={eye}\n data-band={band}\n className=\"ds:contents\"\n >\n <span\n role=\"rowheader\"\n tabIndex={-1}\n aria-label={eyeName(eye)}\n className=\"ds:text-start ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-semibold)] ds:tabular-nums ds:text-[var(--foreground)] ds:outline-none ds:rounded-[var(--radius-sm)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]\"\n >\n {t(`opticalPrescription.eye.${eye}`)}\n </span>\n {columns.map((col) =>\n interactive\n ? renderEditableCell(band, eye, col)\n : renderDisplayCell(band, eye, col),\n )}\n </div>\n ))}\n </div>\n </section>\n );\n },\n [\n instanceId,\n columns,\n interactive,\n bandLabel,\n columnLabel,\n eyeName,\n renderEditableCell,\n renderDisplayCell,\n t,\n ],\n );\n\n /* ---- Standard prescription charts ---- */\n const enabledCharts = useMemo<readonly OpticalPrescriptionChart[]>(() => {\n if (charts === false) return [];\n if (charts === true) return CHART_KINDS;\n return charts;\n }, [charts]);\n\n const renderCharts = useCallback((): ReactElement | null => {\n if (enabledCharts.length === 0) return null;\n const v = current;\n const withData = bandsInValue(v);\n const band =\n chartsBand ?? renderedBands.find((b) => withData.includes(b));\n const rowOf = (eye: Eye): RefractionRow | undefined =>\n band ? getRowData(v, band, eye) : undefined;\n\n const figures: ReactElement[] = [];\n\n if (enabledCharts.includes('tabo')) {\n for (const eye of EYES) {\n const rawAxis = rowOf(eye)?.axis;\n if (rawAxis === undefined) continue;\n // One normalisation for needle, caption, and aria — so the dial\n // can never disagree with the power cross about the meridian.\n const axis = normalizeAxis(rawAxis);\n figures.push(\n <TaboDial\n key={`tabo-${eye}`}\n eye={eye}\n axisDeg={axis}\n ariaLabel={t('opticalPrescription.charts.tabo.aria', {\n eye: eyeName(eye),\n axis: formatAxis(axis),\n })}\n caption={t('opticalPrescription.charts.tabo.caption', {\n eye: t(`opticalPrescription.eye.${eye}`),\n axis: formatAxis(axis),\n })}\n />,\n );\n }\n }\n\n if (enabledCharts.includes('powerCross')) {\n for (const eye of EYES) {\n const powers = meridianPowers(rowOf(eye));\n if (!powers) continue;\n figures.push(\n <PowerCross\n key={`cross-${eye}`}\n eye={eye}\n primary={powers.primary}\n secondary={powers.secondary}\n primaryText={formatSigned(powers.primary.power, 2)}\n secondaryText={formatSigned(powers.secondary.power, 2)}\n ariaLabel={t('opticalPrescription.charts.powerCross.aria', {\n eye: eyeName(eye),\n primary: formatSigned(powers.primary.power, 2),\n primaryDeg: formatAxis(powers.primary.deg),\n secondary: formatSigned(powers.secondary.power, 2),\n secondaryDeg: formatAxis(powers.secondary.deg),\n })}\n caption={t('opticalPrescription.charts.powerCross.caption', {\n eye: t(`opticalPrescription.eye.${eye}`),\n })}\n // Notation-only echo (signed dioptres @ meridian) at readable\n // HTML size — the in-SVG labels are too small for low vision.\n detail={`${formatSigned(powers.primary.power, 2)} @ ${formatAxis(powers.primary.deg)} · ${formatSigned(powers.secondary.power, 2)} @ ${formatAxis(powers.secondary.deg)}`}\n />,\n );\n }\n }\n\n if (enabledCharts.includes('pd')) {\n const split = v.pdRight !== undefined && v.pdLeft !== undefined;\n if (split || v.pd !== undefined) {\n figures.push(\n <PdSchematic\n key=\"pd\"\n totalText={\n v.pd !== undefined\n ? t('opticalPrescription.pd.value', { value: v.pd })\n : undefined\n }\n rightText={\n split\n ? t('opticalPrescription.pd.value', { value: v.pdRight })\n : undefined\n }\n leftText={\n split\n ? t('opticalPrescription.pd.value', { value: v.pdLeft })\n : undefined\n }\n ariaLabel={\n split\n ? t('opticalPrescription.charts.pd.ariaSplit', {\n right: v.pdRight,\n left: v.pdLeft,\n })\n : t('opticalPrescription.charts.pd.aria', { value: v.pd })\n }\n caption={t('opticalPrescription.charts.pd.caption')}\n detail={\n split\n ? t('opticalPrescription.pd.monocularValue', {\n right: v.pdRight,\n left: v.pdLeft,\n })\n : t('opticalPrescription.pd.value', { value: v.pd })\n }\n />,\n );\n }\n }\n\n if (enabledCharts.includes('prismBase')) {\n for (const eye of EYES) {\n const row = rowOf(eye);\n if (!row || row.prism === undefined || row.prism <= 0 || !row.base) {\n continue;\n }\n figures.push(\n <PrismRose\n key={`prism-${eye}`}\n eye={eye}\n base={row.base}\n labels={{\n up: t('opticalPrescription.charts.prism.baseShort.up'),\n down: t('opticalPrescription.charts.prism.baseShort.down'),\n in: t('opticalPrescription.charts.prism.baseShort.in'),\n out: t('opticalPrescription.charts.prism.baseShort.out'),\n }}\n ariaLabel={t('opticalPrescription.charts.prism.aria', {\n eye: eyeName(eye),\n value: formatPrism(row.prism),\n base: t(`opticalPrescription.base.${row.base}`),\n })}\n caption={t('opticalPrescription.charts.prism.caption', {\n eye: t(`opticalPrescription.eye.${eye}`),\n value: formatPrism(row.prism),\n base: t(\n `opticalPrescription.charts.prism.baseShort.${row.base}`,\n ),\n })}\n />,\n );\n }\n }\n\n if (figures.length === 0) return null;\n return (\n // Examiner-view clinical diagrams (OD drawn to the left of OS, nasal\n // towards the other eye) — physical order like the odontogram, so the\n // strip is pinned LTR and does not mirror in RTL.\n <div\n role=\"group\"\n aria-label={t('opticalPrescription.charts.label')}\n dir=\"ltr\"\n className=\"ds:flex ds:flex-wrap ds:items-end ds:gap-4\"\n >\n {figures}\n </div>\n );\n }, [enabledCharts, current, chartsBand, renderedBands, eyeName, t]);\n\n /* ---- Metadata strip ---- */\n const renderMetadata = useCallback((): ReactElement | null => {\n if (!metadata) return null;\n const v = current;\n\n if (interactive) {\n return (\n <div\n role=\"group\"\n aria-label={t('opticalPrescription.metaLabel')}\n className=\"ds:grid ds:gap-3 ds:grid-cols-[repeat(auto-fit,minmax(8rem,1fr))]\"\n >\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.pd.label')}\n </span>\n <NumberInput\n size=\"md\"\n mode=\"decimal\"\n step={0.5}\n min={PD_MIN}\n max={PD_MAX}\n aria-label={t('opticalPrescription.pd.full')}\n value={v.pd ?? null}\n onChange={(n) => setMeta({ pd: n ?? undefined })}\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.pd.right')}\n </span>\n <NumberInput\n size=\"md\"\n mode=\"decimal\"\n step={0.5}\n min={PD_MIN / 2}\n max={PD_MAX / 2}\n aria-label={t('opticalPrescription.pd.right')}\n value={v.pdRight ?? null}\n onChange={(n) => setMeta({ pdRight: n ?? undefined })}\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.pd.left')}\n </span>\n <NumberInput\n size=\"md\"\n mode=\"decimal\"\n step={0.5}\n min={PD_MIN / 2}\n max={PD_MAX / 2}\n aria-label={t('opticalPrescription.pd.left')}\n value={v.pdLeft ?? null}\n onChange={(n) => setMeta({ pdLeft: n ?? undefined })}\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.lensType.label')}\n </span>\n <Select<LensType>\n size=\"md\"\n clearable\n aria-label={t('opticalPrescription.lensType.label')}\n value={v.lensType ?? ''}\n options={LENS_TYPES.map((lt) => ({\n value: lt,\n label: t(`opticalPrescription.lensType.${lt}`),\n }))}\n onValueChange={(next) =>\n setMeta({ lensType: next === '' ? undefined : next })\n }\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1\">\n <span className={headerCell}>\n {t('opticalPrescription.axisSystem.label')}\n </span>\n <Select<AxisSystem>\n size=\"md\"\n clearable\n aria-label={t('opticalPrescription.axisSystem.label')}\n value={v.axisSystem ?? ''}\n options={AXIS_SYSTEMS.map((as) => ({\n value: as,\n label: t(`opticalPrescription.axisSystem.${as}`),\n }))}\n onValueChange={(next) =>\n setMeta({ axisSystem: next === '' ? undefined : next })\n }\n />\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-1 ds:[grid-column:1/-1]\">\n <span className={headerCell}>\n {t('opticalPrescription.notes.label')}\n </span>\n <TextArea\n size=\"md\"\n minRows={2}\n aria-label={t('opticalPrescription.notes.label')}\n placeholder={t('opticalPrescription.notes.placeholder')}\n value={v.notes ?? ''}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) =>\n setMeta({ notes: e.target.value || undefined })\n }\n />\n </div>\n </div>\n );\n }\n\n // Display mode — read-only metadata via DescriptionList.\n const hasAny =\n v.pd !== undefined ||\n (v.pdRight !== undefined && v.pdLeft !== undefined) ||\n v.lensType !== undefined ||\n v.axisSystem !== undefined ||\n (v.notes !== undefined && v.notes !== '');\n if (!hasAny) return null;\n\n return (\n <DescriptionList\n layout=\"inline\"\n labelWidth=\"fixed\"\n density=\"compact\"\n aria-label={t('opticalPrescription.metaLabel')}\n >\n {v.pd !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.pd.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {t('opticalPrescription.pd.value', { value: v.pd })}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.pdRight !== undefined && v.pdLeft !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.pd.monocular')}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {t('opticalPrescription.pd.monocularValue', {\n right: v.pdRight,\n left: v.pdLeft,\n })}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.lensType !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.lensType.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail>\n {t(`opticalPrescription.lensType.${v.lensType}`)}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.axisSystem !== undefined && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.axisSystem.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail>\n {t(`opticalPrescription.axisSystem.${v.axisSystem}`)}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n {v.notes !== undefined && v.notes !== '' && (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('opticalPrescription.notes.label')}\n </DescriptionList.Term>\n <DescriptionList.Detail>{v.notes}</DescriptionList.Detail>\n </DescriptionList.Row>\n )}\n </DescriptionList>\n );\n }, [metadata, current, interactive, t, setMeta]);\n\n return (\n <div\n ref={rootRef}\n data-component=\"optical-prescription\"\n data-component-id={instanceId}\n data-mode={mode}\n role=\"group\"\n aria-label={ariaLabel ?? t('opticalPrescription.ariaLabel')}\n className={containerVariants({ density, className })}\n >\n {renderedBands.map((band) => renderBand(band))}\n {renderCharts()}\n {renderMetadata()}\n </div>\n );\n },\n);\n\nOpticalPrescription.displayName = 'OpticalPrescription';\n"],"names":["EYE_SCHEMA","BAND_SCHEMA","FIELD_SCHEMA","ROW_SCHEMA","VALUE_SCHEMA","opticalPrescriptionAgent","handle","v","args","EYES","DISTANCE_BANDS","PRISM_BASES","LENS_TYPES","AXIS_SYSTEMS","REFRACTION_COLUMNS","DIOPTRE_STEP","SPHERE_MIN","SPHERE_MAX","CYLINDER_MIN","CYLINDER_MAX","ADD_MIN","ADD_MAX","AXIS_MIN","AXIS_MAX","AXIS_STEP","PD_MIN","PD_MAX","PRISM_MIN","PRISM_MAX","formatSigned","value","fractionDigits","fixed","formatSphere","formatCylinder","formatAdd","formatAxis","formatPrism","formatRefraction","field","normalizeAxis","deg","meridianPowers","row","sphere","cylinder","axis","emptyValue","getRow","band","eye","_a","setCell","fieldValue","bands","bandRows","clearBand","bandsInValue","rows","CHART_KINDS","chromeStroke","chromeText","inkStroke","inkText","needleStroke","needleFill","figureClass","captionClass","polar","cx","cy","r","rad","ChartFigure","chart","caption","detail","children","jsxs","jsx","TABO_CX","TABO_CY","TABO_R","TABO_TICKS","TABO_LABELS","TaboDial","axisDeg","ariaLabel","nx","ny","len","x1","y1","x2","y2","x","y","CROSS_CX","CROSS_CY","CROSS_ARM","CROSS_LABEL_R","PowerCross","primary","secondary","primaryText","secondaryText","meridians","text","lx","ly","PD_EYES","PD_EYE_Y","PD_DIM_Y","PdSchematic","totalText","rightText","leftText","split","Fragment","ROSE_CX","ROSE_CY","ROSE_ARM","baseAngle","base","PrismRose","labels","angle","ax","ay","hx","hy","w1x","w1y","w2x","w2y","rightLabel","leftLabel","containerVariants","cva","GRID_TEMPLATE","headerCell","numericCell","OpticalPrescription","forwardRef","id","mode","defaultValue","onChange","showPrism","metadata","charts","chartsBand","density","className","ref","t","useTranslation","reactId","useId","instanceId","rootRef","useRef","interactive","isControlled","internal","setInternal","useState","current","valueRef","commit","useCallback","next","setCellFn","setCellData","setMeta","patch","renderedBands","renderedBandsRef","columns","useMemo","focusEye","root","targetBand","getRowData","clearBandData","useImperativeHandle","useAgentRegistration","eyeName","columnLabel","col","bandLabel","renderEditableCell","raw","cellAria","Select","b","NumberInput","n","renderDisplayCell","renderBand","titleId","template","enabledCharts","renderCharts","withData","rowOf","figures","rawAxis","powers","renderMetadata","lt","as","TextArea","e","DescriptionList"],"mappings":";;;;;;;;;AAYA,MAAMA,KAAa;AAAA,EACjB,MAAM,CAAC,MAAM,IAAI;AAAA,EACjB,aAAa;AACf,GACMC,KAAc;AAAA,EAClB,MAAM,CAAC,OAAO,gBAAgB,MAAM;AAAA,EACpC,aACE;AACJ,GACMC,KAAe;AAAA,EACnB,MAAM,CAAC,UAAU,YAAY,QAAQ,OAAO,SAAS,MAAM;AAAA,EAC3D,aACE;AACJ,GACMC,KAAa;AAAA,EACjB,MAAM;AAAA,EACN,YAAY;AAAA,I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AAI,CAAC;AAAA,UAC5C0J,GAAA;AAAA,UACAM,GAAA;AAAA,QAAe;AAAA,MAAA;AAAA,IAAA;AAAA,EAGtB;AACF;AAEAnE,GAAoB,cAAc;"}
|
|
@@ -13,14 +13,14 @@ import { F as ue } from "./fiscal-code-input-B_nYMSEM.js";
|
|
|
13
13
|
import { N as me } from "./number-input-Cgu2TtA8.js";
|
|
14
14
|
import { P as fe } from "./panel-header-D313n_9-.js";
|
|
15
15
|
import { P as ge } from "./phone-input-BsZIoE36.js";
|
|
16
|
-
import { S as ye } from "./select-
|
|
16
|
+
import { S as ye } from "./select-Bi8zril7.js";
|
|
17
17
|
import { S as be } from "./switch-OILsBLWo.js";
|
|
18
18
|
import { T as he } from "./text-area-Bt3p7Pt0.js";
|
|
19
19
|
import { T as ve } from "./text-input-CUvCb6ST.js";
|
|
20
|
-
import { C as xe } from "./country-select-
|
|
21
|
-
import { P as Ne } from "./province-select-
|
|
20
|
+
import { C as xe } from "./country-select-DzbPFktV.js";
|
|
21
|
+
import { P as Ne } from "./province-select-BBc7s7vR.js";
|
|
22
22
|
import { P as Ve } from "./postal-code-input-BznBxVxf.js";
|
|
23
|
-
import { C as Ce } from "./city-input-
|
|
23
|
+
import { C as Ce } from "./city-input-DaQc-Hbj.js";
|
|
24
24
|
import { u as ke } from "./registry-DvAUVLHh.js";
|
|
25
25
|
import { u as we, F as De, r as Pe, a as Te } from "./field-value-DG8zaZvo.js";
|
|
26
26
|
import { c as Fe } from "./createLucideIcon-DhHxpK9K.js";
|
|
@@ -776,4 +776,4 @@ export {
|
|
|
776
776
|
Me as P,
|
|
777
777
|
Ae as p
|
|
778
778
|
};
|
|
779
|
-
//# sourceMappingURL=patient-details-
|
|
779
|
+
//# sourceMappingURL=patient-details-BQaUzPqp.js.map
|