@alfadocs/ui-kit-debug 1.80.0 → 1.82.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 (223) hide show
  1. package/dist/_chunks/{address-fields-GnoSkvh6.js → address-fields-CfnXK8RT.js} +4 -4
  2. package/dist/_chunks/{address-fields-GnoSkvh6.js.map → address-fields-CfnXK8RT.js.map} +1 -1
  3. package/dist/_chunks/{ai-prompt-input-M6u29f87.js → ai-prompt-input-DH_rnV-F.js} +33 -26
  4. package/dist/_chunks/{ai-prompt-input-M6u29f87.js.map → ai-prompt-input-DH_rnV-F.js.map} +1 -1
  5. package/dist/_chunks/{anamnesis-summary-rows-lONg-zja.js → anamnesis-summary-rows-6gMuu0ZK.js} +2 -2
  6. package/dist/_chunks/{anamnesis-summary-rows-lONg-zja.js.map → anamnesis-summary-rows-6gMuu0ZK.js.map} +1 -1
  7. package/dist/_chunks/{autocomplete-DosDnGie.js → autocomplete-CnB1mHGc.js} +65 -64
  8. package/dist/_chunks/{autocomplete-DosDnGie.js.map → autocomplete-CnB1mHGc.js.map} +1 -1
  9. package/dist/_chunks/{balance-badge-cell-Dzd-Z_5W.js → balance-badge-cell-BHXJS8Ga.js} +2 -2
  10. package/dist/_chunks/{balance-badge-cell-Dzd-Z_5W.js.map → balance-badge-cell-BHXJS8Ga.js.map} +1 -1
  11. package/dist/_chunks/{benefit-card-BWBClvdF.js → benefit-card-BcPtRHgM.js} +37 -36
  12. package/dist/_chunks/{benefit-card-BWBClvdF.js.map → benefit-card-BcPtRHgM.js.map} +1 -1
  13. package/dist/_chunks/booking-dsgiuhKg.js +4304 -0
  14. package/dist/_chunks/booking-dsgiuhKg.js.map +1 -0
  15. package/dist/_chunks/{calendar-appointment-editor-dialog-DhTTWgXw.js → calendar-appointment-editor-dialog-BuumJbcv.js} +4 -4
  16. package/dist/_chunks/{calendar-appointment-editor-dialog-DhTTWgXw.js.map → calendar-appointment-editor-dialog-BuumJbcv.js.map} +1 -1
  17. package/dist/_chunks/{city-input-3J3bz9EO.js → city-input-CJVGswxp.js} +2 -2
  18. package/dist/_chunks/{city-input-3J3bz9EO.js.map → city-input-CJVGswxp.js.map} +1 -1
  19. package/dist/_chunks/{combobox-vF9O-QoG.js → combobox-CDPm_n0p.js} +93 -92
  20. package/dist/_chunks/{combobox-vF9O-QoG.js.map → combobox-CDPm_n0p.js.map} +1 -1
  21. package/dist/_chunks/{command-palette-D9TBzmOG.js → command-palette-B3dVqm9D.js} +68 -68
  22. package/dist/_chunks/{command-palette-D9TBzmOG.js.map → command-palette-B3dVqm9D.js.map} +1 -1
  23. package/dist/_chunks/{contact-profile-card-DKk94l-d.js → contact-profile-card-Da1vmJQI.js} +115 -102
  24. package/dist/_chunks/contact-profile-card-Da1vmJQI.js.map +1 -0
  25. package/dist/_chunks/{country-select-CSE2Zm_s.js → country-select-DQ8q7ypA.js} +2 -2
  26. package/dist/_chunks/{country-select-CSE2Zm_s.js.map → country-select-DQ8q7ypA.js.map} +1 -1
  27. package/dist/_chunks/{face-scheme-BIPJqw9f.js → face-scheme-BgJGFDTa.js} +2 -2
  28. package/dist/_chunks/{face-scheme-BIPJqw9f.js.map → face-scheme-BgJGFDTa.js.map} +1 -1
  29. package/dist/_chunks/{header-settings-BYpVmLip.js → header-settings-CifwJEKB.js} +2 -2
  30. package/dist/_chunks/{header-settings-BYpVmLip.js.map → header-settings-CifwJEKB.js.map} +1 -1
  31. package/dist/_chunks/{link-cell-renderer-B0riA_h_.js → link-cell-renderer-C0ynDik7.js} +3 -3
  32. package/dist/_chunks/{link-cell-renderer-B0riA_h_.js.map → link-cell-renderer-C0ynDik7.js.map} +1 -1
  33. package/dist/_chunks/{locale-picker-DzdGDSBI.js → locale-picker-QbT1p60X.js} +39 -38
  34. package/dist/_chunks/{locale-picker-DzdGDSBI.js.map → locale-picker-QbT1p60X.js.map} +1 -1
  35. package/dist/_chunks/{map-view-C6MIVaqn.js → map-view-Bvi06RVh.js} +2 -2
  36. package/dist/_chunks/{map-view-C6MIVaqn.js.map → map-view-Bvi06RVh.js.map} +1 -1
  37. package/dist/_chunks/{marketplace-app-shell-mS7Q2-81.js → marketplace-app-shell-vON3WhD0.js} +2 -2
  38. package/dist/_chunks/{marketplace-app-shell-mS7Q2-81.js.map → marketplace-app-shell-vON3WhD0.js.map} +1 -1
  39. package/dist/_chunks/{multi-select-BOad3za9.js → multi-select-i5MFRpXg.js} +194 -187
  40. package/dist/_chunks/multi-select-i5MFRpXg.js.map +1 -0
  41. package/dist/_chunks/{otp-input-BgEZi0py.js → otp-input-gV1446Dw.js} +70 -70
  42. package/dist/_chunks/otp-input-gV1446Dw.js.map +1 -0
  43. package/dist/_chunks/{patient-details-B-I9Xkh9.js → patient-details-D0P5eog5.js} +2 -2
  44. package/dist/_chunks/{patient-details-B-I9Xkh9.js.map → patient-details-D0P5eog5.js.map} +1 -1
  45. package/dist/_chunks/{patient-field-row-Bn0z6lAZ.js → patient-field-row-R73dZJY6.js} +5 -5
  46. package/dist/_chunks/{patient-field-row-Bn0z6lAZ.js.map → patient-field-row-R73dZJY6.js.map} +1 -1
  47. package/dist/_chunks/{patient-search-CxqNcth4.js → patient-search-Dy0sxcwv.js} +2 -2
  48. package/dist/_chunks/{patient-search-CxqNcth4.js.map → patient-search-Dy0sxcwv.js.map} +1 -1
  49. package/dist/_chunks/{patient-summary-card-bhDo0gVX.js → patient-summary-card-6U74-ivO.js} +2 -2
  50. package/dist/_chunks/{patient-summary-card-bhDo0gVX.js.map → patient-summary-card-6U74-ivO.js.map} +1 -1
  51. package/dist/_chunks/{payment-automation-upsell-AQpHOS1X.js → payment-automation-upsell-D1YdO1xY.js} +2 -2
  52. package/dist/_chunks/{payment-automation-upsell-AQpHOS1X.js.map → payment-automation-upsell-D1YdO1xY.js.map} +1 -1
  53. package/dist/_chunks/{phone-input-C3NrD-nl.js → phone-input-DJ4BN8tG.js} +70 -63
  54. package/dist/_chunks/{phone-input-C3NrD-nl.js.map → phone-input-DJ4BN8tG.js.map} +1 -1
  55. package/dist/_chunks/{practice-results-CtOanuzZ.js → practice-results-B61krlwu.js} +2 -2
  56. package/dist/_chunks/{practice-results-CtOanuzZ.js.map → practice-results-B61krlwu.js.map} +1 -1
  57. package/dist/_chunks/{province-select-CDjs5obD.js → province-select-CPdTwEob.js} +2 -2
  58. package/dist/_chunks/{province-select-CDjs5obD.js.map → province-select-CPdTwEob.js.map} +1 -1
  59. package/dist/_chunks/{registration-form-CNBfUduG.js → registration-form-DmP3YUfp.js} +3 -3
  60. package/dist/_chunks/{registration-form-CNBfUduG.js.map → registration-form-DmP3YUfp.js.map} +1 -1
  61. package/dist/_chunks/{send-registration-link-form-vTn1HxjA.js → send-registration-link-form-CZYOO7NO.js} +2 -2
  62. package/dist/_chunks/{send-registration-link-form-vTn1HxjA.js.map → send-registration-link-form-CZYOO7NO.js.map} +1 -1
  63. package/dist/_chunks/{task-editor-Cpw-NmND.js → task-editor-BOETWbjU.js} +2 -2
  64. package/dist/_chunks/{task-editor-Cpw-NmND.js.map → task-editor-BOETWbjU.js.map} +1 -1
  65. package/dist/_chunks/{use-appointment-details-read-lFUL4kkd.js → use-appointment-details-read-CWN-nJCZ.js} +2 -2
  66. package/dist/_chunks/{use-appointment-details-read-lFUL4kkd.js.map → use-appointment-details-read-CWN-nJCZ.js.map} +1 -1
  67. package/dist/agent-catalog.json +4 -4
  68. package/dist/agent-i18n/en.json +1 -1
  69. package/dist/components/address-fields/index.js +1 -1
  70. package/dist/components/ai-prompt-input/ai-prompt-input.d.ts.map +1 -1
  71. package/dist/components/ai-prompt-input/index.js +1 -1
  72. package/dist/components/appointment-details-panel/index.js +1 -1
  73. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  74. package/dist/components/autocomplete/index.js +1 -1
  75. package/dist/components/benefit-card/benefit-card.d.ts +7 -1
  76. package/dist/components/benefit-card/benefit-card.d.ts.map +1 -1
  77. package/dist/components/benefit-card/index.js +1 -1
  78. package/dist/components/booking/booking-types.d.ts +35 -2
  79. package/dist/components/booking/booking-types.d.ts.map +1 -1
  80. package/dist/components/booking/booking.d.ts.map +1 -1
  81. package/dist/components/booking/code-step.d.ts +4 -2
  82. package/dist/components/booking/code-step.d.ts.map +1 -1
  83. package/dist/components/booking/details-form.d.ts +2 -0
  84. package/dist/components/booking/details-form.d.ts.map +1 -1
  85. package/dist/components/booking/handover.d.ts +12 -0
  86. package/dist/components/booking/handover.d.ts.map +1 -0
  87. package/dist/components/booking/index.js +1 -1
  88. package/dist/components/booking/reserved.d.ts +24 -0
  89. package/dist/components/booking/reserved.d.ts.map +1 -0
  90. package/dist/components/booking/use-booking-payment.d.ts +3 -1
  91. package/dist/components/booking/use-booking-payment.d.ts.map +1 -1
  92. package/dist/components/city-input/index.js +1 -1
  93. package/dist/components/combobox/combobox.d.ts.map +1 -1
  94. package/dist/components/combobox/index.js +1 -1
  95. package/dist/components/command-palette/index.js +1 -1
  96. package/dist/components/contact-profile-card/contact-profile-card.d.ts +4 -1
  97. package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
  98. package/dist/components/contact-profile-card/index.js +1 -1
  99. package/dist/components/country-select/index.js +1 -1
  100. package/dist/components/data-table/index.js +1 -1
  101. package/dist/components/face-scheme/index.js +1 -1
  102. package/dist/components/header-settings/index.js +1 -1
  103. package/dist/components/locale-picker/index.js +1 -1
  104. package/dist/components/locale-picker/locale-picker.d.ts.map +1 -1
  105. package/dist/components/map-view/index.js +1 -1
  106. package/dist/components/multi-select/index.js +1 -1
  107. package/dist/components/multi-select/multi-select.d.ts.map +1 -1
  108. package/dist/components/otp-input/index.js +1 -1
  109. package/dist/components/otp-input/otp-input.d.ts +1 -1
  110. package/dist/components/otp-input/otp-input.d.ts.map +1 -1
  111. package/dist/components/patient-details/index.js +1 -1
  112. package/dist/components/patient-search/index.js +1 -1
  113. package/dist/components/patient-summary-card/index.js +1 -1
  114. package/dist/components/patient-table/index.js +1 -1
  115. package/dist/components/phone-input/index.js +1 -1
  116. package/dist/components/phone-input/phone-input.d.ts.map +1 -1
  117. package/dist/components/practice-results/index.js +1 -1
  118. package/dist/components/province-select/index.js +1 -1
  119. package/dist/components/task-editor/index.js +1 -1
  120. package/dist/i18n/locales/ar.d.ts +8 -0
  121. package/dist/i18n/locales/ar.d.ts.map +1 -1
  122. package/dist/i18n/locales/ar.js +8 -0
  123. package/dist/i18n/locales/ar.js.map +1 -1
  124. package/dist/i18n/locales/de.d.ts +8 -0
  125. package/dist/i18n/locales/de.d.ts.map +1 -1
  126. package/dist/i18n/locales/de.js +8 -0
  127. package/dist/i18n/locales/de.js.map +1 -1
  128. package/dist/i18n/locales/el.d.ts +8 -0
  129. package/dist/i18n/locales/el.d.ts.map +1 -1
  130. package/dist/i18n/locales/el.js +8 -0
  131. package/dist/i18n/locales/el.js.map +1 -1
  132. package/dist/i18n/locales/en.d.ts +8 -0
  133. package/dist/i18n/locales/en.d.ts.map +1 -1
  134. package/dist/i18n/locales/en.js +8 -0
  135. package/dist/i18n/locales/en.js.map +1 -1
  136. package/dist/i18n/locales/es.d.ts +8 -0
  137. package/dist/i18n/locales/es.d.ts.map +1 -1
  138. package/dist/i18n/locales/es.js +8 -0
  139. package/dist/i18n/locales/es.js.map +1 -1
  140. package/dist/i18n/locales/fr.d.ts +8 -0
  141. package/dist/i18n/locales/fr.d.ts.map +1 -1
  142. package/dist/i18n/locales/fr.js +8 -0
  143. package/dist/i18n/locales/fr.js.map +1 -1
  144. package/dist/i18n/locales/hi.d.ts +8 -0
  145. package/dist/i18n/locales/hi.d.ts.map +1 -1
  146. package/dist/i18n/locales/hi.js +8 -0
  147. package/dist/i18n/locales/hi.js.map +1 -1
  148. package/dist/i18n/locales/it.d.ts +8 -0
  149. package/dist/i18n/locales/it.d.ts.map +1 -1
  150. package/dist/i18n/locales/it.js +8 -0
  151. package/dist/i18n/locales/it.js.map +1 -1
  152. package/dist/i18n/locales/ja.d.ts +8 -0
  153. package/dist/i18n/locales/ja.d.ts.map +1 -1
  154. package/dist/i18n/locales/ja.js +8 -0
  155. package/dist/i18n/locales/ja.js.map +1 -1
  156. package/dist/i18n/locales/nl.d.ts +8 -0
  157. package/dist/i18n/locales/nl.d.ts.map +1 -1
  158. package/dist/i18n/locales/nl.js +8 -0
  159. package/dist/i18n/locales/nl.js.map +1 -1
  160. package/dist/i18n/locales/pl.d.ts +8 -0
  161. package/dist/i18n/locales/pl.d.ts.map +1 -1
  162. package/dist/i18n/locales/pl.js +8 -0
  163. package/dist/i18n/locales/pl.js.map +1 -1
  164. package/dist/i18n/locales/pt.d.ts +8 -0
  165. package/dist/i18n/locales/pt.d.ts.map +1 -1
  166. package/dist/i18n/locales/pt.js +8 -0
  167. package/dist/i18n/locales/pt.js.map +1 -1
  168. package/dist/i18n/locales/ro.d.ts +8 -0
  169. package/dist/i18n/locales/ro.d.ts.map +1 -1
  170. package/dist/i18n/locales/ro.js +8 -0
  171. package/dist/i18n/locales/ro.js.map +1 -1
  172. package/dist/i18n/locales/ru.d.ts +8 -0
  173. package/dist/i18n/locales/ru.d.ts.map +1 -1
  174. package/dist/i18n/locales/ru.js +8 -0
  175. package/dist/i18n/locales/ru.js.map +1 -1
  176. package/dist/i18n/locales/sq.d.ts +8 -0
  177. package/dist/i18n/locales/sq.d.ts.map +1 -1
  178. package/dist/i18n/locales/sq.js +8 -0
  179. package/dist/i18n/locales/sq.js.map +1 -1
  180. package/dist/i18n/locales/sv.d.ts +8 -0
  181. package/dist/i18n/locales/sv.d.ts.map +1 -1
  182. package/dist/i18n/locales/sv.js +8 -0
  183. package/dist/i18n/locales/sv.js.map +1 -1
  184. package/dist/i18n/locales/tr.d.ts +8 -0
  185. package/dist/i18n/locales/tr.d.ts.map +1 -1
  186. package/dist/i18n/locales/tr.js +8 -0
  187. package/dist/i18n/locales/tr.js.map +1 -1
  188. package/dist/i18n/locales/zh.d.ts +8 -0
  189. package/dist/i18n/locales/zh.d.ts.map +1 -1
  190. package/dist/i18n/locales/zh.js +8 -0
  191. package/dist/i18n/locales/zh.js.map +1 -1
  192. package/dist/index.js +30 -30
  193. package/dist/locales/ar.json +8 -0
  194. package/dist/locales/de.json +8 -0
  195. package/dist/locales/el.json +8 -0
  196. package/dist/locales/en.json +8 -0
  197. package/dist/locales/es.json +8 -0
  198. package/dist/locales/fr.json +8 -0
  199. package/dist/locales/hi.json +8 -0
  200. package/dist/locales/it.json +8 -0
  201. package/dist/locales/ja.json +8 -0
  202. package/dist/locales/nl.json +8 -0
  203. package/dist/locales/pl.json +8 -0
  204. package/dist/locales/pt.json +8 -0
  205. package/dist/locales/ro.json +8 -0
  206. package/dist/locales/ru.json +8 -0
  207. package/dist/locales/sq.json +8 -0
  208. package/dist/locales/sv.json +8 -0
  209. package/dist/locales/tr.json +8 -0
  210. package/dist/locales/zh.json +8 -0
  211. package/dist/patterns/anamnesis/index.js +1 -1
  212. package/dist/patterns/calendar/index.js +1 -1
  213. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  214. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  215. package/dist/patterns/registration-form/index.js +1 -1
  216. package/dist/patterns/send-registration-link-form/index.js +1 -1
  217. package/dist/tokens.css +1 -1
  218. package/package.json +1 -1
  219. package/dist/_chunks/booking-By4I_1A-.js +0 -4068
  220. package/dist/_chunks/booking-By4I_1A-.js.map +0 -1
  221. package/dist/_chunks/contact-profile-card-DKk94l-d.js.map +0 -1
  222. package/dist/_chunks/multi-select-BOad3za9.js.map +0 -1
  223. package/dist/_chunks/otp-input-BgEZi0py.js.map +0 -1
