export type Eye = 'od' | 'os'; /** Distance band — `far` (per lontano), `intermediate`, `near` (per vicino). */ export type DistanceBand = 'far' | 'intermediate' | 'near'; /** Prism base direction. */ export type PrismBase = 'up' | 'down' | 'in' | 'out'; /** Lens construction. */ export type LensType = 'single-vision' | 'bifocal' | 'progressive'; /** Axis notation system — TABO (European) or INT (international). */ export type AxisSystem = 'tabo' | 'int'; /** `'interactive'` renders editable inputs; `'display'` is a read-only grid. */ export type OpticalPrescriptionMode = 'interactive' | 'display'; /** One eye's refraction at one distance band. All fields optional. */ export interface RefractionRow { /** Spherical power, dioptres (±, 0.25 steps). */ sphere?: number; /** Cylindrical power, dioptres (±, 0.25 steps). */ cylinder?: number; /** Cylinder axis, 0–180°. */ axis?: number; /** Reading addition, dioptres (+, 0.25 steps). */ add?: number; /** Prismatic power, prism dioptres. */ prism?: number; /** Prism base direction. */ base?: PrismBase; } /** A full glasses prescription. */ export interface OpticalPrescriptionValue { /** Refraction rows, keyed by band then eye. */ bands: Partial>>>; /** Interpupillary distance (DIP / PD), millimetres. */ pd?: number; /** Monocular PD, right eye (nose centre → OD pupil), millimetres. */ pdRight?: number; /** Monocular PD, left eye (nose centre → OS pupil), millimetres. */ pdLeft?: number; /** Lens construction. */ lensType?: LensType; /** Axis notation system. */ axisSystem?: AxisSystem; /** Free-text clinical note. PHI — never bundle real notes in stories. */ notes?: string; } export declare const EYES: readonly Eye[]; export declare const DISTANCE_BANDS: readonly DistanceBand[]; export declare const PRISM_BASES: readonly PrismBase[]; export declare const LENS_TYPES: readonly LensType[]; export declare const AXIS_SYSTEMS: readonly AxisSystem[]; /** The dioptric columns, in display order. `base` pairs with `prism`. */ export declare const REFRACTION_COLUMNS: readonly (keyof RefractionRow)[]; /** Dioptric step for sphere / cylinder / add. */ export declare const DIOPTRE_STEP = 0.25; /** Sphere range, dioptres. */ export declare const SPHERE_MIN = -30; export declare const SPHERE_MAX = 30; /** Cylinder range, dioptres. */ export declare const CYLINDER_MIN = -12; export declare const CYLINDER_MAX = 12; /** Reading addition range, dioptres. */ export declare const ADD_MIN = 0; export declare const ADD_MAX = 6; /** Axis range, degrees. */ export declare const AXIS_MIN = 0; export declare const AXIS_MAX = 180; export declare const AXIS_STEP = 1; /** Interpupillary distance range, millimetres. */ export declare const PD_MIN = 40; export declare const PD_MAX = 85; /** Prism range, prism dioptres. */ export declare const PRISM_MIN = 0; export declare const PRISM_MAX = 20; /** * Format a number with an explicit leading sign — `+1.50`, `-2.25`. Zero is * rendered unsigned (`0.00`). Used for sphere and cylinder, where optometry * convention always shows the sign. `language` (the UI language, default * English) picks the decimal separator: `+1,50` in Italian. */ export declare function formatSigned(value: number, fractionDigits?: number, language?: string): string; /** Sphere power, explicit sign, 2 dp (`+2.00` / `-1.25`). */ export declare function formatSphere(value: number, language?: string): string; /** Cylinder power, explicit sign, 2 dp. */ export declare function formatCylinder(value: number, language?: string): string; /** Reading addition — always positive, 2 dp (`+2.00`). */ export declare function formatAdd(value: number, language?: string): string; /** Axis, integer degrees with the degree symbol (`90°`). */ export declare function formatAxis(value: number): string; /** Prism, 2 dp (`2.00`). */ export declare function formatPrism(value: number, language?: string): string; /** * Format the numeric value of one refraction column for the read-only grid. * `base` is a string enum the component resolves through i18n separately, so it * never reaches this numeric formatter; any unhandled field falls through the * default branch and is coerced with `String(value)`. */ export declare function formatRefraction(field: keyof RefractionRow, value: number, language?: string): string; /** Power along one principal meridian, for the optical power cross. */ export interface MeridianPower { /** Meridian orientation, degrees, normalised to [0, 180). */ deg: number; /** Dioptric power along this meridian. */ power: number; } /** * Normalise an axis to the conventional 0–180° range. Values already in * range are kept verbatim (180 stays 180 — the form convention), anything * outside wraps modulo 180. Single source of truth so the TABO dial, the * power cross, and their labels can never disagree about one meridian. */ export declare function normalizeAxis(deg: number): number; /** * Resolve a sphero-cylindrical row into its two principal meridians. * The cylinder AXIS meridian carries the sphere power; the meridian 90° * away carries sphere + cylinder. A row with neither sphere nor cylinder * has no cross — returns `undefined`. A missing sphere is plano (0.00); * a missing axis defaults to 0°. */ export declare function meridianPowers(row: RefractionRow | undefined): { primary: MeridianPower; secondary: MeridianPower; } | undefined; /** An empty prescription. */ export declare function emptyValue(): OpticalPrescriptionValue; /** Read one eye's row at one band (undefined when absent). */ export declare function getRow(value: OpticalPrescriptionValue, band: DistanceBand, eye: Eye): RefractionRow | undefined; /** * Immutably set (or clear) a single cell. Passing `undefined` / `null` removes * the field; emptying a row removes the row, and emptying a band removes the * band — so `bandsInValue` and the agent state snapshot stay tight. */ export declare function setCell(value: OpticalPrescriptionValue, band: DistanceBand, eye: Eye, field: K, fieldValue: RefractionRow[K] | undefined): OpticalPrescriptionValue; /** Immutably remove every row in a band. */ export declare function clearBand(value: OpticalPrescriptionValue, band: DistanceBand): OpticalPrescriptionValue; /** The distance bands carrying at least one refraction value, in order. */ export declare function bandsInValue(value: OpticalPrescriptionValue): DistanceBand[]; //# sourceMappingURL=optical-prescription-data.d.ts.map