@alfadocs/ui-kit 1.45.0 → 1.47.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 (178) hide show
  1. package/dist/_chunks/{actions-cell-renderer-BXBy9c0f.js → actions-cell-renderer-B5m9lwgC.js} +2 -2
  2. package/dist/_chunks/ai-credits-notice-xszqOZTC.js +90 -0
  3. package/dist/_chunks/ai-credits-notice.agent-C9L7orrP.js +17 -0
  4. package/dist/_chunks/{ai-consent-banner-D7I2U-cz.js → ai-permission-notice-D7I2U-cz.js} +1 -1
  5. package/dist/_chunks/ai-sparkle-D23NT8Z_.js +45 -0
  6. package/dist/_chunks/{anamnesis-summary-rows-DQUqwWc1.js → anamnesis-summary-rows-DI-UX5r6.js} +2 -2
  7. package/dist/_chunks/{appointment-card-TgR_2GKS.js → appointment-card-DluZy8Iv.js} +2 -2
  8. package/dist/_chunks/{appointment-peek-abiR0T9e.js → appointment-peek-BsfCpiJs.js} +3 -3
  9. package/dist/_chunks/{appointment-timeline-CCnyUYKz.js → appointment-timeline-Cs5f9viN.js} +3 -3
  10. package/dist/_chunks/{appointment-tray-N0yEI8UF.js → appointment-tray-CLrGGnKR.js} +2 -2
  11. package/dist/_chunks/baby-Dku-Xvg9.js +23 -0
  12. package/dist/_chunks/{balance-badge-cell-o6LldMUA.js → balance-badge-cell-YGrYdrvR.js} +3 -3
  13. package/dist/_chunks/booking-C4MwImkS.js +3362 -0
  14. package/dist/_chunks/button-group-CA1tmu39.js +325 -0
  15. package/dist/_chunks/{calendar-U6N0F99w.js → calendar-OzSeTb4V.js} +2 -2
  16. package/dist/_chunks/{calendar-event-card-DKUnT9Be.js → calendar-event-card-B6N5h1dO.js} +57 -48
  17. package/dist/_chunks/calendar-workspace-DDnQmiIL.js +12427 -0
  18. package/dist/_chunks/{chart-PF2krCZC.js → chart-D8ucl8hH.js} +2 -2
  19. package/dist/_chunks/{data-table-CcAx_I1w.js → data-table-DnKOmEVw.js} +2 -2
  20. package/dist/_chunks/{editable-currency-cell-renderer-Psb6XKHR.js → editable-currency-cell-renderer-OUkUv7U4.js} +2 -2
  21. package/dist/_chunks/{face-scheme-Bm6pe7R8.js → face-scheme-mIhwrQXt.js} +3 -3
  22. package/dist/_chunks/{file-manager-BfLQxF5t.js → file-manager-DOcJGIx2.js} +4 -4
  23. package/dist/_chunks/{freemium-paywall-Cz-O9lQD.js → freemium-paywall-BaW5ODc9.js} +2 -2
  24. package/dist/_chunks/{header-settings-CTe45iDy.js → header-settings-BEfx_-TF.js} +2 -2
  25. package/dist/_chunks/{help-me-write-templates-GUeEn3Ff.js → help-me-write-templates-DHIwa4xR.js} +205 -199
  26. package/dist/_chunks/{hover-card-BMJBVqIf.js → hover-card-nUae8NPJ.js} +67 -62
  27. package/dist/_chunks/{icon-button-group-DkkdIygu.js → icon-button-group-DZKC6KGf.js} +181 -168
  28. package/dist/_chunks/kit-extensions-DuoFF1R3.js +94 -0
  29. package/dist/_chunks/{marketplace-app-shell-DdwPj03y.js → marketplace-app-shell-PB89Dkk_.js} +2 -2
  30. package/dist/_chunks/{notes-panel-Dkk9QPPX.js → notes-panel-CHbDDMx8.js} +83 -73
  31. package/dist/_chunks/{patient-details-C8ImUrVg.js → patient-details-yrgkSeEY.js} +2 -2
  32. package/dist/_chunks/{patient-field-row-BRSOKvme.js → patient-field-row-DCMkFGqI.js} +3 -3
  33. package/dist/_chunks/{patient-summary-card-BhmKB2KR.js → patient-summary-card-CmEFflGS.js} +59 -45
  34. package/dist/_chunks/payment-form-DqJFiplX.js +881 -0
  35. package/dist/_chunks/{phone-input-BsZIoE36.js → phone-input-IWrGOCwm.js} +40 -39
  36. package/dist/_chunks/rich-text-editor-BwDV2XkZ.js +4153 -0
  37. package/dist/_chunks/{stepper-accordion-DmVykr5F.js → stepper-accordion-jMR8NaOB.js} +2 -1
  38. package/dist/_chunks/{tasks-panel-CpcikOeY.js → tasks-panel-DncuBPIZ.js} +2 -2
  39. package/dist/_chunks/{theme-toggle-bI0pgDDv.js → theme-toggle-BP0XRGMM.js} +2 -2
  40. package/dist/_chunks/use-ai-sparkle-Cf4yVTLB.js +76 -0
  41. package/dist/_chunks/{workflow-status-xeaJTzD3.js → workflow-status-CuJAOuKL.js} +43 -42
  42. package/dist/agent-catalog.json +36 -7
  43. package/dist/agent-i18n/en.json +3 -3
  44. package/dist/components/ai-credits-notice/ai-credits-notice.agent.d.ts +3 -0
  45. package/dist/components/ai-credits-notice/ai-credits-notice.d.ts +48 -0
  46. package/dist/components/ai-credits-notice/index.d.ts +4 -0
  47. package/dist/components/ai-credits-notice/index.js +7 -0
  48. package/dist/components/{ai-consent-banner/ai-consent-banner.agent.d.ts → ai-permission-notice/ai-permission-notice.agent.d.ts} +2 -2
  49. package/dist/components/{ai-consent-banner/ai-consent-banner.d.ts → ai-permission-notice/ai-permission-notice.d.ts} +1 -1
  50. package/dist/components/ai-permission-notice/index.d.ts +4 -0
  51. package/dist/components/{ai-consent-banner → ai-permission-notice}/index.js +1 -1
  52. package/dist/components/ai-sparkle/ai-sparkle.d.ts +3 -3
  53. package/dist/components/ai-sparkle/index.js +1 -1
  54. package/dist/components/appointment-card/index.js +2 -2
  55. package/dist/components/appointment-peek/index.js +1 -1
  56. package/dist/components/appointment-timeline/index.js +1 -1
  57. package/dist/components/booking/booking-types.d.ts +60 -1
  58. package/dist/components/booking/booking.d.ts +1 -1
  59. package/dist/components/booking/details-form.d.ts +5 -1
  60. package/dist/components/booking/index.d.ts +1 -1
  61. package/dist/components/booking/index.js +1 -1
  62. package/dist/components/booking/payment.d.ts +9 -0
  63. package/dist/components/booking/use-booking-payment.d.ts +14 -0
  64. package/dist/components/button-group/index.js +1 -1
  65. package/dist/components/calendar/index.js +1 -1
  66. package/dist/components/calendar-event-card/index.js +1 -1
  67. package/dist/components/chart/index.js +1 -1
  68. package/dist/components/data-table/index.js +3 -3
  69. package/dist/components/face-scheme/index.js +1 -1
  70. package/dist/components/file-manager/index.js +1 -1
  71. package/dist/components/freemium-paywall/index.js +1 -1
  72. package/dist/components/header-settings/index.js +1 -1
  73. package/dist/components/hover-card/hover-card.d.ts +4 -0
  74. package/dist/components/hover-card/index.d.ts +1 -1
  75. package/dist/components/hover-card/index.js +3 -2
  76. package/dist/components/icon-button-group/index.js +1 -1
  77. package/dist/components/index.d.ts +2 -1
  78. package/dist/components/notes-panel/index.js +1 -1
  79. package/dist/components/notes-panel/notes-panel.d.ts +10 -0
  80. package/dist/components/patient-details/index.js +1 -1
  81. package/dist/components/patient-summary-card/index.js +1 -1
  82. package/dist/components/patient-table/index.js +1 -1
  83. package/dist/components/payment-form/index.d.ts +1 -1
  84. package/dist/components/payment-form/index.js +1 -1
  85. package/dist/components/payment-form/payment-form.d.ts +35 -3
  86. package/dist/components/phone-input/index.js +1 -1
  87. package/dist/components/rich-text-editor/editor-extensions.d.ts +54 -0
  88. package/dist/components/rich-text-editor/editor-toolbar.d.ts +2 -1
  89. package/dist/components/rich-text-editor/help-me-write-overlay.d.ts +4 -0
  90. package/dist/components/rich-text-editor/index.d.ts +2 -0
  91. package/dist/components/rich-text-editor/index.js +6 -4
  92. package/dist/components/rich-text-editor/kit-extensions.d.ts +4 -0
  93. package/dist/components/rich-text-editor/rich-text-editor.d.ts +18 -2
  94. package/dist/components/stepper-accordion/index.js +1 -1
  95. package/dist/components/tasks-panel/index.js +1 -1
  96. package/dist/components/theme-toggle/index.js +1 -1
  97. package/dist/components/workflow-status/index.js +1 -1
  98. package/dist/hooks/index.d.ts +1 -1
  99. package/dist/hooks/index.js +51 -53
  100. package/dist/hooks/use-ai-sparkle.d.ts +7 -25
  101. package/dist/host-compat.css +2 -2
  102. package/dist/i18n/locales/ar.d.ts +67 -1
  103. package/dist/i18n/locales/ar.js +69 -3
  104. package/dist/i18n/locales/de.d.ts +67 -1
  105. package/dist/i18n/locales/de.js +69 -3
  106. package/dist/i18n/locales/el.d.ts +67 -1
  107. package/dist/i18n/locales/el.js +69 -3
  108. package/dist/i18n/locales/en.d.ts +67 -1
  109. package/dist/i18n/locales/en.js +69 -3
  110. package/dist/i18n/locales/es.d.ts +67 -1
  111. package/dist/i18n/locales/es.js +69 -3
  112. package/dist/i18n/locales/fr.d.ts +67 -1
  113. package/dist/i18n/locales/fr.js +69 -3
  114. package/dist/i18n/locales/hi.d.ts +67 -1
  115. package/dist/i18n/locales/hi.js +69 -3
  116. package/dist/i18n/locales/it.d.ts +67 -1
  117. package/dist/i18n/locales/it.js +69 -3
  118. package/dist/i18n/locales/ja.d.ts +67 -1
  119. package/dist/i18n/locales/ja.js +69 -3
  120. package/dist/i18n/locales/nl.d.ts +67 -1
  121. package/dist/i18n/locales/nl.js +69 -3
  122. package/dist/i18n/locales/pl.d.ts +67 -1
  123. package/dist/i18n/locales/pl.js +69 -3
  124. package/dist/i18n/locales/pt.d.ts +67 -1
  125. package/dist/i18n/locales/pt.js +69 -3
  126. package/dist/i18n/locales/ro.d.ts +67 -1
  127. package/dist/i18n/locales/ro.js +69 -3
  128. package/dist/i18n/locales/ru.d.ts +67 -1
  129. package/dist/i18n/locales/ru.js +69 -3
  130. package/dist/i18n/locales/sq.d.ts +67 -1
  131. package/dist/i18n/locales/sq.js +69 -3
  132. package/dist/i18n/locales/sv.d.ts +67 -1
  133. package/dist/i18n/locales/sv.js +69 -3
  134. package/dist/i18n/locales/tr.d.ts +67 -1
  135. package/dist/i18n/locales/tr.js +69 -3
  136. package/dist/i18n/locales/zh.d.ts +67 -1
  137. package/dist/i18n/locales/zh.js +69 -3
  138. package/dist/index.js +648 -641
  139. package/dist/locales/ar.json +69 -3
  140. package/dist/locales/de.json +69 -3
  141. package/dist/locales/el.json +69 -3
  142. package/dist/locales/en.json +69 -3
  143. package/dist/locales/es.json +69 -3
  144. package/dist/locales/fr.json +69 -3
  145. package/dist/locales/hi.json +69 -3
  146. package/dist/locales/it.json +69 -3
  147. package/dist/locales/ja.json +69 -3
  148. package/dist/locales/nl.json +69 -3
  149. package/dist/locales/pl.json +69 -3
  150. package/dist/locales/pt.json +69 -3
  151. package/dist/locales/ro.json +69 -3
  152. package/dist/locales/ru.json +69 -3
  153. package/dist/locales/sq.json +69 -3
  154. package/dist/locales/sv.json +69 -3
  155. package/dist/locales/tr.json +69 -3
  156. package/dist/locales/zh.json +69 -3
  157. package/dist/patterns/anamnesis/index.js +1 -1
  158. package/dist/patterns/calendar/calendar-editor-fields.d.ts +33 -0
  159. package/dist/patterns/calendar/calendar-sticky-offset.d.ts +20 -0
  160. package/dist/patterns/calendar/calendar-workspace.d.ts +6 -4
  161. package/dist/patterns/calendar/calendar.data.d.ts +26 -0
  162. package/dist/patterns/calendar/calendar.journey.d.ts +1 -1
  163. package/dist/patterns/calendar/calendar.sheets.d.ts +16 -5
  164. package/dist/patterns/calendar/calendar.types.d.ts +25 -9
  165. package/dist/patterns/calendar/index.js +1 -1
  166. package/dist/patterns/help-me-write-templates/help-me-write-templates.d.ts +11 -2
  167. package/dist/patterns/help-me-write-templates/index.js +1 -1
  168. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  169. package/dist/tokens.css +1 -1
  170. package/package.json +14 -4
  171. package/dist/_chunks/ai-sparkle-DXeP_6a0.js +0 -52
  172. package/dist/_chunks/booking-D43ASl8y.js +0 -3034
  173. package/dist/_chunks/button-group-R32U7SyV.js +0 -307
  174. package/dist/_chunks/calendar-workspace-B7KvZ1_D.js +0 -12161
  175. package/dist/_chunks/payment-form-BHMDqW9C.js +0 -767
  176. package/dist/_chunks/rich-text-editor-BrAvNajV.js +0 -3779
  177. package/dist/_chunks/use-ai-sparkle-CyQSRTCe.js +0 -103
  178. package/dist/components/ai-consent-banner/index.d.ts +0 -4