@@ -1,4068 +0,0 @@
1
- import { jsx as n, jsxs as k, Fragment as me } from "react/jsx-runtime";
2
- import { forwardRef as kn, useId as bt, useRef as E, useCallback as Ne, useState as G, useEffect as K, useMemo as R, Fragment as Wn, useImperativeHandle as Yn } from "react";
3
- import { c as Et } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Y, Trans as Sn } from "react-i18next";
5
- import { u as Zn } from "./registry-DvAUVLHh.js";
6
- import { A as ne } from "./alert-9kEwDza3.js";
7
- import { B as tt } from "./button-DohK_Ak_.js";
8
- import { C as gt } from "./checkbox-BjDv-r3o.js";
9
- import { C as Qn } from "./checkbox-group-Cw2H5qaq.js";
10
- import { R as Xn } from "./radio-BZQs6_36.js";
11
- import { R as es } from "./radio-group-ChIKyeSJ.js";
12
- import { D as ts } from "./date-picker-CdhXlgVI.js";
13
- import { E as ns } from "./email-input-C7THAwh2.js";
14
- import { F as je } from "./form-field-CyHfOVKF.js";
15
- import { P as ss } from "./phone-input-C3NrD-nl.js";
16
- import { T as is } from "./text-area-COMVJ1yE.js";
17
- import { T as Pt } from "./text-input-CaG9ApoE.js";
18
- import { A as rs } from "./address-fields-GnoSkvh6.js";
19
- import { S as xn } from "./spinner-CoflYlEx.js";
20
- import { a as Gt } from "./format-price-BcFBa-WP.js";
21
- import { C as os } from "./credit-card-D9XZsHGA.js";
22
- import { O as as } from "./otp-input-BgEZi0py.js";
23
- import { B as In } from "./badge-BUk4RjTS.js";
24
- import { I as un } from "./icon-button-S8_weU3g.js";
25
- import { S as Ht } from "./select-4S-eYZUf.js";
26
- import { C as rn } from "./combobox-vF9O-QoG.js";
27
- import { M as on } from "./multi-select-BOad3za9.js";
28
- import { c as cs } from "./option-row-Dc7BrbK8.js";
29
- import { S as Ut } from "./skeleton-tTWJpvAq.js";
30
- import { E as Nn } from "./empty-state-DwJ5YNzz.js";
31
- import { S as ds } from "./stepper-accordion-DDTSOUHc.js";
32
- import { S as ls } from "./stepper-progress-D6H8wQiV.js";
33
- import { S as us } from "./slot-grid-Bb13H9Rl.js";
34
- import { p as Ie } from "./parseISO-DZZ5a-zK.js";
35
- import { C as ps } from "./chevron-down-DWE7GSq9.js";
36
- import { s as ht, f as jt, d as pn } from "./format--x5jypvH.js";
37
- import { x as wn, a as vt, b as Xt, i as ms, s as Dt, m as fs, y as Vt } from "./date-picker-variants-Dt6UbonG.js";
38
- import { s as gs } from "./subDays-DKISP2nE.js";
39
- import { C as hs } from "./chevron-left-B8cOyH-V.js";
40
- import { C as vs } from "./chevron-right-I9AeSxH2.js";
41
- import { c as Me } from "./createLucideIcon-DhHxpK9K.js";
42
- import { M as bs, S as ys } from "./sun-Bj9Mr553.js";
43
- import { S as ks } from "./stethoscope-sZXGC43m.js";
44
- import { H as Ss } from "./heart-pulse-BCppJyN2.js";
45
- import { E as xs } from "./eye-BjhN2nYf.js";
46
- import { B as Is } from "./baby-Dku-Xvg9.js";
47
- import { S as Ns } from "./scan-line-CNseIHQ0.js";
48
- import { A as ws } from "./astroid-BN4f5VXU.js";
49
- import { C as Cs } from "./clipboard-check-BeAGxDVT.js";
50
- /**
51
- * @license lucide-react v1.22.0 - ISC
52
- *
53
- * This source code is licensed under the ISC license.
54
- * See the LICENSE file in the root directory of this source tree.
55
- */
56
- const As = [
57
- [
58
- "path",
59
- {
60
- 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",
61
- key: "169zse"
62
- }
63
- ]
64
- ], Ts = Me("activity", As);
65
- /**
66
- * @license lucide-react v1.22.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */
71
- const Os = [
72
- [
73
- "path",
74
- {
75
- 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",
76
- key: "w610uw"
77
- }
78
- ]
79
- ], Ds = Me("bone", Os);
80
- /**
81
- * @license lucide-react v1.22.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */
86
- const Ms = [
87
- ["path", { d: "M12 18V5", key: "adv99a" }],
88
- ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
89
- ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
90
- ["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
91
- ["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
92
- ["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
93
- ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
94
- ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
95
- ], Es = Me("brain", Ms);
96
- /**
97
- * @license lucide-react v1.22.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */
102
- const Fs = [
103
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
104
- ["path", { d: "M16 2v4", key: "4m81vk" }],
105
- ["path", { d: "M3 10h18", key: "8toen8" }],
106
- ["path", { d: "M8 2v4", key: "1cmpym" }],
107
- ["path", { d: "M17 14h-6", key: "bkmgh3" }],
108
- ["path", { d: "M13 18H7", key: "bb0bb7" }],
109
- ["path", { d: "M7 14h.01", key: "1qa3f1" }],
110
- ["path", { d: "M17 18h.01", key: "1bdyru" }]
111
- ], Bs = Me("calendar-range", Fs);
112
- /**
113
- * @license lucide-react v1.22.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */
118
- const Ls = [
119
- ["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" }],
120
- ["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
121
- ], Rs = Me("ear", Ls);
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 _s = [
129
- ["path", { d: "M6 18h8", key: "1borvv" }],
130
- ["path", { d: "M3 22h18", key: "8prr45" }],
131
- ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
132
- ["path", { d: "M9 14h2", key: "197e7h" }],
133
- ["path", { d: "M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z", key: "1bmzmy" }],
134
- ["path", { d: "M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3", key: "1drr47" }]
135
- ], Ps = Me("microscope", _s);
136
- /**
137
- * @license lucide-react v1.22.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */
142
- const Vs = [
143
- [
144
- "path",
145
- { 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" }
146
- ],
147
- ["path", { d: "m8.5 8.5 7 7", key: "rvfmvr" }]
148
- ], $s = Me("pill", Vs);
149
- /**
150
- * @license lucide-react v1.22.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- */
155
- const qs = [
156
- ["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
157
- ["path", { d: "M8.12 8.12 12 12", key: "1alkpv" }],
158
- ["path", { d: "M20 4 8.12 15.88", key: "xgtan2" }],
159
- ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
160
- ["path", { d: "M14.8 14.8 20 20", key: "ptml3r" }]
161
- ], Ks = Me("scissors", qs);
162
- /**
163
- * @license lucide-react v1.22.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */
168
- const zs = [
169
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
170
- ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
171
- ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
172
- ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
173
- ], js = Me("smile", zs);
174
- /**
175
- * @license lucide-react v1.22.0 - ISC
176
- *
177
- * This source code is licensed under the ISC license.
178
- * See the LICENSE file in the root directory of this source tree.
179
- */
180
- const Us = [
181
- ["path", { d: "M12 10V2", key: "16sf7g" }],
182
- ["path", { d: "m4.93 10.93 1.41 1.41", key: "2a7f42" }],
183
- ["path", { d: "M2 18h2", key: "j10viu" }],
184
- ["path", { d: "M20 18h2", key: "wocana" }],
185
- ["path", { d: "m19.07 10.93-1.41 1.41", key: "15zs5n" }],
186
- ["path", { d: "M22 22H2", key: "19qnx5" }],
187
- ["path", { d: "m16 6-4 4-4-4", key: "6wukr" }],
188
- ["path", { d: "M16 18a4 4 0 0 0-8 0", key: "1lzouq" }]
189
- ], Gs = Me("sunset", Us);
190
- /**
191
- * @license lucide-react v1.22.0 - ISC
192
- *
193
- * This source code is licensed under the ISC license.
194
- * See the LICENSE file in the root directory of this source tree.
195
- */
196
- const Hs = [
197
- ["path", { d: "m18 2 4 4", key: "22kx64" }],
198
- ["path", { d: "m17 7 3-3", key: "1w1zoj" }],
199
- ["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" }],
200
- ["path", { d: "m9 11 4 4", key: "rovt3i" }],
201
- ["path", { d: "m5 19-3 3", key: "59f2uf" }],
202
- ["path", { d: "m14 4 6 6", key: "yqp9t2" }]
203
- ], mn = Me("syringe", Hs);
204
- function Js(e, t, s) {
205
- return wn(e, -1, s);
206
- }
207
- const Ws = {
208
- id: "booking",
209
- // `view_change` removed (0.69): the layout `variant` is a fixed prop — the
210
- // handle exposes only `getVariant` (state), no action mutates it. The flow's
211
- // only navigation is step-to-step (`goto_step` → `navigate`).
212
- capabilities: ["navigate"],
213
- state: {
214
- variant: {
215
- type: "string",
216
- descriptionKey: "ui.agent.booking.state.variant",
217
- description: "Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.",
218
- read: (e) => e.getVariant()
219
- },
220
- currentStep: {
221
- type: "number",
222
- descriptionKey: "ui.agent.booking.state.currentStep",
223
- description: "The step the flow is on: 1 insurance, 2 specialty, 3 service, 4 provider, 5 date, 6 time, 7 patient details, payment or optional SMS code verification, 8 confirmation after all required steps succeed. Read this back after `goto_step` to see where the clamp landed.",
224
- read: (e) => e.getCurrentStep()
225
- }
226
- },
227
- actions: {
228
- reset: {
229
- // destructive: clears the whole in-progress booking value (patient
230
- // identity, contact, slot choice) — irreversibly loses user input.
231
- safety: "destructive",
232
- idempotent: !0,
233
- descriptionKey: "ui.agent.booking.actions.reset",
234
- description: "Clear the booking value back to an empty state. Use to abandon an in-progress flow.",
235
- errors: [
236
- "Refused while a payment session is open (step 7): the consumer must cancel the hold first.",
237
- "Refused while SMS code verification is pending (step 7): the submitted booking remains active. The host owns cancellation."
238
- ],
239
- invoke: (e) => {
240
- e.reset();
241
- }
242
- },
243
- goto_step: {
244
- safety: "read",
245
- argsType: "{ step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }",
246
- argsSchema: {
247
- type: "object",
248
- properties: {
249
- step: {
250
- type: "integer",
251
- enum: [1, 2, 3, 4, 5, 6, 7],
252
- description: "Target step (1-7)."
253
- }
254
- },
255
- required: ["step"]
256
- },
257
- idempotent: !0,
258
- descriptionKey: "ui.agent.booking.actions.gotoStep",
259
- 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.",
260
- errors: [
261
- "Navigation stays on step 7 while payment or SMS code verification is pending.",
262
- "Requested step is not yet reachable — clamped to the first incomplete step.",
263
- "Requested step is hidden for this practice (e.g. insurance outside Germany, or provider choice turned off) — clamped to the first incomplete step."
264
- ],
265
- examples: [{ args: { step: 1 }, note: "Return to the first step." }],
266
- invoke: (e, t) => {
267
- e.goToStep(t.step);
268
- }
269
- }
270
- },
271
- domHooks: {
272
- root: {
273
- attr: "data-component",
274
- value: "booking",
275
- description: 'Marks the Booking root region. The host prop hideEmail (boolean, default false) hides the email field, skips its validation and omits email from submission. The host prop emailOptional (boolean, default false) keeps email visible and optional unless used for confirmation. Email is marked and validated as required when selected in the channel picker or singleConfirmationChannel radio, or when the effective confirmation channel is email. With a hidden picker, the form and success screen use the sole enabled channel, or email when multiple channels are enabled. This includes payment and blocked-payment flows, which omit stored selections from submission. Omitting confirmationChannels also defaults to email. Selecting SMS without email makes the field optional again. The optional/required marker updates visually when the channel changes, with no announcement of that change. Validation updates immediately using the existing email error. With emailOptional, surrounding spaces are trimmed before validation, even when email is required for confirmation. Optional blank values are omitted from submission; filled values are sent trimmed. hideEmail takes precedence over emailOptional. Neither prop changes confirmation channels; pair with confirmationChannels ["sms"] for SMS-only confirmation with no channel picker. The optional codeStep prop adds SMS verification after submission and payment; the step remains 7 until verification succeeds, then becomes 8. Patient contact details and verification codes are never exposed through this adapter.'
276
- },
277
- instanceId: {
278
- attr: "data-component-id",
279
- sourceProp: "id",
280
- description: "Sourced from the id prop."
281
- }
282
- }
283
- }, nn = [
284
- "email",
285
- "whatsapp",
286
- "sms"
287
- ], _e = "all", Ys = "de";
288
- function Zs(e) {
289
- const t = e.lockedOperatorId;
290
- return [...t ? e.operatorsByService ? e.specialties.filter(
291
- (i) => e.services.some(
292
- (r) => {
293
- var a;
294
- return r.specialtyId === i.id && ((a = r.operatorIds) == null ? void 0 : a.includes(t));
295
- }
296
- )
297
- ) : e.specialties.filter((i) => {
298
- var r;
299
- return (r = i.operatorIds) == null ? void 0 : r.includes(t);
300
- }) : e.specialties].sort((i, r) => {
301
- const a = i.sequenceNumber ?? Number.POSITIVE_INFINITY, c = r.sequenceNumber ?? Number.POSITIVE_INFINITY;
302
- return a - c;
303
- });
304
- }
305
- function Qs(e) {
306
- let t = e.services;
307
- if (e.lockedOperatorId && (t = t.filter(
308
- (i) => {
309
- var r;
310
- return (r = i.operatorIds) == null ? void 0 : r.includes(e.lockedOperatorId);
311
- }
312
- )), e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) {
313
- const i = nt(e.value);
314
- i.length > 0 && (t = t.filter(
315
- (r) => r.specialtyId !== void 0 && i.includes(r.specialtyId)
316
- ));
317
- }
318
- return t;
319
- }
320
- function Xs(e) {
321
- const t = e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties, s = Ge(e.value);
322
- if ((!t || e.operatorsByService) && s.length > 0)
323
- return e.operators.filter(
324
- (i) => {
325
- var r;
326
- return (r = i.appointmentBookingReasonIds) == null ? void 0 : r.some((a) => s.includes(a));
327
- }
328
- );
329
- if (t) {
330
- const i = nt(e.value);
331
- if (i.length > 0)
332
- return e.operators.filter(
333
- (r) => {
334
- var a;
335
- return (a = r.specialtyIds) == null ? void 0 : a.some((c) => i.includes(c));
336
- }
337
- );
338
- }
339
- return [];
340
- }
341
- function ei(e, t) {
342
- const s = e.country === Ys, i = !s || e.value.insuranceType !== void 0, a = (e.useSpecialties === void 0 ? e.specialties.length > 0 : e.useSpecialties) && i, c = nt(e.value).length > 0, u = !a || c, m = Ge(e.value).length > 0, v = !u || m, b = t.operators, g = !!e.allowOperatorSelection && v && m && !e.lockedOperatorId && b.length > 1, o = v && m, I = (!o || e.value.date !== void 0) && e.value.date !== void 0, B = (!I || e.value.slotKey !== void 0) && e.value.slotKey !== void 0, N = m && b.length === 0;
343
- return {
344
- insurance: s,
345
- specialty: a,
346
- service: u,
347
- operator: g,
348
- date: o,
349
- slot: I,
350
- details: B,
351
- onboardingIncomplete: N
352
- };
353
- }
354
- function ti(e, t) {
355
- const s = [];
356
- return t.insurance && s.push(1), t.specialty && s.push(2), s.push(3), t.operator && s.push(4), s.push(5), s.push(6), s.push(7), {
357
- currentStep: s.find(
358
- (r) => !Ue(r, e.value)
359
- ) ?? 7,
360
- visibleSteps: s
361
- };
362
- }
363
- function Ue(e, t) {
364
- switch (e) {
365
- case 1:
366
- return t.insuranceType !== void 0;
367
- // 0.34.0: array-or-single — satisfied when EITHER form is present.
368
- case 2:
369
- return nt(t).length > 0;
370
- case 3:
371
- return Ge(t).length > 0;
372
- // Always satisfied, like its gate: "no preference" is a valid answer,
373
- // whether it is the `'all'` sentinel or an empty multi-select.
374
- case 4:
375
- return !0;
376
- case 5:
377
- return t.date !== void 0;
378
- case 6:
379
- return t.slotKey !== void 0;
380
- // Details fulfilment is owned by the form's own validation.
381
- case 7:
382
- return !1;
383
- }
384
- }
385
- function ni(e) {
386
- const t = {
387
- specialties: Zs(e),
388
- services: Qs(e),
389
- operators: Xs(e)
390
- }, s = ei(e, t), { currentStep: i, visibleSteps: r } = ti(e, s);
391
- let a;
392
- if (e.value.date && e.value.slotKey) {
393
- const v = e.availableSlots[e.value.date];
394
- v && (a = v.find((b) => b.key === e.value.slotKey));
395
- }
396
- const c = Ge(e.value), p = c.length > 0 ? e.services.find((v) => v.id === c[0]) : void 0, u = nt(e.value).length > 0, m = c.length > 0 && e.value.date !== void 0 && e.value.slotKey !== void 0 && (!s.insurance || e.value.insuranceType !== void 0) && (!s.specialty || u);
397
- return {
398
- gates: s,
399
- filtered: t,
400
- currentStep: i,
401
- totalSteps: r.length,
402
- visibleSteps: r,
403
- isReadyToSubmit: m,
404
- durationMin: p == null ? void 0 : p.durationMin,
405
- selectedSlot: a
406
- };
407
- }
408
- function Cn(e, t) {
409
- return {
410
- ...e,
411
- insuranceType: t,
412
- specialtyId: void 0,
413
- serviceId: void 0,
414
- operatorId: void 0,
415
- date: void 0,
416
- slotKey: void 0,
417
- details: void 0
418
- };
419
- }
420
- function An(e, t) {
421
- return {
422
- ...e,
423
- specialtyId: t,
424
- specialtyIds: void 0,
425
- serviceId: void 0,
426
- serviceIds: void 0,
427
- operatorId: void 0,
428
- operatorIds: void 0,
429
- date: void 0,
430
- slotKey: void 0,
431
- details: void 0
432
- };
433
- }
434
- function Tn(e, t) {
435
- return {
436
- ...e,
437
- specialtyId: void 0,
438
- specialtyIds: t,
439
- serviceId: void 0,
440
- serviceIds: void 0,
441
- operatorId: void 0,
442
- operatorIds: void 0,
443
- date: void 0,
444
- slotKey: void 0,
445
- details: void 0
446
- };
447
- }
448
- function On(e, t) {
449
- return {
450
- ...e,
451
- serviceId: t,
452
- serviceIds: void 0,
453
- // Default the operator to the "All operators" sentinel so a patient
454
- // who doesn't care about picking lands on a satisfied step 4 without
455
- // any further input.
456
- operatorId: t ? _e : void 0,
457
- operatorIds: void 0,
458
- date: void 0,
459
- slotKey: void 0,
460
- details: void 0
461
- };
462
- }
463
- function Dn(e, t) {
464
- const s = !!t && t.length > 0;
465
- return {
466
- ...e,
467
- serviceId: void 0,
468
- serviceIds: t,
469
- operatorId: s ? _e : void 0,
470
- operatorIds: void 0,
471
- date: void 0,
472
- slotKey: void 0,
473
- details: void 0
474
- };
475
- }
476
- function Mn(e, t) {
477
- return {
478
- ...e,
479
- operatorId: t,
480
- operatorIds: void 0,
481
- date: void 0,
482
- slotKey: void 0,
483
- details: void 0
484
- };
485
- }
486
- function En(e, t) {
487
- return {
488
- ...e,
489
- operatorId: void 0,
490
- operatorIds: t,
491
- date: void 0,
492
- slotKey: void 0,
493
- details: void 0
494
- };
495
- }
496
- function nt(e) {
497
- return e.specialtyIds && e.specialtyIds.length > 0 ? e.specialtyIds : e.specialtyId ? [e.specialtyId] : [];
498
- }
499
- function Ge(e) {
500
- return e.serviceIds && e.serviceIds.length > 0 ? e.serviceIds : e.serviceId ? [e.serviceId] : [];
501
- }
502
- function sn(e) {
503
- return e.operatorIds && e.operatorIds.length > 0 ? e.operatorIds : e.operatorId ? [e.operatorId] : [];
504
- }
505
- function Jt(e, t) {
506
- return {
507
- ...e,
508
- date: t,
509
- slotKey: void 0
510
- // Keep details — date/slot changes shouldn't wipe the patient form
511
- // since the user has already filled some fields.
512
- };
513
- }
514
- function Fn(e, t) {
515
- return {
516
- ...e,
517
- slotKey: t
518
- };
519
- }
520
- function si(e, t) {
521
- let s = e;
522
- if (t.lockedOperatorId && s.operatorId !== t.lockedOperatorId && (s = { ...s, operatorId: t.lockedOperatorId }), (t.useSpecialties === void 0 ? t.specialties.length > 0 : t.useSpecialties) && t.specialties.length === 1 && s.specialtyId === void 0 && s.specialtyIds === void 0 && (s = { ...s, specialtyId: t.specialties[0].id }), t.autoSelectSingleService) {
523
- const r = nt(s), a = r.length > 0 ? t.services.filter(
524
- (c) => c.specialtyId && r.includes(c.specialtyId)
525
- ) : t.services;
526
- a.length === 1 && s.serviceId === void 0 && s.serviceIds === void 0 && (s = { ...s, serviceId: a[0].id }, s.operatorId === void 0 && s.operatorIds === void 0 && (s = { ...s, operatorId: _e }));
527
- }
528
- return s;
529
- }
530
- function Bn(e) {
531
- if (e.operatorId && e.operatorId !== _e)
532
- return e.operatorId;
533
- }
534
- function ii(e) {
535
- if (!e) return !1;
536
- const t = e.trim();
537
- return /^\+?\d[\d\s\-()]{6,}$/.test(t);
538
- }
539
- function an(e) {
540
- const t = e && e.length > 0 ? e : ["email"], s = new Set(t);
541
- return nn.filter((i) => s.has(i));
542
- }
543
- function Ln(e, t) {
544
- return t ?? (e.length === 1 ? e : ["email"]);
545
- }
546
- function ri(e, t, s) {
547
- const i = an(e), r = new Set(i);
548
- if (s)
549
- return nn.filter(
550
- (m) => s.includes(m) && r.has(m)
551
- );
552
- const a = [];
553
- r.has("email") && a.push("email");
554
- const c = ii(t), p = r.has("whatsapp");
555
- p && c && a.push("whatsapp"), !p && r.has("sms") && a.push("sms");
556
- const u = new Set(a);
557
- return nn.filter((m) => u.has(m));
558
- }
559
- const oi = /https?:\/\/(?:(?![.,;:!?'»›]https?:\/\/)[^\s<>"\u060C\u061B\u061F\u06D4\u2000-\u206F\u3000-\u303F\uFF00-\uFFEF])+/gi, ai = /* @__PURE__ */ new Set([
560
- ".",
561
- ",",
562
- ";",
563
- ":",
564
- "!",
565
- "?",
566
- "'",
567
- "»",
568
- "›"
569
- ]), ci = { ")": "(", "]": "[", "}": "{" }, fn = (e, t) => e.split(t).length - 1;
570
- function di(e) {
571
- const t = {};
572
- for (const [i, r] of Object.entries(ci))
573
- t[i] = fn(e, i) - fn(e, r);
574
- let s = e.length;
575
- for (; s > 0; ) {
576
- const i = e[s - 1];
577
- if (ai.has(i))
578
- s -= 1;
579
- else if (i in t && t[i] > 0)
580
- t[i] -= 1, s -= 1;
581
- else
582
- break;
583
- }
584
- return e.slice(0, s);
585
- }
586
- const li = /[\u0600-\u06FF\u3040-\u30FF\u3400-\u9FFF\uAC00-\uD7AF]/, ui = /[A-Za-z0-9]/;
587
- function pi(e) {
588
- const t = e.search(li);
589
- return t > 0 && ui.test(e[t - 1]) ? e.slice(0, t) : e;
590
- }
591
- function mi(e) {
592
- try {
593
- const { protocol: t, hostname: s } = new URL(e);
594
- return (t === "http:" || t === "https:") && s !== "";
595
- } catch {
596
- return !1;
597
- }
598
- }
599
- function fi(e) {
600
- const t = [];
601
- let s = 0;
602
- const i = (r) => {
603
- if (r === "") return;
604
- const a = t[t.length - 1];
605
- (a == null ? void 0 : a.kind) === "text" ? a.text += r : t.push({ kind: "text", text: r });
606
- };
607
- for (const r of e.matchAll(oi)) {
608
- const a = r.index ?? 0, c = di(pi(r[0]));
609
- mi(c) && (i(e.slice(s, a)), t.push({ kind: "link", text: c, href: c }), s = a + c.length);
610
- }
611
- return i(e.slice(s)), t;
612
- }
613
- const gn = 500, gi = /^[A-Z0-9]{16}$/, hi = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, hn = 300, en = "ds:rounded-[var(--radius-sm)] ds:underline ds:text-[var(--foreground)] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]", $t = (e) => e && /^https?:\/\//i.test(e) ? e : void 0, vi = (e, t) => ({
614
- street: (e == null ? void 0 : e.address.line1) ?? "",
615
- city: (e == null ? void 0 : e.address.city) ?? "",
616
- postcode: (e == null ? void 0 : e.address.postalCode) ?? "",
617
- province: (e == null ? void 0 : e.address.state) ?? "",
618
- // The practice's country only until the patient has an address at all.
619
- country: (e ? e.address.country : t).toLowerCase(),
620
- formatted: ""
621
- }), bi = (e, t, s = null) => ({
622
- name: t,
623
- address: {
624
- line1: e.street,
625
- line2: s,
626
- city: e.city,
627
- state: e.province,
628
- postalCode: e.postcode,
629
- country: e.country.toUpperCase()
630
- }
631
- }), yi = Et("ds:flex ds:flex-col ds:border", {
632
- variants: {
633
- noticeStyle: {
634
- plain: "ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-md)] ds:border-[var(--border)] ds:bg-[var(--muted)] ds:p-[var(--spacing-sm)]",
635
- highlighted: "ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-lg)] ds:border-[color-mix(in_srgb,var(--primary)_30%,var(--border))] ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:p-[var(--spacing-md)]"
636
- }
637
- },
638
- defaultVariants: { noticeStyle: "highlighted" }
639
- }), ki = ["it", "ch", "de", "at", "fr", "sm"], z = {
640
- country: "billing.country",
641
- street: "billing.street",
642
- city: "billing.city",
643
- postcode: "billing.postcode",
644
- province: "billing.province"
645
- }, Rn = /^\d{5}$/, Si = (e) => {
646
- if (!e) return !1;
647
- const { line1: t, city: s, postalCode: i, country: r, state: a } = e.address;
648
- return !t.trim() || !s.trim() || !i.trim() || !r.trim() ? !1 : r.toUpperCase() !== "IT" ? !0 : !!a.trim() && Rn.test(i.trim());
649
- }, xi = (e, t) => {
650
- var s;
651
- return {
652
- name: t,
653
- address: {
654
- line1: e.address.line1.trim(),
655
- line2: ((s = e.address.line2) == null ? void 0 : s.trim()) || null,
656
- city: e.address.city.trim(),
657
- state: e.address.state.trim(),
658
- postalCode: e.address.postalCode.trim(),
659
- country: e.address.country.trim().toUpperCase()
660
- }
661
- };
662
- }, qt = { state: "idle" }, vn = [
663
- "firstName",
664
- "lastName",
665
- "email",
666
- "mobilePhone",
667
- "codiceFiscale",
668
- "dateOfBirth",
669
- "insuranceNumber",
670
- z.country,
671
- z.street,
672
- z.city,
673
- z.postcode,
674
- z.province
675
- ], Ii = /* @__PURE__ */ new Set(), cn = kn(
676
- ({
677
- value: e,
678
- onChange: t,
679
- onSubmit: s,
680
- hideEmail: i = !1,
681
- emailOptional: r = !1,
682
- requireCodiceFiscale: a = !1,
683
- requireDateOfBirth: c = !1,
684
- requireInsuranceNumber: p = !1,
685
- insuranceType: u,
686
- showNote: m = !1,
687
- showReturningPatientFlag: v = !1,
688
- privacyPolicyUrl: b,
689
- termsUrl: g,
690
- practiceConsent: o,
691
- payment: f,
692
- paymentTermsUrl: I,
693
- paymentBlocked: y = !1,
694
- billingInDetails: B = !1,
695
- paymentNoticeStyle: N = "highlighted",
696
- criticalInformationToAccept: x,
697
- validateCodiceFiscale: S,
698
- validateInsuranceNumber: O,
699
- submitting: T = !1,
700
- summarySlot: F,
701
- defaultPhoneCountry: l,
702
- confirmationChannels: w,
703
- defaultConfirmationChannels: D,
704
- singleConfirmationChannel: V = !1,
705
- submitError: j
706
- }, Z) => {
707
- var C, L, P, Q, ae;
708
- const { t: h, i18n: ee } = Y("ui"), H = bt(), Pe = E(null), M = Ne(
709
- (d) => {
710
- Pe.current = d, typeof Z == "function" ? Z(d) : Z && (Z.current = d);
711
- },
712
- [Z]
713
- ), [J, we] = G(0);
714
- K(() => {
715
- var A;
716
- if (J === 0) return;
717
- const d = (A = Pe.current) == null ? void 0 : A.querySelectorAll(
718
- '[aria-invalid="true"], [role="checkbox"][aria-required="true"][aria-checked="false"], [data-unanswered] [role="checkbox"]'
719
- );
720
- for (const te of d ?? [])
721
- if (te.focus(), document.activeElement === te) return;
722
- }, [J]);
723
- const fe = E(!1), [W, Ve] = G(!1), [ct, ge] = G(!1), se = T || W, [ce, Ce] = G(qt), [Ae, Ee] = G(qt), [re, Fe] = G({}), de = Ne(
724
- (d) => Fe((A) => ({ ...A, [d]: !0 })),
725
- []
726
- ), [he, Te] = G(Ii), $e = E(null), He = E(
727
- null
728
- );
729
- K(
730
- () => () => {
731
- $e.current && clearTimeout($e.current), He.current && clearTimeout(He.current);
732
- },
733
- []
734
- );
735
- const q = Ne(
736
- (d) => {
737
- ge(!1), t({ ...e, ...d });
738
- },
739
- [e, t]
740
- ), qe = f ? JSON.stringify([
741
- f.serviceId,
742
- f.kind,
743
- f.amountCents,
744
- f.currencyCode,
745
- I
746
- ]) : void 0, [st, Ft] = G(
747
- () => e.paymentAccepted ? qe : void 0
748
- ), dt = E(qe), lt = !!(f && e.paymentAccepted && st === qe);
749
- K(() => {
750
- dt.current !== qe && (dt.current = qe, Ft(void 0), e.paymentAccepted !== void 0 && q({ paymentAccepted: f ? !1 : void 0 }));
751
- }, [qe, f, q, e.paymentAccepted]);
752
- const ut = typeof (o == null ? void 0 : o.label) == "string" && o.label.trim() !== "", Be = o && ut ? JSON.stringify([
753
- o.label,
754
- o.url ?? null,
755
- o.required
756
- ]) : void 0, [le, Bt] = G(
757
- () => e.practiceConsentAccepted ? Be : void 0
758
- ), ve = E(Be), Je = !!(Be !== void 0 && e.practiceConsentAccepted && le === Be);
759
- K(() => {
760
- ve.current !== Be && (ve.current = Be, Bt(void 0), e.practiceConsentAccepted !== void 0 && q({ practiceConsentAccepted: void 0 }));
761
- }, [Be, q, e.practiceConsentAccepted]);
762
- const ke = f ? Gt(f.amountCents, f.currencyCode, ee.language) : "", We = $t(I), _ = B && !!f && !y, Se = a, pt = (l || "it").toLowerCase(), kt = !_ || Si(e.billing), oe = vi(e.billing, pt), xe = oe.country === "it", St = E(null), Ye = E(
763
- null
764
- ), ue = (C = e.billing) == null ? void 0 : C.address.line1.trim(), it = ((P = (L = e.billing) == null ? void 0 : L.address.line2) == null ? void 0 : P.trim()) || null;
765
- K(() => {
766
- var d;
767
- ue !== void 0 && it ? Ye.current = { street: ue, line2: it } : (ue === void 0 || ue === ((d = Ye.current) == null ? void 0 : d.street)) && (Ye.current = null);
768
- }, [ue, it]);
769
- const Ze = (d) => (
770
- // Nothing for a block not shown, nor for a province outside Italy.
771
- !_ || !re[z[d]] || d === "province" && !xe ? void 0 : oe[d].trim() ? (
772
- // The one format the block itself checks: an Italian CAP.
773
- d === "postcode" && xe && !Rn.test(oe.postcode.trim()) ? h("inputs.postalCode.invalid") : void 0
774
- ) : h("booking.details.fieldRequired")
775
- ), Yt = Ne(
776
- () => Fe(
777
- (d) => d[z.province] ? d : {
778
- ...d,
779
- codiceFiscale: !0,
780
- ...Object.fromEntries(
781
- Object.values(z).map((A) => [A, !0])
782
- )
783
- }
784
- ),
785
- []
786
- ), Le = R(
787
- () => an(w),
788
- [w]
789
- ), be = !f && !y && Le.length >= 2, rt = E(!1);
790
- K(() => {
791
- if (f || y) return;
792
- if (!be) {
793
- e.confirmationChannels !== void 0 && q({ confirmationChannels: void 0 });
794
- return;
795
- }
796
- if (e.confirmationChannels !== void 0) {
797
- rt.current = !0, V && e.confirmationChannels.length > 1 && q({
798
- confirmationChannels: e.confirmationChannels.slice(0, 1)
799
- });
800
- return;
801
- }
802
- const d = V ? [
803
- (D == null ? void 0 : D.find(
804
- (A) => Le.includes(A)
805
- )) ?? Le[0]
806
- ] : ri(
807
- Le,
808
- e.mobilePhone,
809
- D
810
- );
811
- rt.current = !0, q({ confirmationChannels: d });
812
- }, [
813
- be,
814
- f,
815
- y,
816
- Le,
817
- e.mobilePhone,
818
- D,
819
- V
820
- ]);
821
- const $ = R(
822
- () => e.confirmationChannels ?? [],
823
- [e.confirmationChannels]
824
- ), U = be && $.length === 0, Lt = Ln(
825
- Le,
826
- be ? $ : void 0
827
- ), ot = !r || Lt.includes("email"), xt = E(S), It = E(O);
828
- K(() => {
829
- xt.current = S, It.current = O;
830
- }, [S, O]);
831
- const Nt = !!S, wt = !!O;
832
- K(() => {
833
- const d = e.codiceFiscale;
834
- if (!Se || !Nt || !d) {
835
- Ce(qt);
836
- return;
837
- }
838
- if (!gi.test(d)) {
839
- Ce({
840
- state: "invalid",
841
- hint: h("booking.details.codiceFiscale.invalidFormat")
842
- });
843
- return;
844
- }
845
- Ce({ state: "pending" });
846
- let A = !0;
847
- return $e.current && clearTimeout($e.current), $e.current = setTimeout(async () => {
848
- try {
849
- const te = xt.current;
850
- if (!te) return;
851
- const ze = await te(d);
852
- A && Ce({
853
- state: ze.valid ? "valid" : "invalid",
854
- hint: ze.hint,
855
- value: d
856
- });
857
- } catch {
858
- A && Ce({
859
- state: "invalid",
860
- hint: h("booking.details.codiceFiscale.unavailable"),
861
- value: d
862
- });
863
- }
864
- }, hn), () => {
865
- A = !1, $e.current && clearTimeout($e.current);
866
- };
867
- }, [Se, Nt, e.codiceFiscale, h]);
868
- const Qe = p && u === "public";
869
- K(() => {
870
- const d = e.insuranceNumber;
871
- if (!Qe || !wt || !d) {
872
- Ee(qt);
873
- return;
874
- }
875
- Ee({ state: "pending" }), He.current && clearTimeout(He.current), He.current = setTimeout(() => {
876
- const A = It.current;
877
- A && A(d).then(
878
- (te) => Ee(
879
- te.valid ? { state: "valid" } : { state: "invalid", hint: te.hint }
880
- )
881
- ).catch(
882
- () => Ee({
883
- state: "invalid",
884
- hint: h("booking.details.insuranceNumber.unavailable")
885
- })
886
- );
887
- }, hn);
888
- }, [Qe, wt, e.insuranceNumber, h]);
889
- const Ke = R(() => {
890
- var A;
891
- if (i) return !0;
892
- const d = r ? (A = e.email) == null ? void 0 : A.trim() : e.email;
893
- return !ot && !d ? !0 : !!(d && hi.test(d));
894
- }, [i, r, ot, e.email]), mt = R(
895
- () => !!(e.mobilePhone && e.mobilePhone.length >= 6),
896
- [e.mobilePhone]
897
- ), Xe = R(() => {
898
- var d, A;
899
- return !(!((d = e.firstName) != null && d.trim()) || !((A = e.lastName) != null && A.trim()) || !Ke || !mt || Se && (ce.state !== "valid" || ce.value !== e.codiceFiscale) || !kt || c && !e.dateOfBirth || Qe && Ae.state !== "valid");
900
- }, [
901
- e.firstName,
902
- e.lastName,
903
- Ke,
904
- mt,
905
- Se,
906
- kt,
907
- ce.state,
908
- ce.value,
909
- e.codiceFiscale,
910
- c,
911
- e.dateOfBirth,
912
- Qe,
913
- Ae.state
914
- ]), ft = x != null && x.trim() ? x : void 0, Rt = ft !== void 0, Oe = !Rt || !!e.criticalInformationAccepted, Zt = !ut || !(o != null && o.required) || Je, Qt = !!(e.privacyConsent && e.termsConsent && Oe && Zt), Ct = !be || $.length > 0, Re = Xe && Qt && Ct && (!f || lt) && !y && !se, ye = !Re && !se && !y, et = `${H}-submit-hint`, ie = {
915
- firstName: re.firstName && !((Q = e.firstName) != null && Q.trim()) ? h("booking.details.firstName.required") : void 0,
916
- lastName: re.lastName && !((ae = e.lastName) != null && ae.trim()) ? h("booking.details.lastName.required") : void 0,
917
- email: !i && re.email && !Ke ? h("booking.details.email.invalid") : void 0,
918
- mobilePhone: re.mobilePhone && !mt ? h("booking.details.mobilePhone.invalid") : void 0,
919
- codiceFiscale: re.codiceFiscale && ce.state === "invalid" ? ce.hint ?? h("booking.details.codiceFiscale.invalid") : re.codiceFiscale && !e.codiceFiscale ? h("booking.details.fieldRequired") : void 0,
920
- dateOfBirth: re.dateOfBirth && !e.dateOfBirth ? h("booking.details.dateOfBirth.required") : void 0,
921
- insuranceNumber: re.insuranceNumber && Ae.state === "invalid" ? Ae.hint ?? h("booking.details.insuranceNumber.invalid") : void 0,
922
- [z.country]: Ze("country"),
923
- [z.street]: Ze("street"),
924
- [z.city]: Ze("city"),
925
- [z.postcode]: Ze("postcode"),
926
- [z.province]: Ze("province")
927
- }, At = vn.filter(
928
- (d) => he.has(d) && ie[d] !== void 0
929
- );
930
- At.length !== he.size && Te(new Set(At));
931
- const pe = (d) => !he.has(d), _t = async (d) => {
932
- var te;
933
- if (d.preventDefault(), !se && !fe.current && !Re && Te(
934
- new Set(
935
- vn.filter(
936
- (ze) => he.has(ze) || !ie[ze]
937
- )
938
- )
939
- ), Fe({
940
- firstName: !0,
941
- lastName: !0,
942
- email: !i,
943
- mobilePhone: !0,
944
- codiceFiscale: !0,
945
- dateOfBirth: !0,
946
- insuranceNumber: !0,
947
- ...Object.fromEntries(
948
- Object.values(z).map((ze) => [ze, !0])
949
- )
950
- }), se || fe.current) return;
951
- if (!Re) {
952
- we((ze) => ze + 1);
953
- return;
954
- }
955
- const A = {
956
- firstName: e.firstName.trim(),
957
- lastName: e.lastName.trim(),
958
- ...!i && ((te = e.email) != null && te.trim()) ? { email: e.email.trim() } : {},
959
- mobilePhone: e.mobilePhone,
960
- privacyConsent: !0,
961
- termsConsent: !0,
962
- // Only present when the service carried text to accept — a
963
- // reason without it leaves the key out of the payload entirely.
964
- ...Rt ? { criticalInformationAccepted: !0 } : {},
965
- // Sent whenever the practice's box is shown, ticked or not, so the
966
- // server can record the answer; left out when there is no box.
967
- ...ut ? { practiceConsentAccepted: Je } : {},
968
- ...f ? { paymentAccepted: !0 } : {},
969
- codiceFiscale: e.codiceFiscale,
970
- dateOfBirth: e.dateOfBirth,
971
- insuranceNumber: e.insuranceNumber,
972
- note: e.note,
973
- returningPatient: e.returningPatient,
974
- // Only include when the picker was visible; otherwise the single
975
- // implicit channel is inferred backend-side from the practice
976
- // config.
977
- confirmationChannels: be ? $ : void 0,
978
- ..._ && e.billing ? {
979
- billing: xi(
980
- e.billing,
981
- `${e.firstName.trim()} ${e.lastName.trim()}`
982
- )
983
- } : {}
984
- };
985
- fe.current = !0, Ve(!0), ge(!1);
986
- try {
987
- await s(A);
988
- } catch {
989
- ge(!0);
990
- } finally {
991
- fe.current = !1, Ve(!1);
992
- }
993
- }, Tt = /* @__PURE__ */ n(
994
- je,
995
- {
996
- label: h("booking.details.codiceFiscale.label"),
997
- required: !0,
998
- description: ce.state === "pending" ? h("booking.details.codiceFiscale.checking") : h("booking.details.codiceFiscale.helper"),
999
- error: ie.codiceFiscale,
1000
- announceError: pe("codiceFiscale"),
1001
- children: /* @__PURE__ */ n(
1002
- Pt,
1003
- {
1004
- value: e.codiceFiscale ?? "",
1005
- maxLength: 16,
1006
- onChange: (d) => q({
1007
- codiceFiscale: d.target.value.slice(0, 16).toUpperCase()
1008
- }),
1009
- onBlur: () => de("codiceFiscale")
1010
- }
1011
- )
1012
- }
1013
- ), Ot = (d, A) => {
1014
- const te = $t(A);
1015
- return te ? /* @__PURE__ */ n(
1016
- Sn,
1017
- {
1018
- ns: "ui",
1019
- i18nKey: d,
1020
- components: {
1021
- // The `<Trans>` runtime injects link text from the i18n
1022
- // string. The anchor renders empty at static-analysis time,
1023
- // so `jsx-a11y/anchor-has-content` would false-flag — silence
1024
- // it; the runtime content is the localised policy / terms
1025
- // label.
1026
- policyLink: (
1027
- // eslint-disable-next-line jsx-a11y/anchor-has-content
1028
- /* @__PURE__ */ n(
1029
- "a",
1030
- {
1031
- href: te,
1032
- target: "_blank",
1033
- rel: "noopener noreferrer",
1034
- className: en
1035
- }
1036
- )
1037
- )
1038
- }
1039
- }
1040
- ) : h(d);
1041
- };
1042
- return /* @__PURE__ */ k(
1043
- "form",
1044
- {
1045
- ref: M,
1046
- id: H,
1047
- noValidate: !0,
1048
- onSubmit: _t,
1049
- onFocus: (d) => {
1050
- const A = St.current;
1051
- !A || !d.currentTarget.contains(d.target) || !A.contains(d.target) && A.compareDocumentPosition(d.target) & Node.DOCUMENT_POSITION_FOLLOWING && Yt();
1052
- },
1053
- "aria-busy": se || void 0,
1054
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1055
- children: [
1056
- F,
1057
- /* @__PURE__ */ k("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
1058
- /* @__PURE__ */ n(
1059
- je,
1060
- {
1061
- label: h("booking.details.firstName.label"),
1062
- required: !0,
1063
- error: ie.firstName,
1064
- announceError: pe("firstName"),
1065
- children: /* @__PURE__ */ n(
1066
- Pt,
1067
- {
1068
- autoComplete: "given-name",
1069
- value: e.firstName ?? "",
1070
- onChange: (d) => q({ firstName: d.target.value }),
1071
- onBlur: () => de("firstName")
1072
- }
1073
- )
1074
- }
1075
- ),
1076
- /* @__PURE__ */ n(
1077
- je,
1078
- {
1079
- label: h("booking.details.lastName.label"),
1080
- required: !0,
1081
- error: ie.lastName,
1082
- announceError: pe("lastName"),
1083
- children: /* @__PURE__ */ n(
1084
- Pt,
1085
- {
1086
- autoComplete: "family-name",
1087
- value: e.lastName ?? "",
1088
- onChange: (d) => q({ lastName: d.target.value }),
1089
- onBlur: () => de("lastName")
1090
- }
1091
- )
1092
- }
1093
- )
1094
- ] }),
1095
- /* @__PURE__ */ k(
1096
- "div",
1097
- {
1098
- className: `ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)]${i ? "" : " ds:sm:grid-cols-2"}`,
1099
- children: [
1100
- !i && /* @__PURE__ */ n(
1101
- je,
1102
- {
1103
- label: h("booking.details.email.label"),
1104
- ...ot ? { required: !0 } : { optional: !0 },
1105
- error: ie.email,
1106
- announceError: pe("email"),
1107
- children: /* @__PURE__ */ n(
1108
- ns,
1109
- {
1110
- disableBuiltInValidation: r,
1111
- value: e.email ?? "",
1112
- onChange: (d) => q({ email: d.target.value }),
1113
- onBlur: () => de("email")
1114
- }
1115
- )
1116
- }
1117
- ),
1118
- /* @__PURE__ */ n(
1119
- je,
1120
- {
1121
- label: h("booking.details.mobilePhone.label"),
1122
- required: !0,
1123
- error: ie.mobilePhone,
1124
- announceError: pe("mobilePhone"),
1125
- children: /* @__PURE__ */ n(
1126
- ss,
1127
- {
1128
- value: e.mobilePhone ?? "",
1129
- defaultCountry: l == null ? void 0 : l.toUpperCase(),
1130
- onChange: (d) => {
1131
- q({ mobilePhone: d }), de("mobilePhone");
1132
- }
1133
- }
1134
- )
1135
- }
1136
- )
1137
- ]
1138
- }
1139
- ),
1140
- Se && !_ || c ? /* @__PURE__ */ k("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
1141
- Se && !_ ? Tt : null,
1142
- c ? /* @__PURE__ */ n(
1143
- je,
1144
- {
1145
- label: h("booking.details.dateOfBirth.label"),
1146
- required: !0,
1147
- error: ie.dateOfBirth,
1148
- announceError: pe("dateOfBirth"),
1149
- children: /* @__PURE__ */ n(
1150
- ts,
1151
- {
1152
- value: e.dateOfBirth ? new Date(e.dateOfBirth) : void 0,
1153
- onChange: (d) => {
1154
- q({
1155
- dateOfBirth: d ? d.toISOString().slice(0, 10) : void 0
1156
- }), de("dateOfBirth");
1157
- }
1158
- }
1159
- )
1160
- }
1161
- ) : null
1162
- ] }) : null,
1163
- Qe ? /* @__PURE__ */ n(
1164
- je,
1165
- {
1166
- label: h("booking.details.insuranceNumber.label"),
1167
- required: !0,
1168
- description: Ae.state === "pending" ? h("booking.details.insuranceNumber.checking") : void 0,
1169
- error: ie.insuranceNumber,
1170
- announceError: pe("insuranceNumber"),
1171
- children: /* @__PURE__ */ n(
1172
- Pt,
1173
- {
1174
- value: e.insuranceNumber ?? "",
1175
- onChange: (d) => q({ insuranceNumber: d.target.value }),
1176
- onBlur: () => de("insuranceNumber")
1177
- }
1178
- )
1179
- }
1180
- ) : null,
1181
- _ ? /* @__PURE__ */ k(
1182
- "div",
1183
- {
1184
- ref: St,
1185
- "data-component": "booking-billing",
1186
- role: "group",
1187
- "aria-labelledby": `${H}-billing-heading`,
1188
- "aria-describedby": `${H}-billing-intro`,
1189
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-md)] ds:border ds:border-[var(--border)] ds:p-[var(--spacing-sm)]",
1190
- onBlur: (d) => {
1191
- var te;
1192
- const A = (te = d.target.closest("[data-address-field]")) == null ? void 0 : te.getAttribute("data-address-field");
1193
- (A === "street" || A === "city" || A === "postcode") && de(z[A]);
1194
- },
1195
- children: [
1196
- /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
1197
- /* @__PURE__ */ n(
1198
- "h3",
1199
- {
1200
- id: `${H}-billing-heading`,
1201
- className: "type-label ds:m-0 ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
1202
- children: h("booking.details.billing.heading")
1203
- }
1204
- ),
1205
- /* @__PURE__ */ n(
1206
- "p",
1207
- {
1208
- id: `${H}-billing-intro`,
1209
- className: "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]",
1210
- children: h("booking.details.billing.intro")
1211
- }
1212
- )
1213
- ] }),
1214
- Se ? Tt : null,
1215
- /* @__PURE__ */ n(
1216
- rs,
1217
- {
1218
- value: oe,
1219
- onChange: (d) => {
1220
- var A;
1221
- return (
1222
- // The name is set from the patient's own on submit.
1223
- q({
1224
- billing: bi(
1225
- d,
1226
- "",
1227
- // A second line belongs to its street: it goes when the
1228
- // patient writes another, and returns with the first.
1229
- d.street.trim() === ((A = Ye.current) == null ? void 0 : A.street) ? Ye.current.line2 : null
1230
- )
1231
- })
1232
- );
1233
- },
1234
- popularCountries: ki,
1235
- layout: "grid",
1236
- fields: xe ? void 0 : ["street", "city", "postcode"],
1237
- required: xe ? ["country", "street", "city", "postcode", "province"] : ["country", "street", "city", "postcode"],
1238
- errors: {
1239
- country: ie[z.country],
1240
- street: ie[z.street],
1241
- city: ie[z.city],
1242
- postcode: ie[z.postcode],
1243
- province: ie[z.province]
1244
- },
1245
- announceErrors: {
1246
- country: pe(z.country),
1247
- street: pe(z.street),
1248
- city: pe(z.city),
1249
- postcode: pe(z.postcode),
1250
- province: pe(z.province)
1251
- }
1252
- }
1253
- )
1254
- ]
1255
- }
1256
- ) : null,
1257
- m ? /* @__PURE__ */ n(
1258
- je,
1259
- {
1260
- label: h("booking.details.note.label"),
1261
- description: h("booking.details.note.helper", {
1262
- max: gn
1263
- }),
1264
- children: /* @__PURE__ */ n(
1265
- is,
1266
- {
1267
- value: e.note ?? "",
1268
- maxLength: gn,
1269
- rows: 3,
1270
- onChange: (d) => q({ note: d.target.value })
1271
- }
1272
- )
1273
- }
1274
- ) : null,
1275
- v ? /* @__PURE__ */ n(
1276
- gt,
1277
- {
1278
- checked: !!e.returningPatient,
1279
- onCheckedChange: (d) => q({ returningPatient: d === !0 }),
1280
- label: h("booking.details.returningPatient.label")
1281
- }
1282
- ) : null,
1283
- ft !== void 0 ? /* @__PURE__ */ k(
1284
- "div",
1285
- {
1286
- "data-component": "booking-critical-information",
1287
- role: "group",
1288
- "aria-labelledby": `${H}-critical-information-heading`,
1289
- 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)]",
1290
- children: [
1291
- /* @__PURE__ */ n(
1292
- "h3",
1293
- {
1294
- id: `${H}-critical-information-heading`,
1295
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0",
1296
- children: h("booking.details.criticalInformation.heading")
1297
- }
1298
- ),
1299
- /* @__PURE__ */ n(
1300
- "p",
1301
- {
1302
- dir: "auto",
1303
- className: "type-body-sm ds:m-0 ds:whitespace-pre-wrap ds:break-words ds:text-[var(--foreground)]",
1304
- children: fi(ft).map(
1305
- (d, A) => d.kind === "link" ? /* @__PURE__ */ n(
1306
- "a",
1307
- {
1308
- href: d.href,
1309
- target: "_blank",
1310
- rel: "noopener noreferrer",
1311
- dir: "ltr",
1312
- className: en,
1313
- children: d.text
1314
- },
1315
- A
1316
- ) : /* @__PURE__ */ n(Wn, { children: d.text }, A)
1317
- )
1318
- }
1319
- ),
1320
- /* @__PURE__ */ n(
1321
- gt,
1322
- {
1323
- checked: !!e.criticalInformationAccepted,
1324
- onCheckedChange: (d) => q({ criticalInformationAccepted: d === !0 }),
1325
- "aria-required": !0,
1326
- label: /* @__PURE__ */ k(me, { children: [
1327
- h("booking.details.criticalInformation.accept"),
1328
- /* @__PURE__ */ n(
1329
- "span",
1330
- {
1331
- "aria-hidden": "true",
1332
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1333
- children: "*"
1334
- }
1335
- )
1336
- ] })
1337
- }
1338
- )
1339
- ]
1340
- }
1341
- ) : null,
1342
- f ? /* @__PURE__ */ k(
1343
- "div",
1344
- {
1345
- "data-component": "booking-payment-notice",
1346
- role: "group",
1347
- "aria-labelledby": `${H}-payment-heading`,
1348
- "data-notice-style": N,
1349
- className: yi({
1350
- noticeStyle: N
1351
- }),
1352
- children: [
1353
- N === "highlighted" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
1354
- /* @__PURE__ */ n("span", { className: "ds:flex ds:size-9 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-full ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]", children: /* @__PURE__ */ n(os, { "aria-hidden": "true", className: "ds:size-5" }) }),
1355
- /* @__PURE__ */ n(
1356
- "h3",
1357
- {
1358
- id: `${H}-payment-heading`,
1359
- className: "type-title-item ds:m-0 ds:flex-1",
1360
- children: h("booking.payment.noticeTitle")
1361
- }
1362
- ),
1363
- /* @__PURE__ */ n(
1364
- "span",
1365
- {
1366
- "aria-hidden": "true",
1367
- className: "type-title-card ds:shrink-0 ds:text-[var(--foreground)]",
1368
- children: ke
1369
- }
1370
- )
1371
- ] }) : /* @__PURE__ */ n(
1372
- "h3",
1373
- {
1374
- id: `${H}-payment-heading`,
1375
- className: "type-label ds:m-0",
1376
- children: h("booking.payment.noticeTitle")
1377
- }
1378
- ),
1379
- /* @__PURE__ */ n("p", { className: "type-body-sm ds:m-0", children: h("booking.payment.noticeBody", { amount: ke }) }),
1380
- We ? /* @__PURE__ */ n(
1381
- "a",
1382
- {
1383
- href: We,
1384
- target: "_blank",
1385
- rel: "noopener noreferrer",
1386
- className: "type-body-sm ds:inline-flex ds:items-center ds:self-start ds:min-h-[var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:underline ds:text-[var(--foreground)] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1387
- children: h("booking.payment.terms")
1388
- }
1389
- ) : null,
1390
- /* @__PURE__ */ n(
1391
- gt,
1392
- {
1393
- checked: lt,
1394
- onCheckedChange: (d) => {
1395
- Ft(
1396
- d === !0 ? qe : void 0
1397
- ), q({ paymentAccepted: d === !0 });
1398
- },
1399
- "aria-required": !0,
1400
- label: /* @__PURE__ */ k(me, { children: [
1401
- h("booking.payment.accept", { amount: ke }),
1402
- /* @__PURE__ */ n(
1403
- "span",
1404
- {
1405
- "aria-hidden": "true",
1406
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1407
- children: "*"
1408
- }
1409
- )
1410
- ] })
1411
- }
1412
- )
1413
- ]
1414
- }
1415
- ) : null,
1416
- /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1417
- /* @__PURE__ */ n(
1418
- gt,
1419
- {
1420
- checked: !!e.privacyConsent,
1421
- onCheckedChange: (d) => q({ privacyConsent: d === !0 }),
1422
- "aria-required": !0,
1423
- label: /* @__PURE__ */ k(me, { children: [
1424
- Ot(
1425
- "booking.details.consent.privacy.label",
1426
- b
1427
- ),
1428
- /* @__PURE__ */ n(
1429
- "span",
1430
- {
1431
- "aria-hidden": "true",
1432
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1433
- children: "*"
1434
- }
1435
- )
1436
- ] })
1437
- }
1438
- ),
1439
- /* @__PURE__ */ n(
1440
- gt,
1441
- {
1442
- checked: !!e.termsConsent,
1443
- onCheckedChange: (d) => q({ termsConsent: d === !0 }),
1444
- "aria-required": !0,
1445
- label: /* @__PURE__ */ k(me, { children: [
1446
- Ot(
1447
- "booking.details.consent.terms.label",
1448
- g
1449
- ),
1450
- /* @__PURE__ */ n(
1451
- "span",
1452
- {
1453
- "aria-hidden": "true",
1454
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1455
- children: "*"
1456
- }
1457
- )
1458
- ] })
1459
- }
1460
- ),
1461
- o && ut ? /* @__PURE__ */ n(
1462
- gt,
1463
- {
1464
- checked: Je,
1465
- onCheckedChange: (d) => {
1466
- Bt(
1467
- d === !0 ? Be : void 0
1468
- ), q({ practiceConsentAccepted: d === !0 });
1469
- },
1470
- "aria-required": o.required || void 0,
1471
- label: /* @__PURE__ */ k(me, { children: [
1472
- $t(o.url) ? /* @__PURE__ */ n(
1473
- "a",
1474
- {
1475
- dir: "auto",
1476
- href: $t(o.url),
1477
- target: "_blank",
1478
- rel: "noopener noreferrer",
1479
- className: en,
1480
- children: o.label
1481
- }
1482
- ) : /* @__PURE__ */ n("span", { dir: "auto", children: o.label }),
1483
- o.required ? /* @__PURE__ */ n(
1484
- "span",
1485
- {
1486
- "aria-hidden": "true",
1487
- className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
1488
- children: "*"
1489
- }
1490
- ) : null
1491
- ] })
1492
- }
1493
- ) : null
1494
- ] }),
1495
- be ? /* @__PURE__ */ n(
1496
- "div",
1497
- {
1498
- "data-component": "booking-confirmation-channels",
1499
- "data-unanswered": U || void 0,
1500
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1501
- children: V ? /* @__PURE__ */ n(
1502
- es,
1503
- {
1504
- variant: "horizontal",
1505
- label: h("booking.confirmation.heading"),
1506
- value: $[0] ?? "",
1507
- onValueChange: (d) => q({
1508
- confirmationChannels: [d]
1509
- }),
1510
- error: U ? h("booking.confirmation.atLeastOne") : void 0,
1511
- children: Le.map((d) => /* @__PURE__ */ n(
1512
- Xn,
1513
- {
1514
- value: d,
1515
- label: h(`booking.confirmation.channel.${d}`)
1516
- },
1517
- d
1518
- ))
1519
- }
1520
- ) : /* @__PURE__ */ n(
1521
- Qn,
1522
- {
1523
- label: h("booking.confirmation.heading"),
1524
- helperText: h("booking.confirmation.helper"),
1525
- value: $,
1526
- onChange: (d) => q({
1527
- confirmationChannels: d
1528
- }),
1529
- orientation: "vertical",
1530
- options: Le.map((d) => ({
1531
- value: d,
1532
- label: h(`booking.confirmation.channel.${d}`)
1533
- })),
1534
- error: U ? h("booking.confirmation.atLeastOne") : void 0
1535
- }
1536
- )
1537
- }
1538
- ) : null,
1539
- j || ct || y ? /* @__PURE__ */ n(ne, { variant: "error", children: /* @__PURE__ */ n(ne.Description, { children: j ?? h(
1540
- y ? "booking.payment.unavailable" : "booking.payment.submitFailed"
1541
- ) }) }) : null,
1542
- /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1543
- ye ? /* @__PURE__ */ n(
1544
- "p",
1545
- {
1546
- id: et,
1547
- "data-slot": "submit-hint",
1548
- className: "type-body-sm ds:m-0 ds:text-[var(--muted-foreground)]",
1549
- children: h("booking.details.submitHint")
1550
- }
1551
- ) : null,
1552
- /* @__PURE__ */ n(
1553
- tt,
1554
- {
1555
- intent: "primary",
1556
- size: "md",
1557
- type: "submit",
1558
- disabled: se || y,
1559
- "aria-disabled": !Re || void 0,
1560
- "aria-describedby": ye ? et : void 0,
1561
- startIcon: se ? /* @__PURE__ */ n(xn, { variant: "pulse", size: "sm" }) : void 0,
1562
- children: f ? h("booking.payment.submit", { amount: ke }) : h("booking.details.submit")
1563
- }
1564
- )
1565
- ] })
1566
- ]
1567
- }
1568
- );
1569
- }
1570
- );
1571
- cn.displayName = "BookingDetailsForm";
1572
- const Mt = [
1573
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1574
- "ds:focus-visible:outline-solid",
1575
- "ds:focus-visible:outline-[var(--ring)]",
1576
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1577
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
1578
- ].join(" ");
1579
- function Ni({
1580
- length: e = 5,
1581
- onVerify: t,
1582
- onResend: s,
1583
- resendSeconds: i = 60,
1584
- phoneHint: r,
1585
- onVerified: a
1586
- }) {
1587
- const { t: c, i18n: p } = Y("ui"), u = bt(), m = bt(), v = E(null), b = E(null), g = E(null), o = E(!1), f = E(!1), [I, y] = G(null), [B, N] = G(!1), [x, S] = G(null), [O, T] = G(
1588
- null
1589
- ), [F, l] = G(0), w = Number.isFinite(i) ? Math.max(0, Math.ceil(i)) : 60, [D, V] = G(
1590
- () => Date.now() + w * 1e3
1591
- ), [j, Z] = G(w), h = x === "too-many-attempts";
1592
- K(() => (o.current = !0, () => {
1593
- o.current = !1;
1594
- }), []), K(() => {
1595
- var M;
1596
- (M = b.current) == null || M.focus();
1597
- }, [F]), K(() => {
1598
- var we, fe;
1599
- if (I || !h && O !== "resend") return;
1600
- const M = document.activeElement, J = (we = v.current) == null ? void 0 : we.closest("section");
1601
- M && M !== document.body && !(J != null && J.contains(M)) || (g.current && !g.current.disabled ? g.current.focus() : (fe = v.current) == null || fe.focus());
1602
- }, [I, h, O]), K(() => {
1603
- if (j === 0) return;
1604
- const M = setTimeout(() => {
1605
- Z(Math.max(0, Math.ceil((D - Date.now()) / 1e3)));
1606
- }, 1e3);
1607
- return () => clearTimeout(M);
1608
- }, [D, j]);
1609
- const ee = async (M) => {
1610
- if (!(f.current || h)) {
1611
- f.current = !0, y("verify"), N(!1), S(null), T(null);
1612
- try {
1613
- const J = await t(M);
1614
- if (!o.current) return;
1615
- J.ok ? a() : (S(J.reason), J.reason !== "too-many-attempts" && l((we) => we + 1));
1616
- } catch {
1617
- if (!o.current) return;
1618
- T("verify"), l((J) => J + 1);
1619
- } finally {
1620
- f.current = !1, o.current && y(null);
1621
- }
1622
- }
1623
- }, H = async () => {
1624
- if (!(f.current || Date.now() < D)) {
1625
- f.current = !0, y("resend"), N(!1), T(null);
1626
- try {
1627
- if (await s(), !o.current) return;
1628
- V(Date.now() + w * 1e3), Z(w), S(null), N(!0), l((M) => M + 1);
1629
- } catch {
1630
- o.current && T("resend");
1631
- } finally {
1632
- f.current = !1, o.current && y(null);
1633
- }
1634
- }
1635
- }, Pe = x === "wrong" ? c("booking.code.wrong") : x === "expired" ? c("booking.code.expired") : h ? c("booking.code.tooManyAttempts") : void 0;
1636
- return /* @__PURE__ */ k(
1637
- "section",
1638
- {
1639
- "aria-labelledby": u,
1640
- "data-component": "booking-code-step",
1641
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1642
- children: [
1643
- /* @__PURE__ */ n(
1644
- "h3",
1645
- {
1646
- ref: v,
1647
- id: u,
1648
- tabIndex: -1,
1649
- className: `type-title-card ds:m-0 ${Mt}`,
1650
- children: c("booking.code.heading")
1651
- }
1652
- ),
1653
- /* @__PURE__ */ n("p", { id: m, className: "type-body ds:m-0", children: r ? /* @__PURE__ */ n(
1654
- Sn,
1655
- {
1656
- t: c,
1657
- ns: "ui",
1658
- i18nKey: "booking.code.instructionWithPhone",
1659
- values: { phone: r },
1660
- components: { phone: /* @__PURE__ */ n("bdi", {}) }
1661
- }
1662
- ) : c("booking.code.instruction") }),
1663
- /* @__PURE__ */ n(je, { label: c("booking.code.label"), error: Pe, children: /* @__PURE__ */ n("div", { dir: "ltr", children: /* @__PURE__ */ n(
1664
- as,
1665
- {
1666
- ref: b,
1667
- length: e,
1668
- mode: "alphanumeric",
1669
- "aria-describedby": m,
1670
- disabled: !!I || h,
1671
- onComplete: ee
1672
- },
1673
- F
1674
- ) }) }),
1675
- O ? /* @__PURE__ */ n(ne, { variant: "error", children: /* @__PURE__ */ n(ne.Description, { children: c(O === "verify" ? "booking.code.verifyFailed" : "booking.code.resendFailed") }) }) : null,
1676
- /* @__PURE__ */ n("p", { role: "status", className: "type-body ds:m-0", children: I === "verify" ? c("booking.code.verifying") : B ? c("booking.code.resent") : null }),
1677
- /* @__PURE__ */ n(
1678
- tt,
1679
- {
1680
- ref: g,
1681
- type: "button",
1682
- intent: "secondary",
1683
- className: "ds:self-start",
1684
- disabled: j > 0 || !!I,
1685
- loading: I === "resend",
1686
- onClick: H,
1687
- children: j > 0 ? c("booking.code.resendCountdown", {
1688
- seconds: new Intl.NumberFormat(p.language).format(j)
1689
- }) : c("booking.code.resend")
1690
- }
1691
- )
1692
- ]
1693
- }
1694
- );
1695
- }
1696
- function _n(e) {
1697
- const t = e.payment;
1698
- if (!t) return;
1699
- const s = (t.currencyCode ?? "EUR").toUpperCase();
1700
- if (!(!Number.isSafeInteger(t.amountCents) || t.amountCents <= 0 || !["full", "deposit"].includes(t.kind) || !/^[A-Z]{3}$/.test(s)))
1701
- return {
1702
- serviceId: e.id,
1703
- kind: t.kind,
1704
- amountCents: t.amountCents,
1705
- currencyCode: s
1706
- };
1707
- }
1708
- function wi(e) {
1709
- var r;
1710
- const t = (r = e.priceLabel) != null && r.trim() ? e.priceLabel : void 0, s = t ? { label: t } : void 0;
1711
- if (!e.payment) return { price: s };
1712
- const i = _n(e);
1713
- return i ? {
1714
- price: s ?? (i.kind === "full" ? { amount: i } : void 0),
1715
- payment: i
1716
- } : { price: s, payment: "unavailable" };
1717
- }
1718
- function Ci(e, t, s) {
1719
- const i = e.filter(
1720
- (a) => t.includes(a.id)
1721
- ), r = (s == null ? void 0 : s.serviceId) ?? (t.length === 1 ? t[0] : void 0);
1722
- if (r) {
1723
- const a = i.find((p) => p.id === r);
1724
- if (!a) return { blocked: !0 };
1725
- const c = _n(a);
1726
- return { payment: c, blocked: !!(a.payment && !c) };
1727
- }
1728
- return { blocked: i.some((a) => !!a.payment) };
1729
- }
1730
- function Kt(e) {
1731
- return e ? JSON.stringify([
1732
- e.serviceId,
1733
- e.kind,
1734
- e.amountCents,
1735
- e.currencyCode
1736
- ]) : "";
1737
- }
1738
- function Ai({
1739
- services: e,
1740
- value: t,
1741
- availableSlots: s,
1742
- onSubmit: i,
1743
- onChange: r,
1744
- paymentState: a,
1745
- submitting: c,
1746
- paymentTermsUrl: p,
1747
- renderPayment: u,
1748
- codeStep: m
1749
- }) {
1750
- var J, we, fe;
1751
- const v = JSON.stringify([
1752
- t.insuranceType,
1753
- t.specialtyId,
1754
- t.specialtyIds,
1755
- Ge(t),
1756
- t.operatorId,
1757
- t.operatorIds,
1758
- t.date,
1759
- t.slotKey
1760
- ]), b = E(
1761
- void 0
1762
- ), o = (t.date ? (J = s[t.date]) == null ? void 0 : J.find((W) => W.key === t.slotKey) : void 0) ?? (((we = b.current) == null ? void 0 : we.selection) === v ? b.current.slot : void 0), f = Ci(
1763
- e,
1764
- Ge(t),
1765
- o
1766
- ), I = f.blocked || !!(f.payment && !u), y = JSON.stringify([
1767
- v,
1768
- o == null ? void 0 : o.serviceId,
1769
- Kt(f.payment),
1770
- p,
1771
- I
1772
- ]), B = f.payment ? JSON.stringify([Kt(f.payment), p]) : "", N = E(void 0), x = !!((fe = t.details) != null && fe.paymentAccepted);
1773
- K(() => {
1774
- if (!x) N.current = void 0;
1775
- else if (B) N.current === void 0 ? N.current = B : N.current !== B && (N.current = void 0, r({
1776
- ...t,
1777
- details: { ...t.details, paymentAccepted: !1 }
1778
- }));
1779
- else return;
1780
- }, [x, B, r, t]);
1781
- const S = E(y);
1782
- S.current = y;
1783
- const [O, T] = G({ status: "idle" }), F = E(0), l = E(!1), w = E(!0), D = E(!1), V = E(void 0), j = E(y);
1784
- K(() => (w.current = !0, () => {
1785
- w.current = !1, F.current += 1;
1786
- }), []);
1787
- const Z = O.status === "payment" || O.status === "code" || O.status === "success";
1788
- K(() => {
1789
- j.current === y || D.current || Z || (j.current = y, F.current += 1, l.current = !1, T({ status: "idle" }));
1790
- }, [y, Z]);
1791
- const h = Z || j.current === y ? O.session : void 0, ee = R(
1792
- () => h && (a == null ? void 0 : a.sessionId) === h.id ? a : h ? { sessionId: h.id, status: "ready" } : void 0,
1793
- [h, a]
1794
- );
1795
- h && ee && "phase" in ee && ee.phase === "completion" && (V.current = h.id);
1796
- const H = R(
1797
- () => h && V.current === h.id && ee && ee.status !== "paid" && (!("phase" in ee) || ee.phase !== "completion") ? {
1798
- sessionId: h.id,
1799
- status: "processing",
1800
- phase: "completion"
1801
- } : ee,
1802
- [h, ee]
1803
- );
1804
- K(() => {
1805
- !h || !H || D.current || (H.status === "paid" ? (D.current = !0, T((W) => ({
1806
- ...W,
1807
- status: W.codeStep ? "code" : "success"
1808
- }))) : H.status === "cancelled" && (F.current += 1, l.current = !1, b.current = void 0, r({
1809
- ...t,
1810
- details: { ...t.details, paymentAccepted: !1 }
1811
- }), T({ status: "idle", cancelled: !0 })));
1812
- }, [h, H, r, t]);
1813
- const Pe = () => {
1814
- F.current += 1, l.current = !1, D.current = !1, V.current = void 0, b.current = void 0, j.current = S.current, T({ status: "idle" });
1815
- }, M = async (W) => {
1816
- var Ae, Ee, re, Fe, de;
1817
- if (!(o != null && o.available) || I || c || l.current || O.status === "payment" || D.current || f.payment && !W.paymentAccepted) return;
1818
- l.current = !0;
1819
- const Ve = m ? { ...m } : void 0;
1820
- b.current = { selection: v, slot: { ...o } };
1821
- const ct = ++F.current, ge = y;
1822
- j.current = ge;
1823
- const se = {
1824
- slot: { ...o, meta: o.meta ? { ...o.meta } : void 0 },
1825
- value: {
1826
- ...t,
1827
- serviceIds: (Ae = t.serviceIds) == null ? void 0 : Ae.slice(),
1828
- specialtyIds: (Ee = t.specialtyIds) == null ? void 0 : Ee.slice(),
1829
- operatorIds: (re = t.operatorIds) == null ? void 0 : re.slice(),
1830
- operatorId: Bn(t) ?? t.operatorId,
1831
- details: { ...W }
1832
- },
1833
- details: {
1834
- ...W,
1835
- confirmationChannels: (Fe = W.confirmationChannels) == null ? void 0 : Fe.slice()
1836
- },
1837
- ...f.payment ? { payment: { ...f.payment } } : {}
1838
- }, ce = () => w.current && F.current === ct && S.current === ge;
1839
- T({ status: "submitting" });
1840
- let Ce = !1;
1841
- try {
1842
- const he = await i(se);
1843
- if (!ce()) return;
1844
- if (se.payment) {
1845
- const Te = he == null ? void 0 : he.paymentSession;
1846
- if (!((de = Te == null ? void 0 : Te.id) != null && de.trim()) || Kt(Te.payment) !== Kt(se.payment)) {
1847
- T({ status: "error" });
1848
- return;
1849
- }
1850
- Ce = !0, T({
1851
- status: "payment",
1852
- snapshot: se,
1853
- session: { id: Te.id, payment: { ...Te.payment } },
1854
- codeStep: Ve
1855
- });
1856
- } else he != null && he.paymentSession ? T({ status: "error" }) : (D.current = !0, T({
1857
- status: Ve ? "code" : "success",
1858
- snapshot: se,
1859
- codeStep: Ve
1860
- }));
1861
- } catch {
1862
- ce() && T({ status: "error" });
1863
- } finally {
1864
- ce() && !Ce && (l.current = !1);
1865
- }
1866
- };
1867
- return {
1868
- ...O,
1869
- payment: f.payment,
1870
- blocked: I,
1871
- state: H,
1872
- activeSession: h,
1873
- submit: M,
1874
- reset: Pe,
1875
- completeCode: () => {
1876
- T(
1877
- (W) => W.status === "code" ? { ...W, status: "success", codeVerified: !0 } : W
1878
- );
1879
- }
1880
- };
1881
- }
1882
- const Ti = Et(
1883
- "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
1884
- {
1885
- variants: {
1886
- variant: {
1887
- "inline-list": "ds:gap-[var(--spacing-md)]",
1888
- accordion: "ds:gap-[var(--spacing-md)]",
1889
- calendar: "ds:gap-[var(--spacing-md)]",
1890
- flexible: "ds:gap-[var(--spacing-lg)]",
1891
- progress: "ds:gap-[var(--spacing-sm)]"
1892
- },
1893
- // `surface="elevated"` matches `Card variant="elevated"` — same
1894
- // tokens, same padding, same boundary behaviour — so consumers can
1895
- // drop their own Card wraps without a double-card look. Default
1896
- // `'flat'` preserves 0.30.x rendering.
1897
- surface: {
1898
- flat: "",
1899
- elevated: [
1900
- "ds:rounded-[var(--radius-lg)]",
1901
- "ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
1902
- "ds:border ds:border-[color:var(--card-border)]",
1903
- "ds:shadow-[var(--shadow-card)]",
1904
- "ds:p-[var(--spacing-md)]"
1905
- ].join(" ")
1906
- }
1907
- },
1908
- defaultVariants: { variant: "inline-list", surface: "flat" }
1909
- }
1910
- ), Oi = [
1911
- [
1912
- /\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\s*plastic)/i,
1913
- mn
1914
- ],
1915
- [/\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, Ss],
1916
- [/\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, js],
1917
- [/\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, xs],
1918
- [/\b(otorin|udito|orecchi|hearing|ear)/i, Rs],
1919
- [/\b(neuro|brain|cervello)/i, Es],
1920
- [/\b(pediatr|child|bambin)/i, Is],
1921
- [/\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, Ds],
1922
- [/\b(lab|analis|test|sang|esami)/i, Ps],
1923
- [/\b(farmaco|pharm|pillol|refill)/i, $s],
1924
- [/\b(chirurg|surg|intervent|operat)/i, Ks],
1925
- [/\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, Ns],
1926
- [/\b(vacc|inject|inie|punto)/i, mn],
1927
- [/\b(derma|skin|pelle)/i, ws],
1928
- [/\b(prima\s*visit|first\s*visit|consult|consulto|valutaz)/i, Cs],
1929
- [/\b(general|medicin|family|control|check[-\s]?up)/i, Ts]
1930
- ];
1931
- function Di(e) {
1932
- for (const [t, s] of Oi)
1933
- if (t.test(e)) return s;
1934
- return null;
1935
- }
1936
- function Mi(e) {
1937
- const t = Di(e.label) ?? ks;
1938
- return /* @__PURE__ */ n(t, { "aria-hidden": "true", className: "ds:size-5" });
1939
- }
1940
- function Pn() {
1941
- const { t: e, i18n: t } = Y("ui");
1942
- return (s) => {
1943
- const i = wi(s), r = (c) => Gt(c.amountCents, c.currencyCode, t.language), a = i.price ? "label" in i.price ? i.price.label : r(i.price.amount) : void 0;
1944
- return i.payment === "unavailable" ? {
1945
- price: a,
1946
- payment: e("booking.payment.unavailable"),
1947
- paymentTone: "error"
1948
- } : {
1949
- price: a,
1950
- payment: i.payment ? e(`booking.payment.${i.payment.kind}`, {
1951
- amount: r(i.payment)
1952
- }) : void 0,
1953
- paymentTone: "default"
1954
- };
1955
- };
1956
- }
1957
- function at(e) {
1958
- return jt(e, "yyyy-MM-dd");
1959
- }
1960
- const Ei = [
1961
- "ds:relative ds:flex ds:items-center ds:justify-center",
1962
- "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
1963
- "ds:rounded-[var(--radius-sm)]",
1964
- "ds:text-[length:var(--font-size-sm)]",
1965
- "ds:transition-colors ds:duration-[var(--animation-duration)]",
1966
- "ds:motion-reduce:transition-none",
1967
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1968
- "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1969
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
1970
- ].join(" "), Fi = Et(Ei, {
1971
- variants: {
1972
- state: {
1973
- available: "ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30",
1974
- unavailable: "ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60",
1975
- selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]",
1976
- outside: "ds:text-[var(--muted-foreground)]/40"
1977
- }
1978
- },
1979
- defaultVariants: { state: "unavailable" }
1980
- });
1981
- function Bi({
1982
- availableDates: e,
1983
- selectedDate: t,
1984
- onSelectDate: s,
1985
- locale: i,
1986
- loading: r
1987
- }) {
1988
- const { t: a } = Y("ui"), c = R(() => t ? Dt(Ie(t)) : e.length > 0 ? Dt(Ie(e[0])) : Dt(/* @__PURE__ */ new Date()), [t, e]), [p, u] = G(c), [m, v] = G(null), b = R(() => {
1989
- const N = Dt(p), x = fs(p), S = N.getDay(), O = x.getDate(), T = [];
1990
- for (let F = S; F > 0; F -= 1) {
1991
- const l = new Date(N);
1992
- l.setDate(N.getDate() - F), T.push(l);
1993
- }
1994
- for (let F = 0; F < O; F += 1) {
1995
- const l = new Date(N);
1996
- l.setDate(N.getDate() + F), T.push(l);
1997
- }
1998
- for (; T.length < 42; ) {
1999
- const F = T[T.length - 1], l = new Date(F);
2000
- l.setDate(F.getDate() + 1), T.push(l);
2001
- }
2002
- return T;
2003
- }, [p]), g = R(() => {
2004
- try {
2005
- return new Intl.DateTimeFormat(i, {
2006
- month: "long",
2007
- year: "numeric"
2008
- }).format(p);
2009
- } catch {
2010
- return jt(p, "MMMM yyyy");
2011
- }
2012
- }, [p, i]), o = R(() => {
2013
- const N = new Date(2024, 0, 7);
2014
- return Array.from({ length: 7 }, (x, S) => {
2015
- const O = new Date(N);
2016
- O.setDate(N.getDate() + S);
2017
- try {
2018
- return new Intl.DateTimeFormat(i, { weekday: "short" }).format(O);
2019
- } catch {
2020
- return jt(O, "EEE");
2021
- }
2022
- });
2023
- }, [i]), f = R(() => new Set(e), [e]), I = Ne(
2024
- (N) => f.has(at(N)),
2025
- [f]
2026
- ), y = R(() => {
2027
- if (m) return m;
2028
- if (t) return Ie(t);
2029
- const N = b.find(
2030
- (x) => Vt(x, p) && I(x)
2031
- );
2032
- return N || (b.find((x) => Vt(x, p)) ?? null);
2033
- }, [m, t, b, p, I]), B = Ne(
2034
- (N, x) => {
2035
- let S = null;
2036
- switch (N.key) {
2037
- case "ArrowLeft":
2038
- S = new Date(x), S.setDate(x.getDate() - 1);
2039
- break;
2040
- case "ArrowRight":
2041
- S = new Date(x), S.setDate(x.getDate() + 1);
2042
- break;
2043
- case "ArrowUp":
2044
- S = new Date(x), S.setDate(x.getDate() - 7);
2045
- break;
2046
- case "ArrowDown":
2047
- S = new Date(x), S.setDate(x.getDate() + 7);
2048
- break;
2049
- case "Home":
2050
- S = new Date(x), S.setDate(x.getDate() - x.getDay());
2051
- break;
2052
- case "End":
2053
- S = new Date(x), S.setDate(x.getDate() + (6 - x.getDay()));
2054
- break;
2055
- case "Enter":
2056
- case " ": {
2057
- N.preventDefault(), I(x) && s(at(x));
2058
- return;
2059
- }
2060
- default:
2061
- return;
2062
- }
2063
- S && (N.preventDefault(), Vt(S, p) || u(Dt(S)), v(S));
2064
- },
2065
- [I, s, p]
2066
- );
2067
- return r ? /* @__PURE__ */ k(
2068
- "div",
2069
- {
2070
- role: "status",
2071
- "aria-live": "polite",
2072
- "aria-label": a("common.loading"),
2073
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
2074
- children: [
2075
- /* @__PURE__ */ n(Ut, { variant: "text", width: "40%" }),
2076
- /* @__PURE__ */ n("div", { className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]", children: Array.from({ length: 42 }, (N, x) => /* @__PURE__ */ n(Ut, { variant: "rounded", height: "2.5rem" }, `mg-skel-${x}`)) })
2077
- ]
2078
- }
2079
- ) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2080
- /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
2081
- /* @__PURE__ */ n(
2082
- un,
2083
- {
2084
- icon: /* @__PURE__ */ n(hs, {}),
2085
- "aria-label": a("booking.previousMonth"),
2086
- size: "sm",
2087
- intent: "ghost",
2088
- flipIconInRtl: !0,
2089
- onClick: () => {
2090
- u((N) => Js(N)), v(null);
2091
- }
2092
- }
2093
- ),
2094
- /* @__PURE__ */ n(
2095
- "span",
2096
- {
2097
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
2098
- "aria-live": "polite",
2099
- children: g
2100
- }
2101
- ),
2102
- /* @__PURE__ */ n(
2103
- un,
2104
- {
2105
- icon: /* @__PURE__ */ n(vs, {}),
2106
- "aria-label": a("booking.nextMonth"),
2107
- size: "sm",
2108
- intent: "ghost",
2109
- flipIconInRtl: !0,
2110
- onClick: () => {
2111
- u((N) => wn(N, 1)), v(null);
2112
- }
2113
- }
2114
- )
2115
- ] }),
2116
- /* @__PURE__ */ k(
2117
- "div",
2118
- {
2119
- role: "grid",
2120
- "aria-label": a("booking.monthGridLabel"),
2121
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
2122
- children: [
2123
- /* @__PURE__ */ n(
2124
- "div",
2125
- {
2126
- role: "row",
2127
- className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
2128
- children: o.map((N, x) => /* @__PURE__ */ n(
2129
- "div",
2130
- {
2131
- role: "columnheader",
2132
- className: "type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]",
2133
- children: N
2134
- },
2135
- `wd-${x}`
2136
- ))
2137
- }
2138
- ),
2139
- Array.from({ length: 6 }, (N, x) => /* @__PURE__ */ n(
2140
- "div",
2141
- {
2142
- role: "row",
2143
- className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
2144
- children: b.slice(x * 7, x * 7 + 7).map((S, O) => {
2145
- const T = x * 7 + O, F = Vt(S, p), l = F && I(S), w = t ? pn(S, Ie(t)) : !1, D = F ? w ? "selected" : l ? "available" : "unavailable" : "outside", V = y ? pn(y, S) : !1, j = (() => {
2146
- try {
2147
- return new Intl.DateTimeFormat(i, {
2148
- dateStyle: "full"
2149
- }).format(S);
2150
- } catch {
2151
- return jt(S, "PPP");
2152
- }
2153
- })();
2154
- return /* @__PURE__ */ n(
2155
- "button",
2156
- {
2157
- type: "button",
2158
- role: "gridcell",
2159
- "aria-label": j,
2160
- "aria-selected": w || void 0,
2161
- "aria-disabled": !l || void 0,
2162
- tabIndex: V ? 0 : -1,
2163
- disabled: !l,
2164
- onClick: () => {
2165
- l && s(at(S));
2166
- },
2167
- onKeyDown: (Z) => B(Z, S),
2168
- className: Fi({ state: D }),
2169
- children: /* @__PURE__ */ n("span", { "aria-hidden": "true", children: S.getDate() })
2170
- },
2171
- `mg-cell-${T}`
2172
- );
2173
- })
2174
- },
2175
- `mg-row-${x}`
2176
- ))
2177
- ]
2178
- }
2179
- )
2180
- ] });
2181
- }
2182
- const Li = Et(
2183
- [
2184
- "ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]",
2185
- "ds:min-h-[var(--min-target-size)]",
2186
- "ds:rounded-[var(--radius-md)]",
2187
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
2188
- "ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]",
2189
- "ds:text-start",
2190
- "ds:transition-[background-color,box-shadow]",
2191
- "ds:duration-[var(--animation-duration)]",
2192
- "ds:motion-reduce:transition-none",
2193
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
2194
- "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2195
- "ds:forced-colors:[outline:1px_solid_CanvasText]",
2196
- "ds:cursor-pointer"
2197
- ].join(" "),
2198
- {
2199
- variants: {
2200
- state: {
2201
- idle: "ds:bg-[var(--card)] ds:shadow-[var(--shadow-sm)] ds:hover:shadow-[var(--shadow-md)]",
2202
- selected: "ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:shadow-[var(--shadow-sm)]"
2203
- }
2204
- },
2205
- defaultVariants: { state: "idle" }
2206
- }
2207
- );
2208
- function Ri({
2209
- services: e,
2210
- selectedServiceId: t,
2211
- onSelect: s,
2212
- showDuration: i
2213
- }) {
2214
- const { t: r } = Y("ui"), a = Pn(), c = bt(), [p, u] = G(() => {
2215
- if (t) {
2216
- const g = e.findIndex((o) => o.id === t);
2217
- if (g >= 0) return g;
2218
- }
2219
- return 0;
2220
- }), m = E(/* @__PURE__ */ new Map()), v = Ne((g) => {
2221
- var o;
2222
- (o = m.current.get(g)) == null || o.focus();
2223
- }, []), b = Ne(
2224
- (g, o, f) => {
2225
- const I = e.length;
2226
- if (I !== 0)
2227
- switch (g.key) {
2228
- case "ArrowDown":
2229
- case "ArrowRight": {
2230
- g.preventDefault();
2231
- const y = (o + 1) % I;
2232
- u(y), v(y);
2233
- break;
2234
- }
2235
- case "ArrowUp":
2236
- case "ArrowLeft": {
2237
- g.preventDefault();
2238
- const y = (o - 1 + I) % I;
2239
- u(y), v(y);
2240
- break;
2241
- }
2242
- case "Home": {
2243
- g.preventDefault(), u(0), v(0);
2244
- break;
2245
- }
2246
- case "End": {
2247
- g.preventDefault();
2248
- const y = I - 1;
2249
- u(y), v(y);
2250
- break;
2251
- }
2252
- case "Enter":
2253
- case " ": {
2254
- g.preventDefault(), s(f);
2255
- break;
2256
- }
2257
- }
2258
- },
2259
- [e.length, v, s]
2260
- );
2261
- return e.length === 0 ? null : /* @__PURE__ */ n(
2262
- "div",
2263
- {
2264
- role: "radiogroup",
2265
- "aria-label": r("booking.serviceListLabel"),
2266
- id: c,
2267
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
2268
- children: e.map((g, o) => {
2269
- const f = t === g.id, I = p === o, { price: y, payment: B, paymentTone: N } = a(g), x = y ? B ? r("booking.serviceCardLabelPayment", {
2270
- label: g.label,
2271
- price: y,
2272
- payment: B
2273
- }) : r("booking.serviceCardLabelPrice", {
2274
- label: g.label,
2275
- price: y
2276
- }) : B ? r("booking.serviceCardLabelPaymentNoPrice", {
2277
- label: g.label,
2278
- payment: B
2279
- }) : i ? r("booking.serviceCardLabel", {
2280
- label: g.label,
2281
- duration: g.durationMin
2282
- }) : g.label, S = Mi(g);
2283
- return /* @__PURE__ */ k(
2284
- "button",
2285
- {
2286
- ref: (O) => {
2287
- O ? m.current.set(o, O) : m.current.delete(o);
2288
- },
2289
- type: "button",
2290
- role: "radio",
2291
- "aria-checked": f,
2292
- "aria-label": x,
2293
- tabIndex: I ? 0 : -1,
2294
- onClick: () => s(g.id),
2295
- onFocus: () => u(o),
2296
- onKeyDown: (O) => b(O, o, g.id),
2297
- className: Li({
2298
- state: f ? "selected" : "idle"
2299
- }),
2300
- children: [
2301
- /* @__PURE__ */ n(
2302
- "span",
2303
- {
2304
- "aria-hidden": "true",
2305
- 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)]",
2306
- children: S
2307
- }
2308
- ),
2309
- /* @__PURE__ */ k("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
2310
- /* @__PURE__ */ n(
2311
- "span",
2312
- {
2313
- dir: "auto",
2314
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:break-words",
2315
- children: g.label
2316
- }
2317
- ),
2318
- B ? /* @__PURE__ */ n(
2319
- "span",
2320
- {
2321
- className: cs({ tone: N }),
2322
- children: B
2323
- }
2324
- ) : y || !i ? null : /* @__PURE__ */ n("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: r("booking.serviceSummary", {
2325
- minutes: g.durationMin
2326
- }) })
2327
- ] }),
2328
- y ? /* @__PURE__ */ n(
2329
- "span",
2330
- {
2331
- "aria-hidden": "true",
2332
- className: "ds:inline-flex ds:shrink-0 ds:items-center ds:ms-auto",
2333
- children: /* @__PURE__ */ n(In, { variant: "accentSoft", size: "lg", children: y })
2334
- }
2335
- ) : null
2336
- ]
2337
- },
2338
- g.id
2339
- );
2340
- })
2341
- }
2342
- );
2343
- }
2344
- const _i = Et(
2345
- [
2346
- "ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
2347
- "ds:min-h-[var(--min-target-size)]",
2348
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
2349
- "ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]",
2350
- "ds:rounded-[var(--radius-md)]",
2351
- "ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]",
2352
- "ds:transition-[background-color,color,box-shadow] ds:duration-[var(--animation-duration)]",
2353
- "ds:motion-reduce:transition-none",
2354
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
2355
- "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2356
- "ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
2357
- "ds:forced-colors:[border:1px_solid_ButtonText] ds:forced-colors:text-[ButtonText]"
2358
- ].join(" "),
2359
- {
2360
- variants: {
2361
- state: {
2362
- 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)]",
2363
- selected: "ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:shadow-[var(--shadow-sm)]",
2364
- unavailable: "ds:[outline:1px_dashed_color:var(--border)] ds:[outline-offset:-1px] ds:bg-transparent ds:text-[color:var(--muted-foreground)]"
2365
- }
2366
- },
2367
- defaultVariants: { state: "idle" }
2368
- }
2369
- );
2370
- function Pi(e) {
2371
- const [t] = e.split(":").map((i) => parseInt(i, 10)), s = Number.isFinite(t) ? t : 0;
2372
- return s < 12 ? "morning" : s < 17 ? "afternoon" : "evening";
2373
- }
2374
- const Vi = {
2375
- morning: ys,
2376
- afternoon: Gs,
2377
- evening: bs
2378
- };
2379
- function $i({
2380
- date: e,
2381
- slots: t,
2382
- selectedSlotKey: s,
2383
- onSelect: i,
2384
- loading: r,
2385
- locale: a
2386
- }) {
2387
- const { t: c } = Y("ui"), p = R(() => {
2388
- try {
2389
- return new Intl.DateTimeFormat(a, {
2390
- weekday: "long",
2391
- day: "numeric",
2392
- month: "long"
2393
- }).format(Ie(e));
2394
- } catch {
2395
- return e;
2396
- }
2397
- }, [e, a]), u = R(() => {
2398
- const b = {
2399
- morning: [],
2400
- afternoon: [],
2401
- evening: []
2402
- };
2403
- for (const g of t)
2404
- b[Pi(g.time)].push(g);
2405
- return b;
2406
- }, [t]), m = t.filter((b) => b.available).length, v = ["morning", "afternoon", "evening"];
2407
- return r ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2408
- /* @__PURE__ */ n(Ut, { variant: "text", width: "60%" }),
2409
- [0, 1].map((b) => /* @__PURE__ */ n(
2410
- "div",
2411
- {
2412
- className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]",
2413
- children: [0, 1, 2].map((g) => /* @__PURE__ */ n(Ut, { variant: "rounded", height: "44px" }, g))
2414
- },
2415
- b
2416
- ))
2417
- ] }) : m === 0 ? /* @__PURE__ */ n(Nn, { variant: "no-results", title: c("booking.noSlotsForDate") }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
2418
- /* @__PURE__ */ k("div", { className: "ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
2419
- /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
2420
- /* @__PURE__ */ n(
2421
- Bs,
2422
- {
2423
- "aria-hidden": "true",
2424
- className: "ds:size-4 ds:text-[color:var(--accent)]"
2425
- }
2426
- ),
2427
- /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: p })
2428
- ] }),
2429
- /* @__PURE__ */ n("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: c("booking.slotsAvailable", { count: m }) })
2430
- ] }),
2431
- v.map((b) => {
2432
- const g = u[b];
2433
- if (g.length === 0) return null;
2434
- const o = Vi[b];
2435
- return /* @__PURE__ */ k(
2436
- "div",
2437
- {
2438
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
2439
- children: [
2440
- /* @__PURE__ */ k("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
2441
- /* @__PURE__ */ n(o, { "aria-hidden": "true", className: "ds:size-3.5" }),
2442
- /* @__PURE__ */ n("span", { className: "type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase", children: c(`booking.timeOfDay.${b}`) })
2443
- ] }),
2444
- /* @__PURE__ */ n(
2445
- "div",
2446
- {
2447
- role: "group",
2448
- "aria-label": c(`booking.timeOfDay.${b}`),
2449
- className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4",
2450
- children: g.map((f) => {
2451
- const I = f.key === s, y = f.available ? I ? "selected" : "idle" : "unavailable";
2452
- return /* @__PURE__ */ n(
2453
- "button",
2454
- {
2455
- type: "button",
2456
- "data-slot-id": f.key,
2457
- disabled: !f.available,
2458
- "aria-pressed": I,
2459
- "aria-label": c("booking.slotAvailableLabel", {
2460
- time: f.time
2461
- }),
2462
- onClick: () => f.available && i(f),
2463
- className: _i({ state: y }),
2464
- children: f.time
2465
- },
2466
- f.key
2467
- );
2468
- })
2469
- }
2470
- )
2471
- ]
2472
- },
2473
- b
2474
- );
2475
- })
2476
- ] });
2477
- }
2478
- const zt = 4;
2479
- function qi({
2480
- availableDates: e,
2481
- availableSlots: t,
2482
- value: s,
2483
- onChange: i,
2484
- onDateSelect: r,
2485
- onWindowChange: a,
2486
- loadingDates: c,
2487
- loadingSlots: p,
2488
- locale: u,
2489
- agentIdBase: m
2490
- }) {
2491
- const v = R(() => ht(/* @__PURE__ */ new Date()), []), [b, g] = G(() => {
2492
- if (s.date) {
2493
- const l = ht(Ie(s.date));
2494
- if (!vt(v, l)) return l;
2495
- }
2496
- if (e.length > 0) {
2497
- const l = ht(Ie(e[0]));
2498
- if (vt(l, v)) return l;
2499
- }
2500
- return v;
2501
- }), o = R(
2502
- () => Xt(b, zt - 1),
2503
- [b]
2504
- ), f = R(() => Array.from({ length: zt }, (l, w) => {
2505
- const D = Xt(b, w), V = at(D), Z = (t[V] ?? []).map((h) => ({
2506
- id: h.key,
2507
- // SlotGrid formats `start` as a time via Intl.DateTimeFormat —
2508
- // compose a full ISO from the column's date + the slot's HH:mm
2509
- // so the locale-formatter has a real timestamp to work with.
2510
- start: `${V}T${h.time}:00`,
2511
- available: h.available
2512
- }));
2513
- return { date: V, slots: Z };
2514
- }), [b, t]), I = vt(b, v), y = !0, B = Ne(() => {
2515
- g((l) => {
2516
- const w = gs(l, zt);
2517
- return vt(v, w) ? v : w;
2518
- });
2519
- }, [v]), N = Ne(() => {
2520
- g((l) => Xt(l, zt));
2521
- }, []);
2522
- K(() => {
2523
- if (e.length === 0) return;
2524
- const l = ht(Ie(e[0]));
2525
- !vt(l, v) || e.some((D) => {
2526
- const V = ht(Ie(D));
2527
- return !vt(V, o) && !ms(V, b);
2528
- }) || g(l);
2529
- }, [e]), K(() => {
2530
- a == null || a(at(b), at(o));
2531
- }, [b, o, a]);
2532
- const x = Ne(
2533
- (l, w) => {
2534
- const D = typeof w.date == "string" ? w.date : at(w.date);
2535
- i({
2536
- ...Fn(Jt(s, D), l.id)
2537
- }), r == null || r(D);
2538
- },
2539
- [i, r, s]
2540
- ), S = c || p ? "loading" : "default", O = f.some((l) => l.slots.length > 0), T = e[0];
2541
- return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2542
- S !== "loading" && !O && !!T ? /* @__PURE__ */ n(
2543
- dn,
2544
- {
2545
- nextAvailableDate: T,
2546
- onJump: () => g(ht(Ie(T))),
2547
- locale: u
2548
- }
2549
- ) : null,
2550
- /* @__PURE__ */ n(
2551
- us,
2552
- {
2553
- id: m ? `${m}-slots` : void 0,
2554
- days: f,
2555
- state: S,
2556
- selectedSlotId: s.slotKey,
2557
- maxInitialSlotsPerDay: 6,
2558
- locale: u,
2559
- hasPrevious: I,
2560
- hasNext: y,
2561
- onSlotSelect: x,
2562
- onPreviousDays: B,
2563
- onNextDays: N
2564
- }
2565
- )
2566
- ] });
2567
- }
2568
- function Vn(e) {
2569
- const {
2570
- inputs: t,
2571
- value: s,
2572
- onChange: i,
2573
- onDateSelect: r,
2574
- onWindowChange: a,
2575
- loadingDates: c,
2576
- loadingSlots: p,
2577
- locale: u,
2578
- datePickerStyle: m,
2579
- agentIdBase: v
2580
- } = e;
2581
- return m === "four-day-grid" ? /* @__PURE__ */ n(
2582
- qi,
2583
- {
2584
- availableDates: t.availableDates,
2585
- availableSlots: t.availableSlots,
2586
- value: s,
2587
- onChange: i,
2588
- onDateSelect: r,
2589
- onWindowChange: a,
2590
- loadingDates: c,
2591
- loadingSlots: p,
2592
- locale: u,
2593
- agentIdBase: v
2594
- }
2595
- ) : /* @__PURE__ */ n(
2596
- Bi,
2597
- {
2598
- availableDates: t.availableDates,
2599
- selectedDate: s.date,
2600
- onSelectDate: (b) => {
2601
- i(Jt(s, b)), r == null || r(b);
2602
- },
2603
- locale: u,
2604
- loading: c ?? p
2605
- }
2606
- );
2607
- }
2608
- function $n(e) {
2609
- const { inputs: t, value: s, onChange: i, loadingSlots: r, locale: a, datePickerStyle: c } = e;
2610
- return c === "four-day-grid" || !s.date ? null : /* @__PURE__ */ n(
2611
- $i,
2612
- {
2613
- date: s.date,
2614
- slots: t.availableSlots[s.date] ?? [],
2615
- selectedSlotKey: s.slotKey,
2616
- onSelect: (p) => i(Fn(s, p.key)),
2617
- loading: r,
2618
- locale: a
2619
- }
2620
- );
2621
- }
2622
- function qn({ value: e, onChange: t }) {
2623
- const { t: s } = Y("ui"), i = [
2624
- { value: "private", label: s("booking.insurance.private") },
2625
- { value: "public", label: s("booking.insurance.public") }
2626
- ];
2627
- return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2628
- /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: s("booking.insurance.heading") }),
2629
- /* @__PURE__ */ n(
2630
- Ht,
2631
- {
2632
- options: i,
2633
- value: e ?? "",
2634
- onValueChange: (r) => {
2635
- (r === "private" || r === "public") && t(r);
2636
- },
2637
- placeholder: s("booking.insurance.placeholder"),
2638
- "aria-label": s("booking.insurance.heading")
2639
- }
2640
- )
2641
- ] });
2642
- }
2643
- function Kn({
2644
- specialties: e,
2645
- value: t,
2646
- valueIds: s,
2647
- onChange: i,
2648
- onChangeIds: r,
2649
- pickerStyle: a = "select"
2650
- }) {
2651
- const { t: c } = Y("ui"), p = e.map((m) => ({
2652
- value: m.id,
2653
- label: m.label,
2654
- dir: "auto"
2655
- })), u = /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: c("booking.specialty.heading") });
2656
- return a === "multi-select" && r ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2657
- u,
2658
- /* @__PURE__ */ n(
2659
- on,
2660
- {
2661
- options: p,
2662
- value: s ?? [],
2663
- onChange: r,
2664
- placeholder: c("booking.specialty.placeholder"),
2665
- "aria-label": c("booking.specialty.heading"),
2666
- allowClear: !0
2667
- }
2668
- )
2669
- ] }) : a === "combobox" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2670
- u,
2671
- /* @__PURE__ */ n(
2672
- rn,
2673
- {
2674
- options: p,
2675
- value: t ?? "",
2676
- onValueChange: (m) => i(m === "" ? "" : m),
2677
- placeholder: c("booking.specialty.placeholder"),
2678
- "aria-label": c("booking.specialty.heading"),
2679
- clearable: !0
2680
- }
2681
- )
2682
- ] }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2683
- u,
2684
- /* @__PURE__ */ n(
2685
- Ht,
2686
- {
2687
- options: p,
2688
- value: t ?? "",
2689
- onValueChange: (m) => i(m),
2690
- placeholder: c("booking.specialty.placeholder"),
2691
- "aria-label": c("booking.specialty.heading")
2692
- }
2693
- )
2694
- ] });
2695
- }
2696
- function zn({
2697
- services: e,
2698
- value: t,
2699
- valueIds: s,
2700
- onChange: i,
2701
- onChangeIds: r,
2702
- pickerStyle: a,
2703
- compact: c,
2704
- showDuration: p
2705
- }) {
2706
- const { t: u } = Y("ui"), m = Pn(), v = a ?? (c ? "select" : "cards"), b = e.map((o) => {
2707
- const { price: f, payment: I, paymentTone: y } = m(o);
2708
- return {
2709
- value: o.id,
2710
- // The practice's service name leads the label, so it decides the
2711
- // direction, even when the kit's duration is appended after it.
2712
- dir: "auto",
2713
- label: f || I || !p ? o.label : `${o.label} · ${u("booking.serviceSummary", {
2714
- minutes: o.durationMin
2715
- })}`,
2716
- ...f ? {
2717
- endContent: /* @__PURE__ */ n(In, { variant: "accentSoft", size: "lg", children: f })
2718
- } : {},
2719
- ...I ? { description: I, descriptionTone: y } : {}
2720
- };
2721
- }), g = /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: u("booking.service.heading") });
2722
- return v === "multi-select" && r ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2723
- g,
2724
- /* @__PURE__ */ n(
2725
- on,
2726
- {
2727
- options: b,
2728
- value: s ?? [],
2729
- onChange: r,
2730
- placeholder: u("booking.service.placeholder"),
2731
- "aria-label": u("booking.service.heading"),
2732
- allowClear: !0,
2733
- wrapOptionLabels: !0
2734
- }
2735
- )
2736
- ] }) : v === "combobox" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2737
- g,
2738
- /* @__PURE__ */ n(
2739
- rn,
2740
- {
2741
- options: b,
2742
- value: t ?? "",
2743
- onValueChange: (o) => i(o === "" ? "" : o),
2744
- placeholder: u("booking.service.placeholder"),
2745
- "aria-label": u("booking.service.heading"),
2746
- clearable: !0,
2747
- wrapOptionLabels: !0
2748
- }
2749
- )
2750
- ] }) : v === "select" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2751
- g,
2752
- /* @__PURE__ */ n(
2753
- Ht,
2754
- {
2755
- options: b,
2756
- value: t ?? "",
2757
- onValueChange: (o) => i(o),
2758
- placeholder: u("booking.service.placeholder"),
2759
- "aria-label": u("booking.service.heading"),
2760
- showDescriptions: !0,
2761
- descriptionInName: !0,
2762
- wrapOptionLabels: !0
2763
- }
2764
- )
2765
- ] }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2766
- g,
2767
- /* @__PURE__ */ n(
2768
- Ri,
2769
- {
2770
- services: e,
2771
- selectedServiceId: t,
2772
- onSelect: i,
2773
- showDuration: p
2774
- }
2775
- )
2776
- ] });
2777
- }
2778
- function jn({
2779
- operators: e,
2780
- value: t,
2781
- valueIds: s,
2782
- onChange: i,
2783
- onChangeIds: r,
2784
- pickerStyle: a = "select"
2785
- }) {
2786
- const { t: c } = Y("ui"), p = /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: c("booking.operator.heading") });
2787
- if (a === "multi-select" && r) {
2788
- const m = e.map((v) => ({
2789
- value: v.id,
2790
- label: v.name,
2791
- dir: "auto"
2792
- }));
2793
- return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2794
- p,
2795
- /* @__PURE__ */ n(
2796
- on,
2797
- {
2798
- options: m,
2799
- value: s ?? [],
2800
- onChange: r,
2801
- placeholder: c("booking.operator.all"),
2802
- "aria-label": c("booking.operator.heading"),
2803
- allowClear: !0
2804
- }
2805
- )
2806
- ] });
2807
- }
2808
- const u = [
2809
- { value: _e, label: c("booking.operator.all") },
2810
- ...e.map(
2811
- (m) => ({ value: m.id, label: m.name, dir: "auto" })
2812
- )
2813
- ];
2814
- return a === "combobox" ? /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2815
- p,
2816
- /* @__PURE__ */ n(
2817
- rn,
2818
- {
2819
- options: u,
2820
- value: t ?? _e,
2821
- onValueChange: (m) => i(m === "" ? _e : m),
2822
- placeholder: c("booking.operator.placeholder"),
2823
- "aria-label": c("booking.operator.heading"),
2824
- clearable: !0
2825
- }
2826
- )
2827
- ] }) : /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
2828
- p,
2829
- /* @__PURE__ */ n(
2830
- Ht,
2831
- {
2832
- options: u,
2833
- value: t ?? _e,
2834
- onValueChange: (m) => i(m),
2835
- placeholder: c("booking.operator.placeholder"),
2836
- "aria-label": c("booking.operator.heading")
2837
- }
2838
- )
2839
- ] });
2840
- }
2841
- function Un({
2842
- customSlot: e
2843
- }) {
2844
- const { t } = Y("ui");
2845
- return e ? /* @__PURE__ */ n(me, { children: e }) : /* @__PURE__ */ k(ne, { variant: "warning", children: [
2846
- /* @__PURE__ */ n(ne.Title, { as: "h4", children: t("booking.onboardingIncomplete.title") }),
2847
- /* @__PURE__ */ n(ne.Description, { children: t("booking.onboardingIncomplete.description") })
2848
- ] });
2849
- }
2850
- function dn({
2851
- nextAvailableDate: e,
2852
- onJump: t,
2853
- locale: s
2854
- }) {
2855
- const { t: i } = Y("ui"), r = R(() => {
2856
- try {
2857
- return new Intl.DateTimeFormat(s, { dateStyle: "long" }).format(
2858
- Ie(e)
2859
- );
2860
- } catch {
2861
- return e;
2862
- }
2863
- }, [e, s]);
2864
- return /* @__PURE__ */ k(ne, { variant: "info", children: [
2865
- /* @__PURE__ */ n(ne.Description, { children: i("booking.nextAvailable.description", { date: r }) }),
2866
- /* @__PURE__ */ n(ne.Action, { children: /* @__PURE__ */ n(tt, { intent: "secondary", size: "sm", onClick: t, children: i("booking.nextAvailable.cta") }) })
2867
- ] });
2868
- }
2869
- function Ki({
2870
- codeVerified: e = !1,
2871
- payment: t,
2872
- confirmationChannels: s,
2873
- snapshot: i,
2874
- operators: r,
2875
- specialties: a,
2876
- services: c,
2877
- locale: p,
2878
- mode: u,
2879
- showModify: m,
2880
- onReset: v,
2881
- onModify: b,
2882
- focusWasLost: g
2883
- }) {
2884
- const { t: o } = Y("ui"), f = E(null);
2885
- K(() => {
2886
- const l = f.current, w = document.activeElement, D = l == null ? void 0 : l.closest('[data-component="booking"]');
2887
- !t && !e || !l || (w && (D != null && D.contains(w)) || g()) && l.focus();
2888
- }, []);
2889
- const I = an(s), B = Ln(
2890
- I,
2891
- i.details.confirmationChannels
2892
- ).map(
2893
- (l) => o(`booking.confirmation.channel.${l}`)
2894
- ), N = t ? Gt(t.amountCents, t.currencyCode, p) : "", x = t ? o(
2895
- u === "demo" ? "booking.payment.paidDemo" : "booking.payment.paidBody",
2896
- { amount: N }
2897
- ) : e ? o(u === "demo" ? "booking.code.confirmedDemo" : "booking.code.confirmedBody") : u === "demo" ? o("booking.success.descriptionDemo") : B.length > 1 ? o("booking.success.descriptionMultiple", {
2898
- channels: B.join(" · ")
2899
- }) : o("booking.success.descriptionSingle", {
2900
- channel: B[0]
2901
- }), S = R(() => {
2902
- if (i.date)
2903
- try {
2904
- return new Intl.DateTimeFormat(p, {
2905
- weekday: "long",
2906
- day: "numeric",
2907
- month: "long"
2908
- }).format(Ie(i.date));
2909
- } catch {
2910
- return i.date;
2911
- }
2912
- }, [i.date, p]), O = R(() => {
2913
- const w = (i.operatorIds && i.operatorIds.length > 0 ? i.operatorIds : i.operatorId ? [i.operatorId] : []).filter((D) => D !== _e).map((D) => {
2914
- var V;
2915
- return (V = r.find((j) => j.id === D)) == null ? void 0 : V.name;
2916
- }).filter((D) => D !== void 0);
2917
- if (w.length === 0) return [];
2918
- try {
2919
- return new Intl.ListFormat(p === "en" ? "en-GB" : p, {
2920
- style: "long",
2921
- type: "conjunction"
2922
- }).formatToParts(w);
2923
- } catch {
2924
- return w.flatMap((D, V) => [
2925
- ...V > 0 ? [{ type: "literal", value: ", " }] : [],
2926
- { type: "element", value: D }
2927
- ]);
2928
- }
2929
- }, [i.operatorIds, i.operatorId, r, p]), T = i.specialtyId ? a.find((l) => l.id === i.specialtyId) : void 0, F = i.serviceId ? c.find((l) => l.id === i.serviceId) : void 0;
2930
- return /* @__PURE__ */ k(
2931
- "div",
2932
- {
2933
- "data-component": "booking-success",
2934
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
2935
- children: [
2936
- /* @__PURE__ */ k(ne, { variant: "success", children: [
2937
- /* @__PURE__ */ n(
2938
- ne.Title,
2939
- {
2940
- as: "h3",
2941
- ref: f,
2942
- tabIndex: t || e ? -1 : void 0,
2943
- className: t || e ? Mt : void 0,
2944
- children: o(
2945
- t ? u === "demo" ? "booking.payment.paidDemoTitle" : "booking.payment.paidTitle" : e ? "booking.code.confirmedHeading" : "booking.success.heading"
2946
- )
2947
- }
2948
- ),
2949
- /* @__PURE__ */ n(ne.Description, { children: x })
2950
- ] }),
2951
- /* @__PURE__ */ n("div", { className: "ds:rounded-[var(--radius-md)] ds:bg-[var(--secondary)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ k("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: [
2952
- t && u !== "demo" ? /* @__PURE__ */ k(me, { children: [
2953
- /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.payment.summaryPaid") }),
2954
- /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: N })
2955
- ] }) : null,
2956
- T ? /* @__PURE__ */ k(me, { children: [
2957
- /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summarySpecialty") }),
2958
- /* @__PURE__ */ n(
2959
- "dd",
2960
- {
2961
- dir: "auto",
2962
- className: "type-body ds:m-0 ds:text-[var(--foreground)]",
2963
- children: T.label
2964
- }
2965
- )
2966
- ] }) : null,
2967
- F ? /* @__PURE__ */ k(me, { children: [
2968
- /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryService") }),
2969
- /* @__PURE__ */ n(
2970
- "dd",
2971
- {
2972
- dir: "auto",
2973
- className: "type-body ds:m-0 ds:text-[var(--foreground)]",
2974
- children: F.label
2975
- }
2976
- )
2977
- ] }) : null,
2978
- S ? /* @__PURE__ */ k(me, { children: [
2979
- /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryDate") }),
2980
- /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: S })
2981
- ] }) : null,
2982
- /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryTime") }),
2983
- /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: i.slot.time }),
2984
- O.length > 0 ? /* @__PURE__ */ k(me, { children: [
2985
- /* @__PURE__ */ n("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: o("booking.success.summaryProvider") }),
2986
- /* @__PURE__ */ n("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: O.map(
2987
- (l, w) => l.type === "element" ? /* @__PURE__ */ n("bdi", { children: l.value }, w) : l.value
2988
- ) })
2989
- ] }) : null
2990
- ] }) }),
2991
- /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
2992
- /* @__PURE__ */ n(tt, { intent: "secondary", size: "md", onClick: v, children: o("booking.success.bookAnother") }),
2993
- m ? /* @__PURE__ */ n(tt, { intent: "ghost", size: "md", onClick: b, children: o("booking.success.modifyBooking") }) : null
2994
- ] })
2995
- ]
2996
- }
2997
- );
2998
- }
2999
- function Gn({ customSlot: e }) {
3000
- const { t } = Y("ui");
3001
- return e ? /* @__PURE__ */ n(me, { children: e }) : /* @__PURE__ */ n(
3002
- Nn,
3003
- {
3004
- variant: "no-results",
3005
- title: t("booking.emptyServices.title"),
3006
- description: t("booking.emptyServices.description")
3007
- }
3008
- );
3009
- }
3010
- const Hn = "data-booking-step-active", zi = `[${Hn}]`;
3011
- function X({
3012
- step: e,
3013
- active: t,
3014
- className: s,
3015
- id: i,
3016
- children: r
3017
- }) {
3018
- return /* @__PURE__ */ n(
3019
- "div",
3020
- {
3021
- id: i,
3022
- "data-booking-step": String(e),
3023
- ...t ? { [Hn]: "" } : null,
3024
- tabIndex: -1,
3025
- className: s ? `${s} ${Mt}` : Mt,
3026
- children: r
3027
- }
3028
- );
3029
- }
3030
- function ln(e, t) {
3031
- return t === "four-day-grid" ? e.filter((s) => s !== 6) : e;
3032
- }
3033
- function ji(e) {
3034
- const {
3035
- cascade: t,
3036
- inputs: s,
3037
- value: i,
3038
- onChange: r,
3039
- onSubmit: a,
3040
- emptyServicesSlot: c,
3041
- onboardingIncompleteSlot: p,
3042
- loadingDates: u,
3043
- loadingSlots: m,
3044
- onDateSelect: v,
3045
- onWindowChange: b,
3046
- datePickerStyle: g,
3047
- specialtyPickerStyle: o,
3048
- servicePickerStyle: f,
3049
- showServiceDuration: I,
3050
- operatorPickerStyle: y,
3051
- submitting: B,
3052
- locale: N,
3053
- detailsProps: x,
3054
- agentIdBase: S,
3055
- activeStep: O
3056
- } = e, { t: T } = Y("ui"), F = yt(O, g), l = (w, D) => ({
3057
- step: w,
3058
- active: w === F,
3059
- className: D
3060
- });
3061
- return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3062
- t.gates.insurance ? /* @__PURE__ */ n(X, { ...l(1), children: /* @__PURE__ */ n(
3063
- qn,
3064
- {
3065
- value: i.insuranceType,
3066
- onChange: (w) => r(Cn(i, w))
3067
- }
3068
- ) }) : null,
3069
- t.gates.specialty ? /* @__PURE__ */ n(X, { ...l(2), children: /* @__PURE__ */ n(
3070
- Kn,
3071
- {
3072
- specialties: t.filtered.specialties,
3073
- value: i.specialtyId,
3074
- valueIds: i.specialtyIds,
3075
- onChange: (w) => r(An(i, w)),
3076
- onChangeIds: (w) => r(Tn(i, w)),
3077
- pickerStyle: o
3078
- }
3079
- ) }) : null,
3080
- t.gates.service ? /* @__PURE__ */ n(X, { ...l(3), children: t.filtered.services.length === 0 ? /* @__PURE__ */ n(Gn, { customSlot: c }) : /* @__PURE__ */ n(
3081
- zn,
3082
- {
3083
- services: t.filtered.services,
3084
- value: i.serviceId,
3085
- valueIds: i.serviceIds,
3086
- onChange: (w) => r(On(i, w)),
3087
- onChangeIds: (w) => r(Dn(i, w)),
3088
- pickerStyle: f,
3089
- showDuration: I
3090
- }
3091
- ) }) : null,
3092
- t.gates.onboardingIncomplete ? /* @__PURE__ */ n(Un, { customSlot: p }) : null,
3093
- t.gates.operator ? /* @__PURE__ */ n(X, { ...l(4), children: /* @__PURE__ */ n(
3094
- jn,
3095
- {
3096
- operators: t.filtered.operators,
3097
- value: i.operatorId,
3098
- valueIds: i.operatorIds,
3099
- onChange: (w) => r(Mn(i, w)),
3100
- onChangeIds: (w) => r(En(i, w)),
3101
- pickerStyle: y
3102
- }
3103
- ) }) : null,
3104
- t.gates.date ? /* @__PURE__ */ k(
3105
- X,
3106
- {
3107
- ...l(5, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
3108
- children: [
3109
- /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: T("booking.date.heading") }),
3110
- s.availableDates.length === 0 && s.nextAvailableDate ? /* @__PURE__ */ n(
3111
- dn,
3112
- {
3113
- nextAvailableDate: s.nextAvailableDate,
3114
- onJump: () => r(Jt(i, s.nextAvailableDate)),
3115
- locale: N
3116
- }
3117
- ) : Vn({
3118
- inputs: s,
3119
- value: i,
3120
- onChange: r,
3121
- onDateSelect: v,
3122
- onWindowChange: b,
3123
- loadingDates: u,
3124
- loadingSlots: m,
3125
- locale: N,
3126
- datePickerStyle: g,
3127
- agentIdBase: S
3128
- })
3129
- ]
3130
- }
3131
- ) : null,
3132
- t.gates.slot && i.date && g === "month-calendar" ? /* @__PURE__ */ k(
3133
- X,
3134
- {
3135
- ...l(6, "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"),
3136
- children: [
3137
- /* @__PURE__ */ n("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: T("booking.slot.heading") }),
3138
- $n({
3139
- inputs: s,
3140
- value: i,
3141
- onChange: r,
3142
- loadingSlots: m,
3143
- locale: N,
3144
- datePickerStyle: g
3145
- })
3146
- ]
3147
- }
3148
- ) : null,
3149
- t.gates.details && t.selectedSlot ? /* @__PURE__ */ n(X, { ...l(7), children: /* @__PURE__ */ n(
3150
- cn,
3151
- {
3152
- ...x,
3153
- value: i.details ?? {},
3154
- onChange: (w) => r({ ...i, details: w }),
3155
- onSubmit: a,
3156
- submitting: B,
3157
- defaultPhoneCountry: e.policy.country
3158
- }
3159
- ) }) : null
3160
- ] });
3161
- }
3162
- function De(e, t, s = {}) {
3163
- const {
3164
- cascade: i,
3165
- inputs: r,
3166
- value: a,
3167
- onChange: c,
3168
- onSubmit: p,
3169
- emptyServicesSlot: u,
3170
- onboardingIncompleteSlot: m,
3171
- loadingDates: v,
3172
- loadingSlots: b,
3173
- onDateSelect: g,
3174
- onWindowChange: o,
3175
- datePickerStyle: f,
3176
- specialtyPickerStyle: I,
3177
- servicePickerStyle: y,
3178
- showServiceDuration: B,
3179
- operatorPickerStyle: N,
3180
- submitting: x,
3181
- locale: S,
3182
- detailsProps: O,
3183
- policy: T,
3184
- agentIdBase: F
3185
- } = t;
3186
- switch (e) {
3187
- case 1:
3188
- return /* @__PURE__ */ n(
3189
- qn,
3190
- {
3191
- value: a.insuranceType,
3192
- onChange: (l) => c(Cn(a, l))
3193
- }
3194
- );
3195
- case 2:
3196
- return /* @__PURE__ */ n(
3197
- Kn,
3198
- {
3199
- specialties: i.filtered.specialties,
3200
- value: a.specialtyId,
3201
- valueIds: a.specialtyIds,
3202
- onChange: (l) => c(An(a, l)),
3203
- onChangeIds: (l) => c(Tn(a, l)),
3204
- pickerStyle: I
3205
- }
3206
- );
3207
- case 3:
3208
- return i.filtered.services.length === 0 ? /* @__PURE__ */ n(Gn, { customSlot: u }) : i.gates.onboardingIncomplete ? /* @__PURE__ */ n(Un, { customSlot: m }) : /* @__PURE__ */ n(
3209
- zn,
3210
- {
3211
- services: i.filtered.services,
3212
- value: a.serviceId,
3213
- valueIds: a.serviceIds,
3214
- onChange: (l) => c(On(a, l)),
3215
- onChangeIds: (l) => c(Dn(a, l)),
3216
- pickerStyle: y,
3217
- compact: s.compactService,
3218
- showDuration: B
3219
- }
3220
- );
3221
- case 4:
3222
- return /* @__PURE__ */ n(
3223
- jn,
3224
- {
3225
- operators: i.filtered.operators,
3226
- value: a.operatorId,
3227
- valueIds: a.operatorIds,
3228
- onChange: (l) => c(Mn(a, l)),
3229
- onChangeIds: (l) => c(En(a, l)),
3230
- pickerStyle: N
3231
- }
3232
- );
3233
- case 5:
3234
- return r.availableDates.length === 0 && r.nextAvailableDate ? /* @__PURE__ */ n(
3235
- dn,
3236
- {
3237
- nextAvailableDate: r.nextAvailableDate,
3238
- onJump: () => c(Jt(a, r.nextAvailableDate)),
3239
- locale: S
3240
- }
3241
- ) : Vn({
3242
- inputs: r,
3243
- value: a,
3244
- onChange: c,
3245
- onDateSelect: g,
3246
- onWindowChange: o,
3247
- loadingDates: v,
3248
- loadingSlots: b,
3249
- locale: S,
3250
- datePickerStyle: f,
3251
- agentIdBase: F
3252
- });
3253
- case 6:
3254
- return $n({
3255
- inputs: r,
3256
- value: a,
3257
- onChange: c,
3258
- loadingSlots: b,
3259
- locale: S,
3260
- datePickerStyle: f
3261
- });
3262
- case 7:
3263
- return i.selectedSlot ? /* @__PURE__ */ n(
3264
- cn,
3265
- {
3266
- ...O,
3267
- value: a.details ?? {},
3268
- onChange: (l) => c({ ...a, details: l }),
3269
- onSubmit: p,
3270
- submitting: x,
3271
- defaultPhoneCountry: T.country
3272
- }
3273
- ) : null;
3274
- /* c8 ignore next 2 */
3275
- default:
3276
- return null;
3277
- }
3278
- }
3279
- function Wt() {
3280
- const { t: e } = Y("ui");
3281
- return R(
3282
- () => ({
3283
- 1: e("booking.insurance.heading"),
3284
- 2: e("booking.specialty.heading"),
3285
- 3: e("booking.service.heading"),
3286
- 4: e("booking.operator.heading"),
3287
- 5: e("booking.date.heading"),
3288
- 6: e("booking.slot.heading"),
3289
- 7: e("booking.details.heading")
3290
- }),
3291
- [e]
3292
- );
3293
- }
3294
- function yt(e, t) {
3295
- return t === "four-day-grid" && e === 6 ? 5 : e;
3296
- }
3297
- function Ui(e) {
3298
- const { cascade: t, value: s, activeStep: i, setActiveStep: r, datePickerStyle: a } = e, c = Wt(), { t: p } = Y("ui"), u = p("booking.operator.all"), m = R(
3299
- () => ln(t.visibleSteps, a),
3300
- [t.visibleSteps, a]
3301
- ), v = yt(i, a), b = Math.max(0, m.indexOf(v)), g = R(
3302
- () => m.map((o) => ({
3303
- label: c[o],
3304
- summary: Jn(o, s, t, u),
3305
- status: Gi(o, s, t),
3306
- content: /* @__PURE__ */ n(X, { step: o, active: o === v, children: De(o, e, { compactService: !0 }) })
3307
- })),
3308
- [
3309
- m,
3310
- s,
3311
- c,
3312
- t,
3313
- e,
3314
- v,
3315
- u
3316
- ]
3317
- );
3318
- return /* @__PURE__ */ n(
3319
- ds,
3320
- {
3321
- activeStep: b,
3322
- steps: g,
3323
- onStepChange: (o) => {
3324
- const f = m[o];
3325
- f && r(f);
3326
- }
3327
- }
3328
- );
3329
- }
3330
- function Gi(e, t, s) {
3331
- return Ue(e, t) && e < s.currentStep ? "completed" : e <= s.currentStep ? "unlocked" : void 0;
3332
- }
3333
- function bn(e, t) {
3334
- return e !== 4 ? Ue(e, t) : t.operatorIds && t.operatorIds.length > 0 ? !0 : Bn(t) !== void 0;
3335
- }
3336
- function tn(e, t) {
3337
- const s = e.map((i) => {
3338
- var r;
3339
- return (r = t.find((a) => a.id === i)) == null ? void 0 : r.label;
3340
- }).filter((i) => i !== void 0);
3341
- return s.length > 0 ? s.join(", ") : void 0;
3342
- }
3343
- function Jn(e, t, s, i) {
3344
- var r;
3345
- if (Ue(e, t))
3346
- switch (e) {
3347
- case 1:
3348
- return t.insuranceType;
3349
- case 2:
3350
- return tn(
3351
- nt(t),
3352
- s.filtered.specialties
3353
- );
3354
- case 3:
3355
- return tn(Ge(t), s.filtered.services);
3356
- case 4: {
3357
- const c = sn(t).filter((u) => u !== _e), p = tn(
3358
- c,
3359
- s.filtered.operators.map((u) => ({
3360
- id: u.id,
3361
- label: u.name
3362
- }))
3363
- );
3364
- return p !== void 0 ? p : c.length === 0 ? i : void 0;
3365
- }
3366
- case 5:
3367
- return t.date;
3368
- case 6:
3369
- return (r = s.selectedSlot) == null ? void 0 : r.time;
3370
- case 7:
3371
- return;
3372
- }
3373
- }
3374
- function Hi(e) {
3375
- const { cascade: t, value: s, activeStep: i, setActiveStep: r } = e, { t: a } = Y("ui"), c = Wt(), p = a("booking.operator.all"), u = `${bt()}-filter`, m = yt(i, e.datePickerStyle), v = t.visibleSteps.filter(
3376
- (o) => o === 1 || o === 2 || o === 3 || o === 4
3377
- ), b = v.some(
3378
- (o) => !Ue(o, s)
3379
- ), g = v.some(
3380
- (o) => o === i
3381
- ) ? i : v.find((o) => !Ue(o, s));
3382
- return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3383
- v.length > 0 ? /* @__PURE__ */ n(
3384
- "div",
3385
- {
3386
- role: "group",
3387
- "aria-label": a("booking.filtersLabel"),
3388
- className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
3389
- children: v.map((o) => {
3390
- const f = Jn(
3391
- o,
3392
- s,
3393
- t,
3394
- p
3395
- ), I = o === g, y = Ue(o, s);
3396
- return /* @__PURE__ */ n(
3397
- tt,
3398
- {
3399
- intent: I ? "primary" : "outline",
3400
- size: "sm",
3401
- endIcon: /* @__PURE__ */ n(
3402
- ps,
3403
- {
3404
- "aria-hidden": "true",
3405
- className: I ? "ds:rotate-180" : void 0
3406
- }
3407
- ),
3408
- "aria-expanded": y ? I : void 0,
3409
- "aria-controls": y && I ? u : void 0,
3410
- "aria-current": !y && I ? "step" : void 0,
3411
- onClick: () => r(
3412
- y && I ? t.currentStep : o
3413
- ),
3414
- children: f ? /* @__PURE__ */ k(me, { children: [
3415
- c[o],
3416
- ": ",
3417
- f
3418
- ] }) : c[o]
3419
- },
3420
- `csc-${o}`
3421
- );
3422
- })
3423
- }
3424
- ) : null,
3425
- g !== void 0 ? /* @__PURE__ */ n(
3426
- X,
3427
- {
3428
- step: g,
3429
- active: g === m,
3430
- id: u,
3431
- children: De(g, e, { compactService: !0 })
3432
- }
3433
- ) : null,
3434
- !b && t.gates.date ? (
3435
- // four-day-grid embeds slots inline with the day strip — the
3436
- // historic 2-col date|slot split collapses to a single column
3437
- // so the picker spans the full width instead of orphaning an
3438
- // empty right cell.
3439
- e.datePickerStyle === "four-day-grid" ? /* @__PURE__ */ n(X, { step: 5, active: m === 5, children: De(5, e) }) : /* @__PURE__ */ k("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
3440
- /* @__PURE__ */ n(
3441
- X,
3442
- {
3443
- step: 5,
3444
- active: m === 5,
3445
- className: "ds:min-w-0",
3446
- children: De(5, e)
3447
- }
3448
- ),
3449
- s.date ? /* @__PURE__ */ n(
3450
- X,
3451
- {
3452
- step: 6,
3453
- active: m === 6,
3454
- className: "ds:min-w-0",
3455
- children: De(6, e)
3456
- }
3457
- ) : /* @__PURE__ */ n("div", { className: "ds:min-w-0" })
3458
- ] })
3459
- ) : null,
3460
- t.gates.details ? /* @__PURE__ */ n(X, { step: 7, active: m === 7, children: De(7, e) }) : null
3461
- ] });
3462
- }
3463
- function Ji(e) {
3464
- const { cascade: t, datePickerStyle: s, activeStep: i } = e, r = yt(i, s), a = t.visibleSteps.filter(
3465
- (p) => p === 1 || p === 2 || p === 3 || p === 4
3466
- );
3467
- return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3468
- /* @__PURE__ */ k(
3469
- "div",
3470
- {
3471
- className: s === "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",
3472
- children: [
3473
- /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: a.map((p) => /* @__PURE__ */ n(X, { step: p, active: p === r, children: De(p, e, { compactService: !0 }) }, `fbf-${p}`)) }),
3474
- /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3475
- t.gates.date ? /* @__PURE__ */ n(X, { step: 5, active: r === 5, children: De(5, e) }) : null,
3476
- t.gates.slot && e.value.date && s === "month-calendar" ? /* @__PURE__ */ n(X, { step: 6, active: r === 6, children: De(6, e) }) : null
3477
- ] })
3478
- ]
3479
- }
3480
- ),
3481
- t.gates.details ? /* @__PURE__ */ n(X, { step: 7, active: r === 7, children: De(7, e) }) : null
3482
- ] });
3483
- }
3484
- function Wi(e) {
3485
- const { cascade: t, value: s, activeStep: i, setActiveStep: r, datePickerStyle: a } = e, { t: c } = Y("ui"), p = Wt(), u = R(
3486
- () => ln(t.visibleSteps, a),
3487
- [t.visibleSteps, a]
3488
- ), m = yt(i, a), v = Math.max(0, u.indexOf(m)), b = u.length, g = R(
3489
- () => u.map((y) => ({ label: p[y] })),
3490
- [u, p]
3491
- ), o = v > 0, f = m === 5 && a === "four-day-grid", I = v < b - 1 && Ue(m, s) && (!f || Ue(6, s));
3492
- return /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
3493
- /* @__PURE__ */ n(ls, { activeStep: v, steps: g }),
3494
- /* @__PURE__ */ n(X, { step: m, active: !0, children: De(m, e, { compactService: !0 }) }),
3495
- /* @__PURE__ */ k("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
3496
- /* @__PURE__ */ n(
3497
- tt,
3498
- {
3499
- intent: "ghost",
3500
- size: "md",
3501
- disabled: !o,
3502
- onClick: () => {
3503
- const y = u[v - 1];
3504
- y && r(y);
3505
- },
3506
- children: c("booking.actions.back")
3507
- }
3508
- ),
3509
- m < 7 ? /* @__PURE__ */ n(
3510
- tt,
3511
- {
3512
- intent: "primary",
3513
- size: "md",
3514
- disabled: !I,
3515
- onClick: () => {
3516
- const y = u[v + 1];
3517
- y && r(y);
3518
- },
3519
- children: c("booking.actions.next")
3520
- }
3521
- ) : null
3522
- ] })
3523
- ] });
3524
- }
3525
- const Yi = [], Zi = [];
3526
- function yn() {
3527
- return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
3528
- }
3529
- const Qi = kn(
3530
- ({
3531
- variant: e = "inline-list",
3532
- country: t,
3533
- // No default — the cascade engine treats `undefined` as "auto-on
3534
- // when `specialties` has items" so consumers who pass specialty
3535
- // data without the explicit flag still get the step.
3536
- useSpecialties: s,
3537
- allowOperatorSelection: i = !1,
3538
- lockedOperatorId: r,
3539
- operatorsByService: a = !1,
3540
- autoSelectSingleService: c = !1,
3541
- specialties: p,
3542
- services: u,
3543
- operators: m,
3544
- availableDates: v,
3545
- availableSlots: b,
3546
- nextAvailableDate: g,
3547
- hideEmail: o = !1,
3548
- emailOptional: f = !1,
3549
- requireCodiceFiscale: I,
3550
- requireDateOfBirth: y,
3551
- requireInsuranceNumber: B,
3552
- billingInDetails: N = !1,
3553
- paymentNoticeStyle: x = "highlighted",
3554
- showNote: S,
3555
- showReturningPatientFlag: O,
3556
- privacyPolicyUrl: T,
3557
- termsUrl: F,
3558
- practiceConsent: l,
3559
- paymentTermsUrl: w,
3560
- paymentState: D,
3561
- renderPayment: V,
3562
- renderPaymentCompletion: j,
3563
- validateCodiceFiscale: Z,
3564
- validateInsuranceNumber: h,
3565
- confirmationChannels: ee,
3566
- defaultConfirmationChannels: H,
3567
- singleConfirmationChannel: Pe,
3568
- value: M,
3569
- onChange: J,
3570
- onSubmit: we,
3571
- codeStep: fe,
3572
- onStepChange: W,
3573
- onDateSelect: Ve,
3574
- onWindowChange: ct,
3575
- datePickerStyle: ge = "month-calendar",
3576
- specialtyPickerStyle: se,
3577
- servicePickerStyle: ce,
3578
- showServiceDuration: Ce = !0,
3579
- operatorPickerStyle: Ae,
3580
- loadingDates: Ee,
3581
- loadingSlots: re,
3582
- submitting: Fe,
3583
- submitError: de,
3584
- mode: he = "live",
3585
- showModifyOnSuccess: Te = !0,
3586
- surface: $e = "flat",
3587
- emptyServicesSlot: He,
3588
- onboardingIncompleteSlot: q,
3589
- "aria-label": qe,
3590
- id: st,
3591
- className: Ft,
3592
- onFocus: dt,
3593
- onBlur: lt,
3594
- ...ut
3595
- }, Be) => {
3596
- var _t, Tt, Ot;
3597
- const { t: le, i18n: Bt } = Y("ui"), ve = e ?? "inline-list", Je = Bt.language ?? "en", ke = p ?? Yi, We = m ?? Zi;
3598
- K(() => {
3599
- const C = si(M, {
3600
- useSpecialties: s,
3601
- lockedOperatorId: r,
3602
- autoSelectSingleService: c,
3603
- specialties: ke,
3604
- services: u
3605
- });
3606
- (C.specialtyId !== M.specialtyId || C.operatorId !== M.operatorId || C.serviceId !== M.serviceId) && J(C);
3607
- }, [
3608
- r,
3609
- s,
3610
- c,
3611
- ke,
3612
- u
3613
- ]);
3614
- const _ = R(
3615
- () => ni({
3616
- country: t,
3617
- useSpecialties: s,
3618
- allowOperatorSelection: i,
3619
- lockedOperatorId: r,
3620
- operatorsByService: a,
3621
- specialties: ke,
3622
- services: u,
3623
- operators: We,
3624
- availableSlots: b,
3625
- value: M
3626
- }),
3627
- [
3628
- t,
3629
- s,
3630
- i,
3631
- r,
3632
- a,
3633
- c,
3634
- ke,
3635
- u,
3636
- We,
3637
- v,
3638
- b,
3639
- M
3640
- ]
3641
- ), Se = R(
3642
- () => [
3643
- JSON.stringify(M.insuranceType),
3644
- JSON.stringify(nt(M)),
3645
- JSON.stringify(Ge(M)),
3646
- JSON.stringify(sn(M)),
3647
- JSON.stringify(M.date),
3648
- JSON.stringify(M.slotKey)
3649
- ],
3650
- [M]
3651
- ), pt = ve === "progress", kt = Ne(
3652
- (C) => {
3653
- if (C === 4 && _.visibleSteps.includes(4) && sn(M).length === 0)
3654
- return Math.min(4, _.currentStep);
3655
- if (!pt) return _.currentStep;
3656
- const L = _.visibleSteps.find(
3657
- (P) => P > C && !bn(P, M)
3658
- );
3659
- return L === void 0 ? _.currentStep : Math.min(L, _.currentStep);
3660
- },
3661
- [pt, _.visibleSteps, _.currentStep, M]
3662
- ), [oe, xe] = G(
3663
- _.currentStep
3664
- ), St = E(Se), Ye = E(_.visibleSteps);
3665
- K(() => {
3666
- const C = St.current, L = Ye.current;
3667
- St.current = Se, Ye.current = _.visibleSteps;
3668
- const P = Se.findIndex(
3669
- (ae, d) => ae !== C[d]
3670
- );
3671
- if (P !== -1) {
3672
- xe(kt(P + 1));
3673
- return;
3674
- }
3675
- const Q = pt ? _.visibleSteps.find(
3676
- (ae) => ae < oe && !L.includes(ae) && !bn(ae, M)
3677
- ) : void 0;
3678
- if (Q !== void 0) {
3679
- xe(Q);
3680
- return;
3681
- }
3682
- _.visibleSteps.includes(oe) || xe(_.currentStep);
3683
- }, [
3684
- Se,
3685
- kt,
3686
- pt,
3687
- _.currentStep,
3688
- _.visibleSteps,
3689
- oe,
3690
- M
3691
- ]);
3692
- const ue = E(null), it = R(
3693
- () => ln(_.visibleSteps, ge),
3694
- [_.visibleSteps, ge]
3695
- ), Ze = Wt(), [Yt, Le] = G(""), be = E(null), rt = E(null);
3696
- K(() => {
3697
- const C = yt(oe, ge);
3698
- if (rt.current === null) {
3699
- rt.current = C;
3700
- return;
3701
- }
3702
- if (rt.current === C) return;
3703
- rt.current = C;
3704
- const L = it.indexOf(C);
3705
- Le(
3706
- L === -1 ? "" : le("booking.stepAnnouncement", {
3707
- current: L + 1,
3708
- total: it.length,
3709
- label: Ze[C]
3710
- })
3711
- );
3712
- const P = be.current;
3713
- if (!P || P.isConnected) return;
3714
- const Q = ue.current;
3715
- if (!Q) return;
3716
- const ae = document.activeElement;
3717
- if (!(ae === null || ae === document.body || !Q.contains(ae))) return;
3718
- const A = Q.querySelector(zi) ?? Q;
3719
- if (A.focus({ preventScroll: !0 }), typeof A.scrollIntoView == "function")
3720
- try {
3721
- A.scrollIntoView({
3722
- behavior: yn() ? "auto" : "smooth",
3723
- block: "nearest"
3724
- });
3725
- } catch {
3726
- A.scrollIntoView();
3727
- }
3728
- }, [oe, ge, it, Ze, le]);
3729
- const $ = Ai({
3730
- services: u,
3731
- value: M,
3732
- availableSlots: b,
3733
- onSubmit: we,
3734
- onChange: J,
3735
- paymentState: D,
3736
- submitting: Fe,
3737
- paymentTermsUrl: w,
3738
- renderPayment: V,
3739
- codeStep: fe
3740
- }), U = $.status, Lt = $.submit, ot = E($.reset);
3741
- ot.current = $.reset;
3742
- const xt = bt(), It = E(null), Nt = E(null), wt = ((_t = $.state) == null ? void 0 : _t.status) === "failed", Qe = $.state && "phase" in $.state && $.state.phase === "completion";
3743
- K(() => {
3744
- var C, L;
3745
- if (U === "payment") {
3746
- const P = document.activeElement;
3747
- (!Qe || !P || P === document.body || !((C = ue.current) != null && C.contains(P))) && ((L = It.current) == null || L.focus());
3748
- }
3749
- }, [U, Qe]), K(() => {
3750
- var C;
3751
- U === "payment" && wt && ((C = Nt.current) == null || C.focus());
3752
- }, [U, wt]), Yn(Be, () => ue.current, []);
3753
- const Ke = U === "success" ? 8 : U === "payment" || U === "code" ? 7 : _.currentStep, mt = E(null);
3754
- K(() => {
3755
- if (Ke !== mt.current && (mt.current = Ke, W == null || W(Ke), Ke === 8 && ue.current))
3756
- try {
3757
- ue.current.scrollIntoView({
3758
- behavior: yn() ? "auto" : "smooth",
3759
- block: "start"
3760
- });
3761
- } catch {
3762
- ue.current.scrollIntoView();
3763
- }
3764
- }, [Ke, W]);
3765
- const Xe = E({ activeStep: oe, cascade: _, submitState: U });
3766
- K(() => {
3767
- Xe.current = { activeStep: oe, cascade: _, submitState: U };
3768
- }, [oe, _, U]);
3769
- const ft = R(
3770
- () => ({
3771
- getVariant: () => ve,
3772
- getCurrentStep: () => {
3773
- const C = Xe.current;
3774
- return C.submitState === "success" ? 8 : C.submitState === "payment" || C.submitState === "code" ? 7 : C.activeStep;
3775
- },
3776
- reset: () => {
3777
- Xe.current.submitState === "payment" || Xe.current.submitState === "code" || (J({}), ot.current(), xe(1));
3778
- },
3779
- goToStep: (C) => {
3780
- const L = Xe.current, P = L.cascade.visibleSteps.includes(C), Q = L.cascade.currentStep, ae = L.submitState === "payment" || L.submitState === "code" ? 7 : !P || C > Q ? Q : C;
3781
- Xe.current = { ...L, activeStep: ae }, xe(ae);
3782
- }
3783
- }),
3784
- [ve, J]
3785
- );
3786
- Zn(Ws, ft, st);
3787
- const Rt = qe ?? le("booking.regionLabel"), Oe = $.snapshot, Zt = U === "success" && Oe ? /* @__PURE__ */ n(
3788
- Ki,
3789
- {
3790
- codeVerified: $.codeVerified,
3791
- payment: Oe.payment,
3792
- confirmationChannels: ee,
3793
- snapshot: {
3794
- ...Oe.value,
3795
- slot: Oe.slot,
3796
- details: Oe.details,
3797
- serviceId: ((Tt = Oe.payment) == null ? void 0 : Tt.serviceId) ?? Oe.slot.serviceId ?? Oe.value.serviceId
3798
- },
3799
- operators: We,
3800
- specialties: ke,
3801
- services: u,
3802
- locale: Je,
3803
- mode: he,
3804
- showModify: Te && !Oe.payment && !$.codeVerified,
3805
- onReset: () => ft.reset(),
3806
- focusWasLost: () => {
3807
- const C = be.current, L = document.activeElement;
3808
- return !!(C && !C.isConnected) && (!L || L === document.body);
3809
- },
3810
- onModify: () => {
3811
- ot.current(), xe(7);
3812
- }
3813
- }
3814
- ) : null, Qt = U === "code" && $.codeStep ? /* @__PURE__ */ n(
3815
- Ni,
3816
- {
3817
- ...$.codeStep,
3818
- ...fe,
3819
- onVerified: $.completeCode
3820
- }
3821
- ) : null, Ct = $.activeSession, Re = $.state, ye = Ct && Re ? {
3822
- session: Ct,
3823
- payment: Ct.payment,
3824
- state: Re,
3825
- billing: (Ot = $.snapshot) == null ? void 0 : Ot.details.billing
3826
- } : void 0, et = Re && "phase" in Re && Re.phase === "completion", ie = U === "payment" && ye ? /* @__PURE__ */ k(
3827
- "section",
3828
- {
3829
- "aria-labelledby": xt,
3830
- "data-component": "booking-payment",
3831
- "data-payment-status": ye.state.status,
3832
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
3833
- children: [
3834
- /* @__PURE__ */ n(
3835
- "h3",
3836
- {
3837
- ref: It,
3838
- id: xt,
3839
- tabIndex: -1,
3840
- className: "type-title-card ds:m-0",
3841
- children: le(
3842
- et ? "booking.payment.confirming" : "booking.payment.heading"
3843
- )
3844
- }
3845
- ),
3846
- et ? null : /* @__PURE__ */ n("p", { className: "type-body ds:m-0", children: le("booking.payment.noticeBody", {
3847
- amount: Gt(
3848
- ye.payment.amountCents,
3849
- ye.payment.currencyCode,
3850
- Je
3851
- )
3852
- }) }),
3853
- /* @__PURE__ */ n(
3854
- "p",
3855
- {
3856
- role: "status",
3857
- className: ye.state.status === "processing" ? "type-body ds:m-0 ds:flex ds:items-center ds:gap-[var(--spacing-sm)]" : "ds:sr-only",
3858
- children: ye.state.status === "processing" ? /* @__PURE__ */ k(me, { children: [
3859
- /* @__PURE__ */ n(xn, { variant: "pulse", size: "lg", "aria-hidden": "true" }),
3860
- /* @__PURE__ */ n("span", { children: le(
3861
- et ? "booking.payment.confirming" : "booking.payment.processing"
3862
- ) })
3863
- ] }) : null
3864
- }
3865
- ),
3866
- ye.state.status === "failed" ? /* @__PURE__ */ n(
3867
- ne,
3868
- {
3869
- ref: Nt,
3870
- variant: "error",
3871
- tabIndex: -1,
3872
- className: Mt,
3873
- children: /* @__PURE__ */ n(ne.Description, { children: ye.state.error ?? le(
3874
- et ? "booking.payment.completionFailed" : "booking.payment.failed"
3875
- ) })
3876
- }
3877
- ) : null,
3878
- et ? j == null ? void 0 : j(ye) : V == null ? void 0 : V(ye)
3879
- ]
3880
- }
3881
- ) : null, At = R(() => {
3882
- const C = new Set(Ge(M)), L = u.filter((P) => C.has(P.id)).map((P) => {
3883
- var Q;
3884
- return {
3885
- label: P.label,
3886
- text: ((Q = P.criticalInformationToAccept) == null ? void 0 : Q.trim()) ?? ""
3887
- };
3888
- }).filter((P) => P.text.length > 0);
3889
- if (L.length !== 0)
3890
- return L.length === 1 ? L[0].text : L.map((P) => `${P.label}: ${P.text}`).join(`
3891
-
3892
- `);
3893
- }, [u, M]), pe = R(() => {
3894
- if (U === "success" || U === "payment" || U === "code")
3895
- return null;
3896
- const C = ve === "accordion" ? Ui : ve === "calendar" ? Hi : ve === "flexible" ? Ji : ve === "progress" ? Wi : ji, L = {
3897
- cascade: _,
3898
- inputs: {
3899
- specialties: ke,
3900
- services: u,
3901
- operators: We,
3902
- availableDates: v,
3903
- availableSlots: b,
3904
- nextAvailableDate: g
3905
- },
3906
- value: M,
3907
- onChange: J,
3908
- onSubmit: Lt,
3909
- policy: { country: t, lockedOperatorId: r },
3910
- detailsProps: {
3911
- hideEmail: o,
3912
- emailOptional: f,
3913
- requireCodiceFiscale: I,
3914
- requireDateOfBirth: y,
3915
- requireInsuranceNumber: B,
3916
- insuranceType: M.insuranceType,
3917
- showNote: S,
3918
- showReturningPatientFlag: O,
3919
- privacyPolicyUrl: T,
3920
- termsUrl: F,
3921
- practiceConsent: l,
3922
- criticalInformationToAccept: At,
3923
- payment: $.payment,
3924
- paymentTermsUrl: w,
3925
- paymentBlocked: $.blocked,
3926
- billingInDetails: N,
3927
- paymentNoticeStyle: x,
3928
- validateCodiceFiscale: Z,
3929
- validateInsuranceNumber: h,
3930
- confirmationChannels: ee,
3931
- defaultConfirmationChannels: H,
3932
- singleConfirmationChannel: Pe,
3933
- submitError: de ?? (U === "error" ? le("booking.payment.submitFailed") : void 0)
3934
- },
3935
- emptyServicesSlot: He,
3936
- onboardingIncompleteSlot: q,
3937
- loadingDates: Ee,
3938
- loadingSlots: re,
3939
- onDateSelect: Ve,
3940
- onWindowChange: ct,
3941
- datePickerStyle: ge,
3942
- specialtyPickerStyle: se,
3943
- servicePickerStyle: ce,
3944
- showServiceDuration: Ce,
3945
- operatorPickerStyle: Ae,
3946
- submitting: Fe || U === "submitting",
3947
- locale: Je,
3948
- activeStep: oe,
3949
- setActiveStep: xe,
3950
- agentIdBase: st
3951
- };
3952
- return /* @__PURE__ */ n(C, { ...L });
3953
- }, [
3954
- U,
3955
- $.payment,
3956
- $.blocked,
3957
- w,
3958
- le,
3959
- ve,
3960
- _,
3961
- ke,
3962
- u,
3963
- We,
3964
- v,
3965
- b,
3966
- g,
3967
- M,
3968
- J,
3969
- Lt,
3970
- t,
3971
- r,
3972
- o,
3973
- f,
3974
- I,
3975
- y,
3976
- B,
3977
- N,
3978
- x,
3979
- de,
3980
- S,
3981
- O,
3982
- T,
3983
- F,
3984
- l,
3985
- At,
3986
- Z,
3987
- h,
3988
- ee,
3989
- H,
3990
- Pe,
3991
- He,
3992
- q,
3993
- Ee,
3994
- re,
3995
- Ve,
3996
- ct,
3997
- ge,
3998
- se,
3999
- ce,
4000
- Ce,
4001
- Ae,
4002
- Fe,
4003
- Je,
4004
- oe,
4005
- st
4006
- ]);
4007
- return /* @__PURE__ */ k(
4008
- "div",
4009
- {
4010
- ref: ue,
4011
- role: "region",
4012
- "aria-label": Rt,
4013
- id: st,
4014
- "data-component": "booking",
4015
- "data-component-id": st,
4016
- "data-variant": ve,
4017
- className: Ti({
4018
- variant: ve,
4019
- surface: $e,
4020
- className: Ft
4021
- }),
4022
- tabIndex: -1,
4023
- onFocus: (C) => {
4024
- be.current = C.target, dt == null || dt(C);
4025
- },
4026
- onBlur: (C) => {
4027
- const L = C.target;
4028
- window.setTimeout(() => {
4029
- var Q;
4030
- const P = document.activeElement;
4031
- be.current === L && L.isConnected && !(P && ((Q = ue.current) != null && Q.contains(P))) && (be.current = null);
4032
- }), lt == null || lt(C);
4033
- },
4034
- ...ut,
4035
- children: [
4036
- /* @__PURE__ */ n("div", { role: "status", className: "ds:sr-only", children: Yt }),
4037
- /* @__PURE__ */ k(
4038
- "div",
4039
- {
4040
- className: [
4041
- "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
4042
- "ds:rounded-[var(--radius-md)]",
4043
- "ds:bg-[color-mix(in_srgb,var(--primary)_35%,var(--background))]",
4044
- "ds:bg-[image:var(--gradient-hero-brand)]",
4045
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
4046
- "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]"
4047
- ].join(" "),
4048
- children: [
4049
- /* @__PURE__ */ n("h2", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: le("booking.regionLabel") }),
4050
- /* @__PURE__ */ n("p", { className: "type-body-sm ds:text-[var(--foreground)] ds:m-0", children: le("booking.headingSubtitle") })
4051
- ]
4052
- }
4053
- ),
4054
- $.cancelled ? /* @__PURE__ */ n(ne, { variant: "info", children: /* @__PURE__ */ n(ne.Description, { children: le("booking.payment.cancelled") }) }) : null,
4055
- Zt ?? Qt ?? ie ?? pe
4056
- ]
4057
- }
4058
- );
4059
- }
4060
- );
4061
- Qi.displayName = "Booking";
4062
- export {
4063
- Qi as B,
4064
- nn as C,
4065
- _e as O,
4066
- Ws as b
4067
- };
4068
- //# sourceMappingURL=booking-By4I_1A-.js.map