@alfadocs/ui-kit-debug 0.73.0 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/dist/_chunks/actions-cell-renderer-DLrcSTK_.js +1546 -0
  2. package/dist/_chunks/actions-cell-renderer-DLrcSTK_.js.map +1 -0
  3. package/dist/_chunks/{ai-prompt-input-DFm58UjY.js → ai-prompt-input-DziJCGLe.js} +2 -2
  4. package/dist/_chunks/{ai-prompt-input-DFm58UjY.js.map → ai-prompt-input-DziJCGLe.js.map} +1 -1
  5. package/dist/_chunks/{audio-recorder-CjAY0GAc.js → audio-recorder-Cc3KuL9y.js} +2 -2
  6. package/dist/_chunks/{audio-recorder-CjAY0GAc.js.map → audio-recorder-Cc3KuL9y.js.map} +1 -1
  7. package/dist/_chunks/{bishop-score-Bs6t6Zv1.js → bishop-score-DDW5-gb9.js} +2 -2
  8. package/dist/_chunks/{bishop-score-Bs6t6Zv1.js.map → bishop-score-DDW5-gb9.js.map} +1 -1
  9. package/dist/_chunks/{booking-CWnZhZ5g.js → booking-B1Qkcl3c.js} +2 -2
  10. package/dist/_chunks/{booking-CWnZhZ5g.js.map → booking-B1Qkcl3c.js.map} +1 -1
  11. package/dist/_chunks/{care-plan-card-CfIP3Vc1.js → care-plan-card-BrwhyIJI.js} +2 -2
  12. package/dist/_chunks/{care-plan-card-CfIP3Vc1.js.map → care-plan-card-BrwhyIJI.js.map} +1 -1
  13. package/dist/_chunks/{care-plan-entry-card-CRbS-G00.js → care-plan-entry-card-DWEdCQM3.js} +2 -2
  14. package/dist/_chunks/{care-plan-entry-card-CRbS-G00.js.map → care-plan-entry-card-DWEdCQM3.js.map} +1 -1
  15. package/dist/_chunks/data-table-tabs-BEUXiRlu.js +710 -0
  16. package/dist/_chunks/data-table-tabs-BEUXiRlu.js.map +1 -0
  17. package/dist/_chunks/document-preview-CGSM_au9.js +181 -0
  18. package/dist/_chunks/document-preview-CGSM_au9.js.map +1 -0
  19. package/dist/_chunks/{document-scanner-BE6Jz4Ob.js → document-scanner-B6h1Ir56.js} +2 -2
  20. package/dist/_chunks/{document-scanner-BE6Jz4Ob.js.map → document-scanner-B6h1Ir56.js.map} +1 -1
  21. package/dist/_chunks/{field-value-DCXJXKab.js → field-value-DHG6gEKS.js} +2 -2
  22. package/dist/_chunks/{field-value-DCXJXKab.js.map → field-value-DHG6gEKS.js.map} +1 -1
  23. package/dist/_chunks/file-Cwe9VC1A.js +40 -0
  24. package/dist/_chunks/file-Cwe9VC1A.js.map +1 -0
  25. package/dist/_chunks/file-manager-UF8dkQF1.js +1776 -0
  26. package/dist/_chunks/file-manager-UF8dkQF1.js.map +1 -0
  27. package/dist/_chunks/{file-upload-B2SXhRiN.js → file-upload-DENvuhfs.js} +98 -129
  28. package/dist/_chunks/file-upload-DENvuhfs.js.map +1 -0
  29. package/dist/_chunks/{gestational-age-calculator-C9Dfis4I.js → gestational-age-calculator-BpYw-WF-.js} +2 -2
  30. package/dist/_chunks/{gestational-age-calculator-C9Dfis4I.js.map → gestational-age-calculator-BpYw-WF-.js.map} +1 -1
  31. package/dist/_chunks/{header-settings-CRQDCYgr.js → header-settings-4cwQzeFc.js} +2 -2
  32. package/dist/_chunks/{header-settings-CRQDCYgr.js.map → header-settings-4cwQzeFc.js.map} +1 -1
  33. package/dist/_chunks/{icon-picker-BePK27S-.js → icon-picker-CM9ubkew.js} +2 -2
  34. package/dist/_chunks/{icon-picker-BePK27S-.js.map → icon-picker-CM9ubkew.js.map} +1 -1
  35. package/dist/_chunks/link-cell-renderer-BQGUs45d.js +711 -0
  36. package/dist/_chunks/link-cell-renderer-BQGUs45d.js.map +1 -0
  37. package/dist/_chunks/{locale-picker-Cbfqc0_N.js → locale-picker-GNF3lo8K.js} +2 -2
  38. package/dist/_chunks/{locale-picker-Cbfqc0_N.js.map → locale-picker-GNF3lo8K.js.map} +1 -1
  39. package/dist/_chunks/{marketplace-app-shell-Dm6S-hun.js → marketplace-app-shell-D_1tF4La.js} +3 -3
  40. package/dist/_chunks/{marketplace-app-shell-Dm6S-hun.js.map → marketplace-app-shell-D_1tF4La.js.map} +1 -1
  41. package/dist/_chunks/{muscle-scheme-B9MIkuj0.js → muscle-scheme-CFBE2dme.js} +6 -14
  42. package/dist/_chunks/{muscle-scheme-B9MIkuj0.js.map → muscle-scheme-CFBE2dme.js.map} +1 -1
  43. package/dist/_chunks/{notes-panel-B_8-Mebz.js → notes-panel-Cvdp818a.js} +2 -2
  44. package/dist/_chunks/{notes-panel-B_8-Mebz.js.map → notes-panel-Cvdp818a.js.map} +1 -1
  45. package/dist/_chunks/{optical-prescription-BQ75_kf6.js → optical-prescription-BEjYQjiO.js} +2 -2
  46. package/dist/_chunks/{optical-prescription-BQ75_kf6.js.map → optical-prescription-BEjYQjiO.js.map} +1 -1
  47. package/dist/_chunks/{patient-details-JkOI3Ijd.js → patient-details-DP4wKyq4.js} +3 -3
  48. package/dist/_chunks/{patient-details-JkOI3Ijd.js.map → patient-details-DP4wKyq4.js.map} +1 -1
  49. package/dist/_chunks/{patient-summary-card-CQOLMH3E.js → patient-summary-card-D6kgdTNn.js} +2 -2
  50. package/dist/_chunks/{patient-summary-card-CQOLMH3E.js.map → patient-summary-card-D6kgdTNn.js.map} +1 -1
  51. package/dist/_chunks/{patient-table-B_mOe-ZT.js → patient-table-DweKjiXg.js} +122 -118
  52. package/dist/_chunks/patient-table-DweKjiXg.js.map +1 -0
  53. package/dist/_chunks/periodontal-chart-D8hOFmde.js +1173 -0
  54. package/dist/_chunks/periodontal-chart-D8hOFmde.js.map +1 -0
  55. package/dist/_chunks/periodontal-diagnosis-cco40xTa.js +345 -0
  56. package/dist/_chunks/periodontal-diagnosis-cco40xTa.js.map +1 -0
  57. package/dist/_chunks/periodontal-risk-chart-bUGkMwDg.js +334 -0
  58. package/dist/_chunks/periodontal-risk-chart-bUGkMwDg.js.map +1 -0
  59. package/dist/_chunks/{popover-DGTKfLWh.js → popover-Cc0a69sw.js} +31 -28
  60. package/dist/_chunks/{popover-DGTKfLWh.js.map → popover-Cc0a69sw.js.map} +1 -1
  61. package/dist/_chunks/{pregnancy-dating-IsDVfqJX.js → pregnancy-dating-msMl_6wz.js} +2 -2
  62. package/dist/_chunks/{pregnancy-dating-IsDVfqJX.js.map → pregnancy-dating-msMl_6wz.js.map} +1 -1
  63. package/dist/_chunks/{radiograph-panel.agent-e488ooH8.js → radiograph-panel.agent-CxF9pVxd.js} +2 -2
  64. package/dist/_chunks/{radiograph-panel.agent-e488ooH8.js.map → radiograph-panel.agent-CxF9pVxd.js.map} +1 -1
  65. package/dist/_chunks/{rich-text-editor-CgA2bYwi.js → rich-text-editor-CCWjNkbx.js} +186 -177
  66. package/dist/_chunks/rich-text-editor-CCWjNkbx.js.map +1 -0
  67. package/dist/_chunks/{select-BmCbJMJS.js → select-BW5ecXlX.js} +13 -13
  68. package/dist/_chunks/{select-BmCbJMJS.js.map → select-BW5ecXlX.js.map} +1 -1
  69. package/dist/_chunks/{sidebar-CtU35PIX.js → sidebar-C0PbwJBc.js} +357 -320
  70. package/dist/_chunks/sidebar-C0PbwJBc.js.map +1 -0
  71. package/dist/_chunks/signature-request-C-mskXwi.js +318 -0
  72. package/dist/_chunks/signature-request-C-mskXwi.js.map +1 -0
  73. package/dist/_chunks/{tabs-DVQ941Sj.js → tabs-CVTukWRD.js} +2 -2
  74. package/dist/_chunks/{tabs-DVQ941Sj.js.map → tabs-CVTukWRD.js.map} +1 -1
  75. package/dist/_chunks/{tasks-panel-LCK5ZXvU.js → tasks-panel-CjGAhIN8.js} +2 -2
  76. package/dist/_chunks/{tasks-panel-LCK5ZXvU.js.map → tasks-panel-CjGAhIN8.js.map} +1 -1
  77. package/dist/_chunks/tooth-data-BwuoKFf4.js +660 -0
  78. package/dist/_chunks/tooth-data-BwuoKFf4.js.map +1 -0
  79. package/dist/_chunks/tooth-scheme-BzJ6rcte.js +1483 -0
  80. package/dist/_chunks/tooth-scheme-BzJ6rcte.js.map +1 -0
  81. package/dist/_chunks/{unit-converter-3uL_tMCm.js → unit-converter-CSLWFDQh.js} +2 -2
  82. package/dist/_chunks/{unit-converter-3uL_tMCm.js.map → unit-converter-CSLWFDQh.js.map} +1 -1
  83. package/dist/agent-catalog.json +1282 -213
  84. package/dist/agent-i18n/en.json +84 -5
  85. package/dist/components/_shared/entity-card/entity-card.d.ts +1 -1
  86. package/dist/components/ai-prompt-input/index.js +1 -1
  87. package/dist/components/anamnesis-card/anamnesis-card.d.ts +1 -1
  88. package/dist/components/appointment-card/appointment-card.d.ts +1 -1
  89. package/dist/components/audio-recorder/index.js +1 -1
  90. package/dist/components/bishop-score/index.js +1 -1
  91. package/dist/components/booking/index.js +1 -1
  92. package/dist/components/card/card.d.ts +1 -1
  93. package/dist/components/care-plan-card/index.js +1 -1
  94. package/dist/components/care-plan-entry-card/index.js +1 -1
  95. package/dist/components/clinical-note-card/clinical-note-card.d.ts +1 -1
  96. package/dist/components/contact-profile-card/contact-profile-card.d.ts +1 -1
  97. package/dist/components/data-table/data-table.d.ts.map +1 -1
  98. package/dist/components/data-table/filters/number-filter.d.ts.map +1 -1
  99. package/dist/components/data-table/index.js +35 -34
  100. package/dist/components/data-table/index.js.map +1 -1
  101. package/dist/components/data-table/toolbar.d.ts +1 -1
  102. package/dist/components/data-table/toolbar.d.ts.map +1 -1
  103. package/dist/components/data-table-tabs/data-table-tabs.agent.d.ts +4 -0
  104. package/dist/components/data-table-tabs/data-table-tabs.agent.d.ts.map +1 -0
  105. package/dist/components/data-table-tabs/data-table-tabs.d.ts +93 -0
  106. package/dist/components/data-table-tabs/data-table-tabs.d.ts.map +1 -0
  107. package/dist/components/data-table-tabs/index.d.ts +5 -0
  108. package/dist/components/data-table-tabs/index.d.ts.map +1 -0
  109. package/dist/components/data-table-tabs/index.js +8 -0
  110. package/dist/components/data-table-tabs/index.js.map +1 -0
  111. package/dist/components/data-table-tabs/use-data-table-filter-tabs.d.ts +63 -0
  112. package/dist/components/data-table-tabs/use-data-table-filter-tabs.d.ts.map +1 -0
  113. package/dist/components/document-preview/document-preview.agent.d.ts +4 -0
  114. package/dist/components/document-preview/document-preview.agent.d.ts.map +1 -0
  115. package/dist/components/document-preview/document-preview.d.ts +41 -0
  116. package/dist/components/document-preview/document-preview.d.ts.map +1 -0
  117. package/dist/components/document-preview/index.d.ts +4 -0
  118. package/dist/components/document-preview/index.d.ts.map +1 -0
  119. package/dist/components/document-preview/index.js +6 -0
  120. package/dist/components/document-preview/index.js.map +1 -0
  121. package/dist/components/document-scanner/index.js +1 -1
  122. package/dist/components/file-manager/dialogs.d.ts +48 -0
  123. package/dist/components/file-manager/dialogs.d.ts.map +1 -0
  124. package/dist/components/file-manager/file-manager.agent.d.ts +4 -0
  125. package/dist/components/file-manager/file-manager.agent.d.ts.map +1 -0
  126. package/dist/components/file-manager/file-manager.d.ts +82 -0
  127. package/dist/components/file-manager/file-manager.d.ts.map +1 -0
  128. package/dist/components/file-manager/folder-tree.d.ts +12 -0
  129. package/dist/components/file-manager/folder-tree.d.ts.map +1 -0
  130. package/dist/components/file-manager/index.d.ts +5 -0
  131. package/dist/components/file-manager/index.d.ts.map +1 -0
  132. package/dist/components/file-manager/index.js +6 -0
  133. package/dist/components/file-manager/index.js.map +1 -0
  134. package/dist/components/file-manager/list-view.d.ts +49 -0
  135. package/dist/components/file-manager/list-view.d.ts.map +1 -0
  136. package/dist/components/file-manager/toolbar.d.ts +15 -0
  137. package/dist/components/file-manager/toolbar.d.ts.map +1 -0
  138. package/dist/components/file-manager/types.d.ts +167 -0
  139. package/dist/components/file-manager/types.d.ts.map +1 -0
  140. package/dist/components/file-manager/utils.d.ts +34 -0
  141. package/dist/components/file-manager/utils.d.ts.map +1 -0
  142. package/dist/components/file-upload/index.js +1 -1
  143. package/dist/components/gestational-age-calculator/index.js +1 -1
  144. package/dist/components/header-settings/index.js +1 -1
  145. package/dist/components/icon-picker/index.js +1 -1
  146. package/dist/components/index.d.ts +7 -0
  147. package/dist/components/index.d.ts.map +1 -1
  148. package/dist/components/locale-picker/index.js +1 -1
  149. package/dist/components/message-card/message-card.d.ts +1 -1
  150. package/dist/components/muscle-scheme/index.js +1 -1
  151. package/dist/components/muscle-scheme/muscle-scheme.d.ts.map +1 -1
  152. package/dist/components/notes-panel/index.js +1 -1
  153. package/dist/components/notification-card/notification-card.d.ts +1 -1
  154. package/dist/components/operator-hero/operator-hero.d.ts +1 -1
  155. package/dist/components/optical-prescription/index.js +1 -1
  156. package/dist/components/patient-details/index.js +1 -1
  157. package/dist/components/patient-summary-card/index.js +1 -1
  158. package/dist/components/patient-summary-card/patient-summary-card.d.ts +1 -1
  159. package/dist/components/patient-table/columns.d.ts.map +1 -1
  160. package/dist/components/patient-table/index.js +1 -1
  161. package/dist/components/payment-card/payment-card.d.ts +1 -1
  162. package/dist/components/payment-card/payment-request-card.d.ts +1 -1
  163. package/dist/components/periodontal-chart/index.d.ts +6 -0
  164. package/dist/components/periodontal-chart/index.d.ts.map +1 -0
  165. package/dist/components/periodontal-chart/index.js +22 -0
  166. package/dist/components/periodontal-chart/index.js.map +1 -0
  167. package/dist/components/periodontal-chart/periodontal-chart-data.d.ts +119 -0
  168. package/dist/components/periodontal-chart/periodontal-chart-data.d.ts.map +1 -0
  169. package/dist/components/periodontal-chart/periodontal-chart.agent.d.ts +4 -0
  170. package/dist/components/periodontal-chart/periodontal-chart.agent.d.ts.map +1 -0
  171. package/dist/components/periodontal-chart/periodontal-chart.d.ts +69 -0
  172. package/dist/components/periodontal-chart/periodontal-chart.d.ts.map +1 -0
  173. package/dist/components/periodontal-chart-card/periodontal-chart-card.d.ts +1 -1
  174. package/dist/components/periodontal-diagnosis/index.d.ts +6 -0
  175. package/dist/components/periodontal-diagnosis/index.d.ts.map +1 -0
  176. package/dist/components/periodontal-diagnosis/index.js +13 -0
  177. package/dist/components/periodontal-diagnosis/index.js.map +1 -0
  178. package/dist/components/periodontal-diagnosis/periodontal-diagnosis-data.d.ts +30 -0
  179. package/dist/components/periodontal-diagnosis/periodontal-diagnosis-data.d.ts.map +1 -0
  180. package/dist/components/periodontal-diagnosis/periodontal-diagnosis.agent.d.ts +4 -0
  181. package/dist/components/periodontal-diagnosis/periodontal-diagnosis.agent.d.ts.map +1 -0
  182. package/dist/components/periodontal-diagnosis/periodontal-diagnosis.d.ts +44 -0
  183. package/dist/components/periodontal-diagnosis/periodontal-diagnosis.d.ts.map +1 -0
  184. package/dist/components/periodontal-risk-chart/index.d.ts +6 -0
  185. package/dist/components/periodontal-risk-chart/index.d.ts.map +1 -0
  186. package/dist/components/periodontal-risk-chart/index.js +9 -0
  187. package/dist/components/periodontal-risk-chart/index.js.map +1 -0
  188. package/dist/components/periodontal-risk-chart/periodontal-risk-chart.agent.d.ts +4 -0
  189. package/dist/components/periodontal-risk-chart/periodontal-risk-chart.agent.d.ts.map +1 -0
  190. package/dist/components/periodontal-risk-chart/periodontal-risk-chart.d.ts +28 -0
  191. package/dist/components/periodontal-risk-chart/periodontal-risk-chart.d.ts.map +1 -0
  192. package/dist/components/periodontal-risk-chart/periodontal-risk-data.d.ts +47 -0
  193. package/dist/components/periodontal-risk-chart/periodontal-risk-data.d.ts.map +1 -0
  194. package/dist/components/popover/index.js +1 -1
  195. package/dist/components/popover/popover.d.ts +1 -0
  196. package/dist/components/popover/popover.d.ts.map +1 -1
  197. package/dist/components/pregnancy-dating/index.js +1 -1
  198. package/dist/components/product-hub-tray/product-hub-panel.d.ts +1 -1
  199. package/dist/components/radiograph-panel/index.js +1 -1
  200. package/dist/components/rich-text-editor/index.js +1 -1
  201. package/dist/components/select/index.js +1 -1
  202. package/dist/components/select/select.d.ts.map +1 -1
  203. package/dist/components/sidebar/index.js +1 -1
  204. package/dist/components/sidebar/sidebar.d.ts +9 -0
  205. package/dist/components/sidebar/sidebar.d.ts.map +1 -1
  206. package/dist/components/skeleton-scheme/index.js +5 -13
  207. package/dist/components/skeleton-scheme/index.js.map +1 -1
  208. package/dist/components/stat/stat.d.ts +1 -1
  209. package/dist/components/tabs/index.js +1 -1
  210. package/dist/components/tasks-panel/index.js +1 -1
  211. package/dist/components/tooth-scheme/index.js +29 -28
  212. package/dist/components/tooth-scheme/index.js.map +1 -1
  213. package/dist/components/unit-converter/index.js +1 -1
  214. package/dist/i18n/locales/ar.d.ts +320 -0
  215. package/dist/i18n/locales/ar.d.ts.map +1 -1
  216. package/dist/i18n/locales/ar.js +320 -0
  217. package/dist/i18n/locales/ar.js.map +1 -1
  218. package/dist/i18n/locales/de.d.ts +320 -0
  219. package/dist/i18n/locales/de.d.ts.map +1 -1
  220. package/dist/i18n/locales/de.js +320 -0
  221. package/dist/i18n/locales/de.js.map +1 -1
  222. package/dist/i18n/locales/el.d.ts +320 -0
  223. package/dist/i18n/locales/el.d.ts.map +1 -1
  224. package/dist/i18n/locales/el.js +320 -0
  225. package/dist/i18n/locales/el.js.map +1 -1
  226. package/dist/i18n/locales/en.d.ts +320 -0
  227. package/dist/i18n/locales/en.d.ts.map +1 -1
  228. package/dist/i18n/locales/en.js +320 -0
  229. package/dist/i18n/locales/en.js.map +1 -1
  230. package/dist/i18n/locales/es.d.ts +320 -0
  231. package/dist/i18n/locales/es.d.ts.map +1 -1
  232. package/dist/i18n/locales/es.js +320 -0
  233. package/dist/i18n/locales/es.js.map +1 -1
  234. package/dist/i18n/locales/fr.d.ts +320 -0
  235. package/dist/i18n/locales/fr.d.ts.map +1 -1
  236. package/dist/i18n/locales/fr.js +320 -0
  237. package/dist/i18n/locales/fr.js.map +1 -1
  238. package/dist/i18n/locales/hi.d.ts +320 -0
  239. package/dist/i18n/locales/hi.d.ts.map +1 -1
  240. package/dist/i18n/locales/hi.js +320 -0
  241. package/dist/i18n/locales/hi.js.map +1 -1
  242. package/dist/i18n/locales/it.d.ts +320 -0
  243. package/dist/i18n/locales/it.d.ts.map +1 -1
  244. package/dist/i18n/locales/it.js +320 -0
  245. package/dist/i18n/locales/it.js.map +1 -1
  246. package/dist/i18n/locales/ja.d.ts +320 -0
  247. package/dist/i18n/locales/ja.d.ts.map +1 -1
  248. package/dist/i18n/locales/ja.js +320 -0
  249. package/dist/i18n/locales/ja.js.map +1 -1
  250. package/dist/i18n/locales/nl.d.ts +320 -0
  251. package/dist/i18n/locales/nl.d.ts.map +1 -1
  252. package/dist/i18n/locales/nl.js +320 -0
  253. package/dist/i18n/locales/nl.js.map +1 -1
  254. package/dist/i18n/locales/pl.d.ts +320 -0
  255. package/dist/i18n/locales/pl.d.ts.map +1 -1
  256. package/dist/i18n/locales/pl.js +320 -0
  257. package/dist/i18n/locales/pl.js.map +1 -1
  258. package/dist/i18n/locales/pt.d.ts +320 -0
  259. package/dist/i18n/locales/pt.d.ts.map +1 -1
  260. package/dist/i18n/locales/pt.js +320 -0
  261. package/dist/i18n/locales/pt.js.map +1 -1
  262. package/dist/i18n/locales/ro.d.ts +320 -0
  263. package/dist/i18n/locales/ro.d.ts.map +1 -1
  264. package/dist/i18n/locales/ro.js +320 -0
  265. package/dist/i18n/locales/ro.js.map +1 -1
  266. package/dist/i18n/locales/ru.d.ts +320 -0
  267. package/dist/i18n/locales/ru.d.ts.map +1 -1
  268. package/dist/i18n/locales/ru.js +320 -0
  269. package/dist/i18n/locales/ru.js.map +1 -1
  270. package/dist/i18n/locales/sq.d.ts +320 -0
  271. package/dist/i18n/locales/sq.d.ts.map +1 -1
  272. package/dist/i18n/locales/sq.js +320 -0
  273. package/dist/i18n/locales/sq.js.map +1 -1
  274. package/dist/i18n/locales/sv.d.ts +320 -0
  275. package/dist/i18n/locales/sv.d.ts.map +1 -1
  276. package/dist/i18n/locales/sv.js +320 -0
  277. package/dist/i18n/locales/sv.js.map +1 -1
  278. package/dist/i18n/locales/tr.d.ts +320 -0
  279. package/dist/i18n/locales/tr.d.ts.map +1 -1
  280. package/dist/i18n/locales/tr.js +320 -0
  281. package/dist/i18n/locales/tr.js.map +1 -1
  282. package/dist/i18n/locales/zh.d.ts +320 -0
  283. package/dist/i18n/locales/zh.d.ts.map +1 -1
  284. package/dist/i18n/locales/zh.js +320 -0
  285. package/dist/i18n/locales/zh.js.map +1 -1
  286. package/dist/index.js +832 -782
  287. package/dist/index.js.map +1 -1
  288. package/dist/locales/ar.json +320 -0
  289. package/dist/locales/de.json +320 -0
  290. package/dist/locales/el.json +320 -0
  291. package/dist/locales/en.json +320 -0
  292. package/dist/locales/es.json +320 -0
  293. package/dist/locales/fr.json +320 -0
  294. package/dist/locales/hi.json +320 -0
  295. package/dist/locales/it.json +320 -0
  296. package/dist/locales/ja.json +320 -0
  297. package/dist/locales/nl.json +320 -0
  298. package/dist/locales/pl.json +320 -0
  299. package/dist/locales/pt.json +320 -0
  300. package/dist/locales/ro.json +320 -0
  301. package/dist/locales/ru.json +320 -0
  302. package/dist/locales/sq.json +320 -0
  303. package/dist/locales/sv.json +320 -0
  304. package/dist/locales/tr.json +320 -0
  305. package/dist/locales/zh.json +320 -0
  306. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  307. package/dist/patterns/signature-request/index.d.ts +3 -0
  308. package/dist/patterns/signature-request/index.d.ts.map +1 -0
  309. package/dist/patterns/signature-request/index.js +5 -0
  310. package/dist/patterns/signature-request/index.js.map +1 -0
  311. package/dist/patterns/signature-request/signature-request.d.ts +81 -0
  312. package/dist/patterns/signature-request/signature-request.d.ts.map +1 -0
  313. package/dist/tokens.css +1 -1
  314. package/package.json +29 -1
  315. package/dist/_chunks/columns-2-8lq4-b8e.js +0 -15
  316. package/dist/_chunks/columns-2-8lq4-b8e.js.map +0 -1
  317. package/dist/_chunks/file-upload-B2SXhRiN.js.map +0 -1
  318. package/dist/_chunks/link-cell-renderer-CLI7sBkX.js +0 -2210
  319. package/dist/_chunks/link-cell-renderer-CLI7sBkX.js.map +0 -1
  320. package/dist/_chunks/patient-table-B_mOe-ZT.js.map +0 -1
  321. package/dist/_chunks/rich-text-editor-CgA2bYwi.js.map +0 -1
  322. package/dist/_chunks/sidebar-CtU35PIX.js.map +0 -1
  323. package/dist/_chunks/tooth-scheme-CX49GycY.js +0 -2133
  324. package/dist/_chunks/tooth-scheme-CX49GycY.js.map +0 -1
