formanitor 0.0.36 → 0.0.38

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/index.cjs CHANGED
@@ -129,6 +129,13 @@ function validateForm(values, fields) {
129
129
  }
130
130
 
131
131
  // src/core/rules.ts
132
+ function tokenListContainsString(text, needle) {
133
+ if (typeof text !== "string") return false;
134
+ const want = String(needle).trim();
135
+ if (!want) return false;
136
+ const parts = text.split(",").map((p) => p.trim()).filter(Boolean);
137
+ return parts.includes(want);
138
+ }
132
139
  function evaluateCondition(value, condition) {
133
140
  switch (condition.op) {
134
141
  case "==":
@@ -147,7 +154,13 @@ function evaluateCondition(value, condition) {
147
154
  case "in":
148
155
  return Array.isArray(condition.value) && condition.value.includes(value);
149
156
  case "contains":
150
- return Array.isArray(value) && value.includes(condition.value);
157
+ if (Array.isArray(value)) {
158
+ return value.includes(condition.value);
159
+ }
160
+ if (typeof value === "string") {
161
+ return tokenListContainsString(value, condition.value);
162
+ }
163
+ return false;
151
164
  default:
152
165
  return false;
153
166
  }
@@ -267,8 +280,47 @@ var FormStore = class {
267
280
  values[field.id] = field.defaultValue;
268
281
  } else {
269
282
  if (field.type === "repeatable") values[field.id] = [];
270
- else if (field.type === "checkbox") values[field.id] = [];
283
+ else if (field.type === "checkbox" || field.type === "multiselect") values[field.id] = [];
271
284
  else if (field.type === "smart_textarea") values[field.id] = { text: "", extractedKeywords: [] };
285
+ else if (field.type === "suggestion_textarea" || field.type === "complaint_chips") values[field.id] = "";
286
+ else if (field.type === "lens_assessment")
287
+ values[field.id] = {
288
+ notes: "",
289
+ assessmentKey: void 0,
290
+ locs: {
291
+ OD: { NO: 0, NC: 0, C: 0, PSC: 0 },
292
+ OS: { NO: 0, NC: 0, C: 0, PSC: 0 }
293
+ }
294
+ };
295
+ else if (field.type === "functional_impairment_score")
296
+ values[field.id] = {
297
+ reading: 0,
298
+ nightDriving: 0,
299
+ glare: 0,
300
+ occupation: 0,
301
+ adl: 0
302
+ };
303
+ else if (field.type === "biometry_iol_workup")
304
+ values[field.id] = {
305
+ axialLengthOD: "",
306
+ axialLengthOS: "",
307
+ k1k2AxisOD: "",
308
+ k1k2AxisOS: "",
309
+ anteriorChamberDepthOD: "",
310
+ anteriorChamberDepthOS: "",
311
+ iolPowerOD: "",
312
+ iolPowerOS: "",
313
+ targetRefractionOD: "",
314
+ targetRefractionOS: "",
315
+ formula: "SRK/T",
316
+ method: "optical_biometry",
317
+ cornealTopoUploaded: false,
318
+ specularMicroscopyDone: false,
319
+ endothelialCount: ""
320
+ };
321
+ else if (field.type === "surgical_risk_flags")
322
+ values[field.id] = { OD: [], OS: [] };
323
+ else if (field.type === "toggle") values[field.id] = false;
272
324
  else values[field.id] = null;
273
325
  }
274
326
  });
@@ -3158,6 +3210,19 @@ var BEFORE_AFTER_NORMALIZATION_MAP = {
3158
3210
  AF: "AFTER FOOD",
3159
3211
  BF: "BEFORE FOOD"
3160
3212
  };
3213
+ var ROUTE_OPTIONS = [
3214
+ { label: "Select route", value: "" },
3215
+ { label: "Per Os", value: "Per Os" },
3216
+ { label: "Intravenous", value: "Intravenous" },
3217
+ { label: "Intramuscular", value: "Intramuscular" },
3218
+ { label: "Subcutaneous", value: "Subcutaneous" },
3219
+ { label: "Sublingual", value: "Sublingual" },
3220
+ { label: "Intranasal", value: "Intranasal" },
3221
+ { label: "Topical", value: "Topical" },
3222
+ { label: "Per Rectum", value: "Per Rectum" },
3223
+ { label: "Inhalation", value: "Inhalation" },
3224
+ { label: "ID Intradermal", value: "ID Intradermal" }
3225
+ ];
3161
3226
  function mapToMedication(result) {
3162
3227
  return {
3163
3228
  id: result.id,
@@ -3168,6 +3233,7 @@ function mapToMedication(result) {
3168
3233
  duration_value: "3",
3169
3234
  duration_unit: "days",
3170
3235
  before_after: "AFTER FOOD",
3236
+ route: "",
3171
3237
  morning: "0",
3172
3238
  afternoon: "0",
3173
3239
  night: "0",
@@ -3185,6 +3251,7 @@ function mapAIMedicationToMedication(ai) {
3185
3251
  duration_value: "3",
3186
3252
  duration_unit: "days",
3187
3253
  before_after: "AFTER FOOD",
3254
+ route: "",
3188
3255
  morning: "1",
3189
3256
  afternoon: "0",
3190
3257
  night: "1",
@@ -3201,6 +3268,7 @@ function createCustomMedication(name, customId) {
3201
3268
  duration_value: "3",
3202
3269
  duration_unit: "days",
3203
3270
  before_after: "AFTER FOOD",
3271
+ route: "",
3204
3272
  morning: "0",
3205
3273
  afternoon: "0",
3206
3274
  night: "0",
@@ -3234,6 +3302,7 @@ function mapFrequentItemToMedication(item) {
3234
3302
  duration_value,
3235
3303
  duration_unit,
3236
3304
  before_after,
3305
+ route: item.route ?? "",
3237
3306
  morning: item.morning ?? "0",
3238
3307
  afternoon: item.afternoon ?? "0",
3239
3308
  night: item.night ?? "0",
@@ -3301,7 +3370,9 @@ function MedicationCard({
3301
3370
  /* @__PURE__ */ jsxRuntime.jsx("option", { value: "as_needed", children: "As needed" }),
3302
3371
  /* @__PURE__ */ jsxRuntime.jsx("option", { value: "fort_night", children: "Fort night" }),
3303
3372
  /* @__PURE__ */ jsxRuntime.jsx("option", { value: "at_bed_time", children: "At Bed time" }),
3304
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "sos", children: "SOS only" })
3373
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "sos", children: "SOS only" }),
3374
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "biweekly", children: "Biweekly" }),
3375
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "stat", children: "STAT" })
3305
3376
  ]
3306
3377
  }
3307
3378
  ),
@@ -3362,6 +3433,15 @@ function MedicationCard({
3362
3433
  onChange: (e) => set("before_after", e.target.value),
3363
3434
  children: BEFORE_AFTER_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.label))
3364
3435
  }
3436
+ ),
3437
+ /* @__PURE__ */ jsxRuntime.jsx(
3438
+ "select",
3439
+ {
3440
+ className: "text-xs border border-border rounded px-2 py-1 bg-white shrink-0",
3441
+ value: med.route ?? "",
3442
+ onChange: (e) => set("route", e.target.value),
3443
+ children: ROUTE_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
3444
+ }
3365
3445
  )
3366
3446
  ] }),
3367
3447
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6072,6 +6152,12 @@ var tableCellClass = "border border-[#E0E0E0] px-1.5 py-1 text-center align-midd
6072
6152
  var selectClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
6073
6153
  var numberInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs text-right focus-visible:outline-none focus-visible:ring-0";
6074
6154
  var textInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
6155
+ var refractionTableClass = "w-full table-fixed border-collapse text-xs";
6156
+ var refractionHeaderCellClass = "border border-[#E0E0E0] bg-[#F7F7F7] px-1 py-1 text-center font-semibold text-[11px]";
6157
+ var refractionDataCellClass = "border border-[#E0E0E0] p-0 text-center align-middle min-w-0";
6158
+ var refractionLabelCellClass = "border border-[#E0E0E0] px-2 py-1 text-left align-middle font-semibold whitespace-nowrap";
6159
+ var refractionInputClass = "h-7 w-full min-w-0 border-0 rounded-none bg-transparent px-1 py-0.5 text-xs text-right shadow-none ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:opacity-50";
6160
+ var refractionSelectClass = "box-border h-7 w-full min-w-0 max-w-full cursor-pointer border-0 rounded-none bg-transparent px-1 py-0.5 pr-6 text-xs shadow-none focus-visible:outline-none focus-visible:ring-0 disabled:opacity-50";
6075
6161
  var OphthalmologyWidget = ({ fieldId }) => {
6076
6162
  const { fieldDef, value, setValue, disabled } = useField(fieldId);
6077
6163
  const safe = React15.useMemo(() => ensureValue(value), [value]);
@@ -6303,34 +6389,45 @@ var OphthalmologyWidget = ({ fieldId }) => {
6303
6389
  ] }),
