@alfadocs/ui-kit 1.134.0 → 1.136.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 (205) hide show
  1. package/dist/_chunks/{ai-prompt-input-JIPbrTF3.js → ai-prompt-input-CVNeusoW.js} +2 -2
  2. package/dist/_chunks/ai-summary-panel-BhCo2vZF.js +1045 -0
  3. package/dist/_chunks/{alia-sidebar-CK1zw_Bc.js → alia-sidebar-CVBlKur9.js} +4 -4
  4. package/dist/_chunks/{anamnesis-summary-rows-CCNmkq55.js → anamnesis-summary-rows-Dr2V1Rtf.js} +3 -3
  5. package/dist/_chunks/{appointment-card-DG3m9yN-.js → appointment-card-BT1cMZIX.js} +2 -2
  6. package/dist/_chunks/{appointment-peek-BK0tDs4C.js → appointment-peek-BP_ACFz5.js} +2 -2
  7. package/dist/_chunks/{appointment-timeline-BiI2riRZ.js → appointment-timeline-Dy4YQJ17.js} +2 -2
  8. package/dist/_chunks/{appointment-tray-ClJCtYQj.js → appointment-tray-B3gSHL1j.js} +2 -2
  9. package/dist/_chunks/{audio-recorder-CsnM_WDy.js → audio-recorder-BOF5YYoC.js} +2 -2
  10. package/dist/_chunks/{balance-badge-cell-DTiMdnCZ.js → balance-badge-cell-BSB02Bwo.js} +4 -4
  11. package/dist/_chunks/{bill-line-table-DHKb_O7c.js → bill-line-table-By-YL2ms.js} +2 -2
  12. package/dist/_chunks/{bishop-score-CKztphVz.js → bishop-score-DWGESRP9.js} +2 -2
  13. package/dist/_chunks/{calendar-appointment-editor-dialog-BSkIYGlW.js → calendar-appointment-editor-dialog-CB4cQOtc.js} +10 -10
  14. package/dist/_chunks/call-status-chip-pajxN5eZ.js +180 -0
  15. package/dist/_chunks/calls-panel-BIfatK90.js +1094 -0
  16. package/dist/_chunks/{chat-container-B83b4hut.js → chat-container-CoOT7dzB.js} +37 -36
  17. package/dist/_chunks/{chat-input-DwQ4_WXK.js → chat-input-BmvnuZqj.js} +112 -106
  18. package/dist/_chunks/{chat-message-CfIyXrxA.js → chat-message-B4TMeZ2m.js} +35 -30
  19. package/dist/_chunks/circle-x-W8Enq3i4.js +16 -0
  20. package/dist/_chunks/communications-panel-SQ-55e3V.js +1079 -0
  21. package/dist/_chunks/{data-grid-B2oaI7Lt.js → data-grid-CxKz8flO.js} +2 -2
  22. package/dist/_chunks/{data-table-FTV3uRjX.js → data-table-_tgj0C_T.js} +2 -2
  23. package/dist/_chunks/{default-tabs-DbebYO04.js → default-tabs-oDWQzbN7.js} +3 -3
  24. package/dist/_chunks/{document-preview-DLVIrOYV.js → document-preview-DWlejd8A.js} +2 -2
  25. package/dist/_chunks/entity-summary-CPUHzyil.js +297 -0
  26. package/dist/_chunks/{file-manager-Bzr5NK1t.js → file-manager-CEi4z2i0.js} +2 -2
  27. package/dist/_chunks/{gestational-age-calculator-mB6brTlp.js → gestational-age-calculator-CHbpC4vL.js} +2 -2
  28. package/dist/_chunks/get-error-message-DbFUzuja.js +7 -0
  29. package/dist/_chunks/handled-rejection-C-6Dq0As.js +9 -0
  30. package/dist/_chunks/{heatmap-C5gJin_F.js → heatmap-_546qI2V.js} +2 -2
  31. package/dist/_chunks/{invoice-upload-list-B5aMffTy.js → invoice-upload-list-CQI9MUl6.js} +3 -3
  32. package/dist/_chunks/{kit-extensions-DUaIYyMD.js → kit-extensions-BNBf4m8O.js} +3 -3
  33. package/dist/_chunks/{link-cell-renderer-D3JLPURZ.js → link-cell-renderer-Xx5T8u5Q.js} +3 -3
  34. package/dist/_chunks/megaphone-CzeTT9B3.js +22 -0
  35. package/dist/_chunks/{muscle-scheme-BGJD62op.js → muscle-scheme-D_rSyGDj.js} +2 -2
  36. package/dist/_chunks/{notes-panel-BAyPOr8N.js → notes-panel-BvjAo4RQ.js} +5 -4
  37. package/dist/_chunks/{optical-prescription-Da_r8pMr.js → optical-prescription-DaSbsh4p.js} +2 -2
  38. package/dist/_chunks/{patient-account-settings-BkAtIxJW.js → patient-account-settings-Bmfeclpd.js} +3 -3
  39. package/dist/_chunks/{patient-card-DTh3QTyS.js → patient-card-Cpr8iD19.js} +4 -4
  40. package/dist/_chunks/{patient-check-in-resume-xhqjC6gf.js → patient-check-in-resume-CYZ-SvsF.js} +41 -41
  41. package/dist/_chunks/{patient-details-DBtEITfE.js → patient-details-9eh9cNy7.js} +2 -2
  42. package/dist/_chunks/{patient-field-row-a5d4QijH.js → patient-field-row-B782eT0C.js} +2 -2
  43. package/dist/_chunks/{patient-sign-in-pin-CDBqV254.js → patient-sign-in-pin-DmMBwWet.js} +2 -2
  44. package/dist/_chunks/{patient-sign-in-steps-C2JSqlok.js → patient-sign-in-steps-BKcxNkdY.js} +37 -59
  45. package/dist/_chunks/{patient-summary-card-Bl2NknPe.js → patient-summary-card-K9zaMl1O.js} +2 -2
  46. package/dist/_chunks/phone-off-DQSTLz4l.js +28 -0
  47. package/dist/_chunks/{portal-details-CTEsm705.js → portal-details-DCIiGkHA.js} +2 -2
  48. package/dist/_chunks/{portal-documents-D8skew0h.js → portal-documents-DVKj6Sco.js} +4 -4
  49. package/dist/_chunks/{portal-parts-BdR29P7z.js → portal-parts-Br8wuala.js} +2 -2
  50. package/dist/_chunks/{pregnancy-dating-BNI32qNw.js → pregnancy-dating-lJbzai73.js} +2 -2
  51. package/dist/_chunks/{registration-form-DS3RuKHu.js → registration-form-CuLiTA52.js} +2 -2
  52. package/dist/_chunks/{reserved.agent-DOzOBUW7.js → reserved.agent-CabZHFJC.js} +2 -2
  53. package/dist/_chunks/{select-uESzXTX6.js → select-CIXKyUMw.js} +172 -149
  54. package/dist/_chunks/{session-countdown-DOx1IBUB.js → session-countdown-StcyUU5O.js} +56 -66
  55. package/dist/_chunks/{signature-request-CHsM_iWi.js → signature-request-vJDSHZld.js} +2 -2
  56. package/dist/_chunks/signing-end-screen-BdhbkPKO.js +1355 -0
  57. package/dist/_chunks/{tabs-CRIDBLP7.js → tabs-Czkmw5ou.js} +2 -2
  58. package/dist/_chunks/{task-editor-g1AGfxhr.js → task-editor-BfXSn6U1.js} +4 -3
  59. package/dist/_chunks/{tasks-panel-BE3zaayj.js → tasks-panel-DbtJS4QI.js} +156 -172
  60. package/dist/_chunks/{toolbar-CfdoJzMV.js → toolbar-DjG-cpD_.js} +2 -2
  61. package/dist/_chunks/{unit-converter-YKlHyUC2.js → unit-converter-CUAUTu2B.js} +2 -2
  62. package/dist/_chunks/{use-appointment-details-read-Dzc6fEzG.js → use-appointment-details-read-7J0j1FP7.js} +111 -110
  63. package/dist/_chunks/{voice-control-panel-Be_c0CQ0.js → voice-control-panel-Cp4vs1iy.js} +2 -2
  64. package/dist/_chunks/{workflow-status-D1WgGVTP.js → workflow-status-CO0mxXs2.js} +3 -2
  65. package/dist/agent-catalog.json +528 -2
  66. package/dist/agent-i18n/en.json +51 -1
  67. package/dist/browser-support.js +1 -1
  68. package/dist/components/_shared/sms-segments.d.ts +43 -0
  69. package/dist/components/ai-prompt-input/index.js +1 -1
  70. package/dist/components/ai-summary-panel/ai-summary-panel.agent.d.ts +4 -0
  71. package/dist/components/ai-summary-panel/ai-summary-panel.d.ts +134 -0
  72. package/dist/components/ai-summary-panel/index.d.ts +4 -0
  73. package/dist/components/ai-summary-panel/index.js +6 -0
  74. package/dist/components/ai-summary-panel/summary-markdown.d.ts +15 -0
  75. package/dist/components/appointment-card/index.js +2 -2
  76. package/dist/components/appointment-details-panel/index.js +1 -1
  77. package/dist/components/appointment-peek/index.js +1 -1
  78. package/dist/components/appointment-timeline/index.js +1 -1
  79. package/dist/components/audio-recorder/index.js +1 -1
  80. package/dist/components/bill-line-table/index.js +1 -1
  81. package/dist/components/bill-table/index.js +1 -1
  82. package/dist/components/bishop-score/index.js +1 -1
  83. package/dist/components/booking/index.js +1 -1
  84. package/dist/components/call-status-chip/call-status-chip.d.ts +30 -0
  85. package/dist/components/call-status-chip/index.d.ts +3 -0
  86. package/dist/components/call-status-chip/index.js +5 -0
  87. package/dist/components/calls-panel/calls-panel.agent.d.ts +4 -0
  88. package/dist/components/calls-panel/calls-panel.d.ts +153 -0
  89. package/dist/components/calls-panel/index.d.ts +4 -0
  90. package/dist/components/calls-panel/index.js +6 -0
  91. package/dist/components/chat-container/chat-container.d.ts +7 -0
  92. package/dist/components/chat-container/index.js +1 -1
  93. package/dist/components/chat-input/chat-input.d.ts +20 -0
  94. package/dist/components/chat-input/index.js +1 -1
  95. package/dist/components/chat-message/index.js +1 -1
  96. package/dist/components/communications-panel/communications-panel.agent.d.ts +4 -0
  97. package/dist/components/communications-panel/communications-panel.d.ts +148 -0
  98. package/dist/components/communications-panel/index.d.ts +6 -0
  99. package/dist/components/communications-panel/index.js +7 -0
  100. package/dist/components/data-grid/index.js +2 -2
  101. package/dist/components/data-table/index.js +2 -2
  102. package/dist/components/document-preview/index.js +1 -1
  103. package/dist/components/entity-summary/entity-summary.d.ts +37 -1
  104. package/dist/components/entity-summary/index.js +1 -1
  105. package/dist/components/file-manager/index.js +1 -1
  106. package/dist/components/gestational-age-calculator/index.js +1 -1
  107. package/dist/components/heatmap/index.js +1 -1
  108. package/dist/components/index.d.ts +4 -0
  109. package/dist/components/invoice-upload-list/index.js +1 -1
  110. package/dist/components/muscle-scheme/index.js +1 -1
  111. package/dist/components/notes-panel/index.js +1 -1
  112. package/dist/components/optical-prescription/index.js +1 -1
  113. package/dist/components/patient-details/index.js +1 -1
  114. package/dist/components/patient-summary-card/index.js +1 -1
  115. package/dist/components/patient-table/index.js +1 -1
  116. package/dist/components/pregnancy-dating/index.js +1 -1
  117. package/dist/components/rich-text-editor/index.js +1 -1
  118. package/dist/components/select/index.js +1 -1
  119. package/dist/components/select/select.d.ts +8 -0
  120. package/dist/components/session-countdown/index.js +1 -1
  121. package/dist/components/skeleton-scheme/index.js +1 -1
  122. package/dist/components/tabs/index.js +1 -1
  123. package/dist/components/task-editor/index.js +1 -1
  124. package/dist/components/tasks-panel/index.js +1 -1
  125. package/dist/components/unit-converter/index.js +1 -1
  126. package/dist/components/voice-control-panel/index.js +1 -1
  127. package/dist/components/workflow-status/index.js +1 -1
  128. package/dist/core.css +1 -1
  129. package/dist/host-compat.css +13 -4
  130. package/dist/i18n/locales/ar.d.ts +162 -0
  131. package/dist/i18n/locales/ar.js +163 -0
  132. package/dist/i18n/locales/de.d.ts +162 -0
  133. package/dist/i18n/locales/de.js +163 -0
  134. package/dist/i18n/locales/el.d.ts +162 -0
  135. package/dist/i18n/locales/el.js +163 -0
  136. package/dist/i18n/locales/en.d.ts +162 -0
  137. package/dist/i18n/locales/en.js +163 -0
  138. package/dist/i18n/locales/es.d.ts +162 -0
  139. package/dist/i18n/locales/es.js +163 -0
  140. package/dist/i18n/locales/fr.d.ts +162 -0
  141. package/dist/i18n/locales/fr.js +163 -0
  142. package/dist/i18n/locales/hi.d.ts +162 -0
  143. package/dist/i18n/locales/hi.js +163 -0
  144. package/dist/i18n/locales/it.d.ts +162 -0
  145. package/dist/i18n/locales/it.js +163 -0
  146. package/dist/i18n/locales/ja.d.ts +162 -0
  147. package/dist/i18n/locales/ja.js +163 -0
  148. package/dist/i18n/locales/nl.d.ts +162 -0
  149. package/dist/i18n/locales/nl.js +163 -0
  150. package/dist/i18n/locales/pl.d.ts +162 -0
  151. package/dist/i18n/locales/pl.js +163 -0
  152. package/dist/i18n/locales/pt.d.ts +162 -0
  153. package/dist/i18n/locales/pt.js +163 -0
  154. package/dist/i18n/locales/ro.d.ts +162 -0
  155. package/dist/i18n/locales/ro.js +163 -0
  156. package/dist/i18n/locales/ru.d.ts +162 -0
  157. package/dist/i18n/locales/ru.js +163 -0
  158. package/dist/i18n/locales/sq.d.ts +162 -0
  159. package/dist/i18n/locales/sq.js +163 -0
  160. package/dist/i18n/locales/sv.d.ts +162 -0
  161. package/dist/i18n/locales/sv.js +163 -0
  162. package/dist/i18n/locales/tr.d.ts +162 -0
  163. package/dist/i18n/locales/tr.js +163 -0
  164. package/dist/i18n/locales/zh.d.ts +162 -0
  165. package/dist/i18n/locales/zh.js +163 -0
  166. package/dist/index.js +905 -893
  167. package/dist/locales/ar.json +162 -0
  168. package/dist/locales/de.json +162 -0
  169. package/dist/locales/el.json +162 -0
  170. package/dist/locales/en.json +162 -0
  171. package/dist/locales/es.json +162 -0
  172. package/dist/locales/fr.json +162 -0
  173. package/dist/locales/hi.json +162 -0
  174. package/dist/locales/it.json +162 -0
  175. package/dist/locales/ja.json +162 -0
  176. package/dist/locales/nl.json +162 -0
  177. package/dist/locales/pl.json +162 -0
  178. package/dist/locales/pt.json +162 -0
  179. package/dist/locales/ro.json +162 -0
  180. package/dist/locales/ru.json +162 -0
  181. package/dist/locales/sq.json +162 -0
  182. package/dist/locales/sv.json +162 -0
  183. package/dist/locales/tr.json +162 -0
  184. package/dist/locales/zh.json +162 -0
  185. package/dist/patterns/alia-assistant/index.js +1 -1
  186. package/dist/patterns/anamnesis/index.js +1 -1
  187. package/dist/patterns/calendar/calendar.journey.d.ts +7 -0
  188. package/dist/patterns/calendar/index.js +1 -1
  189. package/dist/patterns/patient-account-settings/index.js +1 -1
  190. package/dist/patterns/patient-check-in/index.js +1 -1
  191. package/dist/patterns/patient-portal/index.js +2 -2
  192. package/dist/patterns/patient-sign-in/index.js +2 -2
  193. package/dist/patterns/registration-form/index.js +1 -1
  194. package/dist/patterns/signature-request/index.js +1 -1
  195. package/dist/patterns/signing/index.d.ts +1 -0
  196. package/dist/patterns/signing/index.js +1 -1
  197. package/dist/patterns/signing/multi-field-signer.d.ts +22 -1
  198. package/dist/patterns/signing/signing-checkbox-pill.d.ts +66 -0
  199. package/dist/patterns/signing/signing-checkbox-sheet.d.ts +16 -0
  200. package/dist/patterns/signing/signing-document-screen.d.ts +18 -1
  201. package/dist/tokens.css +1 -1
  202. package/package.json +17 -1
  203. package/dist/_chunks/entity-summary-KHM0PnSI.js +0 -265
  204. package/dist/_chunks/handled-rejection-6gqCf5vt.js +0 -13
  205. package/dist/_chunks/signing-end-screen-an9P8DOT.js +0 -1041