@@ -4,7 +4,7 @@ import { c as oe } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as ue } from "react-i18next";
5
5
  import { B as G } from "./button-CPGiR_bH.js";
6
6
  import { I as D } from "./icon-button-C_kbcd7I.js";
7
- import { S as pe } from "./select-BmCbJMJS.js";
7
+ import { S as pe } from "./select-BW5ecXlX.js";
8
8
  import { A as le } from "./audio-visualiser-l6zPd0AG.js";
9
9
  import { A as F } from "./alert-KJbsPYkI.js";
10
10
  import { u as me } from "./registry-DvAUVLHh.js";
@@ -447,4 +447,4 @@ export {
447
447
  De as A,
448
448
  Re as a
449
449
  };
450
- //# sourceMappingURL=audio-recorder-CjAY0GAc.js.map
450
+ //# sourceMappingURL=audio-recorder-Cc3KuL9y.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio-recorder-CjAY0GAc.js","sources":["../../node_modules/lucide-react/dist/esm/icons/pause.mjs","../../node_modules/lucide-react/dist/esm/icons/play.mjs","../../src/components/audio-recorder/audio-recorder.agent.ts","../../src/components/audio-recorder/audio-recorder.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 [\"rect\", { x: \"14\", y: \"3\", width: \"5\", height: \"18\", rx: \"1\", key: \"kaeet6\" }],\n [\"rect\", { x: \"5\", y: \"3\", width: \"5\", height: \"18\", rx: \"1\", key: \"1wsw3u\" }]\n];\nconst Pause = createLucideIcon(\"pause\", __iconNode);\n\nexport { __iconNode, Pause as default };\n//# sourceMappingURL=pause.mjs.map\n","/**\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 [\n \"path\",\n {\n d: \"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\",\n key: \"10ikf1\"\n }\n ]\n];\nconst Play = createLucideIcon(\"play\", __iconNode);\n\nexport { __iconNode, Play as default };\n//# sourceMappingURL=play.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — AudioRecorder. */\n/* */\n/* Multi-step media-capture lifecycle (request → record → stop → submit / */\n/* discard). Exposes `capture` for the start/stop steps and `submit` for */\n/* the final commit via onRecordingComplete. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { AudioRecorderHandle } from './audio-recorder';\n\nexport const audioRecorderAgent: AgentAdapter<AudioRecorderHandle> = {\n id: 'audio-recorder',\n capabilities: ['capture', 'submit'],\n state: {\n isRecording: {\n type: 'boolean',\n descriptionKey: 'ui.agent.audioRecorder.state.isRecording',\n description: 'True while actively capturing audio (not paused).',\n read: (handle) => handle.isRecording(),\n },\n duration: {\n type: 'number',\n descriptionKey: 'ui.agent.audioRecorder.state.duration',\n description:\n 'Elapsed recording time in milliseconds (paused time excluded).',\n read: (handle) => handle.getDuration(),\n },\n hasRecording: {\n type: 'boolean',\n descriptionKey: 'ui.agent.audioRecorder.state.hasRecording',\n description:\n 'True when a completed recording is available for submission.',\n read: (handle) => handle.hasRecording(),\n },\n },\n actions: {\n start_recording: {\n safety: 'write',\n returns: 'void',\n descriptionKey: 'ui.agent.audioRecorder.actions.startRecording',\n description: 'Request microphone permission and begin recording.',\n errors: ['Microphone permission denied', 'No audio input device'],\n invoke: (handle) => handle.startRecording(),\n },\n stop_recording: {\n safety: 'write',\n descriptionKey: 'ui.agent.audioRecorder.actions.stopRecording',\n description: 'Stop the current recording and finalise the blob.',\n invoke: (handle) => {\n handle.stopRecording();\n },\n },\n discard: {\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.audioRecorder.actions.discard',\n description:\n 'Cancel the recording. Irreversible — the captured audio is dropped.',\n invoke: (handle) => {\n handle.discard();\n },\n },\n submit: {\n safety: 'write',\n descriptionKey: 'ui.agent.audioRecorder.actions.submit',\n description:\n 'Stop the active recording, finalising it via onRecordingComplete.',\n invoke: (handle) => {\n handle.stopRecording();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'audio-recorder',\n description: 'Marks the AudioRecorder wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useReducer,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Mic, Pause, Play, Square, X } from 'lucide-react';\nimport { IconButton, Button } from '../button';\nimport { Select, type SelectOption } from '../select/select';\nimport { AudioVisualiser } from '../audio-visualiser';\nimport { Alert } from '../alert';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { audioRecorderAgent } from './audio-recorder.agent';\n\ntype State =\n | { kind: 'idle' }\n | { kind: 'requesting' }\n | { kind: 'recording'; startedAt: number; pausedMs: number }\n | { kind: 'paused'; startedAt: number; pausedMs: number; pausedAt: number }\n | { kind: 'stopped'; duration: number }\n | {\n kind: 'error';\n type:\n | 'permission-denied'\n | 'no-device'\n | 'unsupported'\n | 'capture-failed';\n };\n\ntype Action =\n | { type: 'request' }\n | { type: 'start' }\n | { type: 'pause' }\n | { type: 'resume' }\n | { type: 'stop'; duration: number }\n | { type: 'cancel' }\n | {\n type: 'error';\n kind:\n | 'permission-denied'\n | 'no-device'\n | 'unsupported'\n | 'capture-failed';\n }\n | { type: 'reset' };\n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'request':\n return { kind: 'requesting' };\n case 'start':\n return { kind: 'recording', startedAt: Date.now(), pausedMs: 0 };\n case 'pause':\n if (state.kind !== 'recording') return state;\n return {\n kind: 'paused',\n startedAt: state.startedAt,\n pausedMs: state.pausedMs,\n pausedAt: Date.now(),\n };\n case 'resume':\n if (state.kind !== 'paused') return state;\n return {\n kind: 'recording',\n startedAt: state.startedAt,\n pausedMs: state.pausedMs + (Date.now() - state.pausedAt),\n };\n case 'stop':\n return { kind: 'stopped', duration: action.duration };\n case 'cancel':\n return { kind: 'idle' };\n case 'error':\n return { kind: 'error', type: action.kind };\n case 'reset':\n return { kind: 'idle' };\n default:\n return state;\n }\n}\n\nconst rootVariants = cva(\n [\n 'ds:inline-flex ds:flex-col ds:items-stretch ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'ds:bg-background',\n ].join(' '),\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst MIME_PREFERENCES = [\n 'audio/webm;codecs=opus',\n 'audio/webm',\n 'audio/mp4',\n 'audio/ogg;codecs=opus',\n];\n\nfunction pickMimeType(): string | undefined {\n if (typeof MediaRecorder === 'undefined') return undefined;\n for (const mime of MIME_PREFERENCES) {\n if (MediaRecorder.isTypeSupported(mime)) return mime;\n }\n return undefined;\n}\n\nfunction formatTimer(ms: number, locale: string): string {\n const total = Math.max(0, Math.floor(ms / 1000));\n const minutes = Math.floor(total / 60);\n const seconds = total % 60;\n const fmt = (n: number) =>\n new Intl.NumberFormat(locale, { minimumIntegerDigits: 2 }).format(n);\n return `${fmt(minutes)}:${fmt(seconds)}`;\n}\n\n/** Curated imperative handle for agent / external automation. */\nexport interface AudioRecorderHandle {\n isRecording: () => boolean;\n getDuration: () => number;\n hasRecording: () => boolean;\n startRecording: () => Promise<void> | void;\n stopRecording: () => void;\n discard: () => void;\n}\n\nexport interface AudioRecorderProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onError'>,\n VariantProps<typeof rootVariants> {\n /** Called on stop with the final blob + duration in ms. */\n onRecordingComplete?: (blob: Blob, durationMs: number) => void;\n /** Called when recording is cancelled. */\n onCancel?: () => void;\n /** Called when an error occurs. */\n onError?: (\n error:\n | 'permission-denied'\n | 'no-device'\n | 'unsupported'\n | 'capture-failed'\n | 'max-duration'\n | 'max-size',\n ) => void;\n /**\n * Auto-stop after this many milliseconds of active recording. Default\n * 30 minutes. Set `null` to disable.\n */\n maxDurationMs?: number | null;\n /**\n * Auto-stop when the accumulated blob chunks exceed this many bytes.\n * Default 250 MB. Set `null` to disable.\n */\n maxBytes?: number | null;\n}\n\nexport const AudioRecorder = forwardRef<\n AudioRecorderHandle,\n AudioRecorderProps\n>(\n (\n {\n size = 'md',\n onRecordingComplete,\n onCancel,\n onError,\n maxDurationMs = 30 * 60 * 1000,\n maxBytes = 250 * 1024 * 1024,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const [state, dispatch] = useReducer(reducer, { kind: 'idle' });\n const [stream, setStream] = useState<MediaStream | null>(null);\n const [now, setNow] = useState<number>(Date.now());\n const [devices, setDevices] = useState<MediaDeviceInfo[]>([]);\n const [selectedDeviceId, setSelectedDeviceId] = useState<string>('');\n\n const recorderRef = useRef<MediaRecorder | null>(null);\n const chunksRef = useRef<Blob[]>([]);\n // Running total of bytes accumulated in `chunksRef` — reading\n // `chunksRef.current.reduce(...)` on every ondataavailable scales\n // poorly; maintain the sum incrementally instead.\n const byteCountRef = useRef<number>(0);\n const durationAtStopRef = useRef<number>(0);\n // Tracks the *currently-held* MediaStream in a ref so the unmount\n // cleanup effect (which closes over [] deps) sees the latest value.\n // Without this, a unmount while getUserMedia is pending would never\n // stop() tracks and the browser mic indicator stays on.\n const streamRef = useRef<MediaStream | null>(null);\n // Flips to true on unmount; consulted inside the getUserMedia promise\n // resolution so we don't try to setStream() on a dead component and\n // so the freshly-acquired tracks get released immediately.\n const unmountedRef = useRef<boolean>(false);\n // Flips to true when cancel() is called; the onstop handler reads it\n // so `onRecordingComplete` is NOT invoked on a cancel path with a blank\n // blob. Reset on each recording start.\n const cancelledRef = useRef<boolean>(false);\n // Monotonic `performance.now()` start timestamp for the max-duration\n // timer. Wall-clock `Date.now()` jumps on NTP / timezone changes.\n const perfStartRef = useRef<number>(0);\n\n const supported = typeof MediaRecorder !== 'undefined';\n\n /* ── Enumerate devices once (after any prior permission grant) ── */\n useEffect(() => {\n if (!supported || !navigator.mediaDevices?.enumerateDevices) return;\n navigator.mediaDevices\n .enumerateDevices()\n .then((list) => {\n const mics = list.filter((d) => d.kind === 'audioinput');\n setDevices(mics);\n })\n .catch(() => {\n /* ignore */\n });\n }, [supported]);\n\n /* ── Timer tick ── */\n useEffect(() => {\n if (state.kind !== 'recording') return;\n const handle = window.setInterval(() => setNow(Date.now()), 250);\n return () => window.clearInterval(handle);\n }, [state.kind]);\n\n const cleanupStream = useCallback(() => {\n const held = streamRef.current ?? stream;\n held?.getTracks().forEach((t) => t.stop());\n streamRef.current = null;\n setStream(null);\n }, [stream]);\n\n const requestAndStart = useCallback(async () => {\n if (!supported) {\n dispatch({ type: 'error', kind: 'unsupported' });\n onError?.('unsupported');\n return;\n }\n dispatch({ type: 'request' });\n cancelledRef.current = false;\n try {\n const nextStream = await navigator.mediaDevices.getUserMedia({\n audio: selectedDeviceId\n ? { deviceId: { exact: selectedDeviceId } }\n : true,\n });\n // Guard against unmount OR a cancel() between the permission prompt\n // and resolution — otherwise the freshly-acquired tracks leak and the\n // browser's mic indicator stays live, secretly capturing audio.\n if (unmountedRef.current || cancelledRef.current) {\n nextStream.getTracks().forEach((tr) => tr.stop());\n return;\n }\n streamRef.current = nextStream;\n setStream(nextStream);\n const mimeType = pickMimeType();\n const recorder = new MediaRecorder(\n nextStream,\n mimeType ? { mimeType } : undefined,\n );\n recorderRef.current = recorder;\n chunksRef.current = [];\n byteCountRef.current = 0;\n recorder.ondataavailable = (event) => {\n if (event.data && event.data.size > 0) {\n chunksRef.current.push(event.data);\n byteCountRef.current += event.data.size;\n // Byte-cap: auto-stop if the recording would exceed maxBytes.\n // Cheaper than summing on every tick; stop once and bail.\n if (\n typeof maxBytes === 'number' &&\n byteCountRef.current >= maxBytes &&\n recorderRef.current?.state === 'recording'\n ) {\n onError?.('max-size');\n try {\n recorderRef.current.stop();\n } catch {\n /* ignore */\n }\n }\n }\n };\n recorder.onstop = () => {\n // Cancel path: drop the blob on the floor — consumers who called\n // cancel() must not receive a silent empty recording.\n if (!cancelledRef.current) {\n const blob = new Blob(chunksRef.current, {\n type: mimeType ?? 'audio/webm',\n });\n onRecordingComplete?.(blob, durationAtStopRef.current);\n }\n chunksRef.current = [];\n recorderRef.current = null;\n nextStream.getTracks().forEach((tr) => tr.stop());\n streamRef.current = null;\n setStream(null);\n cancelledRef.current = false;\n };\n perfStartRef.current = performance.now();\n recorder.start(1000);\n dispatch({ type: 'start' });\n } catch (err: unknown) {\n const errorName = err instanceof Error ? err.name : '';\n if (errorName === 'NotAllowedError' || errorName === 'SecurityError') {\n dispatch({ type: 'error', kind: 'permission-denied' });\n onError?.('permission-denied');\n } else if (\n errorName === 'NotFoundError' ||\n errorName === 'OverconstrainedError'\n ) {\n dispatch({ type: 'error', kind: 'no-device' });\n onError?.('no-device');\n } else {\n dispatch({ type: 'error', kind: 'capture-failed' });\n onError?.('capture-failed');\n }\n }\n }, [onError, onRecordingComplete, selectedDeviceId, supported]);\n\n const pause = useCallback(() => {\n recorderRef.current?.pause();\n dispatch({ type: 'pause' });\n }, []);\n\n const resume = useCallback(() => {\n recorderRef.current?.resume();\n dispatch({ type: 'resume' });\n }, []);\n\n const stop = useCallback(() => {\n if (state.kind === 'recording' || state.kind === 'paused') {\n const started = state.startedAt;\n const pausedMs = state.pausedMs;\n const duration = Date.now() - started - pausedMs;\n durationAtStopRef.current = Math.max(0, duration);\n dispatch({ type: 'stop', duration: duration });\n }\n try {\n recorderRef.current?.stop();\n } catch {\n /* stop() throws on non-recording state; safe to swallow */\n }\n }, [state]);\n\n const cancel = useCallback(() => {\n // Flip the cancelled flag BEFORE asking MediaRecorder to stop so the\n // async onstop handler sees it and skips onRecordingComplete.\n cancelledRef.current = true;\n try {\n recorderRef.current?.stop();\n } catch {\n /* ignore */\n }\n chunksRef.current = [];\n recorderRef.current = null;\n cleanupStream();\n dispatch({ type: 'cancel' });\n onCancel?.();\n }, [cleanupStream, onCancel]);\n\n /* ── Max-duration auto-stop ── */\n useEffect(() => {\n if (state.kind !== 'recording') return;\n if (typeof maxDurationMs !== 'number' || maxDurationMs <= 0) return;\n // Use the monotonic clock so an NTP / timezone jump mid-recording\n // doesn't skew the remaining-time calc.\n const alreadyElapsed =\n performance.now() - perfStartRef.current - state.pausedMs;\n const remaining = Math.max(0, maxDurationMs - alreadyElapsed);\n const handle = window.setTimeout(() => {\n if (recorderRef.current?.state === 'recording') {\n onError?.('max-duration');\n try {\n recorderRef.current.stop();\n } catch {\n /* ignore */\n }\n }\n }, remaining);\n return () => window.clearTimeout(handle);\n }, [state, maxDurationMs, onError]);\n\n /* ── Unmount cleanup: release mic if still held ── */\n useEffect(() => {\n return () => {\n unmountedRef.current = true;\n try {\n recorderRef.current?.stop();\n } catch {\n /* ignore */\n }\n // Use streamRef so we see a stream that was acquired by an\n // in-flight getUserMedia resolution — not just the one captured\n // by the closure at mount.\n streamRef.current?.getTracks().forEach((tr) => tr.stop());\n streamRef.current = null;\n };\n }, []);\n\n const elapsedMs =\n state.kind === 'recording'\n ? now - state.startedAt - state.pausedMs\n : state.kind === 'paused'\n ? state.pausedAt - state.startedAt - state.pausedMs\n : state.kind === 'stopped'\n ? state.duration\n : 0;\n\n const agentHandle = useMemo<AudioRecorderHandle>(\n () => ({\n isRecording: () => state.kind === 'recording',\n getDuration: () => elapsedMs,\n hasRecording: () => state.kind === 'stopped',\n startRecording: () => requestAndStart(),\n stopRecording: () => stop(),\n discard: () => cancel(),\n }),\n [state, elapsedMs, requestAndStart, stop, cancel],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(audioRecorderAgent, agentHandle, rest.id);\n\n const deviceOptions: SelectOption<string>[] = devices.map((d) => ({\n value: d.deviceId,\n label: d.label || t('chat.audio.selectDevice'),\n }));\n\n const statusText = (() => {\n switch (state.kind) {\n case 'idle':\n return t('chat.audio.idle');\n case 'requesting':\n return t('common.loading');\n case 'recording':\n return t('chat.audio.recording');\n case 'paused':\n return t('chat.audio.paused');\n case 'stopped':\n return t('chat.audio.idle');\n case 'error':\n if (state.type === 'permission-denied')\n return t('chat.audio.permissionDenied');\n if (state.type === 'unsupported') return t('chat.audio.unsupported');\n return t('chat.audio.idle');\n }\n })();\n\n const isRecording = state.kind === 'recording';\n const isPaused = state.kind === 'paused';\n const hasError = state.kind === 'error';\n\n return (\n <div\n data-component=\"audio-recorder\"\n data-component-id={rest.id}\n className={rootVariants({ size, className })}\n {...rest}\n >\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span\n aria-hidden=\"true\"\n className={[\n 'ds:relative ds:inline-flex ds:size-3 ds:items-center ds:justify-center ds:rounded-[var(--radius-full)]',\n isRecording\n ? 'ds:bg-[color:var(--destructive)]'\n : 'ds:bg-[color:var(--muted)]',\n ].join(' ')}\n >\n {isRecording ? (\n <span\n className={[\n 'ds:absolute ds:inset-0 ds:rounded-[var(--radius-full)]',\n 'ds:bg-[color:var(--destructive)]',\n 'ds:motion-safe:animate-[recorder-pulse_1.2s_ease-out_infinite]',\n 'ds:[.theme-accessible_&]:animate-none',\n ].join(' ')}\n />\n ) : null}\n </span>\n <AudioVisualiser\n stream={stream}\n size=\"sm\"\n aria-hidden=\"true\"\n className=\"ds:flex-1\"\n />\n <time\n dir=\"ltr\"\n aria-hidden=\"true\"\n className=\"ds:tabular-nums type-meta ds:text-[color:var(--muted-foreground)]\"\n >\n {formatTimer(elapsedMs, i18n.language)}\n </time>\n </div>\n\n <span role=\"status\" aria-live=\"polite\" className=\"ds:sr-only\">\n {statusText}\n </span>\n\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n {state.kind === 'idle' || state.kind === 'stopped' || hasError ? (\n <Button\n intent=\"primary\"\n size=\"sm\"\n startIcon={<Mic />}\n onClick={requestAndStart}\n disabled={!supported}\n >\n {t('chat.audio.record')}\n </Button>\n ) : null}\n {isRecording ? (\n <IconButton\n icon={<Pause />}\n aria-label={t('chat.audio.pause')}\n intent=\"secondary\"\n size=\"sm\"\n onClick={pause}\n />\n ) : null}\n {isPaused ? (\n <IconButton\n icon={<Play />}\n aria-label={t('chat.audio.resume')}\n intent=\"secondary\"\n size=\"sm\"\n onClick={resume}\n />\n ) : null}\n {isRecording || isPaused ? (\n <>\n <IconButton\n icon={<Square />}\n aria-label={t('chat.audio.stop')}\n intent=\"primary\"\n size=\"sm\"\n onClick={stop}\n />\n <IconButton\n icon={<X />}\n aria-label={t('chat.audio.cancel')}\n intent=\"ghost\"\n size=\"sm\"\n onClick={cancel}\n />\n </>\n ) : null}\n {state.kind === 'idle' && deviceOptions.length > 1 ? (\n <div className=\"ds:ms-auto ds:min-w-[160px]\">\n <Select\n aria-label={t('chat.audio.selectDevice')}\n options={deviceOptions}\n value={selectedDeviceId}\n onValueChange={(v) => setSelectedDeviceId(v)}\n size=\"sm\"\n clearable\n />\n </div>\n ) : null}\n </div>\n\n {hasError && state.kind === 'error' ? (\n <Alert variant=\"error\" live=\"polite\">\n <Alert.Description>{statusText}</Alert.Description>\n {state.type === 'permission-denied' ? (\n <Alert.Action>\n <Button intent=\"ghost\" size=\"sm\" onClick={requestAndStart}>\n {t('chat.audio.retry')}\n </Button>\n </Alert.Action>\n ) : null}\n </Alert>\n ) : null}\n </div>\n );\n },\n);\n\nAudioRecorder.displayName = 'AudioRecorder';\n"],"names":["__iconNode","Pause","createLucideIcon","Play","audioRecorderAgent","handle","reducer","state","action","rootVariants","cva","MIME_PREFERENCES","pickMimeType","mime","formatTimer","ms","locale","total","minutes","seconds","fmt","n","AudioRecorder","forwardRef","size","onRecordingComplete","onCancel","onError","maxDurationMs","maxBytes","className","rest","ref","t","i18n","useTranslation","dispatch","useReducer","stream","setStream","useState","now","setNow","devices","setDevices","selectedDeviceId","setSelectedDeviceId","recorderRef","useRef","chunksRef","byteCountRef","durationAtStopRef","streamRef","unmountedRef","cancelledRef","perfStartRef","supported","useEffect","_a","list","mics","d","cleanupStream","useCallback","held","requestAndStart","nextStream","tr","mimeType","recorder","event","blob","err","errorName","pause","resume","stop","started","pausedMs","duration","cancel","alreadyElapsed","remaining","_b","elapsedMs","agentHandle","useMemo","useImperativeHandle","useAgentRegistration","deviceOptions","statusText","isRecording","isPaused","hasError","jsxs","jsx","AudioVisualiser","Button","Mic","IconButton","Fragment","Square","X","Select","v","Alert"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,MAAM,GAAG,KAAK,OAAO,KAAK,QAAQ,MAAM,IAAI,KAAK,KAAK,SAAQ,CAAE;AAAA,EAC9E,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,KAAK,OAAO,KAAK,QAAQ,MAAM,IAAI,KAAK,KAAK,SAAQ,CAAE;AAC/E,GACMC,KAAQC,EAAiB,SAASF,EAAU;ACblD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMG,KAAOD,EAAiB,QAAQF,EAAU,GCPnCI,KAAwD;AAAA,EACnE,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW,QAAQ;AAAA,EAClC,OAAO;AAAA,IACL,aAAa;AAAA,MACX,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,YAAA;AAAA,IAAY;AAAA,IAEvC,UAAU;AAAA,MACR,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,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A3C,GAAc,cAAc;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"audio-recorder-Cc3KuL9y.js","sources":["../../node_modules/lucide-react/dist/esm/icons/pause.mjs","../../node_modules/lucide-react/dist/esm/icons/play.mjs","../../src/components/audio-recorder/audio-recorder.agent.ts","../../src/components/audio-recorder/audio-recorder.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 [\"rect\", { x: \"14\", y: \"3\", width: \"5\", height: \"18\", rx: \"1\", key: \"kaeet6\" }],\n [\"rect\", { x: \"5\", y: \"3\", width: \"5\", height: \"18\", rx: \"1\", key: \"1wsw3u\" }]\n];\nconst Pause = createLucideIcon(\"pause\", __iconNode);\n\nexport { __iconNode, Pause as default };\n//# sourceMappingURL=pause.mjs.map\n","/**\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 [\n \"path\",\n {\n d: \"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\",\n key: \"10ikf1\"\n }\n ]\n];\nconst Play = createLucideIcon(\"play\", __iconNode);\n\nexport { __iconNode, Play as default };\n//# sourceMappingURL=play.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — AudioRecorder. */\n/* */\n/* Multi-step media-capture lifecycle (request → record → stop → submit / */\n/* discard). Exposes `capture` for the start/stop steps and `submit` for */\n/* the final commit via onRecordingComplete. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { AudioRecorderHandle } from './audio-recorder';\n\nexport const audioRecorderAgent: AgentAdapter<AudioRecorderHandle> = {\n id: 'audio-recorder',\n capabilities: ['capture', 'submit'],\n state: {\n isRecording: {\n type: 'boolean',\n descriptionKey: 'ui.agent.audioRecorder.state.isRecording',\n description: 'True while actively capturing audio (not paused).',\n read: (handle) => handle.isRecording(),\n },\n duration: {\n type: 'number',\n descriptionKey: 'ui.agent.audioRecorder.state.duration',\n description:\n 'Elapsed recording time in milliseconds (paused time excluded).',\n read: (handle) => handle.getDuration(),\n },\n hasRecording: {\n type: 'boolean',\n descriptionKey: 'ui.agent.audioRecorder.state.hasRecording',\n description:\n 'True when a completed recording is available for submission.',\n read: (handle) => handle.hasRecording(),\n },\n },\n actions: {\n start_recording: {\n safety: 'write',\n returns: 'void',\n descriptionKey: 'ui.agent.audioRecorder.actions.startRecording',\n description: 'Request microphone permission and begin recording.',\n errors: ['Microphone permission denied', 'No audio input device'],\n invoke: (handle) => handle.startRecording(),\n },\n stop_recording: {\n safety: 'write',\n descriptionKey: 'ui.agent.audioRecorder.actions.stopRecording',\n description: 'Stop the current recording and finalise the blob.',\n invoke: (handle) => {\n handle.stopRecording();\n },\n },\n discard: {\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.audioRecorder.actions.discard',\n description:\n 'Cancel the recording. Irreversible — the captured audio is dropped.',\n invoke: (handle) => {\n handle.discard();\n },\n },\n submit: {\n safety: 'write',\n descriptionKey: 'ui.agent.audioRecorder.actions.submit',\n description:\n 'Stop the active recording, finalising it via onRecordingComplete.',\n invoke: (handle) => {\n handle.stopRecording();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'audio-recorder',\n description: 'Marks the AudioRecorder wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useReducer,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Mic, Pause, Play, Square, X } from 'lucide-react';\nimport { IconButton, Button } from '../button';\nimport { Select, type SelectOption } from '../select/select';\nimport { AudioVisualiser } from '../audio-visualiser';\nimport { Alert } from '../alert';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { audioRecorderAgent } from './audio-recorder.agent';\n\ntype State =\n | { kind: 'idle' }\n | { kind: 'requesting' }\n | { kind: 'recording'; startedAt: number; pausedMs: number }\n | { kind: 'paused'; startedAt: number; pausedMs: number; pausedAt: number }\n | { kind: 'stopped'; duration: number }\n | {\n kind: 'error';\n type:\n | 'permission-denied'\n | 'no-device'\n | 'unsupported'\n | 'capture-failed';\n };\n\ntype Action =\n | { type: 'request' }\n | { type: 'start' }\n | { type: 'pause' }\n | { type: 'resume' }\n | { type: 'stop'; duration: number }\n | { type: 'cancel' }\n | {\n type: 'error';\n kind:\n | 'permission-denied'\n | 'no-device'\n | 'unsupported'\n | 'capture-failed';\n }\n | { type: 'reset' };\n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'request':\n return { kind: 'requesting' };\n case 'start':\n return { kind: 'recording', startedAt: Date.now(), pausedMs: 0 };\n case 'pause':\n if (state.kind !== 'recording') return state;\n return {\n kind: 'paused',\n startedAt: state.startedAt,\n pausedMs: state.pausedMs,\n pausedAt: Date.now(),\n };\n case 'resume':\n if (state.kind !== 'paused') return state;\n return {\n kind: 'recording',\n startedAt: state.startedAt,\n pausedMs: state.pausedMs + (Date.now() - state.pausedAt),\n };\n case 'stop':\n return { kind: 'stopped', duration: action.duration };\n case 'cancel':\n return { kind: 'idle' };\n case 'error':\n return { kind: 'error', type: action.kind };\n case 'reset':\n return { kind: 'idle' };\n default:\n return state;\n }\n}\n\nconst rootVariants = cva(\n [\n 'ds:inline-flex ds:flex-col ds:items-stretch ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'ds:bg-background',\n ].join(' '),\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\nconst MIME_PREFERENCES = [\n 'audio/webm;codecs=opus',\n 'audio/webm',\n 'audio/mp4',\n 'audio/ogg;codecs=opus',\n];\n\nfunction pickMimeType(): string | undefined {\n if (typeof MediaRecorder === 'undefined') return undefined;\n for (const mime of MIME_PREFERENCES) {\n if (MediaRecorder.isTypeSupported(mime)) return mime;\n }\n return undefined;\n}\n\nfunction formatTimer(ms: number, locale: string): string {\n const total = Math.max(0, Math.floor(ms / 1000));\n const minutes = Math.floor(total / 60);\n const seconds = total % 60;\n const fmt = (n: number) =>\n new Intl.NumberFormat(locale, { minimumIntegerDigits: 2 }).format(n);\n return `${fmt(minutes)}:${fmt(seconds)}`;\n}\n\n/** Curated imperative handle for agent / external automation. */\nexport interface AudioRecorderHandle {\n isRecording: () => boolean;\n getDuration: () => number;\n hasRecording: () => boolean;\n startRecording: () => Promise<void> | void;\n stopRecording: () => void;\n discard: () => void;\n}\n\nexport interface AudioRecorderProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onError'>,\n VariantProps<typeof rootVariants> {\n /** Called on stop with the final blob + duration in ms. */\n onRecordingComplete?: (blob: Blob, durationMs: number) => void;\n /** Called when recording is cancelled. */\n onCancel?: () => void;\n /** Called when an error occurs. */\n onError?: (\n error:\n | 'permission-denied'\n | 'no-device'\n | 'unsupported'\n | 'capture-failed'\n | 'max-duration'\n | 'max-size',\n ) => void;\n /**\n * Auto-stop after this many milliseconds of active recording. Default\n * 30 minutes. Set `null` to disable.\n */\n maxDurationMs?: number | null;\n /**\n * Auto-stop when the accumulated blob chunks exceed this many bytes.\n * Default 250 MB. Set `null` to disable.\n */\n maxBytes?: number | null;\n}\n\nexport const AudioRecorder = forwardRef<\n AudioRecorderHandle,\n AudioRecorderProps\n>(\n (\n {\n size = 'md',\n onRecordingComplete,\n onCancel,\n onError,\n maxDurationMs = 30 * 60 * 1000,\n maxBytes = 250 * 1024 * 1024,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const [state, dispatch] = useReducer(reducer, { kind: 'idle' });\n const [stream, setStream] = useState<MediaStream | null>(null);\n const [now, setNow] = useState<number>(Date.now());\n const [devices, setDevices] = useState<MediaDeviceInfo[]>([]);\n const [selectedDeviceId, setSelectedDeviceId] = useState<string>('');\n\n const recorderRef = useRef<MediaRecorder | null>(null);\n const chunksRef = useRef<Blob[]>([]);\n // Running total of bytes accumulated in `chunksRef` — reading\n // `chunksRef.current.reduce(...)` on every ondataavailable scales\n // poorly; maintain the sum incrementally instead.\n const byteCountRef = useRef<number>(0);\n const durationAtStopRef = useRef<number>(0);\n // Tracks the *currently-held* MediaStream in a ref so the unmount\n // cleanup effect (which closes over [] deps) sees the latest value.\n // Without this, a unmount while getUserMedia is pending would never\n // stop() tracks and the browser mic indicator stays on.\n const streamRef = useRef<MediaStream | null>(null);\n // Flips to true on unmount; consulted inside the getUserMedia promise\n // resolution so we don't try to setStream() on a dead component and\n // so the freshly-acquired tracks get released immediately.\n const unmountedRef = useRef<boolean>(false);\n // Flips to true when cancel() is called; the onstop handler reads it\n // so `onRecordingComplete` is NOT invoked on a cancel path with a blank\n // blob. Reset on each recording start.\n const cancelledRef = useRef<boolean>(false);\n // Monotonic `performance.now()` start timestamp for the max-duration\n // timer. Wall-clock `Date.now()` jumps on NTP / timezone changes.\n const perfStartRef = useRef<number>(0);\n\n const supported = typeof MediaRecorder !== 'undefined';\n\n /* ── Enumerate devices once (after any prior permission grant) ── */\n useEffect(() => {\n if (!supported || !navigator.mediaDevices?.enumerateDevices) return;\n navigator.mediaDevices\n .enumerateDevices()\n .then((list) => {\n const mics = list.filter((d) => d.kind === 'audioinput');\n setDevices(mics);\n })\n .catch(() => {\n /* ignore */\n });\n }, [supported]);\n\n /* ── Timer tick ── */\n useEffect(() => {\n if (state.kind !== 'recording') return;\n const handle = window.setInterval(() => setNow(Date.now()), 250);\n return () => window.clearInterval(handle);\n }, [state.kind]);\n\n const cleanupStream = useCallback(() => {\n const held = streamRef.current ?? stream;\n held?.getTracks().forEach((t) => t.stop());\n streamRef.current = null;\n setStream(null);\n }, [stream]);\n\n const requestAndStart = useCallback(async () => {\n if (!supported) {\n dispatch({ type: 'error', kind: 'unsupported' });\n onError?.('unsupported');\n return;\n }\n dispatch({ type: 'request' });\n cancelledRef.current = false;\n try {\n const nextStream = await navigator.mediaDevices.getUserMedia({\n audio: selectedDeviceId\n ? { deviceId: { exact: selectedDeviceId } }\n : true,\n });\n // Guard against unmount OR a cancel() between the permission prompt\n // and resolution — otherwise the freshly-acquired tracks leak and the\n // browser's mic indicator stays live, secretly capturing audio.\n if (unmountedRef.current || cancelledRef.current) {\n nextStream.getTracks().forEach((tr) => tr.stop());\n return;\n }\n streamRef.current = nextStream;\n setStream(nextStream);\n const mimeType = pickMimeType();\n const recorder = new MediaRecorder(\n nextStream,\n mimeType ? { mimeType } : undefined,\n );\n recorderRef.current = recorder;\n chunksRef.current = [];\n byteCountRef.current = 0;\n recorder.ondataavailable = (event) => {\n if (event.data && event.data.size > 0) {\n chunksRef.current.push(event.data);\n byteCountRef.current += event.data.size;\n // Byte-cap: auto-stop if the recording would exceed maxBytes.\n // Cheaper than summing on every tick; stop once and bail.\n if (\n typeof maxBytes === 'number' &&\n byteCountRef.current >= maxBytes &&\n recorderRef.current?.state === 'recording'\n ) {\n onError?.('max-size');\n try {\n recorderRef.current.stop();\n } catch {\n /* ignore */\n }\n }\n }\n };\n recorder.onstop = () => {\n // Cancel path: drop the blob on the floor — consumers who called\n // cancel() must not receive a silent empty recording.\n if (!cancelledRef.current) {\n const blob = new Blob(chunksRef.current, {\n type: mimeType ?? 'audio/webm',\n });\n onRecordingComplete?.(blob, durationAtStopRef.current);\n }\n chunksRef.current = [];\n recorderRef.current = null;\n nextStream.getTracks().forEach((tr) => tr.stop());\n streamRef.current = null;\n setStream(null);\n cancelledRef.current = false;\n };\n perfStartRef.current = performance.now();\n recorder.start(1000);\n dispatch({ type: 'start' });\n } catch (err: unknown) {\n const errorName = err instanceof Error ? err.name : '';\n if (errorName === 'NotAllowedError' || errorName === 'SecurityError') {\n dispatch({ type: 'error', kind: 'permission-denied' });\n onError?.('permission-denied');\n } else if (\n errorName === 'NotFoundError' ||\n errorName === 'OverconstrainedError'\n ) {\n dispatch({ type: 'error', kind: 'no-device' });\n onError?.('no-device');\n } else {\n dispatch({ type: 'error', kind: 'capture-failed' });\n onError?.('capture-failed');\n }\n }\n }, [onError, onRecordingComplete, selectedDeviceId, supported]);\n\n const pause = useCallback(() => {\n recorderRef.current?.pause();\n dispatch({ type: 'pause' });\n }, []);\n\n const resume = useCallback(() => {\n recorderRef.current?.resume();\n dispatch({ type: 'resume' });\n }, []);\n\n const stop = useCallback(() => {\n if (state.kind === 'recording' || state.kind === 'paused') {\n const started = state.startedAt;\n const pausedMs = state.pausedMs;\n const duration = Date.now() - started - pausedMs;\n durationAtStopRef.current = Math.max(0, duration);\n dispatch({ type: 'stop', duration: duration });\n }\n try {\n recorderRef.current?.stop();\n } catch {\n /* stop() throws on non-recording state; safe to swallow */\n }\n }, [state]);\n\n const cancel = useCallback(() => {\n // Flip the cancelled flag BEFORE asking MediaRecorder to stop so the\n // async onstop handler sees it and skips onRecordingComplete.\n cancelledRef.current = true;\n try {\n recorderRef.current?.stop();\n } catch {\n /* ignore */\n }\n chunksRef.current = [];\n recorderRef.current = null;\n cleanupStream();\n dispatch({ type: 'cancel' });\n onCancel?.();\n }, [cleanupStream, onCancel]);\n\n /* ── Max-duration auto-stop ── */\n useEffect(() => {\n if (state.kind !== 'recording') return;\n if (typeof maxDurationMs !== 'number' || maxDurationMs <= 0) return;\n // Use the monotonic clock so an NTP / timezone jump mid-recording\n // doesn't skew the remaining-time calc.\n const alreadyElapsed =\n performance.now() - perfStartRef.current - state.pausedMs;\n const remaining = Math.max(0, maxDurationMs - alreadyElapsed);\n const handle = window.setTimeout(() => {\n if (recorderRef.current?.state === 'recording') {\n onError?.('max-duration');\n try {\n recorderRef.current.stop();\n } catch {\n /* ignore */\n }\n }\n }, remaining);\n return () => window.clearTimeout(handle);\n }, [state, maxDurationMs, onError]);\n\n /* ── Unmount cleanup: release mic if still held ── */\n useEffect(() => {\n return () => {\n unmountedRef.current = true;\n try {\n recorderRef.current?.stop();\n } catch {\n /* ignore */\n }\n // Use streamRef so we see a stream that was acquired by an\n // in-flight getUserMedia resolution — not just the one captured\n // by the closure at mount.\n streamRef.current?.getTracks().forEach((tr) => tr.stop());\n streamRef.current = null;\n };\n }, []);\n\n const elapsedMs =\n state.kind === 'recording'\n ? now - state.startedAt - state.pausedMs\n : state.kind === 'paused'\n ? state.pausedAt - state.startedAt - state.pausedMs\n : state.kind === 'stopped'\n ? state.duration\n : 0;\n\n const agentHandle = useMemo<AudioRecorderHandle>(\n () => ({\n isRecording: () => state.kind === 'recording',\n getDuration: () => elapsedMs,\n hasRecording: () => state.kind === 'stopped',\n startRecording: () => requestAndStart(),\n stopRecording: () => stop(),\n discard: () => cancel(),\n }),\n [state, elapsedMs, requestAndStart, stop, cancel],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(audioRecorderAgent, agentHandle, rest.id);\n\n const deviceOptions: SelectOption<string>[] = devices.map((d) => ({\n value: d.deviceId,\n label: d.label || t('chat.audio.selectDevice'),\n }));\n\n const statusText = (() => {\n switch (state.kind) {\n case 'idle':\n return t('chat.audio.idle');\n case 'requesting':\n return t('common.loading');\n case 'recording':\n return t('chat.audio.recording');\n case 'paused':\n return t('chat.audio.paused');\n case 'stopped':\n return t('chat.audio.idle');\n case 'error':\n if (state.type === 'permission-denied')\n return t('chat.audio.permissionDenied');\n if (state.type === 'unsupported') return t('chat.audio.unsupported');\n return t('chat.audio.idle');\n }\n })();\n\n const isRecording = state.kind === 'recording';\n const isPaused = state.kind === 'paused';\n const hasError = state.kind === 'error';\n\n return (\n <div\n data-component=\"audio-recorder\"\n data-component-id={rest.id}\n className={rootVariants({ size, className })}\n {...rest}\n >\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span\n aria-hidden=\"true\"\n className={[\n 'ds:relative ds:inline-flex ds:size-3 ds:items-center ds:justify-center ds:rounded-[var(--radius-full)]',\n isRecording\n ? 'ds:bg-[color:var(--destructive)]'\n : 'ds:bg-[color:var(--muted)]',\n ].join(' ')}\n >\n {isRecording ? (\n <span\n className={[\n 'ds:absolute ds:inset-0 ds:rounded-[var(--radius-full)]',\n 'ds:bg-[color:var(--destructive)]',\n 'ds:motion-safe:animate-[recorder-pulse_1.2s_ease-out_infinite]',\n 'ds:[.theme-accessible_&]:animate-none',\n ].join(' ')}\n />\n ) : null}\n </span>\n <AudioVisualiser\n stream={stream}\n size=\"sm\"\n aria-hidden=\"true\"\n className=\"ds:flex-1\"\n />\n <time\n dir=\"ltr\"\n aria-hidden=\"true\"\n className=\"ds:tabular-nums type-meta ds:text-[color:var(--muted-foreground)]\"\n >\n {formatTimer(elapsedMs, i18n.language)}\n </time>\n </div>\n\n <span role=\"status\" aria-live=\"polite\" className=\"ds:sr-only\">\n {statusText}\n </span>\n\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n {state.kind === 'idle' || state.kind === 'stopped' || hasError ? (\n <Button\n intent=\"primary\"\n size=\"sm\"\n startIcon={<Mic />}\n onClick={requestAndStart}\n disabled={!supported}\n >\n {t('chat.audio.record')}\n </Button>\n ) : null}\n {isRecording ? (\n <IconButton\n icon={<Pause />}\n aria-label={t('chat.audio.pause')}\n intent=\"secondary\"\n size=\"sm\"\n onClick={pause}\n />\n ) : null}\n {isPaused ? (\n <IconButton\n icon={<Play />}\n aria-label={t('chat.audio.resume')}\n intent=\"secondary\"\n size=\"sm\"\n onClick={resume}\n />\n ) : null}\n {isRecording || isPaused ? (\n <>\n <IconButton\n icon={<Square />}\n aria-label={t('chat.audio.stop')}\n intent=\"primary\"\n size=\"sm\"\n onClick={stop}\n />\n <IconButton\n icon={<X />}\n aria-label={t('chat.audio.cancel')}\n intent=\"ghost\"\n size=\"sm\"\n onClick={cancel}\n />\n </>\n ) : null}\n {state.kind === 'idle' && deviceOptions.length > 1 ? (\n <div className=\"ds:ms-auto ds:min-w-[160px]\">\n <Select\n aria-label={t('chat.audio.selectDevice')}\n options={deviceOptions}\n value={selectedDeviceId}\n onValueChange={(v) => setSelectedDeviceId(v)}\n size=\"sm\"\n clearable\n />\n </div>\n ) : null}\n </div>\n\n {hasError && state.kind === 'error' ? (\n <Alert variant=\"error\" live=\"polite\">\n <Alert.Description>{statusText}</Alert.Description>\n {state.type === 'permission-denied' ? (\n <Alert.Action>\n <Button intent=\"ghost\" size=\"sm\" onClick={requestAndStart}>\n {t('chat.audio.retry')}\n </Button>\n </Alert.Action>\n ) : null}\n </Alert>\n ) : null}\n </div>\n );\n },\n);\n\nAudioRecorder.displayName = 'AudioRecorder';\n"],"names":["__iconNode","Pause","createLucideIcon","Play","audioRecorderAgent","handle","reducer","state","action","rootVariants","cva","MIME_PREFERENCES","pickMimeType","mime","formatTimer","ms","locale","total","minutes","seconds","fmt","n","AudioRecorder","forwardRef","size","onRecordingComplete","onCancel","onError","maxDurationMs","maxBytes","className","rest","ref","t","i18n","useTranslation","dispatch","useReducer","stream","setStream","useState","now","setNow","devices","setDevices","selectedDeviceId","setSelectedDeviceId","recorderRef","useRef","chunksRef","byteCountRef","durationAtStopRef","streamRef","unmountedRef","cancelledRef","perfStartRef","supported","useEffect","_a","list","mics","d","cleanupStream","useCallback","held","requestAndStart","nextStream","tr","mimeType","recorder","event","blob","err","errorName","pause","resume","stop","started","pausedMs","duration","cancel","alreadyElapsed","remaining","_b","elapsedMs","agentHandle","useMemo","useImperativeHandle","useAgentRegistration","deviceOptions","statusText","isRecording","isPaused","hasError","jsxs","jsx","AudioVisualiser","Button","Mic","IconButton","Fragment","Square","X","Select","v","Alert"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;A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AA;AAAA,YACX,EAAA,CACF,IACE;AAAA,YACHzE,EAAM,SAAS,UAAUkF,EAAc,SAAS,IAC/C,gBAAAM,EAAC,OAAA,EAAI,WAAU,+BACb,UAAA,gBAAAA;AAAA,cAACQ;AAAA,cAAA;AAAA,gBACC,cAAYtE,EAAE,yBAAyB;AAAA,gBACvC,SAASwD;AAAA,gBACT,OAAO5C;AAAA,gBACP,eAAe,CAAC2D,MAAM1D,GAAoB0D,CAAC;AAAA,gBAC3C,MAAK;AAAA,gBACL,WAAS;AAAA,cAAA;AAAA,YAAA,GAEb,IACE;AAAA,UAAA,GACN;AAAA,UAECX,KAAYtF,EAAM,SAAS,4BACzBkG,GAAA,EAAM,SAAQ,SAAQ,MAAK,UAC1B,UAAA;AAAA,YAAA,gBAAAV,EAACU,EAAM,aAAN,EAAmB,UAAAf,EAAA,CAAW;AAAA,YAC9BnF,EAAM,SAAS,wCACbkG,EAAM,QAAN,EACC,UAAA,gBAAAV,EAACE,GAAA,EAAO,QAAO,SAAQ,MAAK,MAAK,SAAShC,GACvC,YAAE,kBAAkB,GACvB,GACF,IACE;AAAA,UAAA,EAAA,CACN,IACE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEA3C,GAAc,cAAc;","x_google_ignoreList":[0,1]}
@@ -4,7 +4,7 @@ import { c as A } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as K } from "react-i18next";
5
5
  import { u as L } from "./registry-DvAUVLHh.js";