6304
6390
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
6305
6391
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Current Glass Prescription" }) }),
6306
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
6392
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: refractionTableClass, children: [
6393
+ /* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
6394
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[10%]" }),
6395
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6396
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6397
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
6398
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[25%]" }),
6399
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6400
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6401
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
6402
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[25%]" })
6403
+ ] }),
6307
6404
  /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
6308
6405
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6309
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6310
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Right Eye" }),
6311
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Left Eye" })
6406
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
6407
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 4, children: "Right Eye" }),
6408
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 4, children: "Left Eye" })
6312
6409
  ] }),
6313
6410
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6314
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6315
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6316
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6317
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6318
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
6319
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6320
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6321
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6322
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" })
6411
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
6412
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
6413
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
6414
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
6415
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
6416
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
6417
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
6418
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
6419
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" })
6323
6420
  ] })
6324
6421
  ] }),
6325
6422
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6326
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Current Glass" }),
6327
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6423
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionLabelCellClass, children: "Current Glass" }),
6424
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6328
6425
  Input,
6329
6426
  {
6330
6427
  disabled,
6331
6428
  type: "number",
6332
6429
  step: "0.25",
6333
- className: numberInputClass,
6430
+ className: refractionInputClass,
6334
6431
  value: safe.current_glass_prescription.right_eye.sph ?? "",
6335
6432
  onChange: (e) => setRefractionField(
6336
6433
  "current_glass_prescription",
@@ -6341,13 +6438,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6341
6438
  )
6342
6439
  }
6343
6440
  ) }),
6344
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6441
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6345
6442
  Input,
6346
6443
  {
6347
6444
  disabled,
6348
6445
  type: "number",
6349
6446
  step: "0.25",
6350
- className: numberInputClass,
6447
+ className: refractionInputClass,
6351
6448
  value: safe.current_glass_prescription.right_eye.cyl ?? "",
6352
6449
  onChange: (e) => setRefractionField(
6353
6450
  "current_glass_prescription",
@@ -6358,12 +6455,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
6358
6455
  )
6359
6456
  }
6360
6457
  ) }),
6361
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6458
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6362
6459
  Input,
6363
6460
  {
6364
6461
  disabled,
6365
6462
  type: "number",
6366
- className: numberInputClass,
6463
+ className: refractionInputClass,
6367
6464
  value: safe.current_glass_prescription.right_eye.axis ?? "",
6368
6465
  onChange: (e) => setRefractionField(
6369
6466
  "current_glass_prescription",
@@ -6374,11 +6471,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
6374
6471
  )
6375
6472
  }
6376
6473
  ) }),
6377
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6474
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6378
6475
  "select",
6379
6476
  {
6380
6477
  disabled,
6381
- className: selectClass,
6478
+ className: refractionSelectClass,
6382
6479
  value: safe.current_glass_prescription.right_eye.va,
6383
6480
  onChange: (e) => setRefractionField(
6384
6481
  "current_glass_prescription",
@@ -6390,13 +6487,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6390
6487
  children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
6391
6488
  }
6392
6489
  ) }),
6393
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6490
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6394
6491
  Input,
6395
6492
  {
6396
6493
  disabled,
6397
6494
  type: "number",
6398
6495
  step: "0.25",
6399
- className: numberInputClass,
6496
+ className: refractionInputClass,
6400
6497
  value: safe.current_glass_prescription.left_eye.sph ?? "",
6401
6498
  onChange: (e) => setRefractionField(
6402
6499
  "current_glass_prescription",
@@ -6407,13 +6504,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6407
6504
  )
6408
6505
  }
6409
6506
  ) }),
6410
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6507
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6411
6508
  Input,
6412
6509
  {
6413
6510
  disabled,
6414
6511
  type: "number",
6415
6512
  step: "0.25",
6416
- className: numberInputClass,
6513
+ className: refractionInputClass,
6417
6514
  value: safe.current_glass_prescription.left_eye.cyl ?? "",
6418
6515
  onChange: (e) => setRefractionField(
6419
6516
  "current_glass_prescription",
@@ -6424,12 +6521,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
6424
6521
  )
6425
6522
  }
6426
6523
  ) }),
6427
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6524
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6428
6525
  Input,
6429
6526
  {
6430
6527
  disabled,
6431
6528
  type: "number",
6432
- className: numberInputClass,
6529
+ className: refractionInputClass,
6433
6530
  value: safe.current_glass_prescription.left_eye.axis ?? "",
6434
6531
  onChange: (e) => setRefractionField(
6435
6532
  "current_glass_prescription",
@@ -6440,11 +6537,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
6440
6537
  )
6441
6538
  }
6442
6539
  ) }),
6443
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6540
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6444
6541
  "select",
6445
6542
  {
6446
6543
  disabled,
6447
- className: selectClass,
6544
+ className: refractionSelectClass,
6448
6545
  value: safe.current_glass_prescription.left_eye.va,
6449
6546
  onChange: (e) => setRefractionField(
6450
6547
  "current_glass_prescription",
@@ -6553,37 +6650,50 @@ var OphthalmologyWidget = ({ fieldId }) => {
6553
6650
  ] }),
6554
6651
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
6555
6652
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Refraction (Distance)" }) }),
6556
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
6653
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: refractionTableClass, children: [
6654
+ /* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
6655
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[10%]" }),
6656
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6657
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6658
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
6659
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[13%]" }),
6660
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[12%]" }),
6661
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6662
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6663
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
6664
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[13%]" }),
6665
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[12%]" })
6666
+ ] }),
6557
6667
  /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
6558
6668
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6559
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6560
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6561
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
6669
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
6670
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6671
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Left Eye" })
6562
6672
  ] }),
6563
6673
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6564
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6565
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6566
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6567
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6568
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
6569
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "P/D" }),
6570
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6571
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6572
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6573
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
6574
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "P/D" })
6674
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
6675
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
6676
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
6677
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
6678
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
6679
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "P/D" }),
6680
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
6681
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
6682
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
6683
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
6684
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "P/D" })
6575
6685
  ] })
6576
6686
  ] }),
6577
6687
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
6578
6688
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6579
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Distance" }),
6580
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6689
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionLabelCellClass, children: "Distance" }),
6690
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6581
6691
  Input,
6582
6692
  {
6583
6693
  disabled,
6584
6694
  type: "number",
6585
6695
  step: "0.25",
6586
- className: numberInputClass,
6696
+ className: refractionInputClass,
6587
6697
  value: safe.refraction.right_eye.sph ?? "",
6588
6698
  onChange: (e) => setRefractionField(
6589
6699
  "refraction",
@@ -6594,13 +6704,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6594
6704
  )
6595
6705
  }
6596
6706
  ) }),
6597
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6707
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6598
6708
  Input,
6599
6709
  {
6600
6710
  disabled,
6601
6711
  type: "number",
6602
6712
  step: "0.25",
6603
- className: numberInputClass,
6713
+ className: refractionInputClass,
6604
6714
  value: safe.refraction.right_eye.cyl ?? "",
6605
6715
  onChange: (e) => setRefractionField(
6606
6716
  "refraction",
@@ -6611,12 +6721,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
6611
6721
  )
6612
6722
  }
6613
6723
  ) }),
6614
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6724
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6615
6725
  Input,
6616
6726
  {
6617
6727
  disabled,
6618
6728
  type: "number",
6619
- className: numberInputClass,
6729
+ className: refractionInputClass,
6620
6730
  value: safe.refraction.right_eye.axis ?? "",
6621
6731
  onChange: (e) => setRefractionField(
6622
6732
  "refraction",
@@ -6627,11 +6737,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
6627
6737
  )
6628
6738
  }
6629
6739
  ) }),
6630
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6740
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6631
6741
  "select",
6632
6742
  {
6633
6743
  disabled,
6634
- className: selectClass,
6744
+ className: refractionSelectClass,
6635
6745
  value: safe.refraction.right_eye.va,
6636
6746
  onChange: (e) => setRefractionField(
6637
6747
  "refraction",
@@ -6643,7 +6753,7 @@ var OphthalmologyWidget = ({ fieldId }) => {
6643
6753
  children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
6644
6754
  }
6645
6755
  ) }),
6646
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6756
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6647
6757
  Input,
6648
6758
  {
6649
6759
  disabled,
@@ -6651,18 +6761,18 @@ var OphthalmologyWidget = ({ fieldId }) => {
6651
6761
  min: 10,
6652
6762
  max: 45,
6653
6763
  step: "1",
6654
- className: numberInputClass,
6764
+ className: refractionInputClass,
6655
6765
  value: safe.refraction.right_eye.pd ?? "",
6656
6766
  onChange: (e) => setRefractionField("refraction", "right_eye", "pd", e.target.value, "int")
6657
6767
  }
6658
6768
  ) }),
6659
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6769
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6660
6770
  Input,
6661
6771
  {
6662
6772
  disabled,
6663
6773
  type: "number",
6664
6774
  step: "0.25",
6665
- className: numberInputClass,
6775
+ className: refractionInputClass,
6666
6776
  value: safe.refraction.left_eye.sph ?? "",
6667
6777
  onChange: (e) => setRefractionField(
6668
6778
  "refraction",
@@ -6673,13 +6783,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6673
6783
  )
6674
6784
  }
6675
6785
  ) }),
6676
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6786
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6677
6787
  Input,
6678
6788
  {
6679
6789
  disabled,
6680
6790
  type: "number",
6681
6791
  step: "0.25",
6682
- className: numberInputClass,
6792
+ className: refractionInputClass,
6683
6793
  value: safe.refraction.left_eye.cyl ?? "",
6684
6794
  onChange: (e) => setRefractionField(
6685
6795
  "refraction",
@@ -6690,12 +6800,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
6690
6800
  )
6691
6801
  }
6692
6802
  ) }),
6693
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6803
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6694
6804
  Input,
6695
6805
  {
6696
6806
  disabled,
6697
6807
  type: "number",
6698
- className: numberInputClass,
6808
+ className: refractionInputClass,
6699
6809
  value: safe.refraction.left_eye.axis ?? "",
6700
6810
  onChange: (e) => setRefractionField(
6701
6811
  "refraction",
@@ -6706,11 +6816,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
6706
6816
  )
6707
6817
  }
6708
6818
  ) }),
6709
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6819
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6710
6820
  "select",
6711
6821
  {
6712
6822
  disabled,
6713
- className: selectClass,
6823
+ className: refractionSelectClass,
6714
6824
  value: safe.refraction.left_eye.va,
6715
6825
  onChange: (e) => setRefractionField(
6716
6826
  "refraction",
@@ -6722,7 +6832,7 @@ var OphthalmologyWidget = ({ fieldId }) => {
6722
6832
  children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
6723
6833
  }
6724
6834
  ) }),
6725
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6835
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6726
6836
  Input,
6727
6837
  {
6728
6838
  disabled,
@@ -6730,32 +6840,32 @@ var OphthalmologyWidget = ({ fieldId }) => {
6730
6840
  min: 10,
6731
6841
  max: 45,
6732
6842
  step: "1",
6733
- className: numberInputClass,
6843
+ className: refractionInputClass,
6734
6844
  value: safe.refraction.left_eye.pd ?? "",
6735
6845
  onChange: (e) => setRefractionField("refraction", "left_eye", "pd", e.target.value, "int")
6736
6846
  }
6737
6847
  ) })
6738
6848
  ] }),
6739
6849
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6740
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
6741
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6850
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionLabelCellClass, children: "Add" }),
6851
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6742
6852
  Input,
6743
6853
  {
6744
6854
  disabled,
6745
6855
  type: "number",
6746
6856
  step: "0.25",
6747
- className: numberInputClass,
6857
+ className: refractionInputClass,
6748
6858
  value: safe.refraction.add.right ?? "",
6749
6859
  onChange: (e) => setRefractionAdd("refraction", "right", e.target.value)
6750
6860
  }
6751
6861
  ) }),
6752
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6862
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6753
6863
  Input,
6754
6864
  {
6755
6865
  disabled,
6756
6866
  type: "number",
6757
6867
  step: "0.25",
6758
- className: numberInputClass,
6868
+ className: refractionInputClass,
6759
6869
  value: safe.refraction.add.left ?? "",
6760
6870
  onChange: (e) => setRefractionAdd("refraction", "left", e.target.value)
6761
6871
  }
@@ -6766,37 +6876,50 @@ var OphthalmologyWidget = ({ fieldId }) => {
6766
6876
  ] }),
6767
6877
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
6768
6878
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Dilated Refraction" }) }),
6769
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
6879
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: refractionTableClass, children: [
6880
+ /* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
6881
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[10%]" }),
6882
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6883
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6884
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
6885
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[8%]" }),
6886
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[17%]" }),
6887
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6888
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
6889
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
6890
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[8%]" }),
6891
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[17%]" })
6892
+ ] }),
6770
6893
  /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
6771
6894
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6772
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6773
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6774
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
6895
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
6896
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6897
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Left Eye" })
6775
6898
  ] }),
6776
6899
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6777
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6778
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6779
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6780
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6781
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6782
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
6783
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6784
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6785
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6786
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6787
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" })
6900
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
6901
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
6902
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
6903
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
6904
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
6905
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
6906
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
6907
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
6908
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
6909
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
6910
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" })
6788
6911
  ] })
6789
6912
  ] }),
6790
6913
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
6791
6914
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6792
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Dilated" }),
6793
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6915
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionLabelCellClass, children: "Dilated" }),
6916
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6794
6917
  Input,
6795
6918
  {
6796
6919
  disabled,
6797
6920
  type: "number",
6798
6921
  step: "0.25",
6799
- className: numberInputClass,
6922
+ className: refractionInputClass,
6800
6923
  value: safe.dilated_refraction.right_eye.sph ?? "",
6801
6924
  onChange: (e) => setRefractionField(
6802
6925
  "dilated_refraction",
@@ -6807,13 +6930,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6807
6930
  )
6808
6931
  }
6809
6932
  ) }),
6810
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6933
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6811
6934
  Input,
6812
6935
  {
6813
6936
  disabled,
6814
6937
  type: "number",
6815
6938
  step: "0.25",
6816
- className: numberInputClass,
6939
+ className: refractionInputClass,
6817
6940
  value: safe.dilated_refraction.right_eye.cyl ?? "",
6818
6941
  onChange: (e) => setRefractionField(
6819
6942
  "dilated_refraction",
@@ -6824,12 +6947,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
6824
6947
  )
6825
6948
  }
6826
6949
  ) }),
6827
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6950
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6828
6951
  Input,
6829
6952
  {
6830
6953
  disabled,
6831
6954
  type: "number",
6832
- className: numberInputClass,
6955
+ className: refractionInputClass,
6833
6956
  value: safe.dilated_refraction.right_eye.axis ?? "",
6834
6957
  onChange: (e) => setRefractionField(
6835
6958
  "dilated_refraction",
@@ -6840,13 +6963,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6840
6963
  )
6841
6964
  }
6842
6965
  ) }),
6843
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6966
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6844
6967
  Input,
6845
6968
  {
6846
6969
  disabled,
6847
6970
  type: "number",
6848
6971
  step: "0.25",
6849
- className: numberInputClass,
6972
+ className: refractionInputClass,
6850
6973
  value: safe.dilated_refraction.right_eye.prism ?? "",
6851
6974
  onChange: (e) => setRefractionField(
6852
6975
  "dilated_refraction",
@@ -6857,11 +6980,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
6857
6980
  )
6858
6981
  }
6859
6982
  ) }),
6860
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6983
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6861
6984
  "select",
6862
6985
  {
6863
6986
  disabled,
6864
- className: selectClass,
6987
+ className: refractionSelectClass,
6865
6988
  value: safe.dilated_refraction.right_eye.va,
6866
6989
  onChange: (e) => setRefractionField(
6867
6990
  "dilated_refraction",
@@ -6873,13 +6996,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6873
6996
  children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
6874
6997
  }
6875
6998
  ) }),
6876
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6999
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6877
7000
  Input,
6878
7001
  {
6879
7002
  disabled,
6880
7003
  type: "number",
6881
7004
  step: "0.25",
6882
- className: numberInputClass,
7005
+ className: refractionInputClass,
6883
7006
  value: safe.dilated_refraction.left_eye.sph ?? "",
6884
7007
  onChange: (e) => setRefractionField(
6885
7008
  "dilated_refraction",
@@ -6890,13 +7013,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6890
7013
  )
6891
7014
  }
6892
7015
  ) }),
6893
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7016
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6894
7017
  Input,
6895
7018
  {
6896
7019
  disabled,
6897
7020
  type: "number",
6898
7021
  step: "0.25",
6899
- className: numberInputClass,
7022
+ className: refractionInputClass,
6900
7023
  value: safe.dilated_refraction.left_eye.cyl ?? "",
6901
7024
  onChange: (e) => setRefractionField(
6902
7025
  "dilated_refraction",
@@ -6907,12 +7030,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
6907
7030
  )
6908
7031
  }
6909
7032
  ) }),
6910
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7033
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6911
7034
  Input,
6912
7035
  {
6913
7036
  disabled,
6914
7037
  type: "number",
6915
- className: numberInputClass,
7038
+ className: refractionInputClass,
6916
7039
  value: safe.dilated_refraction.left_eye.axis ?? "",
6917
7040
  onChange: (e) => setRefractionField(
6918
7041
  "dilated_refraction",
@@ -6923,13 +7046,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
6923
7046
  )
6924
7047
  }
6925
7048
  ) }),
6926
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7049
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6927
7050
  Input,
6928
7051
  {
6929
7052
  disabled,
6930
7053
  type: "number",
6931
7054
  step: "0.25",
6932
- className: numberInputClass,
7055
+ className: refractionInputClass,
6933
7056
  value: safe.dilated_refraction.left_eye.prism ?? "",
6934
7057
  onChange: (e) => setRefractionField(
6935
7058
  "dilated_refraction",
@@ -6940,11 +7063,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
6940
7063
  )
6941
7064
  }
6942
7065
  ) }),
6943
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7066
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6944
7067
  "select",
6945
7068
  {
6946
7069
  disabled,
6947
- className: selectClass,
7070
+ className: refractionSelectClass,
6948
7071
  value: safe.dilated_refraction.left_eye.va,
6949
7072
  onChange: (e) => setRefractionField(
6950
7073
  "dilated_refraction",
@@ -6958,25 +7081,25 @@ var OphthalmologyWidget = ({ fieldId }) => {
6958
7081
  ) })
6959
7082
  ] }),
6960
7083
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6961
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
6962
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
7084
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionLabelCellClass, children: "Add" }),
7085
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6963
7086
  Input,
6964
7087
  {
6965
7088
  disabled,
6966
7089
  type: "number",
6967
7090
  step: "0.25",
6968
- className: numberInputClass,
7091
+ className: refractionInputClass,
6969
7092
  value: safe.dilated_refraction.add.right ?? "",
6970
7093
  onChange: (e) => setRefractionAdd("dilated_refraction", "right", e.target.value)
6971
7094
  }
6972
7095
  ) }),
6973
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
7096
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6974
7097
  Input,
6975
7098
  {
6976
7099
  disabled,
6977
7100
  type: "number",
6978
7101
  step: "0.25",
6979
- className: numberInputClass,
7102
+ className: refractionInputClass,
6980
7103
  value: safe.dilated_refraction.add.left ?? "",
6981
7104
  onChange: (e) => setRefractionAdd("dilated_refraction", "left", e.target.value)
6982
7105
  }
@@ -6987,37 +7110,50 @@ var OphthalmologyWidget = ({ fieldId }) => {
6987
7110
  ] }),
6988
7111
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
6989
7112
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Glass Power Prescription" }) }),
6990
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
7113
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: refractionTableClass, children: [
7114
+ /* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
7115
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[10%]" }),
7116
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
7117
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
7118
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
7119
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[8%]" }),
7120
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[17%]" }),
7121
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
7122
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[7%]" }),
7123
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[6%]" }),
7124
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[8%]" }),
7125
+ /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-[17%]" })
7126
+ ] }),
6991
7127
  /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
6992
7128
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6993
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6994
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6995
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
7129
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
7130
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Right Eye" }),
7131
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Left Eye" })
6996
7132
  ] }),
6997
7133
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6998
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6999
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
7000
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
7001
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
7002
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
7003
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
7004
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
7005
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
7006
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
7007
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
7008
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" })
7134
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass }),
7135
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
7136
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
7137
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
7138
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
7139
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
7140
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
7141
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
7142
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
7143
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
7144
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: refractionHeaderCellClass, children: "V/A" })
7009
7145
  ] })
7010
7146
  ] }),
7011
7147
  /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
7012
7148
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
7013
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Glass Power" }),
7014
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7149
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionLabelCellClass, children: "Glass Power" }),
7150
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7015
7151
  Input,
7016
7152
  {
7017
7153
  disabled,
7018
7154
  type: "number",
7019
7155
  step: "0.25",
7020
- className: numberInputClass,
7156
+ className: refractionInputClass,
7021
7157
  value: safe.glass_power_prescription.right_eye.sph ?? "",
7022
7158
  onChange: (e) => setRefractionField(
7023
7159
  "glass_power_prescription",
@@ -7028,13 +7164,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
7028
7164
  )
7029
7165
  }
7030
7166
  ) }),
7031
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7167
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7032
7168
  Input,
7033
7169
  {
7034
7170
  disabled,
7035
7171
  type: "number",
7036
7172
  step: "0.25",
7037
- className: numberInputClass,
7173
+ className: refractionInputClass,
7038
7174
  value: safe.glass_power_prescription.right_eye.cyl ?? "",
7039
7175
  onChange: (e) => setRefractionField(
7040
7176
  "glass_power_prescription",
@@ -7045,12 +7181,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
7045
7181
  )
7046
7182
  }
7047
7183
  ) }),
7048
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7184
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7049
7185
  Input,
7050
7186
  {
7051
7187
  disabled,
7052
7188
  type: "number",
7053
- className: numberInputClass,
7189
+ className: refractionInputClass,
7054
7190
  value: safe.glass_power_prescription.right_eye.axis ?? "",
7055
7191
  onChange: (e) => setRefractionField(
7056
7192
  "glass_power_prescription",
@@ -7061,13 +7197,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
7061
7197
  )
7062
7198
  }
7063
7199
  ) }),
7064
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7200
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7065
7201
  Input,
7066
7202
  {
7067
7203
  disabled,
7068
7204
  type: "number",
7069
7205
  step: "0.25",
7070
- className: numberInputClass,
7206
+ className: refractionInputClass,
7071
7207
  value: safe.glass_power_prescription.right_eye.prism ?? "",
7072
7208
  onChange: (e) => setRefractionField(
7073
7209
  "glass_power_prescription",
@@ -7078,11 +7214,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
7078
7214
  )
7079
7215
  }
7080
7216
  ) }),
7081
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7217
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7082
7218
  "select",
7083
7219
  {
7084
7220
  disabled,
7085
- className: selectClass,
7221
+ className: refractionSelectClass,
7086
7222
  value: safe.glass_power_prescription.right_eye.va,
7087
7223
  onChange: (e) => setRefractionField(
7088
7224
  "glass_power_prescription",
@@ -7094,13 +7230,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
7094
7230
  children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
7095
7231
  }
7096
7232
  ) }),
7097
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7233
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7098
7234
  Input,
7099
7235
  {
7100
7236
  disabled,
7101
7237
  type: "number",
7102
7238
  step: "0.25",
7103
- className: numberInputClass,
7239
+ className: refractionInputClass,
7104
7240
  value: safe.glass_power_prescription.left_eye.sph ?? "",
7105
7241
  onChange: (e) => setRefractionField(
7106
7242
  "glass_power_prescription",
@@ -7111,13 +7247,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
7111
7247
  )
7112
7248
  }
7113
7249
  ) }),
7114
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7250
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7115
7251
  Input,
7116
7252
  {
7117
7253
  disabled,
7118
7254
  type: "number",
7119
7255
  step: "0.25",
7120
- className: numberInputClass,
7256
+ className: refractionInputClass,
7121
7257
  value: safe.glass_power_prescription.left_eye.cyl ?? "",
7122
7258
  onChange: (e) => setRefractionField(
7123
7259
  "glass_power_prescription",
@@ -7128,12 +7264,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
7128
7264
  )
7129
7265
  }
7130
7266
  ) }),
7131
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7267
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7132
7268
  Input,
7133
7269
  {
7134
7270
  disabled,
7135
7271
  type: "number",
7136
- className: numberInputClass,
7272
+ className: refractionInputClass,
7137
7273
  value: safe.glass_power_prescription.left_eye.axis ?? "",
7138
7274
  onChange: (e) => setRefractionField(
7139
7275
  "glass_power_prescription",
@@ -7144,13 +7280,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
7144
7280
  )
7145
7281
  }
7146
7282
  ) }),
7147
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7283
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7148
7284
  Input,
7149
7285
  {
7150
7286
  disabled,
7151
7287
  type: "number",
7152
7288
  step: "0.25",
7153
- className: numberInputClass,
7289
+ className: refractionInputClass,
7154
7290
  value: safe.glass_power_prescription.left_eye.prism ?? "",
7155
7291
  onChange: (e) => setRefractionField(
7156
7292
  "glass_power_prescription",
@@ -7161,11 +7297,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
7161
7297
  )
7162
7298
  }
7163
7299
  ) }),
7164
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7300
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
7165
7301
  "select",
7166
7302
  {
7167
7303
  disabled,
7168
- className: selectClass,
7304
+ className: refractionSelectClass,
7169
7305
  value: safe.glass_power_prescription.left_eye.va,
7170
7306
  onChange: (e) => setRefractionField(
7171
7307
  "glass_power_prescription",
@@ -7179,25 +7315,25 @@ var OphthalmologyWidget = ({ fieldId }) => {
7179
7315
  ) })
7180
7316
  ] }),
7181
7317
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
7182
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
7183
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
7318
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionLabelCellClass, children: "Add" }),
7319
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
7184
7320
  Input,
7185
7321
  {
7186
7322
  disabled,
7187
7323
  type: "number",
7188
7324
  step: "0.25",
7189
- className: numberInputClass,
7325
+ className: refractionInputClass,
7190
7326
  value: safe.glass_power_prescription.add.right ?? "",
7191
7327
  onChange: (e) => setRefractionAdd("glass_power_prescription", "right", e.target.value)
7192
7328
  }
7193
7329
  ) }),
7194
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
7330
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
7195
7331
  Input,
7196
7332
  {
7197
7333
  disabled,
7198
7334
  type: "number",
7199
7335
  step: "0.25",
7200
- className: numberInputClass,
7336
+ className: refractionInputClass,
7201
7337
  value: safe.glass_power_prescription.add.left ?? "",
7202
7338
  onChange: (e) => setRefractionAdd("glass_power_prescription", "left", e.target.value)
7203
7339
  }
@@ -7884,6 +8020,930 @@ var DischargeMedicationOrdersWidget = ({ fieldId }) => {
7884
8020
  showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
7885
8021
  ] });
7886
8022
  };
8023
+ var DEFAULT_TOKEN_SEPARATOR = ", ";
8024
+ function getAppendSeparator(def) {
8025
+ const raw = def.meta && typeof def.meta.appendSeparator === "string" ? def.meta.appendSeparator : DEFAULT_TOKEN_SEPARATOR;
8026
+ return raw;
8027
+ }
8028
+ function getSuggestionTokensFromText(text) {
8029
+ return text.split(",").map((p) => p.trim()).filter(Boolean);
8030
+ }
8031
+ function toggleSuggestionTokenInText(current, token, separator = DEFAULT_TOKEN_SEPARATOR) {
8032
+ const t = String(token).trim();
8033
+ if (!t) return current;
8034
+ const parts = getSuggestionTokensFromText(current);
8035
+ const i = parts.findIndex((p) => p === t);
8036
+ if (i >= 0) {
8037
+ parts.splice(i, 1);
8038
+ } else {
8039
+ parts.push(t);
8040
+ }
8041
+ return parts.join(separator);
8042
+ }
8043
+ function isTokenSelected(text, optionValue) {
8044
+ const t = String(optionValue).trim();
8045
+ if (!t) return false;
8046
+ return getSuggestionTokensFromText(text).some((p) => p === t);
8047
+ }
8048
+ function deriveKnownSuggestionChipValues(text, options) {
8049
+ if (!options.length) return [];
8050
+ const allowed = new Map(options.map((o) => [String(o.value), o.value]));
8051
+ const tokens = getSuggestionTokensFromText(text);
8052
+ const out = [];
8053
+ const seen = /* @__PURE__ */ new Set();
8054
+ for (const t of tokens) {
8055
+ if (!allowed.has(t) || seen.has(t)) continue;
8056
+ seen.add(t);
8057
+ out.push(allowed.get(t));
8058
+ }
8059
+ return out;
8060
+ }
8061
+ function parallelChipArraysEqual(a, b) {
8062
+ if (!Array.isArray(a) || !Array.isArray(b)) return false;
8063
+ if (a.length !== b.length) return false;
8064
+ for (let i = 0; i < a.length; i++) {
8065
+ if (a[i] !== b[i]) return false;
8066
+ }
8067
+ return true;
8068
+ }
8069
+ function isSuggestionField(type) {
8070
+ return type === "suggestion_textarea" || type === "complaint_chips";
8071
+ }
8072
+ var SuggestionTextareaWidget = ({ fieldId }) => {
8073
+ const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
8074
+ const { state } = useForm();
8075
+ const store = useFormStore();
8076
+ const hasVoice = !!(fieldDef?.voice && store.getVoice());
8077
+ const [options, setOptions] = React15.useState([]);
8078
+ const [loading, setLoading] = React15.useState(false);
8079
+ const showError = !!error && (touched || state.submitAttempted);
8080
+ const def = fieldDef && isSuggestionField(fieldDef.type) ? fieldDef : void 0;
8081
+ const textValue = value == null || typeof value === "string" ? value || "" : String(value);
8082
+ const parallelChipFieldId = def?.meta && typeof def.meta.parallelChipFieldId === "string" ? def.meta.parallelChipFieldId.trim() : void 0;
8083
+ React15.useEffect(() => {
8084
+ if (!def) {
8085
+ setOptions([]);
8086
+ return;
8087
+ }
8088
+ if (def.options?.length) {
8089
+ setOptions(def.options);
8090
+ } else if (def.dataSource) {
8091
+ setLoading(true);
8092
+ fetchOptions(def.dataSource.source, def.dataSource.params).then((opts) => setOptions(opts)).finally(() => setLoading(false));
8093
+ } else {
8094
+ setOptions([]);
8095
+ }
8096
+ }, [def]);
8097
+ React15.useEffect(() => {
8098
+ if (!parallelChipFieldId || !def) return;
8099
+ const parallelDef = store.getFieldDef(parallelChipFieldId);
8100
+ if (!parallelDef || parallelDef.type !== "multiselect") return;
8101
+ const next = deriveKnownSuggestionChipValues(textValue, options);
8102
+ const prev = store.getFieldState(parallelChipFieldId).value;
8103
+ if (parallelChipArraysEqual(prev, next)) return;
8104
+ store.setValues({ [parallelChipFieldId]: next }, { touch: false });
8105
+ }, [def, parallelChipFieldId, textValue, options, store]);
8106
+ if (!def) {
8107
+ return null;
8108
+ }
8109
+ const appendSeparator = getAppendSeparator(def);
8110
+ const suggestionsAria = def.meta && typeof def.meta.suggestionsAriaLabel === "string" ? def.meta.suggestionsAriaLabel : "Quick suggestions";
8111
+ const theme = getThemeConfig("textarea", def.theme);
8112
+ const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
8113
+ const labelClass = theme?.labelClassName;
8114
+ const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
8115
+ const height = def.height != null ? typeof def.height === "string" ? Number(def.height) || void 0 : def.height : void 0;
8116
+ const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8117
+ def.label,
8118
+ " ",
8119
+ def.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500", children: "*" })
8120
+ ] });
8121
+ const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { children: labelContent });
8122
+ const onChipClick = (optValue) => {
8123
+ if (disabled) return;
8124
+ setValue(toggleSuggestionTokenInText(textValue, String(optValue), appendSeparator));
8125
+ };
8126
+ const hasSuggestions = options.length > 0;
8127
+ const isHighlightLabel = def.theme === "highlight-label";
8128
+ const suggestionShellClass = cn(
8129
+ "flex min-w-0 flex-col overflow-hidden",
8130
+ hasSuggestions && (isHighlightLabel ? "-mt-1 rounded-b-md border-[#D0D0D0] bg-white" : "rounded-md border border-input bg-background")
8131
+ );
8132
+ const chipsRowClass = cn(
8133
+ "flex flex-wrap gap-2 px-3 pb-2 pt-3",
8134
+ hasSuggestions && (isHighlightLabel ? "" : "border-b border-input/70"),
8135
+ disabled && "pointer-events-none opacity-50"
8136
+ );
8137
+ const textareaShellClass = cn(
8138
+ inputClass,
8139
+ hasSuggestions && cn(
8140
+ "mt-0 rounded-t-none rounded-b-md border-0 shadow-none focus-visible:ring-offset-0",
8141
+ isHighlightLabel ? "border-t-0" : "min-h-[80px]"
8142
+ )
8143
+ );
8144
+ const suggestionButtons = loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Loading suggestions\u2026" }) : options.map((opt) => {
8145
+ const on = isTokenSelected(textValue, opt.value);
8146
+ return /* @__PURE__ */ jsxRuntime.jsx(
8147
+ "button",
8148
+ {
8149
+ type: "button",
8150
+ onClick: () => onChipClick(opt.value),
8151
+ className: cn(
8152
+ "inline-flex min-h-8 items-center rounded-full border px-3 py-1 text-xs font-medium leading-none transition-colors",
8153
+ on ? "border-primary bg-primary/10 text-primary" : "border-muted-foreground/30 bg-background hover:bg-muted/60"
8154
+ ),
8155
+ children: opt.label
8156
+ },
8157
+ String(opt.value)
8158
+ );
8159
+ });
8160
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, children: [
8161
+ hasVoice ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
8162
+ labelEl,
8163
+ /* @__PURE__ */ jsxRuntime.jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
8164
+ ] }) : labelEl,
8165
+ def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: def.description }),
8166
+ hasSuggestions ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: suggestionShellClass, children: [
8167
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: chipsRowClass, role: "group", "aria-label": suggestionsAria, children: suggestionButtons }),
8168
+ /* @__PURE__ */ jsxRuntime.jsx(
8169
+ Textarea,
8170
+ {
8171
+ id: fieldId,
8172
+ value: textValue,
8173
+ onChange: (e) => setValue(e.target.value),
8174
+ onBlur: setTouched,
8175
+ disabled,
8176
+ className: textareaShellClass,
8177
+ placeholder: def.placeholder,
8178
+ style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
8179
+ }
8180
+ )
8181
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
8182
+ Textarea,
8183
+ {
8184
+ id: fieldId,
8185
+ value: textValue,
8186
+ onChange: (e) => setValue(e.target.value),
8187
+ onBlur: setTouched,
8188
+ disabled,
8189
+ className: inputClass,
8190
+ placeholder: def.placeholder,
8191
+ style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
8192
+ }
8193
+ ),
8194
+ showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
8195
+ ] });
8196
+ };
8197
+ var EMPTY_GRADES = { NO: 0, NC: 0, C: 0, PSC: 0 };
8198
+ var LOCS_FIELDS = [
8199
+ { key: "NO", label: "Nuclear Opalescence", max: 4, hint: "0\u20134" },
8200
+ { key: "NC", label: "Nuclear Colour", max: 4, hint: "0\u20134" },
8201
+ { key: "C", label: "Cortical", max: 4, hint: "0\u20134" },
8202
+ { key: "PSC", label: "Posterior Subcapsular", max: 4, hint: "0\u20134" }
8203
+ ];
8204
+ var LOCS_GRID_STYLE = {
8205
+ display: "grid",
8206
+ gridTemplateColumns: "minmax(0, 1fr) minmax(5.5rem, auto) minmax(5.5rem, auto)",
8207
+ columnGap: "1rem",
8208
+ rowGap: "0.5rem",
8209
+ alignItems: "center",
8210
+ width: "100%",
8211
+ minWidth: 0
8212
+ };
8213
+ function parseGrades(raw) {
8214
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
8215
+ const r = raw;
8216
+ const n = (k) => {
8217
+ const v = Number(r[k]);
8218
+ return Number.isFinite(v) ? Math.trunc(v) : 0;
8219
+ };
8220
+ return { NO: n("NO"), NC: n("NC"), C: n("C"), PSC: n("PSC") };
8221
+ }
8222
+ function clampGrade(v) {
8223
+ return Math.max(0, Math.min(4, Math.trunc(v)));
8224
+ }
8225
+ function parseValue(raw) {
8226
+ const locs = {
8227
+ OD: { ...EMPTY_GRADES },
8228
+ OS: { ...EMPTY_GRADES }
8229
+ };
8230
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
8231
+ const o = raw;
8232
+ const locsRaw = o.locs;
8233
+ if (locsRaw && typeof locsRaw === "object" && !Array.isArray(locsRaw)) {
8234
+ const L = locsRaw;
8235
+ const od = parseGrades(L.OD);
8236
+ const os = parseGrades(L.OS);
8237
+ if (od)
8238
+ locs.OD = {
8239
+ NO: clampGrade(od.NO),
8240
+ NC: clampGrade(od.NC),
8241
+ C: clampGrade(od.C),
8242
+ PSC: clampGrade(od.PSC)
8243
+ };
8244
+ if (os)
8245
+ locs.OS = {
8246
+ NO: clampGrade(os.NO),
8247
+ NC: clampGrade(os.NC),
8248
+ C: clampGrade(os.C),
8249
+ PSC: clampGrade(os.PSC)
8250
+ };
8251
+ }
8252
+ return {
8253
+ notes: typeof o.notes === "string" ? o.notes : "",
8254
+ assessmentKey: typeof o.assessmentKey === "string" ? o.assessmentKey : void 0,
8255
+ locs
8256
+ };
8257
+ }
8258
+ return { notes: "", assessmentKey: void 0, locs };
8259
+ }
8260
+ function cataractStage(eye, locs) {
8261
+ const g = locs[eye];
8262
+ const total = g.NO + g.NC + g.C + g.PSC;
8263
+ if (total === 0) return "\u2014";
8264
+ if (total <= 4) return "Early";
8265
+ if (total <= 8) return "Moderate";
8266
+ if (total <= 12) return "Advanced";
8267
+ return "Hypermature";
8268
+ }
8269
+ function Stepper({
8270
+ value,
8271
+ max,
8272
+ disabled,
8273
+ ariaLabel,
8274
+ onChange
8275
+ }) {
8276
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8277
+ "div",
8278
+ {
8279
+ className: "flex items-center gap-1 justify-self-center",
8280
+ role: "group",
8281
+ "aria-label": ariaLabel,
8282
+ children: [
8283
+ /* @__PURE__ */ jsxRuntime.jsx(
8284
+ "button",
8285
+ {
8286
+ type: "button",
8287
+ disabled,
8288
+ onClick: () => onChange(Math.max(0, value - 1)),
8289
+ className: "h-6 w-6 shrink-0 rounded border border-input text-xs hover:bg-muted disabled:pointer-events-none disabled:opacity-50",
8290
+ children: "-"
8291
+ }
8292
+ ),
8293
+ /* @__PURE__ */ jsxRuntime.jsx(
8294
+ "input",
8295
+ {
8296
+ type: "number",
8297
+ min: 0,
8298
+ max,
8299
+ disabled,
8300
+ value,
8301
+ "aria-label": ariaLabel,
8302
+ onChange: (e) => onChange(Math.max(0, Math.min(max, Number(e.target.value) || 0))),
8303
+ className: "h-6 w-10 shrink-0 rounded border border-input bg-background px-1 py-0 text-center text-xs disabled:opacity-50"
8304
+ }
8305
+ ),
8306
+ /* @__PURE__ */ jsxRuntime.jsx(
8307
+ "button",
8308
+ {
8309
+ type: "button",
8310
+ disabled,
8311
+ onClick: () => onChange(Math.min(max, value + 1)),
8312
+ className: "h-6 w-6 shrink-0 rounded border border-input text-xs hover:bg-muted disabled:pointer-events-none disabled:opacity-50",
8313
+ children: "+"
8314
+ }
8315
+ )
8316
+ ]
8317
+ }
8318
+ );
8319
+ }
8320
+ function StageBadge({ stage }) {
8321
+ const cls = {
8322
+ Early: "border border-emerald-200 text-foreground",
8323
+ Moderate: "border border-amber-200 text-foreground",
8324
+ Advanced: "border border-orange-300 text-foreground",
8325
+ Hypermature: "border border-destructive text-foreground",
8326
+ "\u2014": "border border-border text-muted-foreground"
8327
+ };
8328
+ return /* @__PURE__ */ jsxRuntime.jsx(
8329
+ "span",
8330
+ {
8331
+ className: cn(
8332
+ "rounded-full bg-background px-2 py-0.5 text-[11px] font-medium",
8333
+ cls[stage] ?? "border border-border text-muted-foreground"
8334
+ ),
8335
+ children: stage
8336
+ }
8337
+ );
8338
+ }
8339
+ var DEFAULT_TITLE = "Lens Assessment \u2014 LOCS III";
8340
+ var LensAssessmentWidget = ({ fieldId }) => {
8341
+ const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
8342
+ const { state } = useForm();
8343
+ const showError = !!error && (touched || state.submitAttempted);
8344
+ if (!fieldDef || fieldDef.type !== "lens_assessment") {
8345
+ return null;
8346
+ }
8347
+ const def = fieldDef;
8348
+ const v = parseValue(value);
8349
+ const locs = v.locs ?? { OD: { ...EMPTY_GRADES }, OS: { ...EMPTY_GRADES } };
8350
+ const title = def.meta?.cardTitle || (def.label?.trim() ? def.label : DEFAULT_TITLE);
8351
+ const setPartial = (patch) => {
8352
+ setValue({ ...v, ...patch, locs: patch.locs ?? v.locs ?? locs });
8353
+ };
8354
+ const setLocs = (eye, key, n) => {
8355
+ const next = clampGrade(n);
8356
+ setPartial({
8357
+ locs: {
8358
+ ...locs,
8359
+ [eye]: { ...locs[eye], [key]: next }
8360
+ }
8361
+ });
8362
+ };
8363
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8364
+ "div",
8365
+ {
8366
+ id: `lens-assessment-${fieldId}`,
8367
+ className: "w-full min-w-0 max-w-full rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm",
8368
+ children: [
8369
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-3 text-sm font-semibold text-foreground", children: title }),
8370
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: LOCS_GRID_STYLE, children: [
8371
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0", "aria-hidden": true }),
8372
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-24 justify-self-center text-center text-xs font-semibold", children: "Right Eye" }),
8373
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-24 justify-self-center text-center text-xs font-semibold", children: "Left Eye" }),
8374
+ LOCS_FIELDS.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "contents" }, children: [
8375
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 text-xs", children: [
8376
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: f.label }),
8377
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground", children: f.hint })
8378
+ ] }),
8379
+ /* @__PURE__ */ jsxRuntime.jsx(
8380
+ Stepper,
8381
+ {
8382
+ value: locs.OD[f.key],
8383
+ max: f.max,
8384
+ disabled,
8385
+ ariaLabel: `${f.label} right eye`,
8386
+ onChange: (n) => setLocs("OD", f.key, n)
8387
+ }
8388
+ ),
8389
+ /* @__PURE__ */ jsxRuntime.jsx(
8390
+ Stepper,
8391
+ {
8392
+ value: locs.OS[f.key],
8393
+ max: f.max,
8394
+ disabled,
8395
+ ariaLabel: `${f.label} left eye`,
8396
+ onChange: (n) => setLocs("OS", f.key, n)
8397
+ }
8398
+ )
8399
+ ] }, f.key))
8400
+ ] }),
8401
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 border-t border-border pt-3 text-xs", children: [
8402
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Cataract Stage" }),
8403
+ " ",
8404
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 inline-flex items-center gap-1", children: [
8405
+ "OD ",
8406
+ /* @__PURE__ */ jsxRuntime.jsx(StageBadge, { stage: cataractStage("OD", locs) })
8407
+ ] }),
8408
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 inline-flex items-center gap-1", children: [
8409
+ "OS ",
8410
+ /* @__PURE__ */ jsxRuntime.jsx(StageBadge, { stage: cataractStage("OS", locs) })
8411
+ ] })
8412
+ ] }),
8413
+ def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
8414
+ showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
8415
+ ]
8416
+ }
8417
+ );
8418
+ };
8419
+
8420
+ // src/core/functionalImpairmentScore.ts
8421
+ function clampFunctionalScore03(n) {
8422
+ const v = typeof n === "number" ? n : Number(n);
8423
+ if (!Number.isFinite(v)) return 0;
8424
+ return Math.max(0, Math.min(3, Math.trunc(v)));
8425
+ }
8426
+ function parseFunctionalImpairmentScore(raw) {
8427
+ const base = {
8428
+ reading: 0,
8429
+ nightDriving: 0,
8430
+ glare: 0,
8431
+ occupation: 0,
8432
+ adl: 0
8433
+ };
8434
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return base;
8435
+ const o = raw;
8436
+ for (const k of Object.keys(base)) {
8437
+ base[k] = clampFunctionalScore03(o[k]);
8438
+ }
8439
+ return base;
8440
+ }
8441
+ function functionalImpairmentTotal(v) {
8442
+ return v.reading + v.nightDriving + v.glare + v.occupation + v.adl;
8443
+ }
8444
+ var ITEMS = [
8445
+ { key: "reading", label: "Difficulty reading" },
8446
+ { key: "nightDriving", label: "Night driving difficulty" },
8447
+ { key: "glare", label: "Glare sensitivity" },
8448
+ { key: "occupation", label: "Occupational impact" },
8449
+ { key: "adl", label: "ADL limitation" }
8450
+ ];
8451
+ var SCALE_LABELS = ["None", "Mild", "Moderate", "Severe"];
8452
+ var DEFAULT_TITLE2 = "Functional Impairment Score (Stage 5)";
8453
+ var ITEMS_GRID_STYLE = {
8454
+ display: "grid",
8455
+ gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 8rem), 1fr))",
8456
+ columnGap: "0.5rem",
8457
+ rowGap: "0.5rem",
8458
+ width: "100%",
8459
+ minWidth: 0
8460
+ };
8461
+ function clamp03(n) {
8462
+ const v = typeof n === "number" ? n : Number(n);
8463
+ if (!Number.isFinite(v)) return 0;
8464
+ return Math.max(0, Math.min(3, Math.trunc(v)));
8465
+ }
8466
+ var FunctionalImpairmentScoreWidget = ({
8467
+ fieldId
8468
+ }) => {
8469
+ const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
8470
+ const { state } = useForm();
8471
+ const showError = !!error && (touched || state.submitAttempted);
8472
+ if (!fieldDef || fieldDef.type !== "functional_impairment_score") {
8473
+ return null;
8474
+ }
8475
+ const def = fieldDef;
8476
+ const v = parseFunctionalImpairmentScore(value);
8477
+ const total = functionalImpairmentTotal(v);
8478
+ const title = def.meta?.cardTitle?.trim() || (def.label?.trim() ? def.label : DEFAULT_TITLE2);
8479
+ const setDim = (key, n) => {
8480
+ setValue({ ...v, [key]: clamp03(n) });
8481
+ };
8482
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8483
+ "div",
8484
+ {
8485
+ id: `functional-impairment-${fieldId}`,
8486
+ className: "w-full min-w-0 max-w-full rounded-lg border border-border bg-card p-3 text-card-foreground shadow-sm",
8487
+ children: [
8488
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-2 text-xs font-semibold leading-tight text-foreground sm:text-[13px]", children: title }),
8489
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: ITEMS_GRID_STYLE, children: ITEMS.map((it) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
8490
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[10px] font-medium leading-snug text-foreground sm:text-[11px]", children: it.label }),
8491
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-fit max-w-full shrink-0 gap-0.5", children: [0, 1, 2, 3].map((score) => /* @__PURE__ */ jsxRuntime.jsx(
8492
+ "button",
8493
+ {
8494
+ type: "button",
8495
+ title: SCALE_LABELS[score],
8496
+ disabled,
8497
+ onClick: () => setDim(it.key, score),
8498
+ className: cn(
8499
+ "h-6 w-7 shrink-0 rounded border text-[10px] transition-colors sm:text-[11px]",
8500
+ v[it.key] === score ? "border-primary bg-primary text-primary-foreground" : "border-input hover:bg-muted",
8501
+ disabled && "pointer-events-none opacity-50"
8502
+ ),
8503
+ children: score
8504
+ },
8505
+ score
8506
+ )) })
8507
+ ] }, it.key)) }),
8508
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex flex-col gap-1.5 border-t border-border pt-2 sm:flex-row sm:items-center sm:justify-between sm:gap-2", children: [
8509
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[10px] leading-snug text-muted-foreground sm:text-[11px]", children: "Score scale: 0 = none, 3 = severe (each item)" }),
8510
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-1.5 sm:justify-end", children: [
8511
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground sm:text-[11px]", children: "Total" }),
8512
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold tabular-nums sm:text-[15px]", children: [
8513
+ total,
8514
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-normal text-muted-foreground", children: "/15" })
8515
+ ] })
8516
+ ] })
8517
+ ] }),
8518
+ def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
8519
+ showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
8520
+ ]
8521
+ }
8522
+ );
8523
+ };
8524
+ var FORMULA_OPTIONS = [
8525
+ "SRK/T",
8526
+ "Barrett Universal II",
8527
+ "Hoffer Q",
8528
+ "Haigis",
8529
+ "Holladay 1",
8530
+ "Holladay 2",
8531
+ "Kane"
8532
+ ];
8533
+ var METHODS = [
8534
+ { value: "optical_biometry", label: "Optical biometry (IOL Master)" },
8535
+ { value: "ascan_immersion", label: "A-scan (immersion)" },
8536
+ { value: "ascan_contact", label: "A-scan (contact)" }
8537
+ ];
8538
+ var EMPTY = {
8539
+ axialLengthOD: "",
8540
+ axialLengthOS: "",
8541
+ k1k2AxisOD: "",
8542
+ k1k2AxisOS: "",
8543
+ anteriorChamberDepthOD: "",
8544
+ anteriorChamberDepthOS: "",
8545
+ iolPowerOD: "",
8546
+ iolPowerOS: "",
8547
+ targetRefractionOD: "",
8548
+ targetRefractionOS: "",
8549
+ formula: "SRK/T",
8550
+ method: "optical_biometry",
8551
+ cornealTopoUploaded: false,
8552
+ specularMicroscopyDone: false,
8553
+ endothelialCount: ""
8554
+ };
8555
+ function str(x) {
8556
+ return typeof x === "string" ? x : "";
8557
+ }
8558
+ function parseValue2(raw) {
8559
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { ...EMPTY };
8560
+ const o = raw;
8561
+ const m = o.method;
8562
+ const method = m === "ascan_immersion" || m === "ascan_contact" || m === "optical_biometry" ? m : "optical_biometry";
8563
+ const formula = str(o.formula);
8564
+ return {
8565
+ ...EMPTY,
8566
+ axialLengthOD: str(o.axialLengthOD),
8567
+ axialLengthOS: str(o.axialLengthOS),
8568
+ k1k2AxisOD: str(o.k1k2AxisOD),
8569
+ k1k2AxisOS: str(o.k1k2AxisOS),
8570
+ anteriorChamberDepthOD: str(o.anteriorChamberDepthOD),
8571
+ anteriorChamberDepthOS: str(o.anteriorChamberDepthOS),
8572
+ iolPowerOD: str(o.iolPowerOD),
8573
+ iolPowerOS: str(o.iolPowerOS),
8574
+ targetRefractionOD: str(o.targetRefractionOD),
8575
+ targetRefractionOS: str(o.targetRefractionOS),
8576
+ formula: formula || "SRK/T",
8577
+ method,
8578
+ cornealTopoUploaded: o.cornealTopoUploaded === true,
8579
+ specularMicroscopyDone: o.specularMicroscopyDone === true,
8580
+ endothelialCount: str(o.endothelialCount)
8581
+ };
8582
+ }
8583
+ var paramCell = "emr-biometry-param text-[11px] font-semibold leading-snug text-foreground sm:text-xs py-2";
8584
+ var eyeTh = "emr-biometry-eye text-center text-[11px] font-semibold sm:text-xs py-2";
8585
+ function Inp({
8586
+ value,
8587
+ onChange,
8588
+ disabled,
8589
+ placeholder
8590
+ }) {
8591
+ return /* @__PURE__ */ jsxRuntime.jsx(
8592
+ "input",
8593
+ {
8594
+ value,
8595
+ disabled,
8596
+ placeholder,
8597
+ onChange: (e) => onChange(e.target.value),
8598
+ className: "box-border w-full min-w-0 rounded border border-input bg-background px-2 py-1 text-[11px] sm:text-xs"
8599
+ }
8600
+ );
8601
+ }
8602
+ var DEFAULT_TITLE3 = "Biometry & IOL Workup (Stage 7)";
8603
+ var BiometryIolWorkupWidget = ({ fieldId }) => {
8604
+ const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
8605
+ const { state } = useForm();
8606
+ const showError = !!error && (touched || state.submitAttempted);
8607
+ if (!fieldDef || fieldDef.type !== "biometry_iol_workup") {
8608
+ return null;
8609
+ }
8610
+ const def = fieldDef;
8611
+ const v = parseValue2(value);
8612
+ const title = def.meta?.cardTitle?.trim() || (def.label?.trim() ? def.label : DEFAULT_TITLE3);
8613
+ const patch = (p) => setValue({ ...v, ...p });
8614
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8615
+ "div",
8616
+ {
8617
+ id: `biometry-iol-${fieldId}`,
8618
+ className: "w-full min-w-0 max-w-full self-stretch rounded-lg border border-border bg-card p-3 text-card-foreground shadow-sm",
8619
+ children: [
8620
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-2.5 text-sm font-semibold leading-tight text-foreground", children: title }),
8621
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full min-w-0 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "emr-table emr-table--biometry min-w-full", children: [
8622
+ /* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
8623
+ /* @__PURE__ */ jsxRuntime.jsx("col", { style: { width: "32%" } }),
8624
+ /* @__PURE__ */ jsxRuntime.jsx("col", { style: { width: "34%" } }),
8625
+ /* @__PURE__ */ jsxRuntime.jsx("col", { style: { width: "34%" } })
8626
+ ] }),
8627
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8628
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: paramCell, children: "Parameter" }),
8629
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: eyeTh, children: "Right Eye" }),
8630
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: eyeTh, children: "Left Eye" })
8631
+ ] }) }),
8632
+ /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
8633
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8634
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: paramCell, children: "Axial Length (mm)" }),
8635
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8636
+ Inp,
8637
+ {
8638
+ value: v.axialLengthOD,
8639
+ disabled,
8640
+ placeholder: "e.g. 23.45",
8641
+ onChange: (s) => patch({ axialLengthOD: s })
8642
+ }
8643
+ ) }),
8644
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8645
+ Inp,
8646
+ {
8647
+ value: v.axialLengthOS,
8648
+ disabled,
8649
+ placeholder: "e.g. 23.45",
8650
+ onChange: (s) => patch({ axialLengthOS: s })
8651
+ }
8652
+ ) })
8653
+ ] }),
8654
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8655
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: paramCell, children: "K1 / K2 / Axis" }),
8656
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8657
+ Inp,
8658
+ {
8659
+ value: v.k1k2AxisOD,
8660
+ disabled,
8661
+ placeholder: "44.0 / 44.5 / 90",
8662
+ onChange: (s) => patch({ k1k2AxisOD: s })
8663
+ }
8664
+ ) }),
8665
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8666
+ Inp,
8667
+ {
8668
+ value: v.k1k2AxisOS,
8669
+ disabled,
8670
+ placeholder: "44.0 / 44.5 / 90",
8671
+ onChange: (s) => patch({ k1k2AxisOS: s })
8672
+ }
8673
+ ) })
8674
+ ] }),
8675
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8676
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: `${paramCell} whitespace-nowrap`, children: "Anterior Chamber Depth (mm)" }),
8677
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8678
+ Inp,
8679
+ {
8680
+ value: v.anteriorChamberDepthOD,
8681
+ disabled,
8682
+ onChange: (s) => patch({ anteriorChamberDepthOD: s })
8683
+ }
8684
+ ) }),
8685
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8686
+ Inp,
8687
+ {
8688
+ value: v.anteriorChamberDepthOS,
8689
+ disabled,
8690
+ onChange: (s) => patch({ anteriorChamberDepthOS: s })
8691
+ }
8692
+ ) })
8693
+ ] }),
8694
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8695
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: paramCell, children: "IOL Power (D)" }),
8696
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(Inp, { value: v.iolPowerOD, disabled, onChange: (s) => patch({ iolPowerOD: s }) }) }),
8697
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(Inp, { value: v.iolPowerOS, disabled, onChange: (s) => patch({ iolPowerOS: s }) }) })
8698
+ ] }),
8699
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8700
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: paramCell, children: "Target Refraction (D)" }),
8701
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8702
+ Inp,
8703
+ {
8704
+ value: v.targetRefractionOD,
8705
+ disabled,
8706
+ placeholder: "e.g. -0.25",
8707
+ onChange: (s) => patch({ targetRefractionOD: s })
8708
+ }
8709
+ ) }),
8710
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
8711
+ Inp,
8712
+ {
8713
+ value: v.targetRefractionOS,
8714
+ disabled,
8715
+ placeholder: "e.g. -0.25",
8716
+ onChange: (s) => patch({ targetRefractionOS: s })
8717
+ }
8718
+ ) })
8719
+ ] }),
8720
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8721
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: paramCell, children: "Formula" }),
8722
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-2 py-2 align-middle", colSpan: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
8723
+ "select",
8724
+ {
8725
+ value: v.formula,
8726
+ disabled,
8727
+ onChange: (e) => patch({ formula: e.target.value }),
8728
+ className: "box-border w-full min-w-0 rounded border border-input bg-background px-2 py-1 text-[11px] sm:text-xs",
8729
+ children: FORMULA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt))
8730
+ }
8731
+ ) })
8732
+ ] }),
8733
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8734
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: `${paramCell} align-top`, children: "Method" }),
8735
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-2 py-2 align-middle", colSpan: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
8736
+ "div",
8737
+ {
8738
+ role: "radiogroup",
8739
+ "aria-label": "Biometry method",
8740
+ className: "flex w-full flex-wrap items-center justify-center gap-x-3 gap-y-2 text-[11px] sm:gap-x-4 sm:text-xs",
8741
+ children: METHODS.map(({ value: mv, label }) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex min-w-0 shrink-0 cursor-pointer items-center gap-1.5", children: [
8742
+ /* @__PURE__ */ jsxRuntime.jsx(
8743
+ "input",
8744
+ {
8745
+ type: "radio",
8746
+ name: `${fieldId}-biom-method`,
8747
+ value: mv,
8748
+ checked: v.method === mv,
8749
+ disabled,
8750
+ onChange: () => patch({ method: mv }),
8751
+ className: "shrink-0"
8752
+ }
8753
+ ),
8754
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 whitespace-nowrap leading-tight", children: label })
8755
+ ] }, mv))
8756
+ }
8757
+ ) })
8758
+ ] }),
8759
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
8760
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: `${paramCell} align-top text-muted-foreground`, children: "Optional workup" }),
8761
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-2 py-2 align-middle", colSpan: 2, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
8762
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-2 sm:justify-between", children: [
8763
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex min-w-0 cursor-pointer items-center gap-1.5 text-[11px] leading-snug sm:text-xs", children: [
8764
+ /* @__PURE__ */ jsxRuntime.jsx(
8765
+ "input",
8766
+ {
8767
+ type: "checkbox",
8768
+ className: "shrink-0",
8769
+ checked: v.cornealTopoUploaded,
8770
+ disabled,
8771
+ onChange: (e) => patch({ cornealTopoUploaded: e.target.checked })
8772
+ }
8773
+ ),
8774
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Corneal topography uploaded" })
8775
+ ] }),
8776
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex min-w-0 cursor-pointer items-center gap-1.5 text-[11px] leading-snug sm:text-xs", children: [
8777
+ /* @__PURE__ */ jsxRuntime.jsx(
8778
+ "input",
8779
+ {
8780
+ type: "checkbox",
8781
+ className: "shrink-0",
8782
+ checked: v.specularMicroscopyDone,
8783
+ disabled,
8784
+ onChange: (e) => patch({ specularMicroscopyDone: e.target.checked })
8785
+ }
8786
+ ),
8787
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Specular microscopy done" })
8788
+ ] })
8789
+ ] }),
8790
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2 text-[11px] sm:text-xs", children: [
8791
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-muted-foreground", children: "Endothelial count:" }),
8792
+ /* @__PURE__ */ jsxRuntime.jsx(
8793
+ "input",
8794
+ {
8795
+ value: v.endothelialCount,
8796
+ disabled,
8797
+ placeholder: "cells/mm\xB2",
8798
+ onChange: (e) => patch({ endothelialCount: e.target.value }),
8799
+ className: "box-border w-[5.5rem] min-w-0 shrink-0 rounded border border-input bg-background px-2 py-1 text-[11px] sm:text-xs"
8800
+ }
8801
+ )
8802
+ ] })
8803
+ ] }) })
8804
+ ] })
8805
+ ] })
8806
+ ] }) }),
8807
+ def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
8808
+ showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
8809
+ ]
8810
+ }
8811
+ );
8812
+ };
8813
+ var RISKS = [
8814
+ "Small pupil",
8815
+ "Pseudoexfoliation",
8816
+ "Diabetes",
8817
+ "Shallow AC",
8818
+ "Previous ocular surgery",
8819
+ "Zonular weakness",
8820
+ "Mature/white cataract"
8821
+ ];
8822
+ var DIABETES = "Diabetes";
8823
+ function parseValue3(raw) {
8824
+ const empty = { OD: [], OS: [] };
8825
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return empty;
8826
+ const o = raw;
8827
+ const arr = (x) => Array.isArray(x) ? x.filter((i) => typeof i === "string") : [];
8828
+ let OD = arr(o.OD);
8829
+ let OS = arr(o.OS);
8830
+ const odD = OD.includes(DIABETES);
8831
+ const osD = OS.includes(DIABETES);
8832
+ if (odD !== osD) {
8833
+ if (odD && !osD) OS = [...OS, DIABETES];
8834
+ else if (osD && !odD) OD = [...OD, DIABETES];
8835
+ }
8836
+ return { OD, OS };
8837
+ }
8838
+ function riskTierForCount(n) {
8839
+ if (n === 0) return "Low";
8840
+ if (n <= 2) return "Moderate";
8841
+ return "High";
8842
+ }
8843
+ function tierBadgeClass(tier) {
8844
+ if (tier === "High") return "bg-red-600 text-white";
8845
+ if (tier === "Moderate") return "bg-amber-500 text-white";
8846
+ return "bg-emerald-600 text-white";
8847
+ }
8848
+ var DEFAULT_TITLE4 = "Surgical Risk Flags (Stage 11)";
8849
+ function RiskCol({
8850
+ eye,
8851
+ value,
8852
+ disabled,
8853
+ onToggle
8854
+ }) {
8855
+ const selected = new Set(value[eye]);
8856
+ const tier = riskTierForCount(selected.size);
8857
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
8858
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
8859
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-semibold text-foreground", children: eye === "OD" ? "Right Eye (OD)" : "Left Eye (OS)" }),
8860
+ /* @__PURE__ */ jsxRuntime.jsxs(
8861
+ "span",
8862
+ {
8863
+ className: cn(
8864
+ "whitespace-nowrap rounded-full px-2 py-0.5 text-[11px] font-medium",
8865
+ tierBadgeClass(tier)
8866
+ ),
8867
+ children: [
8868
+ tier,
8869
+ " risk"
8870
+ ]
8871
+ }
8872
+ )
8873
+ ] }),
8874
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1.5", children: RISKS.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
8875
+ "label",
8876
+ {
8877
+ className: "flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-muted/50",
8878
+ children: [
8879
+ /* @__PURE__ */ jsxRuntime.jsx(
8880
+ "input",
8881
+ {
8882
+ type: "checkbox",
8883
+ className: "shrink-0",
8884
+ checked: selected.has(r),
8885
+ disabled,
8886
+ onChange: () => onToggle(eye, r)
8887
+ }
8888
+ ),
8889
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: r })
8890
+ ]
8891
+ },
8892
+ r
8893
+ )) })
8894
+ ] });
8895
+ }
8896
+ var SurgicalRiskFlagsWidget = ({ fieldId }) => {
8897
+ const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
8898
+ const { state } = useForm();
8899
+ const showError = !!error && (touched || state.submitAttempted);
8900
+ if (!fieldDef || fieldDef.type !== "surgical_risk_flags") {
8901
+ return null;
8902
+ }
8903
+ const def = fieldDef;
8904
+ const v = parseValue3(value);
8905
+ const title = def.meta?.cardTitle?.trim() || (def.label?.trim() ? def.label : DEFAULT_TITLE4);
8906
+ const toggleRisk = (eye, risk) => {
8907
+ const next = {
8908
+ OD: [...v.OD],
8909
+ OS: [...v.OS]
8910
+ };
8911
+ if (risk === DIABETES) {
8912
+ const had = next.OD.includes(DIABETES) || next.OS.includes(DIABETES);
8913
+ if (had) {
8914
+ next.OD = next.OD.filter((x) => x !== DIABETES);
8915
+ next.OS = next.OS.filter((x) => x !== DIABETES);
8916
+ } else {
8917
+ if (!next.OD.includes(DIABETES)) next.OD.push(DIABETES);
8918
+ if (!next.OS.includes(DIABETES)) next.OS.push(DIABETES);
8919
+ }
8920
+ setValue(next);
8921
+ return;
8922
+ }
8923
+ const list = next[eye];
8924
+ const i = list.indexOf(risk);
8925
+ if (i === -1) list.push(risk);
8926
+ else list.splice(i, 1);
8927
+ setValue(next);
8928
+ };
8929
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8930
+ "div",
8931
+ {
8932
+ id: `surgical-risk-flags-${fieldId}`,
8933
+ className: "w-full min-w-0 max-w-full rounded-lg border border-border bg-card p-3 text-card-foreground shadow-sm",
8934
+ children: [
8935
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-3 text-sm font-semibold leading-tight text-foreground", children: title }),
8936
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-6", children: [
8937
+ /* @__PURE__ */ jsxRuntime.jsx(RiskCol, { eye: "OD", value: v, disabled, onToggle: toggleRisk }),
8938
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px shrink-0 bg-border", "aria-hidden": true }),
8939
+ /* @__PURE__ */ jsxRuntime.jsx(RiskCol, { eye: "OS", value: v, disabled, onToggle: toggleRisk })
8940
+ ] }),
8941
+ def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
8942
+ showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
8943
+ ]
8944
+ }
8945
+ );
8946
+ };
7887
8947
  var FieldRenderer = ({ fieldId }) => {
7888
8948
  const { fieldDef, visible } = useField(fieldId);
7889
8949
  if (!visible || !fieldDef) {
@@ -7975,6 +9035,17 @@ function renderWidget(fieldId, fieldDef) {
7975
9035
  /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
7976
9036
  ] });
