@alfadocs/ui-kit-debug 1.75.1 → 1.77.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 (200) hide show
  1. package/dist/_chunks/{balance-badge-cell-B49xgL6H.js → balance-badge-cell-Dzd-Z_5W.js} +2 -2
  2. package/dist/_chunks/{balance-badge-cell-B49xgL6H.js.map → balance-badge-cell-Dzd-Z_5W.js.map} +1 -1
  3. package/dist/_chunks/booking-Cz_QjIJe.js +4051 -0
  4. package/dist/_chunks/booking-Cz_QjIJe.js.map +1 -0
  5. package/dist/_chunks/{breadcrumb-Boan-5n8.js → breadcrumb-Bn29NCnf.js} +8 -8
  6. package/dist/_chunks/breadcrumb-Bn29NCnf.js.map +1 -0
  7. package/dist/_chunks/{calendar-appointment-editor-dialog-B4My4eiB.js → calendar-appointment-editor-dialog-cvUpUjj-.js} +4 -4
  8. package/dist/_chunks/{calendar-appointment-editor-dialog-B4My4eiB.js.map → calendar-appointment-editor-dialog-cvUpUjj-.js.map} +1 -1
  9. package/dist/_chunks/{control-room-rail-CKZ2nemY.js → control-room-rail-DcJpHbp4.js} +2 -2
  10. package/dist/_chunks/{control-room-rail-CKZ2nemY.js.map → control-room-rail-DcJpHbp4.js.map} +1 -1
  11. package/dist/_chunks/{data-table-DTKGWUQm.js → data-table-BlONA1rP.js} +2 -2
  12. package/dist/_chunks/{data-table-DTKGWUQm.js.map → data-table-BlONA1rP.js.map} +1 -1
  13. package/dist/_chunks/{file-manager-Ct5QpZZI.js → file-manager-C9iJjDZt.js} +3 -3
  14. package/dist/_chunks/{file-manager-Ct5QpZZI.js.map → file-manager-C9iJjDZt.js.map} +1 -1
  15. package/dist/_chunks/{header-settings-Coh1r41O.js → header-settings-BYpVmLip.js} +2 -2
  16. package/dist/_chunks/{header-settings-Coh1r41O.js.map → header-settings-BYpVmLip.js.map} +1 -1
  17. package/dist/_chunks/{heatmap-Ba9cgfSY.js → heatmap-C2Rg-SV_.js} +2 -2
  18. package/dist/_chunks/{heatmap-Ba9cgfSY.js.map → heatmap-C2Rg-SV_.js.map} +1 -1
  19. package/dist/_chunks/{marketplace-app-shell-Ck5NVJcO.js → marketplace-app-shell-mS7Q2-81.js} +3 -3
  20. package/dist/_chunks/{marketplace-app-shell-Ck5NVJcO.js.map → marketplace-app-shell-mS7Q2-81.js.map} +1 -1
  21. package/dist/_chunks/{notes-panel-CxjMovCh.js → notes-panel-CZO1qsD-.js} +2 -2
  22. package/dist/_chunks/{notes-panel-CxjMovCh.js.map → notes-panel-CZO1qsD-.js.map} +1 -1
  23. package/dist/_chunks/{otp-input-CGMu30_e.js → otp-input-BgEZi0py.js} +54 -53
  24. package/dist/_chunks/otp-input-BgEZi0py.js.map +1 -0
  25. package/dist/_chunks/{practice-results-B4Z5q46r.js → practice-results-By2BZFCz.js} +820 -783
  26. package/dist/_chunks/practice-results-By2BZFCz.js.map +1 -0
  27. package/dist/_chunks/{recaptcha-widget-CsvwlYTE.js → recaptcha-widget-iglUBIF3.js} +2 -2
  28. package/dist/_chunks/{recaptcha-widget-CsvwlYTE.js.map → recaptcha-widget-iglUBIF3.js.map} +1 -1
  29. package/dist/_chunks/{registration-form-DeK2QiJu.js → registration-form-xORq2s4p.js} +3 -3
  30. package/dist/_chunks/{registration-form-DeK2QiJu.js.map → registration-form-xORq2s4p.js.map} +1 -1
  31. package/dist/_chunks/signature-request-DjY-X62H.js +2448 -0
  32. package/dist/_chunks/signature-request-DjY-X62H.js.map +1 -0
  33. package/dist/_chunks/{tasks-panel-Cmr0oMvc.js → tasks-panel-BkjtgjQ8.js} +2 -2
  34. package/dist/_chunks/{tasks-panel-Cmr0oMvc.js.map → tasks-panel-BkjtgjQ8.js.map} +1 -1
  35. package/dist/_chunks/{theme-toggle-DTrUzIBG.js → theme-toggle-DKpzb0-M.js} +2 -2
  36. package/dist/_chunks/{theme-toggle-DTrUzIBG.js.map → theme-toggle-DKpzb0-M.js.map} +1 -1
  37. package/dist/_chunks/{tool-rail-C_9lm0TC.js → tool-rail-Kup1b7xI.js} +2 -2
  38. package/dist/_chunks/{tool-rail-C_9lm0TC.js.map → tool-rail-Kup1b7xI.js.map} +1 -1
  39. package/dist/_chunks/use-theme-CYGyzFgZ.js +196 -0
  40. package/dist/_chunks/use-theme-CYGyzFgZ.js.map +1 -0
  41. package/dist/agent-catalog.json +46 -10
  42. package/dist/agent-i18n/en.json +5 -4
  43. package/dist/components/booking/booking-types.d.ts +22 -1
  44. package/dist/components/booking/booking-types.d.ts.map +1 -1
  45. package/dist/components/booking/booking.agent.d.ts.map +1 -1
  46. package/dist/components/booking/booking.d.ts +1 -1
  47. package/dist/components/booking/booking.d.ts.map +1 -1
  48. package/dist/components/booking/code-step.d.ts +6 -0
  49. package/dist/components/booking/code-step.d.ts.map +1 -0
  50. package/dist/components/booking/index.d.ts +1 -1
  51. package/dist/components/booking/index.d.ts.map +1 -1
  52. package/dist/components/booking/index.js +1 -1
  53. package/dist/components/booking/step-focus.d.ts +9 -0
  54. package/dist/components/booking/step-focus.d.ts.map +1 -0
  55. package/dist/components/booking/use-booking-payment.d.ts +6 -3
  56. package/dist/components/booking/use-booking-payment.d.ts.map +1 -1
  57. package/dist/components/breadcrumb/index.js +1 -1
  58. package/dist/components/control-room-rail/index.js +1 -1
  59. package/dist/components/data-table/index.js +1 -1
  60. package/dist/components/file-manager/index.js +1 -1
  61. package/dist/components/header-settings/index.js +1 -1
  62. package/dist/components/heatmap/index.js +1 -1
  63. package/dist/components/index.d.ts +1 -1
  64. package/dist/components/index.d.ts.map +1 -1
  65. package/dist/components/notes-panel/index.js +1 -1
  66. package/dist/components/otp-input/index.js +1 -1
  67. package/dist/components/otp-input/otp-input.d.ts +1 -0
  68. package/dist/components/otp-input/otp-input.d.ts.map +1 -1
  69. package/dist/components/patient-table/index.js +1 -1
  70. package/dist/components/practice-results/index.d.ts +1 -1
  71. package/dist/components/practice-results/index.d.ts.map +1 -1
  72. package/dist/components/practice-results/index.js +1 -1
  73. package/dist/components/practice-results/practice-results.agent.d.ts.map +1 -1
  74. package/dist/components/practice-results/practice-results.d.ts +4 -0
  75. package/dist/components/practice-results/practice-results.d.ts.map +1 -1
  76. package/dist/components/recaptcha-widget/index.js +1 -1
  77. package/dist/components/tasks-panel/index.js +1 -1
  78. package/dist/components/theme-toggle/index.js +1 -1
  79. package/dist/components/tool-rail/index.js +1 -1
  80. package/dist/hooks/index.d.ts +1 -1
  81. package/dist/hooks/index.d.ts.map +1 -1
  82. package/dist/hooks/index.js +88 -86
  83. package/dist/hooks/use-theme.d.ts +9 -0
  84. package/dist/hooks/use-theme.d.ts.map +1 -1
  85. package/dist/host-compat.css +4 -1
  86. package/dist/i18n/locales/ar.d.ts +29 -0
  87. package/dist/i18n/locales/ar.d.ts.map +1 -1
  88. package/dist/i18n/locales/ar.js +30 -1
  89. package/dist/i18n/locales/ar.js.map +1 -1
  90. package/dist/i18n/locales/de.d.ts +29 -0
  91. package/dist/i18n/locales/de.d.ts.map +1 -1
  92. package/dist/i18n/locales/de.js +30 -1
  93. package/dist/i18n/locales/de.js.map +1 -1
  94. package/dist/i18n/locales/el.d.ts +29 -0
  95. package/dist/i18n/locales/el.d.ts.map +1 -1
  96. package/dist/i18n/locales/el.js +30 -1
  97. package/dist/i18n/locales/el.js.map +1 -1
  98. package/dist/i18n/locales/en.d.ts +29 -0
  99. package/dist/i18n/locales/en.d.ts.map +1 -1
  100. package/dist/i18n/locales/en.js +30 -1
  101. package/dist/i18n/locales/en.js.map +1 -1
  102. package/dist/i18n/locales/es.d.ts +29 -0
  103. package/dist/i18n/locales/es.d.ts.map +1 -1
  104. package/dist/i18n/locales/es.js +30 -1
  105. package/dist/i18n/locales/es.js.map +1 -1
  106. package/dist/i18n/locales/fr.d.ts +29 -0
  107. package/dist/i18n/locales/fr.d.ts.map +1 -1
  108. package/dist/i18n/locales/fr.js +30 -1
  109. package/dist/i18n/locales/fr.js.map +1 -1
  110. package/dist/i18n/locales/hi.d.ts +29 -0
  111. package/dist/i18n/locales/hi.d.ts.map +1 -1
  112. package/dist/i18n/locales/hi.js +30 -1
  113. package/dist/i18n/locales/hi.js.map +1 -1
  114. package/dist/i18n/locales/it.d.ts +29 -0
  115. package/dist/i18n/locales/it.d.ts.map +1 -1
  116. package/dist/i18n/locales/it.js +30 -1
  117. package/dist/i18n/locales/it.js.map +1 -1
  118. package/dist/i18n/locales/ja.d.ts +29 -0
  119. package/dist/i18n/locales/ja.d.ts.map +1 -1
  120. package/dist/i18n/locales/ja.js +30 -1
  121. package/dist/i18n/locales/ja.js.map +1 -1
  122. package/dist/i18n/locales/nl.d.ts +29 -0
  123. package/dist/i18n/locales/nl.d.ts.map +1 -1
  124. package/dist/i18n/locales/nl.js +30 -1
  125. package/dist/i18n/locales/nl.js.map +1 -1
  126. package/dist/i18n/locales/pl.d.ts +29 -0
  127. package/dist/i18n/locales/pl.d.ts.map +1 -1
  128. package/dist/i18n/locales/pl.js +30 -1
  129. package/dist/i18n/locales/pl.js.map +1 -1
  130. package/dist/i18n/locales/pt.d.ts +29 -0
  131. package/dist/i18n/locales/pt.d.ts.map +1 -1
  132. package/dist/i18n/locales/pt.js +30 -1
  133. package/dist/i18n/locales/pt.js.map +1 -1
  134. package/dist/i18n/locales/ro.d.ts +29 -0
  135. package/dist/i18n/locales/ro.d.ts.map +1 -1
  136. package/dist/i18n/locales/ro.js +30 -1
  137. package/dist/i18n/locales/ro.js.map +1 -1
  138. package/dist/i18n/locales/ru.d.ts +29 -0
  139. package/dist/i18n/locales/ru.d.ts.map +1 -1
  140. package/dist/i18n/locales/ru.js +30 -1
  141. package/dist/i18n/locales/ru.js.map +1 -1
  142. package/dist/i18n/locales/sq.d.ts +29 -0
  143. package/dist/i18n/locales/sq.d.ts.map +1 -1
  144. package/dist/i18n/locales/sq.js +30 -1
  145. package/dist/i18n/locales/sq.js.map +1 -1
  146. package/dist/i18n/locales/sv.d.ts +29 -0
  147. package/dist/i18n/locales/sv.d.ts.map +1 -1
  148. package/dist/i18n/locales/sv.js +30 -1
  149. package/dist/i18n/locales/sv.js.map +1 -1
  150. package/dist/i18n/locales/tr.d.ts +29 -0
  151. package/dist/i18n/locales/tr.d.ts.map +1 -1
  152. package/dist/i18n/locales/tr.js +30 -1
  153. package/dist/i18n/locales/tr.js.map +1 -1
  154. package/dist/i18n/locales/zh.d.ts +29 -0
  155. package/dist/i18n/locales/zh.d.ts.map +1 -1
  156. package/dist/i18n/locales/zh.js +30 -1
  157. package/dist/i18n/locales/zh.js.map +1 -1
  158. package/dist/index.js +1209 -1207
  159. package/dist/locales/ar.json +30 -1
  160. package/dist/locales/de.json +30 -1
  161. package/dist/locales/el.json +30 -1
  162. package/dist/locales/en.json +30 -1
  163. package/dist/locales/es.json +30 -1
  164. package/dist/locales/fr.json +30 -1
  165. package/dist/locales/hi.json +30 -1
  166. package/dist/locales/it.json +30 -1
  167. package/dist/locales/ja.json +30 -1
  168. package/dist/locales/nl.json +30 -1
  169. package/dist/locales/pl.json +30 -1
  170. package/dist/locales/pt.json +30 -1
  171. package/dist/locales/ro.json +30 -1
  172. package/dist/locales/ru.json +30 -1
  173. package/dist/locales/sq.json +30 -1
  174. package/dist/locales/sv.json +30 -1
  175. package/dist/locales/tr.json +30 -1
  176. package/dist/locales/zh.json +30 -1
  177. package/dist/patterns/calendar/index.js +1 -1
  178. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  179. package/dist/patterns/registration-form/index.js +1 -1
  180. package/dist/patterns/signature-request/channel-meta.d.ts +8 -2
  181. package/dist/patterns/signature-request/channel-meta.d.ts.map +1 -1
  182. package/dist/patterns/signature-request/index.js +1 -1
  183. package/dist/patterns/signature-request/minor-patient.d.ts +41 -0
  184. package/dist/patterns/signature-request/minor-patient.d.ts.map +1 -0
  185. package/dist/patterns/signature-request/required-documents.d.ts +4 -3
  186. package/dist/patterns/signature-request/required-documents.d.ts.map +1 -1
  187. package/dist/patterns/signature-request/signature-request.d.ts +62 -12
  188. package/dist/patterns/signature-request/signature-request.d.ts.map +1 -1
  189. package/dist/theme-boot.js +26 -0
  190. package/dist/tokens.css +1 -1
  191. package/package.json +4 -2
  192. package/dist/_chunks/booking-D2r19Lia.js +0 -3901
  193. package/dist/_chunks/booking-D2r19Lia.js.map +0 -1
  194. package/dist/_chunks/breadcrumb-Boan-5n8.js.map +0 -1
  195. package/dist/_chunks/otp-input-CGMu30_e.js.map +0 -1
  196. package/dist/_chunks/practice-results-B4Z5q46r.js.map +0 -1
  197. package/dist/_chunks/signature-request-ldmXj2X6.js +0 -2221
  198. package/dist/_chunks/signature-request-ldmXj2X6.js.map +0 -1
  199. package/dist/_chunks/use-theme-CAuo6EYT.js +0 -159
  200. package/dist/_chunks/use-theme-CAuo6EYT.js.map +0 -1