6
6
  import { F } from "./form-field-M5UpX65Z.js";
7
- import { S as H } from "./select-BmCbJMJS.js";
7
+ import { S as H } from "./select-BW5ecXlX.js";
8
8
  import { C as O } from "./card-DPmk26CL.js";
9
9
  import { B as M } from "./badge-DCOqV9mI.js";
10
10
  import { I as j } from "./insert-result-D074GtHX.js";
@@ -301,4 +301,4 @@ export {
301
301
  V as d,
302
302
  G as e
303
303
  };
304
- //# sourceMappingURL=bishop-score-Bs6t6Zv1.js.map
304
+ //# sourceMappingURL=bishop-score-DDW5-gb9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bishop-score-Bs6t6Zv1.js","sources":["../../src/components/bishop-score/bishop-score.agent.ts","../../src/components/bishop-score/bishop.ts","../../src/components/bishop-score/bishop-score.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — BishopScore. */\n/* */\n/* Cervical-favourability calculator. The agent-relevant surface is the */\n/* read-only computed result (total + band) plus the five enumerated */\n/* findings, and `set_value` actions to drive each finding. NO patient */\n/* identity is ever exposed — only the structural exam findings and the */\n/* derived score. The handle is the curated `BishopScoreHandle`, never */\n/* React state. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { BishopScoreHandle } from './bishop-score';\nimport type { BishopComponent } from './bishop';\n\n/**\n * Enumerated finding ids, mirrored from `./bishop`'s `BISHOP_COMPONENTS`.\n * Inlined as a literal (rather than runtime-imported) so the ESM catalog\n * build can load this pure module without TS path resolution. The `satisfies`\n * keeps it in lockstep with the `BishopComponent` union at compile time.\n */\nconst COMPONENT_IDS = [\n 'dilation',\n 'effacement',\n 'station',\n 'consistency',\n 'position',\n] as const satisfies readonly BishopComponent[];\n\nexport const bishopScoreAgent: AgentAdapter<BishopScoreHandle> = {\n id: 'bishop-score',\n capabilities: ['set_value'],\n state: {\n selection: {\n type: 'Partial<Record<BishopComponent, string>>',\n descriptionKey: 'ui.agent.bishopScore.state.selection',\n description:\n 'The five cervical-exam findings keyed by component (dilation, effacement, station, consistency, position). Each value is an enumerated option key, not free text.',\n read: (handle) => handle.getSelection(),\n },\n result: {\n type: '{ total: number, band: string } | null',\n descriptionKey: 'ui.agent.bishopScore.state.result',\n description:\n 'Computed Bishop result — total (0–13) and favourability band (unfavourable / intermediate / favourable). Null until all five findings are set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ component: BishopComponent, value: string }',\n argsSchema: {\n type: 'object',\n properties: {\n component: {\n enum: [...COMPONENT_IDS],\n description: 'Which cervical-exam finding to set.',\n },\n value: {\n type: 'string',\n description:\n 'Enumerated option key for that finding (e.g. dilation \"closed\" | \"1-2\" | \"3-4\" | \"5+\").',\n },\n },\n required: ['component', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.bishopScore.actions.setValue',\n description:\n 'Set one cervical-exam finding to an enumerated option value. Unknown component/value pairs are ignored.',\n examples: [\n {\n args: { component: 'dilation', value: '3-4' },\n note: 'Record cervical dilation of 3–4 cm (2 points).',\n },\n ],\n invoke: (handle, args: { component: BishopComponent; value: string }) => {\n handle.setComponent(args.component, args.value);\n },\n },\n reset: {\n safety: 'write',\n idempotent: true,\n descriptionKey: 'ui.agent.bishopScore.actions.reset',\n description: 'Clear all five findings and the computed result.',\n invoke: (handle) => {\n handle.reset();\n },\n },\n get_result: {\n safety: 'read',\n returns: '{ total: number, band: string } | null',\n returnsSchema: {\n oneOf: [\n {\n type: 'object',\n properties: {\n total: { type: 'integer', minimum: 0, maximum: 13 },\n band: {\n enum: ['unfavourable', 'intermediate', 'favourable'],\n },\n },\n required: ['total', 'band'],\n },\n { type: 'null' },\n ],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.bishopScore.actions.getResult',\n description:\n 'Return the computed Bishop result, or null until all five findings are set.',\n invoke: (handle) => handle.getResult(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'bishop-score',\n description: 'Marks the BishopScore calculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific calculator instance.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Bishop score — cervical favourability for induction of labour. */\n/* */\n/* Pure, framework-free, unit-testable. Five components scored 0–3 */\n/* (dilation, effacement, station) or 0–2 (consistency, position), */\n/* summed to a 0–13 total. Bands per ACOG: ≤6 unfavourable (cervical */\n/* ripening advised), 7 intermediate, ≥8 favourable. */\n/* */\n/* Bishop EH, Obstet Gynecol 1964; thresholds per ACOG Practice */\n/* Bulletin 107 (Induction of Labor). */\n/* ------------------------------------------------------------------ */\n\nexport type BishopComponent =\n | 'dilation'\n | 'effacement'\n | 'station'\n | 'consistency'\n | 'position';\n\n/** The component fields in the order they are scored / displayed. */\nexport const BISHOP_COMPONENTS: readonly BishopComponent[] = [\n 'dilation',\n 'effacement',\n 'station',\n 'consistency',\n 'position',\n] as const;\n\nexport interface BishopOption {\n /** Stable value key → i18n lookup `bishopScore.<component>.<value>`. */\n value: string;\n /** Points this option contributes. */\n score: number;\n}\n\n/**\n * Scored options per component. Dilation / effacement / station run 0–3;\n * consistency / position run 0–2 (the classic Bishop weighting).\n */\nexport const BISHOP_OPTIONS: Record<BishopComponent, BishopOption[]> = {\n dilation: [\n { value: 'closed', score: 0 },\n { value: '1-2', score: 1 },\n { value: '3-4', score: 2 },\n { value: '5+', score: 3 },\n ],\n effacement: [\n { value: '0-30', score: 0 },\n { value: '40-50', score: 1 },\n { value: '60-70', score: 2 },\n { value: '80+', score: 3 },\n ],\n station: [\n { value: '-3', score: 0 },\n { value: '-2', score: 1 },\n { value: '-1-0', score: 2 },\n { value: '+1+2', score: 3 },\n ],\n consistency: [\n { value: 'firm', score: 0 },\n { value: 'medium', score: 1 },\n { value: 'soft', score: 2 },\n ],\n position: [\n { value: 'posterior', score: 0 },\n { value: 'mid', score: 1 },\n { value: 'anterior', score: 2 },\n ],\n};\n\nexport type BishopBand = 'unfavourable' | 'intermediate' | 'favourable';\n\n/** Highest attainable total (3 + 3 + 3 + 2 + 2). */\nexport const BISHOP_MAX_SCORE = 13;\n\n/** Classify a total into a favourability band (ACOG thresholds). */\nexport function bishopBand(total: number): BishopBand {\n if (total <= 6) return 'unfavourable';\n if (total >= 8) return 'favourable';\n return 'intermediate';\n}\n\nexport type BishopSelection = Partial<Record<BishopComponent, string>>;\n\nexport interface BishopResult {\n total: number;\n band: BishopBand;\n}\n\n/** Look up the score for a component's selected option, or `null` if unknown. */\nfunction scoreFor(component: BishopComponent, value: string): number | null {\n return (\n BISHOP_OPTIONS[component].find((o) => o.value === value)?.score ?? null\n );\n}\n\n/**\n * Sum the Bishop score. Returns `null` until every one of the five components\n * has a valid selection (a partial exam doesn't yield a meaningful total).\n */\nexport function bishopScore(selection: BishopSelection): BishopResult | null {\n let total = 0;\n for (const component of BISHOP_COMPONENTS) {\n const value = selection[component];\n if (value === undefined) return null;\n const score = scoreFor(component, value);\n if (score === null) return null;\n total += score;\n }\n return { total, band: bishopBand(total) };\n}\n","/* ------------------------------------------------------------------ */\n/* BishopScore — cervical favourability for induction of labour. */\n/* */\n/* Five enumerated cervical-exam findings → a 0–13 total with a */\n/* favourability band. Maths lives in `./bishop` (pure, tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { bishopScoreAgent } from './bishop-score.agent';\nimport { FormField } from '../form-field';\nimport { Select } from '../select';\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 BishopComponent,\n type BishopSelection,\n type BishopResult,\n type BishopBand,\n BISHOP_COMPONENTS,\n BISHOP_OPTIONS,\n BISHOP_MAX_SCORE,\n bishopScore,\n} from './bishop';\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/** Band → on-screen Badge variant + inserted-card chip token. */\nconst BAND_BADGE: Record<BishopBand, 'warning' | 'info' | 'success'> = {\n unfavourable: 'warning',\n intermediate: 'info',\n favourable: 'success',\n};\nconst BAND_TOKEN: Record<BishopBand, string> = {\n unfavourable: '--warning-readable',\n intermediate: '--info',\n favourable: '--success',\n};\n\nexport interface BishopScoreProps extends VariantProps<typeof rootVariants> {\n /** Fires whenever all five findings are set (and `null` when not). */\n onResultChange?: (result: BishopResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /** Which verb the result button performs. Defaults to `'insert'`. */\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 /** Brand wordmark printed in the inserted/copied result-card footer. */\n insertBrand?: string | false;\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 * Curated imperative handle for agent / external automation. Exposes the\n * structural exam findings + computed result and lets a caller set one\n * finding at a time. Never exposes patient identity. Consumed by the\n * `bishop-score.agent.ts` adapter; the public `ref` stays the DOM element.\n */\nexport interface BishopScoreHandle {\n /** Snapshot of the five findings keyed by component. */\n getSelection: () => BishopSelection;\n /** Current computed result, or null until all five findings are set. */\n getResult: () => BishopResult | null;\n /** Set one finding to an enumerated option value (unknown pairs are ignored). */\n setComponent: (component: BishopComponent, value: string) => void;\n /** Clear all findings. */\n reset: () => void;\n}\n\nexport const BishopScore = forwardRef<HTMLDivElement, BishopScoreProps>(\n (\n {\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n\n const [selection, setSelection] = useState<BishopSelection>({});\n\n const result = useMemo(() => bishopScore(selection), [selection]);\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n // Live refs so the once-built agent handle reads/writes current state\n // without re-creating on every keystroke. Public `ref` stays the DOM node.\n const selectionRef = useRef(selection);\n selectionRef.current = selection;\n const resultRef = useRef(result);\n resultRef.current = result;\n const agentHandle = useMemo<BishopScoreHandle>(\n () => ({\n getSelection: () => ({ ...selectionRef.current }),\n getResult: () => resultRef.current,\n setComponent: (component, value) => {\n const allowed = BISHOP_OPTIONS[component]?.some(\n (o) => o.value === value,\n );\n if (!allowed) return;\n setSelection((prev) => ({ ...prev, [component]: value }));\n },\n reset: () => setSelection({}),\n }),\n [],\n );\n useAgentRegistration(bishopScoreAgent, agentHandle, id);\n\n const optionsFor = (component: BishopComponent) =>\n BISHOP_OPTIONS[component].map((o) => ({\n value: o.value,\n label: t(`bishopScore.${component}.${o.value}`),\n }));\n\n const bandLabel = (band: BishopBand): string =>\n t(`bishopScore.band.${band}`);\n\n return (\n <div\n ref={ref}\n data-component=\"bishop-score\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n {BISHOP_COMPONENTS.map((component) => (\n <FormField\n key={component}\n label={t(`bishopScore.${component}.label`)}\n >\n <Select\n options={optionsFor(component)}\n value={selection[component] ?? ''}\n onValueChange={(next) =>\n setSelection((prev) => ({ ...prev, [component]: next }))\n }\n />\n </FormField>\n ))}\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('bishopScore.totalLabel')}: ${t('bishopScore.scoreOf', {\n score: result.total,\n max: BISHOP_MAX_SCORE,\n })}. ${bandLabel(result.band)}.`\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-2\">\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('bishopScore.totalLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {t('bishopScore.scoreOf', {\n score: result.total,\n max: BISHOP_MAX_SCORE,\n })}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-end ds:gap-[var(--spacing-xs)] ds:text-end\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('bishopScore.bandLabel')}\n </dt>\n <dd>\n <Badge variant={BAND_BADGE[result.band]} size=\"lg\">\n {bandLabel(result.band)}\n </Badge>\n </dd>\n </div>\n </dl>\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t(`bishopScore.interpretation.${result.band}`)}\n </p>\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n onInsert={onInsert}\n variant={insertVariant}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.bishop'),\n icon: 'activity',\n highlight: bandLabel(result.band),\n highlightToken: BAND_TOKEN[result.band],\n brand: insertBrand,\n fields: [\n {\n icon: 'percent',\n label: t('bishopScore.totalLabel'),\n value: t('bishopScore.scoreOf', {\n score: result.total,\n max: BISHOP_MAX_SCORE,\n }),\n },\n {\n icon: 'tag',\n label: t('bishopScore.bandLabel'),\n value: bandLabel(result.band),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('bishopScore.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nBishopScore.displayName = 'BishopScore';\n"],"names":["COMPONENT_IDS","bishopScoreAgent","handle","args","BISHOP_COMPONENTS","BISHOP_OPTIONS","BISHOP_MAX_SCORE","bishopBand","total","scoreFor","component","value","_a","o","bishopScore","selection","score","rootVariants","cva","BAND_BADGE","BAND_TOKEN","BishopScore","forwardRef","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","useTranslation","setSelection","useState","result","useMemo","useEffect","selectionRef","useRef","resultRef","agentHandle","prev","useAgentRegistration","optionsFor","bandLabel","band","jsxs","jsx","FormField","Select","next","Card","Badge","InsertButton"],"mappings":";;;;;;;;;;AAqBA,MAAMA,IAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF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,MAAM;AAAA,sBACN,OAAO2B,EAAE,uBAAuB;AAAA,sBAChC,OAAOc,EAAUV,EAAO,IAAI;AAAA,oBAAA;AAAA,kBAC9B;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,EAAA,CACN,EAAA,CACF,IAEA,gBAAAa,EAAC,KAAA,EAAE,WAAU,sCACV,UAAAjB,EAAE,mBAAmB,EAAA,CACxB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAZ,EAAY,cAAc;"}
1
+ {"version":3,"file":"bishop-score-DDW5-gb9.js","sources":["../../src/components/bishop-score/bishop-score.agent.ts","../../src/components/bishop-score/bishop.ts","../../src/components/bishop-score/bishop-score.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — BishopScore. */\n/* */\n/* Cervical-favourability calculator. The agent-relevant surface is the */\n/* read-only computed result (total + band) plus the five enumerated */\n/* findings, and `set_value` actions to drive each finding. NO patient */\n/* identity is ever exposed — only the structural exam findings and the */\n/* derived score. The handle is the curated `BishopScoreHandle`, never */\n/* React state. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { BishopScoreHandle } from './bishop-score';\nimport type { BishopComponent } from './bishop';\n\n/**\n * Enumerated finding ids, mirrored from `./bishop`'s `BISHOP_COMPONENTS`.\n * Inlined as a literal (rather than runtime-imported) so the ESM catalog\n * build can load this pure module without TS path resolution. The `satisfies`\n * keeps it in lockstep with the `BishopComponent` union at compile time.\n */\nconst COMPONENT_IDS = [\n 'dilation',\n 'effacement',\n 'station',\n 'consistency',\n 'position',\n] as const satisfies readonly BishopComponent[];\n\nexport const bishopScoreAgent: AgentAdapter<BishopScoreHandle> = {\n id: 'bishop-score',\n capabilities: ['set_value'],\n state: {\n selection: {\n type: 'Partial<Record<BishopComponent, string>>',\n descriptionKey: 'ui.agent.bishopScore.state.selection',\n description:\n 'The five cervical-exam findings keyed by component (dilation, effacement, station, consistency, position). Each value is an enumerated option key, not free text.',\n read: (handle) => handle.getSelection(),\n },\n result: {\n type: '{ total: number, band: string } | null',\n descriptionKey: 'ui.agent.bishopScore.state.result',\n description:\n 'Computed Bishop result — total (0–13) and favourability band (unfavourable / intermediate / favourable). Null until all five findings are set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ component: BishopComponent, value: string }',\n argsSchema: {\n type: 'object',\n properties: {\n component: {\n enum: [...COMPONENT_IDS],\n description: 'Which cervical-exam finding to set.',\n },\n value: {\n type: 'string',\n description:\n 'Enumerated option key for that finding (e.g. dilation \"closed\" | \"1-2\" | \"3-4\" | \"5+\").',\n },\n },\n required: ['component', 'value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.bishopScore.actions.setValue',\n description:\n 'Set one cervical-exam finding to an enumerated option value. Unknown component/value pairs are ignored.',\n examples: [\n {\n args: { component: 'dilation', value: '3-4' },\n note: 'Record cervical dilation of 3–4 cm (2 points).',\n },\n ],\n invoke: (handle, args: { component: BishopComponent; value: string }) => {\n handle.setComponent(args.component, args.value);\n },\n },\n reset: {\n safety: 'write',\n idempotent: true,\n descriptionKey: 'ui.agent.bishopScore.actions.reset',\n description: 'Clear all five findings and the computed result.',\n invoke: (handle) => {\n handle.reset();\n },\n },\n get_result: {\n safety: 'read',\n returns: '{ total: number, band: string } | null',\n returnsSchema: {\n oneOf: [\n {\n type: 'object',\n properties: {\n total: { type: 'integer', minimum: 0, maximum: 13 },\n band: {\n enum: ['unfavourable', 'intermediate', 'favourable'],\n },\n },\n required: ['total', 'band'],\n },\n { type: 'null' },\n ],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.bishopScore.actions.getResult',\n description:\n 'Return the computed Bishop result, or null until all five findings are set.',\n invoke: (handle) => handle.getResult(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'bishop-score',\n description: 'Marks the BishopScore calculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific calculator instance.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Bishop score — cervical favourability for induction of labour. */\n/* */\n/* Pure, framework-free, unit-testable. Five components scored 0–3 */\n/* (dilation, effacement, station) or 0–2 (consistency, position), */\n/* summed to a 0–13 total. Bands per ACOG: ≤6 unfavourable (cervical */\n/* ripening advised), 7 intermediate, ≥8 favourable. */\n/* */\n/* Bishop EH, Obstet Gynecol 1964; thresholds per ACOG Practice */\n/* Bulletin 107 (Induction of Labor). */\n/* ------------------------------------------------------------------ */\n\nexport type BishopComponent =\n | 'dilation'\n | 'effacement'\n | 'station'\n | 'consistency'\n | 'position';\n\n/** The component fields in the order they are scored / displayed. */\nexport const BISHOP_COMPONENTS: readonly BishopComponent[] = [\n 'dilation',\n 'effacement',\n 'station',\n 'consistency',\n 'position',\n] as const;\n\nexport interface BishopOption {\n /** Stable value key → i18n lookup `bishopScore.<component>.<value>`. */\n value: string;\n /** Points this option contributes. */\n score: number;\n}\n\n/**\n * Scored options per component. Dilation / effacement / station run 0–3;\n * consistency / position run 0–2 (the classic Bishop weighting).\n */\nexport const BISHOP_OPTIONS: Record<BishopComponent, BishopOption[]> = {\n dilation: [\n { value: 'closed', score: 0 },\n { value: '1-2', score: 1 },\n { value: '3-4', score: 2 },\n { value: '5+', score: 3 },\n ],\n effacement: [\n { value: '0-30', score: 0 },\n { value: '40-50', score: 1 },\n { value: '60-70', score: 2 },\n { value: '80+', score: 3 },\n ],\n station: [\n { value: '-3', score: 0 },\n { value: '-2', score: 1 },\n { value: '-1-0', score: 2 },\n { value: '+1+2', score: 3 },\n ],\n consistency: [\n { value: 'firm', score: 0 },\n { value: 'medium', score: 1 },\n { value: 'soft', score: 2 },\n ],\n position: [\n { value: 'posterior', score: 0 },\n { value: 'mid', score: 1 },\n { value: 'anterior', score: 2 },\n ],\n};\n\nexport type BishopBand = 'unfavourable' | 'intermediate' | 'favourable';\n\n/** Highest attainable total (3 + 3 + 3 + 2 + 2). */\nexport const BISHOP_MAX_SCORE = 13;\n\n/** Classify a total into a favourability band (ACOG thresholds). */\nexport function bishopBand(total: number): BishopBand {\n if (total <= 6) return 'unfavourable';\n if (total >= 8) return 'favourable';\n return 'intermediate';\n}\n\nexport type BishopSelection = Partial<Record<BishopComponent, string>>;\n\nexport interface BishopResult {\n total: number;\n band: BishopBand;\n}\n\n/** Look up the score for a component's selected option, or `null` if unknown. */\nfunction scoreFor(component: BishopComponent, value: string): number | null {\n return (\n BISHOP_OPTIONS[component].find((o) => o.value === value)?.score ?? null\n );\n}\n\n/**\n * Sum the Bishop score. Returns `null` until every one of the five components\n * has a valid selection (a partial exam doesn't yield a meaningful total).\n */\nexport function bishopScore(selection: BishopSelection): BishopResult | null {\n let total = 0;\n for (const component of BISHOP_COMPONENTS) {\n const value = selection[component];\n if (value === undefined) return null;\n const score = scoreFor(component, value);\n if (score === null) return null;\n total += score;\n }\n return { total, band: bishopBand(total) };\n}\n","/* ------------------------------------------------------------------ */\n/* BishopScore — cervical favourability for induction of labour. */\n/* */\n/* Five enumerated cervical-exam findings → a 0–13 total with a */\n/* favourability band. Maths lives in `./bishop` (pure, tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { bishopScoreAgent } from './bishop-score.agent';\nimport { FormField } from '../form-field';\nimport { Select } from '../select';\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 BishopComponent,\n type BishopSelection,\n type BishopResult,\n type BishopBand,\n BISHOP_COMPONENTS,\n BISHOP_OPTIONS,\n BISHOP_MAX_SCORE,\n bishopScore,\n} from './bishop';\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/** Band → on-screen Badge variant + inserted-card chip token. */\nconst BAND_BADGE: Record<BishopBand, 'warning' | 'info' | 'success'> = {\n unfavourable: 'warning',\n intermediate: 'info',\n favourable: 'success',\n};\nconst BAND_TOKEN: Record<BishopBand, string> = {\n unfavourable: '--warning-readable',\n intermediate: '--info',\n favourable: '--success',\n};\n\nexport interface BishopScoreProps extends VariantProps<typeof rootVariants> {\n /** Fires whenever all five findings are set (and `null` when not). */\n onResultChange?: (result: BishopResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /** Which verb the result button performs. Defaults to `'insert'`. */\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 /** Brand wordmark printed in the inserted/copied result-card footer. */\n insertBrand?: string | false;\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 * Curated imperative handle for agent / external automation. Exposes the\n * structural exam findings + computed result and lets a caller set one\n * finding at a time. Never exposes patient identity. Consumed by the\n * `bishop-score.agent.ts` adapter; the public `ref` stays the DOM element.\n */\nexport interface BishopScoreHandle {\n /** Snapshot of the five findings keyed by component. */\n getSelection: () => BishopSelection;\n /** Current computed result, or null until all five findings are set. */\n getResult: () => BishopResult | null;\n /** Set one finding to an enumerated option value (unknown pairs are ignored). */\n setComponent: (component: BishopComponent, value: string) => void;\n /** Clear all findings. */\n reset: () => void;\n}\n\nexport const BishopScore = forwardRef<HTMLDivElement, BishopScoreProps>(\n (\n {\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n\n const [selection, setSelection] = useState<BishopSelection>({});\n\n const result = useMemo(() => bishopScore(selection), [selection]);\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n // Live refs so the once-built agent handle reads/writes current state\n // without re-creating on every keystroke. Public `ref` stays the DOM node.\n const selectionRef = useRef(selection);\n selectionRef.current = selection;\n const resultRef = useRef(result);\n resultRef.current = result;\n const agentHandle = useMemo<BishopScoreHandle>(\n () => ({\n getSelection: () => ({ ...selectionRef.current }),\n getResult: () => resultRef.current,\n setComponent: (component, value) => {\n const allowed = BISHOP_OPTIONS[component]?.some(\n (o) => o.value === value,\n );\n if (!allowed) return;\n setSelection((prev) => ({ ...prev, [component]: value }));\n },\n reset: () => setSelection({}),\n }),\n [],\n );\n useAgentRegistration(bishopScoreAgent, agentHandle, id);\n\n const optionsFor = (component: BishopComponent) =>\n BISHOP_OPTIONS[component].map((o) => ({\n value: o.value,\n label: t(`bishopScore.${component}.${o.value}`),\n }));\n\n const bandLabel = (band: BishopBand): string =>\n t(`bishopScore.band.${band}`);\n\n return (\n <div\n ref={ref}\n data-component=\"bishop-score\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n {BISHOP_COMPONENTS.map((component) => (\n <FormField\n key={component}\n label={t(`bishopScore.${component}.label`)}\n >\n <Select\n options={optionsFor(component)}\n value={selection[component] ?? ''}\n onValueChange={(next) =>\n setSelection((prev) => ({ ...prev, [component]: next }))\n }\n />\n </FormField>\n ))}\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('bishopScore.totalLabel')}: ${t('bishopScore.scoreOf', {\n score: result.total,\n max: BISHOP_MAX_SCORE,\n })}. ${bandLabel(result.band)}.`\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-2\">\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('bishopScore.totalLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {t('bishopScore.scoreOf', {\n score: result.total,\n max: BISHOP_MAX_SCORE,\n })}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-end ds:gap-[var(--spacing-xs)] ds:text-end\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('bishopScore.bandLabel')}\n </dt>\n <dd>\n <Badge variant={BAND_BADGE[result.band]} size=\"lg\">\n {bandLabel(result.band)}\n </Badge>\n </dd>\n </div>\n </dl>\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t(`bishopScore.interpretation.${result.band}`)}\n </p>\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n onInsert={onInsert}\n variant={insertVariant}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.bishop'),\n icon: 'activity',\n highlight: bandLabel(result.band),\n highlightToken: BAND_TOKEN[result.band],\n brand: insertBrand,\n fields: [\n {\n icon: 'percent',\n label: t('bishopScore.totalLabel'),\n value: t('bishopScore.scoreOf', {\n score: result.total,\n max: BISHOP_MAX_SCORE,\n }),\n },\n {\n icon: 'tag',\n label: t('bishopScore.bandLabel'),\n value: bandLabel(result.band),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('bishopScore.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nBishopScore.displayName = 'BishopScore';\n"],"names":["COMPONENT_IDS","bishopScoreAgent","handle","args","BISHOP_COMPONENTS","BISHOP_OPTIONS","BISHOP_MAX_SCORE","bishopBand","total","scoreFor","component","value","_a","o","bishopScore","selection","score","rootVariants","cva","BAND_BADGE","BAND_TOKEN","BishopScore","forwardRef","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","useTranslation","setSelection","useState","result","useMemo","useEffect","selectionRef","useRef","resultRef","agentHandle","prev","useAgentRegistration","optionsFor","bandLabel","band","jsxs","jsx","FormField","Select","next","Card","Badge","InsertButton"],"mappings":";;;;;;;;;;AAqBA,MAAMA,IAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,IAAoD;AAAA,EAC/D,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,aAAA;AAAA,IAAa;AAAA,IAExC,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,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,WAAW;AAAA,YACT,MAAM,CAAC,GAAGF,CAAa;AAAA,YACvB,aAAa;AAAA,UAAA;AAAA,UAEf,OAAO;AAAA,YACL,MAAM;AAAA,YACN,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,aAAa,OAAO;AAAA,MAAA;AAAA,MAEjC,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,UAAU;AAAA,QACR;AAAA,UACE,MAAM,EAAE,WAAW,YAAY,OAAO,MAAA;AAAA,UACtC,MAAM;AAAA,QAAA;AAAA,MACR;AAAA,MAEF,QAAQ,CAACE,GAAQC,MAAwD;AACvE,QAAAD,EAAO,aAAaC,EAAK,WAAWA,EAAK,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UV,EAAO,IAAI;AAAA,kBAChC,gBAAgBjB,EAAWiB,EAAO,IAAI;AAAA,kBACtC,OAAOT;AAAA,kBACP,QAAQ;AAAA,oBACN;AAAA,sBACE,MAAM;AAAA,sBACN,OAAOK,EAAE,wBAAwB;AAAA,sBACjC,OAAOA,EAAE,uBAAuB;AAAA,wBAC9B,OAAOI,EAAO;AAAA,wBACd,KAAK/B;AAAA,sBAAA,CACN;AAAA,oBAAA;AAAA,oBAEH;AAAA,sBACE,MAAM;AAAA,sBACN,OAAO2B,EAAE,uBAAuB;AAAA,sBAChC,OAAOc,EAAUV,EAAO,IAAI;AAAA,oBAAA;AAAA,kBAC9B;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,EAAA,CACN,EAAA,CACF,IAEA,gBAAAa,EAAC,KAAA,EAAE,WAAU,sCACV,UAAAjB,EAAE,mBAAmB,EAAA,CACxB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAZ,EAAY,cAAc;"}
@@ -15,7 +15,7 @@ import { T as Lt } from "./text-area-Bt3p7Pt0.js";
15
15
  import { T as Ce } from "./text-input-CUvCb6ST.js";
16
16
  import { S as Ft } from "./spinner-hbwuKwMf.js";
17
17
  import { I as tt } from "./icon-button-C_kbcd7I.js";
18
- import { S as Oe } from "./select-BmCbJMJS.js";
18
+ import { S as Oe } from "./select-BW5ecXlX.js";
19
19
  import { C as Ge } from "./combobox-DiMLItyu.js";
20
20
  import { M as Ue } from "./multi-select-D5QLBJM1.js";
21
21
  import { S as _e } from "./skeleton-CZbwyJAA.js";
@@ -2692,4 +2692,4 @@ export {
2692
2692
  X as O,
2693
2693
  Cs as b
2694
2694
  };
2695
- //# sourceMappingURL=booking-CWnZhZ5g.js.map
2695
+ //# sourceMappingURL=booking-B1Qkcl3c.js.map