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