@alfadocs/ui-kit-debug 1.52.0 → 1.53.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 (474) hide show
  1. package/dist/_chunks/{address-autocomplete-BVLoHU3E.js → address-autocomplete-Bp816Mb1.js} +2 -2
  2. package/dist/_chunks/{address-autocomplete-BVLoHU3E.js.map → address-autocomplete-Bp816Mb1.js.map} +1 -1
  3. package/dist/_chunks/{address-fields-UiEXHxEX.js → address-fields-BIL6cvLS.js} +2 -2
  4. package/dist/_chunks/{address-fields-UiEXHxEX.js.map → address-fields-BIL6cvLS.js.map} +1 -1
  5. package/dist/_chunks/{agenda-tray-C-_iu6Fo.js → agenda-tray-C2a8OfKC.js} +2 -2
  6. package/dist/_chunks/{agenda-tray-C-_iu6Fo.js.map → agenda-tray-C2a8OfKC.js.map} +1 -1
  7. package/dist/_chunks/{anamnesis-summary-rows-DaSoA80I.js → anamnesis-summary-rows-CnHxtht-.js} +3 -3
  8. package/dist/_chunks/{anamnesis-summary-rows-DaSoA80I.js.map → anamnesis-summary-rows-CnHxtht-.js.map} +1 -1
  9. package/dist/_chunks/apexcharts-theme-DNoXvgnZ.js +105 -0
  10. package/dist/_chunks/apexcharts-theme-DNoXvgnZ.js.map +1 -0
  11. package/dist/_chunks/{appointment-timeline-BZErHbD1.js → appointment-timeline-By-EwmJU.js} +2 -2
  12. package/dist/_chunks/{appointment-timeline-BZErHbD1.js.map → appointment-timeline-By-EwmJU.js.map} +1 -1
  13. package/dist/_chunks/{appointment-tray-DR_Zm4Gw.js → appointment-tray-7Z3A3Xz9.js} +2 -2
  14. package/dist/_chunks/{appointment-tray-DR_Zm4Gw.js.map → appointment-tray-7Z3A3Xz9.js.map} +1 -1
  15. package/dist/_chunks/{balance-badge-cell-CS-iKkLM.js → balance-badge-cell-BtiFfFRY.js} +2 -2
  16. package/dist/_chunks/{balance-badge-cell-CS-iKkLM.js.map → balance-badge-cell-BtiFfFRY.js.map} +1 -1
  17. package/dist/_chunks/{booking-DP543-BT.js → booking-CFR7vU8X.js} +3 -3
  18. package/dist/_chunks/{booking-DP543-BT.js.map → booking-CFR7vU8X.js.map} +1 -1
  19. package/dist/_chunks/{calendar-workspace-B9MKJXER.js → calendar-workspace-LDuzo_Ie.js} +7 -7
  20. package/dist/_chunks/{calendar-workspace-B9MKJXER.js.map → calendar-workspace-LDuzo_Ie.js.map} +1 -1
  21. package/dist/_chunks/{chart-CuE30cfr.js → chart-D37VAIa-.js} +81 -81
  22. package/dist/_chunks/chart-D37VAIa-.js.map +1 -0
  23. package/dist/_chunks/{data-table-DJvEwZZx.js → data-table-CiVyhNXx.js} +2 -2
  24. package/dist/_chunks/{data-table-DJvEwZZx.js.map → data-table-CiVyhNXx.js.map} +1 -1
  25. package/dist/_chunks/{document-preview-1CZJg6CX.js → document-preview-VXOQZZvy.js} +2 -2
  26. package/dist/_chunks/{document-preview-1CZJg6CX.js.map → document-preview-VXOQZZvy.js.map} +1 -1
  27. package/dist/_chunks/{empty-state-DActfjdn.js → empty-state-C62P_6kr.js} +59 -48
  28. package/dist/_chunks/empty-state-C62P_6kr.js.map +1 -0
  29. package/dist/_chunks/{error-boundary--w5hYiQ-.js → error-boundary-Cvs23EzK.js} +2 -2
  30. package/dist/_chunks/{error-boundary--w5hYiQ-.js.map → error-boundary-Cvs23EzK.js.map} +1 -1
  31. package/dist/_chunks/error-page-BtxEOL6g.js +780 -0
  32. package/dist/_chunks/error-page-BtxEOL6g.js.map +1 -0
  33. package/dist/_chunks/{file-manager-BGHShxn_.js → file-manager-BfG3usGk.js} +3 -3
  34. package/dist/_chunks/{file-manager-BGHShxn_.js.map → file-manager-BfG3usGk.js.map} +1 -1
  35. package/dist/_chunks/{help-me-write-templates-CGCyhAVE.js → help-me-write-templates-DcR-e_90.js} +2 -2
  36. package/dist/_chunks/{help-me-write-templates-CGCyhAVE.js.map → help-me-write-templates-DcR-e_90.js.map} +1 -1
  37. package/dist/_chunks/{index.modern-Zta-A4Jm.js → index.modern-BeRXQVdc.js} +3 -2
  38. package/dist/_chunks/{index.modern-Zta-A4Jm.js.map → index.modern-BeRXQVdc.js.map} +1 -1
  39. package/dist/_chunks/{map-view-CmNGS6Ok.js → map-view-CQmqQJwK.js} +158 -129
  40. package/dist/_chunks/map-view-CQmqQJwK.js.map +1 -0
  41. package/dist/_chunks/{practice-results-DjhcggtZ.js → practice-results-B9uV0TT8.js} +3 -3
  42. package/dist/_chunks/{practice-results-DjhcggtZ.js.map → practice-results-B9uV0TT8.js.map} +1 -1
  43. package/dist/_chunks/{privacy-mask-noG15O9q.js → privacy-mask-CK-9sxeI.js} +2 -2
  44. package/dist/_chunks/{privacy-mask-noG15O9q.js.map → privacy-mask-CK-9sxeI.js.map} +1 -1
  45. package/dist/_chunks/{product-hub-panel-BmBzDba9.js → product-hub-panel-D87kbz5j.js} +2 -2
  46. package/dist/_chunks/{product-hub-panel-BmBzDba9.js.map → product-hub-panel-D87kbz5j.js.map} +1 -1
  47. package/dist/_chunks/{radiograph-panel.agent-BP71J_VB.js → radiograph-panel.agent-BWBaxJ8e.js} +2 -2
  48. package/dist/_chunks/{radiograph-panel.agent-BP71J_VB.js.map → radiograph-panel.agent-BWBaxJ8e.js.map} +1 -1
  49. package/dist/_chunks/{reviews-panel-DDb_t7vy.js → reviews-panel-DUgqU-Wr.js} +2 -2
  50. package/dist/_chunks/{reviews-panel-DDb_t7vy.js.map → reviews-panel-DUgqU-Wr.js.map} +1 -1
  51. package/dist/_chunks/{slot-grid-Bkg9MVXP.js → slot-grid-kq7bDdrx.js} +2 -2
  52. package/dist/_chunks/{slot-grid-Bkg9MVXP.js.map → slot-grid-kq7bDdrx.js.map} +1 -1
  53. package/dist/_chunks/{sparkline-ZOxMBU76.js → sparkline-pkGPCXbl.js} +80 -80
  54. package/dist/_chunks/sparkline-pkGPCXbl.js.map +1 -0
  55. package/dist/_chunks/{task-card-CngF4Zee.js → task-card-Cfl08MCS.js} +2 -2
  56. package/dist/_chunks/{task-card-CngF4Zee.js.map → task-card-Cfl08MCS.js.map} +1 -1
  57. package/dist/_chunks/{task-editor-Dz93rRXg.js → task-editor-CxF-sBnu.js} +2 -2
  58. package/dist/_chunks/{task-editor-Dz93rRXg.js.map → task-editor-CxF-sBnu.js.map} +1 -1
  59. package/dist/_chunks/{task-tray-CB6_BvH9.js → task-tray-rAGslT2C.js} +3 -3
  60. package/dist/_chunks/{task-tray-CB6_BvH9.js.map → task-tray-rAGslT2C.js.map} +1 -1
  61. package/dist/_chunks/{tasks-panel-DHAoTQtR.js → tasks-panel-Dkm8SnmV.js} +3 -3
  62. package/dist/_chunks/{tasks-panel-DHAoTQtR.js.map → tasks-panel-Dkm8SnmV.js.map} +1 -1
  63. package/dist/_chunks/{use-appointment-details-read-YsuJgYeB.js → use-appointment-details-read-W6h4oTHx.js} +3 -3
  64. package/dist/_chunks/{use-appointment-details-read-YsuJgYeB.js.map → use-appointment-details-read-W6h4oTHx.js.map} +1 -1
  65. package/dist/_chunks/{workflow-map-C7fHKTXL.js → workflow-map-C1OjRhM3.js} +189 -197
  66. package/dist/_chunks/workflow-map-C1OjRhM3.js.map +1 -0
  67. package/dist/agent-catalog.json +51 -7
  68. package/dist/agent-i18n/en.json +9 -3
  69. package/dist/components/_shared/index.d.ts +1 -0
  70. package/dist/components/_shared/index.d.ts.map +1 -1
  71. package/dist/components/_shared/is-development.d.ts +8 -0
  72. package/dist/components/_shared/is-development.d.ts.map +1 -0
  73. package/dist/components/_shared/use-keep-apex-tooltip-inside.d.ts +3 -0
  74. package/dist/components/_shared/use-keep-apex-tooltip-inside.d.ts.map +1 -0
  75. package/dist/components/address-autocomplete/index.js +1 -1
  76. package/dist/components/address-fields/index.js +1 -1
  77. package/dist/components/agenda-tray/index.js +1 -1
  78. package/dist/components/appointment-card/index.js +1 -1
  79. package/dist/components/appointment-details-panel/index.js +1 -1
  80. package/dist/components/appointment-timeline/index.js +1 -1
  81. package/dist/components/booking/index.js +1 -1
  82. package/dist/components/chart/chart.d.ts.map +1 -1
  83. package/dist/components/chart/index.js +1 -1
  84. package/dist/components/data-table/index.js +1 -1
  85. package/dist/components/document-preview/index.js +1 -1
  86. package/dist/components/empty-state/empty-state.d.ts +6 -0
  87. package/dist/components/empty-state/empty-state.d.ts.map +1 -1
  88. package/dist/components/empty-state/index.js +1 -1
  89. package/dist/components/error-boundary/index.js +1 -1
  90. package/dist/components/file-manager/index.js +1 -1
  91. package/dist/components/index.d.ts +1 -0
  92. package/dist/components/index.d.ts.map +1 -1
  93. package/dist/components/map-view/index.js +1 -1
  94. package/dist/components/map-view/map-view.agent.d.ts.map +1 -1
  95. package/dist/components/map-view/map-view.d.ts +8 -5
  96. package/dist/components/map-view/map-view.d.ts.map +1 -1
  97. package/dist/components/patient-table/index.js +1 -1
  98. package/dist/components/practice-results/index.js +1 -1
  99. package/dist/components/product-hub-tray/index.js +1 -1
  100. package/dist/components/radiograph-panel/index.js +1 -1
  101. package/dist/components/reviews-panel/index.js +1 -1
  102. package/dist/components/slot-grid/index.js +1 -1
  103. package/dist/components/sparkline/index.js +1 -1
  104. package/dist/components/sparkline/sparkline.d.ts.map +1 -1
  105. package/dist/components/task-card/index.js +1 -1
  106. package/dist/components/task-editor/index.js +1 -1
  107. package/dist/components/task-tray/index.js +1 -1
  108. package/dist/components/tasks-panel/index.js +1 -1
  109. package/dist/components/workflow/index.js +1 -1
  110. package/dist/components/workflow/workflow-editor.d.ts.map +1 -1
  111. package/dist/error-pages/400.ar.html +41 -0
  112. package/dist/error-pages/400.de.html +41 -0
  113. package/dist/error-pages/400.el.html +41 -0
  114. package/dist/error-pages/400.en.html +41 -0
  115. package/dist/error-pages/400.es.html +41 -0
  116. package/dist/error-pages/400.fr.html +41 -0
  117. package/dist/error-pages/400.hi.html +41 -0
  118. package/dist/error-pages/400.html +41 -0
  119. package/dist/error-pages/400.it.html +41 -0
  120. package/dist/error-pages/400.ja.html +41 -0
  121. package/dist/error-pages/400.nl.html +41 -0
  122. package/dist/error-pages/400.pl.html +41 -0
  123. package/dist/error-pages/400.pt.html +41 -0
  124. package/dist/error-pages/400.ro.html +41 -0
  125. package/dist/error-pages/400.ru.html +41 -0
  126. package/dist/error-pages/400.sq.html +41 -0
  127. package/dist/error-pages/400.sv.html +41 -0
  128. package/dist/error-pages/400.tr.html +41 -0
  129. package/dist/error-pages/400.zh.html +41 -0
  130. package/dist/error-pages/401.ar.html +41 -0
  131. package/dist/error-pages/401.de.html +41 -0
  132. package/dist/error-pages/401.el.html +41 -0
  133. package/dist/error-pages/401.en.html +41 -0
  134. package/dist/error-pages/401.es.html +41 -0
  135. package/dist/error-pages/401.fr.html +41 -0
  136. package/dist/error-pages/401.hi.html +41 -0
  137. package/dist/error-pages/401.html +41 -0
  138. package/dist/error-pages/401.it.html +41 -0
  139. package/dist/error-pages/401.ja.html +41 -0
  140. package/dist/error-pages/401.nl.html +41 -0
  141. package/dist/error-pages/401.pl.html +41 -0
  142. package/dist/error-pages/401.pt.html +41 -0
  143. package/dist/error-pages/401.ro.html +41 -0
  144. package/dist/error-pages/401.ru.html +41 -0
  145. package/dist/error-pages/401.sq.html +41 -0
  146. package/dist/error-pages/401.sv.html +41 -0
  147. package/dist/error-pages/401.tr.html +41 -0
  148. package/dist/error-pages/401.zh.html +41 -0
  149. package/dist/error-pages/403.ar.html +41 -0
  150. package/dist/error-pages/403.de.html +41 -0
  151. package/dist/error-pages/403.el.html +41 -0
  152. package/dist/error-pages/403.en.html +41 -0
  153. package/dist/error-pages/403.es.html +41 -0
  154. package/dist/error-pages/403.fr.html +41 -0
  155. package/dist/error-pages/403.hi.html +41 -0
  156. package/dist/error-pages/403.html +41 -0
  157. package/dist/error-pages/403.it.html +41 -0
  158. package/dist/error-pages/403.ja.html +41 -0
  159. package/dist/error-pages/403.nl.html +41 -0
  160. package/dist/error-pages/403.pl.html +41 -0
  161. package/dist/error-pages/403.pt.html +41 -0
  162. package/dist/error-pages/403.ro.html +41 -0
  163. package/dist/error-pages/403.ru.html +41 -0
  164. package/dist/error-pages/403.sq.html +41 -0
  165. package/dist/error-pages/403.sv.html +41 -0
  166. package/dist/error-pages/403.tr.html +41 -0
  167. package/dist/error-pages/403.zh.html +41 -0
  168. package/dist/error-pages/404.ar.html +41 -0
  169. package/dist/error-pages/404.de.html +41 -0
  170. package/dist/error-pages/404.el.html +41 -0
  171. package/dist/error-pages/404.en.html +41 -0
  172. package/dist/error-pages/404.es.html +41 -0
  173. package/dist/error-pages/404.fr.html +41 -0
  174. package/dist/error-pages/404.hi.html +41 -0
  175. package/dist/error-pages/404.html +41 -0
  176. package/dist/error-pages/404.it.html +41 -0
  177. package/dist/error-pages/404.ja.html +41 -0
  178. package/dist/error-pages/404.nl.html +41 -0
  179. package/dist/error-pages/404.pl.html +41 -0
  180. package/dist/error-pages/404.pt.html +41 -0
  181. package/dist/error-pages/404.ro.html +41 -0
  182. package/dist/error-pages/404.ru.html +41 -0
  183. package/dist/error-pages/404.sq.html +41 -0
  184. package/dist/error-pages/404.sv.html +41 -0
  185. package/dist/error-pages/404.tr.html +41 -0
  186. package/dist/error-pages/404.zh.html +41 -0
  187. package/dist/error-pages/405.ar.html +41 -0
  188. package/dist/error-pages/405.de.html +41 -0
  189. package/dist/error-pages/405.el.html +41 -0
  190. package/dist/error-pages/405.en.html +41 -0
  191. package/dist/error-pages/405.es.html +41 -0
  192. package/dist/error-pages/405.fr.html +41 -0
  193. package/dist/error-pages/405.hi.html +41 -0
  194. package/dist/error-pages/405.html +41 -0
  195. package/dist/error-pages/405.it.html +41 -0
  196. package/dist/error-pages/405.ja.html +41 -0
  197. package/dist/error-pages/405.nl.html +41 -0
  198. package/dist/error-pages/405.pl.html +41 -0
  199. package/dist/error-pages/405.pt.html +41 -0
  200. package/dist/error-pages/405.ro.html +41 -0
  201. package/dist/error-pages/405.ru.html +41 -0
  202. package/dist/error-pages/405.sq.html +41 -0
  203. package/dist/error-pages/405.sv.html +41 -0
  204. package/dist/error-pages/405.tr.html +41 -0
  205. package/dist/error-pages/405.zh.html +41 -0
  206. package/dist/error-pages/410.ar.html +41 -0
  207. package/dist/error-pages/410.de.html +41 -0
  208. package/dist/error-pages/410.el.html +41 -0
  209. package/dist/error-pages/410.en.html +41 -0
  210. package/dist/error-pages/410.es.html +41 -0
  211. package/dist/error-pages/410.fr.html +41 -0
  212. package/dist/error-pages/410.hi.html +41 -0
  213. package/dist/error-pages/410.html +41 -0
  214. package/dist/error-pages/410.it.html +41 -0
  215. package/dist/error-pages/410.ja.html +41 -0
  216. package/dist/error-pages/410.nl.html +41 -0
  217. package/dist/error-pages/410.pl.html +41 -0
  218. package/dist/error-pages/410.pt.html +41 -0
  219. package/dist/error-pages/410.ro.html +41 -0
  220. package/dist/error-pages/410.ru.html +41 -0
  221. package/dist/error-pages/410.sq.html +41 -0
  222. package/dist/error-pages/410.sv.html +41 -0
  223. package/dist/error-pages/410.tr.html +41 -0
  224. package/dist/error-pages/410.zh.html +41 -0
  225. package/dist/error-pages/419.ar.html +42 -0
  226. package/dist/error-pages/419.de.html +42 -0
  227. package/dist/error-pages/419.el.html +42 -0
  228. package/dist/error-pages/419.en.html +42 -0
  229. package/dist/error-pages/419.es.html +42 -0
  230. package/dist/error-pages/419.fr.html +42 -0
  231. package/dist/error-pages/419.hi.html +42 -0
  232. package/dist/error-pages/419.html +42 -0
  233. package/dist/error-pages/419.it.html +42 -0
  234. package/dist/error-pages/419.ja.html +42 -0
  235. package/dist/error-pages/419.nl.html +42 -0
  236. package/dist/error-pages/419.pl.html +42 -0
  237. package/dist/error-pages/419.pt.html +42 -0
  238. package/dist/error-pages/419.ro.html +42 -0
  239. package/dist/error-pages/419.ru.html +42 -0
  240. package/dist/error-pages/419.sq.html +42 -0
  241. package/dist/error-pages/419.sv.html +42 -0
  242. package/dist/error-pages/419.tr.html +42 -0
  243. package/dist/error-pages/419.zh.html +42 -0
  244. package/dist/error-pages/429.ar.html +42 -0
  245. package/dist/error-pages/429.de.html +42 -0
  246. package/dist/error-pages/429.el.html +42 -0
  247. package/dist/error-pages/429.en.html +42 -0
  248. package/dist/error-pages/429.es.html +42 -0
  249. package/dist/error-pages/429.fr.html +42 -0
  250. package/dist/error-pages/429.hi.html +42 -0
  251. package/dist/error-pages/429.html +42 -0
  252. package/dist/error-pages/429.it.html +42 -0
  253. package/dist/error-pages/429.ja.html +42 -0
  254. package/dist/error-pages/429.nl.html +42 -0
  255. package/dist/error-pages/429.pl.html +42 -0
  256. package/dist/error-pages/429.pt.html +42 -0
  257. package/dist/error-pages/429.ro.html +42 -0
  258. package/dist/error-pages/429.ru.html +42 -0
  259. package/dist/error-pages/429.sq.html +42 -0
  260. package/dist/error-pages/429.sv.html +42 -0
  261. package/dist/error-pages/429.tr.html +42 -0
  262. package/dist/error-pages/429.zh.html +42 -0
  263. package/dist/error-pages/500.ar.html +41 -0
  264. package/dist/error-pages/500.de.html +41 -0
  265. package/dist/error-pages/500.el.html +41 -0
  266. package/dist/error-pages/500.en.html +41 -0
  267. package/dist/error-pages/500.es.html +41 -0
  268. package/dist/error-pages/500.fr.html +41 -0
  269. package/dist/error-pages/500.hi.html +41 -0
  270. package/dist/error-pages/500.html +41 -0
  271. package/dist/error-pages/500.it.html +41 -0
  272. package/dist/error-pages/500.ja.html +41 -0
  273. package/dist/error-pages/500.nl.html +41 -0
  274. package/dist/error-pages/500.pl.html +41 -0
  275. package/dist/error-pages/500.pt.html +41 -0
  276. package/dist/error-pages/500.ro.html +41 -0
  277. package/dist/error-pages/500.ru.html +41 -0
  278. package/dist/error-pages/500.sq.html +41 -0
  279. package/dist/error-pages/500.sv.html +41 -0
  280. package/dist/error-pages/500.tr.html +41 -0
  281. package/dist/error-pages/500.zh.html +41 -0
  282. package/dist/error-pages/502.ar.html +41 -0
  283. package/dist/error-pages/502.de.html +41 -0
  284. package/dist/error-pages/502.el.html +41 -0
  285. package/dist/error-pages/502.en.html +41 -0
  286. package/dist/error-pages/502.es.html +41 -0
  287. package/dist/error-pages/502.fr.html +41 -0
  288. package/dist/error-pages/502.hi.html +41 -0
  289. package/dist/error-pages/502.html +41 -0
  290. package/dist/error-pages/502.it.html +41 -0
  291. package/dist/error-pages/502.ja.html +41 -0
  292. package/dist/error-pages/502.nl.html +41 -0
  293. package/dist/error-pages/502.pl.html +41 -0
  294. package/dist/error-pages/502.pt.html +41 -0
  295. package/dist/error-pages/502.ro.html +41 -0
  296. package/dist/error-pages/502.ru.html +41 -0
  297. package/dist/error-pages/502.sq.html +41 -0
  298. package/dist/error-pages/502.sv.html +41 -0
  299. package/dist/error-pages/502.tr.html +41 -0
  300. package/dist/error-pages/502.zh.html +41 -0
  301. package/dist/error-pages/503.ar.html +41 -0
  302. package/dist/error-pages/503.de.html +41 -0
  303. package/dist/error-pages/503.el.html +41 -0
  304. package/dist/error-pages/503.en.html +41 -0
  305. package/dist/error-pages/503.es.html +41 -0
  306. package/dist/error-pages/503.fr.html +41 -0
  307. package/dist/error-pages/503.hi.html +41 -0
  308. package/dist/error-pages/503.html +41 -0
  309. package/dist/error-pages/503.it.html +41 -0
  310. package/dist/error-pages/503.ja.html +41 -0
  311. package/dist/error-pages/503.nl.html +41 -0
  312. package/dist/error-pages/503.pl.html +41 -0
  313. package/dist/error-pages/503.pt.html +41 -0
  314. package/dist/error-pages/503.ro.html +41 -0
  315. package/dist/error-pages/503.ru.html +41 -0
  316. package/dist/error-pages/503.sq.html +41 -0
  317. package/dist/error-pages/503.sv.html +41 -0
  318. package/dist/error-pages/503.tr.html +41 -0
  319. package/dist/error-pages/503.zh.html +41 -0
  320. package/dist/error-pages/504.ar.html +41 -0
  321. package/dist/error-pages/504.de.html +41 -0
  322. package/dist/error-pages/504.el.html +41 -0
  323. package/dist/error-pages/504.en.html +41 -0
  324. package/dist/error-pages/504.es.html +41 -0
  325. package/dist/error-pages/504.fr.html +41 -0
  326. package/dist/error-pages/504.hi.html +41 -0
  327. package/dist/error-pages/504.html +41 -0
  328. package/dist/error-pages/504.it.html +41 -0
  329. package/dist/error-pages/504.ja.html +41 -0
  330. package/dist/error-pages/504.nl.html +41 -0
  331. package/dist/error-pages/504.pl.html +41 -0
  332. package/dist/error-pages/504.pt.html +41 -0
  333. package/dist/error-pages/504.ro.html +41 -0
  334. package/dist/error-pages/504.ru.html +41 -0
  335. package/dist/error-pages/504.sq.html +41 -0
  336. package/dist/error-pages/504.sv.html +41 -0
  337. package/dist/error-pages/504.tr.html +41 -0
  338. package/dist/error-pages/504.zh.html +41 -0
  339. package/dist/error-pages/maintenance.ar.html +41 -0
  340. package/dist/error-pages/maintenance.de.html +41 -0
  341. package/dist/error-pages/maintenance.el.html +41 -0
  342. package/dist/error-pages/maintenance.en.html +41 -0
  343. package/dist/error-pages/maintenance.es.html +41 -0
  344. package/dist/error-pages/maintenance.fr.html +41 -0
  345. package/dist/error-pages/maintenance.hi.html +41 -0
  346. package/dist/error-pages/maintenance.html +41 -0
  347. package/dist/error-pages/maintenance.it.html +41 -0
  348. package/dist/error-pages/maintenance.ja.html +41 -0
  349. package/dist/error-pages/maintenance.nl.html +41 -0
  350. package/dist/error-pages/maintenance.pl.html +41 -0
  351. package/dist/error-pages/maintenance.pt.html +41 -0
  352. package/dist/error-pages/maintenance.ro.html +41 -0
  353. package/dist/error-pages/maintenance.ru.html +41 -0
  354. package/dist/error-pages/maintenance.sq.html +41 -0
  355. package/dist/error-pages/maintenance.sv.html +41 -0
  356. package/dist/error-pages/maintenance.tr.html +41 -0
  357. package/dist/error-pages/maintenance.zh.html +41 -0
  358. package/dist/host-compat.css +13 -1
  359. package/dist/i18n/locales/ar.d.ts +70 -0
  360. package/dist/i18n/locales/ar.d.ts.map +1 -1
  361. package/dist/i18n/locales/ar.js +70 -0
  362. package/dist/i18n/locales/ar.js.map +1 -1
  363. package/dist/i18n/locales/de.d.ts +70 -0
  364. package/dist/i18n/locales/de.d.ts.map +1 -1
  365. package/dist/i18n/locales/de.js +70 -0
  366. package/dist/i18n/locales/de.js.map +1 -1
  367. package/dist/i18n/locales/el.d.ts +70 -0
  368. package/dist/i18n/locales/el.d.ts.map +1 -1
  369. package/dist/i18n/locales/el.js +70 -0
  370. package/dist/i18n/locales/el.js.map +1 -1
  371. package/dist/i18n/locales/en.d.ts +70 -0
  372. package/dist/i18n/locales/en.d.ts.map +1 -1
  373. package/dist/i18n/locales/en.js +70 -0
  374. package/dist/i18n/locales/en.js.map +1 -1
  375. package/dist/i18n/locales/es.d.ts +70 -0
  376. package/dist/i18n/locales/es.d.ts.map +1 -1
  377. package/dist/i18n/locales/es.js +70 -0
  378. package/dist/i18n/locales/es.js.map +1 -1
  379. package/dist/i18n/locales/fr.d.ts +70 -0
  380. package/dist/i18n/locales/fr.d.ts.map +1 -1
  381. package/dist/i18n/locales/fr.js +70 -0
  382. package/dist/i18n/locales/fr.js.map +1 -1
  383. package/dist/i18n/locales/hi.d.ts +70 -0
  384. package/dist/i18n/locales/hi.d.ts.map +1 -1
  385. package/dist/i18n/locales/hi.js +70 -0
  386. package/dist/i18n/locales/hi.js.map +1 -1
  387. package/dist/i18n/locales/it.d.ts +70 -0
  388. package/dist/i18n/locales/it.d.ts.map +1 -1
  389. package/dist/i18n/locales/it.js +70 -0
  390. package/dist/i18n/locales/it.js.map +1 -1
  391. package/dist/i18n/locales/ja.d.ts +70 -0
  392. package/dist/i18n/locales/ja.d.ts.map +1 -1
  393. package/dist/i18n/locales/ja.js +70 -0
  394. package/dist/i18n/locales/ja.js.map +1 -1
  395. package/dist/i18n/locales/nl.d.ts +70 -0
  396. package/dist/i18n/locales/nl.d.ts.map +1 -1
  397. package/dist/i18n/locales/nl.js +70 -0
  398. package/dist/i18n/locales/nl.js.map +1 -1
  399. package/dist/i18n/locales/pl.d.ts +70 -0
  400. package/dist/i18n/locales/pl.d.ts.map +1 -1
  401. package/dist/i18n/locales/pl.js +70 -0
  402. package/dist/i18n/locales/pl.js.map +1 -1
  403. package/dist/i18n/locales/pt.d.ts +70 -0
  404. package/dist/i18n/locales/pt.d.ts.map +1 -1
  405. package/dist/i18n/locales/pt.js +70 -0
  406. package/dist/i18n/locales/pt.js.map +1 -1
  407. package/dist/i18n/locales/ro.d.ts +70 -0
  408. package/dist/i18n/locales/ro.d.ts.map +1 -1
  409. package/dist/i18n/locales/ro.js +70 -0
  410. package/dist/i18n/locales/ro.js.map +1 -1
  411. package/dist/i18n/locales/ru.d.ts +70 -0
  412. package/dist/i18n/locales/ru.d.ts.map +1 -1
  413. package/dist/i18n/locales/ru.js +70 -0
  414. package/dist/i18n/locales/ru.js.map +1 -1
  415. package/dist/i18n/locales/sq.d.ts +70 -0
  416. package/dist/i18n/locales/sq.d.ts.map +1 -1
  417. package/dist/i18n/locales/sq.js +70 -0
  418. package/dist/i18n/locales/sq.js.map +1 -1
  419. package/dist/i18n/locales/sv.d.ts +70 -0
  420. package/dist/i18n/locales/sv.d.ts.map +1 -1
  421. package/dist/i18n/locales/sv.js +70 -0
  422. package/dist/i18n/locales/sv.js.map +1 -1
  423. package/dist/i18n/locales/tr.d.ts +70 -0
  424. package/dist/i18n/locales/tr.d.ts.map +1 -1
  425. package/dist/i18n/locales/tr.js +70 -0
  426. package/dist/i18n/locales/tr.js.map +1 -1
  427. package/dist/i18n/locales/zh.d.ts +70 -0
  428. package/dist/i18n/locales/zh.d.ts.map +1 -1
  429. package/dist/i18n/locales/zh.js +70 -0
  430. package/dist/i18n/locales/zh.js.map +1 -1
  431. package/dist/index.js +143 -137
  432. package/dist/index.js.map +1 -1
  433. package/dist/locales/ar.json +70 -0
  434. package/dist/locales/de.json +70 -0
  435. package/dist/locales/el.json +70 -0
  436. package/dist/locales/en.json +70 -0
  437. package/dist/locales/es.json +70 -0
  438. package/dist/locales/fr.json +70 -0
  439. package/dist/locales/hi.json +70 -0
  440. package/dist/locales/it.json +70 -0
  441. package/dist/locales/ja.json +70 -0
  442. package/dist/locales/nl.json +70 -0
  443. package/dist/locales/pl.json +70 -0
  444. package/dist/locales/pt.json +70 -0
  445. package/dist/locales/ro.json +70 -0
  446. package/dist/locales/ru.json +70 -0
  447. package/dist/locales/sq.json +70 -0
  448. package/dist/locales/sv.json +70 -0
  449. package/dist/locales/tr.json +70 -0
  450. package/dist/locales/zh.json +70 -0
  451. package/dist/patterns/anamnesis/index.js +1 -1
  452. package/dist/patterns/calendar/index.js +1 -1
  453. package/dist/patterns/error-page/error-page-illustration.d.ts +6 -0
  454. package/dist/patterns/error-page/error-page-illustration.d.ts.map +1 -0
  455. package/dist/patterns/error-page/error-page-locale.d.ts +32 -0
  456. package/dist/patterns/error-page/error-page-locale.d.ts.map +1 -0
  457. package/dist/patterns/error-page/error-page-statuses.d.ts +16 -0
  458. package/dist/patterns/error-page/error-page-statuses.d.ts.map +1 -0
  459. package/dist/patterns/error-page/error-page.d.ts +48 -0
  460. package/dist/patterns/error-page/error-page.d.ts.map +1 -0
  461. package/dist/patterns/error-page/index.d.ts +5 -0
  462. package/dist/patterns/error-page/index.d.ts.map +1 -0
  463. package/dist/patterns/error-page/index.js +9 -0
  464. package/dist/patterns/error-page/index.js.map +1 -0
  465. package/dist/patterns/help-me-write-templates/index.js +1 -1
  466. package/dist/tokens.css +1 -1
  467. package/package.json +9 -2
  468. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js +0 -72
  469. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js.map +0 -1
  470. package/dist/_chunks/chart-CuE30cfr.js.map +0 -1
  471. package/dist/_chunks/empty-state-DActfjdn.js.map +0 -1
  472. package/dist/_chunks/map-view-CmNGS6Ok.js.map +0 -1
  473. package/dist/_chunks/sparkline-ZOxMBU76.js.map +0 -1
  474. package/dist/_chunks/workflow-map-C7fHKTXL.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"sparkline-ZOxMBU76.js","sources":["../../src/components/sparkline/use-linear-trend.ts","../../src/components/sparkline/sparkline.agent.ts","../../src/components/sparkline/sparkline.tsx"],"sourcesContent":["export type TrendDirection = 'increasing' | 'decreasing' | 'steady';\n\nexport interface LinearTrendResult {\n slope: number;\n direction: TrendDirection;\n}\n\nexport function useLinearTrend(data: number[]): LinearTrendResult {\n if (data.length < 2) {\n return { slope: 0, direction: 'steady' };\n }\n\n const n = data.length;\n const xMean = (n - 1) / 2;\n const yMean = data.reduce((sum, y) => sum + y, 0) / n;\n\n let numerator = 0;\n let denominator = 0;\n\n for (let i = 0; i < n; i++) {\n const dx = i - xMean;\n numerator += dx * (data[i] - yMean);\n denominator += dx * dx;\n }\n\n const slope = denominator === 0 ? 0 : numerator / denominator;\n const range = Math.max(...data) - Math.min(...data);\n const threshold = 0.01 * (range || 1);\n\n const direction: TrendDirection =\n Math.abs(slope) < threshold\n ? 'steady'\n : slope > 0\n ? 'increasing'\n : 'decreasing';\n\n return { slope, direction };\n}\n","import type { AgentAdapter } from '../../agent/types';\nimport type { SparklineHandle } from './sparkline';\n\nexport const sparklineAgent: AgentAdapter<SparklineHandle> = {\n id: 'sparkline',\n capabilities: [],\n // `select_annotation` enforces two preconditions silently and\n // `update_series` writes straight into ApexCharts, bypassing React —\n // so nothing in the React tree reflects what is actually rendered.\n // These slots are the checkable form of both.\n //\n // A9 boundary: an annotation `id` is the host's opaque key, so it is\n // exposed; `SparklineAnnotation.label` is human-readable and could\n // name a clinical event, so it is not. The plotted values are\n // measurements in a clinical sparkline and are never exposed — only\n // their count. `trend` from `useLinearTrend` is deliberately left out\n // for the same reason (still derived from the plotted values); adding\n // it needs a DS-maintainer sign-off.\n state: {\n annotationIds: {\n type: 'string[]',\n descriptionKey: 'ui.agent.sparkline.state.annotationIds',\n description:\n 'Ids of the annotations currently drawn, in declaration order. The only ids `select_annotation` will accept — check against this before calling. Ids only, never annotation labels.',\n read: (handle) => handle.getAnnotationIds(),\n },\n selectable: {\n type: 'boolean',\n descriptionKey: 'ui.agent.sparkline.state.selectable',\n description:\n 'True when the host wired an annotation-select handler. False means every `select_annotation` call is a no-op, whatever id is passed.',\n read: (handle) => handle.isSelectable(),\n },\n pointCount: {\n type: 'number',\n descriptionKey: 'ui.agent.sparkline.state.pointCount',\n description:\n 'Number of positions in the currently rendered series, unmeasured gaps included — reflecting whichever applied last, the `data` prop or an `update_series` call. A count only; the plotted values are never exposed.',\n read: (handle) => handle.getPointCount(),\n },\n },\n actions: {\n update_series: {\n // Replacing the rendered series mutates what the chart displays — write,\n // not read.\n safety: 'write',\n argsType: '{ data: number[] }',\n argsSchema: {\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: { type: 'number' },\n description: 'The new data points to render.',\n },\n },\n required: ['data'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.sparkline.actions.updateSeries',\n description:\n 'Replace the sparkline data without remounting. Writes straight into ApexCharts, bypassing React — read the `pointCount` slot back rather than expecting the host tree to reflect it. Host-supplied point labels are not updated, so the tooltip title is hidden after this call.',\n errors: [\n 'Per-point tooltip titles are hidden after this call — the host point labels describe the previous series, not the one written.',\n ],\n invoke: (handle, args: { data: number[] }) => {\n handle.updateSeries(args.data);\n },\n },\n export_png: {\n // Pure getter — returns an image of the current chart, no state change.\n safety: 'read',\n returns: 'string',\n returnsSchema: {\n type: 'string',\n description: 'A PNG image of the sparkline encoded as a data URI.',\n },\n descriptionKey: 'ui.agent.sparkline.actions.exportPng',\n description: 'Return a PNG data URI of the sparkline.',\n invoke: (handle) => handle.dataURI(),\n },\n select_annotation: {\n // Routes the host somewhere — the same thing a pointer press on the\n // annotation's band does. Nothing in the chart changes, but the host's\n // surface does, so it is not a read.\n safety: 'write',\n argsType: '{ annotationId: string }',\n argsSchema: {\n type: 'object',\n properties: {\n annotationId: {\n type: 'string',\n description:\n \"The annotation's id, as carried by data-annotation-hit-id on the pressable band. The decorative drawn marker carries the same value as data-annotation-id, but is not selectable.\",\n },\n },\n required: ['annotationId'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.sparkline.actions.selectAnnotation',\n description:\n 'Select a drawn annotation, as pressing its band would. No-op unless the host wired onAnnotationSelect and the id names an annotation that is currently drawn — check the `selectable` and `annotationIds` slots first, since neither failure produces a signal.',\n errors: [\n 'Silently ignored when `selectable` is false — the host wired no annotation-select handler.',\n 'Silently ignored when the id is not in `annotationIds` — that annotation is not currently drawn.',\n ],\n invoke: (handle, args: { annotationId: string }) => {\n handle.selectAnnotation(args.annotationId);\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'sparkline' },\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 useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport ReactApexChart from 'react-apexcharts';\nimport ApexCharts from 'apexcharts';\nimport { getApexChartsTheme } from '../../tokens/apexcharts-theme';\nimport { useNeutraliseHiddenFocus } from '../_shared/use-neutralize-hidden-focus';\nimport { markerPath, type MarkerShape } from '../annotation-marker';\nimport { useLinearTrend } from './use-linear-trend';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { sparklineAgent } from './sparkline.agent';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst sparklineVariants = cva('ds:relative ds:inline-block ds:w-full', {\n variants: {\n size: {\n xs: 'ds:h-6',\n sm: 'ds:h-8',\n md: 'ds:h-10',\n // Applied when an explicit `height` prop is given: the wrapper\n // grows with the svg instead of clipping at the size's fixed height.\n auto: '',\n },\n },\n defaultVariants: { size: 'md' },\n});\n\n/* Tone only TINTS the annotation — the shape is what distinguishes one\n * event from another (WCAG 1.4.1), matching AnnotationMarker's vocabulary. */\nconst annotationVariants = cva('', {\n variants: {\n tone: {\n neutral: 'ds:[--annotation-color:var(--muted-foreground)]',\n info: 'ds:[--annotation-color:var(--info)]',\n success: 'ds:[--annotation-color:var(--success)]',\n /* `--warning-readable`, not `--warning`: a 1.5px dashed line is a\n * non-text graphic (WCAG 1.4.11, 3:1), and yellow-500 is ~1.6:1 on a\n * light card. The token aliases back to `--warning` in dark. */\n warning: 'ds:[--annotation-color:var(--warning-readable)]',\n error: 'ds:[--annotation-color:var(--destructive)]',\n accent: 'ds:[--annotation-color:var(--accent)]',\n },\n },\n defaultVariants: { tone: 'neutral' },\n});\n\n/* A 24–40px sparkline cannot hold a 44px target, so the POINTER layer alone is\n * bled outward to reach it. The drawn layer is a separate div at `inset-y-0`;\n * nothing rendered moves.\n *\n * BOTH axes follow `--min-target-size`: the vertical bleed via the calc\n * variants below, and the JS band width by measuring the resolved token off\n * the wrapper (fallback 44). Under `.theme-accessible` (48px) the band\n * widens on both axes. `auto` (an explicit `height`) cannot be computed here\n * at all and inherits whatever the host set. */\nconst annotationHitVariants = cva(\n 'ds:pointer-events-none ds:absolute ds:inset-x-[2px]',\n {\n variants: {\n // Bleed to the target-size token, not a literal: (token − drawn)/−2 per\n // size, so `.theme-accessible` (48px) widens the band automatically —\n // the same calc idiom IconButton uses for its hit-area expansion.\n size: {\n xs: 'ds:inset-y-[calc((var(--min-target-size)-24px)/-2)]',\n sm: 'ds:inset-y-[calc((var(--min-target-size)-32px)/-2)]',\n md: 'ds:inset-y-[calc((var(--min-target-size)-40px)/-2)]',\n auto: 'ds:inset-y-0',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Constants */\n/* ------------------------------------------------------------------ */\n\nconst DIRECTION_ARROW = {\n increasing: '↑',\n decreasing: '↓',\n steady: '→',\n} as const;\n\nconst SIZE_HEIGHT: Record<'xs' | 'sm' | 'md', number> = {\n xs: 24,\n sm: 32,\n md: 40,\n};\n\n/** ApexCharts grid padding, in px. The plotted extent is the wrapper inset by\n * this on each edge, so the annotation overlay has to use the same number to\n * land its first/last position on the first/last data point. */\nconst PLOT_EDGE_PADDING = 2;\n\n/** Radius of an annotation's shape cap, in svg user units (= px here). Sized\n * against the SMALLEST sparkline it has to sit on (`xs`, 24px): a 5px cap is\n * ~a fifth of that height, still shape-legible, and no longer competes with\n * the series it annotates. */\nconst ANNOTATION_CAP_RADIUS = 2.5;\n\n/** FALLBACK pointer-band width, in px — the light/dark `--min-target-size`.\n * The live value is measured off the wrapper so `.theme-accessible` (48px)\n * widens the band; this constant only covers the tick before the first\n * measurement and non-browser environments. Wider than the token is never\n * allowed — a sparse set of annotations would turn the whole trend into a\n * click target. */\nconst ANNOTATION_HIT_WIDTH = 44;\n\ninterface AnnotationHitBand {\n annotation: SparklineAnnotation;\n x: number;\n width: number;\n}\n\n/**\n * The pointer bands for a set of annotations across a plot `plotWidth` px wide.\n * Pure — the geometry is the only part needing a measured width, and keeping it\n * out of the render is what makes it testable.\n *\n * Each annotation owns the strip from the midpoint of the gap behind it to the\n * midpoint of the gap ahead, clamped to the plot. Its band is 44px inside that\n * strip, centred on its line and slid inward where the strip's edge would cut\n * it — so a line on the first data point still gets a full band, and no band\n * reaches past the plot onto whatever sits beside the sparkline. Annotations\n * closer than 44px each keep half the gap: a press must mean exactly one.\n */\nfunction annotationHitBands(\n annotations: readonly SparklineAnnotation[],\n plotWidth: number,\n hitWidth: number = ANNOTATION_HIT_WIDTH,\n): AnnotationHitBand[] {\n const centred = annotations\n .map((annotation) => ({\n annotation,\n centre: clampFraction(annotation.position) * plotWidth,\n }))\n .sort((a, b) => a.centre - b.centre);\n\n return centred.map((entry, index) => {\n const before = centred[index - 1];\n const after = centred[index + 1];\n const from = before ? (before.centre + entry.centre) / 2 : 0;\n const to = after ? (entry.centre + after.centre) / 2 : plotWidth;\n const lower = Math.max(0, from);\n const upper = Math.min(plotWidth, to);\n const width = Math.min(hitWidth, Math.max(0, upper - lower));\n const x = Math.min(\n Math.max(entry.centre - width / 2, lower),\n upper - width,\n );\n return { annotation: entry.annotation, x, width };\n });\n}\n\nfunction clampFraction(value: number): number {\n if (!Number.isFinite(value)) return 0;\n return Math.min(1, Math.max(0, value));\n}\n\n/** The measurements in a series, gaps dropped. A `null` is an unmeasured\n * position, not a zero — it must not reach the min/max/trend maths. */\nfunction measured(data: readonly (number | null)[]): number[] {\n return data.filter((value): value is number => value != null);\n}\n\nfunction prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface SparklineHandle {\n updateSeries: (data: (number | null)[]) => void;\n updateOptions: (opts: ApexCharts.ApexOptions) => void;\n dataURI: () => Promise<string>;\n /** Fire the host's annotation handler for `id`, as a pointer press on that\n * annotation's band would. No-op when the sparkline is not selectable, or\n * when `id` names no currently drawn annotation. */\n selectAnnotation: (id: string) => void;\n /* ---- read-back: the two preconditions `selectAnnotation` silently\n * enforces, plus the series length ------------------------------- */\n /** Ids of the annotations currently drawn — the only ids `selectAnnotation`\n * will accept. Ids only: an annotation's `label` is human-readable and could\n * name a clinical event, so it is never exposed. */\n getAnnotationIds: () => string[];\n /** True when the host wired `onAnnotationSelect`. False means every\n * `selectAnnotation` call is a no-op. */\n isSelectable: () => boolean;\n /** Number of positions in the currently rendered series, gaps included.\n * A count only — the plotted values are measurements and stay private. */\n getPointCount: () => number;\n}\n\n/** Semantic tint for an annotation. Decorative reinforcement of `shape` —\n * never the only channel carrying which event this is. */\nexport type SparklineAnnotationTone =\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'error'\n | 'accent';\n\n/**\n * A vertical reference line dropped across the plot — the release-annotation\n * pattern: \"something happened here, look at what the line does around it\".\n *\n * `position` is a FRACTION of the plotted x extent, not an index: `0` is the\n * first data point, `1` the last, `0.5` exactly halfway between them. That is\n * what lets an event that falls BETWEEN two points be placed at all, and what\n * lets the same event land at the same x in a column of stacked sparklines —\n * the caller derives the fraction once, from a domain the whole column shares,\n * rather than per-series from a point count that differs row to row.\n */\nexport interface SparklineAnnotation {\n /** Stable key — also emitted as `data-annotation-id` for test/agent hooks. */\n id: string;\n /** Fraction of the plotted x extent: 0 = first point, 1 = last. Clamped. */\n position: number;\n /** Accessible label, already localised by the caller. Folded into the\n * sparkline's own `aria-label` — the line itself says nothing aloud. */\n label: string;\n /** Shape of the cap drawn at the top of the line. The accessible channel. */\n shape?: MarkerShape;\n tone?: SparklineAnnotationTone;\n}\n\nexport interface SparklineProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'children'>,\n VariantProps<typeof sparklineVariants> {\n /** Data points in plot order. `null` is an unmeasured position — it holds\n * the point's place on the x extent and draws a gap, so a series measured\n * at some positions and not others stays aligned with one that was measured\n * at all of them. */\n data: (number | null)[];\n /** Chart visual style */\n variant?: 'line' | 'bar' | 'area';\n /** Size preset */\n size?: 'xs' | 'sm' | 'md';\n /** Accessible label prefix, e.g. \"Revenue, 30 days\" */\n label?: string;\n /** Stroke / bar colour override — defaults to var(--primary) via bridge */\n color?: string;\n /** Show end-point dot with trend direction arrow */\n showEndpoint?: boolean;\n /**\n * Show Apex's hover tooltip with the data point value. Defaults to\n * `false` — sparklines are intentionally minimal — opt in when the\n * sparkline is large enough to be a primary metric surface (e.g.\n * dashboard widgets) and the user benefits from per-point readout.\n */\n showTooltip?: boolean;\n /** Series name shown in the tooltip, already localised. Defaults to\n * `label`, so the tooltip never falls back to Apex's \"series-1\". */\n seriesName?: string;\n /** Tooltip title per point, same order and length as `data` (gaps\n * included). Omitted = no tooltip title. Never drawn on an axis. */\n pointLabels?: readonly string[];\n /** Width override — defaults to 100% of container */\n width?: string | number;\n /** Height override — defaults to the size variant height */\n height?: string | number;\n /** Vertical reference lines dropped across the plot. Omitted = none, so\n * every existing consumer is unaffected. */\n annotations?: readonly SparklineAnnotation[];\n /**\n * Make the drawn annotations POINTER-selectable — a press anywhere in an\n * annotation's 44px band calls this with its `id`. Omitted (the default, and\n * what every consumer before 1.1.0 gets) leaves them decorative, which is\n * what a dashboard sparkline wants: a trend thumbnail should not be a click\n * target.\n *\n * NOT a keyboard route, and deliberately so. The sparkline is `role=\"img\"`,\n * whose descendants are not exposed to assistive technology at all, so a\n * focusable control drawn inside it would be a tab stop with no accessible\n * name. The host MUST therefore already offer a keyboard control that does\n * the same thing for the same annotation (WCAG 2.1.1) — this is a pointer\n * shortcut to that control, never the only way in.\n *\n * The band is delivered by the `size` variants only, and follows\n * `--min-target-size` on both axes (48px under `.theme-accessible`). Pass\n * an explicit `height` and the pointer layer falls back to the drawn\n * height, so `height={20}` yields a 20px-tall target — below even WCAG\n * 2.5.8.\n */\n onAnnotationSelect?: (annotationId: string) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Sparkline component */\n/* ------------------------------------------------------------------ */\n\nexport const Sparkline = forwardRef<SparklineHandle, SparklineProps>(\n (\n {\n id,\n data,\n variant = 'line',\n size = 'md',\n label,\n color,\n showEndpoint = false,\n showTooltip = false,\n seriesName,\n pointLabels,\n width,\n height,\n annotations,\n onAnnotationSelect,\n className,\n ...props\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n const rawId = useId();\n const chartId = useMemo(\n () => `sparkline-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}`,\n [rawId],\n );\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState(0);\n const [hitWidth, setHitWidth] = useState(ANNOTATION_HIT_WIDTH);\n\n // Gaps are positions, not values: they hold the point's place on the x\n // extent but never reach the trend, the min/max, or the endpoint dot.\n const points = useMemo(() => measured(data), [data]);\n const { direction } = useLinearTrend(points);\n\n /* ---- accessible summary ---------------------------------------- */\n const ariaLabel = useMemo(() => {\n // The annotations are the only thing a vertical line in an SVG can say\n // aloud, so they ride the summary in every branch — including \"no data\",\n // where the marked events are all there is left to report.\n const marks =\n annotations && annotations.length > 0\n ? t('sparkline.annotations', {\n list: annotations.map((a) => a.label).join(', '),\n })\n : '';\n const withMarks = (summary: string) =>\n marks ? `${summary}. ${marks}` : summary;\n\n if (points.length === 0) {\n return withMarks(t('sparkline.noData', 'No data'));\n }\n const fmt = (n: number) => new Intl.NumberFormat(i18n.language).format(n);\n const dirText = t(`sparkline.direction.${direction}`);\n const nums = {\n min: fmt(Math.min(...points)),\n max: fmt(Math.max(...points)),\n current: fmt(points[points.length - 1]),\n direction: dirText,\n };\n if (label) {\n return withMarks(t('sparkline.summary', { label, ...nums }));\n }\n return withMarks(t('sparkline.summaryNoLabel', nums));\n }, [points, annotations, label, direction, i18n.language, t]);\n\n /* ---- theme-reactive state -------------------------------------- */\n const [themeOptions, setThemeOptions] = useState<ApexCharts.ApexOptions>(\n () => {\n try {\n return getApexChartsTheme();\n } catch {\n return {};\n }\n },\n );\n\n /* ---- MutationObserver: re-read theme on class change ----------- */\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout>;\n const observer = new MutationObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n try {\n setThemeOptions(getApexChartsTheme());\n } catch {\n /* no-op in non-browser environments */\n }\n }, 50);\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n\n /* ---- ResizeObserver: track container width -------------------- */\n useEffect(() => {\n const el = wrapperRef.current;\n if (!el) return;\n const measureTarget = () => {\n // The resolved token off the wrapper: theme classes live above the\n // component, so the cascade answers for whichever theme applies.\n const raw = getComputedStyle(el).getPropertyValue('--min-target-size');\n const parsed = Number.parseFloat(raw);\n if (Number.isFinite(parsed) && parsed > 0) setHitWidth(parsed);\n };\n measureTarget();\n const ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setContainerWidth(Math.floor(entry.contentRect.width));\n measureTarget();\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n /* ApexCharts injects focusable canvases inside the `aria-hidden` */\n /* chart wrapper. Neutralise their tabindex so axe's */\n /* `aria-hidden-focus` rule passes. Shared hook — same fix in */\n /* `Chart` (full apex) and the calendar's mirror events. */\n useNeutraliseHiddenFocus(wrapperRef);\n\n /* ---- imperative handle ---------------------------------------- */\n // Through a ref so the handle keeps one identity across a host that\n // re-creates the callback on every render — the agent registry keys on it.\n const selectRef = useRef(onAnnotationSelect);\n useEffect(() => {\n selectRef.current = onAnnotationSelect;\n }, [onAnnotationSelect]);\n // Assigned during render, not in an effect: an agent may call before the\n // next commit, and routing the host to an annotation that is not drawn\n // opens a panel addressed to nothing.\n const drawnRef = useRef(annotations);\n drawnRef.current = annotations;\n // The `data` prop and `updateSeries` are two independent paths into\n // the rendered series — the latter writes straight into ApexCharts,\n // bypassing React — so track whichever applied last. Keyed on the\n // prop (not assigned every render) so an unrelated re-render does\n // not clobber a length an agent just set.\n // Read by `updateSeries`, which replaces the whole series. Never\n // undefined: Apex swaps an undefined name for \"series-1\", while an\n // empty one renders no name at all.\n const resolvedSeriesName = seriesName ?? label ?? '';\n const seriesNameRef = useRef(resolvedSeriesName);\n seriesNameRef.current = resolvedSeriesName;\n const pointCountRef = useRef(data.length);\n // Point labels and their slot map, read by the tooltip formatter through\n // a ref so a formatter Apex already holds never reads stale labels.\n const tooltipLabelsRef = useRef<{\n labels?: readonly string[];\n slotOf?: readonly number[];\n shown: boolean;\n }>({ shown: false });\n // Set by `updateSeries`: the host's labels describe the old series, so\n // the title stays hidden until the host passes new `data`.\n const labelsStaleRef = useRef(false);\n useEffect(() => {\n pointCountRef.current = data.length;\n if (!labelsStaleRef.current) return;\n labelsStaleRef.current = false;\n if (tooltipLabelsRef.current.shown) {\n ApexCharts.getChartByID(chartId)?.updateOptions({\n tooltip: { x: { show: true } },\n });\n }\n }, [data, chartId]);\n\n const agentHandle = useMemo<SparklineHandle>(\n () => ({\n updateSeries(newData: (number | null)[]) {\n const chart = ApexCharts.getChartByID(chartId);\n chart?.updateSeries([{ name: seriesNameRef.current, data: newData }]);\n pointCountRef.current = newData.length;\n if (tooltipLabelsRef.current.shown) {\n labelsStaleRef.current = true;\n chart?.updateOptions({ tooltip: { x: { show: false } } });\n }\n },\n updateOptions(opts: ApexCharts.ApexOptions) {\n ApexCharts.getChartByID(chartId)?.updateOptions(opts);\n },\n async dataURI(): Promise<string> {\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return '';\n const result = await instance.dataURI();\n return (result as { imgURI: string }).imgURI;\n },\n selectAnnotation(annotationId: string) {\n const drawn = drawnRef.current?.some((a) => a.id === annotationId);\n if (!drawn) return;\n selectRef.current?.(annotationId);\n },\n // Read-back for the two preconditions `selectAnnotation` enforces\n // silently — without these an agent can check neither and gets no\n // signal from either failure.\n getAnnotationIds: () => (drawnRef.current ?? []).map((a) => a.id),\n isSelectable: () => selectRef.current != null,\n getPointCount: () => pointCountRef.current,\n }),\n [chartId],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(sparklineAgent, agentHandle, id);\n\n /* ---- resolve color -------------------------------------------- */\n const resolvedColor = color ?? themeOptions.colors?.[0] ?? 'currentColor';\n\n /* ---- empty state ---------------------------------------------- */\n if (points.length === 0) {\n return (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={ariaLabel}\n dir=\"ltr\"\n className={sparklineVariants({\n size: height !== undefined ? 'auto' : size,\n className,\n })}\n data-component=\"sparkline\"\n data-component-id={id}\n {...props}\n />\n );\n }\n\n /* ---- chart config ---------------------------------------------- */\n const reducedMotion = prefersReducedMotion();\n\n // A gapped series is plotted as {x, y} pairs on a NUMERIC axis pinned to\n // the full slot count, not as an array with holes in it: ApexCharts draws\n // a line only between consecutive non-null points, so a lab measured at\n // slots 0, 4 and 8 would render as three isolated points and no trend at\n // all. Pairs keep each measurement at its own slot, connect across the\n // gap, and leave the extent — and so every annotation — unchanged.\n // Gapless data keeps the plain-array form, so every existing consumer\n // renders byte-identically.\n const gapped = data.length > points.length;\n const seriesData = gapped\n ? data.flatMap((y, x) => (y == null ? [] : [{ x, y }]))\n : points;\n\n // Apex hands the tooltip the index into the SERIES, whose gaps are\n // removed, so map it back to its slot in `data` before reading a label.\n const slotOf = gapped\n ? data.flatMap((y, slot) => (y == null ? [] : [slot]))\n : undefined;\n tooltipLabelsRef.current = {\n labels: pointLabels,\n slotOf,\n shown: showTooltip && pointLabels !== undefined,\n };\n const tooltip: ApexCharts.ApexOptions['tooltip'] = showTooltip\n ? {\n enabled: true,\n x: pointLabels\n ? {\n show: true,\n formatter: (_value, opts) => {\n const { labels, slotOf: slots } = tooltipLabelsRef.current;\n if (labelsStaleRef.current || !labels) return '';\n const index = opts?.dataPointIndex ?? -1;\n return labels[slots ? (slots[index] ?? -1) : index] ?? '';\n },\n }\n : // No labels: hide the title rather than show a raw index.\n { show: false },\n }\n : { enabled: false };\n\n const chartOptions: ApexCharts.ApexOptions = {\n ...themeOptions,\n chart: {\n ...themeOptions.chart,\n id: chartId,\n type: variant,\n sparkline: { enabled: true },\n toolbar: { show: false },\n animations: {\n enabled: !reducedMotion,\n // A gapped series is re-rendered as {x, y} pairs, and Apex's\n // update tween interpolates between the old and new paths point by\n // point. Across a width change the two have different lengths and\n // the tween emits `d=\"… NaN …\"` for a few frames. The finished\n // render is correct either way; switching the tween off keeps the\n // console clean.\n dynamicAnimation: { enabled: !reducedMotion && !gapped },\n },\n zoom: { enabled: false },\n parentHeightOffset: 0,\n },\n colors: [resolvedColor],\n stroke: {\n curve: 'smooth',\n width: variant === 'bar' ? 0 : 2,\n },\n fill: {\n opacity: variant === 'area' ? 0.15 : 1,\n },\n xaxis: {\n crosshairs: { show: false },\n // Pin the extent to the slot count so a gap at either end still holds\n // its place — otherwise the plot would rescale to the measurements\n // and the annotation fractions would no longer mean the same thing.\n ...(gapped\n ? { type: 'numeric' as const, min: 0, max: data.length - 1 }\n : {}),\n },\n tooltip,\n markers: showEndpoint\n ? {\n size: [0],\n discrete: [\n {\n // An index into the SERIES, whose holes have already been\n // removed — so this is the last MEASURED point, never a slot\n // the parameter was not measured at.\n seriesIndex: 0,\n dataPointIndex: seriesData.length - 1,\n fillColor: resolvedColor,\n strokeColor: resolvedColor,\n size: 4,\n },\n ],\n }\n : { size: 0 },\n grid: {\n ...themeOptions.grid,\n show: false,\n // ApexCharts grid.padding uses physical keys (not CSS logical properties).\n // The chart wrapper enforces dir=\"ltr\" so these always resolve correctly.\n padding: {\n top: PLOT_EDGE_PADDING,\n right: PLOT_EDGE_PADDING,\n bottom: PLOT_EDGE_PADDING,\n left: PLOT_EDGE_PADDING,\n },\n },\n };\n\n const resolvedWidth =\n width ?? (containerWidth > 0 ? containerWidth : '100%');\n const resolvedHeight = height ?? SIZE_HEIGHT[size ?? 'md'];\n\n // Positioned as a percentage of the overlay's own box rather than from a\n // measured width: the overlay is inset to the plot area, so a fraction is\n // exact at any size and cannot lag or disagree with the plot.\n const drawnAnnotations = annotations?.length ? annotations : undefined;\n\n // The plot box in px — the overlay is the wrapper inset by the grid padding\n // on each edge. Nothing is measured before the first ResizeObserver tick,\n // and a band with no width lies about where it is: no width, no bands.\n const plotWidth = containerWidth - PLOT_EDGE_PADDING * 2;\n const hitBands =\n onAnnotationSelect && drawnAnnotations && plotWidth > 0\n ? annotationHitBands(drawnAnnotations, plotWidth, hitWidth)\n : undefined;\n\n return (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={ariaLabel}\n dir=\"ltr\"\n className={sparklineVariants({\n size: height !== undefined ? 'auto' : size,\n className,\n })}\n data-component=\"sparkline\"\n data-component-id={id}\n {...props}\n >\n <ReactApexChart\n type={variant}\n series={[{ name: resolvedSeriesName, data: seriesData }]}\n options={chartOptions}\n width={resolvedWidth}\n height={resolvedHeight}\n aria-hidden=\"true\"\n />\n {drawnAnnotations && (\n /* Drawn over the plot rather than through ApexCharts' own xaxis\n annotations: a fraction of the measured extent is the one\n positioning rule that survives series of different lengths, which\n is what makes a column of sparklines share an x. */\n /* The inset lives on a div: an <svg> is a replaced element, so\n left+right do not size it and it would fall back to its intrinsic\n 300px. The div is the plot box; the svg fills it. The 2px MUST\n equal PLOT_EDGE_PADDING — Tailwind needs a static literal, so the\n two cannot share one source; change them together or the first and\n last annotation drift off the first and last data point. */\n <div className=\"ds:pointer-events-none ds:absolute ds:inset-y-0 ds:inset-x-[2px]\">\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-testid=\"sparkline-annotations\"\n className=\"ds:size-full\"\n >\n {drawnAnnotations.map((annotation) => {\n const fraction = clampFraction(annotation.position);\n return (\n /* A nested viewport placed at a percentage of the plot: the\n one positioning rule that needs no measurement, so a column\n of sparklines shares an x whatever their widths. */\n <svg\n key={annotation.id}\n x={`${fraction * 100}%`}\n y=\"0\"\n width=\"1\"\n height=\"100%\"\n overflow=\"visible\"\n data-annotation-id={annotation.id}\n data-annotation-position={fraction}\n className={annotationVariants({ tone: annotation.tone })}\n >\n <line\n x1={0}\n x2={0}\n y1={0}\n y2=\"100%\"\n /* 1px, more gap than dash: the line marks WHERE, the\n series is what is read, and at 1.5px the annotation\n was the louder of the two. */\n className=\"ds:[stroke:var(--annotation-color)] ds:[stroke-dasharray:2_3] ds:[stroke-width:1]\"\n />\n <path\n d={markerPath(\n annotation.shape ?? 'diamond',\n 0,\n ANNOTATION_CAP_RADIUS,\n ANNOTATION_CAP_RADIUS,\n )}\n className=\"ds:[fill:var(--annotation-color)]\"\n />\n </svg>\n );\n })}\n </svg>\n </div>\n )}\n {hitBands && onAnnotationSelect && (\n /* Sized in px, not percentages: the target size is a measurement,\n not a fraction of a box the reader can resize.\n `pointer-events-none` holds all the way down to the bands, so the\n only live pixels are the token-width each annotation owns. */\n <div\n className={annotationHitVariants({\n size: height !== undefined ? 'auto' : size,\n })}\n >\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-testid=\"sparkline-annotation-hits\"\n className=\"ds:size-full\"\n >\n {hitBands.map(({ annotation, x, width }) => (\n <g\n key={annotation.id}\n data-annotation-hit-id={annotation.id}\n onClick={() => onAnnotationSelect(annotation.id)}\n className={`ds:group ds:pointer-events-auto ds:cursor-pointer ${annotationVariants(\n { tone: annotation.tone },\n )}`}\n >\n {/* A native tooltip for the pointer that can act on it. The\n same labels already ride the wrapper's aria-label, and\n this svg is aria-hidden, so nothing is said twice. */}\n <title>\n {t('sparkline.annotationAction', {\n label: annotation.label,\n })}\n </title>\n {/* Target and hover affordance in one rect: it tints on\n hover so the reader sees which event the press means.\n Opacity does not affect hit-testing. */}\n <rect\n x={x}\n y={0}\n width={width}\n height=\"100%\"\n className=\"ds:[fill:var(--annotation-color)] ds:opacity-0 ds:transition-opacity ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:group-hover:opacity-20\"\n />\n </g>\n ))}\n </svg>\n </div>\n )}\n {showEndpoint && (\n <span\n aria-hidden=\"true\"\n className=\"ds:pointer-events-none ds:absolute ds:end-0 ds:top-0 ds:text-[length:var(--font-size-xs)] ds:leading-none\"\n >\n {DIRECTION_ARROW[direction]}\n </span>\n )}\n </div>\n );\n },\n);\n\nSparkline.displayName = 'Sparkline';\n"],"names":["useLinearTrend","data","n","xMean","yMean","sum","y","numerator","denominator","i","dx","slope","threshold","direction","sparklineAgent","handle","args","sparklineVariants","cva","annotationVariants","annotationHitVariants","DIRECTION_ARROW","SIZE_HEIGHT","PLOT_EDGE_PADDING","ANNOTATION_CAP_RADIUS","ANNOTATION_HIT_WIDTH","annotationHitBands","annotations","plotWidth","hitWidth","centred","annotation","clampFraction","b","entry","index","before","after","from","to","lower","upper","width","x","value","measured","prefersReducedMotion","Sparkline","forwardRef","id","variant","size","label","color","showEndpoint","showTooltip","seriesName","pointLabels","height","onAnnotationSelect","className","props","ref","t","i18n","useTranslation","rawId","useId","chartId","useMemo","wrapperRef","useRef","containerWidth","setContainerWidth","useState","setHitWidth","points","ariaLabel","marks","a","withMarks","summary","fmt","dirText","nums","themeOptions","setThemeOptions","getApexChartsTheme","useEffect","timer","observer","el","measureTarget","raw","parsed","ro","entries","useNeutraliseHiddenFocus","selectRef","drawnRef","resolvedSeriesName","seriesNameRef","pointCountRef","tooltipLabelsRef","labelsStaleRef","_a","ApexCharts","agentHandle","newData","chart","opts","instance","annotationId","_b","useImperativeHandle","useAgentRegistration","resolvedColor","jsx","reducedMotion","gapped","seriesData","slotOf","slot","tooltip","_value","labels","slots","chartOptions","resolvedWidth","resolvedHeight","drawnAnnotations","hitBands","jsxs","ReactApexChart","fraction","markerPath"],"mappings":";;;;;;;;;AAOO,SAASA,GAAe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AAA;AAAA,QAC5B;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAkC,GAAU,cAAc;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow-map-C7fHKTXL.js","sources":["../../node_modules/lucide-react/dist/esm/icons/circle-pause.mjs","../../node_modules/lucide-react/dist/esm/icons/power-off.mjs","../../node_modules/lucide-react/dist/esm/icons/power.mjs","../../src/components/workflow/workflow-card.tsx","../../src/components/workflow/workflow.agent.ts","../../src/components/workflow/workflow-types.ts","../../src/components/workflow/workflow-editor.tsx","../../src/components/workflow/workflow-map.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 [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"line\", { x1: \"10\", x2: \"10\", y1: \"15\", y2: \"9\", key: \"c1nkhi\" }],\n [\"line\", { x1: \"14\", x2: \"14\", y1: \"15\", y2: \"9\", key: \"h65svq\" }]\n];\nconst CirclePause = createLucideIcon(\"circle-pause\", __iconNode);\n\nexport { __iconNode, CirclePause as default };\n//# sourceMappingURL=circle-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 [\"path\", { d: \"M18.36 6.64A9 9 0 0 1 20.77 15\", key: \"dxknvb\" }],\n [\"path\", { d: \"M6.16 6.16a9 9 0 1 0 12.68 12.68\", key: \"1x7qb5\" }],\n [\"path\", { d: \"M12 2v4\", key: \"3427ic\" }],\n [\"path\", { d: \"m2 2 20 20\", key: \"1ooewy\" }]\n];\nconst PowerOff = createLucideIcon(\"power-off\", __iconNode);\n\nexport { __iconNode, PowerOff as default };\n//# sourceMappingURL=power-off.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 [\"path\", { d: \"M12 2v10\", key: \"mnfbl\" }],\n [\"path\", { d: \"M18.4 6.6a9 9 0 1 1-12.77.04\", key: \"obofu9\" }]\n];\nconst Power = createLucideIcon(\"power\", __iconNode);\n\nexport { __iconNode, Power as default };\n//# sourceMappingURL=power.mjs.map\n","import { forwardRef, type MouseEvent, type ReactNode } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n Circle,\n CircleDashed,\n CirclePause,\n Pencil,\n Power,\n PowerOff,\n Trash2,\n} from 'lucide-react';\nimport { Card } from '../card';\nimport { Badge } from '../badge';\nimport { KeyValuePair } from '../key-value-pair';\nimport { Timestamp } from '../timestamp';\nimport { IconButton } from '../button/icon-button';\nimport type { WorkflowStatus, WorkflowSummary } from './workflow-types';\n\n/* ------------------------------------------------------------------ */\n/* Variants */\n/* ------------------------------------------------------------------ */\n\nconst workflowCardVariants = cva('ds:relative ds:w-full', {\n variants: {\n density: {\n comfortable: '',\n compact: '',\n },\n },\n defaultVariants: {\n density: 'comfortable',\n },\n});\n\n/* ------------------------------------------------------------------ */\n/* Status → badge + icon mapping */\n/* ------------------------------------------------------------------ */\n\ntype BadgeVariant = 'neutral' | 'success' | 'warning';\n\ninterface StatusMeta {\n badgeVariant: BadgeVariant;\n icon: ReactNode;\n}\n\nfunction getStatusMeta(status: WorkflowStatus): StatusMeta {\n switch (status) {\n case 'active':\n // Filled dot for `active` — readable without hue (WCAG 1.4.1).\n return {\n badgeVariant: 'success',\n icon: <Circle className=\"ds:fill-current\" aria-hidden=\"true\" />,\n };\n case 'paused':\n return {\n badgeVariant: 'warning',\n icon: <CirclePause aria-hidden=\"true\" />,\n };\n case 'inactive':\n default:\n return {\n badgeVariant: 'neutral',\n icon: <CircleDashed aria-hidden=\"true\" />,\n };\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Props */\n/* ------------------------------------------------------------------ */\n\nexport interface WorkflowCardProps extends VariantProps<\n typeof workflowCardVariants\n> {\n workflow: WorkflowSummary;\n density?: 'comfortable' | 'compact';\n /** Fires when the card body is clicked. Absent → card is not interactive. */\n onView?: (id: string) => void;\n /** Fires when the edit IconButton is clicked. Absent → no edit button. */\n onEdit?: (id: string) => void;\n /** Fires when the delete IconButton is clicked. Absent → no delete button. */\n onDelete?: (id: string) => void;\n /**\n * Fires when the activate/deactivate IconButton is clicked. The second\n * argument is the TARGET state (the opposite of the current status), so the\n * consumer's handler is idempotent. Absent → no toggle button.\n */\n onToggleActive?: (id: string, active: boolean) => void;\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* WorkflowCard */\n/* ------------------------------------------------------------------ */\n\nexport const WorkflowCard = forwardRef<HTMLElement, WorkflowCardProps>(\n function WorkflowCard(\n {\n workflow,\n density = 'comfortable',\n onView,\n onEdit,\n onDelete,\n onToggleActive,\n className,\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n\n const statusMeta = getStatusMeta(workflow.status);\n const isActive = workflow.status === 'active';\n const isCompact = density === 'compact';\n\n // Icon-button clicks must not bubble up to the card body so that\n // `onView` doesn't fire along with edit / delete / toggle.\n const stop =\n (handler: (() => void) | undefined) =>\n (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n handler?.();\n };\n\n const statusBadge = (\n <Badge\n variant={statusMeta.badgeVariant}\n leading={statusMeta.icon}\n withDot={false}\n >\n {t(`workflow.status.${workflow.status}`)}\n </Badge>\n );\n\n const activeCountLabel = t('workflow.card.activeEnrollments');\n\n // When `onView` is provided we can't make the `<article>` itself a\n // role=\"button\" — that would violate both `aria-allowed-role`\n // (article forbids role=button) and `nested-interactive` (the\n // IconButtons in the footer would nest inside an outer button).\n // Instead we expose a single accessible-name-carrying `<button>`\n // on the title, styled to span the whole card via an inset ::after\n // pseudo-element so the hit target stays card-wide.\n return (\n <Card\n ref={ref}\n variant=\"default\"\n className={workflowCardVariants({ density, className })}\n data-component=\"workflow-card\"\n data-component-id={workflow.id}\n >\n <Card.Header>\n <div className=\"ds:flex ds:items-start ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <h3 className=\"ds:m-0 type-title-card ds:text-[color:var(--foreground)] ds:[overflow-wrap:anywhere] ds:break-words\">\n {onView ? (\n <button\n type=\"button\"\n onClick={() => onView(workflow.id)}\n className={[\n 'ds:text-start ds:font-inherit ds:text-inherit',\n // Inset overlay that turns the whole card into a\n // click target without nesting buttons. The\n // IconButton cluster in the footer paints above\n // this pseudo via `position: relative` + z-10.\n 'ds:after:absolute ds:after:inset-0 ds:after:content-[\"\"]',\n 'ds:after:rounded-[var(--radius-lg)]',\n 'ds:focus-visible:outline-none',\n 'ds:focus-visible:after:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:after:outline-solid',\n 'ds:focus-visible:after:outline-[color:var(--ring)]',\n 'ds:focus-visible:after:outline-offset-[length:var(--focus-ring-offset)]',\n ].join(' ')}\n >\n {workflow.name}\n </button>\n ) : (\n workflow.name\n )}\n </h3>\n {isCompact && (\n <span className=\"ds:flex ds:items-baseline ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[color:var(--muted-foreground)]\">\n <span>{activeCountLabel}</span>\n <span className=\"ds:font-medium ds:text-[color:var(--foreground)]\">\n {workflow.stats.activeEnrollments}\n </span>\n </span>\n )}\n </div>\n <div className=\"ds:shrink-0\">{statusBadge}</div>\n </div>\n </Card.Header>\n\n {!isCompact && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <KeyValuePair\n label={t('workflow.card.activeEnrollments')}\n value={workflow.stats.activeEnrollments}\n />\n <KeyValuePair\n label={t('workflow.card.totalEnrollments')}\n value={workflow.stats.totalEnrollments}\n />\n </Card.Body>\n )}\n\n <Card.Footer className=\"ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[color:var(--muted-foreground)]\">\n <span className=\"ds:truncate\" title={workflow.createdBy}>\n {t('workflow.createdBy', { name: workflow.createdBy })}\n </span>\n {workflow.updatedAt && (\n <Timestamp\n value={workflow.updatedAt}\n format=\"absolute\"\n shape=\"bare\"\n absoluteFormat={{ dateStyle: 'medium' }}\n className=\"ds:truncate\"\n />\n )}\n </div>\n\n <div className=\"ds:relative ds:z-10 ds:flex ds:shrink-0 ds:items-center ds:gap-[var(--spacing-xs)] ds:ms-auto\">\n {onEdit && (\n <IconButton\n icon={<Pencil />}\n size=\"sm\"\n intent=\"ghost\"\n aria-label={t('workflow.card.edit')}\n onClick={stop(() => onEdit(workflow.id))}\n />\n )}\n {onToggleActive && (\n <IconButton\n icon={isActive ? <PowerOff /> : <Power />}\n size=\"sm\"\n intent=\"ghost\"\n aria-label={t(\n isActive\n ? 'workflow.card.deactivate'\n : 'workflow.card.activate',\n )}\n onClick={stop(() => onToggleActive(workflow.id, !isActive))}\n />\n )}\n {onDelete && (\n <IconButton\n icon={<Trash2 />}\n size=\"sm\"\n intent=\"destructive\"\n aria-label={t('workflow.card.delete')}\n onClick={stop(() => onDelete(workflow.id))}\n />\n )}\n </div>\n </Card.Footer>\n </Card>\n );\n },\n);\n\nWorkflowCard.displayName = 'WorkflowCard';\n","/* -------------------------------------------------------------------- */\n/* Agent adapters — Workflow surfaces. */\n/* */\n/* The `workflow/` directory ships three distinct components — each with */\n/* its own `data-component` value (workflow-card, workflow-editor, */\n/* workflow-map). Three adapters are declared here, one per surface, so */\n/* the catalog reflects what's actually rendered in the DOM. The editor */\n/* is the only mutation surface; card and map are presentational and ship */\n/* root hooks only. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { WorkflowEditorHandle } from './workflow-editor';\n\nexport const workflowCardAgent: AgentAdapter = {\n id: 'workflow-card',\n // Presentational summary card — no agent-facing action or state. Navigation\n // is owned by the host pattern, so no capability is declared here.\n capabilities: [],\n state: {},\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'workflow-card',\n description:\n 'Marks a Workflow summary card. Presentational — actions are owned by the host pattern.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n\nexport const workflowMapAgent: AgentAdapter = {\n id: 'workflow-map',\n // Presentational linear visualisation — no agent-facing action or state.\n capabilities: [],\n state: {},\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'workflow-map',\n description:\n 'Marks a Workflow map (linear visualisation). Presentational.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-node-id',\n description: 'Stable opaque workflow node id emitted on each step.',\n },\n },\n};\n\nexport const workflowEditorAgent: AgentAdapter<WorkflowEditorHandle> = {\n id: 'workflow-editor',\n // `goto_step` focuses a node (navigation). No `expand` capability: the\n // WorkflowEditorHandle exposes no expand/collapse method to back it.\n capabilities: ['navigate'],\n state: {\n totalSteps: {\n type: 'number',\n descriptionKey: 'ui.agent.workflowEditor.state.totalSteps',\n description: 'Total number of nodes currently in the workflow graph.',\n read: (handle) => handle.getTotalSteps(),\n },\n currentStep: {\n type: 'string | null',\n descriptionKey: 'ui.agent.workflowEditor.state.currentStep',\n description: 'Opaque node id of the currently-focused step, or null.',\n read: (handle) => handle.getCurrentStep(),\n },\n },\n actions: {\n goto_step: {\n safety: 'read',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.workflowEditor.actions.gotoStep',\n description: 'Focus a node by its opaque id.',\n invoke: (handle, args: { id: string }) => {\n handle.gotoStep(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'workflow-editor',\n description: 'Marks the WorkflowEditor surface.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-node-id',\n description: 'Stable opaque workflow node id emitted on each node card.',\n },\n },\n};\n","/**\n * Shared types and helpers for the Workflow component suite\n * (WorkflowCard · WorkflowEditor · WorkflowMap).\n *\n * The prop surface is DAG-shaped from day one — { nodes, edges } —\n * even though v1 renders workflows linearly. A linear pipeline is a\n * degenerate DAG where every node has exactly one outgoing edge with\n * a null condition. This means v2 branching (if/else) can ship as an\n * additive change without breaking v1 consumers.\n\n */\n\n// ---------------------------------------------------------------\n// Node types\n// ---------------------------------------------------------------\n\nexport type WorkflowActionType =\n | 'add_delay'\n | 'send_email'\n | 'send_sms'\n | 'create_task'\n // v2 types accepted by the type system today; the editor renders a\n // generic card for these until bespoke summariser UI ships.\n | 'send_whatsapp'\n | 'update_patient_field'\n | 'webhook';\n\nexport type WorkflowStatus = 'active' | 'inactive' | 'paused';\n\n// ---------------------------------------------------------------\n// Discriminated settings — `kind` narrows `WorkflowNode['settings']`\n// without the consumer needing a cast.\n// ---------------------------------------------------------------\n\nexport interface DelaySettings {\n kind: 'add_delay';\n days?: number;\n hours?: number;\n minutes?: number;\n}\n\nexport interface EmailSettings {\n kind: 'send_email';\n subject: string;\n body?: string;\n templateId?: string;\n}\n\nexport interface SmsSettings {\n kind: 'send_sms';\n body: string;\n}\n\nexport interface TaskSettings {\n kind: 'create_task';\n title: string;\n description?: string;\n assigneeId?: string;\n}\n\nexport interface WhatsAppSettings {\n kind: 'send_whatsapp';\n templateName: string;\n body?: string;\n}\n\nexport interface UpdateFieldSettings {\n kind: 'update_patient_field';\n /** Custom ObjectField id — NEVER a core patient column. */\n fieldId: string;\n fieldLabel: string;\n value: string;\n}\n\nexport interface WebhookSettings {\n kind: 'webhook';\n url: string;\n method: 'POST' | 'PUT';\n headers?: Record<string, string>;\n}\n\nexport type WorkflowActionSettings =\n | DelaySettings\n | EmailSettings\n | SmsSettings\n | TaskSettings\n | WhatsAppSettings\n | UpdateFieldSettings\n | WebhookSettings;\n\n// ---------------------------------------------------------------\n// Graph shape\n// ---------------------------------------------------------------\n\nexport interface WorkflowNode {\n id: string;\n type: WorkflowActionType;\n settings: WorkflowActionSettings;\n}\n\nexport interface WorkflowEdge {\n from: string;\n to: string;\n /**\n * Edge condition label. Null / omitted for linear pipelines.\n * Reserved for v2 branching: 'true' | 'false' for if_else nodes.\n */\n condition?: string | null;\n}\n\nexport interface WorkflowGraph {\n nodes: WorkflowNode[];\n edges: WorkflowEdge[];\n}\n\n// ---------------------------------------------------------------\n// Summary & stats (WorkflowCard)\n// ---------------------------------------------------------------\n\nexport interface WorkflowStats {\n totalEnrollments: number;\n activeEnrollments: number;\n}\n\nexport interface WorkflowSummary {\n id: string;\n name: string;\n status: WorkflowStatus;\n stats: WorkflowStats;\n actionCount: number;\n createdBy: string;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface EnrollmentCriteria {\n ruleCount: number;\n summary?: string;\n}\n\n// ---------------------------------------------------------------\n// Pure graph helpers — never mutate their inputs.\n// ---------------------------------------------------------------\n\n/**\n * Walk the linear chain starting from the first node (the one that\n * has no incoming linear edge). Returns nodes in execution order.\n * Throws in dev if the graph has a cycle or a node with multiple\n * linear outgoing edges (reserved for v2 branching).\n */\nexport function linearOrder(graph: WorkflowGraph): WorkflowNode[] {\n if (graph.nodes.length === 0) return [];\n\n const linearEdges = graph.edges.filter((e) => e.condition == null);\n const targets = new Set(linearEdges.map((e) => e.to));\n const roots = graph.nodes.filter((n) => !targets.has(n.id));\n\n // Fall back to the first declared node if the edges don't identify\n // a root (e.g. a brand-new graph with a single node and no edges).\n const start = roots[0] ?? graph.nodes[0];\n const byId = new Map(graph.nodes.map((n) => [n.id, n]));\n const edgesFrom = new Map<string, WorkflowEdge[]>();\n for (const edge of linearEdges) {\n const bucket = edgesFrom.get(edge.from) ?? [];\n bucket.push(edge);\n edgesFrom.set(edge.from, bucket);\n }\n\n const seen = new Set<string>();\n const order: WorkflowNode[] = [];\n let cursor: WorkflowNode | undefined = start;\n while (cursor && !seen.has(cursor.id)) {\n seen.add(cursor.id);\n order.push(cursor);\n const outgoing: WorkflowEdge[] = edgesFrom.get(cursor.id) ?? [];\n if (outgoing.length > 1) {\n // v2 branching surface — v1 renderer should warn but not crash.\n if (typeof console !== 'undefined') {\n console.warn(\n `[workflow] node ${cursor.id} has ${outgoing.length} outgoing linear edges; v1 walks the first only.`,\n );\n }\n }\n cursor = outgoing[0] ? byId.get(outgoing[0].to) : undefined;\n }\n\n // Append any orphan nodes (not reachable from the root) so callers\n // still see them in the UI instead of silently dropping them.\n for (const node of graph.nodes) {\n if (!seen.has(node.id)) order.push(node);\n }\n return order;\n}\n\n/**\n * Insert a new node after `afterNodeId` (or at the head when null).\n * Rewrites edges so the linear chain stays singly-linked.\n */\nexport function addNodeAfter(\n graph: WorkflowGraph,\n afterNodeId: string | null,\n node: WorkflowNode,\n): WorkflowGraph {\n const nodes = [...graph.nodes, node];\n\n if (afterNodeId === null) {\n // Insert at head.\n const oldHead = graph.nodes[0];\n if (!oldHead) {\n return { nodes, edges: [] };\n }\n return {\n nodes,\n edges: [\n { from: node.id, to: oldHead.id, condition: null },\n ...graph.edges,\n ],\n };\n }\n\n const outgoing = graph.edges.find(\n (e) => e.from === afterNodeId && e.condition == null,\n );\n\n if (!outgoing) {\n // Append at tail.\n return {\n nodes,\n edges: [\n ...graph.edges,\n { from: afterNodeId, to: node.id, condition: null },\n ],\n };\n }\n\n // Splice into the middle.\n const otherEdges = graph.edges.filter((e) => e !== outgoing);\n return {\n nodes,\n edges: [\n ...otherEdges,\n { from: afterNodeId, to: node.id, condition: null },\n { from: node.id, to: outgoing.to, condition: null },\n ],\n };\n}\n\n/** Remove a node and reconnect its neighbours so the chain stays intact. */\nexport function removeNode(\n graph: WorkflowGraph,\n nodeId: string,\n): WorkflowGraph {\n const incoming = graph.edges.find(\n (e) => e.to === nodeId && e.condition == null,\n );\n const outgoing = graph.edges.find(\n (e) => e.from === nodeId && e.condition == null,\n );\n\n const kept = graph.edges.filter((e) => e.from !== nodeId && e.to !== nodeId);\n\n const bridged =\n incoming && outgoing\n ? [...kept, { from: incoming.from, to: outgoing.to, condition: null }]\n : kept;\n\n return {\n nodes: graph.nodes.filter((n) => n.id !== nodeId),\n edges: bridged,\n };\n}\n\n/** Swap a node with its neighbour in the linear chain. */\nexport function moveNode(\n graph: WorkflowGraph,\n nodeId: string,\n direction: 'up' | 'down',\n): WorkflowGraph {\n const order = linearOrder(graph);\n const index = order.findIndex((n) => n.id === nodeId);\n if (index === -1) return graph;\n\n const swapIndex = direction === 'up' ? index - 1 : index + 1;\n if (swapIndex < 0 || swapIndex >= order.length) return graph;\n\n const a = order[index];\n const b = order[swapIndex];\n if (!a || !b) return graph;\n\n // Remove both, then re-insert in swapped order via the helpers above.\n // This is O(n) but keeps the invariant maintenance in one place.\n const afterRemove = removeNode(removeNode(graph, a.id), b.id);\n\n const first = direction === 'up' ? a : b;\n const second = direction === 'up' ? b : a;\n\n // Identify the node that now precedes the swap pair (or null for head).\n const firstPredecessor = order[Math.min(index, swapIndex) - 1]?.id ?? null;\n\n const step1 = addNodeAfter(afterRemove, firstPredecessor, first);\n return addNodeAfter(step1, first.id, second);\n}\n\n// ---------------------------------------------------------------\n// Action-type registry — single source of truth for icons + labels.\n// Adding a new action type requires: (a) extending\n// `WorkflowActionType`, (b) adding an entry here, (c) adding i18n\n// keys under `ui.workflow.action.*`. Nothing else.\n// ---------------------------------------------------------------\n\nexport interface WorkflowActionMeta {\n /** i18n key for the type label — full path under `ui.*`. */\n labelKey: string;\n /** lucide-react icon name for dynamic lookup by consumers. */\n iconName:\n | 'Clock'\n | 'Mail'\n | 'Smartphone'\n | 'CheckSquare'\n | 'MessageCircle'\n | 'UserCog'\n | 'Globe';\n}\n\n/**\n * Core patient columns that a workflow MUST NOT overwrite. The\n * `update_patient_field` action is scoped to custom `ObjectField`\n * entries only; passing one of these ids is a misconfiguration and\n * the editor surfaces a warning strip.\n *\n * The maintainability requirement behind this: a misconfigured\n * workflow must not be able to overwrite a patient's legal name or\n * contact info.\n */\nexport const CORE_PATIENT_FIELDS: ReadonlySet<string> = new Set([\n 'dateOfBirth',\n 'date_of_birth',\n 'firstName',\n 'first_name',\n 'lastName',\n 'last_name',\n 'name',\n 'email',\n 'phone',\n 'phoneNumber',\n 'phone_number',\n 'fiscalCode',\n 'fiscal_code',\n 'taxId',\n 'tax_id',\n 'gender',\n 'address',\n 'id',\n]);\n\n/** True when the field id targets a core patient column (never allowed). */\nexport function isCorePatientField(fieldId: string): boolean {\n return CORE_PATIENT_FIELDS.has(fieldId);\n}\n\nexport const workflowActionRegistry: Record<\n WorkflowActionType,\n WorkflowActionMeta\n> = {\n add_delay: {\n labelKey: 'workflow.action.addDelay',\n iconName: 'Clock',\n },\n send_email: {\n labelKey: 'workflow.action.sendEmail',\n iconName: 'Mail',\n },\n send_sms: {\n labelKey: 'workflow.action.sendSms',\n iconName: 'Smartphone',\n },\n create_task: {\n labelKey: 'workflow.action.createTask',\n iconName: 'CheckSquare',\n },\n send_whatsapp: {\n labelKey: 'workflow.action.sendWhatsapp',\n iconName: 'MessageCircle',\n },\n update_patient_field: {\n labelKey: 'workflow.action.updateField',\n iconName: 'UserCog',\n },\n webhook: {\n labelKey: 'workflow.action.webhook',\n iconName: 'Globe',\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type MutableRefObject,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { workflowEditorAgent } from './workflow.agent';\nimport {\n SquareCheckBig,\n ChevronDown,\n ChevronUp,\n Clock,\n Globe,\n Mail,\n MessageCircle,\n Pencil,\n Plus,\n Smartphone,\n Trash2,\n UserCog,\n type LucideIcon,\n} from 'lucide-react';\nimport { Card } from '../card';\nimport { Alert } from '../alert';\nimport { Button } from '../button';\nimport { IconButton } from '../button/icon-button';\nimport { DropdownMenu } from '../dropdown-menu';\nimport { EmptyState } from '../empty-state';\nimport {\n addNodeAfter,\n isCorePatientField,\n linearOrder,\n moveNode,\n workflowActionRegistry,\n type EnrollmentCriteria,\n type WorkflowActionMeta,\n type WorkflowActionSettings,\n type WorkflowActionType,\n type WorkflowGraph,\n type WorkflowNode,\n} from './workflow-types';\n\n/* ------------------------------------------------------------------ */\n/* Icon map — explicit so the bundler can tree-shake lucide-react */\n/* properly. Driven by `iconName` from the action registry. */\n/* ------------------------------------------------------------------ */\n\nconst ACTION_ICONS: Record<WorkflowActionMeta['iconName'], LucideIcon> = {\n Clock,\n Mail,\n Smartphone,\n CheckSquare: SquareCheckBig,\n MessageCircle,\n UserCog,\n Globe,\n};\n\nfunction ActionIcon({\n iconName,\n className,\n}: {\n iconName: WorkflowActionMeta['iconName'];\n className?: string;\n}) {\n const Glyph = ACTION_ICONS[iconName];\n return <Glyph aria-hidden=\"true\" className={className ?? 'ds:size-4'} />;\n}\n\n/* ------------------------------------------------------------------ */\n/* Settings summary helper — narrows on the discriminated-union */\n/* `kind` so every branch reads its type-specific fields safely. */\n/* ------------------------------------------------------------------ */\n\nconst TRUNCATE_EMAIL = 40;\nconst TRUNCATE_SMS = 60;\n\nfunction truncate(value: string, max: number): string {\n if (value.length <= max) return value;\n return `${value.slice(0, max - 1)}\\u2026`;\n}\n\ninterface SummaryResult {\n /** Displayed (possibly truncated) text. */\n text: string;\n /** Full, un-truncated text for `title` and `aria-label`. */\n full: string;\n}\n\nfunction summariseSettings(\n settings: WorkflowActionSettings,\n t: (key: string, options?: Record<string, unknown>) => string,\n): SummaryResult | null {\n switch (settings.kind) {\n case 'add_delay': {\n const days = settings.days ?? 0;\n const summary = t('workflow.delay.summary', { count: days });\n return { text: summary, full: summary };\n }\n case 'send_email': {\n const subject = settings.subject ?? '';\n const prefix = t('workflow.action.sendEmail');\n const full = `${prefix}: ${subject}`;\n return { text: truncate(full, TRUNCATE_EMAIL), full };\n }\n case 'send_sms': {\n const body = settings.body ?? '';\n return { text: truncate(body, TRUNCATE_SMS), full: body };\n }\n case 'create_task': {\n const title = settings.title ?? '';\n return { text: title, full: title };\n }\n // v2 types — generic fallback (no bespoke summariser yet).\n case 'send_whatsapp':\n case 'update_patient_field':\n case 'webhook':\n default:\n return null;\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Classes (no hardcoded colours / physical props / inline styles) */\n/* ------------------------------------------------------------------ */\n\nconst rootClasses = [\n 'ds:flex ds:flex-col',\n 'ds:w-full',\n 'ds:text-start',\n 'ds:gap-[var(--spacing-sm)]',\n].join(' ');\n\n// Connector line between items. Uses `border-inline-start` so the rule\n// automatically mirrors in RTL without any physical left/right reference.\nconst connectorClasses = [\n 'ds:block',\n 'ds:self-start',\n 'ds:h-[var(--spacing-md)]',\n 'ds:ms-[calc(var(--min-target-size)/2)]',\n 'ds:border-inline-start-[var(--border-width-hairline)]',\n 'ds:border-solid',\n 'ds:border-[color:var(--border)]',\n].join(' ');\n\nconst addButtonClasses = [\n 'ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)]',\n 'ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:border ds:border-dashed ds:border-[color:var(--border)]',\n 'ds:bg-[color:var(--background)]',\n 'ds:text-[color:var(--muted-foreground)]',\n 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]',\n 'ds:text-[length:var(--font-size-sm)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-[color:var(--muted)]/20 ds:hover:text-[color:var(--foreground)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:disabled:opacity-50 ds:disabled:cursor-not-allowed',\n].join(' ');\n\nconst nodeCardFocusableClasses = [\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:rounded-[var(--radius-lg)]',\n].join(' ');\n\n/* ------------------------------------------------------------------ */\n/* Props */\n/* ------------------------------------------------------------------ */\n\n/** Curated imperative handle for agent / external automation. */\nexport interface WorkflowEditorHandle {\n getTotalSteps: () => number;\n getCurrentStep: () => string | null;\n gotoStep: (id: string) => void;\n}\n\nexport interface WorkflowEditorProps {\n /** DAG-shaped graph. v1 renders the linear chain via `linearOrder`. */\n graph: WorkflowGraph;\n /**\n * Fires for INTERNAL mutations only — add / reorder. Never fired for\n * edit or delete (those have their own callbacks). When `isActive`\n * is true the editor MUST NOT call this.\n */\n onChange: (graph: WorkflowGraph) => void;\n /** Optional enrollment-criteria summary rendered as a fixed header card. */\n enrollmentCriteria?: EnrollmentCriteria;\n /** Fires when the \"Edit criteria\" CTA in the criteria header is clicked. */\n onEditEnrollmentCriteria?: () => void;\n /** Locks ALL mutation controls and shows the active-lock banner. */\n isActive?: boolean;\n /**\n * Action types available in the add-action DropdownMenu.\n * Defaults to every key in `workflowActionRegistry`.\n */\n availableActions?: WorkflowActionType[];\n /** Fires when a node's edit IconButton is clicked. Consumer owns the form. */\n onEditNode?: (nodeId: string) => void;\n /** Fires when a node's delete IconButton is clicked. Consumer confirms. */\n onDeleteNode?: (nodeId: string) => void;\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Defaults */\n/* ------------------------------------------------------------------ */\n\nconst ALL_ACTION_TYPES = Object.keys(\n workflowActionRegistry,\n) as WorkflowActionType[];\n\nlet nodeIdCounter = 0;\nfunction generateNodeId(): string {\n nodeIdCounter += 1;\n const random = Math.random().toString(36).slice(2, 8);\n return `wf-node-${Date.now()}-${nodeIdCounter}-${random}`;\n}\n\nfunction defaultSettingsFor(type: WorkflowActionType): WorkflowActionSettings {\n switch (type) {\n case 'add_delay':\n return { kind: 'add_delay', days: 1 };\n case 'send_email':\n return { kind: 'send_email', subject: '' };\n case 'send_sms':\n return { kind: 'send_sms', body: '' };\n case 'create_task':\n return { kind: 'create_task', title: '' };\n case 'send_whatsapp':\n return { kind: 'send_whatsapp', templateName: '' };\n case 'update_patient_field':\n return {\n kind: 'update_patient_field',\n fieldId: '',\n fieldLabel: '',\n value: '',\n };\n case 'webhook':\n return { kind: 'webhook', url: '', method: 'POST' };\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Roving-tabindex helper: a `useRef`-backed mutable index without */\n/* re-rendering on every arrow keystroke. */\n/* ------------------------------------------------------------------ */\n\nfunction useMutableIndex(\n initial = 0,\n): [MutableRefObject<number>, (v: number) => void] {\n const ref = useRef(initial);\n const setter = useCallback((v: number) => {\n ref.current = v;\n }, []);\n return [ref, setter];\n}\n\n/* ------------------------------------------------------------------ */\n/* Action-node card */\n/* ------------------------------------------------------------------ */\n\ninterface ActionNodeCardProps {\n node: WorkflowNode;\n position: number;\n total: number;\n disabled: boolean;\n onEdit?: (id: string) => void;\n onDelete?: (id: string) => void;\n onMove: (id: string, direction: 'up' | 'down') => void;\n registerRef: (id: string, el: HTMLDivElement | null) => void;\n}\n\nfunction ActionNodeCard({\n node,\n position,\n total,\n disabled,\n onEdit,\n onDelete,\n onMove,\n registerRef,\n}: ActionNodeCardProps) {\n const { t } = useTranslation('ui');\n const meta = workflowActionRegistry[node.type];\n\n // Roving tabindex: the card itself is tabbable; once focused, arrow\n // keys step through its internal controls.\n const controlsRef = useRef<HTMLDivElement | null>(null);\n const [activeControl, setActiveControl] = useMutableIndex(0);\n\n const focusControl = useCallback(\n (index: number) => {\n const controls = controlsRef.current?.querySelectorAll<HTMLButtonElement>(\n 'button[data-wf-control]:not([disabled])',\n );\n if (!controls || controls.length === 0) return;\n const clamped = Math.max(0, Math.min(index, controls.length - 1));\n controls[clamped]?.focus();\n setActiveControl(clamped);\n },\n [setActiveControl],\n );\n\n const handleCardKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n // Only intercept keystrokes landing on the card wrapper itself.\n if (event.target !== event.currentTarget) return;\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n event.preventDefault();\n focusControl(0);\n }\n };\n\n const handleControlsKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n focusControl(activeControl.current + 1);\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault();\n focusControl(activeControl.current - 1);\n } else if (event.key === 'Home') {\n event.preventDefault();\n focusControl(0);\n } else if (event.key === 'End') {\n event.preventDefault();\n focusControl(Number.POSITIVE_INFINITY);\n }\n };\n\n const summary = summariseSettings(node.settings, t);\n const typeLabel = t(meta.labelKey);\n const canMoveUp = position > 0;\n const canMoveDown = position < total - 1;\n\n const positionText = t('workflow.editor.position', {\n current: position + 1,\n total,\n });\n const nodeAriaLabel = t('workflow.editor.nodeAriaLabel', {\n type: typeLabel,\n current: position + 1,\n total,\n });\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- node card is keyboard-actionable via roving tabindex; pipeline keys handled in onKeyDown\n <div\n ref={(el) => registerRef(node.id, el)}\n tabIndex={disabled ? -1 : 0}\n onKeyDown={handleCardKeyDown}\n aria-label={nodeAriaLabel}\n data-node-id={node.id}\n className={nodeCardFocusableClasses}\n >\n <Card variant=\"outlined\">\n <Card.Header className=\"ds:pb-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:size-8 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)] ds:bg-[color:var(--muted)]/20 ds:text-[color:var(--foreground)]\"\n >\n <ActionIcon iconName={meta.iconName} className=\"ds:size-4\" />\n </span>\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col\">\n <span className=\"ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-semibold)] ds:text-[color:var(--foreground)] ds:[overflow-wrap:anywhere] ds:break-words\">\n {typeLabel}\n </span>\n <span className=\"ds:text-[length:var(--font-size-xs)] ds:text-[color:var(--muted-foreground)]\">\n {positionText}\n </span>\n </div>\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions -- inner controls subtree handles arrow-key navigation between edit/delete buttons */}\n <div\n ref={controlsRef}\n onKeyDown={handleControlsKeyDown}\n className=\"ds:flex ds:shrink-0 ds:items-center ds:gap-[var(--spacing-xs)] ds:ms-auto\"\n >\n {onEdit ? (\n <IconButton\n data-wf-control=\"edit\"\n icon={<Pencil />}\n size=\"sm\"\n intent=\"ghost\"\n disabled={disabled}\n tabIndex={-1}\n aria-label={t('workflow.editor.editAction')}\n onClick={() => onEdit(node.id)}\n />\n ) : null}\n <IconButton\n data-wf-control=\"up\"\n icon={<ChevronUp />}\n size=\"sm\"\n intent=\"ghost\"\n disabled={disabled || !canMoveUp}\n tabIndex={-1}\n aria-label={t('workflow.editor.moveUp')}\n onClick={() => onMove(node.id, 'up')}\n />\n <IconButton\n data-wf-control=\"down\"\n icon={<ChevronDown />}\n size=\"sm\"\n intent=\"ghost\"\n disabled={disabled || !canMoveDown}\n tabIndex={-1}\n aria-label={t('workflow.editor.moveDown')}\n onClick={() => onMove(node.id, 'down')}\n />\n {onDelete ? (\n <IconButton\n data-wf-control=\"delete\"\n icon={<Trash2 />}\n size=\"sm\"\n intent=\"destructive\"\n disabled={disabled}\n tabIndex={-1}\n aria-label={t('workflow.editor.deleteAction')}\n onClick={() => onDelete(node.id)}\n />\n ) : null}\n </div>\n </div>\n </Card.Header>\n {summary ? (\n <Card.Body className=\"ds:pt-0\">\n <p\n className=\"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere] ds:break-words\"\n title={summary.full}\n >\n {summary.text}\n </p>\n </Card.Body>\n ) : null}\n {node.settings.kind === 'update_patient_field' &&\n isCorePatientField(node.settings.fieldId) ? (\n <Card.Body className=\"ds:pt-0\">\n <Alert variant=\"error\" data-testid=\"workflow-editor-invalid-field\">\n {t('workflow.editor.invalidField')}\n </Alert>\n </Card.Body>\n ) : null}\n </Card>\n </div>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Add-action trigger + DropdownMenu */\n/* ------------------------------------------------------------------ */\n\ninterface AddActionMenuProps {\n availableActions: WorkflowActionType[];\n onSelect: (type: WorkflowActionType) => void;\n disabled: boolean;\n label: string;\n compact?: boolean;\n}\n\nfunction AddActionMenu({\n availableActions,\n onSelect,\n disabled,\n label,\n compact = true,\n}: AddActionMenuProps) {\n const { t } = useTranslation('ui');\n\n return (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={label}\n className={addButtonClasses}\n >\n <Plus aria-hidden=\"true\" className=\"ds:size-4\" />\n {compact ? null : (\n <span className=\"ds:text-[length:var(--font-size-sm)]\">\n {label}\n </span>\n )}\n </button>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"start\" sideOffset={6}>\n <DropdownMenu.Label>\n {t('workflow.editor.addAction')}\n </DropdownMenu.Label>\n {availableActions.map((type) => {\n const meta = workflowActionRegistry[type];\n return (\n <DropdownMenu.Item\n key={type}\n startIcon={<ActionIcon iconName={meta.iconName} />}\n onSelect={() => onSelect(type)}\n >\n {t(meta.labelKey)}\n </DropdownMenu.Item>\n );\n })}\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Criteria header */\n/* ------------------------------------------------------------------ */\n\ninterface CriteriaHeaderProps {\n criteria?: EnrollmentCriteria;\n onEdit?: () => void;\n disabled: boolean;\n}\n\nfunction CriteriaHeader({ criteria, onEdit, disabled }: CriteriaHeaderProps) {\n const { t } = useTranslation('ui');\n const count = criteria?.ruleCount ?? 0;\n const summaryText =\n count > 0\n ? t('workflow.editor.criteriaCount', { count })\n : t('workflow.editor.noCriteria');\n\n return (\n <Card variant=\"outlined\">\n <Card.Header className=\"ds:pb-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col\">\n <span className=\"ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-semibold)] ds:text-[color:var(--foreground)]\">\n {t('workflow.editor.enrollmentCriteria')}\n </span>\n <span className=\"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere] ds:break-words\">\n {criteria?.summary ?? summaryText}\n </span>\n </div>\n {onEdit ? (\n <IconButton\n icon={<Pencil />}\n size=\"sm\"\n intent=\"ghost\"\n disabled={disabled}\n aria-label={t('workflow.editor.editCriteria')}\n onClick={onEdit}\n />\n ) : null}\n </div>\n </Card.Header>\n </Card>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* WorkflowEditor */\n/* ------------------------------------------------------------------ */\n\nexport const WorkflowEditor = forwardRef<HTMLDivElement, WorkflowEditorProps>(\n function WorkflowEditor(\n {\n graph,\n onChange,\n enrollmentCriteria,\n onEditEnrollmentCriteria,\n isActive = false,\n availableActions,\n onEditNode,\n onDeleteNode,\n className,\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n const types = availableActions ?? ALL_ACTION_TYPES;\n const ordered = useMemo(() => linearOrder(graph), [graph]);\n const nodeRefs = useRef<Map<string, HTMLDivElement | null>>(new Map());\n const focusTargetRef = useRef<string | null>(null);\n\n // Dev-mode guard: `onChange` should never fire while the editor is\n // locked. We wrap the consumer-supplied handler so internal calls\n // cannot violate the contract even if disabled state leaks.\n const safeOnChange = useCallback(\n (next: WorkflowGraph) => {\n if (isActive) {\n if (import.meta.env.DEV) {\n console.warn(\n '[WorkflowEditor] onChange suppressed — editor is active-locked.',\n );\n }\n return;\n }\n onChange(next);\n },\n [isActive, onChange],\n );\n\n const registerRef = useCallback((id: string, el: HTMLDivElement | null) => {\n if (el) {\n nodeRefs.current.set(id, el);\n } else {\n nodeRefs.current.delete(id);\n }\n }, []);\n\n const [currentStep, setCurrentStep] = useState<string | null>(null);\n const currentStepRef = useRef<string | null>(null);\n currentStepRef.current = currentStep;\n\n const rootRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLDivElement, []);\n\n const agentHandle = useMemo<WorkflowEditorHandle>(\n () => ({\n getTotalSteps: () => ordered.length,\n getCurrentStep: () => currentStepRef.current,\n gotoStep: (id: string) => {\n const el = nodeRefs.current.get(id);\n if (el) {\n el.focus();\n setCurrentStep(id);\n }\n },\n }),\n [ordered.length],\n );\n useAgentRegistration(workflowEditorAgent, agentHandle, undefined);\n\n // After a mutation, focus returns to the inserted / moved card.\n useEffect(() => {\n const id = focusTargetRef.current;\n if (!id) return;\n const el = nodeRefs.current.get(id);\n if (el) {\n el.focus();\n focusTargetRef.current = null;\n }\n });\n\n const handleAddAfter = (\n afterId: string | null,\n type: WorkflowActionType,\n ) => {\n if (isActive) return;\n const node: WorkflowNode = {\n id: generateNodeId(),\n type,\n settings: defaultSettingsFor(type),\n };\n focusTargetRef.current = node.id;\n safeOnChange(addNodeAfter(graph, afterId, node));\n };\n\n const handleMove = (id: string, direction: 'up' | 'down') => {\n if (isActive) return;\n focusTargetRef.current = id;\n safeOnChange(moveNode(graph, id, direction));\n };\n\n const handleEdit = (id: string) => {\n if (isActive || !onEditNode) return;\n onEditNode(id);\n };\n\n const handleDelete = (id: string) => {\n if (isActive || !onDeleteNode) return;\n onDeleteNode(id);\n };\n\n const renderBanner = (): ReactNode =>\n isActive ? (\n <Alert variant=\"warning\">\n <Alert.Title as=\"p\">{t('workflow.editor.activeLock')}</Alert.Title>\n </Alert>\n ) : null;\n\n const renderCriteria = (): ReactNode =>\n enrollmentCriteria || onEditEnrollmentCriteria ? (\n <>\n <CriteriaHeader\n criteria={enrollmentCriteria}\n onEdit={onEditEnrollmentCriteria}\n disabled={isActive}\n />\n <span aria-hidden=\"true\" className={connectorClasses} />\n </>\n ) : null;\n\n const total = ordered.length;\n\n if (total === 0) {\n return (\n <div\n ref={rootRef}\n className={[rootClasses, className].filter(Boolean).join(' ')}\n >\n {renderBanner()}\n {renderCriteria()}\n <EmptyState\n variant=\"first-use\"\n title={t('workflow.editor.addFirstAction')}\n description={t('workflow.editor.empty')}\n >\n <EmptyState.Illustration>\n <svg\n viewBox=\"0 0 120 120\"\n fill=\"none\"\n aria-hidden=\"true\"\n className=\"ds:w-full ds:h-full\"\n >\n <circle\n cx=\"60\"\n cy=\"60\"\n r=\"50\"\n fill=\"var(--muted)\"\n stroke=\"var(--border)\"\n strokeWidth=\"2\"\n />\n <rect\n x=\"55\"\n y=\"30\"\n width=\"10\"\n height=\"60\"\n rx=\"5\"\n fill=\"var(--primary)\"\n />\n <rect\n x=\"30\"\n y=\"55\"\n width=\"60\"\n height=\"10\"\n rx=\"5\"\n fill=\"var(--primary)\"\n />\n </svg>\n </EmptyState.Illustration>\n <EmptyState.Title>\n {t('workflow.editor.addFirstAction')}\n </EmptyState.Title>\n <EmptyState.Description>\n {t('workflow.editor.empty')}\n </EmptyState.Description>\n <EmptyState.Actions>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <Button intent=\"primary\" disabled={isActive}>\n <Plus aria-hidden=\"true\" className=\"ds:size-4\" />\n <span>{t('workflow.editor.addFirstAction')}</span>\n </Button>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"center\" sideOffset={6}>\n <DropdownMenu.Label>\n {t('workflow.editor.addAction')}\n </DropdownMenu.Label>\n {types.map((type) => {\n const meta = workflowActionRegistry[type];\n return (\n <DropdownMenu.Item\n key={type}\n startIcon={<ActionIcon iconName={meta.iconName} />}\n onSelect={() => handleAddAfter(null, type)}\n >\n {t(meta.labelKey)}\n </DropdownMenu.Item>\n );\n })}\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n </EmptyState.Actions>\n </EmptyState>\n </div>\n );\n }\n\n // Non-empty: render the full pipeline.\n //\n // Structure:\n // [banner?]\n // [criteria header? + connector]\n // [leading ⊕]\n // <ol role=\"list\" aria-label=\"Workflow pipeline\">\n // <li> ← native role=\"listitem\"\n // connector + action-card + connector + trailing ⊕ (per-item)\n // </li>\n // …\n // </ol>\n //\n // The interleaved ⊕ buttons live inside each <li> — they are NOT\n // listitems themselves (they're <button>s), so the accessible tree\n // still reports \"list with N items\". The card-focus wrapper carries\n // `role=\"listitem\"` redundantly to keep the wrapper the single\n // focusable interactive surface; native <li> also implies listitem\n // but the browser already dedupes identical roles.\n return (\n <div\n ref={rootRef}\n data-component=\"workflow-editor\"\n className={[rootClasses, className].filter(Boolean).join(' ')}\n >\n {renderBanner()}\n {renderCriteria()}\n\n {/* Leading ⊕ button — OUTSIDE the list. */}\n <div>\n <AddActionMenu\n availableActions={types}\n disabled={isActive}\n label={t('workflow.editor.addAction')}\n onSelect={(type) => handleAddAfter(null, type)}\n />\n </div>\n\n {/* eslint-disable-next-line jsx-a11y/no-redundant-roles -- Safari strips the implicit list role on <ol> with list-style:none; this guard puts it back in the accessibility tree */}\n <ol\n role=\"list\"\n aria-label={t('workflow.editor.pipeline')}\n className=\"ds:list-none ds:m-0 ds:p-0 ds:flex ds:flex-col\"\n >\n {ordered.map((node, index) => (\n <li key={node.id} className=\"ds:list-none ds:flex ds:flex-col\">\n <span aria-hidden=\"true\" className={connectorClasses} />\n <ActionNodeCard\n node={node}\n position={index}\n total={total}\n disabled={isActive}\n onEdit={onEditNode ? handleEdit : undefined}\n onDelete={onDeleteNode ? handleDelete : undefined}\n onMove={handleMove}\n registerRef={registerRef}\n />\n <span aria-hidden=\"true\" className={connectorClasses} />\n <div>\n <AddActionMenu\n availableActions={types}\n disabled={isActive}\n label={t('workflow.editor.addActionAfter')}\n onSelect={(type) => handleAddAfter(node.id, type)}\n />\n </div>\n </li>\n ))}\n </ol>\n </div>\n );\n },\n);\n\nWorkflowEditor.displayName = 'WorkflowEditor';\n","import {\n forwardRef,\n useMemo,\n type ComponentType,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type SVGProps,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n Check,\n SquareCheckBig,\n Clock,\n Globe,\n ClipboardCheck,\n Mail,\n MessageCircle,\n Smartphone,\n UserCog,\n} from 'lucide-react';\nimport {\n linearOrder,\n workflowActionRegistry,\n type EnrollmentCriteria,\n type WorkflowActionMeta,\n type WorkflowActionSettings,\n type WorkflowGraph,\n type WorkflowNode,\n} from './workflow-types';\n\n/* ------------------------------------------------------------------ */\n/* Icon lookup — typed map over the registry's `iconName` union so we */\n/* get exhaustiveness + tree-shakeable named imports from lucide-react. */\n/* ------------------------------------------------------------------ */\n\ntype LucideIcon = ComponentType<SVGProps<SVGSVGElement>>;\n\nconst iconByName: Record<WorkflowActionMeta['iconName'], LucideIcon> = {\n Clock,\n Mail,\n Smartphone,\n CheckSquare: SquareCheckBig,\n MessageCircle,\n UserCog,\n Globe,\n};\n\n/* ------------------------------------------------------------------ */\n/* CVA variants */\n/* ------------------------------------------------------------------ */\n\nconst rootVariants = cva(\n // The map is a list of steps — never a list of meaningful controls.\n // Layout via logical properties only; connectors are sibling spacers\n // styled with border-inline-start / border-block-end (see node/spacer).\n 'ds:flex ds:list-none ds:p-0 ds:m-0',\n {\n variants: {\n orientation: {\n vertical: 'ds:flex-col ds:items-stretch',\n horizontal: 'ds:flex-row ds:items-stretch ds:flex-wrap',\n },\n compact: {\n true: 'ds:gap-0',\n false: 'ds:gap-0',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n compact: false,\n },\n },\n);\n\n// Each node's <li> stacks the node card and the trailing connector along\n// the root's main axis so the chain reads continuously in either\n// orientation. Vertical root (flex-col) → li is flex-col; horizontal root\n// (flex-row) → li is flex-row.\nconst nodeWrapperVariants = cva('ds:flex', {\n variants: {\n orientation: {\n vertical: 'ds:flex-col ds:items-stretch',\n horizontal: 'ds:flex-row ds:items-center',\n },\n },\n});\n\nconst nodeCardVariants = cva(\n [\n 'ds:relative ds:flex ds:items-center',\n 'ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-md)]',\n // Flat-hairline: 1px card-border, no shadow; accessible theme bumps to 2px.\n 'ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2',\n 'ds:bg-[var(--card)] ds:text-[var(--card-foreground)]',\n // Motion honours the accessible theme (--animation-duration → 0ms).\n 'ds:transition-[box-shadow,transform,opacity] ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n // Content wraps instead of pushing siblings off-screen (DE / CJK story contract).\n 'ds:[word-break:break-word] ds:[overflow-wrap:anywhere]',\n ].join(' '),\n {\n variants: {\n orientation: {\n vertical: 'ds:inline-size-full',\n horizontal: 'ds:block-size-full',\n },\n compact: {\n true: 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:py-[var(--spacing-xs)] ds:min-h-[var(--spacing-xl)]',\n false:\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:py-[var(--spacing-sm)]',\n },\n state: {\n completed: '',\n current:\n 'ds:ring-2 ds:ring-[color:var(--ring)] ds:font-[var(--font-weight-semibold)]',\n // Pending state uses a dashed border + muted foreground so the\n // step reads as \"upcoming\" without dropping text contrast below\n // the 4.5:1 AA floor in dark-accessible. Applying opacity to\n // text that is already on --muted-foreground fails axe on the\n // dark themes (contrast ~3.6:1 after a 50 % dim).\n pending:\n 'ds:border-dashed ds:text-[color:var(--muted-foreground)] ds:[&_[data-testid=workflow-map-summary]]:text-[color:var(--muted-foreground)]',\n neutral: '',\n },\n interactive: {\n true: [\n 'ds:cursor-pointer',\n 'ds:hover:shadow-[var(--shadow-sm)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n ].join(' '),\n false: '',\n },\n },\n },\n);\n\n/**\n * Connector spacer — a bare <span aria-hidden=\"true\"> that draws the\n * line between nodes via logical-property borders. Vertical maps get\n * `border-inline-start`; horizontal maps get `border-block-end`. No\n * physical direction properties, no SVG.\n */\nconst spacerVariants = cva(\n ['ds:block', 'ds:border-solid', 'ds:border-[color:var(--border)]'].join(' '),\n {\n variants: {\n orientation: {\n vertical: [\n // Single edge: `border-s-[length:…]` maps to\n // `border-inline-start-width` in Tailwind v4, so only the\n // inline-start side renders — the other three stay at 0.\n // `ms-[…]` aligns the line under the icon column.\n 'ds:ms-[calc(var(--spacing-md)+var(--spacing-sm))]',\n 'ds:border-s-[length:var(--border-width-hairline)]',\n 'ds:border-inline-start',\n ].join(' '),\n horizontal: [\n 'ds:self-center',\n 'ds:border-b-[length:var(--border-width-hairline)]',\n 'ds:border-block-end',\n ].join(' '),\n },\n compact: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n orientation: 'vertical',\n compact: false,\n class: 'ds:h-[var(--spacing-md)]',\n },\n {\n orientation: 'vertical',\n compact: true,\n class: 'ds:h-[var(--spacing-sm)]',\n },\n {\n orientation: 'horizontal',\n compact: false,\n class: 'ds:w-[var(--spacing-md)]',\n },\n {\n orientation: 'horizontal',\n compact: true,\n class: 'ds:w-[var(--spacing-sm)]',\n },\n ],\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Settings summariser — short, token-aware one-liner per action type. */\n/* The i18n key is resolved by the caller; this returns either a */\n/* {key, options} pair for pluralised strings or a plain string literal. */\n/* ------------------------------------------------------------------ */\n\ninterface SummaryKey {\n key: string;\n options?: Record<string, unknown>;\n}\n\nfunction summariseSettings(\n settings: WorkflowActionSettings,\n): SummaryKey | string | undefined {\n switch (settings.kind) {\n case 'add_delay': {\n if (typeof settings.days === 'number' && settings.days > 0) {\n return {\n key: 'workflow.delay.days',\n options: { count: settings.days },\n };\n }\n if (typeof settings.hours === 'number' && settings.hours > 0) {\n return {\n key: 'workflow.delay.hours',\n options: { count: settings.hours },\n };\n }\n if (typeof settings.minutes === 'number' && settings.minutes > 0) {\n return {\n key: 'workflow.delay.minutes',\n options: { count: settings.minutes },\n };\n }\n return undefined;\n }\n case 'send_email':\n return settings.subject || undefined;\n case 'send_sms':\n return settings.body || undefined;\n case 'create_task':\n return settings.title || undefined;\n case 'send_whatsapp':\n return settings.templateName || undefined;\n case 'update_patient_field':\n return settings.fieldLabel || undefined;\n case 'webhook':\n return settings.url || undefined;\n default:\n return undefined;\n }\n}\n\ntype TFn = (key: string, options?: Record<string, unknown>) => string;\n\nfunction resolveSummary(\n summary: SummaryKey | string | undefined,\n t: TFn,\n): string | undefined {\n if (summary === undefined) return undefined;\n if (typeof summary === 'string') return summary;\n return t(summary.key, summary.options);\n}\n\n/* ------------------------------------------------------------------ */\n/* Props */\n/* ------------------------------------------------------------------ */\n\nexport interface WorkflowMapProps extends VariantProps<typeof rootVariants> {\n /** Instance id surfaced as `data-component-id` on the root. */\n id?: string;\n /** Workflow graph (DAG-shaped, linear in v1). */\n graph: WorkflowGraph;\n /** Id of the currently active step. When unset, the map is structural. */\n activeNodeId?: string;\n /** When provided, nodes become focusable buttons. */\n onNodeClick?: (nodeId: string) => void;\n /** Optional leading criteria summary card — NOT part of the graph. */\n enrollmentCriteria?: EnrollmentCriteria;\n /** Orientation. @default 'vertical' */\n orientation?: 'vertical' | 'horizontal';\n /** Compact mode: smaller padding, hides settings summary text. */\n compact?: boolean;\n className?: string;\n /** Override the auto-generated aria-label on the list root. */\n 'aria-label'?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\ntype NodeState = 'completed' | 'current' | 'pending' | 'neutral';\n\nexport const WorkflowMap = forwardRef<HTMLOListElement, WorkflowMapProps>(\n function WorkflowMap(\n {\n graph,\n activeNodeId,\n onNodeClick,\n enrollmentCriteria,\n orientation = 'vertical',\n compact = false,\n className,\n 'aria-label': ariaLabelOverride,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation('ui');\n\n const ordered = useMemo(() => linearOrder(graph), [graph]);\n const activeIndex = useMemo(\n () =>\n activeNodeId ? ordered.findIndex((n) => n.id === activeNodeId) : -1,\n [ordered, activeNodeId],\n );\n\n const ariaLabel =\n ariaLabelOverride ?? t('workflow.map.label', { count: ordered.length });\n\n const nodeState = (index: number): NodeState => {\n if (activeIndex === -1) return 'neutral';\n if (index === activeIndex) return 'current';\n if (index < activeIndex) return 'completed';\n return 'pending';\n };\n\n return (\n // eslint-disable-next-line jsx-a11y/no-redundant-roles -- Safari strips the implicit list role on <ol> with list-style:none; this guard puts it back in the accessibility tree\n <ol\n ref={ref}\n role=\"list\"\n aria-label={ariaLabel}\n data-component=\"workflow-map\"\n data-component-id={rest.id}\n className={rootVariants({ orientation, compact, className })}\n {...rest}\n >\n {enrollmentCriteria ? (\n <EnrollmentCriteriaHeader\n orientation={orientation}\n compact={compact}\n criteria={enrollmentCriteria}\n />\n ) : null}\n {ordered.map((node, index) => {\n const state = nodeState(index);\n const isLast = index === ordered.length - 1;\n return (\n <MapNode\n key={node.id}\n node={node}\n state={state}\n orientation={orientation}\n compact={compact}\n isLast={isLast}\n onNodeClick={onNodeClick}\n />\n );\n })}\n </ol>\n );\n },\n);\n\nWorkflowMap.displayName = 'WorkflowMap';\n\n/* ------------------------------------------------------------------ */\n/* Internal: MapNode */\n/* ------------------------------------------------------------------ */\n\ninterface MapNodeProps {\n node: WorkflowNode;\n state: NodeState;\n orientation: 'vertical' | 'horizontal';\n compact: boolean;\n isLast: boolean;\n onNodeClick?: (nodeId: string) => void;\n}\n\nfunction MapNode({\n node,\n state,\n orientation,\n compact,\n isLast,\n onNodeClick,\n}: MapNodeProps) {\n const { t } = useTranslation('ui');\n const meta = workflowActionRegistry[node.type];\n const Icon = iconByName[meta.iconName];\n const typeLabel = t(meta.labelKey);\n const summary = resolveSummary(summariseSettings(node.settings), t);\n const isInteractive = typeof onNodeClick === 'function';\n\n const isCurrent = state === 'current';\n const isCompleted = state === 'completed';\n\n const handleClick = (event: ReactMouseEvent<HTMLDivElement>) => {\n if (!isInteractive) return;\n event.preventDefault();\n onNodeClick?.(node.id);\n };\n\n const handleKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n if (!isInteractive) return;\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onNodeClick?.(node.id);\n }\n };\n\n // sr-only state label so greyscale / colour-blind users get\n // an announceable state hint alongside the visual cue.\n const stateLabel = isCurrent\n ? t('workflow.map.current')\n : isCompleted\n ? t('workflow.map.completed')\n : state === 'pending'\n ? t('workflow.map.pending')\n : null;\n\n return (\n // `<li>` has implicit role=\"listitem\"; no explicit role needed.\n <li data-node-id={node.id} className={nodeWrapperVariants({ orientation })}>\n <div\n role={isInteractive ? 'button' : undefined}\n tabIndex={isInteractive ? 0 : undefined}\n aria-current={isCurrent ? 'step' : undefined}\n aria-label={\n isInteractive && compact\n ? summary\n ? t('workflow.map.nodeLabelWithSummary', {\n type: typeLabel,\n summary,\n })\n : t('workflow.map.nodeLabel', { type: typeLabel })\n : undefined\n }\n // Expose the full text on truncation (compact mode) so DE / CJK\n // long compound labels remain discoverable via tooltip.\n title={\n compact && summary\n ? t('workflow.map.nodeLabelWithSummary', {\n type: typeLabel,\n summary,\n })\n : undefined\n }\n onClick={isInteractive ? handleClick : undefined}\n onKeyDown={isInteractive ? handleKeyDown : undefined}\n className={nodeCardVariants({\n orientation,\n compact,\n state,\n interactive: isInteractive,\n })}\n data-node-id={node.id}\n data-state={state}\n >\n <span\n aria-hidden=\"true\"\n className=\"ds:flex ds:items-center ds:justify-center ds:shrink-0 ds:size-[var(--spacing-md)] ds:text-[var(--muted-foreground)]\"\n >\n {isCompleted ? (\n <Check\n className=\"ds:size-[var(--spacing-md)] ds:text-[color:var(--success)]\"\n data-testid=\"workflow-map-check\"\n />\n ) : (\n <Icon className=\"ds:size-[var(--spacing-md)]\" />\n )}\n </span>\n <span className=\"ds:flex ds:flex-col ds:min-w-0 ds:flex-1\">\n <span className={compact ? 'type-meta ds:truncate' : 'type-body-sm'}>\n {typeLabel}\n </span>\n {!compact && summary ? (\n <span\n className=\"type-meta ds:text-[var(--muted-foreground)]\"\n data-testid=\"workflow-map-summary\"\n >\n {summary}\n </span>\n ) : null}\n </span>\n {stateLabel ? <span className=\"ds:sr-only\">{stateLabel}</span> : null}\n </div>\n {!isLast ? (\n <span\n aria-hidden=\"true\"\n className={spacerVariants({ orientation, compact })}\n data-testid=\"workflow-map-connector\"\n />\n ) : null}\n </li>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Internal: Enrollment criteria header */\n/* ------------------------------------------------------------------ */\n\ninterface EnrollmentCriteriaHeaderProps {\n orientation: 'vertical' | 'horizontal';\n compact: boolean;\n criteria: EnrollmentCriteria;\n}\n\nfunction EnrollmentCriteriaHeader({\n orientation,\n compact,\n criteria,\n}: EnrollmentCriteriaHeaderProps) {\n const { t } = useTranslation('ui');\n\n // Not part of the graph; rendered as a leading listitem. The root's\n // aria-label advertises the graph step count (not list-item count) so\n // the SR announcement stays accurate for the pipeline proper.\n return (\n <li className={nodeWrapperVariants({ orientation })}>\n <div\n className={nodeCardVariants({\n orientation,\n compact,\n state: 'neutral',\n interactive: false,\n })}\n data-testid=\"workflow-map-criteria\"\n >\n <span\n aria-hidden=\"true\"\n className=\"ds:flex ds:items-center ds:justify-center ds:shrink-0 ds:size-[var(--spacing-md)] ds:text-[var(--muted-foreground)]\"\n >\n <ClipboardCheck className=\"ds:size-[var(--spacing-md)]\" />\n </span>\n <span className=\"ds:flex ds:flex-col ds:min-w-0 ds:flex-1\">\n <span className={compact ? 'type-meta ds:truncate' : 'type-body-sm'}>\n {t('workflow.editor.enrollmentCriteria')}\n </span>\n {!compact ? (\n <span className=\"type-meta ds:text-[var(--muted-foreground)]\">\n {criteria.summary ??\n t('workflow.editor.criteriaCount', {\n count: criteria.ruleCount,\n })}\n </span>\n ) : null}\n </span>\n </div>\n <span\n aria-hidden=\"true\"\n className={spacerVariants({ orientation, compact })}\n />\n </li>\n );\n}\n"],"names":["__iconNode","CirclePause","createLucideIcon","PowerOff","Power","workflowCardVariants","cva","getStatusMeta","status","jsx","Circle","CircleDashed","WorkflowCard","forwardRef","workflow","density","onView","onEdit","onDelete","onToggleActive","className","ref","t","useTranslation","statusMeta","isActive","isCompact","stop","handler","event","statusBadge","Badge","activeCountLabel","jsxs","Card","KeyValuePair","Timestamp","IconButton","Pencil","Trash2","workflowCardAgent","workflowMapAgent","workflowEditorAgent","handle","args","linearOrder","graph","linearEdges","e","targets","start","n","byId","edgesFrom","edge","bucket","seen","order","cursor","outgoing","node","addNodeAfter","afterNodeId","nodes","oldHead","otherEdges","removeNode","nodeId","incoming","kept","bridged","moveNode","direction","index","swapIndex","b","afterRemove","first","second","firstPredecessor","_a","step1","CORE_PATIENT_FIELDS","isCorePatientField","fieldId","workflowActionRegistry","ACTION_ICONS","Clock","Mail","Smartphone","SquareCheckBig","MessageCircle","UserCog","Globe","ActionIcon","iconName","Glyph","TRUNCATE_EMAIL","TRUNCATE_SMS","truncate","value","max","summariseSettings","settings","days","summary","subject","full","body","title","rootClasses","connectorClasses","addButtonClasses","nodeCardFocusableClasses","ALL_ACTION_TYPES","nodeIdCounter","generateNodeId","random","defaultSettingsFor","type","useMutableIndex","initial","useRef","setter","useCallback","v","ActionNodeCard","position","total","disabled","onMove","registerRef","meta","controlsRef","activeControl","setActiveControl","focusControl","controls","clamped","_b","handleCardKeyDown","handleControlsKeyDown","typeLabel","canMoveUp","canMoveDown","positionText","nodeAriaLabel","el","ChevronUp","ChevronDown","Alert","AddActionMenu","availableActions","onSelect","label","compact","DropdownMenu","Plus","CriteriaHeader","criteria","count","summaryText","WorkflowEditor","onChange","enrollmentCriteria","onEditEnrollmentCriteria","onEditNode","onDeleteNode","types","ordered","useMemo","nodeRefs","focusTargetRef","safeOnChange","next","id","currentStep","setCurrentStep","useState","currentStepRef","rootRef","useImperativeHandle","agentHandle","useAgentRegistration","useEffect","handleAddAfter","afterId","handleMove","handleEdit","handleDelete","renderBanner","renderCriteria","Fragment","EmptyState","Button","iconByName","rootVariants","nodeWrapperVariants","nodeCardVariants","spacerVariants","resolveSummary","WorkflowMap","activeNodeId","onNodeClick","orientation","ariaLabelOverride","rest","activeIndex","ariaLabel","nodeState","EnrollmentCriteriaHeader","state","isLast","MapNode","Icon","isInteractive","isCurrent","isCompleted","handleClick","handleKeyDown","stateLabel","Check","ClipboardCheck"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,MAAM,KAAK,UAAU;AAAA,EACzD,CAAC,QAAQ,EAAE,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,KAAK,SAAQ,CAAE;AAAA,EACjE,CAAC,QAAQ,EAAE,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,KAAK,SAAQ,CAAE;AACnE,GACMC,KAAcC,EAAiB,gBAAgBF,EAAU;ACd/D;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,kCAAkC,KAAK,SAAQ,CAAE;AAAA,EAC/D,CAAC,QAAQ,EAAE,GAAG,oCAAoC,KAAK,SAAQ,CAAE;AAAA,EACjE,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,cAAc,KAAK,SAAQ,CAAE;AAC7C,GACMG,KAAWD,EAAiB,aAA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