@@ -0,0 +1,1045 @@
1
+ import { jsx as e, jsxs as u, Fragment as Ye } from "react/jsx-runtime";
2
+ import { createElement as M, Fragment as wt, forwardRef as xt, useId as bt, useRef as y, useImperativeHandle as Pt, useState as K, useEffect as ce, useCallback as _, useMemo as me } from "react";
3
+ import { c as Tt } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as he } from "react-i18next";
5
+ import { u as Nt } from "./registry-DvAUVLHh.js";
6
+ import { g as Je } from "./get-error-message-DbFUzuja.js";
7
+ import { A as At } from "./ai-permission-notice-C-xR2_iS.js";
8
+ import { A as kt } from "./ai-credits-exhausted-notice-Lws3113e.js";
9
+ import { A as x } from "./alert-C4WKViaS.js";
10
+ import { A as Et } from "./avatar-Dp5apm1d.js";
11
+ import { B as Qe } from "./badge-BUk4RjTS.js";
12
+ import { B as ue } from "./button-DohK_Ak_.js";
13
+ import { I as Rt } from "./icon-button-S8_weU3g.js";
14
+ import { E as b } from "./empty-state-DwJ5YNzz.js";
15
+ import { E as Ct } from "./entity-summary-CPUHzyil.js";
16
+ import { L as rt } from "./link-CeV7FoI6.js";
17
+ import { P as Xe } from "./panel-header-CbtlTe85.js";
18
+ import { S as Ae } from "./skeleton-tTWJpvAq.js";
19
+ import { C as ke } from "./clock-Drd4Wtis.js";
20
+ import { C as nt } from "./circle-alert-rGDZ73Wh.js";
21
+ import { R as Ze } from "./refresh-cw-DnI0cLFC.js";
22
+ import { A as Ge } from "./astroid-BN4f5VXU.js";
23
+ const zt = {
24
+ id: "ai-summary-panel",
25
+ // 'confirm' backs grant_consent. generate and regenerate have no dedicated
26
+ // capability in the closed vocabulary.
27
+ capabilities: ["confirm"],
28
+ state: {
29
+ status: {
30
+ type: "'consent-required' | 'loading' | 'ready' | 'stale' | 'insufficient-data' | 'not-generated' | 'credits-exhausted' | 'error'",
31
+ descriptionKey: "ui.agent.aiSummaryPanel.state.status",
32
+ description: "The face the panel shows.",
33
+ read: (n) => n.getState().status
34
+ },
35
+ ageBand: {
36
+ type: "'fresh' | 'old' | 'very-old' | null",
37
+ descriptionKey: "ui.agent.aiSummaryPanel.state.ageBand",
38
+ description: "How old the summary is: fresh (under 6 hours), old (6 to 24 hours) or very-old (over 24 hours). Null when there is no summary.",
39
+ read: (n) => n.getState().ageBand
40
+ },
41
+ sectionCount: {
42
+ type: "number",
43
+ descriptionKey: "ui.agent.aiSummaryPanel.state.sectionCount",
44
+ description: "How many sections the summary holds. A count only.",
45
+ read: (n) => n.getState().sectionCount
46
+ },
47
+ sectionsReady: {
48
+ type: "number",
49
+ descriptionKey: "ui.agent.aiSummaryPanel.state.sectionsReady",
50
+ description: "How many sections have content (ready or out of date). A count only.",
51
+ read: (n) => n.getState().sectionsReady
52
+ },
53
+ sectionsLoading: {
54
+ type: "number",
55
+ descriptionKey: "ui.agent.aiSummaryPanel.state.sectionsLoading",
56
+ description: "How many sections are still being created. A count only; zero unless sections are produced separately.",
57
+ read: (n) => n.getState().sectionsLoading
58
+ },
59
+ sectionsFailed: {
60
+ type: "number",
61
+ descriptionKey: "ui.agent.aiSummaryPanel.state.sectionsFailed",
62
+ description: "How many sections could not be created. A count only; zero unless sections are produced separately.",
63
+ read: (n) => n.getState().sectionsFailed
64
+ }
65
+ },
66
+ actions: {
67
+ grant_consent: {
68
+ safety: "write",
69
+ openWorld: !0,
70
+ idempotent: !0,
71
+ errors: [
72
+ "The panel is not asking for consent, is read-only or privacy mode is on.",
73
+ "The host could not save the consent. The panel shows the host's message."
74
+ ],
75
+ descriptionKey: "ui.agent.aiSummaryPanel.actions.grantConsent",
76
+ description: "Record that the patient was told and agrees, then ask for the first summary. The summary spends AI credits. Only call this when the user says the patient agreed. Settles with the host's answer.",
77
+ invoke: (n) => n.grantConsent()
78
+ },
79
+ generate: {
80
+ safety: "write",
81
+ openWorld: !0,
82
+ errors: [
83
+ "The panel is not in the error, not-enough-data or not-generated face, is read-only or privacy mode is on.",
84
+ "A request is already in flight."
85
+ ],
86
+ descriptionKey: "ui.agent.aiSummaryPanel.actions.generate",
87
+ description: "Ask for a summary after an error, when data was added or when none was generated yet. Spends AI credits. Settles with the host's answer.",
88
+ invoke: (n) => n.generate()
89
+ },
90
+ regenerate: {
91
+ safety: "write",
92
+ openWorld: !0,
93
+ errors: [
94
+ "The panel shows no summary, is read-only or privacy mode is on.",
95
+ "A request is already in flight."
96
+ ],
97
+ descriptionKey: "ui.agent.aiSummaryPanel.actions.regenerate",
98
+ description: "Replace the summary with a new one. Spends AI credits. Settles with the host's answer.",
99
+ invoke: (n) => n.regenerate()
100
+ },
101
+ generate_section: {
102
+ safety: "write",
103
+ openWorld: !0,
104
+ argsType: "{ sectionId: string }",
105
+ argsSchema: {
106
+ type: "object",
107
+ properties: { sectionId: { type: "string" } },
108
+ required: ["sectionId"]
109
+ },
110
+ errors: [
111
+ "The panel shows no summary, is read-only, privacy mode is on or the host gave no way to ask for one section.",
112
+ "There is no section with that id.",
113
+ "A request is already in flight."
114
+ ],
115
+ descriptionKey: "ui.agent.aiSummaryPanel.actions.generateSection",
116
+ description: "Ask for one section that has no content yet, such as one that failed. Spends AI credits. Only call this when the user asks for it. Settles with the host's answer.",
117
+ invoke: (n, s) => n.generateSection(s.sectionId)
118
+ },
119
+ regenerate_section: {
120
+ safety: "write",
121
+ openWorld: !0,
122
+ argsType: "{ sectionId: string }",
123
+ argsSchema: {
124
+ type: "object",
125
+ properties: { sectionId: { type: "string" } },
126
+ required: ["sectionId"]
127
+ },
128
+ errors: [
129
+ "The panel shows no summary, is read-only, privacy mode is on or the host gave no way to ask for one section.",
130
+ "There is no section with that id.",
131
+ "A request is already in flight."
132
+ ],
133
+ descriptionKey: "ui.agent.aiSummaryPanel.actions.regenerateSection",
134
+ description: "Replace one section that has content with a new one. Spends AI credits. Only call this when the user asks for it. Settles with the host's answer.",
135
+ invoke: (n, s) => n.regenerateSection(s.sectionId)
136
+ }
137
+ },
138
+ domHooks: {
139
+ root: {
140
+ attr: "data-component",
141
+ value: "ai-summary-panel",
142
+ description: "Marks the AiSummaryPanel region."
143
+ },
144
+ instanceId: {
145
+ attr: "data-component-id",
146
+ sourceProp: "id",
147
+ description: "Sourced from the id prop. Required to address a specific panel from the agent."
148
+ }
149
+ }
150
+ }, Lt = "ds:mt-[var(--spacing-2xs)] ds:mb-0 ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:ps-[var(--spacing-md)]", Dt = /^(\s*)(?:[•\-*]|\d+[.)])\s+(.*)$/, Bt = /^\s*\d+[.)]\s/, qt = /\[([^\]]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)|\*\*(.+?)\*\*|\*(.+?)\*/, It = /^\S+$/;
151
+ function $t(n) {
152
+ if (!It.test(n)) return null;
153
+ if (n.startsWith("/"))
154
+ return n[1] === "/" || n[1] === "\\" ? null : "internal";
155
+ try {
156
+ const { protocol: s } = new URL(n);
157
+ return s === "http:" || s === "https:" ? "external" : null;
158
+ } catch {
159
+ return null;
160
+ }
161
+ }
162
+ function Y(n, s = "i") {
163
+ const l = [];
164
+ let d = n, g = 0;
165
+ for (; d.length > 0; ) {
166
+ const i = qt.exec(d);
167
+ if (!i) {
168
+ l.push(d);
169
+ break;
170
+ }
171
+ i.index > 0 && l.push(d.slice(0, i.index));
172
+ const f = `${s}-${g++}`, [W, w, N, m, C] = i;
173
+ if (w !== void 0 && N !== void 0) {
174
+ const O = $t(N);
175
+ l.push(
176
+ O ? M(
177
+ rt,
178
+ {
179
+ key: f,
180
+ href: N,
181
+ external: O === "external",
182
+ externalIcon: !1
183
+ },
184
+ w
185
+ ) : w
186
+ );
187
+ } else m !== void 0 ? l.push(M("strong", { key: f }, Y(m, f))) : C !== void 0 && l.push(M("em", { key: f }, Y(C, f)));
188
+ d = d.slice(i.index + W.length);
189
+ }
190
+ return l;
191
+ }
192
+ function Ht(n) {
193
+ const s = [];
194
+ for (const l of n.replace(/\t/g, " ").split(/\r?\n/)) {
195
+ if (l.trim() === "") continue;
196
+ const d = Dt.exec(l);
197
+ if (!d) {
198
+ s.push({ text: l.trim(), nested: !1, ordered: !1 });
199
+ continue;
200
+ }
201
+ const [, g = "", i = ""] = d;
202
+ i.trim() !== "" && s.push({
203
+ text: i.trim(),
204
+ nested: g.length >= 2 && s.length > 0,
205
+ ordered: Bt.test(l)
206
+ });
207
+ }
208
+ return s;
209
+ }
210
+ function Ft(n) {
211
+ const s = [];
212
+ for (const l of Ht(n)) {
213
+ const d = s[s.length - 1];
214
+ l.nested && d ? d.children.push(l) : s.push({ row: l, children: [] });
215
+ }
216
+ return s.map(({ row: l, children: d }, g) => {
217
+ var w;
218
+ const i = `m${g}`;
219
+ if (d.length === 0) return Y(l.text, i);
220
+ const f = ((w = d[0]) == null ? void 0 : w.ordered) ?? !1, W = f ? "ol" : "ul";
221
+ return M(
222
+ wt,
223
+ null,
224
+ Y(l.text, i),
225
+ M(
226
+ W,
227
+ {
228
+ className: `${Lt} ${f ? "ds:list-decimal" : "ds:list-disc"}`
229
+ },
230
+ d.map(
231
+ (N, m) => M(
232
+ "li",
233
+ { key: `${i}-${m}` },
234
+ Y(N.text, `${i}-${m}`)
235
+ )
236
+ )
237
+ )
238
+ );
239
+ });
240
+ }
241
+ const Kt = Tt(
242
+ "ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:bg-[color:var(--card)]"
243
+ ), de = "ds:px-[var(--spacing-md)] ds:pt-[var(--spacing-md)]", et = 36e5, at = 6, st = 24, _t = {
244
+ note: "aiSummaryPanel.minNote",
245
+ "plan-entry": "aiSummaryPanel.minPlanEntry",
246
+ appointment: "aiSummaryPanel.minAppointment",
247
+ anamnesis: "aiSummaryPanel.minAnamnesis"
248
+ };
249
+ function Mt(n, s) {
250
+ const l = new Date(s).getTime() - new Date(n).getTime();
251
+ return Number.isFinite(l) ? l >= st * et ? "very-old" : l >= at * et ? "old" : "fresh" : "fresh";
252
+ }
253
+ const Wt = xt(
254
+ ({
255
+ id: n,
256
+ title: s,
257
+ "aria-label": l,
258
+ locale: d,
259
+ nowIso: g,
260
+ status: i,
261
+ patientName: f,
262
+ patientHref: W,
263
+ generatedAtIso: w,
264
+ stats: N,
265
+ sections: m = [],
266
+ minimumData: C,
267
+ errorMessage: O,
268
+ privacy: A = !1,
269
+ readOnly: z = !1,
270
+ showBeta: Ee = !0,
271
+ onGrantConsent: fe,
272
+ onGenerate: J,
273
+ onGenerateSection: L,
274
+ onRetry: Re,
275
+ onOpenPatient: ye,
276
+ className: it,
277
+ ...ot
278
+ }, lt) => {
279
+ const { t: r, i18n: ct } = he("ui"), ge = bt(), D = s ?? r("aiSummaryPanel.title"), Q = d ?? ct.language, X = y(null);
280
+ Pt(lt, () => X.current, []);
281
+ const [P, Ce] = K(!1), B = y(!1), [ze, Le] = K(null), T = y(!0);
282
+ ce(() => (T.current = !0, () => {
283
+ T.current = !1;
284
+ }), []);
285
+ const pe = m.some(
286
+ (t) => t.status !== void 0 || t.regenerating === !0
287
+ ), ve = m.map((t) => t.generatedAtIso).filter((t) => !!t && !Number.isNaN(Date.parse(t))), Se = new Set(ve.map((t) => Date.parse(t))).size > 1, Z = Se ? [...ve, ...w ? [w] : []].reduce(
288
+ (t, o) => Date.parse(o) < Date.parse(t) ? o : t
289
+ ) : w ?? ve[0], we = (i === "ready" || i === "stale") && Z ? Mt(Z, g) : null, G = y(fe);
290
+ G.current = fe;
291
+ const k = y(J);
292
+ k.current = J;
293
+ const q = y(L);
294
+ q.current = L;
295
+ const E = y(m);
296
+ E.current = m;
297
+ const [De, dt] = K(
298
+ () => /* @__PURE__ */ new Set()
299
+ ), R = y(/* @__PURE__ */ new Set()), [Be, qe] = K({}), I = y(null), [ut, Ie] = K(0), ee = _(
300
+ async (t, o) => {
301
+ if (!B.current) {
302
+ B.current = !0, Ce(!0), Le(null);
303
+ try {
304
+ await t();
305
+ } catch (a) {
306
+ throw T.current && Le(Je(a, o())), a;
307
+ } finally {
308
+ B.current = !1, T.current && Ce(!1);
309
+ }
310
+ }
311
+ },
312
+ []
313
+ ), xe = _(() => {
314
+ let t = "grant";
315
+ return ee(
316
+ async () => {
317
+ var o, a;
318
+ await ((o = G.current) == null ? void 0 : o.call(G)), t = "generate", await ((a = k.current) == null ? void 0 : a.call(k, { regenerate: !1 }));
319
+ },
320
+ () => r(t === "grant" ? "aiSummaryPanel.consentSaveFailed" : "aiSummaryPanel.errorTitle")
321
+ );
322
+ }, [ee, r]), $ = _(() => {
323
+ T.current && dt(new Set(R.current));
324
+ }, []), te = _(
325
+ async (t, o, a) => {
326
+ var c;
327
+ qe((h) => {
328
+ if (!(t in h)) return h;
329
+ const { [t]: ie, ...p } = h;
330
+ return p;
331
+ });
332
+ try {
333
+ await ((c = q.current) == null ? void 0 : c.call(q, t, { regenerate: o }));
334
+ } catch (h) {
335
+ if (T.current) {
336
+ const ie = Je(
337
+ h,
338
+ r("aiSummaryPanel.sectionError")
339
+ );
340
+ qe((p) => ({
341
+ ...p,
342
+ [t]: { message: ie, live: a }
343
+ }));
344
+ }
345
+ throw h;
346
+ } finally {
347
+ R.current.delete(t), $();
348
+ }
349
+ },
350
+ [$, r]
351
+ ), H = _(
352
+ async (t) => {
353
+ if (R.current.size > 0 || E.current.some((o) => o.regenerating === !0))
354
+ throw new Error("A section request is already in flight.");
355
+ if (!k.current && (!q.current || !E.current.some((o) => o.status !== "loading")))
356
+ throw new Error("There is nothing to generate.");
357
+ return ee(
358
+ async () => {
359
+ if (k.current) {
360
+ await k.current({ regenerate: t });
361
+ return;
362
+ }
363
+ const o = E.current.filter(
364
+ (c) => c.status !== "loading"
365
+ );
366
+ for (const c of o) R.current.add(c.id);
367
+ $();
368
+ let a = 0;
369
+ for (const c of o)
370
+ try {
371
+ await te(
372
+ c.id,
373
+ c.status !== "error" && t,
374
+ !1
375
+ );
376
+ } catch {
377
+ a += 1;
378
+ }
379
+ if (a > 0) throw new Error(r("aiSummaryPanel.errorTitle"));
380
+ },
381
+ () => r("aiSummaryPanel.errorTitle")
382
+ );
383
+ },
384
+ [ee, r, te, $]
385
+ ), re = _(
386
+ async (t, o) => {
387
+ if (R.current.has(t)) return;
388
+ const a = E.current.find((c) => c.id === t);
389
+ if (B.current || (a == null ? void 0 : a.status) === "loading" || (a == null ? void 0 : a.regenerating) === !0)
390
+ throw new Error("A request is already in flight.");
391
+ R.current.add(t), $(), I.current = t, T.current && Ie((c) => c + 1);
392
+ try {
393
+ await te(t, o, !0);
394
+ } finally {
395
+ I.current = t, T.current && Ie((c) => c + 1);
396
+ }
397
+ },
398
+ [te, $]
399
+ ), be = re, ne = !z && !!L, mt = me(
400
+ () => m.map(
401
+ ({
402
+ markdown: t,
403
+ items: o,
404
+ status: a,
405
+ errorMessage: c,
406
+ generatedAtIso: h,
407
+ regenerating: ie,
408
+ ...p
409
+ }) => {
410
+ const We = {
411
+ ...p,
412
+ items: t !== void 0 ? Ft(t) : o ?? [],
413
+ emptyLabel: r("aiSummaryPanel.sectionEmpty")
414
+ };
415
+ if (!pe && !L) return We;
416
+ const S = a ?? "ready", Ne = ie === !0 || De.has(p.id) || S === "loading", F = Be[p.id], oe = F == null ? void 0 : F.message, Oe = (F == null ? void 0 : F.live) === !0, vt = S === "ready" || S === "stale", St = ne && S !== "loading", Ue = r("aiSummaryPanel.sectionRegenerate", {
417
+ section: p.heading
418
+ }), je = Se && h && vt ? /* @__PURE__ */ e(Vt, { iso: h, lang: Q }) : null;
419
+ let le;
420
+ S === "loading" ? le = /* @__PURE__ */ e(Ut, { label: p.heading }) : S === "error" && (le = /* @__PURE__ */ e(
421
+ jt,
422
+ {
423
+ live: Oe,
424
+ message: oe ?? c ?? r("aiSummaryPanel.sectionError"),
425
+ retry: ne ? /* @__PURE__ */ e(
426
+ ue,
427
+ {
428
+ type: "button",
429
+ intent: "secondary",
430
+ size: "sm",
431
+ loading: Ne,
432
+ className: "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
433
+ "aria-disabled": P || void 0,
434
+ "aria-label": r("aiSummaryPanel.sectionRetryNamed", {
435
+ section: p.heading
436
+ }),
437
+ "data-ai-summary-section-retry": "",
438
+ onClick: () => {
439
+ be(p.id, !1).catch(() => {
440
+ });
441
+ },
442
+ children: r("aiSummaryPanel.retry")
443
+ }
444
+ ) : null
445
+ }
446
+ ));
447
+ const Ve = S === "stale" || oe || je ? /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] type-meta ds:text-[color:var(--muted-foreground)]", children: [
448
+ S === "stale" ? /* @__PURE__ */ u(
449
+ "span",
450
+ {
451
+ "data-ai-summary-section-stale": "",
452
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]",
453
+ children: [
454
+ /* @__PURE__ */ e(
455
+ ke,
456
+ {
457
+ "aria-hidden": "true",
458
+ className: "ds:size-3.5 ds:shrink-0"
459
+ }
460
+ ),
461
+ r("aiSummaryPanel.sectionStale")
462
+ ]
463
+ }
464
+ ) : null,
465
+ oe && S !== "error" ? /* @__PURE__ */ u(
466
+ "span",
467
+ {
468
+ role: Oe ? "alert" : void 0,
469
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[color:var(--error-foreground)]",
470
+ children: [
471
+ /* @__PURE__ */ e(
472
+ nt,
473
+ {
474
+ "aria-hidden": "true",
475
+ className: "ds:size-3.5 ds:shrink-0"
476
+ }
477
+ ),
478
+ oe
479
+ ]
480
+ }
481
+ ) : null,
482
+ je
483
+ ] }) : void 0;
484
+ return {
485
+ ...We,
486
+ busy: Ne,
487
+ ...le !== void 0 ? { body: le } : {},
488
+ ...Ve ? { footer: Ve } : {},
489
+ // A loading section holds the control's room, so the card keeps
490
+ // its height when the section arrives.
491
+ ...ne && S === "loading" ? {
492
+ actions: /* @__PURE__ */ e(
493
+ "span",
494
+ {
495
+ "aria-hidden": "true",
496
+ className: "ds:block ds:size-[var(--min-target-size)]"
497
+ }
498
+ )
499
+ } : {},
500
+ ...St && S !== "error" ? {
501
+ actions: /* @__PURE__ */ e(
502
+ Rt,
503
+ {
504
+ icon: /* @__PURE__ */ e(Ze, { "aria-hidden": "true" }),
505
+ size: "sm",
506
+ intent: "ghost",
507
+ className: "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
508
+ "aria-label": Ue,
509
+ tooltip: Ue,
510
+ loading: Ne,
511
+ "aria-disabled": P || void 0,
512
+ "data-ai-summary-section-regenerate": "",
513
+ onClick: () => {
514
+ be(p.id, !0).catch(() => {
515
+ });
516
+ }
517
+ }
518
+ )
519
+ } : {}
520
+ };
521
+ }
522
+ ),
523
+ [
524
+ m,
525
+ r,
526
+ Q,
527
+ pe,
528
+ L,
529
+ ne,
530
+ De,
531
+ Be,
532
+ P,
533
+ Se,
534
+ be
535
+ ]
536
+ ), U = {
537
+ ready: m.filter(
538
+ (t) => t.status === void 0 || t.status === "ready" || t.status === "stale"
539
+ ).length,
540
+ loading: m.filter((t) => t.status === "loading").length,
541
+ failed: m.filter((t) => t.status === "error").length
542
+ }, v = y({
543
+ status: i,
544
+ ageBand: we,
545
+ sectionCount: m.length,
546
+ ...U
547
+ });
548
+ v.current = {
549
+ status: i,
550
+ ageBand: we,
551
+ sectionCount: m.length,
552
+ ...U
553
+ };
554
+ const j = y({ readOnly: z, privacy: A });
555
+ j.current = { readOnly: z, privacy: A };
556
+ const ht = me(() => {
557
+ const t = async (a) => {
558
+ if (j.current.privacy)
559
+ throw new Error("The summary is hidden by privacy mode.");
560
+ if (j.current.readOnly)
561
+ throw new Error("The panel is read-only.");
562
+ if (!q.current)
563
+ throw new Error("The host did not give a way to ask for a section.");
564
+ if (!["ready", "stale"].includes(v.current.status))
565
+ throw new Error(
566
+ `The panel is in the ${v.current.status} face, which does not offer this.`
567
+ );
568
+ if (!E.current.some((h) => h.id === a))
569
+ throw new Error(`There is no section "${a}".`);
570
+ const c = E.current.find((h) => h.id === a);
571
+ if (B.current || R.current.has(a) || (c == null ? void 0 : c.status) === "loading" || (c == null ? void 0 : c.regenerating) === !0)
572
+ throw new Error("A request is already in flight.");
573
+ }, o = async (a) => {
574
+ if (j.current.privacy)
575
+ throw new Error("The summary is hidden by privacy mode.");
576
+ if (j.current.readOnly)
577
+ throw new Error("The panel is read-only.");
578
+ if (!a.includes(v.current.status))
579
+ throw new Error(
580
+ `The panel is in the ${v.current.status} face, which does not offer this.`
581
+ );
582
+ if (B.current) throw new Error("A request is already in flight.");
583
+ };
584
+ return {
585
+ getState: () => ({
586
+ status: v.current.status,
587
+ ageBand: v.current.ageBand,
588
+ sectionCount: v.current.sectionCount,
589
+ sectionsReady: v.current.ready,
590
+ sectionsLoading: v.current.loading,
591
+ sectionsFailed: v.current.failed
592
+ }),
593
+ grantConsent: async () => {
594
+ await o(["consent-required"]), await xe();
595
+ },
596
+ generate: async () => {
597
+ await o(["error", "insufficient-data", "not-generated"]), await H(!1);
598
+ },
599
+ regenerate: async () => {
600
+ await o(["ready", "stale"]), await H(!0);
601
+ },
602
+ generateSection: async (a) => {
603
+ await t(a), await re(a, !1);
604
+ },
605
+ regenerateSection: async (a) => {
606
+ await t(a), await re(a, !0);
607
+ }
608
+ };
609
+ }, [xe, H, re]);
610
+ Nt(zt, ht, n);
611
+ const $e = y(!1), Pe = y(!1);
612
+ ce(() => {
613
+ const t = X.current;
614
+ if (!t) return;
615
+ const o = Pe.current && (!document.activeElement || document.activeElement === document.body);
616
+ if ($e.current && !o) return;
617
+ $e.current = !0;
618
+ const a = A ? null : t.querySelector('[role="checkbox"]');
619
+ if (i === "consent-required" && a && !o) {
620
+ a.focus({ preventScroll: !0 });
621
+ return;
622
+ }
623
+ const c = t.querySelector("h2");
624
+ c && (c.setAttribute("tabindex", "-1"), c.focus({ preventScroll: !0, focusVisible: !1 }));
625
+ }, [A, i]);
626
+ const ae = m.length, Te = pe && (i === "ready" || i === "stale") && ae > 0 ? U.ready === ae ? r(i === "stale" ? "aiSummaryPanel.staleTitle" : "aiSummaryPanel.statusReady") : r("aiSummaryPanel.sectionsProgress", {
627
+ count: ae,
628
+ ready: U.ready
629
+ }) : null, He = A ? r("aiSummaryPanel.privacyTitle") : P && (i === "ready" || i === "stale") && // Sections still arriving: say how many, not "reading" again.
630
+ !(Te !== null && U.ready < ae) ? r("aiSummaryPanel.loading") : Te !== null ? Te : {
631
+ "consent-required": r("aiSummaryPanel.consentTitle"),
632
+ loading: r("aiSummaryPanel.loading"),
633
+ ready: r("aiSummaryPanel.statusReady"),
634
+ stale: r("aiSummaryPanel.staleTitle"),
635
+ "insufficient-data": r("aiSummaryPanel.insufficientTitle"),
636
+ "not-generated": r("aiSummaryPanel.notGeneratedTitle"),
637
+ "credits-exhausted": r("aiSummaryPanel.creditsExhausted"),
638
+ error: r("aiSummaryPanel.errorTitle")
639
+ }[i], [Fe, ft] = K("");
640
+ ce(() => {
641
+ ft(He);
642
+ }, [He]), ce(() => {
643
+ const t = I.current, o = X.current;
644
+ if (t === null || !o) return;
645
+ const a = Array.from(
646
+ o.querySelectorAll("[data-entity-summary-section]")
647
+ ).find((h) => h.getAttribute("data-entity-summary-section") === t);
648
+ if (!a) {
649
+ I.current = null;
650
+ return;
651
+ }
652
+ const c = document.activeElement;
653
+ if (!c || c === document.body) {
654
+ I.current = null;
655
+ const h = a.querySelector("h3");
656
+ h && (h.setAttribute("tabindex", "-1"), h.focus({ preventScroll: !0, focusVisible: !1 }));
657
+ } else a.contains(c) || (I.current = null);
658
+ }, [ut, m]);
659
+ const V = W ?? (ye ? "#" : void 0), yt = (t) => {
660
+ if (!ye || !V) return;
661
+ const o = t.target.closest("a");
662
+ o && o.getAttribute("href") === V && (t.preventDefault(), ye());
663
+ }, Ke = {
664
+ ref: X,
665
+ "data-component": "ai-summary-panel",
666
+ "data-component-id": n,
667
+ "data-status": A ? "privacy" : i,
668
+ onFocusCapture: () => {
669
+ Pe.current = !0;
670
+ },
671
+ onBlurCapture: (t) => {
672
+ t.relatedTarget && (Pe.current = !1);
673
+ },
674
+ // The summary inside is its own region named by the title, so this
675
+ // region carries the longer name: two regions may not share one.
676
+ "aria-label": l ?? r("aiSummaryPanel.regionLabel"),
677
+ className: [Kt(), it].filter(Boolean).join(" "),
678
+ ...ot
679
+ };
680
+ if (A)
681
+ return /* @__PURE__ */ u("section", { ...Ke, children: [
682
+ /* @__PURE__ */ e(
683
+ Xe,
684
+ {
685
+ title: Ee ? /* @__PURE__ */ u(Ye, { children: [
686
+ D,
687
+ " ",
688
+ /* @__PURE__ */ e(
689
+ Qe,
690
+ {
691
+ size: "sm",
692
+ className: "ds:ms-[var(--spacing-xs)] ds:align-middle",
693
+ children: r("voiceControl.beta")
694
+ }
695
+ )
696
+ ] }) : D,
697
+ titleTooltip: D,
698
+ icon: /* @__PURE__ */ e(Ge, { "aria-hidden": "true" }),
699
+ headingId: ge,
700
+ divider: !0
701
+ }
702
+ ),
703
+ /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: Fe }),
704
+ /* @__PURE__ */ e("div", { className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ e(
705
+ b,
706
+ {
707
+ variant: "first-use",
708
+ size: "sm",
709
+ title: r("aiSummaryPanel.privacyTitle"),
710
+ description: r("aiSummaryPanel.privacyDescription")
711
+ }
712
+ ) })
713
+ ] });
714
+ const se = i === "ready" || i === "stale", gt = se && !z && (!!J || !!L), _e = !z && !!J, pt = f && !se ? /* @__PURE__ */ u(
715
+ "div",
716
+ {
717
+ className: `${de} ds:flex ds:items-center ds:gap-[var(--spacing-sm)]`,
718
+ children: [
719
+ /* @__PURE__ */ e(Et, { name: f, size: "sm", className: "ds:shrink-0" }),
720
+ V ? /* @__PURE__ */ e(
721
+ rt,
722
+ {
723
+ href: V,
724
+ className: "type-body-sm ds:font-semibold ds:min-w-0 ds:break-words",
725
+ children: f
726
+ }
727
+ ) : /* @__PURE__ */ e("span", { className: "type-body-sm ds:min-w-0 ds:break-words ds:font-semibold ds:text-[color:var(--foreground)]", children: f })
728
+ ]
729
+ }
730
+ ) : null, Me = se && Z ? /* @__PURE__ */ e(
731
+ Ot,
732
+ {
733
+ generatedAtIso: Z,
734
+ band: we ?? "fresh",
735
+ lang: Q
736
+ }
737
+ ) : null;
738
+ return /* @__PURE__ */ u("section", { ...Ke, children: [
739
+ /* @__PURE__ */ e(
740
+ Xe,
741
+ {
742
+ title: Ee ? /* @__PURE__ */ u(Ye, { children: [
743
+ D,
744
+ " ",
745
+ /* @__PURE__ */ e(
746
+ Qe,
747
+ {
748
+ size: "sm",
749
+ className: "ds:ms-[var(--spacing-xs)] ds:align-middle",
750
+ children: r("voiceControl.beta")
751
+ }
752
+ )
753
+ ] }) : D,
754
+ titleTooltip: D,
755
+ icon: /* @__PURE__ */ e(Ge, { "aria-hidden": "true" }),
756
+ headingId: ge,
757
+ divider: !0,
758
+ wrapActions: !0,
759
+ actions: gt ? /* @__PURE__ */ e(
760
+ ue,
761
+ {
762
+ type: "button",
763
+ size: "sm",
764
+ intent: "ghost",
765
+ startIcon: /* @__PURE__ */ e(Ze, { "aria-hidden": "true" }),
766
+ loading: P,
767
+ onClick: () => {
768
+ H(!0).catch(() => {
769
+ });
770
+ },
771
+ children: r("aiSummaryPanel.regenerate")
772
+ }
773
+ ) : void 0
774
+ }
775
+ ),
776
+ /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: Fe }),
777
+ /* @__PURE__ */ u(
778
+ "div",
779
+ {
780
+ tabIndex: 0,
781
+ role: "group",
782
+ "aria-labelledby": ge,
783
+ onClick: yt,
784
+ className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
785
+ children: [
786
+ pt,
787
+ i === "consent-required" ? /* @__PURE__ */ e("div", { className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ e(
788
+ At,
789
+ {
790
+ granted: !1,
791
+ canGrant: !z && !!fe,
792
+ pending: P,
793
+ headingLevel: 3,
794
+ className: "ds:[&_p:not(:last-child)]:mb-[var(--spacing-sm)]",
795
+ copy: {
796
+ title: r("aiSummaryPanel.consentTitle"),
797
+ descriptionRequired: r("aiSummaryPanel.consentDescription"),
798
+ confirmLabel: r("aiSummaryPanel.consentCheckbox"),
799
+ grantButton: r("aiSummaryPanel.generate"),
800
+ pendingLabel: r("aiSummaryPanel.loading")
801
+ },
802
+ onGrantConsent: () => {
803
+ xe().catch(() => {
804
+ });
805
+ }
806
+ }
807
+ ) }) : null,
808
+ i === "loading" ? /* @__PURE__ */ e(
809
+ "div",
810
+ {
811
+ "data-ai-summary-state": "loading",
812
+ "aria-hidden": "true",
813
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]",
814
+ children: ["a", "b", "c"].map((t, o) => /* @__PURE__ */ u(
815
+ "div",
816
+ {
817
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
818
+ children: [
819
+ /* @__PURE__ */ e(Ae, { variant: "text", size: "sm", width: "40%", stagger: o }),
820
+ /* @__PURE__ */ e(Ae, { variant: "text", size: "sm", lines: 3, stagger: o })
821
+ ]
822
+ },
823
+ t
824
+ ))
825
+ }
826
+ ) : null,
827
+ i === "stale" ? /* @__PURE__ */ e("div", { className: de, children: /* @__PURE__ */ u(x, { variant: "warning", announce: "off", "data-ai-summary-stale": "", children: [
828
+ /* @__PURE__ */ e(x.Title, { as: "h3", children: r("aiSummaryPanel.staleTitle") }),
829
+ /* @__PURE__ */ e(x.Description, { children: r("aiSummaryPanel.staleDescription") })
830
+ ] }) }) : null,
831
+ Me ? /* @__PURE__ */ e("div", { className: de, children: Me }) : null,
832
+ se ? /* @__PURE__ */ e(
833
+ Ct,
834
+ {
835
+ showHeader: !1,
836
+ entityName: f,
837
+ entityHref: V,
838
+ stats: N,
839
+ sections: mt,
840
+ locale: Q,
841
+ disclaimer: !1
842
+ }
843
+ ) : null,
844
+ i === "insufficient-data" ? /* @__PURE__ */ e(
845
+ "div",
846
+ {
847
+ "data-ai-summary-state": "insufficient-data",
848
+ className: "ds:p-[var(--spacing-md)]",
849
+ children: /* @__PURE__ */ u(b, { variant: "first-use", size: "sm", headingLevel: 3, children: [
850
+ /* @__PURE__ */ e(b.Title, { children: r("aiSummaryPanel.insufficientTitle") }),
851
+ /* @__PURE__ */ e(b.Description, { children: r("aiSummaryPanel.insufficientDescription") }),
852
+ C && C.length > 0 ? /* @__PURE__ */ e("ul", { className: "ds:m-0 ds:flex ds:list-disc ds:flex-col ds:gap-[var(--spacing-2xs)] ds:ps-[var(--spacing-md)] ds:text-start type-body-sm", children: C.map((t) => /* @__PURE__ */ e("li", { children: r(_t[t]) }, t)) }) : null,
853
+ _e ? /* @__PURE__ */ e(b.Actions, { children: /* @__PURE__ */ e(
854
+ tt,
855
+ {
856
+ busy: P,
857
+ label: r("aiSummaryPanel.generate"),
858
+ onClick: () => {
859
+ H(!1).catch(() => {
860
+ });
861
+ }
862
+ }
863
+ ) }) : null
864
+ ] })
865
+ }
866
+ ) : null,
867
+ i === "not-generated" ? /* @__PURE__ */ e(
868
+ "div",
869
+ {
870
+ "data-ai-summary-state": "not-generated",
871
+ className: "ds:p-[var(--spacing-md)]",
872
+ children: /* @__PURE__ */ u(b, { variant: "first-use", size: "sm", headingLevel: 3, children: [
873
+ /* @__PURE__ */ e(b.Title, { children: r("aiSummaryPanel.notGeneratedTitle") }),
874
+ /* @__PURE__ */ e(b.Description, { children: r("aiSummaryPanel.notGeneratedDescription") }),
875
+ _e ? /* @__PURE__ */ e(b.Actions, { children: /* @__PURE__ */ e(
876
+ tt,
877
+ {
878
+ busy: P,
879
+ label: r("aiSummaryPanel.generate"),
880
+ onClick: () => {
881
+ H(!1).catch(() => {
882
+ });
883
+ }
884
+ }
885
+ ) }) : null
886
+ ] })
887
+ }
888
+ ) : null,
889
+ i === "credits-exhausted" ? /* @__PURE__ */ e(
890
+ "div",
891
+ {
892
+ "data-ai-summary-state": "credits-exhausted",
893
+ className: "ds:p-[var(--spacing-md)]",
894
+ children: /* @__PURE__ */ e(kt, { headingLevel: 3, announce: "off" })
895
+ }
896
+ ) : null,
897
+ i === "error" ? /* @__PURE__ */ e(
898
+ "div",
899
+ {
900
+ "data-ai-summary-state": "error",
901
+ className: "ds:p-[var(--spacing-md)]",
902
+ children: /* @__PURE__ */ u(x, { variant: "error", announce: "off", children: [
903
+ /* @__PURE__ */ e(x.Title, { as: "h3", children: r("aiSummaryPanel.errorTitle") }),
904
+ O ? /* @__PURE__ */ e(x.Description, { children: O }) : null,
905
+ Re ? /* @__PURE__ */ e(x.Action, { children: /* @__PURE__ */ e(
906
+ ue,
907
+ {
908
+ type: "button",
909
+ intent: "secondary",
910
+ size: "sm",
911
+ onClick: Re,
912
+ children: r("aiSummaryPanel.retry")
913
+ }
914
+ ) }) : null
915
+ ] })
916
+ }
917
+ ) : null,
918
+ ze ? /* @__PURE__ */ e("div", { className: de, children: /* @__PURE__ */ e(x, { variant: "error", "data-ai-summary-action-error": "", children: /* @__PURE__ */ e(x.Description, { children: ze }) }) }) : null
919
+ ]
920
+ }
921
+ ),
922
+ /* @__PURE__ */ e(
923
+ "footer",
924
+ {
925
+ "data-ai-summary-disclaimer": "",
926
+ className: "ds:shrink-0 ds:border-t ds:border-[color:var(--border)] ds:p-[var(--spacing-md)]",
927
+ children: /* @__PURE__ */ e("p", { className: "ds:m-0 type-meta ds:text-[color:var(--muted-foreground)]", children: r("aiSummaryPanel.disclaimer") })
928
+ }
929
+ )
930
+ ] });
931
+ }
932
+ );
933
+ Wt.displayName = "AiSummaryPanel";
934
+ function tt({
935
+ busy: n,
936
+ label: s,
937
+ onClick: l
938
+ }) {
939
+ return /* @__PURE__ */ e(
940
+ ue,
941
+ {
942
+ type: "button",
943
+ intent: "primary",
944
+ size: "md",
945
+ loading: n,
946
+ onClick: l,
947
+ children: s
948
+ }
949
+ );
950
+ }
951
+ function Ot({
952
+ generatedAtIso: n,
953
+ band: s,
954
+ lang: l
955
+ }) {
956
+ const { t: d } = he("ui"), g = me(() => {
957
+ const f = new Date(n);
958
+ return Number.isNaN(f.getTime()) ? "" : new Intl.DateTimeFormat(l, {
959
+ dateStyle: "medium",
960
+ timeStyle: "short"
961
+ }).format(f);
962
+ }, [n, l]);
963
+ return /* @__PURE__ */ u(
964
+ "div",
965
+ {
966
+ "data-ai-summary-age": s,
967
+ className: `ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] type-meta ${s === "very-old" ? "ds:text-[color:var(--destructive)]" : s === "old" ? "ds:text-[color:var(--warning-foreground)]" : "ds:text-[color:var(--muted-foreground)]"}`,
968
+ children: [
969
+ /* @__PURE__ */ u("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
970
+ /* @__PURE__ */ e(ke, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" }),
971
+ /* @__PURE__ */ e("span", { children: d("aiSummaryPanel.generatedAt", { date: g }) })
972
+ ] }),
973
+ s !== "fresh" ? /* @__PURE__ */ e("span", { children: d("aiSummaryPanel.ageNotice", {
974
+ hours: s === "very-old" ? st : at
975
+ }) }) : null
976
+ ]
977
+ }
978
+ );
979
+ }
980
+ function Ut({ label: n }) {
981
+ const { t: s } = he("ui");
982
+ return /* @__PURE__ */ u("div", { "data-ai-summary-section-state": "loading", children: [
983
+ /* @__PURE__ */ e("div", { "aria-hidden": "true", children: /* @__PURE__ */ e(Ae, { variant: "text", size: "sm", lines: 3 }) }),
984
+ /* @__PURE__ */ e("span", { className: "ds:sr-only", children: s("aiSummaryPanel.sectionLoading", { section: n }) })
985
+ ] });
986
+ }
987
+ function jt({
988
+ message: n,
989
+ retry: s,
990
+ live: l
991
+ }) {
992
+ return /* @__PURE__ */ u(
993
+ "div",
994
+ {
995
+ "data-ai-summary-section-state": "error",
996
+ className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-sm)]",
997
+ children: [
998
+ /* @__PURE__ */ u(
999
+ "p",
1000
+ {
1001
+ role: l ? "alert" : void 0,
1002
+ className: "ds:m-0 ds:inline-flex ds:items-start ds:gap-[var(--spacing-2xs)] type-body-sm ds:text-[color:var(--foreground)]",
1003
+ children: [
1004
+ /* @__PURE__ */ e(
1005
+ nt,
1006
+ {
1007
+ "aria-hidden": "true",
1008
+ className: "ds:mt-0.5 ds:size-4 ds:shrink-0 ds:text-[color:var(--error-foreground)]"
1009
+ }
1010
+ ),
1011
+ /* @__PURE__ */ e("span", { children: n })
1012
+ ]
1013
+ },
1014
+ l ? "live" : "quiet"
1015
+ ),
1016
+ s
1017
+ ]
1018
+ }
1019
+ );
1020
+ }
1021
+ function Vt({ iso: n, lang: s }) {
1022
+ const { t: l } = he("ui"), d = me(() => {
1023
+ const g = new Date(n);
1024
+ return Number.isNaN(g.getTime()) ? "" : new Intl.DateTimeFormat(s, {
1025
+ dateStyle: "medium",
1026
+ timeStyle: "short"
1027
+ }).format(g);
1028
+ }, [n, s]);
1029
+ return d ? /* @__PURE__ */ u(
1030
+ "span",
1031
+ {
1032
+ "data-ai-summary-section-time": "",
1033
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1034
+ children: [
1035
+ /* @__PURE__ */ e(ke, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" }),
1036
+ l("aiSummaryPanel.generatedAt", { date: d })
1037
+ ]
1038
+ }
1039
+ ) : null;
1040
+ }
1041
+ export {
1042
+ Wt as A,
1043
+ zt as a
1044
+ };
1045
+ //# sourceMappingURL=ai-summary-panel-BhCo2vZF.js.map