@alfadocs/ui-kit 1.136.0 → 1.138.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 (131) hide show
  1. package/dist/_chunks/{appointment-card-BT1cMZIX.js → appointment-card-CaxFXtSn.js} +196 -184
  2. package/dist/_chunks/appointment-details-panel.history-DrIMDQYf.js +314 -0
  3. package/dist/_chunks/appointment-details-panel.identity-C20Y9xNC.js +223 -0
  4. package/dist/_chunks/{appointment-timeline-Dy4YQJ17.js → appointment-timeline-BEwgbYyG.js} +113 -110
  5. package/dist/_chunks/{appointment-tray-B3gSHL1j.js → appointment-tray-DPpeR9JT.js} +8 -8
  6. package/dist/_chunks/calendar-appointment-editor-dialog-SxSkOTnO.js +5519 -0
  7. package/dist/_chunks/calendar-editor-discard-host-DjUhoFr2.js +1336 -0
  8. package/dist/_chunks/calendar-editor-guard-9fShhNIA.js +31 -0
  9. package/dist/_chunks/calendar-waiting-list-panel-331vzAdl.js +981 -0
  10. package/dist/_chunks/calendar-workspace.model-B8yPwuBv.js +1557 -0
  11. package/dist/_chunks/calendar.sheets-aodjllWd.js +4585 -0
  12. package/dist/_chunks/color-picker-CC8ZfntU.js +582 -0
  13. package/dist/_chunks/{document-preview-DWlejd8A.js → document-preview-CirR3C_m.js} +2 -2
  14. package/dist/_chunks/{fiscal-code-input-BBvU7sAo.js → fiscal-code-input-DZlpaMGg.js} +2 -2
  15. package/dist/_chunks/{iban-input-DuTwKok5.js → iban-input-CdSLRzQN.js} +2 -2
  16. package/dist/_chunks/list-todo-KWvUhmT_.js +33 -0
  17. package/dist/_chunks/{notes-panel-BvjAo4RQ.js → notes-panel-DsEKNtsw.js} +2 -2
  18. package/dist/_chunks/palettes-CKVXYTzo.js +172 -0
  19. package/dist/_chunks/{patient-account-settings-Bmfeclpd.js → patient-account-settings-Cs9y-pVA.js} +3 -3
  20. package/dist/_chunks/{patient-check-in-resume-CYZ-SvsF.js → patient-check-in-resume-4qi_klQV.js} +5 -5
  21. package/dist/_chunks/{patient-details-9eh9cNy7.js → patient-details-Dv7EiTCo.js} +2 -2
  22. package/dist/_chunks/{patient-field-row-B782eT0C.js → patient-field-row-DuHWGlLz.js} +2 -2
  23. package/dist/_chunks/patient-picker-BZJuOgMw.js +173 -0
  24. package/dist/_chunks/{patient-summary-card-K9zaMl1O.js → patient-summary-card-D-cDzOim.js} +2 -2
  25. package/dist/_chunks/{portal-details-DCIiGkHA.js → portal-details-BGc_FLQk.js} +3 -3
  26. package/dist/_chunks/{portal-documents-DVKj6Sco.js → portal-documents-BSI1U5lI.js} +3 -3
  27. package/dist/_chunks/{portal-parts-Br8wuala.js → portal-parts-C99CreYO.js} +2 -2
  28. package/dist/_chunks/{privacy-mask-C19dJFMk.js → privacy-mask-C2ZLKrMh.js} +5 -5
  29. package/dist/_chunks/{rich-text-editor-DjHL1b3E.js → rich-text-editor-C48omVjq.js} +2 -2
  30. package/dist/_chunks/task-editor-wKbFbGqW.js +1093 -0
  31. package/dist/_chunks/use-appointment-details-read-jGkJalX8.js +1966 -0
  32. package/dist/agent-catalog.json +2 -2
  33. package/dist/appointment-editor-panel/index.js +100 -0
  34. package/dist/booking-tools-data/index.js +82 -0
  35. package/dist/browser-support.js +1 -1
  36. package/dist/calendar-action-buttons/index.js +178 -0
  37. package/dist/components/appointment-card/appointment-card.d.ts +5 -2
  38. package/dist/components/appointment-card/index.js +2 -2
  39. package/dist/components/appointment-details-panel/index.js +6 -5
  40. package/dist/components/appointment-timeline/appointment-timeline.d.ts +6 -0
  41. package/dist/components/appointment-timeline/index.js +1 -1
  42. package/dist/components/color-picker/index.js +5 -4
  43. package/dist/components/document-preview/index.js +1 -1
  44. package/dist/components/fiscal-code-input/index.js +1 -1
  45. package/dist/components/iban-input/index.js +1 -1
  46. package/dist/components/notes-panel/index.js +1 -1
  47. package/dist/components/patient-details/index.js +1 -1
  48. package/dist/components/patient-summary-card/index.js +1 -1
  49. package/dist/components/rich-text-editor/index.js +1 -1
  50. package/dist/components/task-editor/index.js +1 -1
  51. package/dist/core.css +1 -1
  52. package/dist/find-free-slots-panel/index.js +58 -0
  53. package/dist/host-legacy.css +16 -0
  54. package/dist/i18n/locales/ar.d.ts +0 -1
  55. package/dist/i18n/locales/ar.js +0 -1
  56. package/dist/i18n/locales/de.d.ts +0 -1
  57. package/dist/i18n/locales/de.js +0 -1
  58. package/dist/i18n/locales/el.d.ts +0 -1
  59. package/dist/i18n/locales/el.js +0 -1
  60. package/dist/i18n/locales/en.d.ts +0 -1
  61. package/dist/i18n/locales/en.js +0 -1
  62. package/dist/i18n/locales/es.d.ts +0 -1
  63. package/dist/i18n/locales/es.js +0 -1
  64. package/dist/i18n/locales/fr.d.ts +0 -1
  65. package/dist/i18n/locales/fr.js +0 -1
  66. package/dist/i18n/locales/hi.d.ts +0 -1
  67. package/dist/i18n/locales/hi.js +0 -1
  68. package/dist/i18n/locales/it.d.ts +0 -1
  69. package/dist/i18n/locales/it.js +0 -1
  70. package/dist/i18n/locales/ja.d.ts +0 -1
  71. package/dist/i18n/locales/ja.js +0 -1
  72. package/dist/i18n/locales/nl.d.ts +0 -1
  73. package/dist/i18n/locales/nl.js +0 -1
  74. package/dist/i18n/locales/pl.d.ts +0 -1
  75. package/dist/i18n/locales/pl.js +0 -1
  76. package/dist/i18n/locales/pt.d.ts +0 -1
  77. package/dist/i18n/locales/pt.js +0 -1
  78. package/dist/i18n/locales/ro.d.ts +0 -1
  79. package/dist/i18n/locales/ro.js +0 -1
  80. package/dist/i18n/locales/ru.d.ts +0 -1
  81. package/dist/i18n/locales/ru.js +0 -1
  82. package/dist/i18n/locales/sq.d.ts +0 -1
  83. package/dist/i18n/locales/sq.js +0 -1
  84. package/dist/i18n/locales/sv.d.ts +0 -1
  85. package/dist/i18n/locales/sv.js +0 -1
  86. package/dist/i18n/locales/tr.d.ts +0 -1
  87. package/dist/i18n/locales/tr.js +0 -1
  88. package/dist/i18n/locales/zh.d.ts +0 -1
  89. package/dist/i18n/locales/zh.js +0 -1
  90. package/dist/index.js +1328 -1322
  91. package/dist/locales/ar.json +0 -1
  92. package/dist/locales/de.json +0 -1
  93. package/dist/locales/el.json +0 -1
  94. package/dist/locales/en.json +0 -1
  95. package/dist/locales/es.json +0 -1
  96. package/dist/locales/fr.json +0 -1
  97. package/dist/locales/hi.json +0 -1
  98. package/dist/locales/it.json +0 -1
  99. package/dist/locales/ja.json +0 -1
  100. package/dist/locales/nl.json +0 -1
  101. package/dist/locales/pl.json +0 -1
  102. package/dist/locales/pt.json +0 -1
  103. package/dist/locales/ro.json +0 -1
  104. package/dist/locales/ru.json +0 -1
  105. package/dist/locales/sq.json +0 -1
  106. package/dist/locales/sv.json +0 -1
  107. package/dist/locales/tr.json +0 -1
  108. package/dist/locales/zh.json +0 -1
  109. package/dist/online-bookings-panel/index.js +69 -0
  110. package/dist/patterns/calendar/booking-tools/appointment-editor-panel.d.ts +46 -0
  111. package/dist/patterns/calendar/booking-tools/booking-tools-data.d.ts +48 -0
  112. package/dist/patterns/calendar/booking-tools/calendar-action-buttons.d.ts +55 -0
  113. package/dist/patterns/calendar/booking-tools/find-free-slots-panel.d.ts +35 -0
  114. package/dist/patterns/calendar/booking-tools/online-bookings-panel.d.ts +61 -0
  115. package/dist/patterns/calendar/booking-tools/waiting-list-panel.d.ts +58 -0
  116. package/dist/patterns/calendar/calendar-editor-discard-host.d.ts +20 -0
  117. package/dist/patterns/calendar/calendar-print-sheet.d.ts +16 -0
  118. package/dist/patterns/calendar/calendar-workspace.model.d.ts +7 -0
  119. package/dist/patterns/calendar/calendar.model.d.ts +9 -0
  120. package/dist/patterns/calendar/calendar.sheets.d.ts +59 -17
  121. package/dist/patterns/calendar/index.js +24 -20
  122. package/dist/patterns/patient-account-settings/index.js +1 -1
  123. package/dist/patterns/patient-check-in/index.js +1 -1
  124. package/dist/patterns/patient-portal/index.js +2 -2
  125. package/dist/tokens.css +1 -1
  126. package/dist/waiting-list-panel/index.js +158 -0
  127. package/package.json +27 -2
  128. package/dist/_chunks/calendar-appointment-editor-dialog-CB4cQOtc.js +0 -13773
  129. package/dist/_chunks/color-picker-AcaWuKah.js +0 -745
  130. package/dist/_chunks/task-editor-BfXSn6U1.js +0 -1257
  131. package/dist/_chunks/use-appointment-details-read-7J0j1FP7.js +0 -2476
