@alfadocs/ui-kit 1.134.0 → 1.135.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 (125) hide show
  1. package/dist/_chunks/ai-summary-panel-B70S2lgC.js +455 -0
  2. package/dist/_chunks/{alia-sidebar-CK1zw_Bc.js → alia-sidebar-CtwhdASP.js} +3 -3
  3. package/dist/_chunks/{appointment-card-DG3m9yN-.js → appointment-card-BT1cMZIX.js} +2 -2
  4. package/dist/_chunks/{appointment-peek-BK0tDs4C.js → appointment-peek-BP_ACFz5.js} +2 -2
  5. package/dist/_chunks/{appointment-timeline-BiI2riRZ.js → appointment-timeline-Dy4YQJ17.js} +2 -2
  6. package/dist/_chunks/{appointment-tray-ClJCtYQj.js → appointment-tray-B3gSHL1j.js} +2 -2
  7. package/dist/_chunks/{calendar-appointment-editor-dialog-BSkIYGlW.js → calendar-appointment-editor-dialog-I5PfWudy.js} +8 -8
  8. package/dist/_chunks/{chat-container-B83b4hut.js → chat-container-CoOT7dzB.js} +37 -36
  9. package/dist/_chunks/{chat-input-DwQ4_WXK.js → chat-input-CX4dxBq7.js} +85 -84
  10. package/dist/_chunks/communications-panel-BKPHCiMB.js +973 -0
  11. package/dist/_chunks/{entity-summary-KHM0PnSI.js → entity-summary-CpNk6ybN.js} +70 -69
  12. package/dist/_chunks/get-error-message-DbFUzuja.js +7 -0
  13. package/dist/_chunks/handled-rejection-C-6Dq0As.js +9 -0
  14. package/dist/_chunks/megaphone-CzeTT9B3.js +22 -0
  15. package/dist/_chunks/{notes-panel-BAyPOr8N.js → notes-panel-BvjAo4RQ.js} +5 -4
  16. package/dist/_chunks/{patient-account-settings-BkAtIxJW.js → patient-account-settings-B2XbN_Fe.js} +2 -2
  17. package/dist/_chunks/{patient-check-in-resume-xhqjC6gf.js → patient-check-in-resume-B7NY-6KI.js} +4 -4
  18. package/dist/_chunks/{portal-details-CTEsm705.js → portal-details-DCIiGkHA.js} +2 -2
  19. package/dist/_chunks/{portal-documents-D8skew0h.js → portal-documents-DJOH8pZx.js} +2 -2
  20. package/dist/_chunks/{portal-parts-BdR29P7z.js → portal-parts-Br8wuala.js} +2 -2
  21. package/dist/_chunks/signing-end-screen-BdhbkPKO.js +1355 -0
  22. package/dist/_chunks/{task-editor-g1AGfxhr.js → task-editor-DvwqPfFR.js} +3 -2
  23. package/dist/_chunks/{tasks-panel-BE3zaayj.js → tasks-panel-6EzdnwT8.js} +155 -171
  24. package/dist/_chunks/{use-appointment-details-read-Dzc6fEzG.js → use-appointment-details-read-6_OmOwUs.js} +110 -109
  25. package/dist/_chunks/{workflow-status-D1WgGVTP.js → workflow-status-CO0mxXs2.js} +3 -2
  26. package/dist/agent-catalog.json +251 -1
  27. package/dist/agent-i18n/en.json +28 -0
  28. package/dist/browser-support.js +1 -1
  29. package/dist/components/_shared/sms-segments.d.ts +43 -0
  30. package/dist/components/ai-summary-panel/ai-summary-panel.agent.d.ts +4 -0
  31. package/dist/components/ai-summary-panel/ai-summary-panel.d.ts +71 -0
  32. package/dist/components/ai-summary-panel/index.d.ts +4 -0
  33. package/dist/components/ai-summary-panel/index.js +6 -0
  34. package/dist/components/appointment-card/index.js +2 -2
  35. package/dist/components/appointment-details-panel/index.js +1 -1
  36. package/dist/components/appointment-peek/index.js +1 -1
  37. package/dist/components/appointment-timeline/index.js +1 -1
  38. package/dist/components/chat-container/chat-container.d.ts +7 -0
  39. package/dist/components/chat-container/index.js +1 -1
  40. package/dist/components/chat-input/chat-input.d.ts +3 -0
  41. package/dist/components/chat-input/index.js +1 -1
  42. package/dist/components/communications-panel/communications-panel.agent.d.ts +4 -0
  43. package/dist/components/communications-panel/communications-panel.d.ts +136 -0
  44. package/dist/components/communications-panel/index.d.ts +6 -0
  45. package/dist/components/communications-panel/index.js +7 -0
  46. package/dist/components/entity-summary/entity-summary.d.ts +8 -0
  47. package/dist/components/entity-summary/index.js +1 -1
  48. package/dist/components/index.d.ts +2 -0
  49. package/dist/components/notes-panel/index.js +1 -1
  50. package/dist/components/task-editor/index.js +1 -1
  51. package/dist/components/tasks-panel/index.js +1 -1
  52. package/dist/components/workflow-status/index.js +1 -1
  53. package/dist/core.css +1 -1
  54. package/dist/host-compat.css +10 -4
  55. package/dist/i18n/locales/ar.d.ts +93 -0
  56. package/dist/i18n/locales/ar.js +94 -0
  57. package/dist/i18n/locales/de.d.ts +93 -0
  58. package/dist/i18n/locales/de.js +94 -0
  59. package/dist/i18n/locales/el.d.ts +93 -0
  60. package/dist/i18n/locales/el.js +94 -0
  61. package/dist/i18n/locales/en.d.ts +93 -0
  62. package/dist/i18n/locales/en.js +94 -0
  63. package/dist/i18n/locales/es.d.ts +93 -0
  64. package/dist/i18n/locales/es.js +94 -0
  65. package/dist/i18n/locales/fr.d.ts +93 -0
  66. package/dist/i18n/locales/fr.js +94 -0
  67. package/dist/i18n/locales/hi.d.ts +93 -0
  68. package/dist/i18n/locales/hi.js +94 -0
  69. package/dist/i18n/locales/it.d.ts +93 -0
  70. package/dist/i18n/locales/it.js +94 -0
  71. package/dist/i18n/locales/ja.d.ts +93 -0
  72. package/dist/i18n/locales/ja.js +94 -0
  73. package/dist/i18n/locales/nl.d.ts +93 -0
  74. package/dist/i18n/locales/nl.js +94 -0
  75. package/dist/i18n/locales/pl.d.ts +93 -0
  76. package/dist/i18n/locales/pl.js +94 -0
  77. package/dist/i18n/locales/pt.d.ts +93 -0
  78. package/dist/i18n/locales/pt.js +94 -0
  79. package/dist/i18n/locales/ro.d.ts +93 -0
  80. package/dist/i18n/locales/ro.js +94 -0
  81. package/dist/i18n/locales/ru.d.ts +93 -0
  82. package/dist/i18n/locales/ru.js +94 -0
  83. package/dist/i18n/locales/sq.d.ts +93 -0
  84. package/dist/i18n/locales/sq.js +94 -0
  85. package/dist/i18n/locales/sv.d.ts +93 -0
  86. package/dist/i18n/locales/sv.js +94 -0
  87. package/dist/i18n/locales/tr.d.ts +93 -0
  88. package/dist/i18n/locales/tr.js +94 -0
  89. package/dist/i18n/locales/zh.d.ts +93 -0
  90. package/dist/i18n/locales/zh.js +94 -0
  91. package/dist/index.js +893 -886
  92. package/dist/locales/ar.json +93 -0
  93. package/dist/locales/de.json +93 -0
  94. package/dist/locales/el.json +93 -0
  95. package/dist/locales/en.json +93 -0
  96. package/dist/locales/es.json +93 -0
  97. package/dist/locales/fr.json +93 -0
  98. package/dist/locales/hi.json +93 -0
  99. package/dist/locales/it.json +93 -0
  100. package/dist/locales/ja.json +93 -0
  101. package/dist/locales/nl.json +93 -0
  102. package/dist/locales/pl.json +93 -0
  103. package/dist/locales/pt.json +93 -0
  104. package/dist/locales/ro.json +93 -0
  105. package/dist/locales/ru.json +93 -0
  106. package/dist/locales/sq.json +93 -0
  107. package/dist/locales/sv.json +93 -0
  108. package/dist/locales/tr.json +93 -0
  109. package/dist/locales/zh.json +93 -0
  110. package/dist/patterns/alia-assistant/index.js +1 -1
  111. package/dist/patterns/calendar/calendar.journey.d.ts +7 -0
  112. package/dist/patterns/calendar/index.js +1 -1
  113. package/dist/patterns/patient-account-settings/index.js +1 -1
  114. package/dist/patterns/patient-check-in/index.js +1 -1
  115. package/dist/patterns/patient-portal/index.js +2 -2
  116. package/dist/patterns/signing/index.d.ts +1 -0
  117. package/dist/patterns/signing/index.js +1 -1
  118. package/dist/patterns/signing/multi-field-signer.d.ts +22 -1
  119. package/dist/patterns/signing/signing-checkbox-pill.d.ts +66 -0
  120. package/dist/patterns/signing/signing-checkbox-sheet.d.ts +16 -0
  121. package/dist/patterns/signing/signing-document-screen.d.ts +18 -1
  122. package/dist/tokens.css +1 -1
  123. package/package.json +9 -1
  124. package/dist/_chunks/handled-rejection-6gqCf5vt.js +0 -13
  125. package/dist/_chunks/signing-end-screen-an9P8DOT.js +0 -1041