7977
9037
  }
9038
+ case "suggestion_textarea":
9039
+ case "complaint_chips":
9040
+ return /* @__PURE__ */ jsxRuntime.jsx(SuggestionTextareaWidget, { fieldId });
9041
+ case "lens_assessment":
9042
+ return /* @__PURE__ */ jsxRuntime.jsx(LensAssessmentWidget, { fieldId });
9043
+ case "functional_impairment_score":
9044
+ return /* @__PURE__ */ jsxRuntime.jsx(FunctionalImpairmentScoreWidget, { fieldId });
9045
+ case "biometry_iol_workup":
9046
+ return /* @__PURE__ */ jsxRuntime.jsx(BiometryIolWorkupWidget, { fieldId });
9047
+ case "surgical_risk_flags":
9048
+ return /* @__PURE__ */ jsxRuntime.jsx(SurgicalRiskFlagsWidget, { fieldId });
7978
9049
  case "static_text": {
7979
9050
  const def = fieldDef;
7980
9051
  const size = def.size ?? "regular";
@@ -8675,6 +9746,84 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
8675
9746
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${isOn ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-600"}`, children: isOn ? "Yes" : "No" })
8676
9747
  ] });
8677
9748
  }
9749
+ case "suggestion_textarea":
9750
+ case "complaint_chips":
9751
+ return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText, { fieldDef, value });
9752
+ case "lens_assessment": {
9753
+ const v = value && typeof value === "object" && !Array.isArray(value) ? value : null;
9754
+ const notes = typeof v?.notes === "string" ? v.notes : "";
9755
+ const key = typeof v?.assessmentKey === "string" ? v.assessmentKey : null;
9756
+ const locs = v?.locs;
9757
+ const locsRecord = locs != null && typeof locs === "object" && !Array.isArray(locs) ? locs : null;
9758
+ const eyeLine = (label, g) => {
9759
+ if (!g || typeof g !== "object") return null;
9760
+ const num = (k) => typeof g[k] === "number" ? g[k] : "\u2014";
9761
+ return /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-foreground", children: [
9762
+ label,
9763
+ ": NO ",
9764
+ String(num("NO")),
9765
+ ", NC ",
9766
+ String(num("NC")),
9767
+ ", C ",
9768
+ String(num("C")),
9769
+ ", PSC",
9770
+ " ",
9771
+ String(num("PSC"))
9772
+ ] });
9773
+ };
9774
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 rounded-md border p-3 text-sm", children: [
9775
+ fieldDef.label && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-foreground", children: fieldDef.label }),
9776
+ locsRecord ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 border-l-2 border-muted pl-2", children: [
9777
+ eyeLine("Right (OD)", locsRecord.OD),
9778
+ eyeLine("Left (OS)", locsRecord.OS)
9779
+ ] }) : null,
9780
+ key && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
9781
+ "Assessment (legacy): ",
9782
+ key
9783
+ ] }),
9784
+ notes && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-wrap text-foreground", children: notes })
9785
+ ] });
9786
+ }
9787
+ case "functional_impairment_score": {
9788
+ const v = parseFunctionalImpairmentScore(value);
9789
+ const total = functionalImpairmentTotal(v);
9790
+ const lines = [
9791
+ `Reading: ${v.reading}`,
9792
+ `Night driving: ${v.nightDriving}`,
9793
+ `Glare: ${v.glare}`,
9794
+ `Occupation: ${v.occupation}`,
9795
+ `ADL: ${v.adl}`,
9796
+ `Total: ${total}/15`
9797
+ ].join("\n");
9798
+ return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText, { fieldDef, value: lines });
9799
+ }
9800
+ case "biometry_iol_workup": {
9801
+ const v = value && typeof value === "object" && !Array.isArray(value) ? value : {};
9802
+ const s = (k) => typeof v[k] === "string" ? v[k] : "";
9803
+ const b = (k) => v[k] === true;
9804
+ const method = v.method === "ascan_immersion" ? "A-scan (immersion)" : v.method === "ascan_contact" ? "A-scan (contact)" : "Optical biometry (IOL Master)";
9805
+ const lines = [
9806
+ `Axial length OD/OS (mm): ${s("axialLengthOD")} / ${s("axialLengthOS")}`,
9807
+ `K1/K2/Axis OD/OS: ${s("k1k2AxisOD")} / ${s("k1k2AxisOS")}`,
9808
+ `AC depth OD/OS (mm): ${s("anteriorChamberDepthOD")} / ${s("anteriorChamberDepthOS")}`,
9809
+ `IOL power (D) OD/OS: ${s("iolPowerOD")} / ${s("iolPowerOS")}`,
9810
+ `Target refraction (D) OD/OS: ${s("targetRefractionOD")} / ${s("targetRefractionOS")}`,
9811
+ `Formula: ${s("formula") || "\u2014"}`,
9812
+ `Method: ${method}`,
9813
+ `Corneal topography uploaded: ${b("cornealTopoUploaded") ? "Yes" : "No"}`,
9814
+ `Specular microscopy: ${b("specularMicroscopyDone") ? "Yes" : "No"}`,
9815
+ `Endothelial count: ${s("endothelialCount") || "\u2014"}`
9816
+ ].join("\n");
9817
+ return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText, { fieldDef, value: lines });
9818
+ }
9819
+ case "surgical_risk_flags": {
9820
+ const v = value && typeof value === "object" && !Array.isArray(value) ? value : null;
9821
+ const list = (x) => Array.isArray(x) ? x.filter((i) => typeof i === "string").join(", ") : "\u2014";
9822
+ const od = list(v?.OD);
9823
+ const os = list(v?.OS);
9824
+ const lines = [`Right eye (OD): ${od}`, `Left eye (OS): ${os}`].join("\n");
9825
+ return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText, { fieldDef, value: lines });
9826
+ }
8678
9827
  case "static_text": {
8679
9828
  const def = fieldDef;
8680
9829
  const size = def.size ?? "regular";