@@ -1,2476 +0,0 @@
1
- import { jsx as e, jsxs as h, Fragment as ie } from "react/jsx-runtime";
2
- import { c as vt } from "./index-D2ZczOXr.js";
3
- import { useId as ot, useRef as _, forwardRef as ln, useEffect as xe, useMemo as Mt, useState as H, useCallback as cn } from "react";
4
- import { useTranslation as B } from "react-i18next";
5
- import { u as un } from "./registry-DvAUVLHh.js";
6
- import { u as me } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
7
- import { c as mn } from "./compose-refs-C0k0tdqF.js";
8
- import { g as dt } from "./get-error-message-DbFUzuja.js";
9
- import { h as at } from "./handled-rejection-C-6Dq0As.js";
10
- import { b as pn, P as Lt } from "./privacy-mask-C19dJFMk.js";
11
- import { A as $ } from "./alert-C4WKViaS.js";
12
- import { B as L } from "./button-DohK_Ak_.js";
13
- import { I as Yt } from "./icon-button-S8_weU3g.js";
14
- import { B as fn } from "./button-group-DuQuuulC.js";
15
- import { D as qe } from "./dropdown-menu-DBWaW4pq.js";
16
- import { E as Gt } from "./editable-description-KU56SP4P.js";
17
- import { N as lt } from "./note-timeline-BbjHMhkL.js";
18
- import { P as Vt } from "./panel-header-CbtlTe85.js";
19
- import { P as it } from "./panel-subview-DCyvn-49.js";
20
- import { P as Xt } from "./patient-summary-card-K9zaMl1O.js";
21
- import { S as pe } from "./section-card-CYfeQ6EQ.js";
22
- import { C as hn, S as we } from "./skeleton-tTWJpvAq.js";
23
- import { T as gn } from "./text-area-COMVJ1yE.js";
24
- import { T as vn } from "./tooltip-uEBdD1-5.js";
25
- import { T as Qt } from "./treatment-receipt-BZzwvsnY.js";
26
- import { a as st } from "./whatsapp-button-XbozeDl_.js";
27
- import { a as Jt, W as yn } from "./workflow-status-CO0mxXs2.js";
28
- import { u as yt, a as Ot, i as bn } from "./appointment-workflow-status-S-lx81Yz.js";
29
- import { E as kn } from "./empty-state-DwJ5YNzz.js";
30
- import { T as Oe } from "./timeline-DXko0M1t.js";
31
- import { C as bt } from "./calendar-clock-hbObjfGY.js";
32
- import { T as Zt } from "./trash-2-uumy3fy1.js";
33
- import { A as rt } from "./entity-card-p-LANpYt.js";
34
- import { C as wn } from "./calendar-plus-BFrIRE4r.js";
35
- import { P as Ne } from "./pencil-B1sKKyuT.js";
36
- import { C as ct } from "./clock-Drd4Wtis.js";
37
- import { c as Ve } from "./createLucideIcon-DhHxpK9K.js";
38
- import { A as Nn } from "./arrow-right-KsIrLdt0.js";
39
- import { A as ut } from "./avatar-Dp5apm1d.js";
40
- import { B as Xe } from "./badge-BUk4RjTS.js";
41
- import { H as kt } from "./heart-pulse-BCppJyN2.js";
42
- import { G as xn } from "./globe-sHBW1JN5.js";
43
- import { T as Sn } from "./triangle-alert-CBnO6nq_.js";
44
- import { E as In } from "./euro-Dsuz4ixO.js";
45
- import { V as wt } from "./video-BheNGvsu.js";
46
- import { R as en } from "./repeat-CvQa5rZt.js";
47
- import { C as An } from "./counter-WsvRuum1.js";
48
- import { D as je } from "./description-list-BxzDN9o2.js";
49
- import { T as _t } from "./timestamp-DPLDWdxA.js";
50
- import { T as Tn } from "./transaction-chip-CkYd-3ky.js";
51
- import { H as Se } from "./hover-card-CuRIA4wN.js";
52
- import { S as Ft } from "./smartphone-C0rFF2if.js";
53
- import { P as En } from "./phone-FceYcIFQ.js";
54
- import { M as Dn } from "./mail-BqXVF2zH.js";
55
- import { M as Cn } from "./map-pin-BaY37-Km.js";
56
- import { F as Rn } from "./file-pen-line-k4uMBM3h.js";
57
- import { C as Pn } from "./contact-round-DiSvB3LP.js";
58
- import { P as Mn } from "./pen-line-D0De5zdl.js";
59
- import { C as Ln } from "./credit-card-D9XZsHGA.js";
60
- import { R as On } from "./refresh-cw-DnI0cLFC.js";
61
- import { C as _n } from "./calendar-days-BGWklvE-.js";
62
- import { H as Fn } from "./hourglass-BEAzW1wE.js";
63
- import { A as zt } from "./armchair-BaLDW6Hz.js";
64
- import { B as zn } from "./building-2-D33bLCWL.js";
65
- import { N as Hn } from "./notebook-pen-CO7HoM-W.js";
66
- import { C as mt } from "./clipboard-list-rSzfIYZB.js";
67
- import { U as $n } from "./user-plus-BtcOLgNU.js";
68
- import { C as Bn } from "./copy-vRpqqHtY.js";
69
- import { P as Wn } from "./plus-DzMQ_c6b.js";
70
- import { S as Un } from "./square-check-big-dj0o8yA3.js";
71
- import { H as Ht } from "./history-CK2JaU2g.js";
72
- import { C as qn } from "./chevron-down-DWE7GSq9.js";
73
- import { C as jn } from "./camera-VSklPDCv.js";
74
- import { F as Kn } from "./file-BuG1VMAy.js";
75
- import { F as Yn } from "./file-text-5yv6r2ls.js";
76
- import { F as Gn } from "./folder-BghC8_S2.js";
77
- import { R as Vn } from "./receipt-euro-B1cLM_TN.js";
78
- /**
79
- * @license lucide-react v1.22.0 - ISC
80
- *
81
- * This source code is licensed under the ISC license.
82
- * See the LICENSE file in the root directory of this source tree.
83
- */
84
- const Xn = [
85
- ["path", { d: "M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8", key: "1w3rig" }],
86
- ["path", { d: "M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1", key: "n2jgmb" }],
87
- ["path", { d: "M2 21h20", key: "1nyx9w" }],
88
- ["path", { d: "M7 8v3", key: "1qtyvj" }],
89
- ["path", { d: "M12 8v3", key: "hwp4zt" }],
90
- ["path", { d: "M17 8v3", key: "1i6e5u" }],
91
- ["path", { d: "M7 4h.01", key: "1bh4kh" }],
92
- ["path", { d: "M12 4h.01", key: "1ujb9j" }],
93
- ["path", { d: "M17 4h.01", key: "1upcoc" }]
94
- ], Qn = Ve("cake", Xn);
95
- /**
96
- * @license lucide-react v1.22.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */
101
- const Jn = [
102
- ["path", { d: "M11 14h10", key: "1w8e9d" }],
103
- ["path", { d: "M16 4h2a2 2 0 0 1 2 2v1.344", key: "1e62lh" }],
104
- ["path", { d: "m17 18 4-4-4-4", key: "z2g111" }],
105
- ["path", { d: "M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113", key: "bjbb7m" }],
106
- ["rect", { x: "8", y: "2", width: "8", height: "4", rx: "1", key: "ublpy" }]
107
- ], $t = Ve("clipboard-paste", Jn);
108
- /**
109
- * @license lucide-react v1.22.0 - ISC
110
- *
111
- * This source code is licensed under the ISC license.
112
- * See the LICENSE file in the root directory of this source tree.
113
- */
114
- const Zn = [
115
- ["path", { d: "M16 10h2", key: "8sgtl7" }],
116
- ["path", { d: "M16 14h2", key: "epxaof" }],
117
- ["path", { d: "M6.17 15a3 3 0 0 1 5.66 0", key: "n6f512" }],
118
- ["circle", { cx: "9", cy: "11", r: "2", key: "yxgjnd" }],
119
- ["rect", { x: "2", y: "5", width: "20", height: "14", rx: "2", key: "qneu4z" }]
120
- ], ea = Ve("id-card", Zn);
121
- /**
122
- * @license lucide-react v1.22.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */
127
- const ta = [
128
- ["path", { d: "M12 2v20", key: "t6zp3m" }],
129
- ["path", { d: "m15 19-3 3-3-3", key: "11eu04" }],
130
- ["path", { d: "m19 9 3 3-3 3", key: "1mg7y2" }],
131
- ["path", { d: "M2 12h20", key: "9i4pu4" }],
132
- ["path", { d: "m5 9-3 3 3 3", key: "j64kie" }],
133
- ["path", { d: "m9 5 3-3 3 3", key: "l8vdw6" }]
134
- ], pt = Ve("move", ta), na = '[data-component="button-group"] [data-component="icon-button"][aria-haspopup="menu"]', aa = {
135
- id: "appointment-details-panel",
136
- // open and close back open_history and close_history; set_value backs
137
- // set_status.
138
- capabilities: ["open", "close", "set_value"],
139
- state: {
140
- eventId: {
141
- type: "string | null",
142
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.eventId",
143
- description: "The occurrence on screen or being read, as the host identifies it. After a failed or refused read, the occurrence it was for when the host says so. Null when there is none, or the host did not say.",
144
- read: (t) => t.getEventId()
145
- },
146
- loadStatus: {
147
- type: "'loading' | 'ready' | 'error' | 'refused'",
148
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.loadStatus",
149
- description: "Where the read is: loading, ready, failed (with Retry) or refused. Actions need ready.",
150
- read: (t) => t.getLoadStatus()
151
- },
152
- appointmentStatus: {
153
- type: "'confirmed' | 'waiting' | 'in_care' | 'done' | 'cancelled' | 'absent' | null",
154
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.appointmentStatus",
155
- description: "The appointment status as last saved here or read. Null when none is recorded or nothing is on screen.",
156
- read: (t) => t.getAppointmentStatus()
157
- },
158
- allowedStatuses: {
159
- type: "string[]",
160
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.allowedStatuses",
161
- description: "The statuses set_status accepts now, in menu order. Empty when the status is read-only.",
162
- read: (t) => t.getAllowedStatuses()
163
- },
164
- offeredActions: {
165
- type: "string[]",
166
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.offeredActions",
167
- description: "The footer actions on offer, as their data-action values (for example edit-appointment, delete-appointment), in footer order, including any folded into More.",
168
- read: (t) => t.getOfferedActions()
169
- },
170
- historyOpen: {
171
- type: "boolean",
172
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.historyOpen",
173
- description: "Whether the History sub-view covers the details.",
174
- read: (t) => t.isHistoryOpen()
175
- },
176
- privacy: {
177
- type: "boolean",
178
- descriptionKey: "ui.agent.appointmentDetailsPanel.state.privacy",
179
- description: "Whether privacy mode is on. The patient identity and personal fields are then masked on screen.",
180
- read: (t) => t.isPrivacy()
181
- }
182
- },
183
- actions: {
184
- open_history: {
185
- safety: "read",
186
- openWorld: !0,
187
- idempotent: !0,
188
- errors: ["No appointment is on screen, or History is not offered."],
189
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.openHistory",
190
- description: "Slide the appointment's history over the details, as its header button does; the host reads it then if it did not send it with the details. It lists who changed what, and when.",
191
- invoke: (t) => t.openHistory()
192
- },
193
- close_history: {
194
- safety: "read",
195
- idempotent: !0,
196
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.closeHistory",
197
- description: "Return from History to the details.",
198
- invoke: (t) => t.closeHistory()
199
- },
200
- set_status: {
201
- safety: "phi",
202
- openWorld: !0,
203
- idempotent: !0,
204
- argsType: "{ status: string }",
205
- argsSchema: {
206
- type: "object",
207
- properties: {
208
- status: {
209
- type: "string",
210
- enum: [
211
- "confirmed",
212
- "waiting",
213
- "in_care",
214
- "done",
215
- "cancelled",
216
- "absent"
217
- ]
218
- }
219
- },
220
- required: ["status"]
221
- },
222
- errors: [
223
- "The status is read-only: no appointment on screen, no host save, readOnly, or no allowed statuses.",
224
- "The status is not in allowedStatuses.",
225
- "A status save is already in flight.",
226
- "The host refused the change. The previous status stays and the panel shows the message."
227
- ],
228
- examples: [{ args: { status: "waiting" } }],
229
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.setStatus",
230
- description: "Save a new appointment status through the host, as the footer control does. Resolves once the host has saved it.",
231
- invoke: (t, n) => t.setAppointmentStatus(
232
- n.status
233
- )
234
- },
235
- retry: {
236
- safety: "read",
237
- openWorld: !0,
238
- errors: [
239
- "Retry is not offered: the read has not failed or been refused as retryable, or the host offers no Retry."
240
- ],
241
- descriptionKey: "ui.agent.appointmentDetailsPanel.actions.retry",
242
- description: "Ask the host to read the appointment again, after a failed read or a refusal it marked retryable.",
243
- invoke: (t) => t.retry()
244
- }
245
- },
246
- domHooks: {
247
- root: {
248
- attr: "data-component",
249
- value: "appointment-details-panel",
250
- description: `Marks the panel. It also carries data-event-id and data-status. Inside, cards carry data-card (patient, appointment, notes, treatments), footer actions data-action, and the History and description sub-views data-details-subview. An action in offeredActions with no data-action in the footer strip is folded into More: click the panel's ${na}, and its menu item carries the same data-action.`
251
- },
252
- instanceId: {
253
- attr: "data-component-id",
254
- sourceProp: "id",
255
- description: "Sourced from the id prop, or generated."
256
- }
257
- }
258
- };
259
- function ft(t) {
260
- const n = document.activeElement;
261
- n && n !== document.body || t == null || t.focus({ preventScroll: !0 });
262
- }
263
- function _e(t) {
264
- const n = document.getElementById(t);
265
- n && !n.hasAttribute("tabindex") && (n.tabIndex = -1), ft(n);
266
- }
267
- const ue = {
268
- advancedSignature: "setup-advanced-signature",
269
- requestSignature: "request-signature",
270
- signOnDevice: "sign-on-device",
271
- openPatient: "open-patient",
272
- renewAnamnesis: "renew-anamnesis",
273
- unlockPayments: "unlock-payments",
274
- carePlan: "open-care-plan"
275
- };
276
- function Ke(t) {
277
- if (t)
278
- try {
279
- const { protocol: n } = new URL(t, "https://host.invalid");
280
- return n === "http:" || n === "https:" ? t : void 0;
281
- } catch {
282
- return;
283
- }
284
- }
285
- function Fe(t) {
286
- return typeof t == "string" && /^\d{4}-\d{2}-\d{2}$/.test(t) ? /* @__PURE__ */ new Date(`${t}T00:00:00`) : new Date(t);
287
- }
288
- function Ge(t, n) {
289
- try {
290
- return new Intl.DateTimeFormat(t, {
291
- weekday: "long",
292
- day: "numeric",
293
- month: "long",
294
- year: "numeric"
295
- }).format(Fe(n));
296
- } catch {
297
- return "";
298
- }
299
- }
300
- function ia(t, n, i) {
301
- const o = new Date(n), s = i ? new Date(i) : o;
302
- try {
303
- const d = new Intl.DateTimeFormat(t, {
304
- hour: "2-digit",
305
- minute: "2-digit",
306
- hour12: !1
307
- });
308
- return typeof d.formatRange == "function" ? d.formatRange(o, s) : `${d.format(o)} – ${d.format(s)}`;
309
- } catch {
310
- return "";
311
- }
312
- }
313
- const ht = {
314
- weekday: "short",
315
- day: "numeric",
316
- month: "short",
317
- hour: "2-digit",
318
- minute: "2-digit"
319
- };
320
- function sa(t, n) {
321
- const i = Fe(t), o = Fe(n);
322
- let s = o.getFullYear() - i.getFullYear();
323
- const d = o.getMonth() - i.getMonth();
324
- return (d < 0 || d === 0 && o.getDate() < i.getDate()) && (s -= 1), Math.max(0, s);
325
- }
326
- const ra = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/;
327
- function oa(t) {
328
- const n = typeof t == "string" ? ra.exec(t) : null;
329
- if (!n) return;
330
- const [i, o, s, d, p, f] = n.slice(1).map(Number), c = /* @__PURE__ */ new Date(0);
331
- if (c.setFullYear(i, o, 0), o < 1 || o > 12 || s < 1 || s > c.getDate() || d > 23 || p > 59 || f > 59)
332
- return;
333
- const r = /* @__PURE__ */ new Date(0);
334
- return r.setFullYear(i, o - 1, s), r.setHours(d, p, f, 0), r;
335
- }
336
- function da(t) {
337
- return t.map((n) => {
338
- const i = Date.parse(n.atIso);
339
- return { entry: n, time: Number.isFinite(i) ? i : -1 / 0 };
340
- }).sort((n, i) => n.time === i.time ? 0 : i.time - n.time).map(({ entry: n }) => n);
341
- }
342
- const la = {
343
- daily: "recurrenceDaily",
344
- weekly: "recurrenceWeekly",
345
- monthly: "recurrenceMonthly",
346
- quarterly: "recurrenceQuarterly",
347
- semiannual: "recurrenceSemiannual",
348
- yearly: "recurrenceYearly"
349
- };
350
- function ca(t) {
351
- return t.phones ? t.phones : t.phone ? [{ label: "mobile", number: t.phone }] : [];
352
- }
353
- function tn(t) {
354
- return [t.address, t.postalCode, t.city].filter((n) => !!n).join(", ");
355
- }
356
- function ua(t) {
357
- return [t.address, t.city].filter((n) => !!n).join(", ");
358
- }
359
- function ma(t) {
360
- const n = tn(t);
361
- return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(n)}`;
362
- }
363
- const P = (t) => `calendarWorkspace.details.${t}`, pa = /* @__PURE__ */ new Set(["patient", "care"]), Bt = /^#?(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i, fa = (t) => {
364
- switch (t.field) {
365
- case "time":
366
- return !!(t.fromIso || t.toIso);
367
- case "duration":
368
- return t.fromMin !== void 0 || t.toMin !== void 0;
369
- default:
370
- return !!(t.from || t.to);
371
- }
372
- };
373
- function ha(t) {
374
- const n = t.kind === "moved" ? [{ field: "time", fromIso: t.fromIso, toIso: t.toIso }] : t.kind === "resized" ? [{ field: "duration", fromMin: t.fromMin, toMin: t.toMin }] : t.kind === "status" ? [{ field: "status", from: t.from, to: t.to }] : [], i = ("changes" in t ? t.changes ?? [] : []).filter(
375
- fa
376
- ), o = new Set(n.map((s) => s.field));
377
- return [
378
- ...n,
379
- ...i.filter((s) => o.has(s.field) ? !1 : (o.add(s.field), !0))
380
- ];
381
- }
382
- const ga = (t, n) => t.getFullYear() === n.getFullYear() && t.getMonth() === n.getMonth() && t.getDate() === n.getDate();
383
- function va({
384
- history: t,
385
- locale: n,
386
- noteUnrecordedEdits: i = !1,
387
- privacy: o = !1
388
- }) {
389
- const { t: s, i18n: d } = B("ui"), { optionFor: p } = yt(null), f = n ?? d.language, c = (a, m) => {
390
- try {
391
- return new Intl.DateTimeFormat(f, m).format(
392
- new Date(a)
393
- );
394
- } catch {
395
- return a;
396
- }
397
- }, r = (a) => c(a, ht), l = s(P("history.notSet")), g = (a) => {
398
- switch (a.field) {
399
- case "status":
400
- return {
401
- from: a.from && p(a.from).label,
402
- to: a.to && p(a.to).label
403
- };
404
- case "time": {
405
- const m = a.fromIso && new Date(a.fromIso), k = a.toIso && new Date(a.toIso), b = m && k && ga(m, k) ? c(a.toIso, {
406
- hour: "2-digit",
407
- minute: "2-digit"
408
- }) : void 0;
409
- return {
410
- from: a.fromIso && r(a.fromIso),
411
- to: b ?? (a.toIso && r(a.toIso))
412
- };
413
- }
414
- case "duration":
415
- return {
416
- from: a.fromMin === void 0 ? void 0 : s(P("history.minutes"), { n: a.fromMin }),
417
- to: a.toMin === void 0 ? void 0 : s(P("history.minutes"), { n: a.toMin })
418
- };
419
- default:
420
- return { from: a.from || void 0, to: a.to || void 0 };
421
- }
422
- }, w = (a) => {
423
- const m = s(P(`history.fields.${a.field}`)), { from: k, to: b } = g(a);
424
- return a.field === "colour" && [k, b].some((A) => A && Bt.test(A)) ? s(P("history.changed.colour")) : k && !b ? s(P("history.changeCleared"), { field: m, from: k }) : !k && b ? s(P("history.changeSet"), { field: m, to: b }) : s(P("history.changeFromTo"), {
425
- field: m,
426
- from: k ?? l,
427
- to: b ?? l
428
- });
429
- }, v = (a) => {
430
- const m = (T, S) => T && a.field === "colour" && Bt.test(T) ? /* @__PURE__ */ e(
431
- "span",
432
- {
433
- className: "ds:inline-block ds:size-4 ds:shrink-0 ds:rounded-[var(--radius-full)] ds:border ds:border-[color:var(--border)] ds:[background-color:var(--history-swatch)] ds:forced-colors:[forced-color-adjust:none]",
434
- style: {
435
- "--history-swatch": T.startsWith("#") ? T : `#${T}`
436
- }
437
- }
438
- ) : T ? /* @__PURE__ */ e(
439
- "span",
440
- {
441
- className: S ? "ds:min-w-0 ds:font-[var(--font-weight-medium)] ds:text-[color:var(--foreground)]" : "ds:min-w-0 ds:text-[color:var(--muted-foreground)]",
442
- children: T
443
- }
444
- ) : /* @__PURE__ */ e("span", { className: "ds:min-w-0 ds:text-[color:var(--muted-foreground)]", children: l }), k = (T) => T ? /* @__PURE__ */ e(
445
- Jt,
446
- {
447
- value: T,
448
- option: p(T),
449
- size: "sm"
450
- }
451
- ) : m(void 0, !1), { from: b, to: A } = g(a);
452
- return /* @__PURE__ */ h("div", { className: "ds:min-w-0", "data-history-change": a.field, children: [
453
- /* @__PURE__ */ e("span", { className: "ds:sr-only", children: w(a) }),
454
- /* @__PURE__ */ h(
455
- "div",
456
- {
457
- "aria-hidden": "true",
458
- className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
459
- children: [
460
- a.field === "status" ? k(a.from) : m(b, !1),
461
- /* @__PURE__ */ e(
462
- Nn,
463
- {
464
- className: "ds:size-4 ds:shrink-0 ds:text-[color:var(--muted-foreground)] ds:rtl:rotate-180",
465
- "aria-hidden": "true"
466
- }
467
- ),
468
- a.field === "status" ? k(a.to) : m(A, !0)
469
- ]
470
- }
471
- )
472
- ] });
473
- }, N = (a) => {
474
- switch (a.kind) {
475
- case "created":
476
- return {
477
- title: s(P("history.created")),
478
- type: "success",
479
- icon: /* @__PURE__ */ e(wn, { size: 16, "aria-hidden": "true" })
480
- };
481
- case "confirmedByPatient": {
482
- const y = rt.confirmed.Icon;
483
- return {
484
- title: s(P("history.confirmedByPatient")),
485
- type: "success",
486
- icon: /* @__PURE__ */ e(y, { size: 16, "aria-hidden": "true" })
487
- };
488
- }
489
- case "deleted":
490
- return {
491
- title: s(P("history.deleted")),
492
- type: "error",
493
- icon: /* @__PURE__ */ e(Zt, { size: 16, "aria-hidden": "true" })
494
- };
495
- }
496
- const m = ha(a), k = o ? m.filter((y) => !pa.has(y.field)) : m, b = new Set(k.map((y) => y.field)), A = [
497
- ...a.kind === "edited" ? a.fields : [],
498
- ...m.filter((y) => !b.has(y.field)).map((y) => y.field)
499
- ].filter(
500
- (y, M, W) => y !== "status" && !b.has(y) && W.indexOf(y) === M
501
- ), T = A.length > 0 ? s(P("history.editedDetail"), {
502
- fields: A.map((y) => s(P(`history.fields.${y}`))).join(", ")
503
- }) : void 0, [S] = k;
504
- if (k.length === 1 && S && !T)
505
- switch (S.field) {
506
- case "status": {
507
- const { to: y } = S, M = y ? rt[y].Icon : Ne;
508
- return {
509
- title: s(P("history.status")),
510
- type: y === "cancelled" || y === "absent" ? "warning" : "neutral",
511
- icon: /* @__PURE__ */ e(M, { size: 16, "aria-hidden": "true" }),
512
- detail: v(S)
513
- };
514
- }
515
- case "time":
516
- return {
517
- title: s(P("history.moved")),
518
- type: "info",
519
- icon: /* @__PURE__ */ e(pt, { size: 16, "aria-hidden": "true" }),
520
- detail: v(S)
521
- };
522
- case "duration":
523
- return {
524
- title: s(P("history.resized")),
525
- type: "info",
526
- icon: /* @__PURE__ */ e(ct, { size: 16, "aria-hidden": "true" }),
527
- detail: v(S)
528
- };
529
- default:
530
- return {
531
- title: s(P(`history.changed.${S.field}`)),
532
- type: "neutral",
533
- icon: /* @__PURE__ */ e(Ne, { size: 16, "aria-hidden": "true" }),
534
- detail: v(S)
535
- };
536
- }
537
- if (k.length > 0) {
538
- const y = a.kind === "moved" ? {
539
- title: "history.moved",
540
- icon: /* @__PURE__ */ e(pt, { size: 16, "aria-hidden": "true" })
541
- } : a.kind === "resized" ? {
542
- title: "history.resized",
543
- icon: /* @__PURE__ */ e(ct, { size: 16, "aria-hidden": "true" })
544
- } : a.kind === "status" ? {
545
- title: "history.status",
546
- icon: (() => {
547
- const M = rt[a.to].Icon;
548
- return /* @__PURE__ */ e(M, { size: 16, "aria-hidden": "true" });
549
- })()
550
- } : {
551
- title: "history.edited",
552
- icon: /* @__PURE__ */ e(Ne, { size: 16, "aria-hidden": "true" })
553
- };
554
- return {
555
- title: s(P(y.title)),
556
- type: a.kind === "moved" || a.kind === "resized" ? "info" : a.kind === "status" && (a.to === "cancelled" || a.to === "absent") ? "warning" : "neutral",
557
- icon: y.icon,
558
- detail: /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
559
- /* @__PURE__ */ e(
560
- "dl",
561
- {
562
- "aria-label": s(P("history.changesLabel")),
563
- className: "ds:m-0 ds:grid ds:grid-cols-[auto_minmax(0,1fr)] ds:items-baseline ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-xs)]",
564
- children: k.map((M) => /* @__PURE__ */ h("div", { className: "ds:contents", children: [
565
- /* @__PURE__ */ e("dt", { className: "type-label ds:text-[color:var(--muted-foreground)]", children: s(P(`history.fields.${M.field}`)) }),
566
- /* @__PURE__ */ e("dd", { className: "ds:m-0 ds:min-w-0", children: v(M) })
567
- ] }, M.field))
568
- }
569
- ),
570
- T ? /* @__PURE__ */ e("p", { className: "ds:m-0", children: T }) : null
571
- ] })
572
- };
573
- }
574
- return {
575
- title: s(P("history.edited")),
576
- type: "neutral",
577
- icon: /* @__PURE__ */ e(Ne, { size: 16, "aria-hidden": "true" }),
578
- detail: T || (i ? /* @__PURE__ */ e("span", { className: "ds:text-[color:var(--muted-foreground)]", children: s(P("history.notRecorded")) }) : void 0)
579
- };
580
- };
581
- return t.length === 0 ? /* @__PURE__ */ e(
582
- kn,
583
- {
584
- variant: "first-use",
585
- size: "sm",
586
- title: s(P("historyEmpty"))
587
- }
588
- ) : /* @__PURE__ */ e(Oe, { order: "newest-first", "aria-label": s(P("historyTitle")), children: da(t).map((a) => {
589
- const m = N(a);
590
- return /* @__PURE__ */ h(
591
- Oe.Event,
592
- {
593
- eventId: a.id,
594
- type: m.type,
595
- className: "ds:[column-gap:var(--spacing-sm)] ds:[padding-block-end:var(--spacing-lg)] ds:before:bg-[var(--primary)]",
596
- children: [
597
- /* @__PURE__ */ e(Oe.Dot, { icon: m.icon }),
598
- /* @__PURE__ */ e(
599
- Oe.Content,
600
- {
601
- title: m.title,
602
- description: m.detail,
603
- className: "ds:[padding-block-end:0] ds:[&>[data-component=card]]:border-[color:var(--card-border)] ds:[&>[data-component=card]]:shadow-[var(--shadow-card)]",
604
- actor: a.actor.trim() ? { name: a.actor } : void 0,
605
- children: /* @__PURE__ */ h("span", { className: "ds:mt-[var(--spacing-sm)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
606
- /* @__PURE__ */ e(
607
- bt,
608
- {
609
- "aria-hidden": "true",
610
- className: "ds:size-4 ds:shrink-0 ds:text-[color:var(--muted-foreground)]"
611
- }
612
- ),
613
- /* @__PURE__ */ e(
614
- Oe.Timestamp,
615
- {
616
- date: a.atIso,
617
- relative: !1,
618
- locale: f
619
- }
620
- )
621
- ] })
622
- }
623
- )
624
- ]
625
- },
626
- a.id
627
- );
628
- }) });
629
- }
630
- const ya = {
631
- confirmed: "success",
632
- waiting: "info",
633
- in_care: "accentSoft",
634
- done: "success",
635
- cancelled: "error",
636
- absent: "warning"
637
- };
638
- function ba({ event: t }) {
639
- const { t: n } = B("ui"), i = (s) => `calendarWorkspace.details.indicators.${s}`, o = [];
640
- return t.isBookedOnline && o.push({
641
- id: "online",
642
- icon: /* @__PURE__ */ e(xn, { "aria-hidden": "true" }),
643
- label: n(i("bookedOnline")),
644
- variant: "info"
645
- }), t.hasUnassignedPatient && o.push({
646
- id: "unassigned",
647
- icon: /* @__PURE__ */ e(Sn, { "aria-hidden": "true" }),
648
- label: n(i("unassignedPatient")),
649
- variant: "warning"
650
- }), t.hasHighlightedAnamnesis && o.push({
651
- id: "anamnesis",
652
- icon: /* @__PURE__ */ e(kt, { "aria-hidden": "true" }),
653
- label: n(i("anamnesis")),
654
- variant: "accentSoft"
655
- }), t.hasBillableAmount && o.push({
656
- id: "billable",
657
- icon: /* @__PURE__ */ e(In, { "aria-hidden": "true" }),
658
- label: n(i("billable")),
659
- variant: "warning"
660
- }), t.isTelehealth && o.push({
661
- id: "telehealth",
662
- icon: /* @__PURE__ */ e(wt, { "aria-hidden": "true" }),
663
- label: n(i("telehealth")),
664
- variant: "info"
665
- }), t.isRecurring && o.push({
666
- id: "recurring",
667
- icon: /* @__PURE__ */ e(en, { "aria-hidden": "true" }),
668
- label: n(i("recurring")),
669
- variant: "info"
670
- }), o.length === 0 ? null : /* @__PURE__ */ e("span", { className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-2xs)]", children: o.map((s) => /* @__PURE__ */ e(
671
- Xe,
672
- {
673
- variant: s.variant,
674
- size: "sm",
675
- leading: s.icon,
676
- children: s.label
677
- },
678
- s.id
679
- )) });
680
- }
681
- function ka({
682
- name: t,
683
- avatarSrc: n,
684
- unresolved: i = !1,
685
- status: o,
686
- flags: s,
687
- age: d,
688
- onOpenPatient: p,
689
- highlightedAnamnesisCount: f = 0,
690
- expiredAnamnesisCount: c = 0,
691
- anamnesisAnswers: r = [],
692
- locale: l
693
- }) {
694
- const { t: g, i18n: w } = B("ui"), v = (b) => `calendarWorkspace.details.${b}`, { optionFor: N } = yt(o), a = o ? N(o) : void 0, m = f, k = c;
695
- return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)] ds:pb-0", children: [
696
- /* @__PURE__ */ h("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
697
- /* @__PURE__ */ e(ut, { name: t, src: n }),
698
- /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:[min-inline-size:0]", children: [
699
- /* @__PURE__ */ h("span", { className: "ds:flex ds:flex-wrap ds:items-baseline ds:gap-[var(--spacing-2xs)] ds:text-start", children: [
700
- p ? /* @__PURE__ */ e(L, { size: "sm", intent: "link", onClick: () => p(), children: t }) : /* @__PURE__ */ e("span", { className: "ds:font-[var(--font-weight-semibold)] ds:truncate", children: t }),
701
- d !== void 0 ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: g(v("patientAge"), { n: d }) }) : null
702
- ] }),
703
- i ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-start ds:text-[color:var(--muted-foreground)]", children: g(v("patientNotLoaded")) }) : null,
704
- o && a ? /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
705
- Xe,
706
- {
707
- variant: ya[o],
708
- size: "sm",
709
- leading: a.icon,
710
- children: a.label
711
- }
712
- ) }) : null,
713
- /* @__PURE__ */ e(ba, { event: s })
714
- ] })
715
- ] }),
716
- m + k > 0 ? /* @__PURE__ */ h(
717
- $,
718
- {
719
- variant: "warning",
720
- announce: "off",
721
- icon: /* @__PURE__ */ e(kt, { "aria-hidden": "true" }),
722
- children: [
723
- /* @__PURE__ */ e($.Title, { as: "p", children: g(v("anamnesisTitle")) }),
724
- /* @__PURE__ */ e($.Description, { children: [
725
- m > 0 ? g(v("anamnesisHighlighted"), { n: m }) : null,
726
- k > 0 ? g(v("anamnesisExpired"), { n: k }) : null
727
- ].filter((b) => b !== null).join(" · ") }),
728
- r.length > 0 ? (
729
- /* Question · yes or no · answer · interview date, as the
730
- platform's details dialog lists them. A list, not a
731
- Description, which renders a <p>. */
732
- /* @__PURE__ */ e("ul", { className: "type-body-sm ds:m-0 ds:mt-[var(--spacing-xs)] ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-2xs)] ds:p-0", children: r.map((b) => /* @__PURE__ */ h("li", { className: "ds:text-start", children: [
733
- /* @__PURE__ */ e("span", { className: "ds:font-[var(--font-weight-semibold)]", children: b.question }),
734
- ` · ${g(v(b.yes ? "anamnesisYes" : "anamnesisNo"))}`,
735
- b.answer ? ` · ${b.answer}` : "",
736
- ` · ${Ge(l ?? w.language, b.interviewIso)}`
737
- ] }, b.question)) })
738
- ) : null
739
- ]
740
- }
741
- ) : null
742
- ] });
743
- }
744
- const wa = {
745
- SU: 0,
746
- MO: 1,
747
- TU: 2,
748
- WE: 3,
749
- TH: 4,
750
- FR: 5,
751
- SA: 6
752
- }, Na = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"], xa = {
753
- daily: "recurrenceEveryDay",
754
- weekly: "recurrenceEveryWeek",
755
- monthly: "recurrenceEveryMonth",
756
- yearly: "recurrenceEveryYear"
757
- }, Sa = {
758
- 1: "recurrenceOrdinal1",
759
- 2: "recurrenceOrdinal2",
760
- 3: "recurrenceOrdinal3",
761
- 4: "recurrenceOrdinal4"
762
- }, Ia = /^(-1|[1-4])?(MO|TU|WE|TH|FR|SA|SU)$/;
763
- function Wt(t, n) {
764
- const i = new Date(2026, 0, 4 + wa[t]);
765
- return new Intl.DateTimeFormat(n, { weekday: "long" }).format(i);
766
- }
767
- function Aa(t, n, i) {
768
- const o = Fe(n);
769
- if (!Number.isFinite(o.getTime())) return;
770
- const s = i ? Fe(i) : void 0, d = s && s.getFullYear() === o.getFullYear();
771
- try {
772
- return new Intl.DateTimeFormat(t, {
773
- day: "numeric",
774
- month: "long",
775
- ...d ? {} : { year: "numeric" }
776
- }).format(o);
777
- } catch {
778
- return;
779
- }
780
- }
781
- function Ta(t, n, i, o) {
782
- const s = la[i.frequency];
783
- if (!s) return;
784
- const d = (N) => `calendarWorkspace.editor.${N}`, p = (N) => `calendarWorkspace.details.${N}`, f = xa[i.frequency], c = f && (i.interval ?? 1) > 1 ? t(d(f), { count: i.interval }) : t(d(s)), r = (i.byDay ?? []).map((N) => Ia.exec(N)).filter((N) => N !== null), l = i.frequency === "weekly" ? Na.filter(
785
- (N) => r.some(([, a, m]) => !a && m === N)
786
- ) : [], g = i.frequency === "monthly" || i.frequency === "yearly" ? r.find(([, N]) => N) : void 0;
787
- let w = c;
788
- if (l.length > 0)
789
- w = t(p("seriesOnDays"), {
790
- every: c,
791
- days: new Intl.ListFormat(n, { type: "conjunction" }).format(
792
- l.map((N) => Wt(N, n))
793
- )
794
- });
795
- else if (g) {
796
- const [, N, a] = g, m = Wt(a, n);
797
- w = N === "-1" ? t(p("seriesOnLast"), { every: c, weekday: m }) : t(p("seriesOnNth"), {
798
- every: c,
799
- weekday: m,
800
- ordinal: t(d(Sa[N]))
801
- });
802
- }
803
- if (i.count !== void 0)
804
- return t(p("seriesRule"), {
805
- frequency: w,
806
- count: i.count
807
- });
808
- const v = i.untilIso ? Aa(n, i.untilIso, o) : void 0;
809
- return v ? t(p("seriesUntil"), { rule: w, date: v }) : w;
810
- }
811
- function gt({
812
- eyebrow: t,
813
- heading: n,
814
- facts: i
815
- }) {
816
- return /* @__PURE__ */ h(ie, { children: [
817
- /* @__PURE__ */ e(Se.Eyebrow, { children: t }),
818
- /* @__PURE__ */ e(Se.Heading, { children: n }),
819
- i && i.length > 0 ? /* @__PURE__ */ e(Se.Body, { children: /* @__PURE__ */ e("ul", { className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-2xs)] ds:p-0 type-body-sm", children: i.map((o, s) => /* @__PURE__ */ e(
820
- "li",
821
- {
822
- className: o.muted ? "ds:text-[color:var(--muted-foreground)]" : void 0,
823
- children: o.text
824
- },
825
- s
826
- )) }) }) : null
827
- ] });
828
- }
829
- const Ea = "ds:inline-flex ds:cursor-pointer ds:rounded-[var(--radius-full)] ds:p-0 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)]";
830
- function Ut({
831
- id: t,
832
- eyebrow: n,
833
- heading: i,
834
- facts: o,
835
- children: s
836
- }) {
837
- return /* @__PURE__ */ h(Se, { children: [
838
- /* @__PURE__ */ e(Se.Trigger, { asChild: !0, children: /* @__PURE__ */ e("button", { type: "button", "data-chip-hover": t, className: Ea, children: s }) }),
839
- /* @__PURE__ */ e(Se.Content, { side: "bottom", align: "start", size: "sm", children: /* @__PURE__ */ e(gt, { eyebrow: n, heading: i, facts: o }) })
840
- ] });
841
- }
842
- const u = (t) => `calendarWorkspace.details.${t}`, Da = {
843
- missing: "consentMissing",
844
- requested: "consentRequested",
845
- signed: "consentSigned"
846
- }, nn = (t) => /* @__PURE__ */ e("a", { href: `tel:${t.replace(/\s/g, "")}`, dir: "ltr", children: t }), an = (t) => /* @__PURE__ */ e("a", { href: `mailto:${t}`, dir: "ltr", children: t }), sn = (t, n, i) => new Intl.NumberFormat(t, { style: "currency", currency: i }).format(n);
847
- function Ye({
848
- href: t,
849
- action: n,
850
- icon: i,
851
- children: o
852
- }) {
853
- const s = Ke(t);
854
- return s ? /* @__PURE__ */ e(
855
- L,
856
- {
857
- asChild: !0,
858
- size: "sm",
859
- intent: "outline",
860
- "data-action": n,
861
- startIcon: i,
862
- children: /* @__PURE__ */ e("a", { href: s, children: o })
863
- }
864
- ) : null;
865
- }
866
- function qt({ rows: t }) {
867
- const n = t.filter((i) => !!i);
868
- return n.length === 0 ? null : /* @__PURE__ */ e(je, { layout: "inline", density: "compact", children: n.map((i) => /* @__PURE__ */ h(
869
- je.Row,
870
- {
871
- "data-row": i.id,
872
- icon: i.icon,
873
- children: [
874
- /* @__PURE__ */ e(je.Term, { children: i.label }),
875
- /* @__PURE__ */ e(je.Detail, { children: i.value })
876
- ]
877
- },
878
- i.id
879
- )) });
880
- }
881
- function Ca({
882
- details: t,
883
- locale: n,
884
- currency: i,
885
- now: o,
886
- mapsLink: s = !1,
887
- shortcuts: d,
888
- onRequestSignature: p,
889
- onSignOnDevice: f,
890
- onOpenPatient: c
891
- }) {
892
- const { t: r } = B("ui"), { patient: l, signing: g, money: w, booking: v } = t;
893
- if (!l) return null;
894
- const N = (g == null ? void 0 : g.consents) ?? [], a = g && (g.required > 0 || N.length > 0) ? g : void 0, m = ((a == null ? void 0 : a.toComplete) ?? 0) > 0, k = a ? [
895
- {
896
- text: m ? a.requestedVia === "sms" ? r(u("signingRequestedSms")) : a.requestedVia === "email" ? r(u("signingRequestedEmail")) : r(u("signingNotRequested")) : r(u("signingAllSigned"))
897
- },
898
- ...a.aesSetUp ? [] : [{ text: r(u("aesMissing")), muted: !0 }]
899
- ] : [], b = ((g == null ? void 0 : g.required) ?? 0) > 0 && m, A = !!(d != null && d.advancedSignatureUrl) && ((g == null ? void 0 : g.required) ?? 0) > 0 && !(g != null && g.aesSetUp), T = !!p && b, S = !!f && b, y = l.highlightedAnamnesisCount ?? 0, M = l.expiredAnamnesisCount ?? 0, W = (l.highlightedAnamnesisAnswers ?? []).map((R) => ({
900
- text: [
901
- R.question,
902
- r(u(R.yes ? "anamnesisYes" : "anamnesisNo")),
903
- R.answer,
904
- Ge(n, R.interviewIso)
905
- ].filter(Boolean).join(" · ")
906
- })), se = tn(l), re = ua(l) || se, G = N.map((R) => ({
907
- id: `consent-${R.id}`,
908
- label: R.name,
909
- value: r(u(Da[R.state]))
910
- })), U = [
911
- ...l.dobIso ? [
912
- {
913
- id: "dob",
914
- label: r(u("dob")),
915
- icon: /* @__PURE__ */ e(Qn, {}),
916
- value: `${Ge(n, l.dobIso)} ${r(
917
- u("patientAge"),
918
- {
919
- n: sa(l.dobIso, o)
920
- }
921
- )}`
922
- }
923
- ] : [],
924
- ...ca(l).map((R, ee) => {
925
- const te = R.label === "mobile" || R.label === "home" || R.label === "work";
926
- return {
927
- id: `phone-${ee}`,
928
- label: r(te ? `calendarWorkspace.print.phoneLabels.${R.label}` : u("phone")),
929
- icon: R.label === "mobile" ? /* @__PURE__ */ e(Ft, {}) : /* @__PURE__ */ e(En, {}),
930
- value: nn(R.number)
931
- };
932
- }),
933
- ...l.email ? [
934
- {
935
- id: "email",
936
- label: r(u("email")),
937
- icon: /* @__PURE__ */ e(Dn, {}),
938
- value: an(l.email)
939
- }
940
- ] : [],
941
- /* P27: hidden patient details leave the address out, and with it the
942
- row: no map link and no empty "address" line. */
943
- ...s && se ? [
944
- {
945
- id: "address",
946
- label: r(u("address")),
947
- icon: /* @__PURE__ */ e(Cn, {}),
948
- value: /* @__PURE__ */ e(
949
- "a",
950
- {
951
- href: ma(l),
952
- target: "_blank",
953
- rel: "noopener noreferrer",
954
- "aria-label": `${r(u("mapsLink"))}: ${re}`,
955
- children: re
956
- }
957
- )
958
- }
959
- ] : []
960
- ], V = (w == null ? void 0 : w.unpaidAmount) ?? 0, X = (w == null ? void 0 : w.billableAmount) ?? 0, J = (v == null ? void 0 : v.paidOnlineAmount) ?? 0, Z = (R, ee, te, Ie, fe, ne) => /* @__PURE__ */ e(
961
- Ut,
962
- {
963
- id: te,
964
- eyebrow: r(u("hoverBilling")),
965
- heading: r(u(Ie), {
966
- amount: sn(n, ee, i)
967
- }),
968
- facts: [{ text: r(u(fe)) }],
969
- children: /* @__PURE__ */ e(
970
- Tn,
971
- {
972
- "data-chip": te,
973
- state: R,
974
- amount: ee,
975
- currency: i,
976
- locale: n,
977
- size: "md",
978
- showLabel: !0,
979
- label: ne,
980
- showIcon: !1
981
- }
982
- )
983
- }
984
- );
985
- return /* @__PURE__ */ e(
986
- Xt,
987
- {
988
- "data-card": "patient",
989
- name: l.name,
990
- avatarUrl: l.avatarSrc,
991
- locale: n,
992
- surface: "elevated",
993
- density: "compact",
994
- flags: {
995
- unsignedDocumentsCount: (a == null ? void 0 : a.toComplete) ?? 0,
996
- highlightedAnamnesisCount: y
997
- },
998
- flagHover: {
999
- ...a ? {
1000
- unsignedDocuments: /* @__PURE__ */ e(
1001
- gt,
1002
- {
1003
- eyebrow: r(u("sectionSigning")),
1004
- heading: a.toComplete === 1 ? r(u("signingToSignOne")) : r(u("signingToSignMany"), {
1005
- n: a.toComplete
1006
- }),
1007
- facts: k
1008
- }
1009
- )
1010
- } : {},
1011
- highlightedAnamnesis: /* @__PURE__ */ e(
1012
- gt,
1013
- {
1014
- eyebrow: r(u("anamnesisTitle")),
1015
- heading: r(u("anamnesisHighlighted"), { n: y }),
1016
- facts: W
1017
- }
1018
- )
1019
- },
1020
- extraChips: V > 0 || X > 0 || J > 0 || M > 0 || A || T || S || c ? /* @__PURE__ */ h(ie, { children: [
1021
- /* @__PURE__ */ h("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1022
- V > 0 ? Z(
1023
- "debt",
1024
- V,
1025
- "unpaid",
1026
- "hoverUnpaidHeading",
1027
- "hoverUnpaidFact"
1028
- ) : null,
1029
- X > 0 ? Z(
1030
- "to-invoice",
1031
- X,
1032
- "billable",
1033
- "hoverBillableHeading",
1034
- "hoverBillableFact"
1035
- ) : null,
1036
- J > 0 ? Z(
1037
- "settled",
1038
- J,
1039
- "paidOnline",
1040
- "hoverPaidOnlineHeading",
1041
- "hoverPaidOnlineFact",
1042
- /* A deposit is settled money, but "Settled" hides where
1043
- it came from: the chip says what its hover card says. */
1044
- r(u("paidOnline"))
1045
- ) : null
1046
- ] }),
1047
- T ? /* @__PURE__ */ e(
1048
- L,
1049
- {
1050
- size: "sm",
1051
- intent: "outline",
1052
- "data-action": ue.requestSignature,
1053
- startIcon: /* @__PURE__ */ e(Rn, { "aria-hidden": "true" }),
1054
- onClick: () => p(t.eventId),
1055
- children: r(u("signingRequest"))
1056
- }
1057
- ) : null,
1058
- S ? /* @__PURE__ */ e(
1059
- L,
1060
- {
1061
- size: "sm",
1062
- intent: "outline",
1063
- "data-action": ue.signOnDevice,
1064
- "aria-label": `${r(u("signingRequest"))}: ${r(u("signingOnDevice"))}`,
1065
- startIcon: /* @__PURE__ */ e(Ft, { "aria-hidden": "true" }),
1066
- onClick: () => f(t.eventId),
1067
- children: r(u("signingOnDevice"))
1068
- }
1069
- ) : null,
1070
- c ? /* @__PURE__ */ e(
1071
- L,
1072
- {
1073
- size: "sm",
1074
- intent: "outline",
1075
- "data-action": ue.openPatient,
1076
- startIcon: /* @__PURE__ */ e(Pn, { "aria-hidden": "true" }),
1077
- onClick: () => c(t.eventId),
1078
- children: r(u("openPatient"))
1079
- }
1080
- ) : null,
1081
- A && (d != null && d.advancedSignatureUrl) ? /* @__PURE__ */ e(
1082
- Ye,
1083
- {
1084
- href: d.advancedSignatureUrl,
1085
- action: ue.advancedSignature,
1086
- icon: /* @__PURE__ */ e(Mn, { "aria-hidden": "true" }),
1087
- children: r(u("aesSetUp"))
1088
- }
1089
- ) : null,
1090
- d != null && d.unlockPaymentsUrl && (V > 0 || X > 0) ? /* @__PURE__ */ e(
1091
- Ye,
1092
- {
1093
- href: d.unlockPaymentsUrl,
1094
- action: ue.unlockPayments,
1095
- icon: /* @__PURE__ */ e(Ln, { "aria-hidden": "true" }),
1096
- children: r(u("unlockPayments"))
1097
- }
1098
- ) : null,
1099
- M > 0 ? /* @__PURE__ */ e(
1100
- Ut,
1101
- {
1102
- id: "anamnesisExpired",
1103
- eyebrow: r(u("anamnesisTitle")),
1104
- heading: r(u("anamnesisExpired"), { n: M }),
1105
- facts: [{ text: r(u("hoverAnamnesisExpiredFact")) }],
1106
- children: /* @__PURE__ */ e(
1107
- Xe,
1108
- {
1109
- "data-chip": "anamnesisExpired",
1110
- variant: "warning",
1111
- size: "md",
1112
- leading: /* @__PURE__ */ e(kt, {}),
1113
- children: r(u("anamnesisExpired"), { n: M })
1114
- }
1115
- )
1116
- }
1117
- ) : null,
1118
- M > 0 && (d != null && d.renewAnamnesisUrl) ? /* @__PURE__ */ e(
1119
- Ye,
1120
- {
1121
- href: d.renewAnamnesisUrl,
1122
- action: ue.renewAnamnesis,
1123
- icon: /* @__PURE__ */ e(On, { "aria-hidden": "true" }),
1124
- children: r(u("anamnesisRenew"))
1125
- }
1126
- ) : null
1127
- ] }) : void 0,
1128
- visibleFieldOrder: [...U, ...G].map((R) => R.id),
1129
- sections: U.length > 0 || G.length > 0 ? [
1130
- ...U.length > 0 ? [{ id: "contact", heading: r(u("sectionPatient")), fields: U }] : [],
1131
- ...G.length > 0 ? [
1132
- {
1133
- id: "consents",
1134
- heading: r(u("sectionSigning")),
1135
- fields: G
1136
- }
1137
- ] : []
1138
- ] : void 0
1139
- }
1140
- );
1141
- }
1142
- function Ra({
1143
- details: t,
1144
- locale: n,
1145
- currency: i,
1146
- operator: o,
1147
- chair: s,
1148
- description: d,
1149
- privacy: p = !1,
1150
- history: f
1151
- }) {
1152
- const { t: c } = B("ui"), { appointment: r, booking: l, patient: g } = t, w = (y) => c(`calendarWorkspace.editor.${y}`), v = new Date(r.startIso), N = new Date(v.getTime() + r.durationMin * 6e4), a = Number.isFinite(v.getTime()), { recurrence: m } = r, k = m && Ta(c, n, m, r.startIso), b = l ? [
1153
- l.bookedAtIso && {
1154
- id: "bookedAt",
1155
- label: c(u("bookedAt")),
1156
- value: /* @__PURE__ */ e(
1157
- _t,
1158
- {
1159
- value: l.bookedAtIso,
1160
- format: "absolute",
1161
- shape: "bare",
1162
- locale: n,
1163
- absoluteFormat: ht
1164
- }
1165
- )
1166
- },
1167
- l.typedName && {
1168
- id: "bookingName",
1169
- label: c(u("bookingName")),
1170
- value: l.typedName
1171
- },
1172
- l.phone && {
1173
- id: "bookingPhone",
1174
- label: c(u("bookingPhone")),
1175
- value: nn(l.phone)
1176
- },
1177
- l.email && {
1178
- id: "bookingEmail",
1179
- label: c(u("bookingEmail")),
1180
- value: an(l.email)
1181
- },
1182
- l.note && {
1183
- id: "bookingNote",
1184
- label: c(u("bookingNote")),
1185
- value: l.note
1186
- },
1187
- /* With a patient the amount is a chip on the patient card. */
1188
- !g && l.paidOnlineAmount !== void 0 && {
1189
- id: "paidOnline",
1190
- label: c(u("paidOnline")),
1191
- value: sn(n, l.paidOnlineAmount, i)
1192
- }
1193
- ] : [], A = p ? b.filter((y) => y && y.id === "bookedAt") : b, T = A.some(Boolean), S = l || r.bookedOnline || f == null ? void 0 : f.filter(
1194
- (y) => y.kind === "created" && y.actor.trim() !== ""
1195
- ).sort((y, M) => Date.parse(y.atIso) - Date.parse(M.atIso))[0];
1196
- return /* @__PURE__ */ h(
1197
- pe,
1198
- {
1199
- "data-card": "appointment",
1200
- title: c(u("sectionAppointment")),
1201
- headingLevel: 3,
1202
- children: [
1203
- d,
1204
- /* @__PURE__ */ e(
1205
- qt,
1206
- {
1207
- rows: [
1208
- a && {
1209
- id: "date",
1210
- label: w("date"),
1211
- icon: /* @__PURE__ */ e(_n, {}),
1212
- value: Ge(n, v)
1213
- },
1214
- a && {
1215
- id: "time",
1216
- label: c(u("time")),
1217
- icon: /* @__PURE__ */ e(ct, {}),
1218
- value: r.allDay ? w("allDay") : ia(n, v, N)
1219
- },
1220
- !r.allDay && {
1221
- id: "duration",
1222
- label: w("duration"),
1223
- icon: /* @__PURE__ */ e(Fn, {}),
1224
- value: `${r.durationMin} ${w("durationUnit")}`
1225
- },
1226
- r.isTelehealth && {
1227
- id: "type",
1228
- label: w("type"),
1229
- icon: /* @__PURE__ */ e(wt, {}),
1230
- value: w("typeTelehealth")
1231
- },
1232
- o && {
1233
- id: "operator",
1234
- label: c(u("operator")),
1235
- /* A person, as on the grid: the avatar fills the icon slot. */
1236
- icon: /* @__PURE__ */ e(ut, { name: o.name, src: o.avatarSrc, size: "xs" }),
1237
- value: o.name
1238
- },
1239
- s && {
1240
- id: "chair",
1241
- label: c(u("chair")),
1242
- icon: /* @__PURE__ */ e(zt, {}),
1243
- value: /* @__PURE__ */ e(Xe, { variant: "neutral", size: "sm", leading: /* @__PURE__ */ e(zt, {}), children: s.name })
1244
- },
1245
- r.branchLabel && {
1246
- id: "branch",
1247
- label: w("branch"),
1248
- icon: /* @__PURE__ */ e(zn, {}),
1249
- value: r.branchLabel
1250
- },
1251
- S && {
1252
- id: "createdBy",
1253
- label: c(u("createdBy")),
1254
- icon: /* @__PURE__ */ e(ut, { name: S.actor, size: "xs" }),
1255
- value: /* @__PURE__ */ h("span", { className: "ds:inline-flex ds:flex-wrap ds:items-baseline ds:gap-x-[var(--spacing-xs)]", children: [
1256
- /* @__PURE__ */ e("span", { children: S.actor }),
1257
- " ",
1258
- /* @__PURE__ */ e("span", { className: "ds:text-[color:var(--muted-foreground)]", children: /* @__PURE__ */ e(
1259
- _t,
1260
- {
1261
- value: S.atIso,
1262
- format: "absolute",
1263
- shape: "bare",
1264
- locale: n,
1265
- absoluteFormat: ht
1266
- }
1267
- ) })
1268
- ] })
1269
- },
1270
- k && {
1271
- id: "series",
1272
- label: c(u("seriesLabel")),
1273
- icon: /* @__PURE__ */ e(en, {}),
1274
- value: k
1275
- }
1276
- ]
1277
- }
1278
- ),
1279
- T ? /* @__PURE__ */ h(
1280
- "div",
1281
- {
1282
- "data-block": "booking",
1283
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1284
- children: [
1285
- /* @__PURE__ */ e("h4", { className: "ds:m-0 type-label ds:text-[color:var(--muted-foreground)]", children: c(u("sectionBooking")) }),
1286
- /* @__PURE__ */ e(qt, { rows: A })
1287
- ]
1288
- }
1289
- ) : null
1290
- ]
1291
- }
1292
- );
1293
- }
1294
- function Pa({
1295
- details: t,
1296
- locale: n,
1297
- currency: i,
1298
- privacy: o = !1,
1299
- carePlanUrl: s
1300
- }) {
1301
- const { t: d } = B("ui"), { care: p } = t, f = o || p == null ? void 0 : p.plan;
1302
- return !p || !f && p.lines.length === 0 ? null : /* @__PURE__ */ h(
1303
- pe,
1304
- {
1305
- "data-card": "treatments",
1306
- title: d(u("sectionTreatments")),
1307
- headingLevel: 3,
1308
- children: [
1309
- f ? /* @__PURE__ */ h("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-xs)]", children: [
1310
- /* @__PURE__ */ h("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] type-title-item", children: [
1311
- /* @__PURE__ */ e(
1312
- mt,
1313
- {
1314
- "aria-hidden": "true",
1315
- className: "ds:size-4 ds:shrink-0 ds:text-[color:var(--muted-foreground)]"
1316
- }
1317
- ),
1318
- f.number ? d(u("planLine"), { number: f.number, name: f.name }) : f.name
1319
- ] }),
1320
- s ? /* @__PURE__ */ e(
1321
- Ye,
1322
- {
1323
- href: s,
1324
- action: ue.carePlan,
1325
- icon: /* @__PURE__ */ e(mt, { "aria-hidden": "true" }),
1326
- children: d(u("openCarePlan"))
1327
- }
1328
- ) : null
1329
- ] }) : null,
1330
- p.lines.length > 0 ? /* @__PURE__ */ e(
1331
- Qt,
1332
- {
1333
- lines: p.lines.map(({ entryId: c, careId: r, ...l }) => ({
1334
- id: c,
1335
- ...l
1336
- })),
1337
- locale: n,
1338
- currency: i
1339
- }
1340
- ) : null
1341
- ]
1342
- }
1343
- );
1344
- }
1345
- const jt = 3;
1346
- function Ma({
1347
- preview: t,
1348
- onOpenNotes: n,
1349
- locale: i
1350
- }) {
1351
- const { t: o } = B("ui"), s = ot(), d = t.status ?? "ready", p = _(!1);
1352
- me(() => {
1353
- p.current && (d !== "loading" && (p.current = !1), _e(s));
1354
- }, [d, s]);
1355
- const f = t.total ?? (d === "ready" ? t.notes.length : null), c = Math.max(0, (f ?? 0) - jt), r = c > 0 ? o(u("notesMore"), { n: c }) : o(u("notesPreviewOpen"));
1356
- return /* @__PURE__ */ h(
1357
- pe,
1358
- {
1359
- "data-card": "notes",
1360
- headingId: s,
1361
- headingLevel: 3,
1362
- title: f === null ? o("notesPanel.title") : o(u("notesPreviewTitle"), { count: f }),
1363
- headerAction: n && (f ?? 0) > 0 ? /* @__PURE__ */ h("span", { className: "ds:relative ds:inline-flex", children: [
1364
- /* @__PURE__ */ e(
1365
- Yt,
1366
- {
1367
- icon: /* @__PURE__ */ e(Hn, { "aria-hidden": "true" }),
1368
- intent: "outline",
1369
- size: "sm",
1370
- "data-action": "open-patient-notes",
1371
- "aria-label": r,
1372
- tooltip: r,
1373
- onClick: () => n()
1374
- }
1375
- ),
1376
- c > 0 ? (
1377
- /* Decorative: the button's name already says the count. */
1378
- /* @__PURE__ */ e(
1379
- An,
1380
- {
1381
- variant: "outline",
1382
- size: "sm",
1383
- background: "surface",
1384
- count: c,
1385
- "aria-hidden": "true",
1386
- className: "ds:pointer-events-none ds:absolute ds:-top-[var(--spacing-2xs)] ds:-end-[var(--spacing-2xs)]"
1387
- }
1388
- )
1389
- ) : null
1390
- ] }) : void 0,
1391
- children: [
1392
- d === "error" ? /* @__PURE__ */ h($, { variant: "error", children: [
1393
- /* @__PURE__ */ e($.Description, { children: o("notesPanel.loadError") }),
1394
- t.onRetry ? /* @__PURE__ */ e($.Action, { children: /* @__PURE__ */ e(
1395
- L,
1396
- {
1397
- intent: "secondary",
1398
- size: "sm",
1399
- onClick: () => {
1400
- var l;
1401
- p.current = !0, (l = t.onRetry) == null || l.call(t);
1402
- },
1403
- children: o("notesPanel.retry")
1404
- }
1405
- ) }) : null
1406
- ] }) : null,
1407
- t.notes.length === 0 && d === "loading" ? /* @__PURE__ */ h(ie, { children: [
1408
- /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: o("notesPanel.loading") }),
1409
- /* @__PURE__ */ e(lt, { notes: [], loading: !0, loadingRows: 2 })
1410
- ] }) : d !== "error" || t.notes.length > 0 ? (
1411
- /* A note click, or Enter or Space on it, goes straight to that note
1412
- in the Notes tool; the header button opens the tool at the top. */
1413
- /* @__PURE__ */ e(
1414
- lt,
1415
- {
1416
- notes: t.notes,
1417
- maxItems: jt,
1418
- locale: i,
1419
- "aria-labelledby": s,
1420
- onNoteActivate: n,
1421
- emptyState: /* @__PURE__ */ e("p", { className: "ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]", children: o(u("notesPreviewEmpty")) })
1422
- }
1423
- )
1424
- ) : null
1425
- ]
1426
- }
1427
- );
1428
- }
1429
- const La = vt("ds:flex ds:h-full ds:min-h-0 ds:flex-col"), Oa = vt(
1430
- "ds:flex ds:shrink-0 ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:border-t ds:border-[color:var(--border)] ds:p-[var(--spacing-sm)]"
1431
- ), _a = vt(
1432
- "ds:shrink-0 ds:rounded-[var(--radius-md)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
1433
- ), K = "ds:sm:[min-block-size:var(--accessible-target-floor,0px)]", Fa = "ds:sm:[&>button]:[min-block-size:var(--accessible-target-floor,0px)]", za = [
1434
- "ds:sm:[&_button:has(svg.lucide-ellipsis)]:[min-block-size:var(--accessible-target-floor,0px)]",
1435
- "ds:[&_button:has(svg.lucide-ellipsis)]:[min-inline-size:var(--accessible-target-floor,auto)]"
1436
- ].join(" "), rn = ["40%", "33%", "50%", "25%"], Ha = [
1437
- "bill",
1438
- "folder",
1439
- "template",
1440
- "empty",
1441
- "identification",
1442
- "webcam"
1443
- ], $a = {
1444
- bill: /* @__PURE__ */ e(Vn, { "aria-hidden": "true" }),
1445
- folder: /* @__PURE__ */ e(Gn, { "aria-hidden": "true" }),
1446
- template: /* @__PURE__ */ e(Yn, { "aria-hidden": "true" }),
1447
- empty: /* @__PURE__ */ e(Kn, { "aria-hidden": "true" }),
1448
- identification: /* @__PURE__ */ e(ea, { "aria-hidden": "true" }),
1449
- webcam: /* @__PURE__ */ e(jn, { "aria-hidden": "true" })
1450
- }, D = (t) => `calendarWorkspace.details.${t}`;
1451
- function Kt({
1452
- children: t,
1453
- startIcon: n,
1454
- overflowItems: i,
1455
- "data-action": o,
1456
- intent: s,
1457
- background: d,
1458
- size: p,
1459
- hideLabel: f
1460
- }) {
1461
- return /* @__PURE__ */ h(qe.Root, { children: [
1462
- /* @__PURE__ */ e(vn, { label: t, side: "top", children: /* @__PURE__ */ e(qe.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
1463
- L,
1464
- {
1465
- intent: s,
1466
- background: d,
1467
- size: p,
1468
- "data-action": o,
1469
- className: K,
1470
- startIcon: n,
1471
- "aria-haspopup": "menu",
1472
- endIcon: /* @__PURE__ */ e(qn, { "aria-hidden": "true" }),
1473
- children: f ? /* @__PURE__ */ e("span", { className: "ds:sr-only", children: t }) : t
1474
- }
1475
- ) }) }),
1476
- /* @__PURE__ */ e(qe.Content, { align: "end", children: i.map((c) => /* @__PURE__ */ e(
1477
- qe.Item,
1478
- {
1479
- "data-action": c.action,
1480
- startIcon: c.icon,
1481
- onSelect: c.onSelect,
1482
- children: c.label
1483
- },
1484
- c.label
1485
- )) })
1486
- ] });
1487
- }
1488
- function Ba() {
1489
- const { t } = B("ui");
1490
- return /* @__PURE__ */ h(ie, { children: [
1491
- /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: t("common.loading") }),
1492
- /* @__PURE__ */ h(
1493
- "div",
1494
- {
1495
- "aria-hidden": "true",
1496
- className: "ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-sm)] ds:overflow-hidden ds:p-[var(--spacing-md)] ds:[&>*]:shrink-0",
1497
- children: [
1498
- /* @__PURE__ */ e(
1499
- Xt,
1500
- {
1501
- name: "",
1502
- loading: !0,
1503
- surface: "elevated",
1504
- density: "compact"
1505
- }
1506
- ),
1507
- /* @__PURE__ */ h(pe, { title: t(D("sectionAppointment")), headingLevel: 3, children: [
1508
- /* @__PURE__ */ e(Gt, { loading: !0, maxLines: 2 }),
1509
- /* @__PURE__ */ e("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: rn.map((n, i) => /* @__PURE__ */ h(
1510
- "div",
1511
- {
1512
- className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
1513
- children: [
1514
- /* @__PURE__ */ e(
1515
- we,
1516
- {
1517
- variant: "rounded",
1518
- stagger: i + 2,
1519
- width: "var(--spacing-md)",
1520
- height: "var(--spacing-md)",
1521
- className: "ds:shrink-0"
1522
- }
1523
- ),
1524
- /* @__PURE__ */ e(
1525
- we,
1526
- {
1527
- variant: "text",
1528
- size: "sm",
1529
- stagger: i + 2,
1530
- width: n
1531
- }
1532
- )
1533
- ]
1534
- },
1535
- n
1536
- )) })
1537
- ] }),
1538
- /* @__PURE__ */ e(pe, { title: t("notesPanel.title"), headingLevel: 3, children: /* @__PURE__ */ e(lt, { notes: [], loading: !0, loadingRows: 2 }) }),
1539
- /* @__PURE__ */ e(pe, { title: t(D("sectionTreatments")), headingLevel: 3, children: /* @__PURE__ */ e(Qt, { lines: [], loading: !0 }) })
1540
- ]
1541
- }
1542
- ),
1543
- /* @__PURE__ */ h(
1544
- "div",
1545
- {
1546
- "aria-hidden": "true",
1547
- className: "ds:flex ds:shrink-0 ds:items-center ds:gap-[var(--spacing-sm)] ds:border-t ds:border-[color:var(--border)] ds:p-[var(--spacing-md)]",
1548
- children: [
1549
- /* @__PURE__ */ e(we, { variant: "rounded", width: "33%", height: "var(--spacing-xl)" }),
1550
- /* @__PURE__ */ e(
1551
- we,
1552
- {
1553
- variant: "rounded",
1554
- stagger: 1,
1555
- height: "var(--spacing-xl)",
1556
- className: "ds:flex-1"
1557
- }
1558
- )
1559
- ]
1560
- }
1561
- )
1562
- ] });
1563
- }
1564
- function Wa({
1565
- history: t,
1566
- locale: n,
1567
- onRetry: i,
1568
- noteUnrecordedEdits: o,
1569
- privacy: s
1570
- }) {
1571
- var v;
1572
- const { t: d } = B("ui"), p = t.status ?? (t.entries ? "ready" : "loading"), f = p === "error" ? void 0 : t.entries, c = p === "loading" || p !== "error" && !f, [r, l] = H(!1);
1573
- xe(() => l(!0), []);
1574
- let g = "";
1575
- c ? g = d("common.loading") : f && (g = f.length === 0 ? d(D("historyEmpty")) : d(D("historyLoaded"), { n: f.length }));
1576
- let w;
1577
- return p === "error" ? w = /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1578
- /* @__PURE__ */ e($, { variant: "error", children: /* @__PURE__ */ e($.Description, { children: ((v = t.message) == null ? void 0 : v.trim()) || d("emptyState.error.description") }) }),
1579
- i ? /* @__PURE__ */ e(
1580
- L,
1581
- {
1582
- intent: "outline",
1583
- "data-action": "retry-history",
1584
- onClick: () => i(),
1585
- children: d("emptyState.error.cta")
1586
- }
1587
- ) : null
1588
- ] }) : c || !f ? w = /* @__PURE__ */ e(
1589
- "div",
1590
- {
1591
- "aria-hidden": "true",
1592
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1593
- children: rn.slice(0, 3).map((N, a) => /* @__PURE__ */ h(
1594
- "div",
1595
- {
1596
- className: "ds:flex ds:items-start ds:gap-[var(--spacing-sm)]",
1597
- children: [
1598
- /* @__PURE__ */ e(
1599
- we,
1600
- {
1601
- variant: "circular",
1602
- stagger: a,
1603
- width: "var(--spacing-xl)",
1604
- height: "var(--spacing-xl)",
1605
- className: "ds:shrink-0"
1606
- }
1607
- ),
1608
- /* @__PURE__ */ e(
1609
- we,
1610
- {
1611
- variant: "rounded",
1612
- stagger: a,
1613
- width: N,
1614
- height: "var(--spacing-2xl)"
1615
- }
1616
- )
1617
- ]
1618
- },
1619
- N
1620
- ))
1621
- }
1622
- ) : w = /* @__PURE__ */ e(
1623
- va,
1624
- {
1625
- history: f,
1626
- locale: n,
1627
- noteUnrecordedEdits: o,
1628
- privacy: s
1629
- }
1630
- ), /* @__PURE__ */ h(ie, { children: [
1631
- /* @__PURE__ */ e("span", { role: "status", className: "ds:sr-only", children: r ? g : "" }),
1632
- w
1633
- ] });
1634
- }
1635
- function Ua({
1636
- read: t,
1637
- refreshing: n,
1638
- currency: i,
1639
- now: o,
1640
- locale: s,
1641
- shownTitle: d,
1642
- headingId: p,
1643
- enter: f,
1644
- live: c,
1645
- statusControl: r,
1646
- patientId: l = ((ze) => (ze = t.patient) == null ? void 0 : ze.id)(),
1647
- operator: g,
1648
- chair: w,
1649
- privacy: v = !1,
1650
- privacyTitle: N,
1651
- mapsLink: a,
1652
- notesPreview: m,
1653
- onOpenNotes: k,
1654
- history: b,
1655
- onOpenHistory: A,
1656
- noteUnrecordedEdits: T = !1,
1657
- readOnly: S = !1,
1658
- onStatusChange: y,
1659
- allowedStatuses: M = Ot,
1660
- onDescriptionChange: W,
1661
- onAssignPatient: se,
1662
- onEdit: re,
1663
- onMove: G,
1664
- onCopy: U,
1665
- onDelete: V,
1666
- onJoinTelehealth: X,
1667
- onWhatsApp: J,
1668
- whatsappUrl: Z,
1669
- onBuyWhatsApp: R,
1670
- createTaskUrl: ee,
1671
- onRequestSignature: te,
1672
- onSignOnDevice: Ie,
1673
- onOpenPatient: fe,
1674
- shortcuts: ne,
1675
- documents: oe
1676
- }) {
1677
- var Ct, Rt;
1678
- const { t: x } = B("ui"), { eventId: O } = t, [Qe] = H(f), he = { details: t, locale: s, currency: i }, E = b ? b.eventId !== void 0 && b.eventId !== O ? { status: "loading" } : b : t.history ? { entries: t.history } : void 0, He = (m == null ? void 0 : m.patientId) === void 0 || m.patientId === l, ge = m ? He ? m : l ? { notes: [], status: "loading", total: null } : void 0 : void 0, de = !!W && !S && !v, [Ae, ae] = H(!1), [Te, Q] = H(!1), le = Ae && E !== void 0, $e = Te && de, Ee = () => {
1679
- le || !E || (ae(!0), A == null || A(O));
1680
- }, Be = _({ history: !1, editor: !1 });
1681
- me(() => {
1682
- const I = Be.current;
1683
- Be.current = { history: le, editor: $e };
1684
- const ke = I.history && E === void 0, Pt = I.editor && !de;
1685
- ke && ae(!1), Pt && Q(!1), (ke || Pt) && _e(p);
1686
- });
1687
- const ve = _(null), F = _(!1), De = (E == null ? void 0 : E.status) ?? (E != null && E.entries ? "ready" : "loading");
1688
- me(() => {
1689
- F.current && (De !== "loading" && (F.current = !1), ft(ve.current));
1690
- }, [De]);
1691
- const [Y, Ce] = H(t.appointment.name ?? "");
1692
- xe(() => {
1693
- Ce(t.appointment.name ?? "");
1694
- }, [t.appointment.name]);
1695
- const [Re, ce] = H(""), [ye, Pe] = H(!1), [C, q] = H(), be = _(null);
1696
- xe(() => {
1697
- Te && (ce(Y), q(void 0));
1698
- }, [Te]);
1699
- const We = async () => {
1700
- if (!W) return;
1701
- const I = Re.trim();
1702
- Pe(!0), q(void 0);
1703
- try {
1704
- await W(I, O), Ce(I), Q(!1);
1705
- } catch (ke) {
1706
- q(
1707
- dt(ke, x(D("descriptionSaveFailed")))
1708
- );
1709
- } finally {
1710
- Pe(!1);
1711
- }
1712
- }, [j, Je] = H(t.appointment.status);
1713
- xe(() => {
1714
- Je(t.appointment.status);
1715
- }, [t.appointment.status]);
1716
- const Nt = _(n);
1717
- me(() => {
1718
- const I = Nt.current && !n;
1719
- Nt.current = n, I && (Je(t.appointment.status), Ce(t.appointment.name ?? ""));
1720
- }, [n]);
1721
- const Ue = Ot.filter(
1722
- (I) => M.includes(I)
1723
- ), Me = yt(j, {
1724
- statuses: Ue,
1725
- /* Shown so the control can say it, but not a choice. */
1726
- disabledStatuses: j && !Ue.includes(j) ? [j] : []
1727
- }), Le = !!y && !S && Ue.some((I) => I !== j), on = async (I) => {
1728
- if (!(!y || !bn(I))) {
1729
- try {
1730
- await y(I, O);
1731
- } catch (ke) {
1732
- throw new Error(dt(ke, x(D("statusSaveFailed"))));
1733
- }
1734
- Je(I);
1735
- }
1736
- }, xt = v ? void 0 : Z, St = Ha.filter(
1737
- (I) => oe == null ? void 0 : oe.kinds.includes(I)
1738
- ), dn = (((Ct = t.care) == null ? void 0 : Ct.lines.length) ?? 0) > 0, Ze = l !== void 0 && l !== "", et = x(D("status")), It = `${et}: ${Me.option.label}`, tt = _(null), At = _(Le);
1739
- me(() => {
1740
- const I = At.current && !Le;
1741
- At.current = Le, I && (tt.current ? ft(tt.current) : _e(p));
1742
- });
1743
- const Tt = Le ? /* @__PURE__ */ e(
1744
- yn,
1745
- {
1746
- ref: r,
1747
- value: Me.value,
1748
- options: Me.options,
1749
- size: "sm",
1750
- workflowLabel: et,
1751
- className: `ds:[&>button]:bg-[color:var(--background)] ${Fa}`,
1752
- "aria-label": It,
1753
- onValueChange: on
1754
- }
1755
- ) : j ? (
1756
- /* Named as the control is, "Status: Confirmed": the small display
1757
- prints the value alone. */
1758
- /* @__PURE__ */ e(
1759
- "div",
1760
- {
1761
- ref: tt,
1762
- role: "group",
1763
- "aria-label": It,
1764
- tabIndex: -1,
1765
- "data-status-display": "",
1766
- className: _a(),
1767
- children: /* @__PURE__ */ e(
1768
- Jt,
1769
- {
1770
- value: Me.value,
1771
- size: "sm",
1772
- workflowLabel: et,
1773
- option: Me.option
1774
- }
1775
- )
1776
- }
1777
- )
1778
- ) : null, z = [];
1779
- !S && se && !Ze && z.push([
1780
- "assign-patient",
1781
- /* @__PURE__ */ e(
1782
- L,
1783
- {
1784
- intent: "primary",
1785
- "data-action": "assign-patient",
1786
- className: K,
1787
- startIcon: /* @__PURE__ */ e($n, { "aria-hidden": "true" }),
1788
- onClick: () => se(O),
1789
- children: x("calendarWorkspace.inc1.bookings.assignPatient")
1790
- },
1791
- "assign"
1792
- )
1793
- ]), X && z.push([
1794
- "join-telehealth",
1795
- /* @__PURE__ */ e(
1796
- L,
1797
- {
1798
- intent: "primary",
1799
- "data-action": "join-telehealth",
1800
- className: K,
1801
- startIcon: /* @__PURE__ */ e(wt, { "aria-hidden": "true" }),
1802
- onClick: () => X(O),
1803
- children: x(D("joinTelehealth"))
1804
- },
1805
- "join"
1806
- )
1807
- ]), !S && re && z.push([
1808
- "edit-appointment",
1809
- /* @__PURE__ */ e(
1810
- L,
1811
- {
1812
- "data-action": "edit-appointment",
1813
- className: K,
1814
- startIcon: /* @__PURE__ */ e(Ne, { "aria-hidden": "true" }),
1815
- onClick: () => re(O),
1816
- children: x("calendarWorkspace.editor.editTitle")
1817
- },
1818
- "edit"
1819
- )
1820
- ]), !S && G && z.push([
1821
- "move-appointment",
1822
- /* @__PURE__ */ e(
1823
- L,
1824
- {
1825
- "data-action": "move-appointment",
1826
- className: K,
1827
- startIcon: /* @__PURE__ */ e(pt, { "aria-hidden": "true" }),
1828
- onClick: () => G(O),
1829
- children: x(D("move"))
1830
- },
1831
- "move"
1832
- )
1833
- ]), !S && U && z.push([
1834
- "copy-appointment",
1835
- dn ? /* @__PURE__ */ e(
1836
- Kt,
1837
- {
1838
- "data-action": "copy-appointment",
1839
- "data-overflow-tip": !1,
1840
- startIcon: /* @__PURE__ */ e($t, { "aria-hidden": "true" }),
1841
- overflowItems: [
1842
- {
1843
- label: x("calendarWorkspace.editor.duplicateAppointmentOnly"),
1844
- icon: /* @__PURE__ */ e(Bn, { "aria-hidden": "true" }),
1845
- action: "copy-appointment-only",
1846
- onSelect: () => U(!1, O)
1847
- },
1848
- {
1849
- label: x("calendarWorkspace.editor.duplicateWithTreatments"),
1850
- icon: /* @__PURE__ */ e(mt, { "aria-hidden": "true" }),
1851
- action: "copy-appointment-with-treatments",
1852
- onSelect: () => U(!0, O)
1853
- }
1854
- ],
1855
- children: x(D("copy"))
1856
- },
1857
- "copy"
1858
- ) : /* @__PURE__ */ e(
1859
- L,
1860
- {
1861
- "data-action": "copy-appointment",
1862
- className: K,
1863
- startIcon: /* @__PURE__ */ e($t, { "aria-hidden": "true" }),
1864
- onClick: () => U(!1, O),
1865
- children: x(D("copy"))
1866
- },
1867
- "copy"
1868
- )
1869
- ]), oe && St.length > 0 && z.push([
1870
- "open-create-document",
1871
- /* @__PURE__ */ e(
1872
- Kt,
1873
- {
1874
- "data-action": "open-create-document",
1875
- "data-overflow-tip": !1,
1876
- startIcon: /* @__PURE__ */ e(Wn, { "aria-hidden": "true" }),
1877
- overflowItems: St.map((I) => ({
1878
- label: x(D(`documents.${I}`)),
1879
- icon: $a[I],
1880
- action: `create-document-${I}`,
1881
- onSelect: () => oe.onCreate(I, O)
1882
- })),
1883
- children: x(D("documents.label"))
1884
- },
1885
- "documents"
1886
- )
1887
- ]), J ? z.push([
1888
- "open-whatsapp",
1889
- /* @__PURE__ */ e(
1890
- L,
1891
- {
1892
- "data-action": "open-whatsapp",
1893
- className: K,
1894
- startIcon: /* @__PURE__ */ e(st, { "aria-hidden": "true" }),
1895
- onClick: () => J(O),
1896
- children: x(D("remindWhatsApp"))
1897
- },
1898
- "whatsapp"
1899
- )
1900
- ]) : Ke(xt) ? z.push([
1901
- "open-whatsapp",
1902
- /* @__PURE__ */ e(
1903
- L,
1904
- {
1905
- asChild: !0,
1906
- "data-action": "open-whatsapp",
1907
- className: K,
1908
- startIcon: /* @__PURE__ */ e(st, { "aria-hidden": "true" }),
1909
- children: /* @__PURE__ */ e(
1910
- "a",
1911
- {
1912
- href: Ke(xt),
1913
- target: "_blank",
1914
- rel: "noopener noreferrer",
1915
- children: x(D("remindWhatsApp"))
1916
- }
1917
- )
1918
- },
1919
- "whatsapp"
1920
- )
1921
- ]) : R && !Z && z.push([
1922
- "buy-whatsapp",
1923
- /* @__PURE__ */ e(
1924
- L,
1925
- {
1926
- "data-action": "buy-whatsapp",
1927
- className: K,
1928
- startIcon: /* @__PURE__ */ e(st, { "aria-hidden": "true" }),
1929
- onClick: () => R(O),
1930
- children: x(D("buyWhatsApp"))
1931
- },
1932
- "buy-whatsapp"
1933
- )
1934
- ]);
1935
- const Et = Ke(ee);
1936
- Et && z.push([
1937
- "create-task",
1938
- /* @__PURE__ */ e(
1939
- L,
1940
- {
1941
- asChild: !0,
1942
- "data-action": "create-task",
1943
- className: K,
1944
- startIcon: /* @__PURE__ */ e(Un, { "aria-hidden": "true" }),
1945
- children: /* @__PURE__ */ e("a", { href: Et, children: x(D("createTask")) })
1946
- },
1947
- "task"
1948
- )
1949
- ]), !S && V && z.push([
1950
- "delete-appointment",
1951
- /* @__PURE__ */ e(
1952
- L,
1953
- {
1954
- intent: "destructiveOutline",
1955
- "data-action": "delete-appointment",
1956
- className: K,
1957
- startIcon: /* @__PURE__ */ e(Zt, { "aria-hidden": "true" }),
1958
- onClick: () => V(O),
1959
- children: x("calendarWorkspace.editor.delete")
1960
- },
1961
- "delete"
1962
- )
1963
- ]);
1964
- const nt = z.map(([, I]) => I);
1965
- c.current = {
1966
- status: j ?? null,
1967
- allowed: Le ? Ue : [],
1968
- offered: z.map(([I]) => I),
1969
- historyAvailable: E !== void 0,
1970
- historyOpen: le,
1971
- openHistory: Ee,
1972
- closeHistory: () => ae(!1)
1973
- };
1974
- const Dt = x(D("historyBack"));
1975
- return /* @__PURE__ */ e(
1976
- "div",
1977
- {
1978
- className: `ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ${Qe ? hn : ""}`,
1979
- children: /* @__PURE__ */ h(it.Host, { children: [
1980
- /* @__PURE__ */ e(
1981
- Vt,
1982
- {
1983
- title: d,
1984
- headingId: p,
1985
- icon: /* @__PURE__ */ e(bt, { "aria-hidden": "true" }),
1986
- sticky: !0,
1987
- divider: !0,
1988
- actions: E ? /* @__PURE__ */ e(
1989
- Yt,
1990
- {
1991
- size: "sm",
1992
- intent: "ghost",
1993
- icon: /* @__PURE__ */ e(Ht, { "aria-hidden": "true" }),
1994
- "aria-label": x(D("historyAction")),
1995
- tooltip: x(D("historyAction")),
1996
- "data-action": "open-history",
1997
- onClick: Ee
1998
- }
1999
- ) : void 0
2000
- }
2001
- ),
2002
- /* @__PURE__ */ e(
2003
- "div",
2004
- {
2005
- tabIndex: 0,
2006
- "aria-busy": n || void 0,
2007
- className: "ds:[min-block-size:0] ds:flex-1 ds:overflow-y-auto",
2008
- children: /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
2009
- v ? /* @__PURE__ */ e(pn, { mask: N }) : t.patient ? /* @__PURE__ */ e(
2010
- Ca,
2011
- {
2012
- ...he,
2013
- now: o,
2014
- mapsLink: a,
2015
- shortcuts: ne,
2016
- onRequestSignature: te,
2017
- onSignOnDevice: Ie,
2018
- onOpenPatient: fe
2019
- }
2020
- ) : (
2021
- /* No patient card to carry the identity: a patient-less, an
2022
- unassigned or an unresolved booking keeps the strip. */
2023
- /* @__PURE__ */ e(
2024
- ka,
2025
- {
2026
- name: t.appointment.title.trim() ? t.appointment.title : x(D("patientNotLoaded")),
2027
- unresolved: Ze,
2028
- status: j,
2029
- flags: {
2030
- isTelehealth: t.appointment.isTelehealth,
2031
- isBookedOnline: t.appointment.bookedOnline,
2032
- isRecurring: t.appointment.recurrence !== void 0,
2033
- hasUnassignedPatient: t.appointment.bookedOnline && !Ze,
2034
- hasHighlightedAnamnesis: !1,
2035
- hasBillableAmount: (((Rt = t.money) == null ? void 0 : Rt.billableAmount) ?? 0) > 0
2036
- },
2037
- locale: s
2038
- }
2039
- )
2040
- ),
2041
- /* @__PURE__ */ e(
2042
- Ra,
2043
- {
2044
- ...he,
2045
- operator: g,
2046
- chair: w,
2047
- privacy: v,
2048
- history: (E == null ? void 0 : E.status) === "error" || E == null ? void 0 : E.entries,
2049
- description: (
2050
- /* Not keyed on the text: the pencil must survive a save,
2051
- so the sub-view can hand focus back to it. An empty
2052
- read-only description prints nothing. Privacy hides the
2053
- text and the pencil. */
2054
- v ? Y ? /* @__PURE__ */ e(Lt, { block: "description" }) : void 0 : Y || W && !S ? /* @__PURE__ */ e(
2055
- Gt,
2056
- {
2057
- "data-block": "description",
2058
- role: "group",
2059
- "aria-label": x("calendarWorkspace.editor.description"),
2060
- value: Y,
2061
- editLabel: x(D("editDescription")),
2062
- onEdit: W && !S ? () => Q(!0) : void 0
2063
- }
2064
- ) : void 0
2065
- )
2066
- }
2067
- ),
2068
- ge && v ? /* @__PURE__ */ e(
2069
- pe,
2070
- {
2071
- "data-card": "notes",
2072
- title: x("notesPanel.title"),
2073
- headingLevel: 3,
2074
- children: /* @__PURE__ */ e(Lt, {})
2075
- }
2076
- ) : ge ? /* @__PURE__ */ e(
2077
- Ma,
2078
- {
2079
- preview: ge,
2080
- onOpenNotes: He ? k : void 0,
2081
- locale: s
2082
- }
2083
- ) : null,
2084
- /* @__PURE__ */ e(
2085
- Pa,
2086
- {
2087
- ...he,
2088
- privacy: v,
2089
- carePlanUrl: ne == null ? void 0 : ne.carePlanUrl
2090
- }
2091
- )
2092
- ] })
2093
- }
2094
- ),
2095
- Tt || nt.length > 0 ? (
2096
- /* The body scrolls; the status and the actions stay put. The
2097
- status keeps its own segment and never folds. The actions fold
2098
- to icons, then into More, never onto a second line. */
2099
- /* @__PURE__ */ h("div", { className: Oa(), children: [
2100
- Tt,
2101
- nt.length > 0 ? /* @__PURE__ */ e(
2102
- fn,
2103
- {
2104
- label: x(D("actionsLabel")),
2105
- overflow: "menu",
2106
- collapseToIcons: !0,
2107
- background: "surface",
2108
- size: "sm",
2109
- className: `ds:min-w-0 ds:flex-1 ds:text-end ${za}`,
2110
- children: nt
2111
- }
2112
- ) : null
2113
- ] })
2114
- ) : null,
2115
- E ? /* @__PURE__ */ e(
2116
- it,
2117
- {
2118
- ref: ve,
2119
- open: le,
2120
- icon: /* @__PURE__ */ e(Ht, { "aria-hidden": "true" }),
2121
- title: x(D("historyTitle")),
2122
- backLabel: Dt,
2123
- headingLevel: 3,
2124
- onBack: () => ae(!1),
2125
- "data-details-subview": "history",
2126
- children: /* @__PURE__ */ e("div", { className: "ds:-m-[var(--panel-subview-inset)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ e(
2127
- Wa,
2128
- {
2129
- history: E,
2130
- locale: s,
2131
- noteUnrecordedEdits: T,
2132
- privacy: v,
2133
- onRetry: E.onRetry ? () => {
2134
- var I;
2135
- F.current = !0, (I = E.onRetry) == null || I.call(E);
2136
- } : void 0
2137
- }
2138
- ) })
2139
- }
2140
- ) : null,
2141
- de ? /* @__PURE__ */ e(
2142
- it,
2143
- {
2144
- open: $e,
2145
- icon: /* @__PURE__ */ e(Ne, { "aria-hidden": "true" }),
2146
- title: x(D("editDescription")),
2147
- backLabel: Dt,
2148
- headingLevel: 3,
2149
- initialFocusRef: be,
2150
- onBack: () => {
2151
- ye || Q(!1);
2152
- },
2153
- "data-details-subview": "description",
2154
- footer: /* @__PURE__ */ h(ie, { children: [
2155
- /* @__PURE__ */ e(
2156
- L,
2157
- {
2158
- intent: "secondary",
2159
- disabled: ye,
2160
- onClick: () => Q(!1),
2161
- children: x(D("noteCancel"))
2162
- }
2163
- ),
2164
- /* @__PURE__ */ e(
2165
- L,
2166
- {
2167
- intent: "primary",
2168
- "data-action": "save-description",
2169
- loading: ye,
2170
- onClick: () => void We(),
2171
- children: x(D("descriptionSave"))
2172
- }
2173
- )
2174
- ] }),
2175
- children: /* @__PURE__ */ h("div", { className: "ds:-m-[var(--panel-subview-inset)] ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
2176
- C ? /* @__PURE__ */ e($, { variant: "error", children: /* @__PURE__ */ e($.Description, { children: C }) }) : null,
2177
- /* @__PURE__ */ e(
2178
- gn,
2179
- {
2180
- ref: be,
2181
- value: Re,
2182
- minRows: 6,
2183
- autoResize: !0,
2184
- "aria-label": x("calendarWorkspace.editor.description"),
2185
- onChange: (I) => ce(I.target.value)
2186
- }
2187
- )
2188
- ] })
2189
- }
2190
- ) : null
2191
- ] })
2192
- }
2193
- );
2194
- }
2195
- const qa = ln(function({
2196
- state: n,
2197
- onRetry: i,
2198
- patientId: o,
2199
- operator: s,
2200
- chair: d,
2201
- currency: p = "EUR",
2202
- now: f,
2203
- locale: c,
2204
- title: r,
2205
- privacy: l = !1,
2206
- privacyTitle: g,
2207
- mapsLink: w,
2208
- notesPreview: v,
2209
- onOpenNotes: N,
2210
- history: a,
2211
- onOpenHistory: m,
2212
- noteUnrecordedEdits: k,
2213
- readOnly: b = !1,
2214
- onStatusChange: A,
2215
- allowedStatuses: T,
2216
- onDescriptionChange: S,
2217
- onAssignPatient: y,
2218
- onEdit: M,
2219
- onMove: W,
2220
- onCopy: se,
2221
- onDelete: re,
2222
- onJoinTelehealth: G,
2223
- onWhatsApp: U,
2224
- whatsappUrl: V,
2225
- onBuyWhatsApp: X,
2226
- createTaskUrl: J,
2227
- onRequestSignature: Z,
2228
- onSignOnDevice: R,
2229
- onOpenPatient: ee,
2230
- shortcuts: te,
2231
- documents: Ie,
2232
- id: fe,
2233
- className: ne,
2234
- ...oe
2235
- }, ze) {
2236
- var ye, Pe;
2237
- const { t: x, i18n: O } = B("ui"), Qe = ot(), he = fe ?? Qe, E = ot(), He = c ?? O.language, ge = !l && (r != null && r.trim()) ? r : x(D("region")), de = n.status === "ready" ? n.read : void 0, Ae = n.status === "ready" ? n.read.eventId : n.eventId, ae = _(
2238
- void 0
2239
- ), Te = ae.current !== void 0 && ae.current !== "ready";
2240
- xe(() => {
2241
- ae.current = n.status;
2242
- }, [n.status]);
2243
- const Q = !!i && (n.status === "error" || n.status === "refused" && n.retryable === !0), le = _(null), $e = Mt(() => mn(ze, le), [ze]), Ee = _(!1);
2244
- typeof document < "u" && (Ee.current = ((ye = le.current) == null ? void 0 : ye.contains(document.activeElement)) ?? !1);
2245
- const Be = de ? `ready:${de.eventId}` : n.status, ve = _(!1);
2246
- me(() => {
2247
- ve.current ? (n.status !== "loading" && (ve.current = !1), _e(E)) : Ee.current && _e(E);
2248
- }, [Be, E]);
2249
- const F = _(null);
2250
- de || (F.current = null);
2251
- const De = _(null), Y = _({ state: n, eventId: Ae, privacy: l, retryOffered: Q, onRetry: i });
2252
- Y.current = { state: n, eventId: Ae, privacy: l, retryOffered: Q, onRetry: i };
2253
- const Ce = Mt(
2254
- () => ({
2255
- getEventId: () => Y.current.eventId ?? null,
2256
- getLoadStatus: () => Y.current.state.status,
2257
- getAppointmentStatus: () => {
2258
- var C;
2259
- return ((C = F.current) == null ? void 0 : C.status) ?? null;
2260
- },
2261
- getAllowedStatuses: () => {
2262
- var C;
2263
- return [...((C = F.current) == null ? void 0 : C.allowed) ?? []];
2264
- },
2265
- getOfferedActions: () => {
2266
- var C;
2267
- return [...((C = F.current) == null ? void 0 : C.offered) ?? []];
2268
- },
2269
- isHistoryOpen: () => {
2270
- var C;
2271
- return ((C = F.current) == null ? void 0 : C.historyOpen) ?? !1;
2272
- },
2273
- isPrivacy: () => Y.current.privacy,
2274
- openHistory: () => {
2275
- var C;
2276
- if (!((C = F.current) != null && C.historyAvailable))
2277
- throw new Error("AppointmentDetailsPanel: History is not offered.");
2278
- F.current.openHistory();
2279
- },
2280
- closeHistory: () => {
2281
- var C;
2282
- (C = F.current) == null || C.closeHistory();
2283
- },
2284
- setAppointmentStatus: (C) => {
2285
- const q = F.current, be = De.current;
2286
- if (!q || !be || q.allowed.length === 0)
2287
- return at(
2288
- new Error("AppointmentDetailsPanel: the status is read-only.")
2289
- );
2290
- if (C === q.status) return Promise.resolve();
2291
- if (!q.allowed.includes(C))
2292
- return at(
2293
- new Error(`AppointmentDetailsPanel: "${C}" is not allowed.`)
2294
- );
2295
- const We = () => at(
2296
- new Error("AppointmentDetailsPanel: a status save is in flight.")
2297
- );
2298
- if (be.getIsSaving()) return We();
2299
- const j = be.setValue(C);
2300
- return j === void 0 ? We() : j;
2301
- },
2302
- retry: () => {
2303
- const { retryOffered: C, onRetry: q } = Y.current;
2304
- if (!C || !q)
2305
- throw new Error("AppointmentDetailsPanel: Retry is not offered.");
2306
- q();
2307
- }
2308
- }),
2309
- []
2310
- );
2311
- un(aa, Ce, he);
2312
- const Re = /* @__PURE__ */ e(
2313
- Vt,
2314
- {
2315
- title: ge,
2316
- headingId: E,
2317
- icon: /* @__PURE__ */ e(bt, { "aria-hidden": "true" }),
2318
- sticky: !0,
2319
- divider: !0
2320
- }
2321
- );
2322
- let ce;
2323
- return n.status === "ready" ? ce = /* @__PURE__ */ e(
2324
- Ua,
2325
- {
2326
- read: n.read,
2327
- refreshing: n.refreshing === !0,
2328
- currency: p,
2329
- now: f ?? /* @__PURE__ */ new Date(),
2330
- locale: He,
2331
- shownTitle: ge,
2332
- headingId: E,
2333
- enter: Te,
2334
- live: F,
2335
- statusControl: De,
2336
- patientId: o,
2337
- operator: s,
2338
- chair: d,
2339
- privacy: l,
2340
- privacyTitle: g,
2341
- mapsLink: w,
2342
- notesPreview: v,
2343
- onOpenNotes: N,
2344
- history: a,
2345
- onOpenHistory: m,
2346
- noteUnrecordedEdits: k,
2347
- readOnly: b,
2348
- onStatusChange: A,
2349
- allowedStatuses: T,
2350
- onDescriptionChange: S,
2351
- onAssignPatient: y,
2352
- onEdit: M,
2353
- onMove: W,
2354
- onCopy: se,
2355
- onDelete: re,
2356
- onJoinTelehealth: G,
2357
- onWhatsApp: U,
2358
- whatsappUrl: V,
2359
- onBuyWhatsApp: X,
2360
- createTaskUrl: J,
2361
- onRequestSignature: Z,
2362
- onSignOnDevice: R,
2363
- onOpenPatient: ee,
2364
- shortcuts: te,
2365
- documents: Ie
2366
- },
2367
- n.read.eventId
2368
- ) : n.status === "loading" ? ce = /* @__PURE__ */ h(ie, { children: [
2369
- Re,
2370
- /* @__PURE__ */ e(Ba, {})
2371
- ] }) : ce = /* @__PURE__ */ h(ie, { children: [
2372
- Re,
2373
- /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
2374
- /* @__PURE__ */ e($, { variant: n.status === "error" ? "error" : "warning", children: /* @__PURE__ */ e($.Description, { children: n.status === "error" ? ((Pe = n.message) == null ? void 0 : Pe.trim()) || x("emptyState.error.description") : n.reason }) }),
2375
- Q ? /* @__PURE__ */ e(
2376
- L,
2377
- {
2378
- intent: "outline",
2379
- "data-action": "retry-load",
2380
- onClick: () => {
2381
- ve.current = !0, i == null || i();
2382
- },
2383
- children: x("emptyState.error.cta")
2384
- }
2385
- ) : null
2386
- ] })
2387
- ] }), /* @__PURE__ */ e(
2388
- "div",
2389
- {
2390
- ref: $e,
2391
- id: fe,
2392
- "data-component": "appointment-details-panel",
2393
- "data-component-id": he,
2394
- "data-event-id": Ae,
2395
- "data-status": n.status,
2396
- "aria-busy": n.status === "loading" || void 0,
2397
- className: La({ className: ne }),
2398
- ...oe,
2399
- children: ce
2400
- }
2401
- );
2402
- });
2403
- qa.displayName = "AppointmentDetailsPanel";
2404
- function fs({
2405
- eventId: t,
2406
- load: n,
2407
- reloadKey: i
2408
- }) {
2409
- const { t: o } = B("ui"), s = _("");
2410
- s.current = o("emptyState.error.description");
2411
- const d = _(n);
2412
- me(() => {
2413
- d.current = n;
2414
- });
2415
- const [p, f] = H(0), [c, r] = H(), l = JSON.stringify([i ?? null, p]), [g, w] = H({ eventId: t, count: 0 }), v = g.eventId === t ? g.count : g.count + 1;
2416
- g.eventId !== t && w({ eventId: t, count: v }), xe(() => {
2417
- if (t === null) {
2418
- r(void 0);
2419
- return;
2420
- }
2421
- const k = new AbortController(), b = (A) => {
2422
- k.signal.aborted || r({ eventId: t, selection: v, request: l, value: A });
2423
- };
2424
- return Promise.resolve().then(() => d.current(t, { signal: k.signal })).then((A) => {
2425
- var T, S;
2426
- if (A.status !== "ready") {
2427
- b({
2428
- status: "refused",
2429
- eventId: t,
2430
- reason: A.reason,
2431
- retryable: A.retryable
2432
- });
2433
- return;
2434
- }
2435
- if (((T = A.details) == null ? void 0 : T.eventId) !== t || !oa((S = A.details.appointment) == null ? void 0 : S.startIso))
2436
- throw new Error(s.current);
2437
- b({ status: "ready", read: A.details });
2438
- }).catch((A) => {
2439
- b({
2440
- status: "error",
2441
- eventId: t,
2442
- message: dt(A, s.current)
2443
- });
2444
- }), () => k.abort();
2445
- }, [t, v, l]);
2446
- const N = cn(() => f((k) => k + 1), []);
2447
- if (t === null) return { state: null, retry: N };
2448
- const a = (c == null ? void 0 : c.eventId) === t && c.selection === v ? c : void 0;
2449
- let m = { status: "loading", eventId: t };
2450
- return (a == null ? void 0 : a.request) === l ? m = a.value : (a == null ? void 0 : a.value.status) === "ready" && (m = { status: "ready", read: a.value.read, refreshing: !0 }), { state: m, retry: N };
2451
- }
2452
- export {
2453
- qa as A,
2454
- $t as C,
2455
- ue as D,
2456
- ba as I,
2457
- pt as M,
2458
- la as R,
2459
- aa as a,
2460
- Fe as b,
2461
- sa as c,
2462
- ca as d,
2463
- ya as e,
2464
- Ge as f,
2465
- va as g,
2466
- ht as h,
2467
- tn as i,
2468
- ua as j,
2469
- ma as k,
2470
- ka as l,
2471
- ia as m,
2472
- oa as p,
2473
- da as s,
2474
- fs as u
2475
- };
2476
- //# sourceMappingURL=use-appointment-details-read-7J0j1FP7.js.map