@@ -1,3034 +0,0 @@
1
- import { jsxs as g, jsx as s, Fragment as te } from "react/jsx-runtime";
2
- import { forwardRef as Ot, useId as lt, useState as Z, useCallback as X, useRef as U, useEffect as Y, useMemo as M, useImperativeHandle as os } from "react";
3
- import { c as Ye } from "./index-D2ZczOXr.js";
4
- import { useTranslation as V, Trans as ds } from "react-i18next";
5
- import { u as ls } from "./registry-DvAUVLHh.js";
6
- import { A as Q } from "./alert-CiQ5Pa3Q.js";
7
- import { B as be } from "./button-CaUe1uyd.js";
8
- import { C as ze } from "./checkbox-CZkipDn7.js";
9
- import { C as cs } from "./checkbox-group-DomUzpkF.js";
10
- import { D as us } from "./date-picker-6tFnKFty.js";
11
- import { E as ps } from "./email-input-Dpe63k0K.js";
12
- import { F as ce } from "./form-field-CahJzTxp.js";
13
- import { P as ms } from "./phone-input-BsZIoE36.js";
14
- import { T as fs } from "./text-area-Bt3p7Pt0.js";
15
- import { T as Ke } from "./text-input-CUvCb6ST.js";
16
- import { S as gs } from "./spinner-hbwuKwMf.js";
17
- import { B as Bt } from "./badge-BudgzTe_.js";
18
- import { I as Nt } from "./icon-button-CehAeZoP.js";
19
- import { S as We } from "./select-CLSUnKjF.js";
20
- import { C as ct } from "./combobox-DnSdYssy.js";
21
- import { M as ut } from "./multi-select-CtPd7g4x.js";
22
- import { S as Je } from "./skeleton-B1KTdJ4N.js";
23
- import { E as Pt } from "./empty-state-BUN_UAWf.js";
24
- import { S as hs } from "./stepper-accordion-DmVykr5F.js";
25
- import { S as vs } from "./stepper-progress-Bv0njx4g.js";
26
- import { S as bs } from "./slot-grid-B3eOPkKD.js";
27
- import { p as G } from "./parseISO-fOGpHKXm.js";
28
- import { C as ys } from "./chevron-down-DWE7GSq9.js";
29
- import { l as xe, f as He, b as wt } from "./format-4HNwNGrN.js";
30
- import { w as Lt, c as Ie, a as it, i as ks, s as Te, l as Ss, x as je } from "./date-picker-variants-B9NLAfUK.js";
31
- import { s as xs } from "./subDays-HPvBuvq3.js";
32
- import { C as Is } from "./chevron-left-B8cOyH-V.js";
33
- import { C as Ns } from "./chevron-right-I9AeSxH2.js";
34
- import { c as J } from "./createLucideIcon-DhHxpK9K.js";
35
- import { M as ws, S as Cs } from "./sun-Bj9Mr553.js";
36
- import { S as Ms } from "./stethoscope-sZXGC43m.js";
37
- import { H as Ds } from "./heart-pulse-BCppJyN2.js";
38
- import { E as As } from "./eye-BjhN2nYf.js";
39
- import { S as Ts } from "./scan-line-CNseIHQ0.js";
40
- import { A as _s } from "./astroid-BN4f5VXU.js";
41
- import { C as Os } from "./clipboard-check-BeAGxDVT.js";
42
- /**
43
- * @license lucide-react v1.22.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */
48
- const Bs = [
49
- [
50
- "path",
51
- {
52
- d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
53
- key: "169zse"
54
- }
55
- ]
56
- ], Ps = J("activity", Bs);
57
- /**
58
- * @license lucide-react v1.22.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */
63
- const Ls = [
64
- ["path", { d: "M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5", key: "1u7htd" }],
65
- ["path", { d: "M15 12h.01", key: "1k8ypt" }],
66
- [
67
- "path",
68
- {
69
- d: "M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",
70
- key: "11xh7x"
71
- }
72
- ],
73
- ["path", { d: "M9 12h.01", key: "157uk2" }]
74
- ], Rs = J("baby", Ls);
75
- /**
76
- * @license lucide-react v1.22.0 - ISC
77
- *
78
- * This source code is licensed under the ISC license.
79
- * See the LICENSE file in the root directory of this source tree.
80
- */
81
- const Es = [
82
- [
83
- "path",
84
- {
85
- d: "M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",
86
- key: "w610uw"
87
- }
88
- ]
89
- ], Vs = J("bone", Es);
90
- /**
91
- * @license lucide-react v1.22.0 - ISC
92
- *
93
- * This source code is licensed under the ISC license.
94
- * See the LICENSE file in the root directory of this source tree.
95
- */
96
- const Fs = [
97
- ["path", { d: "M12 18V5", key: "adv99a" }],
98
- ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
99
- ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
100
- ["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
101
- ["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
102
- ["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
103
- ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
104
- ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
105
- ], $s = J("brain", Fs);
106
- /**
107
- * @license lucide-react v1.22.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */
112
- const zs = [
113
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
114
- ["path", { d: "M16 2v4", key: "4m81vk" }],
115
- ["path", { d: "M3 10h18", key: "8toen8" }],
116
- ["path", { d: "M8 2v4", key: "1cmpym" }],
117
- ["path", { d: "M17 14h-6", key: "bkmgh3" }],
118
- ["path", { d: "M13 18H7", key: "bb0bb7" }],
119
- ["path", { d: "M7 14h.01", key: "1qa3f1" }],
120
- ["path", { d: "M17 18h.01", key: "1bdyru" }]
121
- ], Ks = J("calendar-range", zs);
122
- /**
123
- * @license lucide-react v1.22.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */
128
- const js = [
129
- ["path", { d: "M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0", key: "1dfaln" }],
130
- ["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
131
- ], qs = J("ear", js);
132
- /**
133
- * @license lucide-react v1.22.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */
138
- const Gs = [
139
- ["path", { d: "M6 18h8", key: "1borvv" }],
140
- ["path", { d: "M3 22h18", key: "8prr45" }],
141
- ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
142
- ["path", { d: "M9 14h2", key: "197e7h" }],
143
- ["path", { d: "M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z", key: "1bmzmy" }],
144
- ["path", { d: "M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3", key: "1drr47" }]
145
- ], Hs = J("microscope", Gs);
146
- /**
147
- * @license lucide-react v1.22.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */
152
- const Js = [
153
- [
154
- "path",
155
- { d: "m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z", key: "wa1lgi" }
156
- ],
157
- ["path", { d: "m8.5 8.5 7 7", key: "rvfmvr" }]
158
- ], Us = J("pill", Js);
159
- /**
160
- * @license lucide-react v1.22.0 - ISC
161
- *
162
- * This source code is licensed under the ISC license.
163
- * See the LICENSE file in the root directory of this source tree.
164
- */
165
- const Ys = [
166
- ["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
167
- ["path", { d: "M8.12 8.12 12 12", key: "1alkpv" }],
168
- ["path", { d: "M20 4 8.12 15.88", key: "xgtan2" }],
169
- ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
170
- ["path", { d: "M14.8 14.8 20 20", key: "ptml3r" }]
171
- ], Ws = J("scissors", Ys);
172
- /**
173
- * @license lucide-react v1.22.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */
178
- const Zs = [
179
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
180
- ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
181
- ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
182
- ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
183
- ], Xs = J("smile", Zs);
184
- /**
185
- * @license lucide-react v1.22.0 - ISC
186
- *
187
- * This source code is licensed under the ISC license.
188
- * See the LICENSE file in the root directory of this source tree.
189
- */
190
- const Qs = [
191
- ["path", { d: "M12 10V2", key: "16sf7g" }],
192
- ["path", { d: "m4.93 10.93 1.41 1.41", key: "2a7f42" }],
193
- ["path", { d: "M2 18h2", key: "j10viu" }],
194
- ["path", { d: "M20 18h2", key: "wocana" }],
195
- ["path", { d: "m19.07 10.93-1.41 1.41", key: "15zs5n" }],
196
- ["path", { d: "M22 22H2", key: "19qnx5" }],
197
- ["path", { d: "m16 6-4 4-4-4", key: "6wukr" }],
198
- ["path", { d: "M16 18a4 4 0 0 0-8 0", key: "1lzouq" }]
199
- ], ea = J("sunset", Qs);
200
- /**
201
- * @license lucide-react v1.22.0 - ISC
202
- *
203
- * This source code is licensed under the ISC license.
204
- * See the LICENSE file in the root directory of this source tree.
205
- */
206
- const ta = [
207
- ["path", { d: "m18 2 4 4", key: "22kx64" }],
208
- ["path", { d: "m17 7 3-3", key: "1w1zoj" }],
209
- ["path", { d: "M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5", key: "1exhtz" }],
210
- ["path", { d: "m9 11 4 4", key: "rovt3i" }],
211
- ["path", { d: "m5 19-3 3", key: "59f2uf" }],
212
- ["path", { d: "m14 4 6 6", key: "yqp9t2" }]
213
- ], Ct = J("syringe", ta);
214
- function sa(e, t, a) {
215
- return Lt(e, -1, a);
216
- }
217
- const aa = {
218
- id: "booking",
219
- // `view_change` removed (0.69): the layout `variant` is a fixed prop — the
220
- // handle exposes only `getVariant` (state), no action mutates it. The flow's
221
- // only navigation is step-to-step (`goto_step` → `navigate`).
222
- capabilities: ["navigate"],
223
- state: {
224
- variant: {
225
- type: "string",
226
- descriptionKey: "ui.agent.booking.state.variant",
227
- description: "Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.",
228
- read: (e) => e.getVariant()
229
- },
230
- currentStep: {
231
- type: "number",
232
- descriptionKey: "ui.agent.booking.state.currentStep",
233
- description: "The step the flow is on — 1 insurance, 2 specialty, 3 service, 4 provider, 5 date, 6 time, 7 patient details, 8 confirmation (after a successful submit). Read this back after `goto_step` to see where the clamp landed.",
234
- read: (e) => e.getCurrentStep()
235
- }
236
- },
237
- actions: {
238
- reset: {
239
- // destructive: clears the whole in-progress booking value (patient
240
- // identity, contact, slot choice) — irreversibly loses user input.
241
- safety: "destructive",
242
- idempotent: !0,
243
- descriptionKey: "ui.agent.booking.actions.reset",
244
- description: "Clear the booking value back to an empty state. Use to abandon an in-progress flow.",
245
- errors: ["Resetting after submit has no effect — the flow is on step 8."],
246
- invoke: (e) => {
247
- e.reset();
248
- }
249
- },
250
- goto_step: {
251
- safety: "read",
252
- argsType: "{ step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }",
253
- argsSchema: {
254
- type: "object",
255
- properties: {
256
- step: {
257
- type: "integer",
258
- enum: [1, 2, 3, 4, 5, 6, 7],
259
- description: "Target step (1-7)."
260
- }
261
- },
262
- required: ["step"]
263
- },
264
- idempotent: !0,
265
- descriptionKey: "ui.agent.booking.actions.gotoStep",
266
- description: "Jump to the given step. A step that is hidden for this practice, or that sits ahead of the first incomplete step, clamps to that first incomplete step — read `currentStep` back to see where it landed.",
267
- errors: [
268
- "Requested step is not yet reachable — clamped to the first incomplete step.",
269
- "Requested step is hidden for this practice (e.g. insurance outside Germany, or provider choice turned off) — clamped to the first incomplete step."
270
- ],
271
- examples: [{ args: { step: 1 }, note: "Return to the first step." }],
272
- invoke: (e, t) => {
273
- e.goToStep(t.step);
274
- }
275
- }
276
- },
277
- domHooks: {
278
- root: {
279
- attr: "data-component",
280
- value: "booking",
281
- description: "Marks the Booking root region."
282
- },
283
- instanceId: {
284
- attr: "data-component-id",
285
- sourceProp: "id",
286
- description: "Sourced from the id prop."
287
- }
288
- }
289
- }, ot = [
290
- "email",
291
- "whatsapp",
292
- "sms"
293
- ], H = "all", na = "de";
294
- function ia(e) {
295
- const t = e.lockedOperatorId;
296
- return [...t ? e.operatorsByService ? e.specialties.filter(
297
- (n) => e.services.some(
298
- (i) => {
299
- var r;
300
- return i.specialtyId === n.id && ((r = i.operatorIds) == null ? void 0 : r.includes(t));
301
- }
302
- )
303
- ) : e.specialties.filter((n) => {
304
- var i;
305
- return (i = n.operatorIds) == null ? void 0 : i.includes(t);
306
- }) : e.specialties].sort((n, i) => {
307
- const r = n.sequenceNumber ?? Number.POSITIVE_INFINITY, d = i.sequenceNumber ?? Number.POSITIVE_INFINITY;
308
- return r - d;
309
- });
310
- }
311
- function ra(e) {
312
- let t = e.services;
313
- if (e.lockedOperatorId && (t = t.filter(
314
- (n) => {
315
- var i;
316
- return (i = n.operatorIds) == null ? void 0 : i.includes(e.lockedOperatorId);
317
- }
318
- )), e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) {
319
- const n = ne(e.value);
320
- n.length > 0 && (t = t.filter(
321
- (i) => i.specialtyId !== void 0 && n.includes(i.specialtyId)
322
- ));
323
- }
324
- return t;
325
- }
326
- function oa(e) {
327
- const t = e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties, a = pe(e.value);
328
- if ((!t || e.operatorsByService) && a.length > 0)
329
- return e.operators.filter(
330
- (n) => {
331
- var i;
332
- return (i = n.appointmentBookingReasonIds) == null ? void 0 : i.some((r) => a.includes(r));
333
- }
334
- );
335
- if (t) {
336
- const n = ne(e.value);
337
- if (n.length > 0)
338
- return e.operators.filter(
339
- (i) => {
340
- var r;
341
- return (r = i.specialtyIds) == null ? void 0 : r.some((d) => n.includes(d));
342
- }
343
- );
344
- }
345
- return [];
346
- }
347
- function da(e, t) {
348
- const a = e.country === na, n = !a || e.value.insuranceType !== void 0, r = (e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) && n, d = ne(e.value).length > 0, m = !r || d, l = pe(e.value).length > 0, u = !m || l, c = t.operators, k = !!e.allowOperatorSelection && u && l && !e.lockedOperatorId && c.length > 1, f = u && l, N = (!f || e.value.date !== void 0) && e.value.date !== void 0, D = (!N || e.value.slotKey !== void 0) && e.value.slotKey !== void 0, I = l && c.length === 0;
349
- return {
350
- insurance: a,
351
- specialty: r,
352
- service: m,
353
- operator: k,
354
- date: f,
355
- slot: N,
356
- details: D,
357
- onboardingIncomplete: I
358
- };
359
- }
360
- function la(e, t) {
361
- const a = [];
362
- t.insurance && a.push(1), t.specialty && a.push(2), a.push(3), t.operator && a.push(4), a.push(5), a.push(6), a.push(7);
363
- const n = {
364
- 1: e.value.insuranceType !== void 0,
365
- // 0.34.0: array-or-single — satisfied when EITHER form is present.
366
- 2: ne(e.value).length > 0,
367
- 3: pe(e.value).length > 0,
368
- 4: e.value.operatorId !== void 0 || e.value.operatorIds !== void 0 && e.value.operatorIds.length > 0,
369
- 5: e.value.date !== void 0,
370
- 6: e.value.slotKey !== void 0,
371
- 7: !1
372
- // details fulfilment is owned by the form's own validation
373
- };
374
- return {
375
- currentStep: a.find((r) => !n[r]) ?? 7,
376
- visibleSteps: a
377
- };
378
- }
379
- function ca(e) {
380
- const t = {
381
- specialties: ia(e),
382
- services: ra(e),
383
- operators: oa(e)
384
- }, a = da(e, t), { currentStep: n, visibleSteps: i } = la(e, a);
385
- let r;
386
- if (e.value.date && e.value.slotKey) {
387
- const u = e.availableSlots[e.value.date];
388
- u && (r = u.find((c) => c.key === e.value.slotKey));
389
- }
390
- const d = pe(e.value), p = d.length > 0 ? e.services.find((u) => u.id === d[0]) : void 0, m = ne(e.value).length > 0, l = d.length > 0 && e.value.date !== void 0 && e.value.slotKey !== void 0 && (!a.insurance || e.value.insuranceType !== void 0) && (!a.specialty || m);
391
- return {
392
- gates: a,
393
- filtered: t,
394
- currentStep: n,
395
- totalSteps: i.length,
396
- visibleSteps: i,
397
- isReadyToSubmit: l,
398
- durationMin: p == null ? void 0 : p.durationMin,
399
- selectedSlot: r
400
- };
401
- }
402
- function Rt(e, t) {
403
- return {
404
- ...e,
405
- insuranceType: t,
406
- specialtyId: void 0,
407
- serviceId: void 0,
408
- operatorId: void 0,
409
- date: void 0,
410
- slotKey: void 0,
411
- details: void 0
412
- };
413
- }
414
- function Et(e, t) {
415
- return {
416
- ...e,
417
- specialtyId: t,
418
- specialtyIds: void 0,
419
- serviceId: void 0,
420
- serviceIds: void 0,
421
- operatorId: void 0,
422
- operatorIds: void 0,
423
- date: void 0,
424
- slotKey: void 0,
425
- details: void 0
426
- };
427
- }
428
- function Vt(e, t) {
429
- return {
430
- ...e,
431
- specialtyId: void 0,
432
- specialtyIds: t,
433
- serviceId: void 0,
434
- serviceIds: void 0,
435
- operatorId: void 0,
436
- operatorIds: void 0,
437
- date: void 0,
438
- slotKey: void 0,
439
- details: void 0
440
- };
441
- }
442
- function Ft(e, t) {
443
- return {
444
- ...e,
445
- serviceId: t,
446
- serviceIds: void 0,
447
- // Default the operator to the "All operators" sentinel so a patient
448
- // who doesn't care about picking lands on a satisfied step 4 without
449
- // any further input.
450
- operatorId: t ? H : void 0,
451
- operatorIds: void 0,
452
- date: void 0,
453
- slotKey: void 0,
454
- details: void 0
455
- };
456
- }
457
- function $t(e, t) {
458
- const a = !!t && t.length > 0;
459
- return {
460
- ...e,
461
- serviceId: void 0,
462
- serviceIds: t,
463
- operatorId: a ? H : void 0,
464
- operatorIds: void 0,
465
- date: void 0,
466
- slotKey: void 0,
467
- details: void 0
468
- };
469
- }
470
- function zt(e, t) {
471
- return {
472
- ...e,
473
- operatorId: t,
474
- operatorIds: void 0,
475
- date: void 0,
476
- slotKey: void 0,
477
- details: void 0
478
- };
479
- }
480
- function Kt(e, t) {
481
- return {
482
- ...e,
483
- operatorId: void 0,
484
- operatorIds: t,
485
- date: void 0,
486
- slotKey: void 0,
487
- details: void 0
488
- };
489
- }
490
- function ne(e) {
491
- return e.specialtyIds && e.specialtyIds.length > 0 ? e.specialtyIds : e.specialtyId ? [e.specialtyId] : [];
492
- }
493
- function pe(e) {
494
- return e.serviceIds && e.serviceIds.length > 0 ? e.serviceIds : e.serviceId ? [e.serviceId] : [];
495
- }
496
- function Ue(e) {
497
- return e.operatorIds && e.operatorIds.length > 0 ? e.operatorIds : e.operatorId ? [e.operatorId] : [];
498
- }
499
- function Ze(e, t) {
500
- return {
501
- ...e,
502
- date: t,
503
- slotKey: void 0
504
- // Keep details — date/slot changes shouldn't wipe the patient form
505
- // since the user has already filled some fields.
506
- };
507
- }
508
- function jt(e, t) {
509
- return {
510
- ...e,
511
- slotKey: t
512
- };
513
- }
514
- function ua(e, t) {
515
- let a = e;
516
- if (t.lockedOperatorId && a.operatorId !== t.lockedOperatorId && (a = { ...a, operatorId: t.lockedOperatorId }), (t.useSpecialties === void 0 ? t.specialties.length > 0 : t.useSpecialties) && t.specialties.length === 1 && a.specialtyId === void 0 && a.specialtyIds === void 0 && (a = { ...a, specialtyId: t.specialties[0].id }), t.autoSelectSingleService) {
517
- const i = ne(a), r = i.length > 0 ? t.services.filter(
518
- (d) => d.specialtyId && i.includes(d.specialtyId)
519
- ) : t.services;
520
- r.length === 1 && a.serviceId === void 0 && a.serviceIds === void 0 && (a = { ...a, serviceId: r[0].id }, a.operatorId === void 0 && a.operatorIds === void 0 && (a = { ...a, operatorId: H }));
521
- }
522
- return a;
523
- }
524
- function dt(e) {
525
- if (e.operatorId && e.operatorId !== H)
526
- return e.operatorId;
527
- }
528
- function pa(e) {
529
- if (!e) return !1;
530
- const t = e.trim();
531
- return /^\+?\d[\d\s\-()]{6,}$/.test(t);
532
- }
533
- function qt(e) {
534
- const t = e && e.length > 0 ? e : ["email"], a = new Set(t);
535
- return ot.filter((n) => a.has(n));
536
- }
537
- function ma(e, t, a) {
538
- const n = qt(e), i = new Set(n);
539
- if (a)
540
- return ot.filter(
541
- (l) => a.includes(l) && i.has(l)
542
- );
543
- const r = [];
544
- i.has("email") && r.push("email");
545
- const d = pa(t), p = i.has("whatsapp");
546
- p && d && r.push("whatsapp"), !p && i.has("sms") && r.push("sms");
547
- const m = new Set(r);
548
- return ot.filter((l) => m.has(l));
549
- }
550
- const Mt = 500, fa = /^[A-Z0-9]{16}$/, ga = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Dt = 300, qe = { state: "idle" }, pt = Ot(
551
- ({
552
- value: e,
553
- onChange: t,
554
- onSubmit: a,
555
- requireCodiceFiscale: n = !1,
556
- requireDateOfBirth: i = !1,
557
- requireInsuranceNumber: r = !1,
558
- insuranceType: d,
559
- showNote: p = !1,
560
- showReturningPatientFlag: m = !1,
561
- privacyPolicyUrl: l,
562
- termsUrl: u,
563
- criticalInformationToAccept: c,
564
- validateCodiceFiscale: k,
565
- validateInsuranceNumber: f,
566
- submitting: v = !1,
567
- summarySlot: N,
568
- defaultPhoneCountry: w,
569
- confirmationChannels: D,
570
- defaultConfirmationChannels: I,
571
- submitError: b
572
- }, x) => {
573
- var Le, K;
574
- const { t: y } = V(), O = lt(), [S, o] = Z(qe), [A, F] = Z(qe), [P, ie] = Z({}), z = X(
575
- (h) => ie((_) => ({ ..._, [h]: !0 })),
576
- []
577
- ), $ = U(null), re = U(
578
- null
579
- );
580
- Y(
581
- () => () => {
582
- $.current && clearTimeout($.current), re.current && clearTimeout(re.current);
583
- },
584
- []
585
- );
586
- const R = X(
587
- (h) => t({ ...e, ...h }),
588
- [e, t]
589
- ), me = M(
590
- () => qt(D),
591
- [D]
592
- ), se = me.length >= 2, we = U(!1);
593
- Y(() => {
594
- if (!se) {
595
- e.confirmationChannels !== void 0 && R({ confirmationChannels: void 0 });
596
- return;
597
- }
598
- if (e.confirmationChannels !== void 0) {
599
- we.current = !0;
600
- return;
601
- }
602
- const h = ma(
603
- me,
604
- e.mobilePhone,
605
- I
606
- );
607
- we.current = !0, R({ confirmationChannels: h });
608
- }, [
609
- se,
610
- me,
611
- e.mobilePhone,
612
- I
613
- ]);
614
- const fe = M(
615
- () => e.confirmationChannels ?? [],
616
- [e.confirmationChannels]
617
- ), _e = se && fe.length === 0;
618
- Y(() => {
619
- const h = e.codiceFiscale;
620
- if (!n || !k || !h) {
621
- o(qe);
622
- return;
623
- }
624
- if (!fa.test(h)) {
625
- o({
626
- state: "invalid",
627
- hint: y("booking.details.codiceFiscale.invalidFormat")
628
- });
629
- return;
630
- }
631
- o({ state: "pending" }), $.current && clearTimeout($.current), $.current = setTimeout(() => {
632
- k(h).then(
633
- (_) => o(
634
- _.valid ? { state: "valid" } : { state: "invalid", hint: _.hint }
635
- )
636
- ).catch(
637
- () => o({
638
- state: "invalid",
639
- hint: y("booking.details.codiceFiscale.unavailable")
640
- })
641
- );
642
- }, Dt);
643
- }, [n, k, e.codiceFiscale, y]);
644
- const oe = r && d === "public";
645
- Y(() => {
646
- const h = e.insuranceNumber;
647
- if (!oe || !f || !h) {
648
- F(qe);
649
- return;
650
- }
651
- F({ state: "pending" }), re.current && clearTimeout(re.current), re.current = setTimeout(() => {
652
- f(h).then(
653
- (_) => F(
654
- _.valid ? { state: "valid" } : { state: "invalid", hint: _.hint }
655
- )
656
- ).catch(
657
- () => F({
658
- state: "invalid",
659
- hint: y("booking.details.insuranceNumber.unavailable")
660
- })
661
- );
662
- }, Dt);
663
- }, [oe, f, e.insuranceNumber, y]);
664
- const ye = M(
665
- () => !!(e.email && ga.test(e.email)),
666
- [e.email]
667
- ), Ce = M(
668
- () => !!(e.mobilePhone && e.mobilePhone.length >= 6),
669
- [e.mobilePhone]
670
- ), Oe = M(() => {
671
- var h, _;
672
- return !(!((h = e.firstName) != null && h.trim()) || !((_ = e.lastName) != null && _.trim()) || !ye || !Ce || n && S.state !== "valid" || i && !e.dateOfBirth || oe && A.state !== "valid");
673
- }, [
674
- e.firstName,
675
- e.lastName,
676
- ye,
677
- Ce,
678
- n,
679
- S.state,
680
- i,
681
- e.dateOfBirth,
682
- oe,
683
- A.state
684
- ]), ke = c != null && c.trim() ? c : void 0, Be = ke !== void 0, ge = !Be || !!e.criticalInformationAccepted, Qe = !!(e.privacyConsent && e.termsConsent && ge), Me = !se || fe.length > 0, Pe = Oe && Qe && Me && !v, et = (h) => {
685
- if (h.preventDefault(), ie({
686
- firstName: !0,
687
- lastName: !0,
688
- email: !0,
689
- mobilePhone: !0,
690
- codiceFiscale: !0,
691
- dateOfBirth: !0,
692
- insuranceNumber: !0
693
- }), !Pe) return;
694
- const _ = {
695
- firstName: e.firstName.trim(),
696
- lastName: e.lastName.trim(),
697
- email: e.email.trim(),
698
- mobilePhone: e.mobilePhone,
699
- privacyConsent: !0,
700
- termsConsent: !0,
701
- // Only present when the service carried text to accept — a
702
- // reason without it leaves the key out of the payload entirely.
703
- ...Be ? { criticalInformationAccepted: !0 } : {},
704
- codiceFiscale: e.codiceFiscale,
705
- dateOfBirth: e.dateOfBirth,
706
- insuranceNumber: e.insuranceNumber,
707
- note: e.note,
708
- returningPatient: e.returningPatient,
709
- // Only include when the picker was visible; otherwise the single
710
- // implicit channel is inferred backend-side from the practice
711
- // config.
712
- confirmationChannels: se ? fe : void 0
713
- };
714
- a(_);
715
- }, de = (h, _) => {
716
- const ae = _ && /^https?:\/\//i.test(_) ? _ : void 0;
717
- return ae ? /* @__PURE__ */ s(
718
- ds,
719
- {
720
- i18nKey: h,
721
- components: {
722
- // The `<Trans>` runtime injects link text from the i18n
723
- // string. The anchor renders empty at static-analysis time,
724
- // so `jsx-a11y/anchor-has-content` would false-flag — silence
725
- // it; the runtime content is the localised policy / terms
726
- // label.
727
- policyLink: (
728
- // eslint-disable-next-line jsx-a11y/anchor-has-content
729
- /* @__PURE__ */ s(
730
- "a",
731
- {
732
- href: ae,
733
- target: "_blank",
734
- rel: "noopener noreferrer",
735
- className: "ds:underline ds:text-[var(--primary)]"
736
- }
737
- )
738
- )
739
- }
740
- }
741
- ) : y(h);
742
- };
743
- return /* @__PURE__ */ g(
744
- "form",
745
- {
746
- ref: x,
747
- id: O,
748
- noValidate: !0,
749
- onSubmit: et,
750
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
751
- children: [
752
- N,
753
- /* @__PURE__ */ g("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
754
- /* @__PURE__ */ s(
755
- ce,
756
- {
757
- label: y("booking.details.firstName.label"),
758
- required: !0,
759
- error: P.firstName && !((Le = e.firstName) != null && Le.trim()) ? y("booking.details.firstName.required") : void 0,
760
- children: /* @__PURE__ */ s(
761
- Ke,
762
- {
763
- autoComplete: "given-name",
764
- value: e.firstName ?? "",
765
- onChange: (h) => R({ firstName: h.target.value }),
766
- onBlur: () => z("firstName")
767
- }
768
- )
769
- }
770
- ),
771
- /* @__PURE__ */ s(
772
- ce,
773
- {
774
- label: y("booking.details.lastName.label"),
775
- required: !0,
776
- error: P.lastName && !((K = e.lastName) != null && K.trim()) ? y("booking.details.lastName.required") : void 0,
777
- children: /* @__PURE__ */ s(
778
- Ke,
779
- {
780
- autoComplete: "family-name",
781
- value: e.lastName ?? "",
782
- onChange: (h) => R({ lastName: h.target.value }),
783
- onBlur: () => z("lastName")
784
- }
785
- )
786
- }
787
- )
788
- ] }),
789
- /* @__PURE__ */ g("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
790
- /* @__PURE__ */ s(
791
- ce,
792
- {
793
- label: y("booking.details.email.label"),
794
- required: !0,
795
- error: P.email && !ye ? y("booking.details.email.invalid") : void 0,
796
- children: /* @__PURE__ */ s(
797
- ps,
798
- {
799
- value: e.email ?? "",
800
- onChange: (h) => R({ email: h.target.value }),
801
- onBlur: () => z("email")
802
- }
803
- )
804
- }
805
- ),
806
- /* @__PURE__ */ s(
807
- ce,
808
- {
809
- label: y("booking.details.mobilePhone.label"),
810
- required: !0,
811
- error: P.mobilePhone && !Ce ? y("booking.details.mobilePhone.invalid") : void 0,
812
- children: /* @__PURE__ */ s(
813
- ms,
814
- {
815
- value: e.mobilePhone ?? "",
816
- defaultCountry: w == null ? void 0 : w.toUpperCase(),
817
- onChange: (h) => {
818
- R({ mobilePhone: h }), z("mobilePhone");
819
- }
820
- }
821
- )
822
- }
823
- )
824
- ] }),
825
- n || i ? /* @__PURE__ */ g("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
826
- n ? /* @__PURE__ */ s(
827
- ce,
828
- {
829
- label: y("booking.details.codiceFiscale.label"),
830
- required: !0,
831
- description: S.state === "pending" ? y("booking.details.codiceFiscale.checking") : y("booking.details.codiceFiscale.helper"),
832
- error: P.codiceFiscale && S.state === "invalid" ? S.hint ?? y("booking.details.codiceFiscale.invalid") : void 0,
833
- children: /* @__PURE__ */ s(
834
- Ke,
835
- {
836
- value: e.codiceFiscale ?? "",
837
- maxLength: 16,
838
- onChange: (h) => R({
839
- codiceFiscale: h.target.value.slice(0, 16).toUpperCase()
840
- }),
841
- onBlur: () => z("codiceFiscale")
842
- }
843
- )
844
- }
845
- ) : null,
846
- i ? /* @__PURE__ */ s(
847
- ce,
848
- {
849
- label: y("booking.details.dateOfBirth.label"),
850
- required: !0,
851
- error: P.dateOfBirth && !e.dateOfBirth ? y("booking.details.dateOfBirth.required") : void 0,
852
- children: /* @__PURE__ */ s(
853
- us,
854
- {
855
- value: e.dateOfBirth ? new Date(e.dateOfBirth) : void 0,
856
- onChange: (h) => {
857
- R({
858
- dateOfBirth: h ? h.toISOString().slice(0, 10) : void 0
859
- }), z("dateOfBirth");
860
- }
861
- }
862
- )
863
- }
864
- ) : null
865
- ] }) : null,
866
- oe ? /* @__PURE__ */ s(
867
- ce,
868
- {
869
- label: y("booking.details.insuranceNumber.label"),
870
- required: !0,
871
- description: A.state === "pending" ? y("booking.details.insuranceNumber.checking") : void 0,
872
- error: P.insuranceNumber && A.state === "invalid" ? A.hint ?? y("booking.details.insuranceNumber.invalid") : void 0,
873
- children: /* @__PURE__ */ s(
874
- Ke,
875
- {
876
- value: e.insuranceNumber ?? "",
877
- onChange: (h) => R({ insuranceNumber: h.target.value }),
878
- onBlur: () => z("insuranceNumber")
879
- }
880
- )
881
- }
882
- ) : null,
883
- p ? /* @__PURE__ */ s(
884
- ce,
885
- {
886
- label: y("booking.details.note.label"),
887
- description: y("booking.details.note.helper", {
888
- max: Mt
889
- }),
890
- children: /* @__PURE__ */ s(
891
- fs,
892
- {
893
- value: e.note ?? "",
894
- maxLength: Mt,
895
- rows: 3,
896
- onChange: (h) => R({ note: h.target.value })
897
- }
898
- )
899
- }
900
- ) : null,
901
- m ? /* @__PURE__ */ s(
902
- ze,
903
- {
904
- checked: !!e.returningPatient,
905
- onCheckedChange: (h) => R({ returningPatient: h === !0 }),
906
- label: y("booking.details.returningPatient.label")
907
- }
908
- ) : null,
909
- ke !== void 0 ? /* @__PURE__ */ g(
910
- "div",
911
- {
912
- "data-component": "booking-critical-information",
913
- role: "group",
914
- "aria-labelledby": `${O}-critical-information-heading`,
915
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-md)] ds:border ds:border-[var(--border)] ds:bg-[var(--muted)] ds:p-[var(--spacing-sm)]",
916
- children: [
917
- /* @__PURE__ */ s(
918
- "h3",
919
- {
920
- id: `${O}-critical-information-heading`,
921
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0",
922
- children: y("booking.details.criticalInformation.heading")
923
- }
924
- ),
925
- /* @__PURE__ */ s("p", { className: "type-body-sm ds:m-0 ds:whitespace-pre-wrap ds:break-words ds:text-[var(--foreground)]", children: ke }),
926
- /* @__PURE__ */ s(
927
- ze,
928
- {
929
- checked: !!e.criticalInformationAccepted,
930
- onCheckedChange: (h) => R({ criticalInformationAccepted: h === !0 }),
931
- "aria-required": !0,
932
- label: /* @__PURE__ */ g(te, { children: [
933
- y("booking.details.criticalInformation.accept"),
934
- /* @__PURE__ */ s(
935
- "span",
936
- {
937
- "aria-hidden": "true",
938
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
939
- children: "*"
940
- }
941
- )
942
- ] })
943
- }
944
- )
945
- ]
946
- }
947
- ) : null,
948
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
949
- /* @__PURE__ */ s(
950
- ze,
951
- {
952
- checked: !!e.privacyConsent,
953
- onCheckedChange: (h) => R({ privacyConsent: h === !0 }),
954
- label: /* @__PURE__ */ g(te, { children: [
955
- de(
956
- "booking.details.consent.privacy.label",
957
- l
958
- ),
959
- /* @__PURE__ */ s(
960
- "span",
961
- {
962
- "aria-hidden": "true",
963
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
964
- children: "*"
965
- }
966
- )
967
- ] })
968
- }
969
- ),
970
- /* @__PURE__ */ s(
971
- ze,
972
- {
973
- checked: !!e.termsConsent,
974
- onCheckedChange: (h) => R({ termsConsent: h === !0 }),
975
- label: /* @__PURE__ */ g(te, { children: [
976
- de(
977
- "booking.details.consent.terms.label",
978
- u
979
- ),
980
- /* @__PURE__ */ s(
981
- "span",
982
- {
983
- "aria-hidden": "true",
984
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
985
- children: "*"
986
- }
987
- )
988
- ] })
989
- }
990
- )
991
- ] }),
992
- se ? /* @__PURE__ */ s(
993
- "div",
994
- {
995
- "data-component": "booking-confirmation-channels",
996
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
997
- children: /* @__PURE__ */ s(
998
- cs,
999
- {
1000
- label: y("booking.confirmation.heading"),
1001
- helperText: y("booking.confirmation.helper"),
1002
- value: fe,
1003
- onChange: (h) => R({
1004
- confirmationChannels: h
1005
- }),
1006
- orientation: "vertical",
1007
- options: me.map((h) => ({
1008
- value: h,
1009
- label: y(`booking.confirmation.channel.${h}`)
1010
- })),
1011
- error: _e ? y("booking.confirmation.atLeastOne") : void 0
1012
- }
1013
- )
1014
- }
1015
- ) : null,
1016
- b ? /* @__PURE__ */ s(Q, { variant: "error", children: /* @__PURE__ */ s(Q.Description, { children: b }) }) : null,
1017
- /* @__PURE__ */ s(
1018
- be,
1019
- {
1020
- intent: "primary",
1021
- size: "md",
1022
- type: "submit",
1023
- disabled: !Pe,
1024
- startIcon: v ? /* @__PURE__ */ s(gs, { variant: "pulse", size: "sm" }) : void 0,
1025
- children: y("booking.details.submit")
1026
- }
1027
- )
1028
- ]
1029
- }
1030
- );
1031
- }
1032
- );
1033
- pt.displayName = "BookingDetailsForm";
1034
- const ha = Ye(
1035
- "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
1036
- {
1037
- variants: {
1038
- variant: {
1039
- "inline-list": "ds:gap-[var(--spacing-md)]",
1040
- accordion: "ds:gap-[var(--spacing-md)]",
1041
- calendar: "ds:gap-[var(--spacing-md)]",
1042
- flexible: "ds:gap-[var(--spacing-lg)]",
1043
- progress: "ds:gap-[var(--spacing-sm)]"
1044
- },
1045
- // `surface="elevated"` matches `Card variant="elevated"` — same
1046
- // tokens, same padding, same boundary behaviour — so consumers can
1047
- // drop their own Card wraps without a double-card look. Default
1048
- // `'flat'` preserves 0.30.x rendering.
1049
- surface: {
1050
- flat: "",
1051
- elevated: [
1052
- "ds:rounded-[var(--radius-lg)]",
1053
- "ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
1054
- "ds:border ds:border-[color:var(--card-border)]",
1055
- "ds:shadow-[var(--shadow-card)]",
1056
- "ds:p-[var(--spacing-md)]"
1057
- ].join(" ")
1058
- }
1059
- },
1060
- defaultVariants: { variant: "inline-list", surface: "flat" }
1061
- }
1062
- ), va = [
1063
- [
1064
- /\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\s*plastic)/i,
1065
- Ct
1066
- ],
1067
- [/\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, Ds],
1068
- [/\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, Xs],
1069
- [/\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, As],
1070
- [/\b(otorin|udito|orecchi|hearing|ear)/i, qs],
1071
- [/\b(neuro|brain|cervello)/i, $s],
1072
- [/\b(pediatr|child|bambin)/i, Rs],
1073
- [/\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, Vs],
1074
- [/\b(lab|analis|test|sang|esami)/i, Hs],
1075
- [/\b(farmaco|pharm|pillol|refill)/i, Us],
1076
- [/\b(chirurg|surg|intervent|operat)/i, Ws],
1077
- [/\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, Ts],
1078
- [/\b(vacc|inject|inie|punto)/i, Ct],
1079
- [/\b(derma|skin|pelle)/i, _s],
1080
- [/\b(prima\s*visit|first\s*visit|consult|consulto|valutaz)/i, Os],
1081
- [/\b(general|medicin|family|control|check[-\s]?up)/i, Ps]
1082
- ];
1083
- function ba(e) {
1084
- for (const [t, a] of va)
1085
- if (t.test(e)) return a;
1086
- return null;
1087
- }
1088
- function ya(e) {
1089
- const t = ba(e.label) ?? Ms;
1090
- return /* @__PURE__ */ s(t, { "aria-hidden": "true", className: "ds:size-5" });
1091
- }
1092
- function Gt(e) {
1093
- var t;
1094
- return (t = e.priceLabel) != null && t.trim() ? e.priceLabel : void 0;
1095
- }
1096
- function ve(e) {
1097
- return He(e, "yyyy-MM-dd");
1098
- }
1099
- const ka = [
1100
- "ds:relative ds:flex ds:items-center ds:justify-center",
1101
- "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
1102
- "ds:rounded-[var(--radius-sm)]",
1103
- "ds:text-[length:var(--font-size-sm)]",
1104
- "ds:transition-colors ds:duration-[var(--animation-duration)]",
1105
- "ds:motion-reduce:transition-none",
1106
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1107
- "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1108
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
1109
- ].join(" "), Sa = Ye(ka, {
1110
- variants: {
1111
- state: {
1112
- available: "ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30",
1113
- unavailable: "ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60",
1114
- selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]",
1115
- outside: "ds:text-[var(--muted-foreground)]/40"
1116
- }
1117
- },
1118
- defaultVariants: { state: "unavailable" }
1119
- });
1120
- function xa({
1121
- availableDates: e,
1122
- selectedDate: t,
1123
- onSelectDate: a,
1124
- locale: n,
1125
- loading: i
1126
- }) {
1127
- const { t: r } = V(), d = M(() => t ? Te(G(t)) : e.length > 0 ? Te(G(e[0])) : Te(/* @__PURE__ */ new Date()), [t, e]), [p, m] = Z(d), [l, u] = Z(null), c = M(() => {
1128
- const I = Te(p), b = Ss(p), x = I.getDay(), y = b.getDate(), O = [];
1129
- for (let S = x; S > 0; S -= 1) {
1130
- const o = new Date(I);
1131
- o.setDate(I.getDate() - S), O.push(o);
1132
- }
1133
- for (let S = 0; S < y; S += 1) {
1134
- const o = new Date(I);
1135
- o.setDate(I.getDate() + S), O.push(o);
1136
- }
1137
- for (; O.length < 42; ) {
1138
- const S = O[O.length - 1], o = new Date(S);
1139
- o.setDate(S.getDate() + 1), O.push(o);
1140
- }
1141
- return O;
1142
- }, [p]), k = M(() => {
1143
- try {
1144
- return new Intl.DateTimeFormat(n, {
1145
- month: "long",
1146
- year: "numeric"
1147
- }).format(p);
1148
- } catch {
1149
- return He(p, "MMMM yyyy");
1150
- }
1151
- }, [p, n]), f = M(() => {
1152
- const I = new Date(2024, 0, 7);
1153
- return Array.from({ length: 7 }, (b, x) => {
1154
- const y = new Date(I);
1155
- y.setDate(I.getDate() + x);
1156
- try {
1157
- return new Intl.DateTimeFormat(n, { weekday: "short" }).format(y);
1158
- } catch {
1159
- return He(y, "EEE");
1160
- }
1161
- });
1162
- }, [n]), v = M(() => new Set(e), [e]), N = X(
1163
- (I) => v.has(ve(I)),
1164
- [v]
1165
- ), w = M(() => {
1166
- if (l) return l;
1167
- if (t) return G(t);
1168
- const I = c.find(
1169
- (b) => je(b, p) && N(b)
1170
- );
1171
- return I || (c.find((b) => je(b, p)) ?? null);
1172
- }, [l, t, c, p, N]), D = X(
1173
- (I, b) => {
1174
- let x = null;
1175
- switch (I.key) {
1176
- case "ArrowLeft":
1177
- x = new Date(b), x.setDate(b.getDate() - 1);
1178
- break;
1179
- case "ArrowRight":
1180
- x = new Date(b), x.setDate(b.getDate() + 1);
1181
- break;
1182
- case "ArrowUp":
1183
- x = new Date(b), x.setDate(b.getDate() - 7);
1184
- break;
1185
- case "ArrowDown":
1186
- x = new Date(b), x.setDate(b.getDate() + 7);
1187
- break;
1188
- case "Home":
1189
- x = new Date(b), x.setDate(b.getDate() - b.getDay());
1190
- break;
1191
- case "End":
1192
- x = new Date(b), x.setDate(b.getDate() + (6 - b.getDay()));
1193
- break;
1194
- case "Enter":
1195
- case " ": {
1196
- I.preventDefault(), N(b) && a(ve(b));
1197
- return;
1198
- }
1199
- default:
1200
- return;
1201
- }
1202
- x && (I.preventDefault(), je(x, p) || m(Te(x)), u(x));
1203
- },
1204
- [N, a, p]
1205
- );
1206
- return i ? /* @__PURE__ */ g(
1207
- "div",
1208
- {
1209
- role: "status",
1210
- "aria-live": "polite",
1211
- "aria-label": r("common.loading"),
1212
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1213
- children: [
1214
- /* @__PURE__ */ s(Je, { variant: "text", width: "40%" }),
1215
- /* @__PURE__ */ s("div", { className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]", children: Array.from({ length: 42 }, (I, b) => /* @__PURE__ */ s(Je, { variant: "rounded", height: "2.5rem" }, `mg-skel-${b}`)) })
1216
- ]
1217
- }
1218
- ) : /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1219
- /* @__PURE__ */ g("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1220
- /* @__PURE__ */ s(
1221
- Nt,
1222
- {
1223
- icon: /* @__PURE__ */ s(Is, {}),
1224
- "aria-label": r("booking.previousMonth"),
1225
- size: "sm",
1226
- intent: "ghost",
1227
- flipIconInRtl: !0,
1228
- onClick: () => {
1229
- m((I) => sa(I)), u(null);
1230
- }
1231
- }
1232
- ),
1233
- /* @__PURE__ */ s(
1234
- "span",
1235
- {
1236
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
1237
- "aria-live": "polite",
1238
- children: k
1239
- }
1240
- ),
1241
- /* @__PURE__ */ s(
1242
- Nt,
1243
- {
1244
- icon: /* @__PURE__ */ s(Ns, {}),
1245
- "aria-label": r("booking.nextMonth"),
1246
- size: "sm",
1247
- intent: "ghost",
1248
- flipIconInRtl: !0,
1249
- onClick: () => {
1250
- m((I) => Lt(I, 1)), u(null);
1251
- }
1252
- }
1253
- )
1254
- ] }),
1255
- /* @__PURE__ */ g(
1256
- "div",
1257
- {
1258
- role: "grid",
1259
- "aria-label": r("booking.monthGridLabel"),
1260
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
1261
- children: [
1262
- /* @__PURE__ */ s(
1263
- "div",
1264
- {
1265
- role: "row",
1266
- className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
1267
- children: f.map((I, b) => /* @__PURE__ */ s(
1268
- "div",
1269
- {
1270
- role: "columnheader",
1271
- className: "type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]",
1272
- children: I
1273
- },
1274
- `wd-${b}`
1275
- ))
1276
- }
1277
- ),
1278
- Array.from({ length: 6 }, (I, b) => /* @__PURE__ */ s(
1279
- "div",
1280
- {
1281
- role: "row",
1282
- className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
1283
- children: c.slice(b * 7, b * 7 + 7).map((x, y) => {
1284
- const O = b * 7 + y, S = je(x, p), o = S && N(x), A = t ? wt(x, G(t)) : !1, F = S ? A ? "selected" : o ? "available" : "unavailable" : "outside", P = w ? wt(w, x) : !1, ie = (() => {
1285
- try {
1286
- return new Intl.DateTimeFormat(n, {
1287
- dateStyle: "full"
1288
- }).format(x);
1289
- } catch {
1290
- return He(x, "PPP");
1291
- }
1292
- })();
1293
- return /* @__PURE__ */ s(
1294
- "button",
1295
- {
1296
- type: "button",
1297
- role: "gridcell",
1298
- "aria-label": ie,
1299
- "aria-selected": A || void 0,
1300
- "aria-disabled": !o || void 0,
1301
- tabIndex: P ? 0 : -1,
1302
- disabled: !o,
1303
- onClick: () => {
1304
- o && a(ve(x));
1305
- },
1306
- onKeyDown: (z) => D(z, x),
1307
- className: Sa({ state: F }),
1308
- children: /* @__PURE__ */ s("span", { "aria-hidden": "true", children: x.getDate() })
1309
- },
1310
- `mg-cell-${O}`
1311
- );
1312
- })
1313
- },
1314
- `mg-row-${b}`
1315
- ))
1316
- ]
1317
- }
1318
- )
1319
- ] });
1320
- }
1321
- const Ia = Ye(
1322
- [
1323
- "ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]",
1324
- "ds:min-h-[var(--min-target-size)]",
1325
- "ds:rounded-[var(--radius-md)]",
1326
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
1327
- "ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]",
1328
- "ds:text-start",
1329
- "ds:transition-[background-color,box-shadow]",
1330
- "ds:duration-[var(--animation-duration)]",
1331
- "ds:motion-reduce:transition-none",
1332
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1333
- "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1334
- "ds:forced-colors:[outline:1px_solid_CanvasText]",
1335
- "ds:cursor-pointer"
1336
- ].join(" "),
1337
- {
1338
- variants: {
1339
- state: {
1340
- idle: "ds:bg-[var(--card)] ds:shadow-[var(--shadow-sm)] ds:hover:shadow-[var(--shadow-md)]",
1341
- selected: "ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:shadow-[var(--shadow-sm)]"
1342
- }
1343
- },
1344
- defaultVariants: { state: "idle" }
1345
- }
1346
- );
1347
- function Na({
1348
- services: e,
1349
- selectedServiceId: t,
1350
- onSelect: a
1351
- }) {
1352
- const { t: n } = V(), i = lt(), [r, d] = Z(() => {
1353
- if (t) {
1354
- const u = e.findIndex((c) => c.id === t);
1355
- if (u >= 0) return u;
1356
- }
1357
- return 0;
1358
- }), p = U(/* @__PURE__ */ new Map()), m = X((u) => {
1359
- var c;
1360
- (c = p.current.get(u)) == null || c.focus();
1361
- }, []), l = X(
1362
- (u, c, k) => {
1363
- const f = e.length;
1364
- if (f !== 0)
1365
- switch (u.key) {
1366
- case "ArrowDown":
1367
- case "ArrowRight": {
1368
- u.preventDefault();
1369
- const v = (c + 1) % f;
1370
- d(v), m(v);
1371
- break;
1372
- }
1373
- case "ArrowUp":
1374
- case "ArrowLeft": {
1375
- u.preventDefault();
1376
- const v = (c - 1 + f) % f;
1377
- d(v), m(v);
1378
- break;
1379
- }
1380
- case "Home": {
1381
- u.preventDefault(), d(0), m(0);
1382
- break;
1383
- }
1384
- case "End": {
1385
- u.preventDefault();
1386
- const v = f - 1;
1387
- d(v), m(v);
1388
- break;
1389
- }
1390
- case "Enter":
1391
- case " ": {
1392
- u.preventDefault(), a(k);
1393
- break;
1394
- }
1395
- }
1396
- },
1397
- [e.length, m, a]
1398
- );
1399
- return e.length === 0 ? null : /* @__PURE__ */ s(
1400
- "div",
1401
- {
1402
- role: "radiogroup",
1403
- "aria-label": n("booking.serviceListLabel"),
1404
- id: i,
1405
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1406
- children: e.map((u, c) => {
1407
- const k = t === u.id, f = r === c, v = Gt(u), N = v ? n("booking.serviceCardLabelPrice", {
1408
- label: u.label,
1409
- price: v
1410
- }) : n("booking.serviceCardLabel", {
1411
- label: u.label,
1412
- duration: u.durationMin
1413
- }), w = ya(u);
1414
- return /* @__PURE__ */ g(
1415
- "button",
1416
- {
1417
- ref: (D) => {
1418
- D ? p.current.set(c, D) : p.current.delete(c);
1419
- },
1420
- type: "button",
1421
- role: "radio",
1422
- "aria-checked": k,
1423
- "aria-label": N,
1424
- tabIndex: f ? 0 : -1,
1425
- onClick: () => a(u.id),
1426
- onFocus: () => d(c),
1427
- onKeyDown: (D) => l(D, c, u.id),
1428
- className: Ia({
1429
- state: k ? "selected" : "idle"
1430
- }),
1431
- children: [
1432
- /* @__PURE__ */ s(
1433
- "span",
1434
- {
1435
- "aria-hidden": "true",
1436
- className: "ds:flex ds:size-10 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)] ds:bg-[var(--primary)]/10 ds:text-[var(--primary)]",
1437
- children: w
1438
- }
1439
- ),
1440
- /* @__PURE__ */ g("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
1441
- /* @__PURE__ */ s("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: u.label }),
1442
- v ? null : /* @__PURE__ */ s("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: n("booking.serviceSummary", {
1443
- minutes: u.durationMin
1444
- }) })
1445
- ] }),
1446
- v ? /* @__PURE__ */ s(
1447
- "span",
1448
- {
1449
- "aria-hidden": "true",
1450
- className: "ds:inline-flex ds:shrink-0 ds:items-center ds:ms-auto",
1451
- children: /* @__PURE__ */ s(Bt, { variant: "accentSoft", size: "lg", children: v })
1452
- }
1453
- ) : null
1454
- ]
1455
- },
1456
- u.id
1457
- );
1458
- })
1459
- }
1460
- );
1461
- }
1462
- const wa = Ye(
1463
- [
1464
- "ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
1465
- "ds:min-h-[var(--min-target-size)]",
1466
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
1467
- "ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]",
1468
- "ds:rounded-[var(--radius-md)]",
1469
- "ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]",
1470
- "ds:transition-[background-color,color,box-shadow] ds:duration-[var(--animation-duration)]",
1471
- "ds:motion-reduce:transition-none",
1472
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1473
- "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1474
- "ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
1475
- "ds:forced-colors:[border:1px_solid_ButtonText] ds:forced-colors:text-[ButtonText]"
1476
- ].join(" "),
1477
- {
1478
- variants: {
1479
- state: {
1480
- idle: "ds:bg-[color:var(--card)] ds:text-[color:var(--foreground)] ds:shadow-[var(--shadow-sm)] ds:hover:enabled:bg-[color:var(--muted)]/40 ds:hover:enabled:shadow-[var(--shadow-md)]",
1481
- selected: "ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:shadow-[var(--shadow-sm)]",
1482
- unavailable: "ds:[outline:1px_dashed_color:var(--border)] ds:[outline-offset:-1px] ds:bg-transparent ds:text-[color:var(--muted-foreground)]"
1483
- }
1484
- },
1485
- defaultVariants: { state: "idle" }
1486
- }
1487
- );
1488
- function Ca(e) {
1489
- const [t] = e.split(":").map((n) => parseInt(n, 10)), a = Number.isFinite(t) ? t : 0;
1490
- return a < 12 ? "morning" : a < 17 ? "afternoon" : "evening";
1491
- }
1492
- const Ma = {
1493
- morning: Cs,
1494
- afternoon: ea,
1495
- evening: ws
1496
- };
1497
- function Da({
1498
- date: e,
1499
- slots: t,
1500
- selectedSlotKey: a,
1501
- onSelect: n,
1502
- loading: i,
1503
- locale: r
1504
- }) {
1505
- const { t: d } = V(), p = M(() => {
1506
- try {
1507
- return new Intl.DateTimeFormat(r, {
1508
- weekday: "long",
1509
- day: "numeric",
1510
- month: "long"
1511
- }).format(G(e));
1512
- } catch {
1513
- return e;
1514
- }
1515
- }, [e, r]), m = M(() => {
1516
- const c = {
1517
- morning: [],
1518
- afternoon: [],
1519
- evening: []
1520
- };
1521
- for (const k of t)
1522
- c[Ca(k.time)].push(k);
1523
- return c;
1524
- }, [t]), l = t.filter((c) => c.available).length, u = ["morning", "afternoon", "evening"];
1525
- return i ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1526
- /* @__PURE__ */ s(Je, { variant: "text", width: "60%" }),
1527
- [0, 1].map((c) => /* @__PURE__ */ s(
1528
- "div",
1529
- {
1530
- className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]",
1531
- children: [0, 1, 2].map((k) => /* @__PURE__ */ s(Je, { variant: "rounded", height: "44px" }, k))
1532
- },
1533
- c
1534
- ))
1535
- ] }) : l === 0 ? /* @__PURE__ */ s(Pt, { variant: "no-results", title: d("booking.noSlotsForDate") }) : /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1536
- /* @__PURE__ */ g("div", { className: "ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1537
- /* @__PURE__ */ g("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1538
- /* @__PURE__ */ s(
1539
- Ks,
1540
- {
1541
- "aria-hidden": "true",
1542
- className: "ds:size-4 ds:text-[color:var(--accent)]"
1543
- }
1544
- ),
1545
- /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: p })
1546
- ] }),
1547
- /* @__PURE__ */ s("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: d("booking.slotsAvailable", { count: l }) })
1548
- ] }),
1549
- u.map((c) => {
1550
- const k = m[c];
1551
- if (k.length === 0) return null;
1552
- const f = Ma[c];
1553
- return /* @__PURE__ */ g(
1554
- "div",
1555
- {
1556
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1557
- children: [
1558
- /* @__PURE__ */ g("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
1559
- /* @__PURE__ */ s(f, { "aria-hidden": "true", className: "ds:size-3.5" }),
1560
- /* @__PURE__ */ s("span", { className: "type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase", children: d(`booking.timeOfDay.${c}`) })
1561
- ] }),
1562
- /* @__PURE__ */ s(
1563
- "div",
1564
- {
1565
- role: "group",
1566
- "aria-label": d(`booking.timeOfDay.${c}`),
1567
- className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4",
1568
- children: k.map((v) => {
1569
- const N = v.key === a, w = v.available ? N ? "selected" : "idle" : "unavailable";
1570
- return /* @__PURE__ */ s(
1571
- "button",
1572
- {
1573
- type: "button",
1574
- "data-slot-id": v.key,
1575
- disabled: !v.available,
1576
- "aria-pressed": N,
1577
- "aria-label": d("booking.slotAvailableLabel", {
1578
- time: v.time
1579
- }),
1580
- onClick: () => v.available && n(v),
1581
- className: wa({ state: w }),
1582
- children: v.time
1583
- },
1584
- v.key
1585
- );
1586
- })
1587
- }
1588
- )
1589
- ]
1590
- },
1591
- c
1592
- );
1593
- })
1594
- ] });
1595
- }
1596
- const Ge = 4;
1597
- function Aa({
1598
- availableDates: e,
1599
- availableSlots: t,
1600
- value: a,
1601
- onChange: n,
1602
- onDateSelect: i,
1603
- onWindowChange: r,
1604
- loadingDates: d,
1605
- loadingSlots: p,
1606
- locale: m,
1607
- agentIdBase: l
1608
- }) {
1609
- const u = M(() => xe(/* @__PURE__ */ new Date()), []), [c, k] = Z(() => {
1610
- if (a.date) {
1611
- const o = xe(G(a.date));
1612
- if (!Ie(u, o)) return o;
1613
- }
1614
- if (e.length > 0) {
1615
- const o = xe(G(e[0]));
1616
- if (Ie(o, u)) return o;
1617
- }
1618
- return u;
1619
- }), f = M(
1620
- () => it(c, Ge - 1),
1621
- [c]
1622
- ), v = M(() => Array.from({ length: Ge }, (o, A) => {
1623
- const F = it(c, A), P = ve(F), z = (t[P] ?? []).map(($) => ({
1624
- id: $.key,
1625
- // SlotGrid formats `start` as a time via Intl.DateTimeFormat —
1626
- // compose a full ISO from the column's date + the slot's HH:mm
1627
- // so the locale-formatter has a real timestamp to work with.
1628
- start: `${P}T${$.time}:00`,
1629
- available: $.available
1630
- }));
1631
- return { date: P, slots: z };
1632
- }), [c, t]), N = Ie(c, u), w = !0, D = X(() => {
1633
- k((o) => {
1634
- const A = xs(o, Ge);
1635
- return Ie(u, A) ? u : A;
1636
- });
1637
- }, [u]), I = X(() => {
1638
- k((o) => it(o, Ge));
1639
- }, []);
1640
- Y(() => {
1641
- if (e.length === 0) return;
1642
- const o = xe(G(e[0]));
1643
- !Ie(o, u) || e.some((F) => {
1644
- const P = xe(G(F));
1645
- return !Ie(P, f) && !ks(P, c);
1646
- }) || k(o);
1647
- }, [e]), Y(() => {
1648
- r == null || r(ve(c), ve(f));
1649
- }, [c, f, r]);
1650
- const b = X(
1651
- (o, A) => {
1652
- const F = typeof A.date == "string" ? A.date : ve(A.date);
1653
- n({
1654
- ...jt(Ze(a, F), o.id)
1655
- }), i == null || i(F);
1656
- },
1657
- [n, i, a]
1658
- ), x = d || p ? "loading" : "default", y = v.some((o) => o.slots.length > 0), O = e[0];
1659
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1660
- !y && !!O ? /* @__PURE__ */ s(
1661
- mt,
1662
- {
1663
- nextAvailableDate: O,
1664
- onJump: () => k(xe(G(O))),
1665
- locale: m
1666
- }
1667
- ) : null,
1668
- /* @__PURE__ */ s(
1669
- bs,
1670
- {
1671
- id: l ? `${l}-slots` : void 0,
1672
- days: v,
1673
- state: x,
1674
- selectedSlotId: a.slotKey,
1675
- maxInitialSlotsPerDay: 6,
1676
- locale: m,
1677
- hasPrevious: N,
1678
- hasNext: w,
1679
- onSlotSelect: b,
1680
- onPreviousDays: D,
1681
- onNextDays: I
1682
- }
1683
- )
1684
- ] });
1685
- }
1686
- function Ht(e) {
1687
- const {
1688
- inputs: t,
1689
- value: a,
1690
- onChange: n,
1691
- onDateSelect: i,
1692
- onWindowChange: r,
1693
- loadingDates: d,
1694
- loadingSlots: p,
1695
- locale: m,
1696
- datePickerStyle: l,
1697
- agentIdBase: u
1698
- } = e;
1699
- return l === "four-day-grid" ? /* @__PURE__ */ s(
1700
- Aa,
1701
- {
1702
- availableDates: t.availableDates,
1703
- availableSlots: t.availableSlots,
1704
- value: a,
1705
- onChange: n,
1706
- onDateSelect: i,
1707
- onWindowChange: r,
1708
- loadingDates: d,
1709
- loadingSlots: p,
1710
- locale: m,
1711
- agentIdBase: u
1712
- }
1713
- ) : /* @__PURE__ */ s(
1714
- xa,
1715
- {
1716
- availableDates: t.availableDates,
1717
- selectedDate: a.date,
1718
- onSelectDate: (c) => {
1719
- n(Ze(a, c)), i == null || i(c);
1720
- },
1721
- locale: m,
1722
- loading: d ?? p
1723
- }
1724
- );
1725
- }
1726
- function Jt(e) {
1727
- const { inputs: t, value: a, onChange: n, loadingSlots: i, locale: r, datePickerStyle: d } = e;
1728
- return d === "four-day-grid" || !a.date ? null : /* @__PURE__ */ s(
1729
- Da,
1730
- {
1731
- date: a.date,
1732
- slots: t.availableSlots[a.date] ?? [],
1733
- selectedSlotKey: a.slotKey,
1734
- onSelect: (p) => n(jt(a, p.key)),
1735
- loading: i,
1736
- locale: r
1737
- }
1738
- );
1739
- }
1740
- function Ut({ value: e, onChange: t }) {
1741
- const { t: a } = V(), n = [
1742
- { value: "private", label: a("booking.insurance.private") },
1743
- { value: "public", label: a("booking.insurance.public") }
1744
- ];
1745
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1746
- /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: a("booking.insurance.heading") }),
1747
- /* @__PURE__ */ s(
1748
- We,
1749
- {
1750
- options: n,
1751
- value: e ?? "",
1752
- onValueChange: (i) => {
1753
- (i === "private" || i === "public") && t(i);
1754
- },
1755
- placeholder: a("booking.insurance.placeholder"),
1756
- "aria-label": a("booking.insurance.heading")
1757
- }
1758
- )
1759
- ] });
1760
- }
1761
- function Yt({
1762
- specialties: e,
1763
- value: t,
1764
- valueIds: a,
1765
- onChange: n,
1766
- onChangeIds: i,
1767
- pickerStyle: r = "select"
1768
- }) {
1769
- const { t: d } = V(), p = e.map((l) => ({
1770
- value: l.id,
1771
- label: l.label
1772
- })), m = /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: d("booking.specialty.heading") });
1773
- return r === "multi-select" && i ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1774
- m,
1775
- /* @__PURE__ */ s(
1776
- ut,
1777
- {
1778
- options: p,
1779
- value: a ?? [],
1780
- onChange: i,
1781
- placeholder: d("booking.specialty.placeholder"),
1782
- "aria-label": d("booking.specialty.heading"),
1783
- allowClear: !0
1784
- }
1785
- )
1786
- ] }) : r === "combobox" ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1787
- m,
1788
- /* @__PURE__ */ s(
1789
- ct,
1790
- {
1791
- options: p,
1792
- value: t ?? "",
1793
- onValueChange: (l) => n(l === "" ? "" : l),
1794
- placeholder: d("booking.specialty.placeholder"),
1795
- "aria-label": d("booking.specialty.heading"),
1796
- clearable: !0
1797
- }
1798
- )
1799
- ] }) : /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1800
- m,
1801
- /* @__PURE__ */ s(
1802
- We,
1803
- {
1804
- options: p,
1805
- value: t ?? "",
1806
- onValueChange: (l) => n(l),
1807
- placeholder: d("booking.specialty.placeholder"),
1808
- "aria-label": d("booking.specialty.heading")
1809
- }
1810
- )
1811
- ] });
1812
- }
1813
- function Wt({
1814
- services: e,
1815
- value: t,
1816
- valueIds: a,
1817
- onChange: n,
1818
- onChangeIds: i,
1819
- pickerStyle: r,
1820
- compact: d
1821
- }) {
1822
- const { t: p } = V(), m = r ?? (d ? "select" : "cards"), l = e.map((c) => {
1823
- const k = Gt(c);
1824
- return k ? {
1825
- value: c.id,
1826
- label: c.label,
1827
- endContent: /* @__PURE__ */ s(Bt, { variant: "accentSoft", size: "lg", children: k })
1828
- } : {
1829
- value: c.id,
1830
- label: `${c.label} · ${p("booking.serviceSummary", {
1831
- minutes: c.durationMin
1832
- })}`
1833
- };
1834
- }), u = /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: p("booking.service.heading") });
1835
- return m === "multi-select" && i ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1836
- u,
1837
- /* @__PURE__ */ s(
1838
- ut,
1839
- {
1840
- options: l,
1841
- value: a ?? [],
1842
- onChange: i,
1843
- placeholder: p("booking.service.placeholder"),
1844
- "aria-label": p("booking.service.heading"),
1845
- allowClear: !0
1846
- }
1847
- )
1848
- ] }) : m === "combobox" ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1849
- u,
1850
- /* @__PURE__ */ s(
1851
- ct,
1852
- {
1853
- options: l,
1854
- value: t ?? "",
1855
- onValueChange: (c) => n(c === "" ? "" : c),
1856
- placeholder: p("booking.service.placeholder"),
1857
- "aria-label": p("booking.service.heading"),
1858
- clearable: !0
1859
- }
1860
- )
1861
- ] }) : m === "select" ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1862
- u,
1863
- /* @__PURE__ */ s(
1864
- We,
1865
- {
1866
- options: l,
1867
- value: t ?? "",
1868
- onValueChange: (c) => n(c),
1869
- placeholder: p("booking.service.placeholder"),
1870
- "aria-label": p("booking.service.heading")
1871
- }
1872
- )
1873
- ] }) : /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1874
- u,
1875
- /* @__PURE__ */ s(
1876
- Na,
1877
- {
1878
- services: e,
1879
- selectedServiceId: t,
1880
- onSelect: n
1881
- }
1882
- )
1883
- ] });
1884
- }
1885
- function Zt({
1886
- operators: e,
1887
- value: t,
1888
- valueIds: a,
1889
- onChange: n,
1890
- onChangeIds: i,
1891
- pickerStyle: r = "select"
1892
- }) {
1893
- const { t: d } = V(), p = /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: d("booking.operator.heading") });
1894
- if (r === "multi-select" && i) {
1895
- const l = e.map((u) => ({
1896
- value: u.id,
1897
- label: u.name
1898
- }));
1899
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1900
- p,
1901
- /* @__PURE__ */ s(
1902
- ut,
1903
- {
1904
- options: l,
1905
- value: a ?? [],
1906
- onChange: i,
1907
- placeholder: d("booking.operator.placeholder"),
1908
- "aria-label": d("booking.operator.heading"),
1909
- allowClear: !0
1910
- }
1911
- )
1912
- ] });
1913
- }
1914
- const m = [
1915
- { value: H, label: d("booking.operator.all") },
1916
- ...e.map((l) => ({ value: l.id, label: l.name }))
1917
- ];
1918
- return r === "combobox" ? /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1919
- p,
1920
- /* @__PURE__ */ s(
1921
- ct,
1922
- {
1923
- options: m,
1924
- value: t ?? H,
1925
- onValueChange: (l) => n(l === "" ? H : l),
1926
- placeholder: d("booking.operator.placeholder"),
1927
- "aria-label": d("booking.operator.heading"),
1928
- clearable: !0
1929
- }
1930
- )
1931
- ] }) : /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1932
- p,
1933
- /* @__PURE__ */ s(
1934
- We,
1935
- {
1936
- options: m,
1937
- value: t ?? H,
1938
- onValueChange: (l) => n(l),
1939
- placeholder: d("booking.operator.placeholder"),
1940
- "aria-label": d("booking.operator.heading")
1941
- }
1942
- )
1943
- ] });
1944
- }
1945
- function Xt({
1946
- customSlot: e
1947
- }) {
1948
- const { t } = V();
1949
- return e ? /* @__PURE__ */ s(te, { children: e }) : /* @__PURE__ */ g(Q, { variant: "warning", children: [
1950
- /* @__PURE__ */ s(Q.Title, { as: "h4", children: t("booking.onboardingIncomplete.title") }),
1951
- /* @__PURE__ */ s(Q.Description, { children: t("booking.onboardingIncomplete.description") })
1952
- ] });
1953
- }
1954
- function mt({
1955
- nextAvailableDate: e,
1956
- onJump: t,
1957
- locale: a
1958
- }) {
1959
- const { t: n } = V(), i = M(() => {
1960
- try {
1961
- return new Intl.DateTimeFormat(a, { dateStyle: "long" }).format(
1962
- G(e)
1963
- );
1964
- } catch {
1965
- return e;
1966
- }
1967
- }, [e, a]);
1968
- return /* @__PURE__ */ g(Q, { variant: "info", children: [
1969
- /* @__PURE__ */ s(Q.Description, { children: n("booking.nextAvailable.description", { date: i }) }),
1970
- /* @__PURE__ */ s(Q.Action, { children: /* @__PURE__ */ s(be, { intent: "secondary", size: "sm", onClick: t, children: n("booking.nextAvailable.cta") }) })
1971
- ] });
1972
- }
1973
- function Ta({
1974
- snapshot: e,
1975
- operators: t,
1976
- specialties: a,
1977
- services: n,
1978
- locale: i,
1979
- mode: r,
1980
- showModify: d,
1981
- onReset: p,
1982
- onModify: m
1983
- }) {
1984
- const { t: l } = V(), c = (e.details.confirmationChannels ?? ["email"]).map(
1985
- (D) => l(`booking.confirmation.channel.${D}`)
1986
- ), k = r === "demo" ? l("booking.success.descriptionDemo") : c.length > 1 ? l("booking.success.descriptionMultiple", {
1987
- channels: c.join(" · ")
1988
- }) : l("booking.success.descriptionSingle", { channel: c[0] }), f = M(() => {
1989
- if (e.date)
1990
- try {
1991
- return new Intl.DateTimeFormat(i, {
1992
- weekday: "long",
1993
- day: "numeric",
1994
- month: "long"
1995
- }).format(G(e.date));
1996
- } catch {
1997
- return e.date;
1998
- }
1999
- }, [e.date, i]), v = M(() => {
2000
- const I = (e.operatorIds && e.operatorIds.length > 0 ? e.operatorIds : e.operatorId ? [e.operatorId] : []).filter((b) => b !== H).map((b) => {
2001
- var x;
2002
- return (x = t.find((y) => y.id === b)) == null ? void 0 : x.name;
2003
- }).filter((b) => b !== void 0);
2004
- if (I.length === 0) return "";
2005
- try {
2006
- return new Intl.ListFormat(i === "en" ? "en-GB" : i, {
2007
- style: "long",
2008
- type: "conjunction"
2009
- }).format(I);
2010
- } catch {
2011
- return I.join(", ");
2012
- }
2013
- }, [e.operatorIds, e.operatorId, t, i]), N = e.specialtyId ? a.find((D) => D.id === e.specialtyId) : void 0, w = e.serviceId ? n.find((D) => D.id === e.serviceId) : void 0;
2014
- return /* @__PURE__ */ g(
2015
- "div",
2016
- {
2017
- "data-component": "booking-success",
2018
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
2019
- children: [
2020
- /* @__PURE__ */ g(Q, { variant: "success", children: [
2021
- /* @__PURE__ */ s(Q.Title, { as: "h3", children: l("booking.success.heading") }),
2022
- /* @__PURE__ */ s(Q.Description, { children: k })
2023
- ] }),
2024
- /* @__PURE__ */ s("div", { className: "ds:rounded-[var(--radius-md)] ds:bg-[var(--secondary)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ g("dl", { className: "ds:grid ds:grid-cols-[auto_minmax(0,1fr)] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] ds:m-0", children: [
2025
- N ? /* @__PURE__ */ g(te, { children: [
2026
- /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summarySpecialty") }),
2027
- /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: N.label })
2028
- ] }) : null,
2029
- w ? /* @__PURE__ */ g(te, { children: [
2030
- /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryService") }),
2031
- /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: w.label })
2032
- ] }) : null,
2033
- f ? /* @__PURE__ */ g(te, { children: [
2034
- /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryDate") }),
2035
- /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: f })
2036
- ] }) : null,
2037
- /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryTime") }),
2038
- /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: e.slot.time }),
2039
- v ? /* @__PURE__ */ g(te, { children: [
2040
- /* @__PURE__ */ s("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: l("booking.success.summaryProvider") }),
2041
- /* @__PURE__ */ s("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: v })
2042
- ] }) : null
2043
- ] }) }),
2044
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
2045
- /* @__PURE__ */ s(be, { intent: "secondary", size: "md", onClick: p, children: l("booking.success.bookAnother") }),
2046
- d ? /* @__PURE__ */ s(be, { intent: "ghost", size: "md", onClick: m, children: l("booking.success.modifyBooking") }) : null
2047
- ] })
2048
- ]
2049
- }
2050
- );
2051
- }
2052
- function Qt({ customSlot: e }) {
2053
- const { t } = V();
2054
- return e ? /* @__PURE__ */ s(te, { children: e }) : /* @__PURE__ */ s(
2055
- Pt,
2056
- {
2057
- variant: "no-results",
2058
- title: t("booking.emptyServices.title"),
2059
- description: t("booking.emptyServices.description")
2060
- }
2061
- );
2062
- }
2063
- const es = "data-booking-step-active", _a = `[${es}]`, At = [
2064
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
2065
- "ds:focus-visible:outline-solid",
2066
- "ds:focus-visible:outline-[var(--ring)]",
2067
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2068
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
2069
- ].join(" ");
2070
- function E({
2071
- step: e,
2072
- active: t,
2073
- className: a,
2074
- id: n,
2075
- children: i
2076
- }) {
2077
- return /* @__PURE__ */ s(
2078
- "div",
2079
- {
2080
- id: n,
2081
- "data-booking-step": String(e),
2082
- ...t ? { [es]: "" } : null,
2083
- tabIndex: -1,
2084
- className: a ? `${a} ${At}` : At,
2085
- children: i
2086
- }
2087
- );
2088
- }
2089
- function ft(e, t) {
2090
- return t === "four-day-grid" ? e.filter((a) => a !== 6) : e;
2091
- }
2092
- function Oa(e) {
2093
- const {
2094
- cascade: t,
2095
- inputs: a,
2096
- value: n,
2097
- onChange: i,
2098
- onSubmit: r,
2099
- emptyServicesSlot: d,
2100
- onboardingIncompleteSlot: p,
2101
- loadingDates: m,
2102
- loadingSlots: l,
2103
- onDateSelect: u,
2104
- onWindowChange: c,
2105
- datePickerStyle: k,
2106
- specialtyPickerStyle: f,
2107
- servicePickerStyle: v,
2108
- operatorPickerStyle: N,
2109
- submitting: w,
2110
- locale: D,
2111
- detailsProps: I,
2112
- agentIdBase: b,
2113
- activeStep: x
2114
- } = e, { t: y } = V(), O = Ne(x, k), S = (o, A) => ({
2115
- step: o,
2116
- active: o === O,
2117
- className: A
2118
- });
2119
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2120
- t.gates.insurance ? /* @__PURE__ */ s(E, { ...S(1), children: /* @__PURE__ */ s(
2121
- Ut,
2122
- {
2123
- value: n.insuranceType,
2124
- onChange: (o) => i(Rt(n, o))
2125
- }
2126
- ) }) : null,
2127
- t.gates.specialty ? /* @__PURE__ */ s(E, { ...S(2), children: /* @__PURE__ */ s(
2128
- Yt,
2129
- {
2130
- specialties: t.filtered.specialties,
2131
- value: n.specialtyId,
2132
- valueIds: n.specialtyIds,
2133
- onChange: (o) => i(Et(n, o)),
2134
- onChangeIds: (o) => i(Vt(n, o)),
2135
- pickerStyle: f
2136
- }
2137
- ) }) : null,
2138
- t.gates.service ? /* @__PURE__ */ s(E, { ...S(3), children: t.filtered.services.length === 0 ? /* @__PURE__ */ s(Qt, { customSlot: d }) : /* @__PURE__ */ s(
2139
- Wt,
2140
- {
2141
- services: t.filtered.services,
2142
- value: n.serviceId,
2143
- valueIds: n.serviceIds,
2144
- onChange: (o) => i(Ft(n, o)),
2145
- onChangeIds: (o) => i($t(n, o)),
2146
- pickerStyle: v
2147
- }
2148
- ) }) : null,
2149
- t.gates.onboardingIncomplete ? /* @__PURE__ */ s(Xt, { customSlot: p }) : null,
2150
- t.gates.operator ? /* @__PURE__ */ s(E, { ...S(4), children: /* @__PURE__ */ s(
2151
- Zt,
2152
- {
2153
- operators: t.filtered.operators,
2154
- value: n.operatorId,
2155
- valueIds: n.operatorIds,
2156
- onChange: (o) => i(zt(n, o)),
2157
- onChangeIds: (o) => i(Kt(n, o)),
2158
- pickerStyle: N
2159
- }
2160
- ) }) : null,
2161
- t.gates.date ? /* @__PURE__ */ g(
2162
- E,
2163
- {
2164
- ...S(5, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
2165
- children: [
2166
- /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: y("booking.date.heading") }),
2167
- a.availableDates.length === 0 && a.nextAvailableDate ? /* @__PURE__ */ s(
2168
- mt,
2169
- {
2170
- nextAvailableDate: a.nextAvailableDate,
2171
- onJump: () => i(Ze(n, a.nextAvailableDate)),
2172
- locale: D
2173
- }
2174
- ) : Ht({
2175
- inputs: a,
2176
- value: n,
2177
- onChange: i,
2178
- onDateSelect: u,
2179
- onWindowChange: c,
2180
- loadingDates: m,
2181
- loadingSlots: l,
2182
- locale: D,
2183
- datePickerStyle: k,
2184
- agentIdBase: b
2185
- })
2186
- ]
2187
- }
2188
- ) : null,
2189
- t.gates.slot && n.date && k === "month-calendar" ? /* @__PURE__ */ g(
2190
- E,
2191
- {
2192
- ...S(6, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
2193
- children: [
2194
- /* @__PURE__ */ s("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: y("booking.slot.heading") }),
2195
- Jt({
2196
- inputs: a,
2197
- value: n,
2198
- onChange: i,
2199
- loadingSlots: l,
2200
- locale: D,
2201
- datePickerStyle: k
2202
- })
2203
- ]
2204
- }
2205
- ) : null,
2206
- t.gates.details && t.selectedSlot ? /* @__PURE__ */ s(E, { ...S(7), children: /* @__PURE__ */ s(
2207
- pt,
2208
- {
2209
- ...I,
2210
- value: n.details ?? {},
2211
- onChange: (o) => i({ ...n, details: o }),
2212
- onSubmit: r,
2213
- submitting: w,
2214
- defaultPhoneCountry: e.policy.country
2215
- }
2216
- ) }) : null
2217
- ] });
2218
- }
2219
- function W(e, t, a = {}) {
2220
- const {
2221
- cascade: n,
2222
- inputs: i,
2223
- value: r,
2224
- onChange: d,
2225
- onSubmit: p,
2226
- emptyServicesSlot: m,
2227
- onboardingIncompleteSlot: l,
2228
- loadingDates: u,
2229
- loadingSlots: c,
2230
- onDateSelect: k,
2231
- onWindowChange: f,
2232
- datePickerStyle: v,
2233
- specialtyPickerStyle: N,
2234
- servicePickerStyle: w,
2235
- operatorPickerStyle: D,
2236
- submitting: I,
2237
- locale: b,
2238
- detailsProps: x,
2239
- policy: y,
2240
- agentIdBase: O
2241
- } = t;
2242
- switch (e) {
2243
- case 1:
2244
- return /* @__PURE__ */ s(
2245
- Ut,
2246
- {
2247
- value: r.insuranceType,
2248
- onChange: (S) => d(Rt(r, S))
2249
- }
2250
- );
2251
- case 2:
2252
- return /* @__PURE__ */ s(
2253
- Yt,
2254
- {
2255
- specialties: n.filtered.specialties,
2256
- value: r.specialtyId,
2257
- valueIds: r.specialtyIds,
2258
- onChange: (S) => d(Et(r, S)),
2259
- onChangeIds: (S) => d(Vt(r, S)),
2260
- pickerStyle: N
2261
- }
2262
- );
2263
- case 3:
2264
- return n.filtered.services.length === 0 ? /* @__PURE__ */ s(Qt, { customSlot: m }) : n.gates.onboardingIncomplete ? /* @__PURE__ */ s(Xt, { customSlot: l }) : /* @__PURE__ */ s(
2265
- Wt,
2266
- {
2267
- services: n.filtered.services,
2268
- value: r.serviceId,
2269
- valueIds: r.serviceIds,
2270
- onChange: (S) => d(Ft(r, S)),
2271
- onChangeIds: (S) => d($t(r, S)),
2272
- pickerStyle: w,
2273
- compact: a.compactService
2274
- }
2275
- );
2276
- case 4:
2277
- return /* @__PURE__ */ s(
2278
- Zt,
2279
- {
2280
- operators: n.filtered.operators,
2281
- value: r.operatorId,
2282
- valueIds: r.operatorIds,
2283
- onChange: (S) => d(zt(r, S)),
2284
- onChangeIds: (S) => d(Kt(r, S)),
2285
- pickerStyle: D
2286
- }
2287
- );
2288
- case 5:
2289
- return i.availableDates.length === 0 && i.nextAvailableDate ? /* @__PURE__ */ s(
2290
- mt,
2291
- {
2292
- nextAvailableDate: i.nextAvailableDate,
2293
- onJump: () => d(Ze(r, i.nextAvailableDate)),
2294
- locale: b
2295
- }
2296
- ) : Ht({
2297
- inputs: i,
2298
- value: r,
2299
- onChange: d,
2300
- onDateSelect: k,
2301
- onWindowChange: f,
2302
- loadingDates: u,
2303
- loadingSlots: c,
2304
- locale: b,
2305
- datePickerStyle: v,
2306
- agentIdBase: O
2307
- });
2308
- case 6:
2309
- return Jt({
2310
- inputs: i,
2311
- value: r,
2312
- onChange: d,
2313
- loadingSlots: c,
2314
- locale: b,
2315
- datePickerStyle: v
2316
- });
2317
- case 7:
2318
- return n.selectedSlot ? /* @__PURE__ */ s(
2319
- pt,
2320
- {
2321
- ...x,
2322
- value: r.details ?? {},
2323
- onChange: (S) => d({ ...r, details: S }),
2324
- onSubmit: p,
2325
- submitting: I,
2326
- defaultPhoneCountry: y.country
2327
- }
2328
- ) : null;
2329
- /* c8 ignore next 2 */
2330
- default:
2331
- return null;
2332
- }
2333
- }
2334
- function Xe() {
2335
- const { t: e } = V();
2336
- return M(
2337
- () => ({
2338
- 1: e("booking.insurance.heading"),
2339
- 2: e("booking.specialty.heading"),
2340
- 3: e("booking.service.heading"),
2341
- 4: e("booking.operator.heading"),
2342
- 5: e("booking.date.heading"),
2343
- 6: e("booking.slot.heading"),
2344
- 7: e("booking.details.heading")
2345
- }),
2346
- [e]
2347
- );
2348
- }
2349
- function Ne(e, t) {
2350
- return t === "four-day-grid" && e === 6 ? 5 : e;
2351
- }
2352
- function Ba(e) {
2353
- const { cascade: t, value: a, activeStep: n, setActiveStep: i, datePickerStyle: r } = e, d = Xe(), { t: p } = V(), m = p("booking.operator.all"), l = M(
2354
- () => ft(t.visibleSteps, r),
2355
- [t.visibleSteps, r]
2356
- ), u = Ne(n, r), c = Math.max(0, l.indexOf(u)), k = M(
2357
- () => l.map((f) => ({
2358
- label: d[f],
2359
- summary: ts(f, a, t, m),
2360
- status: Pa(f, a, t),
2361
- content: /* @__PURE__ */ s(E, { step: f, active: f === u, children: W(f, e, { compactService: !0 }) })
2362
- })),
2363
- [
2364
- l,
2365
- a,
2366
- d,
2367
- t,
2368
- e,
2369
- u,
2370
- m
2371
- ]
2372
- );
2373
- return /* @__PURE__ */ s(
2374
- hs,
2375
- {
2376
- activeStep: c,
2377
- steps: k,
2378
- onStepChange: (f) => {
2379
- const v = l[f];
2380
- v && i(v);
2381
- }
2382
- }
2383
- );
2384
- }
2385
- function Pa(e, t, a) {
2386
- return ue(e, t) && e < a.currentStep ? "completed" : e <= a.currentStep ? "unlocked" : void 0;
2387
- }
2388
- function ue(e, t) {
2389
- switch (e) {
2390
- case 1:
2391
- return t.insuranceType !== void 0;
2392
- case 2:
2393
- return ne(t).length > 0;
2394
- case 3:
2395
- return pe(t).length > 0;
2396
- case 4:
2397
- return Ue(t).length > 0;
2398
- case 5:
2399
- return t.date !== void 0;
2400
- case 6:
2401
- return t.slotKey !== void 0;
2402
- case 7:
2403
- return !1;
2404
- }
2405
- }
2406
- function Tt(e, t) {
2407
- return e !== 4 ? ue(e, t) : t.operatorIds && t.operatorIds.length > 0 ? !0 : dt(t) !== void 0;
2408
- }
2409
- function rt(e, t) {
2410
- const a = e.map((n) => {
2411
- var i;
2412
- return (i = t.find((r) => r.id === n)) == null ? void 0 : i.label;
2413
- }).filter((n) => n !== void 0);
2414
- return a.length > 0 ? a.join(", ") : void 0;
2415
- }
2416
- function ts(e, t, a, n) {
2417
- var i;
2418
- if (ue(e, t))
2419
- switch (e) {
2420
- case 1:
2421
- return t.insuranceType;
2422
- case 2:
2423
- return rt(
2424
- ne(t),
2425
- a.filtered.specialties
2426
- );
2427
- case 3:
2428
- return rt(pe(t), a.filtered.services);
2429
- case 4: {
2430
- const r = Ue(t), d = r.filter((m) => m !== H), p = rt(
2431
- d,
2432
- a.filtered.operators.map((m) => ({
2433
- id: m.id,
2434
- label: m.name
2435
- }))
2436
- );
2437
- return p !== void 0 ? p : r.includes(H) ? n : void 0;
2438
- }
2439
- case 5:
2440
- return t.date;
2441
- case 6:
2442
- return (i = a.selectedSlot) == null ? void 0 : i.time;
2443
- case 7:
2444
- return;
2445
- }
2446
- }
2447
- function La(e) {
2448
- const { cascade: t, value: a, activeStep: n, setActiveStep: i } = e, { t: r } = V(), d = Xe(), p = r("booking.operator.all"), m = `${lt()}-filter`, l = Ne(n, e.datePickerStyle), u = t.visibleSteps.filter(
2449
- (f) => f === 1 || f === 2 || f === 3 || f === 4
2450
- ), c = u.some(
2451
- (f) => !ue(f, a)
2452
- ), k = u.some(
2453
- (f) => f === n
2454
- ) ? n : u.find((f) => !ue(f, a));
2455
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2456
- u.length > 0 ? /* @__PURE__ */ s(
2457
- "div",
2458
- {
2459
- role: "group",
2460
- "aria-label": r("booking.filtersLabel"),
2461
- className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
2462
- children: u.map((f) => {
2463
- const v = ts(
2464
- f,
2465
- a,
2466
- t,
2467
- p
2468
- ), N = f === k, w = ue(f, a);
2469
- return /* @__PURE__ */ s(
2470
- be,
2471
- {
2472
- intent: N ? "primary" : "outline",
2473
- size: "sm",
2474
- endIcon: /* @__PURE__ */ s(
2475
- ys,
2476
- {
2477
- "aria-hidden": "true",
2478
- className: N ? "ds:rotate-180" : void 0
2479
- }
2480
- ),
2481
- "aria-expanded": w ? N : void 0,
2482
- "aria-controls": w && N ? m : void 0,
2483
- "aria-current": !w && N ? "step" : void 0,
2484
- onClick: () => i(
2485
- w && N ? t.currentStep : f
2486
- ),
2487
- children: v ? /* @__PURE__ */ g(te, { children: [
2488
- d[f],
2489
- ": ",
2490
- v
2491
- ] }) : d[f]
2492
- },
2493
- `csc-${f}`
2494
- );
2495
- })
2496
- }
2497
- ) : null,
2498
- k !== void 0 ? /* @__PURE__ */ s(
2499
- E,
2500
- {
2501
- step: k,
2502
- active: k === l,
2503
- id: m,
2504
- children: W(k, e, { compactService: !0 })
2505
- }
2506
- ) : null,
2507
- !c && t.gates.date ? (
2508
- // four-day-grid embeds slots inline with the day strip — the
2509
- // historic 2-col date|slot split collapses to a single column
2510
- // so the picker spans the full width instead of orphaning an
2511
- // empty right cell.
2512
- e.datePickerStyle === "four-day-grid" ? /* @__PURE__ */ s(E, { step: 5, active: l === 5, children: W(5, e) }) : /* @__PURE__ */ g("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
2513
- /* @__PURE__ */ s(
2514
- E,
2515
- {
2516
- step: 5,
2517
- active: l === 5,
2518
- className: "ds:min-w-0",
2519
- children: W(5, e)
2520
- }
2521
- ),
2522
- a.date ? /* @__PURE__ */ s(
2523
- E,
2524
- {
2525
- step: 6,
2526
- active: l === 6,
2527
- className: "ds:min-w-0",
2528
- children: W(6, e)
2529
- }
2530
- ) : /* @__PURE__ */ s("div", { className: "ds:min-w-0" })
2531
- ] })
2532
- ) : null,
2533
- t.gates.details ? /* @__PURE__ */ s(E, { step: 7, active: l === 7, children: W(7, e) }) : null
2534
- ] });
2535
- }
2536
- function Ra(e) {
2537
- const { cascade: t, datePickerStyle: a, activeStep: n } = e, i = Ne(n, a), r = t.visibleSteps.filter(
2538
- (p) => p === 1 || p === 2 || p === 3 || p === 4
2539
- );
2540
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2541
- /* @__PURE__ */ g(
2542
- "div",
2543
- {
2544
- className: a === "four-day-grid" ? "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]" : "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2",
2545
- children: [
2546
- /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: r.map((p) => /* @__PURE__ */ s(E, { step: p, active: p === i, children: W(p, e, { compactService: !0 }) }, `fbf-${p}`)) }),
2547
- /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2548
- t.gates.date ? /* @__PURE__ */ s(E, { step: 5, active: i === 5, children: W(5, e) }) : null,
2549
- t.gates.slot && e.value.date && a === "month-calendar" ? /* @__PURE__ */ s(E, { step: 6, active: i === 6, children: W(6, e) }) : null
2550
- ] })
2551
- ]
2552
- }
2553
- ),
2554
- t.gates.details ? /* @__PURE__ */ s(E, { step: 7, active: i === 7, children: W(7, e) }) : null
2555
- ] });
2556
- }
2557
- function Ea(e) {
2558
- const { cascade: t, value: a, activeStep: n, setActiveStep: i, datePickerStyle: r } = e, { t: d } = V(), p = Xe(), m = M(
2559
- () => ft(t.visibleSteps, r),
2560
- [t.visibleSteps, r]
2561
- ), l = Ne(n, r), u = Math.max(0, m.indexOf(l)), c = m.length, k = M(
2562
- () => m.map((w) => ({ label: p[w] })),
2563
- [m, p]
2564
- ), f = u > 0, v = l === 5 && r === "four-day-grid", N = u < c - 1 && ue(l, a) && (!v || ue(6, a));
2565
- return /* @__PURE__ */ g("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2566
- /* @__PURE__ */ s(vs, { activeStep: u, steps: k }),
2567
- /* @__PURE__ */ s(E, { step: l, active: !0, children: W(l, e, { compactService: !0 }) }),
2568
- /* @__PURE__ */ g("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
2569
- /* @__PURE__ */ s(
2570
- be,
2571
- {
2572
- intent: "ghost",
2573
- size: "md",
2574
- disabled: !f,
2575
- onClick: () => {
2576
- const w = m[u - 1];
2577
- w && i(w);
2578
- },
2579
- children: d("booking.actions.back")
2580
- }
2581
- ),
2582
- l < 7 ? /* @__PURE__ */ s(
2583
- be,
2584
- {
2585
- intent: "primary",
2586
- size: "md",
2587
- disabled: !N,
2588
- onClick: () => {
2589
- const w = m[u + 1];
2590
- w && i(w);
2591
- },
2592
- children: d("booking.actions.next")
2593
- }
2594
- ) : null
2595
- ] })
2596
- ] });
2597
- }
2598
- const Va = [], Fa = [];
2599
- function _t() {
2600
- return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2601
- }
2602
- const $a = Ot(
2603
- ({
2604
- variant: e = "inline-list",
2605
- country: t,
2606
- // No default — the cascade engine treats `undefined` as "auto-on
2607
- // when `specialties` has items" so consumers who pass specialty
2608
- // data without the explicit flag still get the step.
2609
- useSpecialties: a,
2610
- allowOperatorSelection: n = !1,
2611
- lockedOperatorId: i,
2612
- operatorsByService: r = !1,
2613
- autoSelectSingleService: d = !1,
2614
- specialties: p,
2615
- services: m,
2616
- operators: l,
2617
- availableDates: u,
2618
- availableSlots: c,
2619
- nextAvailableDate: k,
2620
- requireCodiceFiscale: f,
2621
- requireDateOfBirth: v,
2622
- requireInsuranceNumber: N,
2623
- showNote: w,
2624
- showReturningPatientFlag: D,
2625
- privacyPolicyUrl: I,
2626
- termsUrl: b,
2627
- validateCodiceFiscale: x,
2628
- validateInsuranceNumber: y,
2629
- confirmationChannels: O,
2630
- defaultConfirmationChannels: S,
2631
- value: o,
2632
- onChange: A,
2633
- onSubmit: F,
2634
- onStepChange: P,
2635
- onDateSelect: ie,
2636
- onWindowChange: z,
2637
- datePickerStyle: $ = "month-calendar",
2638
- specialtyPickerStyle: re,
2639
- servicePickerStyle: R,
2640
- operatorPickerStyle: me,
2641
- loadingDates: se,
2642
- loadingSlots: we,
2643
- submitting: fe,
2644
- submitError: _e,
2645
- mode: oe = "live",
2646
- showModifyOnSuccess: ye = !0,
2647
- surface: Ce = "flat",
2648
- emptyServicesSlot: Oe,
2649
- onboardingIncompleteSlot: ke,
2650
- "aria-label": Be,
2651
- id: ge,
2652
- className: Qe,
2653
- onFocus: Me,
2654
- ...Pe
2655
- }, et) => {
2656
- const { t: de, i18n: Le } = V(), K = e ?? "inline-list", h = Le.language ?? "en", _ = p ?? Va, ae = l ?? Fa;
2657
- Y(() => {
2658
- const C = ua(o, {
2659
- useSpecialties: a,
2660
- lockedOperatorId: i,
2661
- autoSelectSingleService: d,
2662
- specialties: _,
2663
- services: m
2664
- });
2665
- (C.specialtyId !== o.specialtyId || C.operatorId !== o.operatorId || C.serviceId !== o.serviceId) && A(C);
2666
- }, [
2667
- i,
2668
- a,
2669
- d,
2670
- _,
2671
- m
2672
- ]);
2673
- const T = M(
2674
- () => ca({
2675
- country: t,
2676
- useSpecialties: a,
2677
- allowOperatorSelection: n,
2678
- lockedOperatorId: i,
2679
- operatorsByService: r,
2680
- specialties: _,
2681
- services: m,
2682
- operators: ae,
2683
- availableSlots: c,
2684
- value: o
2685
- }),
2686
- [
2687
- t,
2688
- a,
2689
- n,
2690
- i,
2691
- r,
2692
- d,
2693
- _,
2694
- m,
2695
- ae,
2696
- u,
2697
- c,
2698
- o
2699
- ]
2700
- ), Re = M(
2701
- () => [
2702
- JSON.stringify(o.insuranceType),
2703
- JSON.stringify(ne(o)),
2704
- JSON.stringify(pe(o)),
2705
- JSON.stringify(Ue(o)),
2706
- JSON.stringify(o.date),
2707
- JSON.stringify(o.slotKey)
2708
- ],
2709
- [o]
2710
- ), Ee = K === "progress", gt = X(
2711
- (C) => {
2712
- if (!Ee) return T.currentStep;
2713
- const L = T.visibleSteps.find(
2714
- (B) => B > C && !Tt(B, o)
2715
- );
2716
- return L === void 0 ? T.currentStep : Math.min(L, T.currentStep);
2717
- },
2718
- [Ee, T.visibleSteps, T.currentStep, o]
2719
- ), [ee, he] = Z(
2720
- T.currentStep
2721
- ), ht = U(Re), vt = U(T.visibleSteps);
2722
- Y(() => {
2723
- const C = ht.current, L = vt.current;
2724
- ht.current = Re, vt.current = T.visibleSteps;
2725
- const B = Re.findIndex(
2726
- (q, It) => q !== C[It]
2727
- );
2728
- if (B !== -1) {
2729
- he(gt(B + 1));
2730
- return;
2731
- }
2732
- const j = Ee ? T.visibleSteps.find(
2733
- (q) => q < ee && !L.includes(q) && !Tt(q, o)
2734
- ) : void 0;
2735
- if (j !== void 0) {
2736
- he(j);
2737
- return;
2738
- }
2739
- T.visibleSteps.includes(ee) || he(T.currentStep);
2740
- }, [
2741
- Re,
2742
- gt,
2743
- Ee,
2744
- T.currentStep,
2745
- T.visibleSteps,
2746
- ee,
2747
- o
2748
- ]);
2749
- const Se = U(null), tt = M(
2750
- () => ft(T.visibleSteps, $),
2751
- [T.visibleSteps, $]
2752
- ), bt = Xe(), [ss, as] = Z(""), yt = U(null), Ve = U(null);
2753
- Y(() => {
2754
- const C = Ne(ee, $);
2755
- if (Ve.current === null) {
2756
- Ve.current = C;
2757
- return;
2758
- }
2759
- if (Ve.current === C) return;
2760
- Ve.current = C;
2761
- const L = tt.indexOf(C);
2762
- as(
2763
- L === -1 ? "" : de("booking.stepAnnouncement", {
2764
- current: L + 1,
2765
- total: tt.length,
2766
- label: bt[C]
2767
- })
2768
- );
2769
- const B = yt.current;
2770
- if (!B || B.isConnected) return;
2771
- const j = Se.current;
2772
- if (!j) return;
2773
- const q = document.activeElement;
2774
- if (!(q === null || q === document.body || !j.contains(q))) return;
2775
- const $e = j.querySelector(_a) ?? j;
2776
- if ($e.focus({ preventScroll: !0 }), typeof $e.scrollIntoView == "function")
2777
- try {
2778
- $e.scrollIntoView({
2779
- behavior: _t() ? "auto" : "smooth",
2780
- block: "nearest"
2781
- });
2782
- } catch {
2783
- $e.scrollIntoView();
2784
- }
2785
- }, [ee, $, tt, bt, de]);
2786
- const [le, De] = Z("idle"), [st, at] = Z(null), kt = X(
2787
- async (C) => {
2788
- if (!T.selectedSlot) return;
2789
- const L = {
2790
- slot: T.selectedSlot,
2791
- value: {
2792
- ...o,
2793
- details: C,
2794
- operatorId: dt(o) ?? o.operatorId
2795
- },
2796
- details: C
2797
- };
2798
- De("submitting");
2799
- try {
2800
- await F(L), at({
2801
- slot: T.selectedSlot,
2802
- details: C,
2803
- specialtyId: o.specialtyId,
2804
- serviceId: o.serviceId,
2805
- insuranceType: o.insuranceType,
2806
- operatorId: dt(o),
2807
- operatorIds: Ue(o).filter(
2808
- (B) => B !== H
2809
- ),
2810
- date: o.date
2811
- }), De("success");
2812
- } catch {
2813
- throw De("error"), new Error("Booking submission failed");
2814
- }
2815
- },
2816
- [T.selectedSlot, F, o]
2817
- );
2818
- os(et, () => Se.current, []);
2819
- const Ae = le === "success" ? 8 : T.currentStep, St = U(null);
2820
- Y(() => {
2821
- if (Ae !== St.current && (St.current = Ae, P == null || P(Ae), Ae === 8 && Se.current))
2822
- try {
2823
- Se.current.scrollIntoView({
2824
- behavior: _t() ? "auto" : "smooth",
2825
- block: "start"
2826
- });
2827
- } catch {
2828
- Se.current.scrollIntoView();
2829
- }
2830
- }, [Ae, P]);
2831
- const Fe = U({ activeStep: ee, cascade: T, submitState: le });
2832
- Y(() => {
2833
- Fe.current = { activeStep: ee, cascade: T, submitState: le };
2834
- }, [ee, T, le]);
2835
- const nt = M(
2836
- () => ({
2837
- getVariant: () => K,
2838
- getCurrentStep: () => {
2839
- const C = Fe.current;
2840
- return C.submitState === "success" ? 8 : C.activeStep;
2841
- },
2842
- reset: () => {
2843
- A({}), at(null), De("idle"), he(1);
2844
- },
2845
- goToStep: (C) => {
2846
- const L = Fe.current, B = L.cascade.visibleSteps.includes(C), j = L.cascade.currentStep, q = !B || C > j ? j : C;
2847
- Fe.current = { ...L, activeStep: q }, he(q);
2848
- }
2849
- }),
2850
- [K, A]
2851
- );
2852
- ls(aa, nt, ge);
2853
- const ns = Be ?? de("booking.regionLabel"), is = M(() => le !== "success" || !st ? null : /* @__PURE__ */ s(
2854
- Ta,
2855
- {
2856
- snapshot: st,
2857
- operators: ae,
2858
- specialties: _,
2859
- services: m,
2860
- locale: h,
2861
- mode: oe,
2862
- showModify: ye,
2863
- onReset: () => nt.reset(),
2864
- onModify: () => {
2865
- at(null), De("idle"), he(7);
2866
- }
2867
- }
2868
- ), [
2869
- le,
2870
- st,
2871
- ae,
2872
- _,
2873
- m,
2874
- h,
2875
- oe,
2876
- ye,
2877
- nt
2878
- ]), xt = M(() => {
2879
- const C = new Set(pe(o)), L = m.filter((B) => C.has(B.id)).map((B) => {
2880
- var j;
2881
- return {
2882
- label: B.label,
2883
- text: ((j = B.criticalInformationToAccept) == null ? void 0 : j.trim()) ?? ""
2884
- };
2885
- }).filter((B) => B.text.length > 0);
2886
- if (L.length !== 0)
2887
- return L.length === 1 ? L[0].text : L.map((B) => `${B.label}: ${B.text}`).join(`
2888
-
2889
- `);
2890
- }, [m, o]), rs = M(() => {
2891
- if (le === "success") return null;
2892
- const C = K === "accordion" ? Ba : K === "calendar" ? La : K === "flexible" ? Ra : K === "progress" ? Ea : Oa, L = {
2893
- cascade: T,
2894
- inputs: {
2895
- specialties: _,
2896
- services: m,
2897
- operators: ae,
2898
- availableDates: u,
2899
- availableSlots: c,
2900
- nextAvailableDate: k
2901
- },
2902
- value: o,
2903
- onChange: A,
2904
- onSubmit: kt,
2905
- policy: { country: t, lockedOperatorId: i },
2906
- detailsProps: {
2907
- requireCodiceFiscale: f,
2908
- requireDateOfBirth: v,
2909
- requireInsuranceNumber: N,
2910
- insuranceType: o.insuranceType,
2911
- showNote: w,
2912
- showReturningPatientFlag: D,
2913
- privacyPolicyUrl: I,
2914
- termsUrl: b,
2915
- criticalInformationToAccept: xt,
2916
- validateCodiceFiscale: x,
2917
- validateInsuranceNumber: y,
2918
- confirmationChannels: O,
2919
- defaultConfirmationChannels: S,
2920
- submitError: _e
2921
- },
2922
- emptyServicesSlot: Oe,
2923
- onboardingIncompleteSlot: ke,
2924
- loadingDates: se,
2925
- loadingSlots: we,
2926
- onDateSelect: ie,
2927
- onWindowChange: z,
2928
- datePickerStyle: $,
2929
- specialtyPickerStyle: re,
2930
- servicePickerStyle: R,
2931
- operatorPickerStyle: me,
2932
- submitting: fe,
2933
- locale: h,
2934
- activeStep: ee,
2935
- setActiveStep: he,
2936
- agentIdBase: ge
2937
- };
2938
- return /* @__PURE__ */ s(C, { ...L });
2939
- }, [
2940
- le,
2941
- K,
2942
- T,
2943
- _,
2944
- m,
2945
- ae,
2946
- u,
2947
- c,
2948
- k,
2949
- o,
2950
- A,
2951
- kt,
2952
- t,
2953
- i,
2954
- f,
2955
- v,
2956
- N,
2957
- _e,
2958
- w,
2959
- D,
2960
- I,
2961
- b,
2962
- xt,
2963
- x,
2964
- y,
2965
- O,
2966
- S,
2967
- Oe,
2968
- ke,
2969
- se,
2970
- we,
2971
- ie,
2972
- z,
2973
- $,
2974
- re,
2975
- R,
2976
- me,
2977
- fe,
2978
- h,
2979
- ee,
2980
- ge
2981
- ]);
2982
- return /* @__PURE__ */ g(
2983
- "div",
2984
- {
2985
- ref: Se,
2986
- role: "region",
2987
- "aria-label": ns,
2988
- id: ge,
2989
- "data-component": "booking",
2990
- "data-component-id": ge,
2991
- "data-variant": K,
2992
- className: ha({
2993
- variant: K,
2994
- surface: Ce,
2995
- className: Qe
2996
- }),
2997
- tabIndex: -1,
2998
- onFocus: (C) => {
2999
- yt.current = C.target, Me == null || Me(C);
3000
- },
3001
- ...Pe,
3002
- children: [
3003
- /* @__PURE__ */ s("div", { role: "status", className: "ds:sr-only", children: ss }),
3004
- /* @__PURE__ */ g(
3005
- "div",
3006
- {
3007
- className: [
3008
- "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
3009
- "ds:rounded-[var(--radius-md)]",
3010
- "ds:bg-[color-mix(in_srgb,var(--primary)_35%,var(--background))]",
3011
- "ds:bg-[image:var(--gradient-hero-brand)]",
3012
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
3013
- "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]"
3014
- ].join(" "),
3015
- children: [
3016
- /* @__PURE__ */ s("h2", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: de("booking.regionLabel") }),
3017
- /* @__PURE__ */ s("p", { className: "type-body-sm ds:text-[var(--muted-foreground)] ds:m-0", children: de("booking.headingSubtitle") })
3018
- ]
3019
- }
3020
- ),
3021
- is ?? rs
3022
- ]
3023
- }
3024
- );
3025
- }
3026
- );
3027
- $a.displayName = "Booking";
3028
- export {
3029
- $a as B,
3030
- ot as C,
3031
- H as O,
3032
- aa as b
3033
- };
3034
- //# sourceMappingURL=booking-D43ASl8y.js.map