@@ -1,2221 +0,0 @@
1
- import { jsx as n, jsxs as h, Fragment as we } from "react/jsx-runtime";
2
- import { useState as L, useRef as ge, useEffect as Ee, useId as j, forwardRef as ga } from "react";
3
- import { useTranslation as fn } from "react-i18next";
4
- import { D as S } from "./dialog-C7RWaH08.js";
5
- import { Q as fa } from "./qr-code-DHEma21c.js";
6
- import { S as va } from "./spinner-CoflYlEx.js";
7
- import { B as F } from "./button-DohK_Ak_.js";
8
- import { I as gn } from "./icon-button-S8_weU3g.js";
9
- import { s as ba, S as Ae } from "./select-4S-eYZUf.js";
10
- import { S as ct } from "./switch-D--x7n6h.js";
11
- import { A as K } from "./alert-9kEwDza3.js";
12
- import { S as dt } from "./separator-CYU_bGFn.js";
13
- import { A as ut } from "./avatar-BPiPL7ND.js";
14
- import { a as St, T as It } from "./tooltip-uEBdD1-5.js";
15
- import { a as kt } from "./whatsapp-button-DV9JFmtq.js";
16
- import { c as An } from "./createLucideIcon-DhHxpK9K.js";
17
- import { M as Ot } from "./mail-BqXVF2zH.js";
18
- import { M as xa } from "./message-square-Bye4ATvx.js";
19
- import { S as Pe } from "./skeleton-tTWJpvAq.js";
20
- import { D as tn } from "./dropdown-menu-D1we7oAY.js";
21
- import { S as Ra } from "./signature-status-chip-pIoQjvH8.js";
22
- import { C as Na } from "./chevron-down-DWE7GSq9.js";
23
- import { E as qa } from "./eye-BjhN2nYf.js";
24
- import { D as ht } from "./download-CfYKJO_j.js";
25
- import { S as Ca } from "./share-2-B49jcW2I.js";
26
- import { T as mt } from "./trash-2-uumy3fy1.js";
27
- import { L as pt } from "./list-CNnn7DOD.js";
28
- import { U as Tt } from "./user-plus-BtcOLgNU.js";
29
- import { T as wa } from "./triangle-alert-CBnO6nq_.js";
30
- import { C as ya } from "./circle-check-BN6rz4NV.js";
31
- import { P as gt } from "./plus-DzMQ_c6b.js";
32
- import { X as Sa } from "./x-B5YnXwCz.js";
33
- import { P as Ia } from "./pen-line-D0De5zdl.js";
34
- /**
35
- * @license lucide-react v1.22.0 - ISC
36
- *
37
- * This source code is licensed under the ISC license.
38
- * See the LICENSE file in the root directory of this source tree.
39
- */
40
- const ka = [
41
- ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
42
- ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
43
- ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
44
- ], Oa = An("link-2", ka);
45
- /**
46
- * @license lucide-react v1.22.0 - ISC
47
- *
48
- * This source code is licensed under the ISC license.
49
- * See the LICENSE file in the root directory of this source tree.
50
- */
51
- const Ta = [
52
- ["rect", { width: "5", height: "5", x: "3", y: "3", rx: "1", key: "1tu5fj" }],
53
- ["rect", { width: "5", height: "5", x: "16", y: "3", rx: "1", key: "1v8r4q" }],
54
- ["rect", { width: "5", height: "5", x: "3", y: "16", rx: "1", key: "1x03jg" }],
55
- ["path", { d: "M21 16h-3a2 2 0 0 0-2 2v3", key: "177gqh" }],
56
- ["path", { d: "M21 21v.01", key: "ents32" }],
57
- ["path", { d: "M12 7v3a2 2 0 0 1-2 2H7", key: "8crl2c" }],
58
- ["path", { d: "M3 12h.01", key: "nlz23k" }],
59
- ["path", { d: "M12 3h.01", key: "n36tog" }],
60
- ["path", { d: "M12 16v.01", key: "133mhm" }],
61
- ["path", { d: "M16 12h1", key: "1slzba" }],
62
- ["path", { d: "M21 12v.01", key: "1lwtk9" }],
63
- ["path", { d: "M12 21v-1", key: "1880an" }]
64
- ], Ea = An("qr-code", Ta);
65
- /**
66
- * @license lucide-react v1.22.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */
71
- const Aa = [
72
- ["circle", { cx: "8", cy: "21", r: "1", key: "jimo8o" }],
73
- ["circle", { cx: "19", cy: "21", r: "1", key: "13723u" }],
74
- [
75
- "path",
76
- {
77
- d: "M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",
78
- key: "9zh506"
79
- }
80
- ]
81
- ], Pa = An("shopping-cart", Aa);
82
- /**
83
- * @license lucide-react v1.22.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */
88
- const Da = [
89
- ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
90
- ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
91
- ], _a = An("tablet", Da), Tn = [
92
- "sms",
93
- "email",
94
- "on-device"
95
- ];
96
- function cs() {
97
- const { t: i } = fn("ui");
98
- return {
99
- sms: {
100
- label: i("signatureRequest.viaSms"),
101
- icon: /* @__PURE__ */ n(xa, { className: "ds:size-4", "aria-hidden": !0 })
102
- },
103
- email: {
104
- label: i("signatureRequest.viaEmail"),
105
- icon: /* @__PURE__ */ n(Ot, { className: "ds:size-4", "aria-hidden": !0 })
106
- },
107
- whatsapp: {
108
- label: i("signatureRequest.viaWhatsapp"),
109
- icon: /* @__PURE__ */ n(kt, { className: "ds:size-4", "aria-hidden": !0 })
110
- },
111
- "on-device": {
112
- label: i("signatureRequest.onThisDevice"),
113
- icon: /* @__PURE__ */ n(_a, { className: "ds:size-4", "aria-hidden": !0 })
114
- },
115
- qr: {
116
- label: i("signatureRequest.viaQr"),
117
- icon: /* @__PURE__ */ n(Ea, { className: "ds:size-4", "aria-hidden": !0 })
118
- }
119
- };
120
- }
121
- function Et({
122
- loading: i,
123
- loadingText: r,
124
- loadedText: c,
125
- message: l
126
- }) {
127
- const [g, I] = L(""), D = ge(!1);
128
- return Ee(() => {
129
- i ? I(r) : D.current && I(c), D.current = i;
130
- }, [i, r, c]), /* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: l !== void 0 && !i ? l : g });
131
- }
132
- const ue = "ds:grid ds:grid-cols-[var(--spacing-xl)_minmax(0,1fr)_var(--min-target-size)] ds:@[512px]/person:grid-cols-[var(--spacing-xl)_minmax(0,1fr)_max-content_var(--min-target-size)] ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-sm)]", ft = "ds:col-start-1 ds:row-start-1 ds:flex ds:items-center ds:justify-center", vt = "ds:col-start-2 ds:row-start-1 ds:min-w-0", La = "ds:col-[2/-2] ds:row-start-1 ds:min-w-0", is = "ds:col-[-3/-2] ds:row-start-2 ds:min-w-0 ds:@[512px]/person:row-start-1", Ma = "ds:col-[-2/-1] ds:row-start-1 ds:flex ds:items-center ds:justify-center", H = "ds:col-[2/-2] ds:min-w-0 ds:text-start", En = "ds:col-[1/-2] ds:row-start-1 ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", $a = "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", pn = "ds:@container/person";
133
- function At({ meta: i }) {
134
- return /* @__PURE__ */ n(
135
- "span",
136
- {
137
- "aria-hidden": "true",
138
- "data-channel-sizer": "",
139
- className: "ds:invisible ds:block ds:h-0 ds:overflow-hidden",
140
- children: Object.entries(i).map(([r, { label: c, icon: l }]) => /* @__PURE__ */ n("span", { className: "ds:flex ds:w-max", children: /* @__PURE__ */ h("span", { className: ba({ size: "md" }), children: [
141
- /* @__PURE__ */ h("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
142
- /* @__PURE__ */ n("span", { className: "ds:inline-flex ds:shrink-0", children: l }),
143
- /* @__PURE__ */ n("span", { className: "ds:whitespace-nowrap", children: c })
144
- ] }),
145
- /* @__PURE__ */ n(Na, { className: "ds:size-4 ds:shrink-0" })
146
- ] }) }, r))
147
- }
148
- );
149
- }
150
- const bt = [
151
- "link",
152
- "email",
153
- "whatsapp"
154
- ], za = [0, 1], Fa = "ds:flex ds:flex-col ds:@[512px]/person:grid ds:@[512px]/person:grid-cols-[max-content_minmax(0,1fr)_max-content] ds:@[512px]/person:gap-x-[var(--spacing-md)]", xt = "ds:flex ds:flex-col ds:@[512px]/person:col-span-full ds:@[512px]/person:grid ds:@[512px]/person:grid-cols-subgrid", rs = "ds:grid ds:grid-cols-[minmax(0,1fr)_max-content] ds:items-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-xs)] ds:py-[var(--spacing-xs)] ds:@[512px]/person:col-span-full ds:@[512px]/person:grid-cols-subgrid ds:@[512px]/person:gap-x-[var(--spacing-md)]", Rt = "ds:col-start-1 ds:row-start-1 ds:min-w-0 ds:text-start ds:@[512px]/person:col-start-1 ds:@[512px]/person:whitespace-nowrap", Nt = "ds:col-span-full ds:row-start-2 ds:min-w-0 ds:text-start ds:@[512px]/person:col-span-1 ds:@[512px]/person:col-start-2 ds:@[512px]/person:row-start-1", qt = "ds:col-start-2 ds:row-start-1 ds:flex ds:justify-end ds:@[512px]/person:col-start-3";
155
- function Pt(i) {
156
- const r = (i instanceof Date ? i : new Date(i)).getTime();
157
- return Number.isNaN(r) ? null : r;
158
- }
159
- function Ha(i) {
160
- return i.map((r, c) => ({ record: r, index: c, ms: Pt(r.createdAt) })).sort((r, c) => r.ms === c.ms ? r.index - c.index : r.ms === null ? 1 : c.ms === null ? -1 : c.ms - r.ms).map(({ record: r }) => r);
161
- }
162
- function ja({
163
- signatures: i,
164
- loading: r = !1,
165
- showLegalLevel: c = !0,
166
- onView: l,
167
- onDownload: g,
168
- onShare: I,
169
- shareTargets: D = bt,
170
- onDelete: $
171
- }) {
172
- const { t: b, i18n: X } = fn("ui"), _ = cs(), fe = j(), ve = {
173
- link: { label: b("signatureRequest.shareLink"), icon: /* @__PURE__ */ n(Oa, {}) },
174
- email: { label: b("signatureRequest.viaEmail"), icon: /* @__PURE__ */ n(Ot, {}) },
175
- whatsapp: {
176
- label: b("signatureRequest.viaWhatsapp"),
177
- icon: /* @__PURE__ */ n(kt, {})
178
- }
179
- }, _e = X.language || "en", k = _e === "en" ? "en-GB" : _e, re = new Intl.DateTimeFormat(k, {
180
- weekday: "short"
181
- }), Le = new Intl.DateTimeFormat(k, {
182
- day: "2-digit",
183
- month: "2-digit",
184
- year: "numeric"
185
- }), Me = new Intl.DateTimeFormat(k, {
186
- hour: "2-digit",
187
- minute: "2-digit"
188
- }), be = (A) => {
189
- const v = re.format(A);
190
- return b("signatureRequest.signedAt", {
191
- weekday: v.charAt(0).toLocaleUpperCase(k) + v.slice(1),
192
- date: Le.format(A),
193
- time: Me.format(A),
194
- interpolation: { escapeValue: !1 }
195
- });
196
- }, U = ge(null), $e = ge(null), he = ge(null), [xe, Re] = L();
197
- Ee(() => {
198
- const A = he.current;
199
- if (!A || r) return;
200
- const v = new Set((i ?? []).map((f) => f.id));
201
- if (v.has(A.id)) return;
202
- he.current = null, Re(b("signatureRequest.signatureDeleted"));
203
- const w = A.order.indexOf(A.id), W = A.order.slice(w + 1).find((f) => v.has(f)) ?? A.order.slice(0, w).reverse().find((f) => v.has(f));
204
- window.setTimeout(() => {
205
- var ye, J, Se;
206
- const f = document.activeElement;
207
- if (!(!f || f === document.body || !f.isConnected || f.matches('[role="dialog"], [role="alertdialog"]'))) return;
208
- if (W === void 0) {
209
- (ye = $e.current) == null || ye.focus();
210
- return;
211
- }
212
- const P = Array.from(
213
- ((J = U.current) == null ? void 0 : J.querySelectorAll(
214
- "[data-signature-id]"
215
- )) ?? []
216
- ).find((Y) => Y.dataset.signatureId === W);
217
- (Se = P == null ? void 0 : P.querySelector('[role="group"] button')) == null || Se.focus();
218
- }, 0);
219
- }, [i, r, b]);
220
- const C = i ? Ha(i) : [];
221
- let me;
222
- if (r)
223
- me = /* @__PURE__ */ n(
224
- "div",
225
- {
226
- "aria-busy": "true",
227
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
228
- children: za.map((A) => /* @__PURE__ */ h(
229
- "div",
230
- {
231
- className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
232
- children: [
233
- /* @__PURE__ */ h("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
234
- /* @__PURE__ */ n(Pe, { size: "md", width: "40%" }),
235
- /* @__PURE__ */ n(Pe, { size: "sm", width: "70%" })
236
- ] }),
237
- /* @__PURE__ */ n(Pe, { variant: "circular", size: "sm" }),
238
- /* @__PURE__ */ n(Pe, { variant: "circular", size: "sm" }),
239
- /* @__PURE__ */ n(Pe, { variant: "circular", size: "sm" })
240
- ]
241
- },
242
- A
243
- ))
244
- }
245
- );
246
- else if (C.length === 0)
247
- me = /* @__PURE__ */ n(
248
- "p",
249
- {
250
- ref: $e,
251
- tabIndex: -1,
252
- "data-note": "no-signed-versions",
253
- className: "type-body-sm ds:text-[color:var(--muted-foreground)] ds:outline-none",
254
- children: b("signatureRequest.noSignedVersions")
255
- }
256
- );
257
- else {
258
- const A = "type-label ds:text-[color:var(--muted-foreground)] ds:pb-[var(--spacing-xs)]";
259
- me = // The chip's tooltip and the icon-button tooltips need a provider; the
260
- // section brings its own so a host without one does not crash.
261
- /* @__PURE__ */ n(St, { children: /* @__PURE__ */ h(
262
- "div",
263
- {
264
- ref: U,
265
- role: "table",
266
- "aria-labelledby": fe,
267
- className: Fa,
268
- children: [
269
- /* @__PURE__ */ n(
270
- "div",
271
- {
272
- role: "rowgroup",
273
- className: `${xt} ds:sr-only ds:@[512px]/person:not-sr-only`,
274
- children: /* @__PURE__ */ h(
275
- "div",
276
- {
277
- role: "row",
278
- className: `${rs} ds:border-b ds:border-[color:var(--border)]`,
279
- children: [
280
- /* @__PURE__ */ n(
281
- "span",
282
- {
283
- role: "columnheader",
284
- className: `${Rt} ${A}`,
285
- children: b("signatureRequest.columnDate")
286
- }
287
- ),
288
- /* @__PURE__ */ n(
289
- "span",
290
- {
291
- role: "columnheader",
292
- className: `${Nt} ${A}`,
293
- children: b("signatureRequest.columnSignatureType")
294
- }
295
- ),
296
- /* @__PURE__ */ n(
297
- "span",
298
- {
299
- role: "columnheader",
300
- className: `${qt} ${A}`,
301
- children: b("signatureRequest.columnActions")
302
- }
303
- )
304
- ]
305
- }
306
- )
307
- }
308
- ),
309
- /* @__PURE__ */ n("div", { role: "rowgroup", className: xt, children: C.map((v, w) => {
310
- const W = Pt(v.createdAt), f = W === null ? String(v.createdAt) : be(W), ee = W === null ? void 0 : new Date(W).toISOString(), P = _[v.channel], ye = v.shareTargets ?? D, J = I ? bt.filter(
311
- (Y) => ye.includes(Y)
312
- ) : [], Se = l !== void 0 || g !== void 0 || J.length > 0 || $ !== void 0;
313
- return /* @__PURE__ */ h(
314
- "div",
315
- {
316
- role: "row",
317
- "data-signature-id": v.id,
318
- className: w === 0 ? rs : `${rs} ds:border-t ds:border-[color:var(--border)]`,
319
- children: [
320
- /* @__PURE__ */ n("div", { role: "cell", className: `${Rt} type-body`, children: /* @__PURE__ */ n("time", { dateTime: ee, children: f }) }),
321
- /* @__PURE__ */ n("div", { role: "cell", className: Nt, children: /* @__PURE__ */ h("span", { className: "type-body-sm ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
322
- c && v.legalLevel ? /* @__PURE__ */ n("span", { children: v.legalLevel === "advanced" ? b("signatureRequest.legalLevelAdvanced") : b("signatureRequest.legalLevelSimple") }) : null,
323
- /* @__PURE__ */ h("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
324
- /* @__PURE__ */ n(
325
- "span",
326
- {
327
- "aria-hidden": "true",
328
- className: "ds:text-[var(--accent)]",
329
- children: P.icon
330
- }
331
- ),
332
- P.label
333
- ] }),
334
- /* @__PURE__ */ n(
335
- Ra,
336
- {
337
- size: "sm",
338
- operator: v.operator,
339
- patient: v.patient,
340
- secondary: v.secondary,
341
- names: v.names,
342
- tooltip: !0
343
- }
344
- )
345
- ] }) }),
346
- /* @__PURE__ */ n("div", { role: "cell", className: qt, children: Se ? /* @__PURE__ */ h(
347
- "span",
348
- {
349
- role: "group",
350
- "aria-label": b("signatureRequest.signatureActions", {
351
- date: f,
352
- interpolation: { escapeValue: !1 }
353
- }),
354
- className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]",
355
- children: [
356
- l ? /* @__PURE__ */ n(
357
- gn,
358
- {
359
- intent: "ghost",
360
- size: "sm",
361
- icon: /* @__PURE__ */ n(qa, {}),
362
- "aria-label": b("signatureRequest.viewSignature"),
363
- tooltip: b("signatureRequest.viewSignature"),
364
- onClick: () => l(v.id)
365
- }
366
- ) : null,
367
- g && v.hasAnonymisedVersion ? /* @__PURE__ */ h(
368
- Ct,
369
- {
370
- id: `signature-download-${v.id}`,
371
- label: b("signatureRequest.downloadSignature"),
372
- icon: /* @__PURE__ */ n(ht, {}),
373
- children: [
374
- /* @__PURE__ */ n(
375
- tn.Item,
376
- {
377
- onSelect: () => g(v.id, "full"),
378
- children: b("signatureRequest.downloadFull")
379
- }
380
- ),
381
- /* @__PURE__ */ n(
382
- tn.Item,
383
- {
384
- onSelect: () => g(v.id, "anonymised"),
385
- children: b("signatureRequest.downloadAnonymised")
386
- }
387
- )
388
- ]
389
- }
390
- ) : g ? (
391
- // One file only: a menu with a single entry would
392
- // be an extra click for nothing.
393
- /* @__PURE__ */ n(
394
- gn,
395
- {
396
- intent: "ghost",
397
- size: "sm",
398
- icon: /* @__PURE__ */ n(ht, {}),
399
- "aria-label": b("signatureRequest.downloadSignature"),
400
- tooltip: b("signatureRequest.downloadSignature"),
401
- onClick: () => g(v.id, "full")
402
- }
403
- )
404
- ) : null,
405
- I && J.length > 0 ? /* @__PURE__ */ n(
406
- Ct,
407
- {
408
- id: `signature-share-${v.id}`,
409
- label: b("signatureRequest.shareSignature"),
410
- icon: /* @__PURE__ */ n(Ca, {}),
411
- children: J.map((Y) => /* @__PURE__ */ n(
412
- tn.Item,
413
- {
414
- startIcon: ve[Y].icon,
415
- onSelect: () => I(v.id, Y),
416
- children: ve[Y].label
417
- },
418
- Y
419
- ))
420
- }
421
- ) : null,
422
- $ ? /* @__PURE__ */ n(
423
- Ua,
424
- {
425
- id: `signature-delete-${v.id}`,
426
- when: f,
427
- dateTime: ee,
428
- onConfirm: () => {
429
- he.current = {
430
- id: v.id,
431
- order: C.map((Y) => Y.id)
432
- }, Re(""), $(v.id);
433
- }
434
- }
435
- ) : null
436
- ]
437
- }
438
- ) : null })
439
- ]
440
- },
441
- v.id
442
- );
443
- }) })
444
- ]
445
- }
446
- ) });
447
- }
448
- return /* @__PURE__ */ h(
449
- "section",
450
- {
451
- "aria-labelledby": fe,
452
- "data-section": "signed-versions",
453
- className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start`,
454
- children: [
455
- /* @__PURE__ */ n("div", { className: ue, children: /* @__PURE__ */ n("div", { className: En, children: /* @__PURE__ */ n(
456
- "h3",
457
- {
458
- id: fe,
459
- className: "type-eyebrow ds:m-0 ds:text-[color:var(--muted-foreground)]",
460
- children: b("signatureRequest.signedVersions")
461
- }
462
- ) }) }),
463
- /* @__PURE__ */ n("div", { className: ue, children: /* @__PURE__ */ h("div", { className: "ds:col-[1/-2] ds:min-w-0", children: [
464
- /* @__PURE__ */ n(
465
- Et,
466
- {
467
- loading: r,
468
- loadingText: b("signatureRequest.signaturesLoading"),
469
- loadedText: b("signatureRequest.signaturesLoaded"),
470
- message: xe
471
- }
472
- ),
473
- me
474
- ] }) })
475
- ]
476
- }
477
- );
478
- }
479
- function Dt() {
480
- const [i, r] = L(!1), c = ge(!1);
481
- return {
482
- tooltipProps: {
483
- open: i,
484
- onOpenChange: (l) => {
485
- l && c.current || r(l);
486
- }
487
- },
488
- triggerProps: {
489
- onPointerMove: () => {
490
- c.current = !1;
491
- },
492
- onBlur: () => {
493
- c.current = !1;
494
- }
495
- },
496
- hideTip: () => r(!1),
497
- /** Call just before focus returns to the trigger. */
498
- markReturning: () => {
499
- c.current = !0;
500
- }
501
- };
502
- }
503
- function Ct({ id: i, label: r, icon: c, children: l }) {
504
- const g = Dt();
505
- return /* @__PURE__ */ h(
506
- tn.Root,
507
- {
508
- id: i,
509
- onOpenChange: (I) => {
510
- I && g.hideTip();
511
- },
512
- children: [
513
- /* @__PURE__ */ n(It, { label: r, ...g.tooltipProps, children: /* @__PURE__ */ n(tn.Trigger, { asChild: !0, children: /* @__PURE__ */ n(
514
- gn,
515
- {
516
- intent: "ghost",
517
- size: "sm",
518
- icon: c,
519
- "aria-label": r,
520
- ...g.triggerProps
521
- }
522
- ) }) }),
523
- /* @__PURE__ */ n(
524
- tn.Content,
525
- {
526
- align: "end",
527
- onCloseAutoFocus: g.markReturning,
528
- children: l
529
- }
530
- )
531
- ]
532
- }
533
- );
534
- }
535
- function Ua({ id: i, when: r, dateTime: c, onConfirm: l }) {
536
- const { t: g } = fn("ui"), I = Dt(), [D, $] = L(!1), b = g("signatureRequest.deleteSignature");
537
- return /* @__PURE__ */ h(
538
- S,
539
- {
540
- id: i,
541
- open: D,
542
- onOpenChange: (X) => {
543
- X && I.hideTip(), $(X);
544
- },
545
- children: [
546
- /* @__PURE__ */ n(It, { label: b, ...I.tooltipProps, children: /* @__PURE__ */ n(S.Trigger, { asChild: !0, children: /* @__PURE__ */ n(
547
- gn,
548
- {
549
- intent: "destructiveOutline",
550
- size: "sm",
551
- icon: /* @__PURE__ */ n(mt, {}),
552
- "aria-label": b,
553
- ...I.triggerProps
554
- }
555
- ) }) }),
556
- /* @__PURE__ */ h(
557
- S.Content,
558
- {
559
- variant: "alert",
560
- size: "sm",
561
- onCloseAutoFocus: I.markReturning,
562
- children: [
563
- /* @__PURE__ */ h(S.Header, { children: [
564
- /* @__PURE__ */ n(S.Title, { children: g("signatureRequest.deleteSignatureConfirm") }),
565
- /* @__PURE__ */ n(S.Description, { children: /* @__PURE__ */ n("time", { dateTime: c, children: r }) })
566
- ] }),
567
- /* @__PURE__ */ h(S.Footer, { children: [
568
- /* @__PURE__ */ n(S.Close, { asChild: !0, children: /* @__PURE__ */ n(F, { intent: "outline", children: g("common.cancel") }) }),
569
- /* @__PURE__ */ n(
570
- F,
571
- {
572
- intent: "destructive",
573
- startIcon: /* @__PURE__ */ n(mt, {}),
574
- onClick: () => {
575
- l(), $(!1);
576
- },
577
- children: b
578
- }
579
- )
580
- ] })
581
- ]
582
- }
583
- )
584
- ]
585
- }
586
- );
587
- }
588
- const Q = "__assign-later__";
589
- function Wa(i) {
590
- return i.filter((r) => r.signed !== !0);
591
- }
592
- function Ba(i) {
593
- return i.length > 0 && i.every(
594
- (r) => r.kind === "document" && r.canCarrySecondary === !0
595
- );
596
- }
597
- function De(i) {
598
- return i.requiresOperator;
599
- }
600
- function _t(i, r) {
601
- return i.filter((c) => c.deleted !== !0 || c.value === r).map(({ deleted: c, ...l }) => l);
602
- }
603
- function Lt(i, r) {
604
- return i.some(
605
- (c) => c.value === r && c.disabled !== !0 && c.deleted !== !0
606
- );
607
- }
608
- function Mt(i, r) {
609
- const c = i.filter((l) => l.disabled === !0 && l.deleted !== !0).map(
610
- (l) => l.description ? `${l.label} (${l.description})` : l.label
611
- );
612
- if (c.length !== 0)
613
- return new Intl.ListFormat(r || "en", { type: "unit" }).format(c);
614
- }
615
- function On({
616
- items: i,
617
- channel: r,
618
- primaryIsPatient: c
619
- }) {
620
- return Ba(i) ? c ? "patient" : r !== "on-device" ? "channel" : null : i.some((l) => l.kind === "anamnesis") ? "anamnesis" : "documents";
621
- }
622
- function Ga({
623
- primaryId: i,
624
- secondId: r,
625
- channel: c,
626
- options: l
627
- }) {
628
- if (r === i) return "sameAsPrimary";
629
- const g = l.find((D) => D.value === r);
630
- if (!g || g.isPatient === !0) return "unknownSignee";
631
- const I = (D) => {
632
- var $;
633
- return (!g.availableChannels || g.availableChannels.length === 0 || g.availableChannels.includes(D)) && !(($ = g.unavailableChannels) != null && $.some((b) => b.channel === D));
634
- };
635
- return (c === "sms" || c === "whatsapp") && !I(c) ? "missingPhone" : c === "email" && !I("email") ? "missingEmail" : null;
636
- }
637
- const Va = [0, 1, 2], Qa = "ds:grid ds:grid-cols-1 ds:@[512px]/person:grid-cols-2 ds:items-center ds:gap-[var(--spacing-sm)] ds:font-normal", Ka = "ds:grid ds:grid-cols-1 ds:@[512px]/person:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_max-content] ds:items-center ds:gap-[var(--spacing-sm)] ds:font-normal", Xa = "ds:min-w-0 ds:font-medium", Ya = "ds:col-span-full ds:min-w-0 ds:font-medium", ls = "ds:block ds:min-w-0", wt = "ds:!gap-[var(--spacing-sm)] ds:!p-[var(--spacing-sm)]";
638
- function Ja({
639
- items: i,
640
- loading: r = !1,
641
- operatorOptions: c,
642
- assignments: l,
643
- onAssign: g,
644
- onAssignAllToMe: I,
645
- busy: D = !1,
646
- showOperatorChannels: $ = !1,
647
- operatorChannels: b = {},
648
- onOperatorChannel: X
649
- }) {
650
- const { t: _, i18n: fe } = fn("ui"), ve = cs(), _e = Tn.map(
651
- (C) => ({
652
- value: C,
653
- label: ve[C].label,
654
- startAdornment: ve[C].icon
655
- })
656
- ), k = j(), re = j(), Le = j(), Me = /* @__PURE__ */ n(
657
- Et,
658
- {
659
- loading: r,
660
- loadingText: _("signatureRequest.requiredLoading"),
661
- loadedText: _("signatureRequest.requiredLoaded")
662
- }
663
- );
664
- if (r)
665
- return /* @__PURE__ */ h(we, { children: [
666
- Me,
667
- /* @__PURE__ */ n(
668
- "div",
669
- {
670
- "aria-busy": "true",
671
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
672
- children: Va.map((C) => /* @__PURE__ */ h(
673
- "div",
674
- {
675
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
676
- children: [
677
- /* @__PURE__ */ n(Pe, { size: "md", width: "50%" }),
678
- /* @__PURE__ */ n(Pe, { size: "sm", width: "30%" })
679
- ]
680
- },
681
- C
682
- ))
683
- }
684
- )
685
- ] });
686
- const be = i.filter((C) => C.kind === "document"), U = i.filter((C) => C.kind === "anamnesis"), $e = i.some(
687
- (C) => De(C) && l[C.id] === Q
688
- ), he = [be, U].find(
689
- (C) => C.some(De)
690
- ), xe = Mt(c, fe.language), Re = (C, me, A) => {
691
- if (C.length === 0) return null;
692
- const v = C === he;
693
- return /* @__PURE__ */ h(
694
- "section",
695
- {
696
- className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]`,
697
- children: [
698
- /* @__PURE__ */ h("div", { className: ue, children: [
699
- /* @__PURE__ */ h("div", { className: En, children: [
700
- /* @__PURE__ */ n(
701
- "p",
702
- {
703
- id: me,
704
- className: "type-eyebrow ds:text-[color:var(--muted-foreground)]",
705
- children: A
706
- }
707
- ),
708
- v && I ? /* @__PURE__ */ n(
709
- F,
710
- {
711
- intent: "outline",
712
- size: "sm",
713
- startIcon: /* @__PURE__ */ n(Tt, {}),
714
- disabled: D,
715
- onClick: I,
716
- children: _("signatureRequest.assignAllToMe")
717
- }
718
- ) : null
719
- ] }),
720
- v && $e ? /* @__PURE__ */ n(
721
- K,
722
- {
723
- variant: "info",
724
- "data-note": "assign-later",
725
- className: `${H} ${wt}`,
726
- children: /* @__PURE__ */ n(K.Description, { children: _("signatureRequest.assignLaterNote") })
727
- }
728
- ) : null,
729
- v && !$ ? /* @__PURE__ */ n(
730
- K,
731
- {
732
- variant: "info",
733
- "data-note": "operator-channel",
734
- className: `${H} ${wt}`,
735
- children: /* @__PURE__ */ n(K.Description, { children: _("signatureRequest.operatorChannelNote") })
736
- }
737
- ) : null
738
- ] }),
739
- /* @__PURE__ */ n("div", { className: ue, children: /* @__PURE__ */ n(
740
- pt,
741
- {
742
- density: "relaxed",
743
- "aria-labelledby": me,
744
- className: H,
745
- children: C.map((w) => {
746
- const W = De(w), f = W && $, ee = W && l[w.id] !== void 0 && l[w.id] !== Q && l[w.id] !== "";
747
- return /* @__PURE__ */ n(
748
- pt.Item,
749
- {
750
- value: w.id,
751
- "data-required-item-id": w.id,
752
- className: "ds:!p-[var(--spacing-none)]",
753
- title: /* @__PURE__ */ h(
754
- "span",
755
- {
756
- className: f ? Ka : Qa,
757
- children: [
758
- /* @__PURE__ */ n("span", { className: W ? Xa : Ya, children: w.name }),
759
- W ? /* @__PURE__ */ n("span", { className: ls, children: /* @__PURE__ */ n(
760
- Ae,
761
- {
762
- id: `signature-request-item-operator-${w.id}`,
763
- options: _t(
764
- c,
765
- l[w.id]
766
- ),
767
- value: l[w.id],
768
- onValueChange: (P) => {
769
- P && Lt(c, P) && g(w.id, P);
770
- },
771
- showDescriptions: !0,
772
- "aria-describedby": xe ? Le : void 0,
773
- required: !0,
774
- disabled: D,
775
- placeholder: _(
776
- "signatureRequest.operatorPlaceholder"
777
- ),
778
- "aria-label": _(
779
- "signatureRequest.itemOperatorLabel",
780
- { name: w.name }
781
- )
782
- }
783
- ) }) : null,
784
- f ? (
785
- // The chosen operator's channel, from their settings
786
- // unless changed here. Nobody to deliver to while
787
- // unassigned, but the column keeps its width.
788
- /* @__PURE__ */ h(
789
- "span",
790
- {
791
- className: ee ? ls : `${ls} ds:hidden ds:@[512px]/person:block`,
792
- children: [
793
- ee ? /* @__PURE__ */ n(
794
- Ae,
795
- {
796
- id: `signature-request-item-operator-channel-${w.id}`,
797
- options: _e,
798
- value: b[w.id],
799
- adornmentInTrigger: !0,
800
- disabled: D,
801
- "aria-label": _(
802
- "signatureRequest.itemOperatorChannelLabel",
803
- { name: w.name }
804
- ),
805
- onValueChange: (P) => {
806
- Tn.includes(
807
- P
808
- ) && (X == null || X(
809
- w.id,
810
- P
811
- ));
812
- }
813
- }
814
- ) : null,
815
- /* @__PURE__ */ n(At, { meta: ve })
816
- ]
817
- }
818
- )
819
- ) : null
820
- ]
821
- }
822
- )
823
- },
824
- w.id
825
- );
826
- })
827
- }
828
- ) })
829
- ]
830
- }
831
- );
832
- };
833
- return /* @__PURE__ */ h(we, { children: [
834
- Me,
835
- xe ? /* @__PURE__ */ n("span", { id: Le, className: "ds:sr-only", children: xe }) : null,
836
- /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)] ds:text-start", children: [
837
- Re(
838
- be,
839
- k,
840
- _("signatureRequest.requiredDocumentsHeading", {
841
- count: be.length
842
- })
843
- ),
844
- Re(
845
- U,
846
- re,
847
- _("signatureRequest.requiredAnamnesisHeading", {
848
- count: U.length
849
- })
850
- )
851
- ] })
852
- ] });
853
- }
854
- function Za(i, r, { required: c = !1 } = {}) {
855
- switch (i) {
856
- case "linkSent":
857
- return c ? {
858
- title: r("signatureRequest.requiredLinkSentTitle"),
859
- description: r("signatureRequest.requiredLinkSentDescription")
860
- } : {
861
- title: r("signatureRequest.outcomeLinkSentTitle"),
862
- description: r("signatureRequest.outcomeLinkSentDescription")
863
- };
864
- case "allSigned":
865
- return {
866
- title: r("signatureRequest.outcomeAllSignedTitle"),
867
- description: r("signatureRequest.outcomeAllSignedDescription")
868
- };
869
- case "creditsExhausted":
870
- return {
871
- title: r("signatureRequest.outcomeCreditsTitle"),
872
- description: r("signatureRequest.outcomeCreditsDescription")
873
- };
874
- }
875
- }
876
- function ei({
877
- outcome: i
878
- }) {
879
- const r = i === "creditsExhausted";
880
- return /* @__PURE__ */ n(
881
- "div",
882
- {
883
- "data-outcome": i,
884
- className: "ds:flex ds:justify-center ds:py-[var(--spacing-md)]",
885
- children: /* @__PURE__ */ n(
886
- "span",
887
- {
888
- "aria-hidden": "true",
889
- className: r ? "ds:text-[color:var(--warning)]" : "ds:text-[color:var(--success)]",
890
- children: r ? /* @__PURE__ */ n(wa, { className: "ds:size-[var(--icon-size-lg)]" }) : /* @__PURE__ */ n(ya, { className: "ds:size-[var(--icon-size-lg)]" })
891
- }
892
- )
893
- }
894
- );
895
- }
896
- const nn = [
897
- "sms",
898
- "email",
899
- "whatsapp",
900
- "on-device",
901
- "qr"
902
- ], yt = "signature-request-batch-channel", os = {
903
- anamnesis: "signatureRequest.secondSigneeUnavailableAnamnesis",
904
- documents: "signatureRequest.secondSigneeUnavailableDocuments",
905
- patient: "signatureRequest.secondSigneeUnavailablePatient",
906
- channel: "signatureRequest.secondSigneeUnavailableChannel"
907
- }, ni = {
908
- sameAsPrimary: "signatureRequest.secondSigneeSameAsPrimary",
909
- unknownSignee: "signatureRequest.secondSigneeUnknown",
910
- missingPhone: "signatureRequest.secondSigneeMissingPhone",
911
- missingEmail: "signatureRequest.secondSigneeMissingEmail"
912
- };
913
- function si(i, r, c) {
914
- const l = i instanceof Date ? i : new Date(i);
915
- if (Number.isNaN(l.getTime())) return null;
916
- const g = { hour: "2-digit", minute: "2-digit" };
917
- return l.toDateString() === (/* @__PURE__ */ new Date()).toDateString() ? c("signatureRequest.qrExpiresAt", {
918
- time: new Intl.DateTimeFormat(r, g).format(l)
919
- }) : c("signatureRequest.qrExpiresOn", {
920
- dateTime: new Intl.DateTimeFormat(r, {
921
- day: "numeric",
922
- month: "short",
923
- year: "numeric",
924
- ...g
925
- }).format(l)
926
- });
927
- }
928
- function sn(i, r) {
929
- var c;
930
- return ((c = i.find((l) => l.value === r)) == null ? void 0 : c.label) ?? "";
931
- }
932
- const ti = ga(
933
- ({
934
- open: i,
935
- onOpenChange: r,
936
- operators: c,
937
- signerOptions: l,
938
- currentOperatorId: g,
939
- allowAssignLater: I = !0,
940
- requireOperator: D = !0,
941
- requirePatient: $ = !0,
942
- initialOperatorId: b,
943
- initialOperatorChannel: X,
944
- initialSigners: _,
945
- maxSigners: fe = 2,
946
- channelMode: ve = "perSigner",
947
- initialBatchChannel: _e,
948
- busy: k = !1,
949
- error: re,
950
- title: Le,
951
- description: Me,
952
- onRequestSignature: be,
953
- qrCodes: U,
954
- qrPending: $e = !1,
955
- onQrDone: he,
956
- signatures: xe,
957
- signaturesLoading: Re = !1,
958
- showLegalLevel: C = !0,
959
- onViewSignature: me,
960
- onDownloadSignature: A,
961
- onShareSignature: v,
962
- signatureShareTargets: w,
963
- onDeleteSignature: W,
964
- resolveChannels: f,
965
- requiredItems: ee,
966
- requiredItemsLoading: P = !1,
967
- showOperatorChannels: ye = !1,
968
- outcome: J,
969
- onBuyMoreSignatures: Se,
970
- onOutcomeCancel: Y,
971
- onAddSignee: ds,
972
- contentProps: $t
973
- }, zt) => {
974
- var et, nt, st, tt, at, it;
975
- const { t: d, i18n: Pn } = fn("ui"), vn = ge(0), us = ge(null), ze = ge(null), Dn = j(), hs = j(), ms = j(), ps = j(), gs = j(), Ft = j(), fs = j(), Ht = j(), vs = j(), bn = j(), x = ee !== void 0 || P, B = ee ? Wa(ee) : [], ne = D && !x, Ne = $ || x, N = ve === "batch", xn = (e) => {
976
- var s;
977
- return ((s = l.find((t) => t.value === e)) == null ? void 0 : s.isPatient) === !0;
978
- }, bs = (e, s) => {
979
- var a, u;
980
- return x ? On({
981
- items: B,
982
- channel: N ? s : ((a = e[0]) == null ? void 0 : a.channel) ?? s,
983
- primaryIsPatient: xn((u = e[0]) == null ? void 0 : u.signerId)
984
- }) === null ? Math.min(fe, 2) : 1 : fe;
985
- }, [jt, _n] = L(!1), [Ut, Wt] = L(J);
986
- J !== Ut && (Wt(J), _n(!1));
987
- const le = (jt ? void 0 : J) ?? (ee !== void 0 && !P && B.length === 0 ? "allSigned" : void 0), an = le ? Za(le, d, { required: x }) : null, rn = (e) => {
988
- var s;
989
- return new Map(
990
- (((s = l.find((t) => t.value === e)) == null ? void 0 : s.unavailableChannels) ?? []).map(({ channel: t, reason: a }) => [t, a])
991
- );
992
- }, Ln = (e, s) => {
993
- var p;
994
- const t = (p = l.find(
995
- (m) => m.value === e
996
- )) == null ? void 0 : p.availableChannels, a = t && t.length > 0 ? nn.filter((m) => t.includes(m)) : nn;
997
- if (!s) return a;
998
- const u = rn(e), o = a.filter((m) => s.includes(m));
999
- return o.some((m) => !u.has(m)) ? o : a;
1000
- }, ln = (e, s) => {
1001
- const t = rn(e);
1002
- return Ln(e, s).filter(
1003
- (a) => !t.has(a)
1004
- );
1005
- }, xs = (e) => {
1006
- const s = e == null ? void 0 : e.operatorAvailableChannels;
1007
- return s && s.length > 0 ? Tn.filter((t) => s.includes(t)) : Tn;
1008
- }, Rn = (e, s) => {
1009
- const t = ln(e);
1010
- return t.includes(s) ? s : t[0] ?? s;
1011
- }, Fe = l.find(
1012
- (e) => e.isPatient === !0
1013
- ), Rs = (e) => e === void 0 ? [] : Fe && Fe.value !== e ? [e, Fe.value] : [e], Mn = (e) => {
1014
- const s = Rs(e), t = /* @__PURE__ */ new Map();
1015
- for (const a of nn) {
1016
- if (a === "on-device" || s.some((o) => ln(o).includes(a))) continue;
1017
- const u = s.map((o) => rn(o).get(a)).find((o) => o !== void 0);
1018
- u !== void 0 && t.set(a, u);
1019
- }
1020
- return t;
1021
- }, Ns = (e, s) => {
1022
- if (e === void 0) return nn;
1023
- const t = Rs(e), a = nn.filter(
1024
- (m) => t.some((R) => Ln(R).includes(m))
1025
- ), u = Mn(e), o = s ? a.filter((m) => s.includes(m)) : a, p = o.some((m) => !u.has(m)) ? o : a;
1026
- return nn.filter(
1027
- (m) => m === "on-device" || p.includes(m)
1028
- );
1029
- }, on = (e, s) => {
1030
- const t = Mn(e);
1031
- return Ns(e, s).filter(
1032
- (a) => !t.has(a)
1033
- );
1034
- }, qs = (e, s = !0) => {
1035
- const t = on(e), a = (s ? _e : void 0) ?? (xn(e) && t.includes("sms") ? "sms" : "email");
1036
- return t.includes(a) ? a : t[0];
1037
- }, Cs = (et = c.find(
1038
- (e) => e.disabled !== !0 && e.deleted !== !0
1039
- )) == null ? void 0 : et.value, ws = (e) => e === null ? I ? Q : Cs ?? Q : e ?? Cs ?? (I ? Q : ""), Bt = () => ws(b), Gt = () => (_ && _.length > 0 ? _ : l.length > 0 ? [
1040
- {
1041
- signerId: l[0].value,
1042
- channel: Rn(l[0].value, "on-device")
1043
- }
1044
- ] : []).map((s) => {
1045
- const t = Rn(s.signerId, s.channel), { skipOtp: a, ...u } = s;
1046
- return {
1047
- ...u,
1048
- channel: t,
1049
- ...t === "on-device" && a !== void 0 ? { skipOtp: a } : {},
1050
- rowId: vn.current++
1051
- };
1052
- }), se = (e, s = !0) => {
1053
- var a;
1054
- const t = ((a = c.find((u) => u.value === e)) == null ? void 0 : a.defaultChannel) ?? "email";
1055
- return t === "on-device" && !s ? "email" : t;
1056
- }, ys = (e, s) => X === "on-device" ? s ? "on-device" : se(e, !1) : X ?? se(e, s), Ss = (e, s, t) => {
1057
- const a = xs(e), u = e.operatorChannel ?? t, o = se(s);
1058
- return a.includes(u) ? u : a.includes(o) ? o : a[0];
1059
- }, $n = (e, s, t, a, u = "on-device") => {
1060
- const o = ne && e !== Q && e !== "", p = x ? t.slice(0, bs(t, u)) : t, m = {};
1061
- if (Ne)
1062
- for (const R of p) {
1063
- const M = [...rn(R.signerId).keys()];
1064
- M.length > 0 && (m[R.signerId] = M);
1065
- }
1066
- return {
1067
- operatorId: o ? e : null,
1068
- operatorChannel: o ? s : null,
1069
- signers: Ne ? p.map(
1070
- ({ rowId: R, ...M }) => N ? { signerId: M.signerId, channel: u } : M
1071
- ) : [],
1072
- changed: a,
1073
- ...Object.keys(m).length > 0 ? { signerUnavailableChannels: m } : {}
1074
- };
1075
- }, zn = (e, s, t, a, u) => {
1076
- const o = $n(s, t, a, u), p = e(o), m = o.operatorChannel === null ? t : Ss(p, s, t), R = o.signers.length, M = a.map((T, Ce) => {
1077
- var ie, Je;
1078
- if (Ce >= R) return T;
1079
- const te = ln(
1080
- T.signerId,
1081
- (ie = p.signerAvailableChannels) == null ? void 0 : ie[T.signerId]
1082
- ), G = ((Je = p.signers.find((kn) => kn.signerId === T.signerId)) == null ? void 0 : Je.channel) ?? T.channel, ae = te.includes(G) ? G : te[0] ?? T.channel;
1083
- return ae === T.channel ? T : { ...T, channel: ae, skipOtp: void 0 };
1084
- });
1085
- return { operatorChannel: m, rows: M };
1086
- }, Is = (e, s, t, a = "", u = "email") => {
1087
- var T, Ce, te;
1088
- const o = (T = e[0]) == null ? void 0 : T.signerId;
1089
- if (!f) {
1090
- const G = on(o);
1091
- return {
1092
- batch: G.includes(s) ? s : G[0],
1093
- operatorChannel: u
1094
- };
1095
- }
1096
- const p = $n(a, u, e, t, s), m = f(p), R = on(
1097
- o,
1098
- o === void 0 || (Ce = m.signerAvailableChannels) == null ? void 0 : Ce[o]
1099
- ), M = ((te = m.signers.find((G) => G.signerId === o)) == null ? void 0 : te.channel) ?? s;
1100
- return {
1101
- batch: R.includes(M) ? M : R.includes(s) ? s : R[0],
1102
- operatorChannel: p.operatorChannel === null ? u : Ss(m, a, u)
1103
- };
1104
- }, ks = () => {
1105
- var u, o;
1106
- const e = Bt(), s = Gt();
1107
- if (N) {
1108
- const p = Is(
1109
- s,
1110
- qs((u = s[0]) == null ? void 0 : u.signerId),
1111
- null,
1112
- e,
1113
- X ?? se(e)
1114
- );
1115
- return {
1116
- operator: e,
1117
- rows: s,
1118
- // Required documents mode has no operator row: nothing reads it.
1119
- operatorChannel: f ? p.operatorChannel : ys(
1120
- e,
1121
- s.length > 0 && p.batch === "on-device"
1122
- ),
1123
- batchChannel: p.batch,
1124
- otpOverride: ((o = _ == null ? void 0 : _[0]) == null ? void 0 : o.skipOtp) ?? null
1125
- };
1126
- }
1127
- const t = { batchChannel: "on-device", otpOverride: null };
1128
- if (!f)
1129
- return {
1130
- operator: e,
1131
- rows: s,
1132
- operatorChannel: ys(
1133
- e,
1134
- s.some((p) => p.channel === "on-device")
1135
- ),
1136
- ...t
1137
- };
1138
- const a = zn(
1139
- f,
1140
- e,
1141
- X ?? se(e),
1142
- s,
1143
- null
1144
- );
1145
- return {
1146
- operator: e,
1147
- rows: a.rows,
1148
- operatorChannel: a.operatorChannel,
1149
- ...t
1150
- };
1151
- }, [cn] = L(ks), [z, Fn] = L(cn.operator), [q, pe] = L(cn.rows), [Z, qe] = L(
1152
- cn.operatorChannel
1153
- ), [O, Os] = L(
1154
- cn.batchChannel
1155
- ), [Vt, Hn] = L(
1156
- cn.otpOverride
1157
- ), Ts = bs(q, O), y = x ? q.slice(0, Ts) : q, [Qt, jn] = L({}), He = {};
1158
- for (const e of B)
1159
- De(e) && (He[e.id] = Qt[e.id] ?? ws(
1160
- e.initialOperatorId !== void 0 ? e.initialOperatorId : b
1161
- ));
1162
- const [Kt, Un] = L({}), Wn = {};
1163
- for (const e of B) {
1164
- const s = He[e.id];
1165
- s === void 0 || s === Q || s === "" || (Wn[e.id] = Kt[e.id] ?? se(s));
1166
- }
1167
- const Es = (e) => {
1168
- e.length !== 0 && Un(
1169
- (s) => Object.fromEntries(
1170
- Object.entries(s).filter(([t]) => !e.includes(t))
1171
- )
1172
- );
1173
- }, Xt = (e, s) => {
1174
- He[e] !== s && Es([e]), jn((t) => ({ ...t, [e]: s }));
1175
- }, Yt = () => {
1176
- g !== void 0 && (Es(
1177
- B.filter(
1178
- (e) => De(e) && He[e.id] !== g
1179
- ).map((e) => e.id)
1180
- ), jn((e) => {
1181
- const s = { ...e };
1182
- for (const t of B)
1183
- De(t) && (s[t.id] = g);
1184
- return s;
1185
- }));
1186
- }, [As, oe] = L(null), [Jt, je] = L(
1187
- null
1188
- ), [Zt, Bn] = L(!1), [ea, Nn] = L(0), Gn = !x && (xe !== void 0 || Re), [na, sa] = L(i);
1189
- i !== na && (sa(i), i && (Bn(!1), Nn(0), _n(!1)));
1190
- const Ps = ge(i);
1191
- Ee(() => {
1192
- if (i && !Ps.current) {
1193
- const e = ks();
1194
- Fn(e.operator), pe(e.rows), qe(e.operatorChannel), Os(e.batchChannel), Hn(e.otpOverride), oe(null), je(null), jn({}), Un({});
1195
- }
1196
- Ps.current = i;
1197
- }, [i]);
1198
- const Vn = (e) => ln(e).length === 0, Ue = N ? y.length > 0 && O === "on-device" : y.some(
1199
- (e) => e.channel === "on-device" && !Vn(e.signerId)
1200
- ), qn = f !== void 0;
1201
- Ee(() => {
1202
- if (!(qn || !ne) && Z === "on-device" && !Ue) {
1203
- const e = se(z, !1);
1204
- qe(e), oe(e);
1205
- }
1206
- }, [Z, Ue, z, qn, ne]);
1207
- const Ds = I ? [{ value: Q, label: d("signatureRequest.assignLater") }] : [], _s = c.map(
1208
- ({ value: e, label: s, disabled: t, reason: a, deleted: u }) => ({
1209
- value: e,
1210
- label: s,
1211
- ...t === !0 ? { disabled: !0, ...a ? { description: a } : {} } : {},
1212
- ...u === !0 ? { deleted: !0 } : {}
1213
- })
1214
- ), Cn = x ? [...Ds, ..._s] : [..._s, ...Ds], Qn = Mt(Cn, Pn.language), Ls = j(), We = z === Q, ce = cs(), de = f ? f(
1215
- $n(z, Z, q, null, O)
1216
- ) : void 0, Ie = (e, s, t, a, u = []) => {
1217
- if (!f) return;
1218
- if (N) {
1219
- Be(t, O, {
1220
- operatorId: e,
1221
- opChannel: s,
1222
- changed: a
1223
- });
1224
- return;
1225
- }
1226
- const o = zn(
1227
- f,
1228
- e,
1229
- s,
1230
- t,
1231
- a
1232
- );
1233
- qe(o.operatorChannel), pe(o.rows), oe(null);
1234
- const p = [];
1235
- ne && e !== Q && e !== "" && o.operatorChannel !== s && p.push(
1236
- d("signatureRequest.operatorChannelChanged", {
1237
- channel: ce[o.operatorChannel].label
1238
- })
1239
- ), o.rows.forEach((R, M) => {
1240
- R.channel !== t[M].channel && p.push(
1241
- d("signatureRequest.signerChannelChanged", {
1242
- name: sn(l, R.signerId),
1243
- channel: ce[R.channel].label
1244
- })
1245
- );
1246
- }), p.push(...u), je(p.length > 0 ? p.join(" ") : null);
1247
- }, Be = (e, s, {
1248
- primaryChanged: t = !1,
1249
- userChannel: a = !1,
1250
- operatorId: u = z,
1251
- opChannel: o = Z,
1252
- changed: p = "signers"
1253
- } = {}) => {
1254
- var te, G, ae;
1255
- const m = Is(
1256
- e,
1257
- t ? qs((te = e[0]) == null ? void 0 : te.signerId, !1) : s,
1258
- p,
1259
- u,
1260
- o
1261
- ), R = m.batch, M = x && e.length > 1 && t, T = [];
1262
- if (ne && u !== Q && u !== "" && m.operatorChannel !== o && T.push(
1263
- d("signatureRequest.operatorChannelChanged", {
1264
- channel: ce[m.operatorChannel].label
1265
- })
1266
- ), R !== (a ? s : O) && T.push(
1267
- d("signatureRequest.signerChannelChanged", {
1268
- name: sn(l, ((G = e[0]) == null ? void 0 : G.signerId) ?? ""),
1269
- channel: ce[R].label
1270
- })
1271
- ), x && y.length > 1) {
1272
- const ie = On({
1273
- items: B,
1274
- channel: R,
1275
- primaryIsPatient: xn((ae = e[0]) == null ? void 0 : ae.signerId)
1276
- });
1277
- M ? T.push(d("signatureRequest.secondSigneeCleared")) : ie !== null && e.length > 1 && T.push(d(os[ie]));
1278
- }
1279
- pe(M ? e.slice(0, 1) : e), ne && qe(m.operatorChannel), R !== O && Hn(null), Os(R), oe(null), je(T.length > 0 ? T.join(" ") : null);
1280
- }, Ms = on(
1281
- (nt = q[0]) == null ? void 0 : nt.signerId,
1282
- q[0] === void 0 || (st = de == null ? void 0 : de.signerAvailableChannels) == null ? void 0 : st[q[0].signerId]
1283
- );
1284
- N && !Ms.includes(O) && Be(q, Ms[0]);
1285
- const Kn = N ? q : q.map((e) => {
1286
- const s = ln(e.signerId);
1287
- return s.length === 0 || s.includes(e.channel) ? e : { ...e, channel: s[0], skipOtp: void 0 };
1288
- });
1289
- if (Kn.some((e, s) => e !== q[s])) {
1290
- const e = f ? zn(
1291
- f,
1292
- z,
1293
- Z,
1294
- Kn,
1295
- "signers"
1296
- ) : { operatorChannel: Z, rows: Kn };
1297
- pe(e.rows), qe(e.operatorChannel), oe(null);
1298
- const s = e.rows.filter((t, a) => t.channel !== q[a].channel).map(
1299
- (t) => d("signatureRequest.signerChannelChanged", {
1300
- name: sn(l, t.signerId),
1301
- channel: ce[t.channel].label
1302
- })
1303
- );
1304
- je(s.length > 0 ? s.join(" ") : null);
1305
- }
1306
- const Ge = (e, s) => ({
1307
- value: e,
1308
- label: ce[s].label,
1309
- startAdornment: ce[s].icon
1310
- }), wn = qn || Ue ? void 0 : d("signatureRequest.onDeviceUnavailableHint"), $s = qn ? xs(de).map(
1311
- (e) => Ge(e, e)
1312
- ) : [
1313
- Ge("sms", "sms"),
1314
- Ge("email", "email"),
1315
- {
1316
- ...Ge("on-device", "on-device"),
1317
- disabled: !Ue,
1318
- description: wn
1319
- }
1320
- ], zs = /* @__PURE__ */ n(At, { meta: ce }), Fs = y.map((e) => e.signerId), Ve = l.find(
1321
- (e) => !Fs.includes(e.value) && !(x && e.isPatient === !0)
1322
- ), ta = !k && y.length < Ts && Ve !== void 0, ke = x || N ? (tt = y[0]) == null ? void 0 : tt.signerId : void 0, Xn = xn(ke), aa = N ? O : ((at = y[0]) == null ? void 0 : at.channel) ?? O, Hs = x ? On({
1323
- items: B,
1324
- channel: aa,
1325
- primaryIsPatient: Xn
1326
- }) : null, Yn = x && !P && B.length > 0 && Hs !== null && l.length > 1 ? d(os[Hs]) : null, yn = x && y.length > 1 ? Ga({
1327
- primaryId: ke,
1328
- secondId: y[1].signerId,
1329
- channel: N ? O : y[1].channel,
1330
- options: l
1331
- }) : null, Jn = on(
1332
- (Fe == null ? void 0 : Fe.value) ?? ke
1333
- ).includes("sms"), Qe = (x || N) && Xn && !Jn, Zn = N && O === "on-device" && (Qe || (Vt ?? !Jn)), ia = N && y.length > 0 && (Qe || Zn), es = (e) => x && e === 0, ns = (e, s) => e.channel === "on-device" && (es(s) ? Qe || (e.skipOtp ?? !Jn) : e.skipOtp === !0), Sn = Ne && !(x && P), ra = (e, s) => {
1334
- pe(
1335
- (t) => t.map(
1336
- (a) => a.rowId === e ? { ...a, ...s } : a
1337
- )
1338
- );
1339
- }, la = () => {
1340
- if (!Ve) return;
1341
- if (N) {
1342
- Be(
1343
- [
1344
- ...q,
1345
- {
1346
- signerId: Ve.value,
1347
- channel: O,
1348
- rowId: vn.current++
1349
- }
1350
- ],
1351
- O
1352
- );
1353
- return;
1354
- }
1355
- const e = Rn(
1356
- Ve.value,
1357
- x ? "on-device" : "sms"
1358
- );
1359
- if (f) {
1360
- Ie(
1361
- z,
1362
- Z,
1363
- [
1364
- ...q,
1365
- {
1366
- signerId: Ve.value,
1367
- channel: e,
1368
- rowId: vn.current++
1369
- }
1370
- ],
1371
- "signers"
1372
- );
1373
- return;
1374
- }
1375
- pe((s) => [
1376
- ...s,
1377
- {
1378
- signerId: Ve.value,
1379
- channel: e,
1380
- rowId: vn.current++
1381
- }
1382
- ]);
1383
- }, oa = (e) => {
1384
- var s;
1385
- if ((s = us.current) == null || s.focus(), N) {
1386
- Be(
1387
- q.filter((t) => t.rowId !== e),
1388
- O
1389
- );
1390
- return;
1391
- }
1392
- if (f) {
1393
- Ie(
1394
- z,
1395
- Z,
1396
- q.filter((t) => t.rowId !== e),
1397
- "signers"
1398
- );
1399
- return;
1400
- }
1401
- pe(
1402
- (t) => t.filter((a) => a.rowId !== e)
1403
- );
1404
- }, js = Ne && !N && y.some((e) => Vn(e.signerId)), Us = Ne && (N ? y.length > 0 && O === "qr" : y.some((e) => e.channel === "qr")), Ws = !N && y.some(
1405
- (e, s) => ns(e, s) && !Vn(e.signerId)
1406
- ), ss = (e) => new Intl.ListFormat(Pn.language || "en", { type: "unit" }).format(
1407
- e
1408
- ), Bs = (e, s) => e.map((t) => {
1409
- const a = s.get(t);
1410
- return a === void 0 ? Ge(t, t) : {
1411
- ...Ge(t, t),
1412
- disabled: !0,
1413
- description: a
1414
- };
1415
- }), Gs = (e, s, t) => {
1416
- const a = /* @__PURE__ */ new Map();
1417
- for (const u of e) {
1418
- const o = s.get(u);
1419
- o !== void 0 && a.set(o, [
1420
- ...a.get(o) ?? [],
1421
- ce[u].label
1422
- ]);
1423
- }
1424
- if (a.size !== 0)
1425
- return ss(t ? [...a.keys()] : [...a].map(
1426
- ([u, o]) => `${ss(o)} (${u})`
1427
- ));
1428
- }, Vs = Ns(
1429
- ke,
1430
- ke === void 0 || (it = de == null ? void 0 : de.signerAvailableChannels) == null ? void 0 : it[ke]
1431
- ), Qs = Mn(ke), Ks = Bs(
1432
- Vs,
1433
- Qs
1434
- ), ts = Gs(
1435
- Vs,
1436
- Qs,
1437
- !1
1438
- ), ca = () => {
1439
- var t;
1440
- if (js || yn !== null) return;
1441
- Bn(Us), Us && ((t = ze.current) == null || t.focus(), Nn(0));
1442
- const e = y.map(
1443
- ({ rowId: a, ...u }, o) => N ? {
1444
- signerId: u.signerId,
1445
- channel: O,
1446
- // The batch's OTP waiver rides on the main signer.
1447
- ...o === 0 && O === "on-device" ? { skipOtp: Zn } : {}
1448
- } : es(o) && u.channel === "on-device" ? { ...u, skipOtp: ns(u, o) } : u
1449
- ), s = N ? { signMode: O } : {};
1450
- if (x) {
1451
- const a = {};
1452
- let u = null;
1453
- for (const p of B) {
1454
- if (!De(p)) continue;
1455
- const m = He[p.id], R = m === Q || m === "" || m === void 0 ? null : m;
1456
- a[p.id] = R, u ?? (u = R);
1457
- }
1458
- const o = {};
1459
- for (const [p, m] of Object.entries(
1460
- a
1461
- ))
1462
- m !== null && (o[p] = Wn[p]);
1463
- be({
1464
- operatorId: u,
1465
- operatorChannel: null,
1466
- signers: e,
1467
- ...s,
1468
- operatorAssignments: a,
1469
- ...ye ? { operatorChannels: o } : {},
1470
- requiredItemIds: B.map((p) => p.id)
1471
- });
1472
- return;
1473
- }
1474
- be({
1475
- operatorId: !D || We ? null : z,
1476
- operatorChannel: !D || We ? null : Z,
1477
- signers: $ ? e : [],
1478
- ...$ ? s : {}
1479
- });
1480
- };
1481
- Ee(() => {
1482
- re && Bn(!1);
1483
- }, [re]);
1484
- const Ke = ((U == null ? void 0 : U.length) ?? 0) > 0, Xe = Ke || !re && ($e || Zt), In = Ne ? y.filter(
1485
- (e) => (N ? O : e.channel) === "qr"
1486
- ).map((e) => e.signerId) : [];
1487
- for (const e of U ?? [])
1488
- In.includes(e.signerId) || In.push(e.signerId);
1489
- const dn = In.length, Oe = Math.min(ea, Math.max(dn - 1, 0)), Te = In[Oe], Ye = Te === void 0 ? "" : sn(l, Te), un = U == null ? void 0 : U.find((e) => e.signerId === Te), Xs = un ? si(un.expiresAt, Pn.language || "en", d) : null, da = Oe >= dn - 1, Ys = Ke && dn > 1, Js = i && Xe && !le ? `${Ke}:${Oe}` : null;
1490
- Ee(() => {
1491
- var e;
1492
- Js !== null && ((e = ze.current) == null || e.focus());
1493
- }, [Js]);
1494
- const Zs = i && le ? le : null;
1495
- Ee(() => {
1496
- var e;
1497
- Zs !== null && ((e = ze.current) == null || e.focus());
1498
- }, [Zs]);
1499
- const ua = Ke ? un ? Ye ? d("signatureRequest.qrCaptionNamed", { name: Ye }) : d("signatureRequest.qrCaption") : (
1500
- // The error alert in the body carries the message (and announces
1501
- // itself); the description only names whose slot this is.
1502
- Ye || Te
1503
- ) : d("signatureRequest.qrPending");
1504
- return /* @__PURE__ */ n("div", { ref: zt, className: "ds:contents", "data-component": "signature-request", children: /* @__PURE__ */ n(St, { children: /* @__PURE__ */ n(S, { open: i, onOpenChange: r, children: /* @__PURE__ */ h(
1505
- S.Content,
1506
- {
1507
- size: "lg",
1508
- scroll: "body",
1509
- hideCloseButton: !0,
1510
- onOpenAutoFocus: (e) => {
1511
- var s;
1512
- !Xe && !Gn && !le || (e.preventDefault(), (s = ze.current) == null || s.focus());
1513
- },
1514
- ...$t,
1515
- children: [
1516
- /* @__PURE__ */ h(S.Header, { children: [
1517
- /* @__PURE__ */ n(
1518
- S.Title,
1519
- {
1520
- ref: ze,
1521
- tabIndex: -1,
1522
- "aria-describedby": an ? ms : Xe ? Ys ? `${Dn} ${hs}` : Dn : void 0,
1523
- className: "ds:outline-none",
1524
- children: an ? an.title : Xe ? d("signatureRequest.qrTitle") : Le ?? d(
1525
- x ? "signatureRequest.requiredTitle" : "signatureRequest.title"
1526
- )
1527
- }
1528
- ),
1529
- an ? /* @__PURE__ */ n(S.Description, { asChild: !0, children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n("p", { id: ms, children: an.description }) }) }) : Xe ? /* @__PURE__ */ n(S.Description, { asChild: !0, children: /* @__PURE__ */ n("div", { children: /* @__PURE__ */ h(
1530
- "div",
1531
- {
1532
- id: Dn,
1533
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1534
- children: [
1535
- /* @__PURE__ */ n("p", { children: ua }),
1536
- Xs ? /* @__PURE__ */ n("p", { children: Xs }) : null
1537
- ]
1538
- }
1539
- ) }) }) : /* @__PURE__ */ n(S.Description, { children: Me ?? d(
1540
- x ? "signatureRequest.requiredDescription" : Gn ? (
1541
- // The table says whether there are signed
1542
- // versions, so the header describes the form.
1543
- "signatureRequest.requestDescription"
1544
- ) : "signatureRequest.noSignedVersions"
1545
- ) })
1546
- ] }),
1547
- le ? /* @__PURE__ */ h(we, { children: [
1548
- /* @__PURE__ */ n(S.Body, { children: /* @__PURE__ */ n(ei, { outcome: le }) }),
1549
- /* @__PURE__ */ h(S.Footer, { children: [
1550
- le === "creditsExhausted" && Se ? /* @__PURE__ */ n(
1551
- F,
1552
- {
1553
- intent: "primary",
1554
- startIcon: /* @__PURE__ */ n(Pa, {}),
1555
- onClick: Se,
1556
- children: d("signatureRequest.buyMoreSignatures")
1557
- }
1558
- ) : null,
1559
- le === "creditsExhausted" && J === "creditsExhausted" && Y ? /* @__PURE__ */ n(
1560
- F,
1561
- {
1562
- intent: "ghost",
1563
- onClick: () => {
1564
- var e;
1565
- (e = ze.current) == null || e.focus(), _n(!0), Y();
1566
- },
1567
- children: d("signatureRequest.outcomeCancel")
1568
- }
1569
- ) : null,
1570
- /* @__PURE__ */ n(S.Close, { asChild: !0, children: /* @__PURE__ */ n(F, { intent: "outline", children: d("signatureRequest.close") }) })
1571
- ] })
1572
- ] }) : Xe ? /* @__PURE__ */ h(we, { children: [
1573
- /* @__PURE__ */ n(S.Body, { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-center", children: Ke ? /* @__PURE__ */ h(we, { children: [
1574
- Ys ? (
1575
- // Also describes the heading, so screen readers hear
1576
- // the position when Previous or Next moves focus there.
1577
- /* @__PURE__ */ n(
1578
- "p",
1579
- {
1580
- id: hs,
1581
- className: "type-label ds:text-[var(--muted-foreground)]",
1582
- children: d("signatureRequest.qrStepCount", {
1583
- current: Oe + 1,
1584
- total: dn
1585
- })
1586
- }
1587
- )
1588
- ) : null,
1589
- Ye ? /* @__PURE__ */ n("p", { className: "type-title-item ds:break-words", children: Ye }) : null,
1590
- un ? (
1591
- // The QrCode's own name speaks of check-in, so the
1592
- // pattern names the code and hides the inner figure.
1593
- // `lg` keeps a long signing link at a module size a
1594
- // phone camera can read off a desk monitor.
1595
- /* @__PURE__ */ n(
1596
- "div",
1597
- {
1598
- role: "img",
1599
- "aria-label": d("signatureRequest.qrCodeLabel"),
1600
- "data-signer-id": Te,
1601
- children: /* @__PURE__ */ n(
1602
- fa,
1603
- {
1604
- value: un.url,
1605
- variant: "framed",
1606
- size: "lg",
1607
- decorative: !0
1608
- }
1609
- )
1610
- }
1611
- )
1612
- ) : /* @__PURE__ */ n(
1613
- K,
1614
- {
1615
- variant: "error",
1616
- className: "ds:text-start",
1617
- "data-signer-id": Te,
1618
- children: /* @__PURE__ */ n(K.Description, { children: d("signatureRequest.qrMissing", {
1619
- name: Ye || Te
1620
- }) })
1621
- }
1622
- )
1623
- ] }) : (
1624
- // Waiting for the server: the spinner's status role
1625
- // announces the wait politely.
1626
- /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:py-[var(--spacing-xl)]", children: /* @__PURE__ */ n(
1627
- va,
1628
- {
1629
- size: "lg",
1630
- label: d("signatureRequest.qrPending")
1631
- }
1632
- ) })
1633
- ) }),
1634
- /* @__PURE__ */ n(S.Footer, { children: Ke ? /* @__PURE__ */ h(we, { children: [
1635
- dn > 1 ? /* @__PURE__ */ n(
1636
- F,
1637
- {
1638
- intent: "outline",
1639
- disabled: Oe === 0,
1640
- onClick: () => Nn(Oe - 1),
1641
- children: d("signatureRequest.qrPrevious")
1642
- }
1643
- ) : null,
1644
- da ? /* @__PURE__ */ n(
1645
- F,
1646
- {
1647
- intent: "primary",
1648
- onClick: () => {
1649
- he == null || he(), r(!1);
1650
- },
1651
- children: d("signatureRequest.qrDone")
1652
- }
1653
- ) : /* @__PURE__ */ n(
1654
- F,
1655
- {
1656
- intent: "primary",
1657
- onClick: () => Nn(Oe + 1),
1658
- children: d("signatureRequest.qrNext")
1659
- }
1660
- )
1661
- ] }) : /* @__PURE__ */ n(S.Close, { asChild: !0, children: /* @__PURE__ */ n(F, { intent: "outline", children: d("signatureRequest.close") }) }) })
1662
- ] }) : /* @__PURE__ */ h(we, { children: [
1663
- /* @__PURE__ */ h(S.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
1664
- Gn ? /* @__PURE__ */ h(we, { children: [
1665
- /* @__PURE__ */ n(
1666
- ja,
1667
- {
1668
- signatures: xe,
1669
- loading: Re,
1670
- showLegalLevel: C,
1671
- onView: me,
1672
- onDownload: A,
1673
- onShare: v,
1674
- shareTargets: w,
1675
- onDelete: W
1676
- }
1677
- ),
1678
- ne || Sn ? /* @__PURE__ */ n(dt, { decorative: !0 }) : null
1679
- ] }) : null,
1680
- x ? /* @__PURE__ */ n(
1681
- Ja,
1682
- {
1683
- items: B,
1684
- loading: P,
1685
- operatorOptions: Cn,
1686
- assignments: He,
1687
- onAssign: Xt,
1688
- showOperatorChannels: ye,
1689
- operatorChannels: Wn,
1690
- onOperatorChannel: (e, s) => Un((t) => ({
1691
- ...t,
1692
- [e]: s
1693
- })),
1694
- onAssignAllToMe: g !== void 0 ? Yt : void 0,
1695
- busy: k
1696
- }
1697
- ) : null,
1698
- ne ? /* @__PURE__ */ h(
1699
- "section",
1700
- {
1701
- className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start`,
1702
- children: [
1703
- /* @__PURE__ */ n("div", { className: ue, children: /* @__PURE__ */ h("div", { className: En, children: [
1704
- /* @__PURE__ */ n("p", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: d("signatureRequest.operatorSection") }),
1705
- g !== void 0 ? /* @__PURE__ */ n(
1706
- F,
1707
- {
1708
- intent: "outline",
1709
- size: "sm",
1710
- startIcon: /* @__PURE__ */ n(Tt, {}),
1711
- disabled: k,
1712
- onClick: () => {
1713
- if (Fn(g), f) {
1714
- Ie(
1715
- g,
1716
- se(g),
1717
- q,
1718
- "operator"
1719
- );
1720
- return;
1721
- }
1722
- qe(
1723
- se(
1724
- g,
1725
- Ue
1726
- )
1727
- ), oe(null);
1728
- },
1729
- children: d("signatureRequest.assignToMe")
1730
- }
1731
- ) : null
1732
- ] }) }),
1733
- /* @__PURE__ */ h("div", { className: ue, "data-person-row": "operator", children: [
1734
- /* @__PURE__ */ n("div", { className: ft, children: /* @__PURE__ */ n(
1735
- ut,
1736
- {
1737
- "aria-hidden": "true",
1738
- name: We ? void 0 : sn(c, z),
1739
- size: "sm"
1740
- }
1741
- ) }),
1742
- /* @__PURE__ */ h("div", { className: vt, children: [
1743
- /* @__PURE__ */ n(
1744
- Ae,
1745
- {
1746
- options: _t(
1747
- Cn,
1748
- z
1749
- ),
1750
- value: z,
1751
- showDescriptions: !0,
1752
- "aria-describedby": Qn ? Ls : void 0,
1753
- onValueChange: (e) => {
1754
- if (!(!e || !Lt(Cn, e))) {
1755
- if (Fn(e), f) {
1756
- Ie(
1757
- e,
1758
- e === Q ? "email" : se(e),
1759
- q,
1760
- "operator"
1761
- );
1762
- return;
1763
- }
1764
- qe(
1765
- e === Q ? "email" : se(
1766
- e,
1767
- Ue
1768
- )
1769
- ), oe(null);
1770
- }
1771
- },
1772
- required: !0,
1773
- disabled: k,
1774
- placeholder: d(
1775
- "signatureRequest.operatorPlaceholder"
1776
- ),
1777
- "aria-label": d("signatureRequest.operatorSection")
1778
- }
1779
- ),
1780
- Qn ? /* @__PURE__ */ n(
1781
- "span",
1782
- {
1783
- id: Ls,
1784
- className: "ds:sr-only",
1785
- children: Qn
1786
- }
1787
- ) : null
1788
- ] }),
1789
- /* @__PURE__ */ h(
1790
- "div",
1791
- {
1792
- className: We ? `${is} ds:hidden ds:@[512px]/person:block` : is,
1793
- children: [
1794
- We ? null : /* @__PURE__ */ n(
1795
- Ae,
1796
- {
1797
- id: "signature-request-operator-channel",
1798
- options: $s,
1799
- value: Z,
1800
- adornmentInTrigger: !0,
1801
- showDescriptions: !0,
1802
- disabled: k,
1803
- "aria-label": d(
1804
- "signatureRequest.operatorChannelLabel"
1805
- ),
1806
- "aria-describedby": wn ? gs : void 0,
1807
- onValueChange: (e) => {
1808
- if ($s.some(
1809
- (t) => t.value === e && !t.disabled
1810
- )) {
1811
- if (f) {
1812
- Ie(
1813
- z,
1814
- e,
1815
- q,
1816
- "operator"
1817
- );
1818
- return;
1819
- }
1820
- qe(e), oe(null);
1821
- }
1822
- }
1823
- }
1824
- ),
1825
- zs
1826
- ]
1827
- }
1828
- ),
1829
- wn && !We ? /* @__PURE__ */ n("span", { id: gs, className: "ds:sr-only", children: wn }) : null
1830
- ] })
1831
- ]
1832
- }
1833
- ) : null,
1834
- ne || Sn ? /* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: As ? d("signatureRequest.operatorChannelReverted", {
1835
- channel: ce[As].label
1836
- }) : Jt }) : null,
1837
- (ne || x) && Sn ? /* @__PURE__ */ n(dt, { decorative: !0 }) : null,
1838
- Sn ? /* @__PURE__ */ h(
1839
- "section",
1840
- {
1841
- className: `${pn} ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start`,
1842
- children: [
1843
- /* @__PURE__ */ h("div", { className: ue, children: [
1844
- /* @__PURE__ */ h("div", { className: En, children: [
1845
- /* @__PURE__ */ n("p", { className: "type-eyebrow ds:text-[color:var(--muted-foreground)]", children: d("signatureRequest.signersSection") }),
1846
- l.length > 1 ? /* @__PURE__ */ n(
1847
- F,
1848
- {
1849
- ref: us,
1850
- intent: "outline",
1851
- size: "sm",
1852
- startIcon: /* @__PURE__ */ n(gt, {}),
1853
- disabled: !ta,
1854
- "aria-describedby": Yn ? ps : void 0,
1855
- onClick: la,
1856
- children: d("signatureRequest.addSigner")
1857
- }
1858
- ) : null
1859
- ] }),
1860
- x && ds && !l.some(
1861
- (e) => e.isPatient !== !0
1862
- ) ? /* @__PURE__ */ n("div", { className: H, children: /* @__PURE__ */ n(
1863
- F,
1864
- {
1865
- intent: "link",
1866
- size: "sm",
1867
- startIcon: /* @__PURE__ */ n(gt, {}),
1868
- disabled: k,
1869
- onClick: ds,
1870
- children: d("signatureRequest.addSignatory")
1871
- }
1872
- ) }) : null,
1873
- N ? /* @__PURE__ */ h(
1874
- "div",
1875
- {
1876
- className: `${H} ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]`,
1877
- children: [
1878
- /* @__PURE__ */ n(
1879
- "label",
1880
- {
1881
- htmlFor: yt,
1882
- className: "type-label ds:text-foreground",
1883
- children: d("signatureRequest.channelLabel")
1884
- }
1885
- ),
1886
- /* @__PURE__ */ n(
1887
- Ae,
1888
- {
1889
- id: yt,
1890
- options: Ks,
1891
- value: O,
1892
- adornmentInTrigger: !0,
1893
- showDescriptions: !0,
1894
- disabled: k,
1895
- "aria-label": d("signatureRequest.channelLabel"),
1896
- "aria-describedby": ts ? fs : void 0,
1897
- onValueChange: (e) => {
1898
- Ks.some(
1899
- (t) => t.value === e && !t.disabled
1900
- ) && Be(
1901
- q,
1902
- e,
1903
- { userChannel: !0 }
1904
- );
1905
- }
1906
- }
1907
- ),
1908
- ts ? /* @__PURE__ */ n(
1909
- "span",
1910
- {
1911
- id: fs,
1912
- className: "ds:sr-only",
1913
- children: ts
1914
- }
1915
- ) : null
1916
- ]
1917
- }
1918
- ) : null,
1919
- N && O === "on-device" ? /* @__PURE__ */ n("div", { className: H, children: /* @__PURE__ */ n(
1920
- ct,
1921
- {
1922
- label: d("signatureRequest.noOtp"),
1923
- checked: Zn,
1924
- disabled: k || Qe,
1925
- "aria-describedby": Qe ? bn : void 0,
1926
- onCheckedChange: (e) => Hn(e)
1927
- }
1928
- ) }) : null,
1929
- ia ? /* @__PURE__ */ n(
1930
- K,
1931
- {
1932
- variant: "warning",
1933
- id: bn,
1934
- className: H,
1935
- children: /* @__PURE__ */ n(K.Description, { children: d("signatureRequest.noOtpWarning") })
1936
- }
1937
- ) : null,
1938
- Yn ? /* @__PURE__ */ n(
1939
- "p",
1940
- {
1941
- id: ps,
1942
- className: `${H} type-body-sm ds:text-[color:var(--muted-foreground)]`,
1943
- children: Yn
1944
- }
1945
- ) : null
1946
- ] }),
1947
- /* @__PURE__ */ n("div", { className: $a, children: y.map((e, s) => {
1948
- var lt, ot;
1949
- const t = l.filter(
1950
- (E) => E.value === e.signerId || !Fs.includes(E.value)
1951
- ), a = sn(
1952
- l,
1953
- e.signerId
1954
- ), u = ((lt = l.find(
1955
- (E) => E.value === e.signerId
1956
- )) == null ? void 0 : lt.isMinor) === !0, o = x && s > 0, p = o ? t.filter(
1957
- (E) => E.isPatient !== !0
1958
- ) : t, m = p.some(
1959
- (E) => E.value === e.signerId
1960
- ), R = o ? yn : null, M = `${vs}-${e.rowId}`, T = `${Ht}-${e.rowId}`, Ce = rn(
1961
- e.signerId
1962
- ), te = Ln(
1963
- e.signerId,
1964
- (ot = de == null ? void 0 : de.signerAvailableChannels) == null ? void 0 : ot[e.signerId]
1965
- ), G = Bs(
1966
- te,
1967
- Ce
1968
- ), ae = !N && G.every(
1969
- (E) => E.disabled
1970
- ), ie = N ? void 0 : Gs(
1971
- te,
1972
- Ce,
1973
- ae
1974
- ), Je = `${Ft}-${e.rowId}`, kn = es(s) && Qe, ha = x ? o : y.length > 1, ma = (E) => {
1975
- if (!E || !p.some(
1976
- (V) => V.value === E
1977
- ))
1978
- return;
1979
- if (N) {
1980
- Be(
1981
- q.map(
1982
- (V) => V.rowId === e.rowId ? { ...V, signerId: E } : V
1983
- ),
1984
- O,
1985
- { primaryChanged: x && !o }
1986
- );
1987
- return;
1988
- }
1989
- const as = Rn(
1990
- E,
1991
- e.channel
1992
- ), hn = x && !o && q.length > 1, mn = (hn ? q.slice(0, 1) : q).map(
1993
- (V) => V.rowId === e.rowId ? {
1994
- ...V,
1995
- signerId: E,
1996
- channel: as,
1997
- skipOtp: as === "on-device" ? V.skipOtp : void 0
1998
- } : V
1999
- ), Ze = hn && y.length > 1 ? [d("signatureRequest.secondSigneeCleared")] : [];
2000
- if (f) {
2001
- Ie(
2002
- z,
2003
- Z,
2004
- mn,
2005
- "signers",
2006
- Ze
2007
- );
2008
- return;
2009
- }
2010
- pe(mn), Ze.length > 0 && (oe(null), je(Ze.join(" ")));
2011
- }, pa = (E) => {
2012
- if (!G.some(
2013
- (en) => en.value === E && !en.disabled
2014
- )) return;
2015
- const hn = E, mn = q.map(
2016
- (en) => en.rowId === e.rowId ? { ...en, channel: hn, skipOtp: void 0 } : en
2017
- ), Ze = x && !o && y.length > 1 ? On({
2018
- items: B,
2019
- channel: hn,
2020
- primaryIsPatient: Xn
2021
- }) : null, V = Ze === null ? [] : [d(os[Ze])];
2022
- if (f) {
2023
- Ie(
2024
- z,
2025
- Z,
2026
- mn,
2027
- "signers",
2028
- V
2029
- );
2030
- return;
2031
- }
2032
- pe(mn), V.length > 0 && (oe(null), je(V.join(" ")));
2033
- }, rt = /* @__PURE__ */ h(
2034
- "div",
2035
- {
2036
- role: "group",
2037
- "aria-label": o ? void 0 : a,
2038
- "aria-labelledby": o ? T : void 0,
2039
- "data-signer-id": e.signerId,
2040
- "data-signer-role": x ? o ? "second" : "main" : void 0,
2041
- className: ue,
2042
- children: [
2043
- /* @__PURE__ */ n("div", { className: ft, children: /* @__PURE__ */ n(
2044
- ut,
2045
- {
2046
- "aria-hidden": "true",
2047
- name: x && !m ? void 0 : a,
2048
- size: "sm"
2049
- }
2050
- ) }),
2051
- /* @__PURE__ */ n(
2052
- "div",
2053
- {
2054
- className: N ? La : vt,
2055
- children: /* @__PURE__ */ n(
2056
- Ae,
2057
- {
2058
- options: p,
2059
- value: x && !m ? "" : e.signerId,
2060
- tone: R ? "error" : "default",
2061
- "aria-describedby": R ? M : void 0,
2062
- onValueChange: ma,
2063
- required: !0,
2064
- disabled: k,
2065
- placeholder: d(
2066
- "signatureRequest.signerPlaceholder"
2067
- ),
2068
- "aria-label": d(
2069
- "signatureRequest.signerPlaceholder"
2070
- )
2071
- }
2072
- )
2073
- }
2074
- ),
2075
- N ? null : /* @__PURE__ */ h("div", { className: is, children: [
2076
- /* @__PURE__ */ n(
2077
- Ae,
2078
- {
2079
- id: `signature-request-signer-channel-${e.rowId}`,
2080
- options: G,
2081
- value: ae ? "" : e.channel,
2082
- adornmentInTrigger: !0,
2083
- showDescriptions: !0,
2084
- disabled: k,
2085
- "aria-label": d(
2086
- "signatureRequest.channelLabel"
2087
- ),
2088
- "aria-describedby": ie ? Je : void 0,
2089
- onValueChange: pa
2090
- }
2091
- ),
2092
- zs
2093
- ] }),
2094
- ie && !ae ? /* @__PURE__ */ n(
2095
- "span",
2096
- {
2097
- id: Je,
2098
- className: "ds:sr-only",
2099
- children: ie
2100
- }
2101
- ) : null,
2102
- ha ? /* @__PURE__ */ n("div", { className: Ma, children: /* @__PURE__ */ n(
2103
- gn,
2104
- {
2105
- intent: "ghost",
2106
- size: "sm",
2107
- icon: /* @__PURE__ */ n(Sa, {}),
2108
- disabled: k,
2109
- "aria-label": d(
2110
- "signatureRequest.removeSigner"
2111
- ),
2112
- onClick: () => oa(e.rowId)
2113
- }
2114
- ) }) : null,
2115
- u ? /* @__PURE__ */ n(
2116
- K,
2117
- {
2118
- variant: "warning",
2119
- announce: "polite",
2120
- "data-note": "minor-signer",
2121
- className: H,
2122
- children: /* @__PURE__ */ n(K.Description, { children: d("signatureRequest.minorSignerWarning") })
2123
- }
2124
- ) : null,
2125
- R ? /* @__PURE__ */ n(
2126
- "p",
2127
- {
2128
- id: M,
2129
- role: "status",
2130
- "data-note": "second-signee-issue",
2131
- "data-issue": R,
2132
- className: `${H} type-body-sm ds:text-[color:var(--destructive)]`,
2133
- children: d(ni[R])
2134
- }
2135
- ) : null,
2136
- ae && ie ? /* @__PURE__ */ n(
2137
- "p",
2138
- {
2139
- id: Je,
2140
- "data-note": "no-channel",
2141
- className: `${H} type-body-sm ds:text-[color:var(--muted-foreground)]`,
2142
- children: ie
2143
- }
2144
- ) : null,
2145
- !N && e.channel === "on-device" && !ae ? /* @__PURE__ */ n("div", { className: H, children: /* @__PURE__ */ n(
2146
- ct,
2147
- {
2148
- label: d("signatureRequest.noOtp"),
2149
- checked: ns(e, s),
2150
- disabled: k || kn,
2151
- "aria-describedby": kn ? bn : void 0,
2152
- onCheckedChange: (E) => ra(e.rowId, {
2153
- skipOtp: E
2154
- })
2155
- }
2156
- ) }) : null
2157
- ]
2158
- },
2159
- e.rowId
2160
- );
2161
- return o ? /* @__PURE__ */ h(
2162
- "div",
2163
- {
2164
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
2165
- children: [
2166
- /* @__PURE__ */ n("div", { className: ue, children: /* @__PURE__ */ n(
2167
- "p",
2168
- {
2169
- id: T,
2170
- className: `${H} type-label ds:text-[color:var(--muted-foreground)]`,
2171
- children: d("signatureRequest.secondSigneeLabel")
2172
- }
2173
- ) }),
2174
- rt
2175
- ]
2176
- },
2177
- e.rowId
2178
- ) : rt;
2179
- }) })
2180
- ]
2181
- }
2182
- ) : null,
2183
- Ws || re ? /* @__PURE__ */ n("div", { className: pn, children: /* @__PURE__ */ h("div", { className: ue, children: [
2184
- Ws ? /* @__PURE__ */ n(
2185
- K,
2186
- {
2187
- variant: "warning",
2188
- id: bn,
2189
- className: H,
2190
- children: /* @__PURE__ */ n(K.Description, { children: d("signatureRequest.noOtpWarning") })
2191
- }
2192
- ) : null,
2193
- re ? /* @__PURE__ */ n(K, { variant: "error", className: H, children: /* @__PURE__ */ n(K.Description, { children: re }) }) : null
2194
- ] }) }) : null
2195
- ] }),
2196
- /* @__PURE__ */ h(S.Footer, { children: [
2197
- /* @__PURE__ */ n(
2198
- F,
2199
- {
2200
- intent: "primary",
2201
- startIcon: /* @__PURE__ */ n(Ia, {}),
2202
- onClick: ca,
2203
- "aria-describedby": yn !== null && y[1] ? `${vs}-${y[1].rowId}` : void 0,
2204
- disabled: !k && (Ne && y.length === 0 || js || yn !== null || !Ne && !ne || x && (P || B.length === 0)),
2205
- loading: k,
2206
- children: d("signatureRequest.requestSignature")
2207
- }
2208
- ),
2209
- /* @__PURE__ */ n(S.Close, { asChild: !0, children: /* @__PURE__ */ n(F, { intent: "outline", disabled: k, children: d("signatureRequest.close") }) })
2210
- ] })
2211
- ] })
2212
- ]
2213
- }
2214
- ) }) }) });
2215
- }
2216
- );
2217
- ti.displayName = "SignatureRequestModal";
2218
- export {
2219
- ti as S
2220
- };
2221
- //# sourceMappingURL=signature-request-ldmXj2X6.js.map