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