@@ -0,0 +1,973 @@
1
+ import { jsx as t, jsxs as f, Fragment as vn } from "react/jsx-runtime";
2
+ import { forwardRef as wn, useId as Ue, useRef as p, useImperativeHandle as bn, useState as k, useEffect as T, useMemo as D, useCallback as Ve } from "react";
3
+ import { c as xn } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as Je } from "react-i18next";
5
+ import { u as Sn } from "./registry-DvAUVLHh.js";
6
+ import { g as kn } from "./get-error-message-DbFUzuja.js";
7
+ import { SafeHtml as Pn } from "../safe-html/index.js";
8
+ import { A as V } from "./alert-C4WKViaS.js";
9
+ import { B as W } from "./badge-BUk4RjTS.js";
10
+ import { B as q } from "./button-DohK_Ak_.js";
11
+ import { C as Tn } from "./chat-container-CoOT7dzB.js";
12
+ import { C as Nn } from "./chat-input-CX4dxBq7.js";
13
+ import { C as Cn } from "./chat-message-CfIyXrxA.js";
14
+ import { E as ce } from "./empty-state-DwJ5YNzz.js";
15
+ import { P as We } from "./panel-header-CbtlTe85.js";
16
+ import { S as Mn } from "./select-uESzXTX6.js";
17
+ import { S as Xe } from "./skeleton-tTWJpvAq.js";
18
+ import { T as An } from "./timestamp-DPLDWdxA.js";
19
+ import { a as me } from "./whatsapp-button-XbozeDl_.js";
20
+ import { M as qe } from "./message-square-Bye4ATvx.js";
21
+ import { C as Qe } from "./circle-alert-rGDZ73Wh.js";
22
+ import { T as Oe } from "./triangle-alert-CBnO6nq_.js";
23
+ import { M as In } from "./megaphone-CzeTT9B3.js";
24
+ import { c as pe } from "./createLucideIcon-DhHxpK9K.js";
25
+ import { F as le } from "./file-text-5yv6r2ls.js";
26
+ import { S as En } from "./smartphone-C0rFF2if.js";
27
+ import { M as Dn } from "./mail-BqXVF2zH.js";
28
+ import { C as Rn } from "./circle-check-BN6rz4NV.js";
29
+ import { C as _n } from "./clock-Drd4Wtis.js";
30
+ /**
31
+ * @license lucide-react v1.22.0 - ISC
32
+ *
33
+ * This source code is licensed under the ISC license.
34
+ * See the LICENSE file in the root directory of this source tree.
35
+ */
36
+ const zn = [
37
+ ["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }],
38
+ ["path", { d: "M10 4v4", key: "pp8u80" }],
39
+ ["path", { d: "M2 8h20", key: "d11cs7" }],
40
+ ["path", { d: "M6 4v4", key: "1svtjw" }]
41
+ ], Fn = pe("app-window", zn);
42
+ /**
43
+ * @license lucide-react v1.22.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */
48
+ const jn = [
49
+ ["path", { d: "M12 2v4", key: "3427ic" }],
50
+ ["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
51
+ ["path", { d: "M18 12h4", key: "wj9ykh" }],
52
+ ["path", { d: "m16.2 16.2 2.9 2.9", key: "1bxg5t" }],
53
+ ["path", { d: "M12 18v4", key: "jadmvz" }],
54
+ ["path", { d: "m4.9 19.1 2.9-2.9", key: "bwix9q" }],
55
+ ["path", { d: "M2 12h4", key: "j09sii" }],
56
+ ["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
57
+ ], Kn = pe("loader", jn);
58
+ /**
59
+ * @license lucide-react v1.22.0 - ISC
60
+ *
61
+ * This source code is licensed under the ISC license.
62
+ * See the LICENSE file in the root directory of this source tree.
63
+ */
64
+ const Ln = [
65
+ ["rect", { width: "8", height: "8", x: "3", y: "3", rx: "2", key: "by2w9f" }],
66
+ ["path", { d: "M7 11v4a2 2 0 0 0 2 2h4", key: "xkn7yn" }],
67
+ ["rect", { width: "8", height: "8", x: "13", y: "13", rx: "2", key: "1cgmvn" }]
68
+ ], $n = pe("workflow", Ln), Bn = `@£$¥èéùìòÇ
69
+ Øø\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà`, Hn = "^{}\\[~]|€\f", Yn = " // ", Gn = 612, Un = 268;
70
+ function Vn(n) {
71
+ let c = !0, l = 0;
72
+ for (const m of n)
73
+ if (Bn.includes(m)) l += 1;
74
+ else if (Hn.includes(m))
75
+ l += 2;
76
+ else {
77
+ c = !1;
78
+ break;
79
+ }
80
+ if (c) {
81
+ const m = l <= 160 ? 1 : Math.ceil(l / 153);
82
+ return {
83
+ chars: l,
84
+ parts: Math.max(1, m),
85
+ encoding: "gsm",
86
+ max: Gn
87
+ };
88
+ }
89
+ let g = 0;
90
+ for (const m of n) g += (m.codePointAt(0) ?? 0) > 65535 ? 2 : 1;
91
+ const w = g <= 70 ? 1 : Math.ceil(g / 67);
92
+ return {
93
+ chars: g,
94
+ parts: Math.max(1, w),
95
+ encoding: "ucs2",
96
+ max: Un
97
+ };
98
+ }
99
+ function de(n, c) {
100
+ const l = c == null ? void 0 : c.trim(), g = l ? `${n}${Yn}${l}` : n, w = Vn(g);
101
+ return { ...w, overLimit: w.chars > w.max };
102
+ }
103
+ const Wn = {
104
+ id: "communications-panel",
105
+ // 'submit' backs send_message. select_channel and mark_seen have no
106
+ // dedicated capability in the closed vocabulary.
107
+ capabilities: ["submit"],
108
+ state: {
109
+ channel: {
110
+ type: "'app' | 'sms' | 'email' | null",
111
+ descriptionKey: "ui.agent.communicationsPanel.state.channel",
112
+ description: "The channel the composer will send by. Null when no channel can be used.",
113
+ read: (n) => n.getState().channel
114
+ },
115
+ messageCount: {
116
+ type: "number",
117
+ descriptionKey: "ui.agent.communicationsPanel.state.messageCount",
118
+ description: "How many messages the thread holds. A count only, never a message. Zero under privacy.",
119
+ read: (n) => n.getState().messageCount
120
+ },
121
+ unreadCount: {
122
+ type: "number",
123
+ descriptionKey: "ui.agent.communicationsPanel.state.unreadCount",
124
+ description: "How many incoming messages are new.",
125
+ read: (n) => n.getState().unreadCount
126
+ },
127
+ status: {
128
+ type: "'ready' | 'loading' | 'error'",
129
+ descriptionKey: "ui.agent.communicationsPanel.state.status",
130
+ description: "The state of the host's read of the thread.",
131
+ read: (n) => n.getState().status
132
+ },
133
+ limitReached: {
134
+ type: "boolean",
135
+ descriptionKey: "ui.agent.communicationsPanel.state.limitReached",
136
+ description: "Whether the daily send limit is reached. SMS and Email are then unavailable; App stays.",
137
+ read: (n) => n.getState().limitReached
138
+ },
139
+ privacy: {
140
+ type: "{ masked: true } | null",
141
+ descriptionKey: "ui.agent.communicationsPanel.state.privacy",
142
+ description: "Reads { masked: true } when privacy mode withholds the thread, else null.",
143
+ read: (n) => n.getState().privacy ? { masked: !0 } : null
144
+ }
145
+ },
146
+ actions: {
147
+ select_channel: {
148
+ safety: "write",
149
+ argsType: "{ channel: 'app' | 'sms' | 'email' }",
150
+ argsSchema: {
151
+ type: "object",
152
+ properties: {
153
+ channel: { type: "string", enum: ["app", "sms", "email"] }
154
+ },
155
+ required: ["channel"]
156
+ },
157
+ idempotent: !0,
158
+ errors: [
159
+ "The channel is not available for this patient, or the daily limit closed it.",
160
+ "The panel is read-only or privacy mode is on."
161
+ ],
162
+ descriptionKey: "ui.agent.communicationsPanel.actions.selectChannel",
163
+ description: "Choose the channel the composer sends by. Rejects when the channel is not available.",
164
+ examples: [{ args: { channel: "sms" }, note: "Switch to SMS." }],
165
+ invoke: (n, c) => n.selectChannel(c.channel)
166
+ },
167
+ mark_seen: {
168
+ safety: "write",
169
+ idempotent: !0,
170
+ openWorld: !0,
171
+ errors: [
172
+ "The panel is read-only or privacy mode is on.",
173
+ "The host refused to clear the unread flag."
174
+ ],
175
+ descriptionKey: "ui.agent.communicationsPanel.actions.markSeen",
176
+ description: "Tell the host the new incoming messages were seen. Settles with the host's answer.",
177
+ invoke: (n) => n.markSeen()
178
+ },
179
+ send_message: {
180
+ // A message to a patient is patient-identifiable. PHI.
181
+ safety: "phi",
182
+ argsType: "{ channel: 'app' | 'sms' | 'email'; body: string }",
183
+ argsSchema: {
184
+ type: "object",
185
+ properties: {
186
+ channel: { type: "string", enum: ["app", "sms", "email"] },
187
+ body: {
188
+ type: "string",
189
+ description: "Plain text. For SMS the sender name is added to the end."
190
+ }
191
+ },
192
+ required: ["channel", "body"]
193
+ },
194
+ openWorld: !0,
195
+ errors: [
196
+ "The channel is not available for this patient, or the daily limit closed it.",
197
+ "The message is empty, or an SMS is above the length cap.",
198
+ "The panel is read-only or privacy mode is on.",
199
+ "A send is already in progress.",
200
+ "The host refused the send. The panel keeps the draft and shows the host's message."
201
+ ],
202
+ descriptionKey: "ui.agent.communicationsPanel.actions.sendMessage",
203
+ description: "Send a message to the patient by App, SMS or Email. Settles with the host's answer; a refusal rejects.",
204
+ examples: [
205
+ {
206
+ args: { channel: "app", body: "See you on Tuesday." },
207
+ note: "Send a short App message."
208
+ }
209
+ ],
210
+ invoke: (n, c) => n.sendMessage(c)
211
+ }
212
+ },
213
+ domHooks: {
214
+ root: {
215
+ attr: "data-component",
216
+ value: "communications-panel",
217
+ description: "Marks the CommunicationsPanel region."
218
+ },
219
+ instanceId: {
220
+ attr: "data-component-id",
221
+ sourceProp: "id",
222
+ description: "Sourced from the id prop. Required to address a specific panel from the agent."
223
+ },
224
+ item: {
225
+ attr: "data-message-id",
226
+ description: "Stable message id on each rendered message. Also carries data-direction and data-channel. Never a name, number or text."
227
+ }
228
+ }
229
+ }, Ze = xn(
230
+ "ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:bg-[color:var(--card)]"
231
+ ), X = ["app", "sms", "email"], Xn = 50, ue = {
232
+ app: "communicationsPanel.channelApp",
233
+ sms: "communicationsPanel.channelSms",
234
+ email: "communicationsPanel.channelEmail",
235
+ whatsapp: "communicationsPanel.channelWhatsApp"
236
+ }, qn = {
237
+ app: "communicationsPanel.appDisabled",
238
+ sms: "communicationsPanel.smsDisabled",
239
+ email: "communicationsPanel.emailDisabled"
240
+ }, Zn = {
241
+ sending: "communicationsPanel.statusSending",
242
+ awaiting: "communicationsPanel.statusAwaiting",
243
+ delivered: "communicationsPanel.statusDelivered",
244
+ "not-delivered": "communicationsPanel.statusNotDelivered",
245
+ "out-of-credit": "communicationsPanel.statusOutOfCredit"
246
+ }, Jn = {
247
+ sending: "info",
248
+ awaiting: "neutral",
249
+ delivered: "success",
250
+ "not-delivered": "error",
251
+ "out-of-credit": "warning"
252
+ }, Qn = {
253
+ sending: /* @__PURE__ */ t(Kn, { "aria-hidden": "true" }),
254
+ awaiting: /* @__PURE__ */ t(_n, { "aria-hidden": "true" }),
255
+ delivered: /* @__PURE__ */ t(Rn, { "aria-hidden": "true" }),
256
+ "not-delivered": /* @__PURE__ */ t(Qe, { "aria-hidden": "true" }),
257
+ "out-of-credit": /* @__PURE__ */ t(Oe, { "aria-hidden": "true" })
258
+ };
259
+ function he({ channel: n }) {
260
+ return n === "sms" ? /* @__PURE__ */ t(En, { "aria-hidden": "true" }) : n === "email" ? /* @__PURE__ */ t(Dn, { "aria-hidden": "true" }) : n === "whatsapp" ? /* @__PURE__ */ t(me, { "aria-hidden": "true" }) : /* @__PURE__ */ t(Fn, { "aria-hidden": "true" });
261
+ }
262
+ function On(n) {
263
+ return typeof n == "object" && n !== null && "status" in n && n.status === 429;
264
+ }
265
+ function et(n) {
266
+ const c = new Date(n);
267
+ return Number.isNaN(c.getTime()) ? n : `${c.getFullYear()}-${c.getMonth() + 1}-${c.getDate()}`;
268
+ }
269
+ const nt = wn(
270
+ ({
271
+ id: n,
272
+ title: c,
273
+ "aria-label": l,
274
+ nowIso: g,
275
+ locale: w,
276
+ messages: m,
277
+ status: i = "ready",
278
+ onRetry: M,
279
+ channels: A,
280
+ defaultChannel: x,
281
+ senderName: S,
282
+ limitReached: h = !1,
283
+ whatsApp: y,
284
+ privacy: r = !1,
285
+ readOnly: N = !1,
286
+ onSend: R,
287
+ onMessagesSeen: fe,
288
+ onWriteError: ge,
289
+ onEnableChannel: ye,
290
+ onOpenWhatsApp: en,
291
+ onBuyWhatsApp: nn,
292
+ onOpenProvenance: ve,
293
+ onOpenAttachment: we,
294
+ className: be,
295
+ ...xe
296
+ }, tn) => {
297
+ const { t: s, i18n: an } = Je("ui"), j = Ue(), _ = Ue(), sn = `${_}-input`, Se = `${_}-reason`, ke = `${_}-meter`, Pe = `${_}-empty-hint`, Te = `${_}-sender`, Ne = c ?? s("communicationsPanel.title"), Z = w ?? an.language, K = p(null);
298
+ bn(tn, () => K.current, []);
299
+ const [on, Ce] = k(!1);
300
+ T(() => {
301
+ Ce(!1);
302
+ }, [h]);
303
+ const L = h || on, I = (e) => A[e].available && (e === "app" || !L), [J, Me] = k(
304
+ x
305
+ ), v = J && I(J) ? J : x && I(x) ? x : X.find(I), Q = X.every((e) => !A[e].available), Ae = X.filter(
306
+ (e) => !A[e].available
307
+ ), z = D(
308
+ () => [...m].sort(
309
+ (e, a) => new Date(e.createdAtIso).getTime() - new Date(a.createdAtIso).getTime()
310
+ ),
311
+ [m]
312
+ ), b = D(
313
+ () => m.filter((e) => e.isNew && e.direction === "in").map((e) => e.id),
314
+ [m]
315
+ ), [Ie, rn] = k(
316
+ () => /* @__PURE__ */ new Set()
317
+ );
318
+ T(() => {
319
+ r || b.length === 0 || rn((e) => b.every((a) => e.has(a)) ? e : /* @__PURE__ */ new Set([...e, ...b]));
320
+ }, [r, b]);
321
+ const $ = p(R);
322
+ $.current = R;
323
+ const Ee = p(fe);
324
+ Ee.current = fe;
325
+ const C = p(ge);
326
+ C.current = ge;
327
+ const E = p(!0);
328
+ T(() => (E.current = !0, () => {
329
+ E.current = !1;
330
+ }), []);
331
+ const O = p(/* @__PURE__ */ new Set()), B = Ve(async (e) => {
332
+ var u;
333
+ const a = Ee.current;
334
+ if (!(!a || e.length === 0)) {
335
+ e.forEach((o) => O.current.add(o));
336
+ try {
337
+ await a(e);
338
+ } catch (o) {
339
+ throw e.forEach((yn) => O.current.delete(yn)), (u = C.current) == null || u.call(C, { kind: "mark-seen", error: o, shown: !1 }), o;
340
+ }
341
+ }
342
+ }, []);
343
+ T(() => {
344
+ if (r || N || i !== "ready") return;
345
+ const e = b.filter((a) => !O.current.has(a));
346
+ e.length !== 0 && B(e).catch(() => {
347
+ });
348
+ }, [r, N, i, b, B]);
349
+ const [H, ee] = k(""), [De, Re] = k(!1), Y = p(!1), [_e, ne] = k(null), [cn, G] = k(!1), [ln, U] = k(!1);
350
+ T(() => {
351
+ r && (ee(""), ne(null), G(!1), U(!1));
352
+ }, [r]);
353
+ const te = Ve(
354
+ async (e) => {
355
+ var a, u;
356
+ if (!Y.current) {
357
+ Y.current = !0, Re(!0), ne(null), G(!1);
358
+ try {
359
+ await ((a = $.current) == null ? void 0 : a.call($, e)), E.current && (ee((o) => o.trim() === e.body ? "" : o), G(!0));
360
+ } catch (o) {
361
+ throw E.current && (On(o) && Ce(!0), ne(
362
+ kn(o, s("communicationsPanel.sendFailed"))
363
+ )), (u = C.current) == null || u.call(C, {
364
+ kind: "send",
365
+ id: e.channel,
366
+ error: o,
367
+ shown: E.current
368
+ }), o;
369
+ } finally {
370
+ Y.current = !1, E.current && Re(!1);
371
+ }
372
+ }
373
+ },
374
+ [s]
375
+ ), d = v === "sms" && H.trim() ? de(H.trim(), S) : null, P = !!(d != null && d.overLimit), ae = !!d && !d.overLimit && d.chars >= d.max - Xn, se = !H.trim(), dn = (e) => {
376
+ const a = e.trim();
377
+ if (!(!v || !a || Y.current)) {
378
+ if (v === "sms" && de(a, S).overLimit) {
379
+ U(!0);
380
+ return;
381
+ }
382
+ te({ channel: v, body: a }).catch(() => {
383
+ });
384
+ }
385
+ }, ie = p({
386
+ channel: v,
387
+ messageCount: m.length,
388
+ unreadCount: b.length,
389
+ status: i,
390
+ limitReached: L,
391
+ privacy: r
392
+ });
393
+ ie.current = {
394
+ channel: v,
395
+ messageCount: r ? 0 : m.length,
396
+ unreadCount: r ? 0 : b.length,
397
+ status: i,
398
+ limitReached: L,
399
+ privacy: r
400
+ };
401
+ const ze = p({ readOnly: N, privacy: r });
402
+ ze.current = { readOnly: N, privacy: r };
403
+ const oe = p(I);
404
+ oe.current = I;
405
+ const Fe = p(b);
406
+ Fe.current = b;
407
+ const mn = D(() => {
408
+ const e = async () => {
409
+ const a = ze.current;
410
+ if (a.privacy)
411
+ throw new Error("Messages are hidden by privacy mode.");
412
+ if (a.readOnly) throw new Error("The panel is read-only.");
413
+ };
414
+ return {
415
+ getState: () => ({
416
+ ...ie.current,
417
+ channel: ie.current.channel ?? null
418
+ }),
419
+ selectChannel: async (a) => {
420
+ if (await e(), !oe.current(a))
421
+ throw new Error(`The ${a} channel is not available.`);
422
+ Me(a);
423
+ },
424
+ markSeen: async () => {
425
+ await e(), await B(Fe.current);
426
+ },
427
+ sendMessage: async (a) => {
428
+ if (await e(), !oe.current(a.channel))
429
+ throw new Error(`The ${a.channel} channel is not available.`);
430
+ if (!a.body.trim()) throw new Error("The message is empty.");
431
+ if (a.channel === "sms" && de(a.body.trim(), S).overLimit)
432
+ throw new Error("The message is too long.");
433
+ await te({
434
+ channel: a.channel,
435
+ body: a.body.trim()
436
+ });
437
+ }
438
+ };
439
+ }, [te, B, S]);
440
+ Sn(Wn, mn, n);
441
+ const je = p(!1), re = p(!1);
442
+ T(() => {
443
+ const e = K.current;
444
+ if (!e) return;
445
+ const a = re.current && (!document.activeElement || document.activeElement === document.body);
446
+ if (je.current && !a || !a && !r && i !== "ready") return;
447
+ je.current = !0;
448
+ const u = r || i !== "ready" ? null : e.querySelector("textarea") ?? e.querySelector("[data-comms-enable]");
449
+ if (u) {
450
+ u.focus({ preventScroll: !0 });
451
+ return;
452
+ }
453
+ const o = e.querySelector("h2");
454
+ o && (o.setAttribute("tabindex", "-1"), o.focus({ preventScroll: !0, focusVisible: !1 }));
455
+ }, [r, i]);
456
+ const Ke = D(() => {
457
+ const e = new Date(g ?? Date.now()).getFullYear();
458
+ return (a) => ({
459
+ day: "numeric",
460
+ month: "long",
461
+ ...new Date(a).getFullYear() === e ? {} : { year: "numeric" }
462
+ });
463
+ }, [g]), un = D(() => {
464
+ const e = [];
465
+ let a = "";
466
+ for (const u of z) {
467
+ const o = et(u.createdAtIso);
468
+ o !== a && (a = o, e.push({
469
+ id: `day-${o}`,
470
+ node: /* @__PURE__ */ t(
471
+ "div",
472
+ {
473
+ "data-comms-day": o,
474
+ className: "ds:flex ds:justify-center ds:py-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]",
475
+ children: /* @__PURE__ */ t(
476
+ An,
477
+ {
478
+ value: u.createdAtIso,
479
+ format: "absolute",
480
+ absoluteFormat: Ke(u.createdAtIso),
481
+ locale: Z
482
+ }
483
+ )
484
+ }
485
+ )
486
+ })), e.push({
487
+ id: u.id,
488
+ node: /* @__PURE__ */ t(
489
+ tt,
490
+ {
491
+ message: u,
492
+ senderName: S,
493
+ lang: Z,
494
+ showNew: !!u.isNew || Ie.has(u.id),
495
+ onOpenProvenance: ve,
496
+ onOpenAttachment: we
497
+ }
498
+ )
499
+ });
500
+ }
501
+ return e;
502
+ }, [
503
+ z,
504
+ S,
505
+ Z,
506
+ Ie,
507
+ Ke,
508
+ ve,
509
+ we
510
+ ]), Le = i === "loading" ? s("communicationsPanel.loading") : De ? s("communicationsPanel.sending") : cn && se ? s("communicationsPanel.sent") : P || ln ? s("communicationsPanel.smsTooLong", { max: (d == null ? void 0 : d.max) ?? 0 }) : "", [hn, pn] = k("");
511
+ T(() => {
512
+ pn(Le);
513
+ }, [Le]);
514
+ const $e = p(null), Be = !r && i !== "loading" && i !== "error" && z.length > 0;
515
+ T(() => {
516
+ var a;
517
+ if (!Be) return;
518
+ const e = (a = $e.current) == null ? void 0 : a.querySelector('[role="log"]');
519
+ e == null || e.scrollTo({ top: e.scrollHeight, behavior: "instant" });
520
+ }, [Be]);
521
+ const He = {
522
+ onFocusCapture: () => {
523
+ re.current = !0;
524
+ },
525
+ onBlurCapture: (e) => {
526
+ e.relatedTarget && (re.current = !1);
527
+ }
528
+ };
529
+ if (r)
530
+ return /* @__PURE__ */ f(
531
+ "section",
532
+ {
533
+ ref: K,
534
+ "data-component": "communications-panel",
535
+ "data-component-id": n,
536
+ "data-privacy": "masked",
537
+ "aria-labelledby": l ? void 0 : j,
538
+ "aria-label": l,
539
+ className: [Ze(), be].filter(Boolean).join(" "),
540
+ ...He,
541
+ ...He,
542
+ ...xe,
543
+ children: [
544
+ /* @__PURE__ */ t(
545
+ We,
546
+ {
547
+ title: Ne,
548
+ icon: /* @__PURE__ */ t(qe, { "aria-hidden": "true" }),
549
+ headingId: l ? void 0 : j,
550
+ divider: !0
551
+ }
552
+ ),
553
+ /* @__PURE__ */ t("div", { className: "ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ t(
554
+ ce,
555
+ {
556
+ variant: "first-use",
557
+ size: "sm",
558
+ title: s("communicationsPanel.privacyTitle"),
559
+ description: s("communicationsPanel.privacyDescription")
560
+ }
561
+ ) })
562
+ ]
563
+ }
564
+ );
565
+ const Ye = v ? A[v].recipient : void 0, fn = X.map((e) => ({
566
+ value: e,
567
+ label: s(ue[e]),
568
+ disabled: !I(e),
569
+ startAdornment: /* @__PURE__ */ t(he, { channel: e })
570
+ })), gn = [
571
+ se ? Pe : void 0,
572
+ d ? ke : void 0,
573
+ d && v === "sms" ? Te : void 0,
574
+ P ? Se : void 0
575
+ ].filter(Boolean).join(" ") || void 0;
576
+ let F;
577
+ i === "loading" ? F = /* @__PURE__ */ t(
578
+ "div",
579
+ {
580
+ "data-comms-state": "loading",
581
+ className: "ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-md)] ds:overflow-y-auto ds:p-[var(--spacing-md)]",
582
+ "aria-hidden": "true",
583
+ children: ["a", "b", "c"].map((e, a) => /* @__PURE__ */ f(
584
+ "div",
585
+ {
586
+ className: [
587
+ "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
588
+ a % 2 === 1 ? "ds:items-end" : "ds:items-start"
589
+ ].join(" "),
590
+ children: [
591
+ /* @__PURE__ */ t(
592
+ Xe,
593
+ {
594
+ variant: "rounded",
595
+ width: "70%",
596
+ height: "3rem",
597
+ stagger: a
598
+ }
599
+ ),
600
+ /* @__PURE__ */ t(Xe, { variant: "text", size: "sm", width: "30%", stagger: a })
601
+ ]
602
+ },
603
+ e
604
+ ))
605
+ }
606
+ ) : i === "error" ? F = /* @__PURE__ */ t(
607
+ "div",
608
+ {
609
+ "data-comms-state": "error",
610
+ className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]",
611
+ children: /* @__PURE__ */ t(
612
+ ce,
613
+ {
614
+ variant: "error",
615
+ size: "sm",
616
+ title: s("communicationsPanel.errorTitle"),
617
+ primaryAction: M ? { label: s("communicationsPanel.retry"), onClick: M } : void 0
618
+ }
619
+ )
620
+ }
621
+ ) : z.length === 0 ? F = /* @__PURE__ */ t(
622
+ "div",
623
+ {
624
+ "data-comms-state": "empty",
625
+ className: "ds:min-h-0 ds:flex-1 ds:overflow-y-auto ds:p-[var(--spacing-md)]",
626
+ children: /* @__PURE__ */ t(
627
+ ce,
628
+ {
629
+ variant: "first-use",
630
+ size: "sm",
631
+ title: s(Q ? "communicationsPanel.noChannelsTitle" : "communicationsPanel.emptyTitle"),
632
+ description: Q ? void 0 : s("communicationsPanel.emptyDescription")
633
+ }
634
+ )
635
+ }
636
+ ) : F = /* @__PURE__ */ t(
637
+ Tn,
638
+ {
639
+ ref: $e,
640
+ messages: un,
641
+ showScrollToLatest: !0,
642
+ logLabel: s("communicationsPanel.messagesLabel"),
643
+ className: "ds:min-h-0 ds:flex-1"
644
+ }
645
+ );
646
+ const Ge = y === "no-phone" ? s("communicationsPanel.whatsAppNoPhone") : y === "no-sms-phone" ? s("communicationsPanel.whatsAppNoSmsPhone") : null;
647
+ return /* @__PURE__ */ f(
648
+ "section",
649
+ {
650
+ ref: K,
651
+ "data-component": "communications-panel",
652
+ "data-component-id": n,
653
+ "aria-labelledby": l ? void 0 : j,
654
+ "aria-label": l,
655
+ className: [Ze(), be].filter(Boolean).join(" "),
656
+ ...xe,
657
+ children: [
658
+ /* @__PURE__ */ t(
659
+ We,
660
+ {
661
+ title: Ne,
662
+ icon: /* @__PURE__ */ t(qe, { "aria-hidden": "true" }),
663
+ headingId: l ? void 0 : j,
664
+ divider: !0
665
+ }
666
+ ),
667
+ /* @__PURE__ */ t("span", { role: "status", className: "ds:sr-only", children: hn }),
668
+ L ? /* @__PURE__ */ t("div", { className: "ds:shrink-0 ds:px-[var(--spacing-md)] ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(V, { variant: "warning", announce: "polite", "data-comms-limit": "", children: /* @__PURE__ */ t(V.Description, { children: s("communicationsPanel.limitReached") }) }) }) : null,
669
+ F,
670
+ !N && i === "ready" ? /* @__PURE__ */ f(
671
+ "div",
672
+ {
673
+ "data-comms-composer": "",
674
+ className: "ds:@container ds:flex ds:shrink-0 ds:flex-col ds:gap-[var(--spacing-sm)] ds:border-t ds:border-[color:var(--border)] ds:bg-[color:var(--card)] ds:p-[var(--spacing-md)]",
675
+ children: [
676
+ Q && z.length > 0 ? /* @__PURE__ */ t(
677
+ "p",
678
+ {
679
+ "data-comms-blocked": "",
680
+ className: "ds:m-0 type-body-sm ds:font-semibold ds:text-[color:var(--foreground)]",
681
+ children: s("communicationsPanel.noChannelsTitle")
682
+ }
683
+ ) : null,
684
+ Ae.length > 0 ? /* @__PURE__ */ t("ul", { className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-xs)] ds:p-0", children: Ae.map((e) => /* @__PURE__ */ f(
685
+ "li",
686
+ {
687
+ "data-comms-disabled": e,
688
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-xs)] type-meta ds:text-[color:var(--muted-foreground)]",
689
+ children: [
690
+ /* @__PURE__ */ f("span", { className: "ds:inline-flex ds:min-w-0 ds:flex-1 ds:items-center ds:gap-[var(--spacing-xs)]", children: [
691
+ /* @__PURE__ */ t("span", { className: "ds:inline-flex ds:shrink-0 ds:[&_svg]:size-4", children: /* @__PURE__ */ t(he, { channel: e }) }),
692
+ /* @__PURE__ */ t("span", { className: "ds:[overflow-wrap:anywhere]", children: s(qn[e]) })
693
+ ] }),
694
+ ye ? /* @__PURE__ */ t(
695
+ q,
696
+ {
697
+ type: "button",
698
+ size: "sm",
699
+ intent: "outline",
700
+ "data-comms-enable": e,
701
+ onClick: () => ye(e),
702
+ children: s("communicationsPanel.enableChannel", {
703
+ channel: s(ue[e])
704
+ })
705
+ }
706
+ ) : null
707
+ ]
708
+ },
709
+ e
710
+ )) }) : null,
711
+ v ? /* @__PURE__ */ f(vn, { children: [
712
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:@[320px]:flex-row ds:@[320px]:items-center ds:@[320px]:gap-[var(--spacing-sm)]", children: [
713
+ /* @__PURE__ */ t(
714
+ Mn,
715
+ {
716
+ size: "md",
717
+ value: v,
718
+ options: fn,
719
+ "aria-label": s("communicationsPanel.channelLabel"),
720
+ adornmentInTrigger: !0,
721
+ className: "ds:w-full ds:@[320px]:w-44",
722
+ onValueChange: (e) => {
723
+ e && (Me(e), U(!1));
724
+ }
725
+ }
726
+ ),
727
+ Ye ? /* @__PURE__ */ t(
728
+ "span",
729
+ {
730
+ dir: "auto",
731
+ className: "type-meta ds:min-w-0 ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere]",
732
+ children: s("communicationsPanel.toRecipient", { recipient: Ye })
733
+ }
734
+ ) : null
735
+ ] }),
736
+ _e ? /* @__PURE__ */ t(V, { variant: "error", "data-comms-send-error": "", children: /* @__PURE__ */ t(V.Description, { children: _e }) }) : null,
737
+ /* @__PURE__ */ t(
738
+ Nn,
739
+ {
740
+ id: sn,
741
+ value: H,
742
+ submitOnEnter: !1,
743
+ minRows: 2,
744
+ maxRows: 6,
745
+ submitDisabled: P || De,
746
+ onKeyDown: (e) => {
747
+ e.key === "Enter" && (e.ctrlKey || e.metaKey) && e.preventDefault();
748
+ },
749
+ label: s("communicationsPanel.composerLabel"),
750
+ placeholder: s("communicationsPanel.placeholder"),
751
+ "aria-describedby": gn,
752
+ "aria-invalid": P || void 0,
753
+ onChange: (e) => {
754
+ ee(e.target.value), G(!1), U(!1);
755
+ },
756
+ onSubmit: dn
757
+ }
758
+ ),
759
+ se ? /* @__PURE__ */ t(
760
+ "p",
761
+ {
762
+ id: Pe,
763
+ className: "ds:m-0 type-meta ds:text-[color:var(--muted-foreground)]",
764
+ children: s("communicationsPanel.emptyDraft")
765
+ }
766
+ ) : null,
767
+ d ? /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
768
+ /* @__PURE__ */ f(
769
+ "p",
770
+ {
771
+ id: ke,
772
+ "data-comms-meter": P ? "over" : ae ? "near" : "ok",
773
+ className: [
774
+ "ds:m-0 ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)] type-meta ds:tabular-nums",
775
+ P ? "ds:text-[color:var(--destructive)]" : ae ? "ds:text-[color:var(--warning-foreground)]" : "ds:text-[color:var(--muted-foreground)]"
776
+ ].join(" "),
777
+ children: [
778
+ P ? /* @__PURE__ */ t(
779
+ Qe,
780
+ {
781
+ "aria-hidden": "true",
782
+ className: "ds:size-3.5 ds:shrink-0"
783
+ }
784
+ ) : ae ? /* @__PURE__ */ t(
785
+ Oe,
786
+ {
787
+ "aria-hidden": "true",
788
+ className: "ds:size-3.5 ds:shrink-0"
789
+ }
790
+ ) : null,
791
+ s("communicationsPanel.smsCount", {
792
+ count: d.chars,
793
+ chars: d.chars,
794
+ parts: d.parts
795
+ })
796
+ ]
797
+ }
798
+ ),
799
+ P ? /* @__PURE__ */ t(
800
+ "p",
801
+ {
802
+ id: Se,
803
+ className: "ds:m-0 type-meta ds:text-[color:var(--destructive)]",
804
+ children: s("communicationsPanel.smsTooLong", { max: d.max })
805
+ }
806
+ ) : null,
807
+ /* @__PURE__ */ t(
808
+ "p",
809
+ {
810
+ id: Te,
811
+ className: "ds:m-0 type-meta ds:text-[color:var(--muted-foreground)] ds:[overflow-wrap:anywhere]",
812
+ children: s("communicationsPanel.senderNote", {
813
+ sender: S
814
+ })
815
+ }
816
+ )
817
+ ] }) : null
818
+ ] }) : null,
819
+ y === "ready" || y === "off" ? /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
820
+ q,
821
+ {
822
+ type: "button",
823
+ size: "sm",
824
+ intent: "outline",
825
+ startIcon: /* @__PURE__ */ t(me, { "aria-hidden": "true" }),
826
+ "data-comms-whatsapp": y,
827
+ onClick: y === "ready" ? en : nn,
828
+ children: s(y === "ready" ? "communicationsPanel.whatsApp" : "communicationsPanel.whatsAppBuy")
829
+ }
830
+ ) }) : Ge ? /* @__PURE__ */ f(
831
+ "p",
832
+ {
833
+ "data-comms-whatsapp": y,
834
+ className: "ds:m-0 ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-meta ds:text-[color:var(--muted-foreground)]",
835
+ children: [
836
+ /* @__PURE__ */ t(
837
+ me,
838
+ {
839
+ "aria-hidden": "true",
840
+ className: "ds:size-4 ds:shrink-0"
841
+ }
842
+ ),
843
+ Ge
844
+ ]
845
+ }
846
+ ) : null
847
+ ]
848
+ }
849
+ ) : null
850
+ ]
851
+ }
852
+ );
853
+ }
854
+ );
855
+ nt.displayName = "CommunicationsPanel";
856
+ function tt({
857
+ message: n,
858
+ senderName: c,
859
+ lang: l,
860
+ showNew: g,
861
+ onOpenProvenance: w,
862
+ onOpenAttachment: m
863
+ }) {
864
+ const { t: i } = Je("ui"), M = i(ue[n.channel]), A = D(() => {
865
+ const R = new Date(n.createdAtIso);
866
+ return Number.isNaN(R.getTime()) ? "" : new Intl.DateTimeFormat(l, {
867
+ dateStyle: "medium",
868
+ timeStyle: "short"
869
+ }).format(R);
870
+ }, [n.createdAtIso, l]), x = n.direction === "out", S = i(
871
+ x ? "communicationsPanel.messageFromPractice" : "communicationsPanel.messageFromPatient",
872
+ { channel: M, time: A }
873
+ ), h = n.provenance, y = h ? h.kind === "document-share" ? i("communicationsPanel.provenanceDocument") : i(
874
+ h.kind === "campaign" ? "communicationsPanel.provenanceCampaign" : "communicationsPanel.provenanceWorkflow",
875
+ { name: h.name ?? "" }
876
+ ) : "", r = h ? h.kind === "campaign" ? /* @__PURE__ */ t(In, { "aria-hidden": "true" }) : h.kind === "workflow" ? /* @__PURE__ */ t($n, { "aria-hidden": "true" }) : /* @__PURE__ */ t(le, { "aria-hidden": "true" }) : null, N = /* @__PURE__ */ f("div", { className: "ds:flex ds:min-w-0 ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
877
+ /* @__PURE__ */ t(
878
+ W,
879
+ {
880
+ variant: "neutral",
881
+ size: "md",
882
+ leading: /* @__PURE__ */ t(he, { channel: n.channel }),
883
+ children: n.recipient ? i("communicationsPanel.viaTo", {
884
+ channel: M,
885
+ recipient: n.recipient
886
+ }) : i("communicationsPanel.via", { channel: M })
887
+ }
888
+ ),
889
+ x && n.channel === "sms" && n.smsStatus ? /* @__PURE__ */ t(
890
+ W,
891
+ {
892
+ variant: Jn[n.smsStatus],
893
+ size: "md",
894
+ leading: Qn[n.smsStatus],
895
+ "data-sms-status": n.smsStatus,
896
+ children: i(Zn[n.smsStatus])
897
+ }
898
+ ) : null,
899
+ g ? /* @__PURE__ */ t(W, { variant: "brand", size: "md", "data-comms-new": "", children: i("communicationsPanel.newMessages") }) : null,
900
+ h ? w ? /* @__PURE__ */ t(
901
+ q,
902
+ {
903
+ type: "button",
904
+ size: "sm",
905
+ intent: "ghost",
906
+ startIcon: r,
907
+ "data-comms-provenance": h.kind,
908
+ onClick: () => w(h.kind, h.id),
909
+ children: y
910
+ }
911
+ ) : /* @__PURE__ */ t(
912
+ W,
913
+ {
914
+ variant: "info",
915
+ size: "md",
916
+ leading: r,
917
+ "data-comms-provenance": h.kind,
918
+ children: y
919
+ }
920
+ ) : null
921
+ ] });
922
+ return /* @__PURE__ */ t(
923
+ Cn,
924
+ {
925
+ role: x ? "user" : "assistant",
926
+ content: n.body,
927
+ timestamp: n.createdAtIso,
928
+ avatar: x ? { name: c } : void 0,
929
+ "aria-label": S,
930
+ "data-message-id": n.id,
931
+ "data-direction": n.direction,
932
+ "data-channel": n.channel,
933
+ body: /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
934
+ n.bodyHtml && n.channel !== "sms" ? /* @__PURE__ */ t(Pn, { html: n.bodyHtml, profile: "email" }) : /* @__PURE__ */ t("span", { className: "ds:whitespace-pre-wrap", children: n.body }),
935
+ n.attachment ? m ? /* @__PURE__ */ t(
936
+ q,
937
+ {
938
+ type: "button",
939
+ size: "sm",
940
+ intent: "outline",
941
+ startIcon: /* @__PURE__ */ t(le, { "aria-hidden": "true" }),
942
+ "data-comms-attachment": n.attachment.id,
943
+ onClick: () => m(n.attachment.id),
944
+ children: n.attachment.name
945
+ }
946
+ ) : /* @__PURE__ */ f(
947
+ "span",
948
+ {
949
+ "data-comms-attachment": n.attachment.id,
950
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm",
951
+ children: [
952
+ /* @__PURE__ */ t(
953
+ le,
954
+ {
955
+ "aria-hidden": "true",
956
+ className: "ds:size-4 ds:shrink-0"
957
+ }
958
+ ),
959
+ n.attachment.name
960
+ ]
961
+ }
962
+ ) : null
963
+ ] }),
964
+ actions: N
965
+ }
966
+ );
967
+ }
968
+ export {
969
+ nt as C,
970
+ Wn as c,
971
+ de as s
972
+ };
973
+ //# sourceMappingURL=communications-panel-BKPHCiMB.js.map