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