@alfadocs/ui-kit-debug 1.4.11 → 1.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/dist/_chunks/actions-cell-renderer-BD-jruqA.js +1784 -0
  2. package/dist/_chunks/actions-cell-renderer-BD-jruqA.js.map +1 -0
  3. package/dist/_chunks/{address-fields-pHsfkXGk.js → address-fields-D-8akw2m.js} +2 -2
  4. package/dist/_chunks/{address-fields-pHsfkXGk.js.map → address-fields-D-8akw2m.js.map} +1 -1
  5. package/dist/_chunks/{agenda-card-BCGaQazD.js → agenda-card-BQDs2ZMp.js} +2 -2
  6. package/dist/_chunks/{agenda-card-BCGaQazD.js.map → agenda-card-BQDs2ZMp.js.map} +1 -1
  7. package/dist/_chunks/{agenda-tray-CG6FuccE.js → agenda-tray-BTyWsVwT.js} +2 -2
  8. package/dist/_chunks/{agenda-tray-CG6FuccE.js.map → agenda-tray-BTyWsVwT.js.map} +1 -1
  9. package/dist/_chunks/{ai-consent-banner-CpF_rbG9.js → ai-consent-banner-gVcoiXxv.js} +2 -2
  10. package/dist/_chunks/{ai-consent-banner-CpF_rbG9.js.map → ai-consent-banner-gVcoiXxv.js.map} +1 -1
  11. package/dist/_chunks/{anamnesis-card-C4FVp9wO.js → anamnesis-card-Bt0twrML.js} +2 -2
  12. package/dist/_chunks/{anamnesis-card-C4FVp9wO.js.map → anamnesis-card-Bt0twrML.js.map} +1 -1
  13. package/dist/_chunks/anamnesis-summary-card-BKGVcwny.js +350 -0
  14. package/dist/_chunks/anamnesis-summary-card-BKGVcwny.js.map +1 -0
  15. package/dist/_chunks/{anamnesis-summary-rows-Dw3l6nOD.js → anamnesis-summary-rows-B5MAYkJ-.js} +2768 -2951
  16. package/dist/_chunks/anamnesis-summary-rows-B5MAYkJ-.js.map +1 -0
  17. package/dist/_chunks/{antenatal-schedule-timeline-u8TsS2QJ.js → antenatal-schedule-timeline-BSLrOQ3S.js} +2 -2
  18. package/dist/_chunks/{antenatal-schedule-timeline-u8TsS2QJ.js.map → antenatal-schedule-timeline-BSLrOQ3S.js.map} +1 -1
  19. package/dist/_chunks/{appointment-card-DgKI5QKD.js → appointment-card-kcUC7vWR.js} +2 -2
  20. package/dist/_chunks/{appointment-card-DgKI5QKD.js.map → appointment-card-kcUC7vWR.js.map} +1 -1
  21. package/dist/_chunks/{appointment-timeline-CUijZCxZ.js → appointment-timeline-BC3dlZu5.js} +2 -2
  22. package/dist/_chunks/{appointment-timeline-CUijZCxZ.js.map → appointment-timeline-BC3dlZu5.js.map} +1 -1
  23. package/dist/_chunks/{appointment-tray-B1aUk46V.js → appointment-tray-BPY5rATW.js} +2 -2
  24. package/dist/_chunks/{appointment-tray-B1aUk46V.js.map → appointment-tray-BPY5rATW.js.map} +1 -1
  25. package/dist/_chunks/{badge-DCOqV9mI.js → badge-CIt-UFEx.js} +28 -28
  26. package/dist/_chunks/{badge-DCOqV9mI.js.map → badge-CIt-UFEx.js.map} +1 -1
  27. package/dist/_chunks/{bishop-score-Bpe20Ctl.js → bishop-score-B6iYYO0c.js} +3 -3
  28. package/dist/_chunks/{bishop-score-Bpe20Ctl.js.map → bishop-score-B6iYYO0c.js.map} +1 -1
  29. package/dist/_chunks/{bmi-calculator-DF5bNsDD.js → bmi-calculator-DC5SaqXT.js} +5 -5
  30. package/dist/_chunks/{bmi-calculator-DF5bNsDD.js.map → bmi-calculator-DC5SaqXT.js.map} +1 -1
  31. package/dist/_chunks/{booking-DuSkvE5x.js → booking-CmHX15dh.js} +2 -2
  32. package/dist/_chunks/{booking-DuSkvE5x.js.map → booking-CmHX15dh.js.map} +1 -1
  33. package/dist/_chunks/{care-plan-card-DiyK3Eys.js → care-plan-card-9tLgsDYY.js} +3 -3
  34. package/dist/_chunks/{care-plan-card-DiyK3Eys.js.map → care-plan-card-9tLgsDYY.js.map} +1 -1
  35. package/dist/_chunks/{care-plan-entry-card-6du8PYVk.js → care-plan-entry-card-CSan4h7A.js} +2 -2
  36. package/dist/_chunks/{care-plan-entry-card-6du8PYVk.js.map → care-plan-entry-card-CSan4h7A.js.map} +1 -1
  37. package/dist/_chunks/{care-plan-header-BWvDvly-.js → care-plan-header-D_BTi77b.js} +2 -2
  38. package/dist/_chunks/{care-plan-header-BWvDvly-.js.map → care-plan-header-D_BTi77b.js.map} +1 -1
  39. package/dist/_chunks/{clinical-note-card-D63x_AkK.js → clinical-note-card-ByzQ86uz.js} +2 -2
  40. package/dist/_chunks/{clinical-note-card-D63x_AkK.js.map → clinical-note-card-ByzQ86uz.js.map} +1 -1
  41. package/dist/_chunks/{connection-status-Bi4Hwpd1.js → connection-status-D8mZ4klk.js} +2 -2
  42. package/dist/_chunks/{connection-status-Bi4Hwpd1.js.map → connection-status-D8mZ4klk.js.map} +1 -1
  43. package/dist/_chunks/{contact-profile-card-CGS_NABR.js → contact-profile-card-DuW6VpzY.js} +2 -2
  44. package/dist/_chunks/{contact-profile-card-CGS_NABR.js.map → contact-profile-card-DuW6VpzY.js.map} +1 -1
  45. package/dist/_chunks/{cycle-calculator-Bd4_fJhq.js → cycle-calculator-B_NlctlQ.js} +4 -4
  46. package/dist/_chunks/{cycle-calculator-Bd4_fJhq.js.map → cycle-calculator-B_NlctlQ.js.map} +1 -1
  47. package/dist/_chunks/{date-time-picker-DafkGDGO.js → date-time-picker-DVETwpzc.js} +2 -2
  48. package/dist/_chunks/{date-time-picker-DafkGDGO.js.map → date-time-picker-DVETwpzc.js.map} +1 -1
  49. package/dist/_chunks/{dependent-selector-DyFpdzZV.js → dependent-selector-BUvrZRi0.js} +2 -2
  50. package/dist/_chunks/{dependent-selector-DyFpdzZV.js.map → dependent-selector-BUvrZRi0.js.map} +1 -1
  51. package/dist/_chunks/{document-preview-DuMzmupZ.js → document-preview-Di15VrpQ.js} +2 -2
  52. package/dist/_chunks/{document-preview-DuMzmupZ.js.map → document-preview-Di15VrpQ.js.map} +1 -1
  53. package/dist/_chunks/{due-date-calculator-Do67C-Z-.js → due-date-calculator-le1z3KpW.js} +6 -6
  54. package/dist/_chunks/{due-date-calculator-Do67C-Z-.js.map → due-date-calculator-le1z3KpW.js.map} +1 -1
  55. package/dist/_chunks/{fetal-weight-DHxXx7Uz.js → fetal-weight-DXA6ZpMq.js} +4 -4
  56. package/dist/_chunks/{fetal-weight-DHxXx7Uz.js.map → fetal-weight-DXA6ZpMq.js.map} +1 -1
  57. package/dist/_chunks/{field-value-C5A4t4OE.js → field-value-BCFLVBmu.js} +2 -2
  58. package/dist/_chunks/{field-value-C5A4t4OE.js.map → field-value-BCFLVBmu.js.map} +1 -1
  59. package/dist/_chunks/{file-manager-BY6FdHAt.js → file-manager-BjCM2fZB.js} +3 -3
  60. package/dist/_chunks/{file-manager-BY6FdHAt.js.map → file-manager-BjCM2fZB.js.map} +1 -1
  61. package/dist/_chunks/form-field-D1oqYisL.js +127 -0
  62. package/dist/_chunks/form-field-D1oqYisL.js.map +1 -0
  63. package/dist/_chunks/{gestational-age-calculator-CMhOtFE_.js → gestational-age-calculator-Ch8vmJAl.js} +5 -5
  64. package/dist/_chunks/{gestational-age-calculator-CMhOtFE_.js.map → gestational-age-calculator-Ch8vmJAl.js.map} +1 -1
  65. package/dist/_chunks/{hcg-doubling-DNG9Q2go.js → hcg-doubling-BT6lki_i.js} +5 -5
  66. package/dist/_chunks/{hcg-doubling-DNG9Q2go.js.map → hcg-doubling-BT6lki_i.js.map} +1 -1
  67. package/dist/_chunks/{link-cell-renderer-C8npOgmM.js → link-cell-renderer-C7GvyK66.js} +3 -3
  68. package/dist/_chunks/{link-cell-renderer-C8npOgmM.js.map → link-cell-renderer-C7GvyK66.js.map} +1 -1
  69. package/dist/_chunks/{marketplace-app-shell-BxOiy25s.js → marketplace-app-shell-BhRH7Zi4.js} +2 -2
  70. package/dist/_chunks/{marketplace-app-shell-BxOiy25s.js.map → marketplace-app-shell-BhRH7Zi4.js.map} +1 -1
  71. package/dist/_chunks/{notes-panel-BoyzMHI_.js → notes-panel-Bz83SO4-.js} +2 -2
  72. package/dist/_chunks/{notes-panel-BoyzMHI_.js.map → notes-panel-Bz83SO4-.js.map} +1 -1
  73. package/dist/_chunks/number-input-CM1q9zvH.js +414 -0
  74. package/dist/_chunks/number-input-CM1q9zvH.js.map +1 -0
  75. package/dist/_chunks/{operator-hero-DVy0RGoD.js → operator-hero-CpJkDNAM.js} +2 -2
  76. package/dist/_chunks/{operator-hero-DVy0RGoD.js.map → operator-hero-CpJkDNAM.js.map} +1 -1
  77. package/dist/_chunks/{optical-prescription-Brs0CeP3.js → optical-prescription-CQR_WJiS.js} +2 -2
  78. package/dist/_chunks/{optical-prescription-Brs0CeP3.js.map → optical-prescription-CQR_WJiS.js.map} +1 -1
  79. package/dist/_chunks/{patient-details-Bf4iTAPp.js → patient-details-CnFgF3MU.js} +3 -3
  80. package/dist/_chunks/{patient-details-Bf4iTAPp.js.map → patient-details-CnFgF3MU.js.map} +1 -1
  81. package/dist/_chunks/{patient-summary-card-dkV6a53T.js → patient-summary-card-DfbOtOV6.js} +3 -3
  82. package/dist/_chunks/{patient-summary-card-dkV6a53T.js.map → patient-summary-card-DfbOtOV6.js.map} +1 -1
  83. package/dist/_chunks/{patient-table-zifAcsjV.js → patient-table-BXzcrC79.js} +4 -4
  84. package/dist/_chunks/{patient-table-zifAcsjV.js.map → patient-table-BXzcrC79.js.map} +1 -1
  85. package/dist/_chunks/{payment-automation-upsell-CZZPGfs0.js → payment-automation-upsell-Ckh3b7Xx.js} +2 -2
  86. package/dist/_chunks/{payment-automation-upsell-CZZPGfs0.js.map → payment-automation-upsell-Ckh3b7Xx.js.map} +1 -1
  87. package/dist/_chunks/{payment-request-card-Dy7_DA-2.js → payment-request-card-Dn6-tH-D.js} +2 -2
  88. package/dist/_chunks/{payment-request-card-Dy7_DA-2.js.map → payment-request-card-Dn6-tH-D.js.map} +1 -1
  89. package/dist/_chunks/{periodontal-chart-CfFgKXWa.js → periodontal-chart-B0yko9Xm.js} +2 -2
  90. package/dist/_chunks/{periodontal-chart-CfFgKXWa.js.map → periodontal-chart-B0yko9Xm.js.map} +1 -1
  91. package/dist/_chunks/{periodontal-chart-card--6yTUsrQ.js → periodontal-chart-card-HbYTmWlo.js} +2 -2
  92. package/dist/_chunks/{periodontal-chart-card--6yTUsrQ.js.map → periodontal-chart-card-HbYTmWlo.js.map} +1 -1
  93. package/dist/_chunks/{periodontal-diagnosis-cco40xTa.js → periodontal-diagnosis-Qk4F3Wc_.js} +3 -3
  94. package/dist/_chunks/{periodontal-diagnosis-cco40xTa.js.map → periodontal-diagnosis-Qk4F3Wc_.js.map} +1 -1
  95. package/dist/_chunks/{periodontal-risk-chart-bUGkMwDg.js → periodontal-risk-chart-ByKuM4cF.js} +2 -2
  96. package/dist/_chunks/{periodontal-risk-chart-bUGkMwDg.js.map → periodontal-risk-chart-ByKuM4cF.js.map} +1 -1
  97. package/dist/_chunks/{practice-results-Mys11x9p.js → practice-results-C5exrEn0.js} +2 -2
  98. package/dist/_chunks/{practice-results-Mys11x9p.js.map → practice-results-C5exrEn0.js.map} +1 -1
  99. package/dist/_chunks/{pregnancy-dating-t3oM4ZzC.js → pregnancy-dating-4tPV_Yko.js} +6 -6
  100. package/dist/_chunks/{pregnancy-dating-t3oM4ZzC.js.map → pregnancy-dating-4tPV_Yko.js.map} +1 -1
  101. package/dist/_chunks/{pregnancy-weight-gain-Bfz7SbIw.js → pregnancy-weight-gain-BBgbWBGe.js} +5 -5
  102. package/dist/_chunks/{pregnancy-weight-gain-Bfz7SbIw.js.map → pregnancy-weight-gain-BBgbWBGe.js.map} +1 -1
  103. package/dist/_chunks/radio-group-BmIqhIT2.js +171 -0
  104. package/dist/_chunks/radio-group-BmIqhIT2.js.map +1 -0
  105. package/dist/_chunks/{radiograph-panel.agent-DyA4wsZA.js → radiograph-panel.agent-Drj0hYVV.js} +3 -3
  106. package/dist/_chunks/{radiograph-panel.agent-DyA4wsZA.js.map → radiograph-panel.agent-Drj0hYVV.js.map} +1 -1
  107. package/dist/_chunks/signature-status-chip-DlLJk1VA.js +97 -0
  108. package/dist/_chunks/signature-status-chip-DlLJk1VA.js.map +1 -0
  109. package/dist/_chunks/{tab-bar-BYESZINM.js → tab-bar-Ddp_ZbnL.js} +2 -2
  110. package/dist/_chunks/{tab-bar-BYESZINM.js.map → tab-bar-Ddp_ZbnL.js.map} +1 -1
  111. package/dist/_chunks/{tasks-panel-CoESdfZI.js → tasks-panel-T7vaKJcA.js} +2 -2
  112. package/dist/_chunks/{tasks-panel-CoESdfZI.js.map → tasks-panel-T7vaKJcA.js.map} +1 -1
  113. package/dist/_chunks/{time-picker-BPlJWm8w.js → time-picker-D0RS391l.js} +66 -63
  114. package/dist/_chunks/{time-picker-BPlJWm8w.js.map → time-picker-D0RS391l.js.map} +1 -1
  115. package/dist/_chunks/{unit-converter-lUW9Q888.js → unit-converter-Dsk__pjA.js} +3 -3
  116. package/dist/_chunks/{unit-converter-lUW9Q888.js.map → unit-converter-Dsk__pjA.js.map} +1 -1
  117. package/dist/_chunks/{widget-picker-DEmTVuFL.js → widget-picker-DqMbjQy_.js} +2 -2
  118. package/dist/_chunks/{widget-picker-DEmTVuFL.js.map → widget-picker-DqMbjQy_.js.map} +1 -1
  119. package/dist/_chunks/{workflow-map-C5PGP6cD.js → workflow-map-BNBeG2zn.js} +2 -2
  120. package/dist/_chunks/{workflow-map-C5PGP6cD.js.map → workflow-map-BNBeG2zn.js.map} +1 -1
  121. package/dist/agent-catalog.json +34 -34
  122. package/dist/agent-i18n/en.json +4 -4
  123. package/dist/components/address-fields/index.js +1 -1
  124. package/dist/components/agenda-card/index.js +1 -1
  125. package/dist/components/agenda-tray/index.js +1 -1
  126. package/dist/components/ai-consent-banner/index.js +1 -1
  127. package/dist/components/anamnesis-card/index.js +1 -1
  128. package/dist/components/anamnesis-summary-card/anamnesis-summary-card.d.ts.map +1 -1
  129. package/dist/components/anamnesis-summary-card/index.js +1 -1
  130. package/dist/components/appointment-card/index.js +2 -2
  131. package/dist/components/appointment-timeline/index.js +1 -1
  132. package/dist/components/badge/badge.d.ts +1 -0
  133. package/dist/components/badge/badge.d.ts.map +1 -1
  134. package/dist/components/badge/index.js +1 -1
  135. package/dist/components/bishop-score/index.js +1 -1
  136. package/dist/components/bmi-calculator/index.js +1 -1
  137. package/dist/components/booking/index.js +1 -1
  138. package/dist/components/care-plan-card/index.js +1 -1
  139. package/dist/components/care-plan-entry-card/index.js +1 -1
  140. package/dist/components/care-plan-header/index.js +1 -1
  141. package/dist/components/clinical-note-card/index.js +1 -1
  142. package/dist/components/connection-status/index.js +1 -1
  143. package/dist/components/contact-profile-card/index.js +1 -1
  144. package/dist/components/cycle-calculator/index.js +1 -1
  145. package/dist/components/data-table/data-table.agent.d.ts.map +1 -1
  146. package/dist/components/data-table/data-table.d.ts +19 -0
  147. package/dist/components/data-table/data-table.d.ts.map +1 -1
  148. package/dist/components/data-table/expanded-row-renderer.d.ts +47 -0
  149. package/dist/components/data-table/expanded-row-renderer.d.ts.map +1 -0
  150. package/dist/components/data-table/index.d.ts +2 -0
  151. package/dist/components/data-table/index.d.ts.map +1 -1
  152. package/dist/components/data-table/index.js +31 -27
  153. package/dist/components/date-time-picker/index.js +1 -1
  154. package/dist/components/dependent-selector/index.js +1 -1
  155. package/dist/components/document-preview/index.js +1 -1
  156. package/dist/components/due-date-calculator/index.js +2 -2
  157. package/dist/components/fetal-weight/index.js +1 -1
  158. package/dist/components/file-manager/index.js +1 -1
  159. package/dist/components/form-field/form-field.d.ts +6 -0
  160. package/dist/components/form-field/form-field.d.ts.map +1 -1
  161. package/dist/components/form-field/index.js +1 -1
  162. package/dist/components/gestational-age-calculator/index.js +1 -1
  163. package/dist/components/hcg-doubling/index.js +1 -1
  164. package/dist/components/index.d.ts +1 -0
  165. package/dist/components/index.d.ts.map +1 -1
  166. package/dist/components/notes-panel/index.js +1 -1
  167. package/dist/components/number-input/index.js +1 -1
  168. package/dist/components/number-input/number-input.d.ts +11 -0
  169. package/dist/components/number-input/number-input.d.ts.map +1 -1
  170. package/dist/components/operator-hero/index.js +1 -1
  171. package/dist/components/optical-prescription/index.js +1 -1
  172. package/dist/components/patient-details/index.js +1 -1
  173. package/dist/components/patient-summary-card/index.js +1 -1
  174. package/dist/components/patient-table/index.js +1 -1
  175. package/dist/components/payment-card/index.js +1 -1
  176. package/dist/components/periodontal-chart/index.js +1 -1
  177. package/dist/components/periodontal-chart-card/index.js +1 -1
  178. package/dist/components/periodontal-diagnosis/index.js +1 -1
  179. package/dist/components/periodontal-risk-chart/index.js +1 -1
  180. package/dist/components/practice-results/index.js +1 -1
  181. package/dist/components/pregnancy-dating/index.js +1 -1
  182. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  183. package/dist/components/radio-group/index.js +1 -1
  184. package/dist/components/radio-group/radio-group.d.ts +3 -0
  185. package/dist/components/radio-group/radio-group.d.ts.map +1 -1
  186. package/dist/components/radiograph-panel/index.js +1 -1
  187. package/dist/components/signature-status-chip/index.d.ts +3 -0
  188. package/dist/components/signature-status-chip/index.d.ts.map +1 -0
  189. package/dist/components/signature-status-chip/index.js +6 -0
  190. package/dist/components/signature-status-chip/index.js.map +1 -0
  191. package/dist/components/signature-status-chip/signature-status-chip.d.ts +29 -0
  192. package/dist/components/signature-status-chip/signature-status-chip.d.ts.map +1 -0
  193. package/dist/components/tab-bar/index.js +1 -1
  194. package/dist/components/tasks-panel/index.js +1 -1
  195. package/dist/components/time-picker/index.js +1 -1
  196. package/dist/components/time-picker/time-picker.d.ts.map +1 -1
  197. package/dist/components/unit-converter/index.js +1 -1
  198. package/dist/components/widget-picker/index.js +1 -1
  199. package/dist/components/workflow/index.js +1 -1
  200. package/dist/host-compat.css +4 -1
  201. package/dist/i18n/locales/ar.d.ts +17 -0
  202. package/dist/i18n/locales/ar.d.ts.map +1 -1
  203. package/dist/i18n/locales/ar.js +11 -0
  204. package/dist/i18n/locales/ar.js.map +1 -1
  205. package/dist/i18n/locales/de.d.ts +17 -0
  206. package/dist/i18n/locales/de.d.ts.map +1 -1
  207. package/dist/i18n/locales/de.js +11 -0
  208. package/dist/i18n/locales/de.js.map +1 -1
  209. package/dist/i18n/locales/el.d.ts +17 -0
  210. package/dist/i18n/locales/el.d.ts.map +1 -1
  211. package/dist/i18n/locales/el.js +11 -0
  212. package/dist/i18n/locales/el.js.map +1 -1
  213. package/dist/i18n/locales/en.d.ts +17 -0
  214. package/dist/i18n/locales/en.d.ts.map +1 -1
  215. package/dist/i18n/locales/en.js +11 -0
  216. package/dist/i18n/locales/en.js.map +1 -1
  217. package/dist/i18n/locales/es.d.ts +17 -0
  218. package/dist/i18n/locales/es.d.ts.map +1 -1
  219. package/dist/i18n/locales/es.js +11 -0
  220. package/dist/i18n/locales/es.js.map +1 -1
  221. package/dist/i18n/locales/fr.d.ts +17 -0
  222. package/dist/i18n/locales/fr.d.ts.map +1 -1
  223. package/dist/i18n/locales/fr.js +11 -0
  224. package/dist/i18n/locales/fr.js.map +1 -1
  225. package/dist/i18n/locales/hi.d.ts +17 -0
  226. package/dist/i18n/locales/hi.d.ts.map +1 -1
  227. package/dist/i18n/locales/hi.js +11 -0
  228. package/dist/i18n/locales/hi.js.map +1 -1
  229. package/dist/i18n/locales/it.d.ts +17 -0
  230. package/dist/i18n/locales/it.d.ts.map +1 -1
  231. package/dist/i18n/locales/it.js +11 -0
  232. package/dist/i18n/locales/it.js.map +1 -1
  233. package/dist/i18n/locales/ja.d.ts +17 -0
  234. package/dist/i18n/locales/ja.d.ts.map +1 -1
  235. package/dist/i18n/locales/ja.js +11 -0
  236. package/dist/i18n/locales/ja.js.map +1 -1
  237. package/dist/i18n/locales/nl.d.ts +17 -0
  238. package/dist/i18n/locales/nl.d.ts.map +1 -1
  239. package/dist/i18n/locales/nl.js +11 -0
  240. package/dist/i18n/locales/nl.js.map +1 -1
  241. package/dist/i18n/locales/pl.d.ts +17 -0
  242. package/dist/i18n/locales/pl.d.ts.map +1 -1
  243. package/dist/i18n/locales/pl.js +11 -0
  244. package/dist/i18n/locales/pl.js.map +1 -1
  245. package/dist/i18n/locales/pt.d.ts +17 -0
  246. package/dist/i18n/locales/pt.d.ts.map +1 -1
  247. package/dist/i18n/locales/pt.js +11 -0
  248. package/dist/i18n/locales/pt.js.map +1 -1
  249. package/dist/i18n/locales/ro.d.ts +17 -0
  250. package/dist/i18n/locales/ro.d.ts.map +1 -1
  251. package/dist/i18n/locales/ro.js +11 -0
  252. package/dist/i18n/locales/ro.js.map +1 -1
  253. package/dist/i18n/locales/ru.d.ts +17 -0
  254. package/dist/i18n/locales/ru.d.ts.map +1 -1
  255. package/dist/i18n/locales/ru.js +11 -0
  256. package/dist/i18n/locales/ru.js.map +1 -1
  257. package/dist/i18n/locales/sq.d.ts +17 -0
  258. package/dist/i18n/locales/sq.d.ts.map +1 -1
  259. package/dist/i18n/locales/sq.js +11 -0
  260. package/dist/i18n/locales/sq.js.map +1 -1
  261. package/dist/i18n/locales/sv.d.ts +17 -0
  262. package/dist/i18n/locales/sv.d.ts.map +1 -1
  263. package/dist/i18n/locales/sv.js +11 -0
  264. package/dist/i18n/locales/sv.js.map +1 -1
  265. package/dist/i18n/locales/tr.d.ts +17 -0
  266. package/dist/i18n/locales/tr.d.ts.map +1 -1
  267. package/dist/i18n/locales/tr.js +11 -0
  268. package/dist/i18n/locales/tr.js.map +1 -1
  269. package/dist/i18n/locales/zh.d.ts +17 -0
  270. package/dist/i18n/locales/zh.d.ts.map +1 -1
  271. package/dist/i18n/locales/zh.js +11 -0
  272. package/dist/i18n/locales/zh.js.map +1 -1
  273. package/dist/index.js +799 -792
  274. package/dist/index.js.map +1 -1
  275. package/dist/locales/ar.json +17 -0
  276. package/dist/locales/de.json +17 -0
  277. package/dist/locales/el.json +17 -0
  278. package/dist/locales/en.json +17 -0
  279. package/dist/locales/es.json +17 -0
  280. package/dist/locales/fr.json +17 -0
  281. package/dist/locales/hi.json +17 -0
  282. package/dist/locales/it.json +17 -0
  283. package/dist/locales/ja.json +17 -0
  284. package/dist/locales/nl.json +17 -0
  285. package/dist/locales/pl.json +17 -0
  286. package/dist/locales/pt.json +17 -0
  287. package/dist/locales/ro.json +17 -0
  288. package/dist/locales/ru.json +17 -0
  289. package/dist/locales/sq.json +17 -0
  290. package/dist/locales/sv.json +17 -0
  291. package/dist/locales/tr.json +17 -0
  292. package/dist/locales/zh.json +17 -0
  293. package/dist/patterns/anamnesis/anamnesis-baseline.d.ts +6 -0
  294. package/dist/patterns/anamnesis/anamnesis-baseline.d.ts.map +1 -1
  295. package/dist/patterns/anamnesis/anamnesis-compile.d.ts +4 -1
  296. package/dist/patterns/anamnesis/anamnesis-compile.d.ts.map +1 -1
  297. package/dist/patterns/anamnesis/anamnesis-evolution-grid.d.ts +8 -9
  298. package/dist/patterns/anamnesis/anamnesis-evolution-grid.d.ts.map +1 -1
  299. package/dist/patterns/anamnesis/anamnesis-evolution.d.ts +24 -12
  300. package/dist/patterns/anamnesis/anamnesis-evolution.d.ts.map +1 -1
  301. package/dist/patterns/anamnesis/anamnesis-field.d.ts.map +1 -1
  302. package/dist/patterns/anamnesis/anamnesis-i18n.d.ts.map +1 -1
  303. package/dist/patterns/anamnesis/anamnesis-intake.d.ts +5 -1
  304. package/dist/patterns/anamnesis/anamnesis-intake.d.ts.map +1 -1
  305. package/dist/patterns/anamnesis/anamnesis-questionnaire.d.ts +4 -1
  306. package/dist/patterns/anamnesis/anamnesis-questionnaire.d.ts.map +1 -1
  307. package/dist/patterns/anamnesis/anamnesis-readonly.d.ts +4 -1
  308. package/dist/patterns/anamnesis/anamnesis-readonly.d.ts.map +1 -1
  309. package/dist/patterns/anamnesis/anamnesis-source-blocks.d.ts +29 -0
  310. package/dist/patterns/anamnesis/anamnesis-source-blocks.d.ts.map +1 -0
  311. package/dist/patterns/anamnesis/anamnesis-window.d.ts +3 -5
  312. package/dist/patterns/anamnesis/anamnesis-window.d.ts.map +1 -1
  313. package/dist/patterns/anamnesis/anamnesis.d.ts +4 -1
  314. package/dist/patterns/anamnesis/anamnesis.d.ts.map +1 -1
  315. package/dist/patterns/anamnesis/index.js +1 -1
  316. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  317. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  318. package/dist/tokens.css +5 -2
  319. package/package.json +5 -1
  320. package/dist/_chunks/actions-cell-renderer-C67oj7mR.js +0 -1581
  321. package/dist/_chunks/actions-cell-renderer-C67oj7mR.js.map +0 -1
  322. package/dist/_chunks/anamnesis-summary-card-CpQViN5l.js +0 -392
  323. package/dist/_chunks/anamnesis-summary-card-CpQViN5l.js.map +0 -1
  324. package/dist/_chunks/anamnesis-summary-rows-Dw3l6nOD.js.map +0 -1
  325. package/dist/_chunks/form-field-M5UpX65Z.js +0 -123
  326. package/dist/_chunks/form-field-M5UpX65Z.js.map +0 -1
  327. package/dist/_chunks/number-input-DOe5VYei.js +0 -370
  328. package/dist/_chunks/number-input-DOe5VYei.js.map +0 -1
  329. package/dist/_chunks/radio-group-CI-6SmSw.js +0 -167
  330. package/dist/_chunks/radio-group-CI-6SmSw.js.map +0 -1
  331. package/dist/patterns/anamnesis/anamnesis-compare-panel.d.ts +0 -89
  332. package/dist/patterns/anamnesis/anamnesis-compare-panel.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"document-preview-DuMzmupZ.js","sources":["../../node_modules/lucide-react/dist/esm/icons/files.mjs","../../src/components/document-preview/document-preview.agent.ts","../../src/components/document-preview/document-preview.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8\", key: \"14sh0y\" }],\n [\n \"path\",\n {\n d: \"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z\",\n key: \"1970lx\"\n }\n ],\n [\"path\", { d: \"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1\", key: \"l4dndm\" }]\n];\nconst Files = createLucideIcon(\"files\", __iconNode);\n\nexport { __iconNode, Files as default };\n//# sourceMappingURL=files.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentPreview. */\n/* */\n/* A passive, read-only viewer, so it declares no interactive */\n/* capabilities. The always-on state slot carries only the structural */\n/* render `kind` (pdf / image / metadata / empty) — never the document */\n/* name. */\n/* */\n/* PHI rule (PRS §26 §7): the document display name can identify a */\n/* patient (e.g. \"Rossi Maria — referto 2026.pdf\"). It renders as text */\n/* (fine) but the only name-returning read is the deliberate get_name */\n/* action with `safety: 'phi'`, so the host gates it behind confirm + */\n/* audit. No name is ever emitted in a data-* hook. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentPreviewHandle } from './document-preview';\n\nexport const documentPreviewAgent: AgentAdapter<DocumentPreviewHandle> = {\n id: 'document-preview',\n capabilities: [],\n state: {\n kind: {\n type: \"'pdf' | 'image' | 'metadata' | 'empty'\",\n descriptionKey: 'ui.agent.documentPreview.state.kind',\n description:\n 'Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.',\n read: (handle) => handle.getKind(),\n },\n },\n actions: {\n get_name: {\n // phi (not read): resolves the document display name, which can identify\n // patients. PRS §26 — phi outranks read so the host gates it behind\n // stricter confirm + audit. The always-on kind slot stays name-free.\n safety: 'phi',\n returns: 'string | undefined',\n returnsSchema: { type: ['string', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.documentPreview.actions.getName',\n description:\n 'Read the display name of the previewed document. May identify a patient (PHI).',\n invoke: (handle) => handle.getName(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-preview',\n description: 'Marks the DocumentPreview region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* DocumentPreview — a standalone, reusable document viewer. */\n/* */\n/* Decoupled from FileManager: it takes primitive props (name, mimeType, */\n/* src, metadata) rather than a FileManagerItem, so signing, the patient */\n/* portal, and the Control Room rail can all reuse it. The body is an */\n/* elevated Card: a bounded preview viewport (PDF → kit PDFViewer; */\n/* image/* → <img>; otherwise a MIME-icon placeholder) above an always-on */\n/* Details block (badges + every structural field the host supplies), so */\n/* the metadata is never dropped when a real preview renders. No name → */\n/* EmptyState. */\n/* */\n/* Title lives in the canonical PanelHeader (the same header every rail */\n/* panel adopts) so the Control Room rail can inject its pin / close */\n/* controls into it. Pass `documents` (≥ 2) to preview a SELECTION as */\n/* tabs — one tab per document, the active one shown below; a single */\n/* entry (or the single-document props) renders without a tab strip. */\n/* */\n/* The root is a `<section>` (region landmark) so the PanelHeader's */\n/* <header> is scoped and never exposed as a page banner — the same */\n/* shape RadiographPanel uses. It is also a keyboard-focusable scroll */\n/* region (tabIndex 0 + labelled focus ring). */\n/* */\n/* PHI: the visible name renders as text (fine), but the only */\n/* name-returning handle read is surfaced by document-preview.agent.ts */\n/* as a `safety: 'phi'` action — never in always-on state, never in a */\n/* data-* hook. In tabbed mode the handle reflects the ACTIVE tab. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n Fragment,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n File as FileIcon,\n FileImage,\n FileText,\n Files,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { EmptyState } from '../empty-state';\nimport { PanelHeader } from '../panel-header';\nimport { PDFViewer } from '../pdf-viewer';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../tabs';\nimport { useAgentRegistration } from '../../agent';\nimport { documentPreviewAgent } from './document-preview.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentPreviewSignatureStatus = 'none' | 'pending' | 'signed';\n\n/** Which render branch DocumentPreview is showing — structural, never PHI. */\nexport type DocumentPreviewKind = 'pdf' | 'image' | 'metadata' | 'empty';\n\nexport interface DocumentPreviewMetadata {\n /** Size in bytes. */\n size?: number;\n /** Display name of whoever created the document (host-supplied). */\n createdBy?: string;\n /** ISO 8601 timestamp the document was created. */\n createdAt?: string;\n /** ISO 8601 timestamp of the last modification. */\n updatedAt?: string;\n /** ISO 8601 timestamp a signature was requested from the patient. */\n signatureRequestedAt?: string;\n /** ISO 8601 timestamp the document was signed. */\n signedAt?: string;\n /** ISO 8601 timestamp the document was shared with the patient. */\n sharedAt?: string;\n /** Open document-type category (non-identifying), e.g. `'xray'`. */\n documentType?: string;\n /** Signature workflow state. */\n signatureStatus?: DocumentPreviewSignatureStatus;\n /** Clinical-document flag (host-defined semantics). */\n clinical?: boolean;\n /** ISO 8601 expiry (e.g. identification documents). */\n expiresAt?: string;\n}\n\n/**\n * A single previewable document. In multi-document mode each becomes a tab;\n * `id` is the tab value (never a patient name) and `name` is the tab label.\n */\nexport interface DocumentPreviewDocument {\n /** Stable, non-identifying id. Emitted as the tab value — never PHI. */\n id: string;\n /** Display name (PHI). Also the tab label in multi-document mode. */\n name: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n}\n\nexport interface DocumentPreviewProps extends VariantProps<\n typeof documentPreviewVariants\n> {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Display name. Absent (and no `documents`) → empty state. PHI. */\n name?: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. The host owns auth. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n /**\n * Multiple documents to preview as tabs — e.g. a multi-row selection. Two\n * or more render a tab per document (label = name) with the active one\n * shown below; a single entry renders without a tab strip. When non-empty\n * this takes precedence over the single-document props. Names are PHI.\n */\n documents?: DocumentPreviewDocument[];\n className?: string;\n}\n\nexport interface DocumentPreviewHandle {\n /** Which render branch is active — structural, safe for always-on reads. */\n getKind: () => DocumentPreviewKind;\n /** The active document's display name (PHI). Surfaced by the adapter as a `phi` action. */\n getName: () => string | undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst documentPreviewVariants = cva(\n [\n 'ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring',\n ].join(' '),\n);\n\nconst SIGNATURE_VARIANT: Record<\n Exclude<DocumentPreviewSignatureStatus, 'none'>,\n 'success' | 'warning'\n> = {\n signed: 'success',\n pending: 'warning',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction resolveKind(\n name: string | undefined,\n mimeType: string | undefined,\n src: string | undefined,\n): DocumentPreviewKind {\n if (!name) return 'empty';\n const mime = mimeType ?? '';\n if (mime === 'application/pdf' && src) return 'pdf';\n if (mime.startsWith('image/') && src) return 'image';\n return 'metadata';\n}\n\n/** Fallback icon for the header / metadata card — a small MIME-family lookup. */\nfunction iconForMime(mimeType: string | undefined): LucideIcon {\n const mime = mimeType ?? '';\n if (mime.startsWith('image/')) return FileImage;\n if (\n mime === 'application/pdf' ||\n mime.startsWith('text/') ||\n mime.includes('word')\n ) {\n return FileText;\n }\n return FileIcon;\n}\n\nconst UNIT_KEYS = [\n 'documentPreview.units.bytes',\n 'documentPreview.units.kilobytes',\n 'documentPreview.units.megabytes',\n 'documentPreview.units.gigabytes',\n] as const;\n\nconst UNIT_FALLBACKS = ['B', 'KB', 'MB', 'GB'] as const;\n\nfunction formatBytes(\n bytes: number,\n locale: string,\n t: (key: string, fallback: string) => string,\n): string {\n let value = bytes;\n let unitIndex = 0;\n while (value >= 1024 && unitIndex < UNIT_FALLBACKS.length - 1) {\n value /= 1024;\n unitIndex++;\n }\n const formatted = new Intl.NumberFormat(locale, {\n maximumFractionDigits: unitIndex === 0 ? 0 : 1,\n }).format(value);\n return `${formatted} ${t(UNIT_KEYS[unitIndex], UNIT_FALLBACKS[unitIndex])}`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const DocumentPreview = forwardRef<\n DocumentPreviewHandle,\n DocumentPreviewProps\n>(({ id, name, mimeType, src, metadata, documents, className }, ref) => {\n const { t, i18n } = useTranslation();\n\n // Resolve the document list: an explicit `documents` list wins; otherwise\n // the single-document props form a one-item list; nothing → empty. The\n // synthetic single-doc id is never emitted as a tab value (a lone doc\n // renders without a tab strip), so falling back to the name is PHI-safe.\n const docs = useMemo<DocumentPreviewDocument[]>(() => {\n if (documents && documents.length > 0) return documents;\n if (name) return [{ id: id ?? name, name, mimeType, src, metadata }];\n return [];\n }, [documents, id, name, mimeType, src, metadata]);\n\n const isTabbed = docs.length > 1;\n\n // Active tab (multi mode). When the current id is stale after the selection\n // changes we fall back to the first document — no reconciling effect needed.\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n const activeDoc = docs.find((doc) => doc.id === activeId) ?? docs[0];\n\n const handle = useMemo<DocumentPreviewHandle>(\n () => ({\n getKind: () =>\n activeDoc\n ? resolveKind(activeDoc.name, activeDoc.mimeType, activeDoc.src)\n : 'empty',\n getName: () => activeDoc?.name,\n }),\n [activeDoc],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(documentPreviewAgent, handle, id);\n\n /* The per-document body — an elevated Card with a bounded preview viewport\n (pdf / image / placeholder) above an always-on Details block. The title is\n NOT rendered here (the PanelHeader owns it, or the tab label in multi mode). */\n const renderBody = (doc: DocumentPreviewDocument): ReactNode => {\n const kind = resolveKind(doc.name, doc.mimeType, doc.src);\n const meta = doc.metadata;\n const PlaceholderIcon = iconForMime(doc.mimeType);\n\n // Preview viewport — the rendered document, or a MIME-icon placeholder when\n // no source resolves. Bounded to a consistent aspect so the Details below\n // stay reachable in the rail.\n let viewport: ReactNode;\n if (kind === 'pdf' && doc.src) {\n viewport = (\n <PDFViewer\n src={doc.src}\n toolbarVariant=\"minimal\"\n // Name the embedded viewer after the document so it stays distinct\n // from the surrounding \"Document preview\" region (nested landmarks\n // must not share an accessible name). Mirrors visible header text.\n ariaLabel={doc.name}\n className=\"ds:h-full ds:w-full\"\n />\n );\n } else if (kind === 'image' && doc.src) {\n viewport = (\n <img\n src={doc.src}\n alt={t('documentPreview.imageAlt', 'Preview of {{name}}', {\n name: doc.name,\n })}\n className=\"ds:max-h-full ds:max-w-full ds:object-contain\"\n />\n );\n } else {\n viewport = (\n <span className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground\">\n <PlaceholderIcon aria-hidden=\"true\" className=\"ds:size-10\" />\n <span className=\"type-body-sm\">\n {t('documentPreview.noPreview', 'No preview available.')}\n </span>\n </span>\n );\n }\n\n // Badges: type / clinical / signature status.\n const status = meta?.signatureStatus;\n const hasBadges =\n Boolean(meta?.documentType) ||\n Boolean(meta?.clinical) ||\n (status !== undefined && status !== 'none');\n\n // Detail rows — every structural field the host supplies, so nothing is\n // dropped when a real preview renders. Only present fields render a row.\n const fmtDate = (iso: string): string =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n new Date(iso),\n );\n const rows: Array<{ key: string; label: string; value: string }> = [];\n if (meta?.createdBy)\n rows.push({\n key: 'createdBy',\n label: t('documentPreview.fields.createdBy', 'Created by'),\n value: meta.createdBy,\n });\n if (meta?.createdAt)\n rows.push({\n key: 'created',\n label: t('documentPreview.fields.created', 'Created'),\n value: fmtDate(meta.createdAt),\n });\n if (meta?.updatedAt)\n rows.push({\n key: 'modified',\n label: t('documentPreview.fields.modified', 'Modified'),\n value: fmtDate(meta.updatedAt),\n });\n if (meta?.signatureRequestedAt)\n rows.push({\n key: 'signatureRequested',\n label: t(\n 'documentPreview.fields.signatureRequested',\n 'Signature requested',\n ),\n value: fmtDate(meta.signatureRequestedAt),\n });\n if (meta?.signedAt)\n rows.push({\n key: 'signed',\n label: t('documentPreview.fields.signed', 'Signed'),\n value: fmtDate(meta.signedAt),\n });\n if (meta?.sharedAt)\n rows.push({\n key: 'sharedWithPatient',\n label: t(\n 'documentPreview.fields.sharedWithPatient',\n 'Shared with patient',\n ),\n value: fmtDate(meta.sharedAt),\n });\n if (meta?.size !== undefined)\n rows.push({\n key: 'size',\n label: t('documentPreview.fields.size', 'Size'),\n value: formatBytes(meta.size, i18n.language, t),\n });\n if (meta?.expiresAt)\n rows.push({\n key: 'expires',\n label: t('documentPreview.fields.expires', 'Expires'),\n value: fmtDate(meta.expiresAt),\n });\n\n const hasDetails = hasBadges || rows.length > 0;\n\n return (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <Card\n variant=\"elevated\"\n className=\"ds:flex ds:flex-col ds:overflow-hidden\"\n >\n <div className=\"ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted\">\n {viewport}\n </div>\n {hasDetails && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-eyebrow ds:m-0 ds:text-muted-foreground\">\n {t('documentPreview.detailsTitle', 'Details')}\n </h3>\n {hasBadges && (\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {meta?.documentType && (\n <Badge variant=\"neutral\" size=\"sm\">\n {meta.documentType}\n </Badge>\n )}\n {meta?.clinical && (\n <Badge variant=\"info\" size=\"sm\">\n {t('documentPreview.clinical', 'Clinical')}\n </Badge>\n )}\n {status && status !== 'none' && (\n <Badge\n variant={SIGNATURE_VARIANT[status]}\n size=\"sm\"\n withDot\n >\n {t(`documentPreview.signature.${status}`, status)}\n </Badge>\n )}\n </span>\n )}\n {rows.length > 0 && (\n <dl className=\"ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm\">\n {rows.map((row) => (\n <Fragment key={row.key}>\n <dt className=\"ds:text-muted-foreground\">{row.label}</dt>\n <dd className=\"ds:m-0\">{row.value}</dd>\n </Fragment>\n ))}\n </dl>\n )}\n </Card.Body>\n )}\n </Card>\n </div>\n );\n };\n\n // Header: a MIME icon + the document name for a single doc; a Files glyph +\n // a count badge (RadiographPanel's title-plus-badge shape) when tabbed.\n const HeaderMimeIcon = iconForMime(activeDoc?.mimeType);\n const headerIcon = isTabbed ? (\n <Files aria-hidden=\"true\" />\n ) : (\n <HeaderMimeIcon aria-hidden=\"true\" />\n );\n const headerTitle: ReactNode = isTabbed ? (\n <>\n {t('documentPreview.multiTitle', 'Documents')}\n <Badge variant=\"neutral\" size=\"sm\">\n {docs.length}\n </Badge>\n </>\n ) : (\n activeDoc?.name\n );\n\n let content: ReactNode;\n if (docs.length === 0) {\n content = (\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={t('documentPreview.emptyTitle', 'No document selected')}\n description={t(\n 'documentPreview.emptyDescription',\n 'Select a document to preview it here.',\n )}\n />\n );\n } else if (isTabbed) {\n content = (\n <Tabs\n value={activeDoc?.id ?? ''}\n onValueChange={setActiveId}\n variant=\"underlined\"\n size=\"sm\"\n // Each tab shows its full file name when there's room and shrinks with\n // an ellipsis only when the tabs would otherwise overflow the width\n // (`min-inline-size:0` lets a tab shrink below its content; the label\n // truncates). The full name stays the accessible name and shows in the\n // body, so nothing is lost.\n className=\"ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]\"\n >\n <TabsList\n aria-label={t('documentPreview.tabsLabel', 'Selected documents')}\n className=\"ds:gap-[var(--spacing-sm)]\"\n >\n {docs.map((doc) => {\n const TabIcon = iconForMime(doc.mimeType);\n return (\n <TabsTrigger\n key={doc.id}\n value={doc.id}\n // Match the header glyph: same 16px size (never larger) and the\n // accent tint that marks a file across the grid and the rail.\n icon={\n <TabIcon\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n }\n className=\"ds:[min-inline-size:0]\"\n >\n <span className=\"ds:block ds:truncate ds:[min-inline-size:0]\">\n {doc.name}\n </span>\n </TabsTrigger>\n );\n })}\n </TabsList>\n {docs.map((doc) => (\n <TabsContent\n key={doc.id}\n value={doc.id}\n className=\"ds:min-h-0 ds:flex-1\"\n >\n {renderBody(doc)}\n </TabsContent>\n ))}\n </Tabs>\n );\n } else {\n content = renderBody(activeDoc);\n }\n\n return (\n <section\n data-component=\"document-preview\"\n data-component-id={id}\n // The preview body scrolls (PDF pages, tall images, long metadata), so\n // the region needs a keyboard tab stop (axe scrollable-region-focusable).\n // A labelled <section> is a region landmark, which also scopes the\n // PanelHeader's <header> so it is never exposed as a page banner.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region (see comment above)\n tabIndex={0}\n aria-label={t('documentPreview.regionLabel', 'Document preview')}\n className={documentPreviewVariants({ className })}\n >\n {docs.length > 0 && (\n <PanelHeader sticky icon={headerIcon} title={headerTitle} />\n )}\n {content}\n </section>\n );\n});\n\nDocumentPreview.displayName = 'DocumentPreview';\n"],"names":["__iconNode","Files","createLucideIcon","documentPreviewAgent","handle","documentPreviewVariants","cva","SIGNATURE_VARIANT","resolveKind","name","mimeType","src","mime","iconForMime","FileImage","FileText","FileIcon","UNIT_KEYS","UNIT_FALLBACKS","formatBytes","bytes","locale","t","value","unitIndex","DocumentPreview","forwardRef","id","metadata","documents","className","ref","i18n","useTranslation","docs","useMemo","isTabbed","activeId","setActiveId","useState","activeDoc","doc","useImperativeHandle","useAgentRegistration","renderBody","kind","meta","PlaceholderIcon","viewport","jsx","PDFViewer","jsxs","status","hasBadges","fmtDate","iso","rows","hasDetails","Card","Badge","row","Fragment","HeaderMimeIcon","headerIcon","headerTitle","content","EmptyState","Tabs","TabsList","TabIcon","TabsTrigger","TabsContent","PanelHeader"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,6DAA6D,KAAK,SAAQ,CAAE;AAAA,EAC1F;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,2DAA2D,KAAK,SAAQ,CAAE;AAC1F,GACMC,KAAQC,GAAiB,SAASF,EAAU,GCFrCG,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACnC;AAAA,EAEF,SAAS;AAAA,IACP,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,eAAe,EAAE,MAAM,CAAC,UAAU,MAAM,EAAA;AAAA,MACxC,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,QAAQ,CAACA,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACrC;AAAA,EAEF,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GCmFMC,KAA0BC;AAAA,EAC9B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA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AE/C,UAAA;AAAA,QAAAI,EAAK,SAAS,KACb,gBAAAe,EAACuB,GAAA,EAAY,QAAM,IAAC,MAAMT,GAAY,OAAOC,EAAA,CAAa;AAAA,QAE3DC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDxC,GAAgB,cAAc;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"document-preview-Di15VrpQ.js","sources":["../../node_modules/lucide-react/dist/esm/icons/files.mjs","../../src/components/document-preview/document-preview.agent.ts","../../src/components/document-preview/document-preview.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8\", key: \"14sh0y\" }],\n [\n \"path\",\n {\n d: \"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z\",\n key: \"1970lx\"\n }\n ],\n [\"path\", { d: \"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1\", key: \"l4dndm\" }]\n];\nconst Files = createLucideIcon(\"files\", __iconNode);\n\nexport { __iconNode, Files as default };\n//# sourceMappingURL=files.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentPreview. */\n/* */\n/* A passive, read-only viewer, so it declares no interactive */\n/* capabilities. The always-on state slot carries only the structural */\n/* render `kind` (pdf / image / metadata / empty) — never the document */\n/* name. */\n/* */\n/* PHI rule (PRS §26 §7): the document display name can identify a */\n/* patient (e.g. \"Rossi Maria — referto 2026.pdf\"). It renders as text */\n/* (fine) but the only name-returning read is the deliberate get_name */\n/* action with `safety: 'phi'`, so the host gates it behind confirm + */\n/* audit. No name is ever emitted in a data-* hook. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentPreviewHandle } from './document-preview';\n\nexport const documentPreviewAgent: AgentAdapter<DocumentPreviewHandle> = {\n id: 'document-preview',\n capabilities: [],\n state: {\n kind: {\n type: \"'pdf' | 'image' | 'metadata' | 'empty'\",\n descriptionKey: 'ui.agent.documentPreview.state.kind',\n description:\n 'Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.',\n read: (handle) => handle.getKind(),\n },\n },\n actions: {\n get_name: {\n // phi (not read): resolves the document display name, which can identify\n // patients. PRS §26 — phi outranks read so the host gates it behind\n // stricter confirm + audit. The always-on kind slot stays name-free.\n safety: 'phi',\n returns: 'string | undefined',\n returnsSchema: { type: ['string', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.documentPreview.actions.getName',\n description:\n 'Read the display name of the previewed document. May identify a patient (PHI).',\n invoke: (handle) => handle.getName(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-preview',\n description: 'Marks the DocumentPreview region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* DocumentPreview — a standalone, reusable document viewer. */\n/* */\n/* Decoupled from FileManager: it takes primitive props (name, mimeType, */\n/* src, metadata) rather than a FileManagerItem, so signing, the patient */\n/* portal, and the Control Room rail can all reuse it. The body is an */\n/* elevated Card: a bounded preview viewport (PDF → kit PDFViewer; */\n/* image/* → <img>; otherwise a MIME-icon placeholder) above an always-on */\n/* Details block (badges + every structural field the host supplies), so */\n/* the metadata is never dropped when a real preview renders. No name → */\n/* EmptyState. */\n/* */\n/* Title lives in the canonical PanelHeader (the same header every rail */\n/* panel adopts) so the Control Room rail can inject its pin / close */\n/* controls into it. Pass `documents` (≥ 2) to preview a SELECTION as */\n/* tabs — one tab per document, the active one shown below; a single */\n/* entry (or the single-document props) renders without a tab strip. */\n/* */\n/* The root is a `<section>` (region landmark) so the PanelHeader's */\n/* <header> is scoped and never exposed as a page banner — the same */\n/* shape RadiographPanel uses. It is also a keyboard-focusable scroll */\n/* region (tabIndex 0 + labelled focus ring). */\n/* */\n/* PHI: the visible name renders as text (fine), but the only */\n/* name-returning handle read is surfaced by document-preview.agent.ts */\n/* as a `safety: 'phi'` action — never in always-on state, never in a */\n/* data-* hook. In tabbed mode the handle reflects the ACTIVE tab. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n Fragment,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n File as FileIcon,\n FileImage,\n FileText,\n Files,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { EmptyState } from '../empty-state';\nimport { PanelHeader } from '../panel-header';\nimport { PDFViewer } from '../pdf-viewer';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../tabs';\nimport { useAgentRegistration } from '../../agent';\nimport { documentPreviewAgent } from './document-preview.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentPreviewSignatureStatus = 'none' | 'pending' | 'signed';\n\n/** Which render branch DocumentPreview is showing — structural, never PHI. */\nexport type DocumentPreviewKind = 'pdf' | 'image' | 'metadata' | 'empty';\n\nexport interface DocumentPreviewMetadata {\n /** Size in bytes. */\n size?: number;\n /** Display name of whoever created the document (host-supplied). */\n createdBy?: string;\n /** ISO 8601 timestamp the document was created. */\n createdAt?: string;\n /** ISO 8601 timestamp of the last modification. */\n updatedAt?: string;\n /** ISO 8601 timestamp a signature was requested from the patient. */\n signatureRequestedAt?: string;\n /** ISO 8601 timestamp the document was signed. */\n signedAt?: string;\n /** ISO 8601 timestamp the document was shared with the patient. */\n sharedAt?: string;\n /** Open document-type category (non-identifying), e.g. `'xray'`. */\n documentType?: string;\n /** Signature workflow state. */\n signatureStatus?: DocumentPreviewSignatureStatus;\n /** Clinical-document flag (host-defined semantics). */\n clinical?: boolean;\n /** ISO 8601 expiry (e.g. identification documents). */\n expiresAt?: string;\n}\n\n/**\n * A single previewable document. In multi-document mode each becomes a tab;\n * `id` is the tab value (never a patient name) and `name` is the tab label.\n */\nexport interface DocumentPreviewDocument {\n /** Stable, non-identifying id. Emitted as the tab value — never PHI. */\n id: string;\n /** Display name (PHI). Also the tab label in multi-document mode. */\n name: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n}\n\nexport interface DocumentPreviewProps extends VariantProps<\n typeof documentPreviewVariants\n> {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Display name. Absent (and no `documents`) → empty state. PHI. */\n name?: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. The host owns auth. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n /**\n * Multiple documents to preview as tabs — e.g. a multi-row selection. Two\n * or more render a tab per document (label = name) with the active one\n * shown below; a single entry renders without a tab strip. When non-empty\n * this takes precedence over the single-document props. Names are PHI.\n */\n documents?: DocumentPreviewDocument[];\n className?: string;\n}\n\nexport interface DocumentPreviewHandle {\n /** Which render branch is active — structural, safe for always-on reads. */\n getKind: () => DocumentPreviewKind;\n /** The active document's display name (PHI). Surfaced by the adapter as a `phi` action. */\n getName: () => string | undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst documentPreviewVariants = cva(\n [\n 'ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring',\n ].join(' '),\n);\n\nconst SIGNATURE_VARIANT: Record<\n Exclude<DocumentPreviewSignatureStatus, 'none'>,\n 'success' | 'warning'\n> = {\n signed: 'success',\n pending: 'warning',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction resolveKind(\n name: string | undefined,\n mimeType: string | undefined,\n src: string | undefined,\n): DocumentPreviewKind {\n if (!name) return 'empty';\n const mime = mimeType ?? '';\n if (mime === 'application/pdf' && src) return 'pdf';\n if (mime.startsWith('image/') && src) return 'image';\n return 'metadata';\n}\n\n/** Fallback icon for the header / metadata card — a small MIME-family lookup. */\nfunction iconForMime(mimeType: string | undefined): LucideIcon {\n const mime = mimeType ?? '';\n if (mime.startsWith('image/')) return FileImage;\n if (\n mime === 'application/pdf' ||\n mime.startsWith('text/') ||\n mime.includes('word')\n ) {\n return FileText;\n }\n return FileIcon;\n}\n\nconst UNIT_KEYS = [\n 'documentPreview.units.bytes',\n 'documentPreview.units.kilobytes',\n 'documentPreview.units.megabytes',\n 'documentPreview.units.gigabytes',\n] as const;\n\nconst UNIT_FALLBACKS = ['B', 'KB', 'MB', 'GB'] as const;\n\nfunction formatBytes(\n bytes: number,\n locale: string,\n t: (key: string, fallback: string) => string,\n): string {\n let value = bytes;\n let unitIndex = 0;\n while (value >= 1024 && unitIndex < UNIT_FALLBACKS.length - 1) {\n value /= 1024;\n unitIndex++;\n }\n const formatted = new Intl.NumberFormat(locale, {\n maximumFractionDigits: unitIndex === 0 ? 0 : 1,\n }).format(value);\n return `${formatted} ${t(UNIT_KEYS[unitIndex], UNIT_FALLBACKS[unitIndex])}`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const DocumentPreview = forwardRef<\n DocumentPreviewHandle,\n DocumentPreviewProps\n>(({ id, name, mimeType, src, metadata, documents, className }, ref) => {\n const { t, i18n } = useTranslation();\n\n // Resolve the document list: an explicit `documents` list wins; otherwise\n // the single-document props form a one-item list; nothing → empty. The\n // synthetic single-doc id is never emitted as a tab value (a lone doc\n // renders without a tab strip), so falling back to the name is PHI-safe.\n const docs = useMemo<DocumentPreviewDocument[]>(() => {\n if (documents && documents.length > 0) return documents;\n if (name) return [{ id: id ?? name, name, mimeType, src, metadata }];\n return [];\n }, [documents, id, name, mimeType, src, metadata]);\n\n const isTabbed = docs.length > 1;\n\n // Active tab (multi mode). When the current id is stale after the selection\n // changes we fall back to the first document — no reconciling effect needed.\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n const activeDoc = docs.find((doc) => doc.id === activeId) ?? docs[0];\n\n const handle = useMemo<DocumentPreviewHandle>(\n () => ({\n getKind: () =>\n activeDoc\n ? resolveKind(activeDoc.name, activeDoc.mimeType, activeDoc.src)\n : 'empty',\n getName: () => activeDoc?.name,\n }),\n [activeDoc],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(documentPreviewAgent, handle, id);\n\n /* The per-document body — an elevated Card with a bounded preview viewport\n (pdf / image / placeholder) above an always-on Details block. The title is\n NOT rendered here (the PanelHeader owns it, or the tab label in multi mode). */\n const renderBody = (doc: DocumentPreviewDocument): ReactNode => {\n const kind = resolveKind(doc.name, doc.mimeType, doc.src);\n const meta = doc.metadata;\n const PlaceholderIcon = iconForMime(doc.mimeType);\n\n // Preview viewport — the rendered document, or a MIME-icon placeholder when\n // no source resolves. Bounded to a consistent aspect so the Details below\n // stay reachable in the rail.\n let viewport: ReactNode;\n if (kind === 'pdf' && doc.src) {\n viewport = (\n <PDFViewer\n src={doc.src}\n toolbarVariant=\"minimal\"\n // Name the embedded viewer after the document so it stays distinct\n // from the surrounding \"Document preview\" region (nested landmarks\n // must not share an accessible name). Mirrors visible header text.\n ariaLabel={doc.name}\n className=\"ds:h-full ds:w-full\"\n />\n );\n } else if (kind === 'image' && doc.src) {\n viewport = (\n <img\n src={doc.src}\n alt={t('documentPreview.imageAlt', 'Preview of {{name}}', {\n name: doc.name,\n })}\n className=\"ds:max-h-full ds:max-w-full ds:object-contain\"\n />\n );\n } else {\n viewport = (\n <span className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground\">\n <PlaceholderIcon aria-hidden=\"true\" className=\"ds:size-10\" />\n <span className=\"type-body-sm\">\n {t('documentPreview.noPreview', 'No preview available.')}\n </span>\n </span>\n );\n }\n\n // Badges: type / clinical / signature status.\n const status = meta?.signatureStatus;\n const hasBadges =\n Boolean(meta?.documentType) ||\n Boolean(meta?.clinical) ||\n (status !== undefined && status !== 'none');\n\n // Detail rows — every structural field the host supplies, so nothing is\n // dropped when a real preview renders. Only present fields render a row.\n const fmtDate = (iso: string): string =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n new Date(iso),\n );\n const rows: Array<{ key: string; label: string; value: string }> = [];\n if (meta?.createdBy)\n rows.push({\n key: 'createdBy',\n label: t('documentPreview.fields.createdBy', 'Created by'),\n value: meta.createdBy,\n });\n if (meta?.createdAt)\n rows.push({\n key: 'created',\n label: t('documentPreview.fields.created', 'Created'),\n value: fmtDate(meta.createdAt),\n });\n if (meta?.updatedAt)\n rows.push({\n key: 'modified',\n label: t('documentPreview.fields.modified', 'Modified'),\n value: fmtDate(meta.updatedAt),\n });\n if (meta?.signatureRequestedAt)\n rows.push({\n key: 'signatureRequested',\n label: t(\n 'documentPreview.fields.signatureRequested',\n 'Signature requested',\n ),\n value: fmtDate(meta.signatureRequestedAt),\n });\n if (meta?.signedAt)\n rows.push({\n key: 'signed',\n label: t('documentPreview.fields.signed', 'Signed'),\n value: fmtDate(meta.signedAt),\n });\n if (meta?.sharedAt)\n rows.push({\n key: 'sharedWithPatient',\n label: t(\n 'documentPreview.fields.sharedWithPatient',\n 'Shared with patient',\n ),\n value: fmtDate(meta.sharedAt),\n });\n if (meta?.size !== undefined)\n rows.push({\n key: 'size',\n label: t('documentPreview.fields.size', 'Size'),\n value: formatBytes(meta.size, i18n.language, t),\n });\n if (meta?.expiresAt)\n rows.push({\n key: 'expires',\n label: t('documentPreview.fields.expires', 'Expires'),\n value: fmtDate(meta.expiresAt),\n });\n\n const hasDetails = hasBadges || rows.length > 0;\n\n return (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <Card\n variant=\"elevated\"\n className=\"ds:flex ds:flex-col ds:overflow-hidden\"\n >\n <div className=\"ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted\">\n {viewport}\n </div>\n {hasDetails && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-eyebrow ds:m-0 ds:text-muted-foreground\">\n {t('documentPreview.detailsTitle', 'Details')}\n </h3>\n {hasBadges && (\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {meta?.documentType && (\n <Badge variant=\"neutral\" size=\"sm\">\n {meta.documentType}\n </Badge>\n )}\n {meta?.clinical && (\n <Badge variant=\"info\" size=\"sm\">\n {t('documentPreview.clinical', 'Clinical')}\n </Badge>\n )}\n {status && status !== 'none' && (\n <Badge\n variant={SIGNATURE_VARIANT[status]}\n size=\"sm\"\n withDot\n >\n {t(`documentPreview.signature.${status}`, status)}\n </Badge>\n )}\n </span>\n )}\n {rows.length > 0 && (\n <dl className=\"ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm\">\n {rows.map((row) => (\n <Fragment key={row.key}>\n <dt className=\"ds:text-muted-foreground\">{row.label}</dt>\n <dd className=\"ds:m-0\">{row.value}</dd>\n </Fragment>\n ))}\n </dl>\n )}\n </Card.Body>\n )}\n </Card>\n </div>\n );\n };\n\n // Header: a MIME icon + the document name for a single doc; a Files glyph +\n // a count badge (RadiographPanel's title-plus-badge shape) when tabbed.\n const HeaderMimeIcon = iconForMime(activeDoc?.mimeType);\n const headerIcon = isTabbed ? (\n <Files aria-hidden=\"true\" />\n ) : (\n <HeaderMimeIcon aria-hidden=\"true\" />\n );\n const headerTitle: ReactNode = isTabbed ? (\n <>\n {t('documentPreview.multiTitle', 'Documents')}\n <Badge variant=\"neutral\" size=\"sm\">\n {docs.length}\n </Badge>\n </>\n ) : (\n activeDoc?.name\n );\n\n let content: ReactNode;\n if (docs.length === 0) {\n content = (\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={t('documentPreview.emptyTitle', 'No document selected')}\n description={t(\n 'documentPreview.emptyDescription',\n 'Select a document to preview it here.',\n )}\n />\n );\n } else if (isTabbed) {\n content = (\n <Tabs\n value={activeDoc?.id ?? ''}\n onValueChange={setActiveId}\n variant=\"underlined\"\n size=\"sm\"\n // Each tab shows its full file name when there's room and shrinks with\n // an ellipsis only when the tabs would otherwise overflow the width\n // (`min-inline-size:0` lets a tab shrink below its content; the label\n // truncates). The full name stays the accessible name and shows in the\n // body, so nothing is lost.\n className=\"ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]\"\n >\n <TabsList\n aria-label={t('documentPreview.tabsLabel', 'Selected documents')}\n className=\"ds:gap-[var(--spacing-sm)]\"\n >\n {docs.map((doc) => {\n const TabIcon = iconForMime(doc.mimeType);\n return (\n <TabsTrigger\n key={doc.id}\n value={doc.id}\n // Match the header glyph: same 16px size (never larger) and the\n // accent tint that marks a file across the grid and the rail.\n icon={\n <TabIcon\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n }\n className=\"ds:[min-inline-size:0]\"\n >\n <span className=\"ds:block ds:truncate ds:[min-inline-size:0]\">\n {doc.name}\n </span>\n </TabsTrigger>\n );\n })}\n </TabsList>\n {docs.map((doc) => (\n <TabsContent\n key={doc.id}\n value={doc.id}\n className=\"ds:min-h-0 ds:flex-1\"\n >\n {renderBody(doc)}\n </TabsContent>\n ))}\n </Tabs>\n );\n } else {\n content = renderBody(activeDoc);\n }\n\n return (\n <section\n data-component=\"document-preview\"\n data-component-id={id}\n // The preview body scrolls (PDF pages, tall images, long metadata), so\n // the region needs a keyboard tab stop (axe scrollable-region-focusable).\n // A labelled <section> is a region landmark, which also scopes the\n // PanelHeader's <header> so it is never exposed as a page banner.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region (see comment above)\n tabIndex={0}\n aria-label={t('documentPreview.regionLabel', 'Document preview')}\n className={documentPreviewVariants({ className })}\n >\n {docs.length > 0 && (\n <PanelHeader sticky icon={headerIcon} title={headerTitle} />\n )}\n {content}\n </section>\n );\n});\n\nDocumentPreview.displayName = 'DocumentPreview';\n"],"names":["__iconNode","Files","createLucideIcon","documentPreviewAgent","handle","documentPreviewVariants","cva","SIGNATURE_VARIANT","resolveKind","name","mimeType","src","mime","iconForMime","FileImage","FileText","FileIcon","UNIT_KEYS","UNIT_FALLBACKS","formatBytes","bytes","locale","t","value","unitIndex","DocumentPreview","forwardRef","id","metadata","documents","className","ref","i18n","useTranslation","docs","useMemo","isTabbed","activeId","setActiveId","useState","activeDoc","doc","useImperativeHandle","useAgentRegistration","renderBody","kind","meta","PlaceholderIcon","viewport","jsx","PDFViewer","jsxs","status","hasBadges","fmtDate","iso","rows","hasDetails","Card","Badge","row","Fragment","HeaderMimeIcon","headerIcon","headerTitle","content","EmptyState","Tabs","TabsList","TabIcon","TabsTrigger","TabsContent","PanelHeader"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,6DAA6D,KAAK,SAAQ,CAAE;AAAA,EAC1F;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,2DAA2D,KAAK,SAAQ,CAAE;AAC1F,GACMC,KAAQC,GAAiB,SAASF,EAAU,GCFrCG,KAA4D;AAAA,EAC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E,gBAAAQ;AAAA,oBAACoB;AAAA,oBAAA;AAAA,sBACC,eAAY;AAAA,sBACZ,WAAU;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAGd,WAAU;AAAA,kBAEV,UAAA,gBAAApB,EAAC,QAAA,EAAK,WAAU,+CACb,YAAI,KAAA,CACP;AAAA,gBAAA;AAAA,gBAdKR,EAAI;AAAA,cAAA;AAAA,YAiBf,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAEFP,EAAK,IAAI,CAACO,MACT,gBAAAQ;AAAA,UAACsB;AAAA,UAAA;AAAA,YAEC,OAAO9B,EAAI;AAAA,YACX,WAAU;AAAA,YAET,YAAWA,CAAG;AAAA,UAAA;AAAA,UAJVA,EAAI;AAAA,QAAA,CAMZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAILwB,IAAUrB,EAAWJ,CAAS,GAI9B,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,kBAAe;AAAA,MACf,qBAAmBxB;AAAA,MAMnB,UAAU;AAAA,MACV,cAAYL,EAAE,+BAA+B,kBAAkB;AAAA,MAC/D,WAAWjB,GAAwB,EAAE,WAAAyB,GAAW;AAAA,MAE/C,UAAA;AAAA,QAAAI,EAAK,SAAS,KACb,gBAAAe,EAACuB,GAAA,EAAY,QAAM,IAAC,MAAMT,GAAY,OAAOC,EAAA,CAAa;AAAA,QAE3DC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDxC,GAAgB,cAAc;","x_google_ignoreList":[0]}
@@ -4,14 +4,14 @@ import { c as oe } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as ie } from "react-i18next";
5
5
  import { u as de } from "./registry-DvAUVLHh.js";
6
6
  import { R as C } from "./radio-TWf9Q-mp.js";
7
- import { R as z } from "./radio-group-CI-6SmSw.js";
8
- import { F as w } from "./form-field-M5UpX65Z.js";
7
+ import { R as z } from "./radio-group-BmIqhIT2.js";
8
+ import { F as w } from "./form-field-D1oqYisL.js";
9
9
  import { D as T } from "./date-picker-Bp64zk2p.js";
10
- import { N as Y } from "./number-input-DOe5VYei.js";
10
+ import { N as Y } from "./number-input-CM1q9zvH.js";
11
11
  import { C as U } from "./card-DPmk26CL.js";
12
- import { B as W } from "./badge-DCOqV9mI.js";
12
+ import { B as W } from "./badge-CIt-UFEx.js";
13
13
  import { I as ce } from "./insert-result-98J1QEp7.js";
14
- import { D as x, r as ue, c as me, e as pe, f as he, A as ge, h as fe, i as ye } from "./antenatal-schedule-timeline-u8TsS2QJ.js";
14
+ import { D as x, r as ue, c as me, e as pe, f as he, A as ge, h as fe, i as ye } from "./antenatal-schedule-timeline-BSLrOQ3S.js";
15
15
  import { c as J } from "./date-picker-variants-pKAJfnWr.js";
16
16
  import { p as De } from "./parseISO-fOGpHKXm.js";
17
17
  import { f as be } from "./format-4HNwNGrN.js";
@@ -568,4 +568,4 @@ Ae.displayName = "DueDateCalculator";
568
568
  export {
569
569
  Ae as D
570
570
  };
571
- //# sourceMappingURL=due-date-calculator-Do67C-Z-.js.map
571
+ //# sourceMappingURL=due-date-calculator-le1z3KpW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"due-date-calculator-Do67C-Z-.js","sources":["../../src/components/due-date-calculator/due-date-calculator.agent.ts","../../src/components/due-date-calculator/due-date-calculator.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DueDateCalculator. */\n/* */\n/* Estimates the date of delivery from one of three dating methods (LMP / */\n/* conception / IVF transfer) plus current gestational age + trimester. */\n/* The agent surface is the dating inputs plus the computed EDD / GA; the */\n/* handle is the curated `DueDateCalculatorHandle` (the public `ref` */\n/* stays the root <div>, exactly as `slider.tsx` and `bmi-calculator.tsx` */\n/* keep theirs). */\n/* */\n/* Dates cross the boundary as local-time `yyyy-MM-dd` strings, never */\n/* `Date` objects, so nothing shifts a day under JSON/UTC serialisation. */\n/* */\n/* DEPRECATED surface: this component is superseded by PregnancyDating, */\n/* which unifies dating + gestational age. Prefer the `pregnancy-dating` */\n/* adapter for new work — every action here is marked deprecated. */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural dating inputs and the dates derived from */\n/* them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DueDateCalculatorHandle } from './due-date-calculator';\n\nconst DEPRECATED = 'Superseded by the `pregnancy-dating` adapter.';\n\n/** Shared JSON Schema fragment for a local calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const dueDateCalculatorAgent: AgentAdapter<DueDateCalculatorHandle> = {\n id: 'due-date-calculator',\n // set_value → the six `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ method: string, referenceDate: string | null, cycleLength: number | null, embryoAge: 3 | 5, crlMm: number | null, scanDate: string | null, asOfDate: string }',\n descriptionKey: 'ui.agent.dueDateCalculator.state.inputs',\n description:\n 'The dating inputs as entered — method, its reference date, cycle length (LMP), embryo age (IVF), the optional CRL + scan date, and the evaluation date. Dates are `yyyy-MM-dd`. Read this to see which method a reference date will be interpreted under.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ dueDate: string, gestationalStart: string, gestationalAge: { weeks: number, days: number, totalDays: number } | null, trimester: string } | null',\n descriptionKey: 'ui.agent.dueDateCalculator.state.result',\n description:\n 'Computed estimated delivery date, the GA day-0 anchor after any CRL re-dating, the gestational age as of the evaluation date, and the trimester band. Null until a reference date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_method: {\n // Drives the same local input state a user picks; nothing is persisted\n // to a record, and the choice is reversible in the same UI.\n safety: 'write',\n argsType: \"{ method: 'lmp' | 'conception' | 'ivf' }\",\n argsSchema: {\n type: 'object',\n properties: {\n method: {\n enum: ['lmp', 'conception', 'ivf'],\n description:\n 'Which anchor to date from — last menstrual period, conception, or IVF transfer.',\n },\n },\n required: ['method'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the method was applied.',\n },\n errors: [\n 'Returns false for a method outside the three supported anchors.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setMethod',\n description:\n 'Choose which anchor the pregnancy is dated from. The reference date is kept and re-interpreted under the new method, so set the method first.',\n invoke: (handle, args: { method: 'lmp' | 'conception' | 'ivf' }) =>\n handle.setMethod(args.method),\n },\n set_reference_date: {\n safety: 'write',\n argsType: '{ date: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n oneOf: [\n { ...isoDate, description: 'Local calendar date, `yyyy-MM-dd`.' },\n { type: 'null' },\n ],\n description:\n 'The date the active method anchors on — LMP, conception, or transfer — or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: [\n 'Returns false for an unparseable date or a date in the future — the on-screen DatePicker caps at today.',\n ],\n examples: [\n {\n args: { date: '2026-01-12' },\n note: 'Under the default LMP method, a last period starting 12 January.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setReferenceDate',\n description:\n 'Set the reference date for the active method. This is the only required input — the result stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setReferenceDate(args.date),\n },\n set_cycle_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 20, maximum: 45 },\n { type: 'null' },\n ],\n description:\n 'Average cycle length in days (20–45), or null to fall back to the 28-day default.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 20–45 days — the same bounds the on-screen NumberInput enforces.',\n 'Applies but changes nothing unless the method is `lmp`, and is ignored once a CRL re-dating is confirmed.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCycleLength',\n description:\n 'LMP method only — set the average cycle length, which shifts Naegele dating off the 28-day assumption.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_embryo_age: {\n safety: 'write',\n argsType: '{ days: 3 | 5 }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n enum: [3, 5],\n description:\n 'Embryo age at transfer in days — 3 (cleavage) or 5 (blastocyst).',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false for any value other than 3 or 5.',\n 'Applies but changes nothing unless the method is `ivf`.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setEmbryoAge',\n description:\n 'IVF method only — set the embryo age at transfer, which offsets the transfer date back to a notional LMP.',\n invoke: (handle, args: { days: 3 | 5 }) => handle.setEmbryoAge(args.days),\n },\n set_crl: {\n safety: 'write',\n argsType: '{ crlMm?: number | null, scanDate?: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n crlMm: {\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description:\n 'Crown-rump length in millimetres, or null to clear it.',\n },\n scanDate: {\n oneOf: [{ ...isoDate }, { type: 'null' }],\n description:\n 'Date of the CRL scan (`yyyy-MM-dd`, not in the future), or null to clear it.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurement was applied.',\n },\n errors: [\n 'Returns false and writes nothing when the length is not positive or the scan date is unparseable or in the future — the payload applies all-or-nothing.',\n 'Re-dating only happens under the `lmp` method, and only when both the length and the scan date are set.',\n ],\n examples: [\n {\n args: { crlMm: 42, scanDate: '2026-02-20' },\n note: 'A first-trimester CRL that may re-date the pregnancy per ACOG CO 700.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCrl',\n description:\n 'LMP method only — set the first-trimester crown-rump length and its scan date. When the two disagree with the LMP beyond the ACOG threshold, the scan re-dates the pregnancy and overrides cycle length.',\n invoke: (\n handle,\n args: { crlMm?: number | null; scanDate?: string | null },\n ) => handle.setCrl(args),\n },\n set_as_of_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n ...isoDate,\n description:\n 'Date to evaluate gestational age and trimester against, `yyyy-MM-dd`. May be in the future to project forward.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: ['Returns false for an unparseable date.'],\n examples: [\n {\n args: { date: '2026-09-15' },\n note: 'Project gestational age forward to an upcoming appointment.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setAsOfDate',\n description:\n 'Set the date gestational age, trimester and the antenatal schedule are evaluated against. Defaults to today; the estimated delivery date itself does not depend on it.',\n invoke: (handle, args: { date: string }) => handle.setAsOfDate(args.date),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'due-date-calculator',\n description: 'Marks the DueDateCalculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven actions/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DueDateCalculator — estimate the date of delivery from one of three */\n/* dating methods, with current gestational age + trimester. */\n/* */\n/* - Maths lives in `./gestation` (pure, separately tested). */\n/* - Three methods: LMP (Naegele, cycle-length adjustable), conception, */\n/* and IVF transfer (Day-3 vs Day-5 embryo). */\n/* - The reference date can't be in the future, so the DatePicker caps */\n/* at today. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { dueDateCalculatorAgent } from './due-date-calculator.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\nimport { NumberInput } from '../number-input';\nimport { Card } from '../card';\nimport { Badge } from '../badge';\nimport {\n InsertButton,\n type InsertPayload,\n type InsertVariant,\n type InsertMode,\n} from '../_shared/insert-result';\nimport {\n type DueDateMethod,\n type EmbryoAge,\n type DueDateResult,\n computeDueDate,\n redateByCrl,\n DEFAULT_CYCLE_LENGTH,\n TRIMESTER_BADGE_VARIANT,\n trimesterHighlightToken,\n} from '../_shared/obstetrics';\nimport {\n computeAntenatalSchedule,\n type AntenatalScheduleOptions,\n} from '../_shared/antenatal-schedule';\nimport {\n AntenatalScheduleTimeline,\n buildScheduleInsertFields,\n} from '../_shared/antenatal-schedule-timeline';\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]', {\n variants: {\n width: { full: 'ds:w-full', auto: 'ds:inline-flex' },\n },\n defaultVariants: { width: 'full' },\n});\n\n/** Reference-date i18n key per method. */\nconst DATE_LABEL_KEY: Record<DueDateMethod, string> = {\n lmp: 'dueDateCalculator.lmpDate',\n conception: 'dueDateCalculator.conceptionDate',\n ivf: 'dueDateCalculator.transferDate',\n};\n\n/* ------------------------------------------------------------------ */\n/* Agent boundary */\n/* */\n/* Dates cross the agent boundary as local-time `yyyy-MM-dd` strings, */\n/* never `Date` objects — a Date JSON-serialises to UTC and silently */\n/* shifts the day for anyone east or west of Greenwich. */\n/* ------------------------------------------------------------------ */\n\nconst toIsoDate = (d: Date): string => format(d, 'yyyy-MM-dd');\n\nconst fromIsoDate = (iso: string): Date | null => {\n const d = parseISO(iso);\n return Number.isNaN(d.getTime()) ? null : d;\n};\n\n/** UI input bounds, mirrored by the agent handle so it can't out-type a user. */\nconst CYCLE_LENGTH_RANGE = { min: 20, max: 45 } as const;\n\n/** The dating inputs as entered. */\nexport interface DueDateInputsSnapshot {\n /** Which anchor the pregnancy is dated from. */\n method: DueDateMethod;\n /** The method's reference date (`yyyy-MM-dd`), or null when unset. */\n referenceDate: string | null;\n /** LMP only — average cycle length in days, or null for the 28-day default. */\n cycleLength: number | null;\n /** IVF only — embryo age at transfer, in days. */\n embryoAge: EmbryoAge;\n /** LMP only — crown-rump length in millimetres, or null. */\n crlMm: number | null;\n /** LMP only — date of the CRL scan (`yyyy-MM-dd`), or null. */\n scanDate: string | null;\n /** The date gestational age and trimester are evaluated against. */\n asOfDate: string;\n}\n\n/** `DueDateResult` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface DueDateSnapshot {\n /** Estimated date of delivery, `yyyy-MM-dd`. */\n dueDate: string;\n /** GA day-0 anchor (effective LMP) after any CRL re-dating, `yyyy-MM-dd`. */\n gestationalStart: string;\n /** Gestational age as of the evaluation date; null before conception. */\n gestationalAge: { weeks: number; days: number; totalDays: number } | null;\n /** Trimester band as of the evaluation date. */\n trimester: DueDateResult['trimester'];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the dating\n * inputs and the computed due date, and drives the inputs the way a user\n * would. Never exposes patient identity — only structural dates and numbers.\n * Consumed by `due-date-calculator.agent.ts`; the public `ref` stays the root\n * DOM element.\n */\nexport interface DueDateCalculatorHandle {\n /** The dating inputs as entered. */\n getInputs: () => DueDateInputsSnapshot;\n /** Computed due date, gestational age and trimester, or null until a reference date is set. */\n getResult: () => DueDateSnapshot | null;\n /** Switch the dating method. Keeps the reference date, which is re-interpreted. */\n setMethod: (method: DueDateMethod) => boolean;\n /** Set the method's reference date (`yyyy-MM-dd`, not in the future). */\n setReferenceDate: (isoDate: string | null) => boolean;\n /** LMP only — set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** IVF only — set the embryo age at transfer (3 or 5 days). */\n setEmbryoAge: (days: EmbryoAge) => boolean;\n /** LMP only — set the CRL measurement and/or its scan date for ACOG re-dating. */\n setCrl: (next: {\n crlMm?: number | null;\n scanDate?: string | null;\n }) => boolean;\n /** Set the date gestational age and trimester are evaluated against. */\n setAsOfDate: (isoDate: string) => boolean;\n}\n\nexport interface DueDateCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial dating method. Defaults to `'lmp'`. */\n defaultMethod?: DueDateMethod;\n /** Fires whenever a due date can be computed (and with `null` when it can't). */\n onResultChange?: (result: DueDateResult | null) => void;\n /** When provided, shows an \"Insert\" button that emits the result for an editor. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Which verb the result button performs. Defaults to `'insert'`.\n * Use `'copy'` in an app-shell surface (no editor to insert into) — the\n * button writes the result to the clipboard as a multi-format `ClipboardItem`.\n */\n insertVariant?: InsertVariant;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /**\n * Brand wordmark printed in the inserted/copied result-card footer.\n * Omitted → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\n */\n insertBrand?: string | false;\n /**\n * Append the antenatal exam schedule (the time-sensitive screening windows)\n * below the result, dated from the computed gestational start.\n */\n showSchedule?: boolean;\n /**\n * Passthrough options for the appended schedule (national `schedule`,\n * `plurality`, `chorionicity`, `rhNegative`, `gdmRisk`, …). `today` is\n * supplied by the component. Ignored unless `showSchedule` is set.\n */\n scheduleOptions?: Omit<AntenatalScheduleOptions, 'today'>;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\n/**\n * @deprecated Superseded by `PregnancyDating`, which unifies the due-date and\n * gestational-age calculators (any anchor → both EDD and current GA) and adds a\n * manual ±days dating adjustment. This component will be removed in a future\n * release; migrate to `PregnancyDating` (`defaultMethod=\"lmp\"`).\n */\nexport const DueDateCalculator = forwardRef<\n HTMLDivElement,\n DueDateCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n showSchedule = false,\n scheduleOptions,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DueDateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n DEFAULT_CYCLE_LENGTH,\n );\n const [embryoAge, setEmbryoAge] = useState<EmbryoAge>(5);\n // Optional first-trimester ultrasound (LMP method only) for ACOG CO700 redating.\n const [crlMm, setCrlMm] = useState<number | null>(null);\n const [scanDate, setScanDate] = useState<Date | undefined>(undefined);\n\n // Real today — caps the date inputs (LMP / ultrasound can't be in the future).\n const today = useMemo(() => new Date(), []);\n // The date GA, trimester and schedule status are evaluated against; defaults\n // to today but can be a future appointment date to project forward. (The EDD\n // itself is dating-anchored and does not depend on this.)\n const [asOfDate, setAsOfDate] = useState<Date>(() => new Date());\n\n // ACOG CO700 CRL redating — only when an LMP, a CRL and a scan date are set.\n const redating = useMemo(() => {\n if (method !== 'lmp' || !refDate || crlMm === null || !scanDate) {\n return null;\n }\n return redateByCrl({ lmp: refDate, scanDate, crlMm });\n }, [method, refDate, crlMm, scanDate]);\n\n const result = useMemo<DueDateResult | null>(() => {\n if (!refDate) return null;\n // A confirmed redating moves the effective LMP to the ultrasound's; the\n // CRL already reflects true gestation, so cycle adjustment no longer applies.\n const effectiveDate =\n method === 'lmp' && redating?.redated\n ? redating.gestationalStart\n : refDate;\n const effectiveCycle =\n method === 'lmp' && redating?.redated\n ? DEFAULT_CYCLE_LENGTH\n : (cycleLength ?? DEFAULT_CYCLE_LENGTH);\n return computeDueDate(\n {\n method,\n date: effectiveDate,\n cycleLength: effectiveCycle,\n embryoAge,\n },\n asOfDate,\n );\n }, [method, refDate, cycleLength, embryoAge, redating, asOfDate]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n });\n liveRef.current = {\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n };\n\n const agentHandle = useMemo<DueDateCalculatorHandle>(\n () => ({\n getInputs: () => {\n const live = liveRef.current;\n return {\n method: live.method,\n referenceDate: live.refDate ? toIsoDate(live.refDate) : null,\n cycleLength: live.cycleLength,\n embryoAge: live.embryoAge,\n crlMm: live.crlMm,\n scanDate: live.scanDate ? toIsoDate(live.scanDate) : null,\n asOfDate: toIsoDate(live.asOfDate),\n };\n },\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n dueDate: toIsoDate(r.dueDate),\n gestationalStart: toIsoDate(r.gestationalStart),\n gestationalAge: r.gestationalAge ? { ...r.gestationalAge } : null,\n trimester: r.trimester,\n };\n },\n setMethod: (next) => {\n if (next !== 'lmp' && next !== 'conception' && next !== 'ivf') {\n return false;\n }\n setMethod(next);\n return true;\n },\n setReferenceDate: (isoDate) => {\n if (isoDate === null) {\n setRefDate(undefined);\n return true;\n }\n const parsed = fromIsoDate(isoDate);\n // The DatePicker caps at today; the handle honours the same bound.\n if (!parsed || isAfter(parsed, new Date())) return false;\n setRefDate(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (\n days !== null &&\n !(\n Number.isFinite(days) &&\n days >= CYCLE_LENGTH_RANGE.min &&\n days <= CYCLE_LENGTH_RANGE.max\n )\n ) {\n return false;\n }\n setCycleLength(days);\n return true;\n },\n setEmbryoAge: (days) => {\n if (days !== 3 && days !== 5) return false;\n setEmbryoAge(days);\n return true;\n },\n setCrl: (next) => {\n const now = new Date();\n let parsedScan: Date | undefined;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n if ('crlMm' in next) {\n const mm = next.crlMm;\n if (\n mm !== null &&\n mm !== undefined &&\n !(Number.isFinite(mm) && mm > 0)\n ) {\n return false;\n }\n }\n if ('scanDate' in next && next.scanDate != null) {\n const d = fromIsoDate(next.scanDate);\n if (!d || isAfter(d, now)) return false;\n parsedScan = d;\n }\n if ('crlMm' in next) setCrlMm(next.crlMm ?? null);\n if ('scanDate' in next) setScanDate(parsedScan);\n return true;\n },\n setAsOfDate: (isoDate) => {\n const parsed = fromIsoDate(isoDate);\n if (!parsed) return false;\n setAsOfDate(parsed);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(dueDateCalculatorAgent, agentHandle, id);\n\n const schedule = useMemo(() => {\n if (!showSchedule || !result) return null;\n return computeAntenatalSchedule(result.gestationalStart, {\n ...scheduleOptions,\n today: asOfDate,\n });\n }, [showSchedule, result, asOfDate, scheduleOptions]);\n\n return (\n <div\n ref={ref}\n data-component=\"due-date-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('dueDateCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DueDateMethod)}\n >\n <Radio label={t('dueDateCalculator.method.lmp')} value=\"lmp\" />\n <Radio\n label={t('dueDateCalculator.method.conception')}\n value=\"conception\"\n />\n <Radio label={t('dueDateCalculator.method.ivf')} value=\"ivf\" />\n </RadioGroup>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t(DATE_LABEL_KEY[method])}>\n <DatePicker value={refDate} onChange={setRefDate} maxDate={today} />\n </FormField>\n\n {method === 'lmp' && (\n <FormField\n label={t('dueDateCalculator.cycleLength')}\n description={t('dueDateCalculator.cycleLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={CYCLE_LENGTH_RANGE.min}\n max={CYCLE_LENGTH_RANGE.max}\n value={cycleLength}\n onChange={setCycleLength}\n />\n </FormField>\n )}\n\n {method === 'ivf' && (\n <RadioGroup\n label={t('dueDateCalculator.embryoAge')}\n variant=\"horizontal\"\n value={String(embryoAge)}\n onValueChange={(next) => setEmbryoAge(Number(next) as EmbryoAge)}\n >\n <Radio label={t('dueDateCalculator.day3')} value=\"3\" />\n <Radio label={t('dueDateCalculator.day5')} value=\"5\" />\n </RadioGroup>\n )}\n </div>\n\n <FormField\n label={t('dueDateCalculator.asOfDate')}\n description={t('dueDateCalculator.asOfDateHint')}\n >\n <DatePicker value={asOfDate} onChange={(d) => d && setAsOfDate(d)} />\n </FormField>\n\n {method === 'lmp' ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={t('dueDateCalculator.crl')}\n description={t('dueDateCalculator.crlHint')}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={crlMm}\n onChange={setCrlMm}\n />\n </FormField>\n <FormField label={t('dueDateCalculator.scanDate')}>\n <DatePicker\n value={scanDate}\n onChange={setScanDate}\n maxDate={today}\n />\n </FormField>\n </div>\n {redating ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant={redating.redated ? 'warning' : 'success'}>\n {redating.redated\n ? t('dueDateCalculator.redated', {\n days: redating.discrepancyDays,\n })\n : t('dueDateCalculator.datesAgree')}\n </Badge>\n {!redating.crlInRange ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {t('dueDateCalculator.crlOutOfRange')}\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {/* Concise polite announcement when a due date resolves. */}\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('dueDateCalculator.result.dueDateLabel')}: ${dateFormatter.format(\n result.dueDate,\n )}. ${t('dueDateCalculator.result.trimesterLabel')}: ${t(\n `dueDateCalculator.trimester.${result.trimester}`,\n )}.`\n : ''}\n </p>\n\n {result ? (\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <dl className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3\">\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE_VARIANT[result.trimester]}\n size=\"lg\"\n >\n {t(`dueDateCalculator.trimester.${result.trimester}`)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.gestationLabel')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—'}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.dueDateLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {dateFormatter.format(result.dueDate)}\n </dd>\n </div>\n </dl>\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('dueDateCalculator.empty')}\n </p>\n )}\n\n {schedule ? <AntenatalScheduleTimeline events={schedule} /> : null}\n\n {/* One result-action group for the whole result — sits after both the\n due-date card and the schedule, and its payload carries the schedule\n rows when shown (no per-card buttons). */}\n {result && (insertVariant === 'copy' || onInsert) ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.dueDate'),\n icon: 'calendar-heart',\n highlight: dateFormatter.format(result.dueDate),\n // Chip tinted with the trimester's semantic token so the inserted\n // PNG carries the same clinical-stage colour as the on-screen\n // trimester badge — with the contrast-safe orange override for the\n // `--warning` third trimester.\n highlightToken: trimesterHighlightToken(result.trimester),\n brand: insertBrand,\n fields: [\n {\n // The estimated date of delivery → calendar glyph.\n icon: 'calendar',\n label: t('dueDateCalculator.result.dueDateLabel'),\n value: dateFormatter.format(result.dueDate),\n },\n {\n // Gestational age is an elapsed duration → clock glyph.\n icon: 'clock',\n label: t('dueDateCalculator.result.gestationLabel'),\n value: result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—',\n },\n {\n // Trimester is a clinical-stage classification → tag.\n icon: 'tag',\n label: t('dueDateCalculator.result.trimesterLabel'),\n value: t(`dueDateCalculator.trimester.${result.trimester}`),\n },\n // When the schedule is shown, the single Insert button carries\n // the exam windows too (no second button).\n ...(schedule\n ? buildScheduleInsertFields(schedule, t, (d) =>\n dateFormatter.format(d),\n )\n : []),\n ],\n }}\n />\n ) : null}\n </div>\n );\n },\n);\n\nDueDateCalculator.displayName = 'DueDateCalculator';\n"],"names":["DEPRECATED","isoDate","dueDateCalculatorAgent","handle","args","rootVariants","cva","DATE_LABEL_KEY","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","DueDateCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","showSchedule","scheduleOptions","id","width","className","ref","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","cycleLength","setCycleLength","DEFAULT_CYCLE_LENGTH","embryoAge","setEmbryoAge","crlMm","setCrlMm","scanDate","setScanDate","today","useMemo","asOfDate","setAsOfDate","redating","redateByCrl","result","effectiveDate","effectiveCycle","computeDueDate","dateFormatter","useEffect","liveRef","useRef","agentHandle","live","r","next","parsed","isAfter","days","now","parsedScan","mm","useAgentRegistration","schedule","computeAntenatalSchedule","jsxs","RadioGroup","jsx","Radio","FormField","DatePicker","NumberInput","Badge","Card","TRIMESTER_BADGE_VARIANT","AntenatalScheduleTimeline","InsertButton","trimesterHighlightToken","buildScheduleInsertFields"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAa,iDAGbC,IAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AACX,GAEaC,KAAgE;AAAA,EAC3E,IAAI;AAAA;AAAA,EAEJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,YAAY;AAAA;AAAA;AAAA,MAGV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM,CAAC,OAAO,cAAc,KAAK;AAAA,YACjC,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,QAAQ;AAAA,QACnB,sBAAsB;AAAA,MAAA;AAAA,MAExB,YAAY;AAAA,MACZ,YAAYH;AAAA,MACZ,SAAS;AAAA,MACT,eAAe;AAAA,QACb,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,QAAQ;AAAA,QACN;AAAA,MAAA;AAAA,MAEF,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,QAAQ,CAACG,GAAQC,MACfD,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AC9D,MACtC+C,EAAc,OAAO/C,CAAC;AAAA,kBAAA,IAExB,CAAA;AAAA,gBAAC;AAAA,cACP;AAAA,YACF;AAAA,UAAA,IAEA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAM,GAAkB,cAAc;"}
1
+ {"version":3,"file":"due-date-calculator-le1z3KpW.js","sources":["../../src/components/due-date-calculator/due-date-calculator.agent.ts","../../src/components/due-date-calculator/due-date-calculator.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DueDateCalculator. */\n/* */\n/* Estimates the date of delivery from one of three dating methods (LMP / */\n/* conception / IVF transfer) plus current gestational age + trimester. */\n/* The agent surface is the dating inputs plus the computed EDD / GA; the */\n/* handle is the curated `DueDateCalculatorHandle` (the public `ref` */\n/* stays the root <div>, exactly as `slider.tsx` and `bmi-calculator.tsx` */\n/* keep theirs). */\n/* */\n/* Dates cross the boundary as local-time `yyyy-MM-dd` strings, never */\n/* `Date` objects, so nothing shifts a day under JSON/UTC serialisation. */\n/* */\n/* DEPRECATED surface: this component is superseded by PregnancyDating, */\n/* which unifies dating + gestational age. Prefer the `pregnancy-dating` */\n/* adapter for new work — every action here is marked deprecated. */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural dating inputs and the dates derived from */\n/* them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DueDateCalculatorHandle } from './due-date-calculator';\n\nconst DEPRECATED = 'Superseded by the `pregnancy-dating` adapter.';\n\n/** Shared JSON Schema fragment for a local calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const dueDateCalculatorAgent: AgentAdapter<DueDateCalculatorHandle> = {\n id: 'due-date-calculator',\n // set_value → the six `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ method: string, referenceDate: string | null, cycleLength: number | null, embryoAge: 3 | 5, crlMm: number | null, scanDate: string | null, asOfDate: string }',\n descriptionKey: 'ui.agent.dueDateCalculator.state.inputs',\n description:\n 'The dating inputs as entered — method, its reference date, cycle length (LMP), embryo age (IVF), the optional CRL + scan date, and the evaluation date. Dates are `yyyy-MM-dd`. Read this to see which method a reference date will be interpreted under.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ dueDate: string, gestationalStart: string, gestationalAge: { weeks: number, days: number, totalDays: number } | null, trimester: string } | null',\n descriptionKey: 'ui.agent.dueDateCalculator.state.result',\n description:\n 'Computed estimated delivery date, the GA day-0 anchor after any CRL re-dating, the gestational age as of the evaluation date, and the trimester band. Null until a reference date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_method: {\n // Drives the same local input state a user picks; nothing is persisted\n // to a record, and the choice is reversible in the same UI.\n safety: 'write',\n argsType: \"{ method: 'lmp' | 'conception' | 'ivf' }\",\n argsSchema: {\n type: 'object',\n properties: {\n method: {\n enum: ['lmp', 'conception', 'ivf'],\n description:\n 'Which anchor to date from — last menstrual period, conception, or IVF transfer.',\n },\n },\n required: ['method'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the method was applied.',\n },\n errors: [\n 'Returns false for a method outside the three supported anchors.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setMethod',\n description:\n 'Choose which anchor the pregnancy is dated from. The reference date is kept and re-interpreted under the new method, so set the method first.',\n invoke: (handle, args: { method: 'lmp' | 'conception' | 'ivf' }) =>\n handle.setMethod(args.method),\n },\n set_reference_date: {\n safety: 'write',\n argsType: '{ date: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n oneOf: [\n { ...isoDate, description: 'Local calendar date, `yyyy-MM-dd`.' },\n { type: 'null' },\n ],\n description:\n 'The date the active method anchors on — LMP, conception, or transfer — or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: [\n 'Returns false for an unparseable date or a date in the future — the on-screen DatePicker caps at today.',\n ],\n examples: [\n {\n args: { date: '2026-01-12' },\n note: 'Under the default LMP method, a last period starting 12 January.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setReferenceDate',\n description:\n 'Set the reference date for the active method. This is the only required input — the result stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setReferenceDate(args.date),\n },\n set_cycle_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 20, maximum: 45 },\n { type: 'null' },\n ],\n description:\n 'Average cycle length in days (20–45), or null to fall back to the 28-day default.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 20–45 days — the same bounds the on-screen NumberInput enforces.',\n 'Applies but changes nothing unless the method is `lmp`, and is ignored once a CRL re-dating is confirmed.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCycleLength',\n description:\n 'LMP method only — set the average cycle length, which shifts Naegele dating off the 28-day assumption.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_embryo_age: {\n safety: 'write',\n argsType: '{ days: 3 | 5 }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n enum: [3, 5],\n description:\n 'Embryo age at transfer in days — 3 (cleavage) or 5 (blastocyst).',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false for any value other than 3 or 5.',\n 'Applies but changes nothing unless the method is `ivf`.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setEmbryoAge',\n description:\n 'IVF method only — set the embryo age at transfer, which offsets the transfer date back to a notional LMP.',\n invoke: (handle, args: { days: 3 | 5 }) => handle.setEmbryoAge(args.days),\n },\n set_crl: {\n safety: 'write',\n argsType: '{ crlMm?: number | null, scanDate?: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n crlMm: {\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description:\n 'Crown-rump length in millimetres, or null to clear it.',\n },\n scanDate: {\n oneOf: [{ ...isoDate }, { type: 'null' }],\n description:\n 'Date of the CRL scan (`yyyy-MM-dd`, not in the future), or null to clear it.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurement was applied.',\n },\n errors: [\n 'Returns false and writes nothing when the length is not positive or the scan date is unparseable or in the future — the payload applies all-or-nothing.',\n 'Re-dating only happens under the `lmp` method, and only when both the length and the scan date are set.',\n ],\n examples: [\n {\n args: { crlMm: 42, scanDate: '2026-02-20' },\n note: 'A first-trimester CRL that may re-date the pregnancy per ACOG CO 700.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCrl',\n description:\n 'LMP method only — set the first-trimester crown-rump length and its scan date. When the two disagree with the LMP beyond the ACOG threshold, the scan re-dates the pregnancy and overrides cycle length.',\n invoke: (\n handle,\n args: { crlMm?: number | null; scanDate?: string | null },\n ) => handle.setCrl(args),\n },\n set_as_of_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n ...isoDate,\n description:\n 'Date to evaluate gestational age and trimester against, `yyyy-MM-dd`. May be in the future to project forward.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: ['Returns false for an unparseable date.'],\n examples: [\n {\n args: { date: '2026-09-15' },\n note: 'Project gestational age forward to an upcoming appointment.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setAsOfDate',\n description:\n 'Set the date gestational age, trimester and the antenatal schedule are evaluated against. Defaults to today; the estimated delivery date itself does not depend on it.',\n invoke: (handle, args: { date: string }) => handle.setAsOfDate(args.date),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'due-date-calculator',\n description: 'Marks the DueDateCalculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven actions/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DueDateCalculator — estimate the date of delivery from one of three */\n/* dating methods, with current gestational age + trimester. */\n/* */\n/* - Maths lives in `./gestation` (pure, separately tested). */\n/* - Three methods: LMP (Naegele, cycle-length adjustable), conception, */\n/* and IVF transfer (Day-3 vs Day-5 embryo). */\n/* - The reference date can't be in the future, so the DatePicker caps */\n/* at today. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { dueDateCalculatorAgent } from './due-date-calculator.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\nimport { NumberInput } from '../number-input';\nimport { Card } from '../card';\nimport { Badge } from '../badge';\nimport {\n InsertButton,\n type InsertPayload,\n type InsertVariant,\n type InsertMode,\n} from '../_shared/insert-result';\nimport {\n type DueDateMethod,\n type EmbryoAge,\n type DueDateResult,\n computeDueDate,\n redateByCrl,\n DEFAULT_CYCLE_LENGTH,\n TRIMESTER_BADGE_VARIANT,\n trimesterHighlightToken,\n} from '../_shared/obstetrics';\nimport {\n computeAntenatalSchedule,\n type AntenatalScheduleOptions,\n} from '../_shared/antenatal-schedule';\nimport {\n AntenatalScheduleTimeline,\n buildScheduleInsertFields,\n} from '../_shared/antenatal-schedule-timeline';\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]', {\n variants: {\n width: { full: 'ds:w-full', auto: 'ds:inline-flex' },\n },\n defaultVariants: { width: 'full' },\n});\n\n/** Reference-date i18n key per method. */\nconst DATE_LABEL_KEY: Record<DueDateMethod, string> = {\n lmp: 'dueDateCalculator.lmpDate',\n conception: 'dueDateCalculator.conceptionDate',\n ivf: 'dueDateCalculator.transferDate',\n};\n\n/* ------------------------------------------------------------------ */\n/* Agent boundary */\n/* */\n/* Dates cross the agent boundary as local-time `yyyy-MM-dd` strings, */\n/* never `Date` objects — a Date JSON-serialises to UTC and silently */\n/* shifts the day for anyone east or west of Greenwich. */\n/* ------------------------------------------------------------------ */\n\nconst toIsoDate = (d: Date): string => format(d, 'yyyy-MM-dd');\n\nconst fromIsoDate = (iso: string): Date | null => {\n const d = parseISO(iso);\n return Number.isNaN(d.getTime()) ? null : d;\n};\n\n/** UI input bounds, mirrored by the agent handle so it can't out-type a user. */\nconst CYCLE_LENGTH_RANGE = { min: 20, max: 45 } as const;\n\n/** The dating inputs as entered. */\nexport interface DueDateInputsSnapshot {\n /** Which anchor the pregnancy is dated from. */\n method: DueDateMethod;\n /** The method's reference date (`yyyy-MM-dd`), or null when unset. */\n referenceDate: string | null;\n /** LMP only — average cycle length in days, or null for the 28-day default. */\n cycleLength: number | null;\n /** IVF only — embryo age at transfer, in days. */\n embryoAge: EmbryoAge;\n /** LMP only — crown-rump length in millimetres, or null. */\n crlMm: number | null;\n /** LMP only — date of the CRL scan (`yyyy-MM-dd`), or null. */\n scanDate: string | null;\n /** The date gestational age and trimester are evaluated against. */\n asOfDate: string;\n}\n\n/** `DueDateResult` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface DueDateSnapshot {\n /** Estimated date of delivery, `yyyy-MM-dd`. */\n dueDate: string;\n /** GA day-0 anchor (effective LMP) after any CRL re-dating, `yyyy-MM-dd`. */\n gestationalStart: string;\n /** Gestational age as of the evaluation date; null before conception. */\n gestationalAge: { weeks: number; days: number; totalDays: number } | null;\n /** Trimester band as of the evaluation date. */\n trimester: DueDateResult['trimester'];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the dating\n * inputs and the computed due date, and drives the inputs the way a user\n * would. Never exposes patient identity — only structural dates and numbers.\n * Consumed by `due-date-calculator.agent.ts`; the public `ref` stays the root\n * DOM element.\n */\nexport interface DueDateCalculatorHandle {\n /** The dating inputs as entered. */\n getInputs: () => DueDateInputsSnapshot;\n /** Computed due date, gestational age and trimester, or null until a reference date is set. */\n getResult: () => DueDateSnapshot | null;\n /** Switch the dating method. Keeps the reference date, which is re-interpreted. */\n setMethod: (method: DueDateMethod) => boolean;\n /** Set the method's reference date (`yyyy-MM-dd`, not in the future). */\n setReferenceDate: (isoDate: string | null) => boolean;\n /** LMP only — set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** IVF only — set the embryo age at transfer (3 or 5 days). */\n setEmbryoAge: (days: EmbryoAge) => boolean;\n /** LMP only — set the CRL measurement and/or its scan date for ACOG re-dating. */\n setCrl: (next: {\n crlMm?: number | null;\n scanDate?: string | null;\n }) => boolean;\n /** Set the date gestational age and trimester are evaluated against. */\n setAsOfDate: (isoDate: string) => boolean;\n}\n\nexport interface DueDateCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial dating method. Defaults to `'lmp'`. */\n defaultMethod?: DueDateMethod;\n /** Fires whenever a due date can be computed (and with `null` when it can't). */\n onResultChange?: (result: DueDateResult | null) => void;\n /** When provided, shows an \"Insert\" button that emits the result for an editor. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Which verb the result button performs. Defaults to `'insert'`.\n * Use `'copy'` in an app-shell surface (no editor to insert into) — the\n * button writes the result to the clipboard as a multi-format `ClipboardItem`.\n */\n insertVariant?: InsertVariant;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /**\n * Brand wordmark printed in the inserted/copied result-card footer.\n * Omitted → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\n */\n insertBrand?: string | false;\n /**\n * Append the antenatal exam schedule (the time-sensitive screening windows)\n * below the result, dated from the computed gestational start.\n */\n showSchedule?: boolean;\n /**\n * Passthrough options for the appended schedule (national `schedule`,\n * `plurality`, `chorionicity`, `rhNegative`, `gdmRisk`, …). `today` is\n * supplied by the component. Ignored unless `showSchedule` is set.\n */\n scheduleOptions?: Omit<AntenatalScheduleOptions, 'today'>;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\n/**\n * @deprecated Superseded by `PregnancyDating`, which unifies the due-date and\n * gestational-age calculators (any anchor → both EDD and current GA) and adds a\n * manual ±days dating adjustment. This component will be removed in a future\n * release; migrate to `PregnancyDating` (`defaultMethod=\"lmp\"`).\n */\nexport const DueDateCalculator = forwardRef<\n HTMLDivElement,\n DueDateCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n showSchedule = false,\n scheduleOptions,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DueDateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n DEFAULT_CYCLE_LENGTH,\n );\n const [embryoAge, setEmbryoAge] = useState<EmbryoAge>(5);\n // Optional first-trimester ultrasound (LMP method only) for ACOG CO700 redating.\n const [crlMm, setCrlMm] = useState<number | null>(null);\n const [scanDate, setScanDate] = useState<Date | undefined>(undefined);\n\n // Real today — caps the date inputs (LMP / ultrasound can't be in the future).\n const today = useMemo(() => new Date(), []);\n // The date GA, trimester and schedule status are evaluated against; defaults\n // to today but can be a future appointment date to project forward. (The EDD\n // itself is dating-anchored and does not depend on this.)\n const [asOfDate, setAsOfDate] = useState<Date>(() => new Date());\n\n // ACOG CO700 CRL redating — only when an LMP, a CRL and a scan date are set.\n const redating = useMemo(() => {\n if (method !== 'lmp' || !refDate || crlMm === null || !scanDate) {\n return null;\n }\n return redateByCrl({ lmp: refDate, scanDate, crlMm });\n }, [method, refDate, crlMm, scanDate]);\n\n const result = useMemo<DueDateResult | null>(() => {\n if (!refDate) return null;\n // A confirmed redating moves the effective LMP to the ultrasound's; the\n // CRL already reflects true gestation, so cycle adjustment no longer applies.\n const effectiveDate =\n method === 'lmp' && redating?.redated\n ? redating.gestationalStart\n : refDate;\n const effectiveCycle =\n method === 'lmp' && redating?.redated\n ? DEFAULT_CYCLE_LENGTH\n : (cycleLength ?? DEFAULT_CYCLE_LENGTH);\n return computeDueDate(\n {\n method,\n date: effectiveDate,\n cycleLength: effectiveCycle,\n embryoAge,\n },\n asOfDate,\n );\n }, [method, refDate, cycleLength, embryoAge, redating, asOfDate]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n });\n liveRef.current = {\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n };\n\n const agentHandle = useMemo<DueDateCalculatorHandle>(\n () => ({\n getInputs: () => {\n const live = liveRef.current;\n return {\n method: live.method,\n referenceDate: live.refDate ? toIsoDate(live.refDate) : null,\n cycleLength: live.cycleLength,\n embryoAge: live.embryoAge,\n crlMm: live.crlMm,\n scanDate: live.scanDate ? toIsoDate(live.scanDate) : null,\n asOfDate: toIsoDate(live.asOfDate),\n };\n },\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n dueDate: toIsoDate(r.dueDate),\n gestationalStart: toIsoDate(r.gestationalStart),\n gestationalAge: r.gestationalAge ? { ...r.gestationalAge } : null,\n trimester: r.trimester,\n };\n },\n setMethod: (next) => {\n if (next !== 'lmp' && next !== 'conception' && next !== 'ivf') {\n return false;\n }\n setMethod(next);\n return true;\n },\n setReferenceDate: (isoDate) => {\n if (isoDate === null) {\n setRefDate(undefined);\n return true;\n }\n const parsed = fromIsoDate(isoDate);\n // The DatePicker caps at today; the handle honours the same bound.\n if (!parsed || isAfter(parsed, new Date())) return false;\n setRefDate(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (\n days !== null &&\n !(\n Number.isFinite(days) &&\n days >= CYCLE_LENGTH_RANGE.min &&\n days <= CYCLE_LENGTH_RANGE.max\n )\n ) {\n return false;\n }\n setCycleLength(days);\n return true;\n },\n setEmbryoAge: (days) => {\n if (days !== 3 && days !== 5) return false;\n setEmbryoAge(days);\n return true;\n },\n setCrl: (next) => {\n const now = new Date();\n let parsedScan: Date | undefined;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n if ('crlMm' in next) {\n const mm = next.crlMm;\n if (\n mm !== null &&\n mm !== undefined &&\n !(Number.isFinite(mm) && mm > 0)\n ) {\n return false;\n }\n }\n if ('scanDate' in next && next.scanDate != null) {\n const d = fromIsoDate(next.scanDate);\n if (!d || isAfter(d, now)) return false;\n parsedScan = d;\n }\n if ('crlMm' in next) setCrlMm(next.crlMm ?? null);\n if ('scanDate' in next) setScanDate(parsedScan);\n return true;\n },\n setAsOfDate: (isoDate) => {\n const parsed = fromIsoDate(isoDate);\n if (!parsed) return false;\n setAsOfDate(parsed);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(dueDateCalculatorAgent, agentHandle, id);\n\n const schedule = useMemo(() => {\n if (!showSchedule || !result) return null;\n return computeAntenatalSchedule(result.gestationalStart, {\n ...scheduleOptions,\n today: asOfDate,\n });\n }, [showSchedule, result, asOfDate, scheduleOptions]);\n\n return (\n <div\n ref={ref}\n data-component=\"due-date-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('dueDateCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DueDateMethod)}\n >\n <Radio label={t('dueDateCalculator.method.lmp')} value=\"lmp\" />\n <Radio\n label={t('dueDateCalculator.method.conception')}\n value=\"conception\"\n />\n <Radio label={t('dueDateCalculator.method.ivf')} value=\"ivf\" />\n </RadioGroup>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t(DATE_LABEL_KEY[method])}>\n <DatePicker value={refDate} onChange={setRefDate} maxDate={today} />\n </FormField>\n\n {method === 'lmp' && (\n <FormField\n label={t('dueDateCalculator.cycleLength')}\n description={t('dueDateCalculator.cycleLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={CYCLE_LENGTH_RANGE.min}\n max={CYCLE_LENGTH_RANGE.max}\n value={cycleLength}\n onChange={setCycleLength}\n />\n </FormField>\n )}\n\n {method === 'ivf' && (\n <RadioGroup\n label={t('dueDateCalculator.embryoAge')}\n variant=\"horizontal\"\n value={String(embryoAge)}\n onValueChange={(next) => setEmbryoAge(Number(next) as EmbryoAge)}\n >\n <Radio label={t('dueDateCalculator.day3')} value=\"3\" />\n <Radio label={t('dueDateCalculator.day5')} value=\"5\" />\n </RadioGroup>\n )}\n </div>\n\n <FormField\n label={t('dueDateCalculator.asOfDate')}\n description={t('dueDateCalculator.asOfDateHint')}\n >\n <DatePicker value={asOfDate} onChange={(d) => d && setAsOfDate(d)} />\n </FormField>\n\n {method === 'lmp' ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={t('dueDateCalculator.crl')}\n description={t('dueDateCalculator.crlHint')}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={crlMm}\n onChange={setCrlMm}\n />\n </FormField>\n <FormField label={t('dueDateCalculator.scanDate')}>\n <DatePicker\n value={scanDate}\n onChange={setScanDate}\n maxDate={today}\n />\n </FormField>\n </div>\n {redating ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant={redating.redated ? 'warning' : 'success'}>\n {redating.redated\n ? t('dueDateCalculator.redated', {\n days: redating.discrepancyDays,\n })\n : t('dueDateCalculator.datesAgree')}\n </Badge>\n {!redating.crlInRange ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {t('dueDateCalculator.crlOutOfRange')}\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {/* Concise polite announcement when a due date resolves. */}\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('dueDateCalculator.result.dueDateLabel')}: ${dateFormatter.format(\n result.dueDate,\n )}. ${t('dueDateCalculator.result.trimesterLabel')}: ${t(\n `dueDateCalculator.trimester.${result.trimester}`,\n )}.`\n : ''}\n </p>\n\n {result ? (\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <dl className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3\">\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE_VARIANT[result.trimester]}\n size=\"lg\"\n >\n {t(`dueDateCalculator.trimester.${result.trimester}`)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.gestationLabel')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—'}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('dueDateCalculator.result.dueDateLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {dateFormatter.format(result.dueDate)}\n </dd>\n </div>\n </dl>\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('dueDateCalculator.empty')}\n </p>\n )}\n\n {schedule ? <AntenatalScheduleTimeline events={schedule} /> : null}\n\n {/* One result-action group for the whole result — sits after both the\n due-date card and the schedule, and its payload carries the schedule\n rows when shown (no per-card buttons). */}\n {result && (insertVariant === 'copy' || onInsert) ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.dueDate'),\n icon: 'calendar-heart',\n highlight: dateFormatter.format(result.dueDate),\n // Chip tinted with the trimester's semantic token so the inserted\n // PNG carries the same clinical-stage colour as the on-screen\n // trimester badge — with the contrast-safe orange override for the\n // `--warning` third trimester.\n highlightToken: trimesterHighlightToken(result.trimester),\n brand: insertBrand,\n fields: [\n {\n // The estimated date of delivery → calendar glyph.\n icon: 'calendar',\n label: t('dueDateCalculator.result.dueDateLabel'),\n value: dateFormatter.format(result.dueDate),\n },\n {\n // Gestational age is an elapsed duration → clock glyph.\n icon: 'clock',\n label: t('dueDateCalculator.result.gestationLabel'),\n value: result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—',\n },\n {\n // Trimester is a clinical-stage classification → tag.\n icon: 'tag',\n label: t('dueDateCalculator.result.trimesterLabel'),\n value: t(`dueDateCalculator.trimester.${result.trimester}`),\n },\n // When the schedule is shown, the single Insert button carries\n // the exam windows too (no second button).\n ...(schedule\n ? buildScheduleInsertFields(schedule, t, (d) =>\n dateFormatter.format(d),\n )\n : []),\n ],\n }}\n />\n ) : null}\n </div>\n );\n },\n);\n\nDueDateCalculator.displayName = 'DueDateCalculator';\n"],"names":["DEPRECATED","isoDate","dueDateCalculatorAgent","handle","args","rootVariants","cva","DATE_LABEL_KEY","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","DueDateCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","showSchedule","scheduleOptions","id","width","className","ref","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","cycleLength","setCycleLength","DEFAULT_CYCLE_LENGTH","embryoAge","setEmbryoAge","crlMm","setCrlMm","scanDate","setScanDate","today","useMemo","asOfDate","setAsOfDate","redating","redateByCrl","result","effectiveDate","effectiveCycle","computeDueDate","dateFormatter","useEffect","liveRef","useRef","agentHandle","live","r","next","parsed","isAfter","days","now","parsedScan","mm","useAgentRegistration","schedule","computeAntenatalSchedule","jsxs","RadioGroup","jsx","Radio","FormField","DatePicker","NumberInput","Badge","Card","TRIMESTER_BADGE_VARIANT","AntenatalScheduleTimeline","InsertButton","trimesterHighlightToken","buildScheduleInsertFields"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAa,iDAGbC,IAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AACX,GAEaC,KAAgE;AAAA,EAC3E,IAAI;AAAA;AAAA,EAEJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,M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c,OAAOJ,EAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gBAK9C,gBAAgBiC,GAAwBjC,EAAO,SAAS;AAAA,gBACxD,OAAO7B;AAAA,gBACP,QAAQ;AAAA,kBACN;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,uCAAuC;AAAA,oBAChD,OAAOiC,EAAc,OAAOJ,EAAO,OAAO;AAAA,kBAAA;AAAA,kBAE5C;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,yCAAyC;AAAA,oBAClD,OAAOA,EAAO,iBACV,EAAE,sCAAsC;AAAA,sBACtC,OAAOA,EAAO,eAAe;AAAA,sBAC7B,MAAMA,EAAO,eAAe;AAAA,oBAAA,CAC7B,IACD;AAAA,kBAAA;AAAA,kBAEN;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,yCAAyC;AAAA,oBAClD,OAAO,EAAE,+BAA+BA,EAAO,SAAS,EAAE;AAAA,kBAAA;AAAA;AAAA;AAAA,kBAI5D,GAAImB,IACAe;AAAA,oBAA0Bf;AAAA,oBAAU;AAAA,oBAAG,CAAC9D,MACtC+C,EAAc,OAAO/C,CAAC;AAAA,kBAAA,IAExB,CAAA;AAAA,gBAAC;AAAA,cACP;AAAA,YACF;AAAA,UAAA,IAEA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAM,GAAkB,cAAc;"}
@@ -3,10 +3,10 @@ import { forwardRef as R, useState as y, useMemo as N, useEffect as E, useRef as
3
3
  import { c as P } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as V } from "react-i18next";
5
5
  import { u as _ } from "./registry-DvAUVLHh.js";
6
- import { F as D } from "./form-field-M5UpX65Z.js";
7
- import { N as q } from "./number-input-DOe5VYei.js";
6
+ import { F as D } from "./form-field-D1oqYisL.js";
7
+ import { N as q } from "./number-input-CM1q9zvH.js";
8
8
  import { C } from "./card-DPmk26CL.js";
9
- import { B as z } from "./badge-DCOqV9mI.js";
9
+ import { B as z } from "./badge-CIt-UFEx.js";
10
10
  import { I as G } from "./insert-result-98J1QEp7.js";
11
11
  const v = (e) => ({
12
12
  oneOf: [{ type: "number", exclusiveMinimum: 0 }, { type: "null" }],
@@ -220,4 +220,4 @@ export {
220
220
  Y as F,
221
221
  Q as e
222
222
  };
223
- //# sourceMappingURL=fetal-weight-DHxXx7Uz.js.map
223
+ //# sourceMappingURL=fetal-weight-DXA6ZpMq.js.map