@alfadocs/ui-kit 0.25.2 → 0.30.1

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 (86) hide show
  1. package/dist/_chunks/booking-Bw9eOU4k.js +2292 -0
  2. package/dist/_chunks/{calendar-9eOXumpH.js → calendar-WWNx448i.js} +10 -9
  3. package/dist/_chunks/{contact-card-CeEfEAxh.js → contact-card-DYbp--s-.js} +2 -2
  4. package/dist/_chunks/{header-B8V_sNPy.js → header-CkMb1TZS.js} +23 -23
  5. package/dist/_chunks/heart-pulse-CvuyFKHB.js +21 -0
  6. package/dist/_chunks/{link-DmM5IevO.js → link-DrD_cRUg.js} +50 -45
  7. package/dist/_chunks/parseISO-Dk4xa7q6.js +120 -0
  8. package/dist/_chunks/patient-search-DuSoGG2t.js +1113 -0
  9. package/dist/_chunks/{patient-shell-Bq8CjRYF.js → patient-shell-CAXYzbRw.js} +2 -2
  10. package/dist/_chunks/public-footer.agent-DivkKdG4.js +537 -0
  11. package/dist/_chunks/reviews-panel-CFttsfuC.js +513 -0
  12. package/dist/_chunks/slot-grid-B2zprPcv.js +387 -0
  13. package/dist/_chunks/stethoscope-DT5qCW8Y.js +18 -0
  14. package/dist/agent-catalog.json +117 -22
  15. package/dist/components/booking/booking-types.d.ts +167 -0
  16. package/dist/components/booking/booking.agent.d.ts +1 -1
  17. package/dist/components/booking/booking.d.ts +4 -89
  18. package/dist/components/booking/cascade.d.ts +96 -0
  19. package/dist/components/booking/details-form.d.ts +39 -0
  20. package/dist/components/booking/index.d.ts +2 -1
  21. package/dist/components/booking/index.js +5 -3
  22. package/dist/components/calendar/index.js +1 -1
  23. package/dist/components/checkbox/checkbox.d.ts +6 -2
  24. package/dist/components/contact-card/index.js +1 -1
  25. package/dist/components/header/index.js +1 -1
  26. package/dist/components/index.d.ts +3 -0
  27. package/dist/components/link/index.js +1 -1
  28. package/dist/components/link/link.d.ts +7 -0
  29. package/dist/components/patient-search/index.d.ts +4 -0
  30. package/dist/components/patient-search/index.js +6 -0
  31. package/dist/components/patient-search/patient-search.agent.d.ts +4 -0
  32. package/dist/components/patient-search/patient-search.d.ts +112 -0
  33. package/dist/components/public-footer/index.d.ts +6 -0
  34. package/dist/components/public-footer/index.js +10 -0
  35. package/dist/components/public-footer/legal-urls.d.ts +18 -0
  36. package/dist/components/public-footer/public-footer.agent.d.ts +4 -0
  37. package/dist/components/public-footer/public-footer.d.ts +58 -0
  38. package/dist/components/public-footer/socials.d.ts +9 -0
  39. package/dist/components/reviews-panel/index.d.ts +4 -0
  40. package/dist/components/reviews-panel/index.js +6 -0
  41. package/dist/components/reviews-panel/reviews-panel.agent.d.ts +4 -0
  42. package/dist/components/reviews-panel/reviews-panel.d.ts +76 -0
  43. package/dist/components/slot-grid/index.js +1 -1
  44. package/dist/i18n/config.js +3994 -38
  45. package/dist/i18n/locales/ar.d.ts +221 -0
  46. package/dist/i18n/locales/de.d.ts +221 -0
  47. package/dist/i18n/locales/el.d.ts +221 -0
  48. package/dist/i18n/locales/es.d.ts +221 -0
  49. package/dist/i18n/locales/fr.d.ts +221 -0
  50. package/dist/i18n/locales/hi.d.ts +221 -0
  51. package/dist/i18n/locales/ja.d.ts +221 -0
  52. package/dist/i18n/locales/nl.d.ts +221 -0
  53. package/dist/i18n/locales/pl.d.ts +221 -0
  54. package/dist/i18n/locales/pt.d.ts +221 -0
  55. package/dist/i18n/locales/ro.d.ts +221 -0
  56. package/dist/i18n/locales/ru.d.ts +221 -0
  57. package/dist/i18n/locales/sq.d.ts +221 -0
  58. package/dist/i18n/locales/sv.d.ts +221 -0
  59. package/dist/i18n/locales/tr.d.ts +221 -0
  60. package/dist/i18n/locales/zh.d.ts +221 -0
  61. package/dist/i18n/resources.d.ts +442 -0
  62. package/dist/index.js +351 -336
  63. package/dist/locales/ar.json +222 -1
  64. package/dist/locales/de.json +222 -1
  65. package/dist/locales/el.json +222 -1
  66. package/dist/locales/en.json +222 -1
  67. package/dist/locales/es.json +222 -1
  68. package/dist/locales/fr.json +222 -1
  69. package/dist/locales/hi.json +222 -1
  70. package/dist/locales/it.json +222 -1
  71. package/dist/locales/ja.json +222 -1
  72. package/dist/locales/nl.json +222 -1
  73. package/dist/locales/pl.json +222 -1
  74. package/dist/locales/pt.json +222 -1
  75. package/dist/locales/ro.json +222 -1
  76. package/dist/locales/ru.json +222 -1
  77. package/dist/locales/sq.json +222 -1
  78. package/dist/locales/sv.json +222 -1
  79. package/dist/locales/tr.json +222 -1
  80. package/dist/locales/zh.json +222 -1
  81. package/dist/patterns/patient-shell/index.js +1 -1
  82. package/dist/tokens.css +1 -1
  83. package/package.json +17 -1
  84. package/dist/_chunks/booking-CXngC-1u.js +0 -1743
  85. package/dist/_chunks/slot-grid-DoodeQGZ.js +0 -502
  86. package/dist/_chunks/stethoscope-B8kpbtjh.js +0 -35
@@ -0,0 +1,2292 @@
1
+ import { jsxs as f, jsx as a, Fragment as Z } from "react/jsx-runtime";
2
+ import { forwardRef as ze, useId as $e, useState as q, useCallback as te, useRef as de, useEffect as re, useMemo as w, useImperativeHandle as lt } from "react";
3
+ import { c as xe } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as T, Trans as ct } from "react-i18next";
5
+ import { u as mt } from "./registry-C9nwlNyL.js";
6
+ import { A as F } from "./alert-ywPR59NE.js";
7
+ import { B as ae } from "./button-DD_0Xdmr.js";
8
+ import { C as Me } from "./checkbox-mwbrPZDY.js";
9
+ import { C as ut } from "./checkbox-group-Bwmt1ovQ.js";
10
+ import { D as pt } from "./date-picker-D0Ry1dMz.js";
11
+ import { E as gt } from "./email-input-DvJ_kPKL.js";
12
+ import { F as Y } from "./form-field-BOm9hK35.js";
13
+ import { P as ft } from "./phone-input-DKSHX7NQ.js";
14
+ import { T as ht } from "./text-area-D5GAe8pV.js";
15
+ import { T as fe } from "./text-input-CakysYnD.js";
16
+ import { S as vt } from "./spinner-CCByyvcb.js";
17
+ import { I as Pe } from "./icon-button-BRHSSFmZ.js";
18
+ import { S as Se } from "./select-C92AT_OZ.js";
19
+ import { S as ye } from "./skeleton-CZbwyJAA.js";
20
+ import { E as Ke } from "./empty-state-BLy7tigq.js";
21
+ import { S as bt } from "./stepper-accordion-BfS6lUB9.js";
22
+ import { S as yt } from "./stepper-progress-jFY8BSf7.js";
23
+ import { p as ee } from "./parseISO-Dk4xa7q6.js";
24
+ import { o as je, f as ue, d as kt, h as be, q as he } from "./react-day-picker-D3yzgvDB.js";
25
+ import { C as xt } from "./chevron-left-CX1jqD2M.js";
26
+ import { C as St } from "./chevron-right-BrpYejk0.js";
27
+ import { i as Le } from "./isSameDay-DHG8Xade.js";
28
+ import { c as B } from "./createLucideIcon-CrFbzy84.js";
29
+ import { M as Nt, S as It } from "./sun-BuXE0xUS.js";
30
+ import { S as wt } from "./stethoscope-DT5qCW8Y.js";
31
+ import { H as Ct } from "./heart-pulse-CvuyFKHB.js";
32
+ import { E as Mt } from "./eye-LHlSU38h.js";
33
+ import { S as Dt } from "./sparkles-CuYXqQLg.js";
34
+ /**
35
+ * @license lucide-react v1.8.0 - ISC
36
+ *
37
+ * This source code is licensed under the ISC license.
38
+ * See the LICENSE file in the root directory of this source tree.
39
+ */
40
+ const Tt = [
41
+ [
42
+ "path",
43
+ {
44
+ 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",
45
+ key: "169zse"
46
+ }
47
+ ]
48
+ ], _t = B("activity", Tt);
49
+ /**
50
+ * @license lucide-react v1.8.0 - ISC
51
+ *
52
+ * This source code is licensed under the ISC license.
53
+ * See the LICENSE file in the root directory of this source tree.
54
+ */
55
+ const At = [
56
+ ["path", { d: "M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5", key: "1u7htd" }],
57
+ ["path", { d: "M15 12h.01", key: "1k8ypt" }],
58
+ [
59
+ "path",
60
+ {
61
+ d: "M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",
62
+ key: "11xh7x"
63
+ }
64
+ ],
65
+ ["path", { d: "M9 12h.01", key: "157uk2" }]
66
+ ], Bt = B("baby", At);
67
+ /**
68
+ * @license lucide-react v1.8.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 Ot = [
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
+ ], Et = B("bone", Ot);
82
+ /**
83
+ * @license lucide-react v1.8.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 Pt = [
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
+ ], Lt = B("brain", Pt);
98
+ /**
99
+ * @license lucide-react v1.8.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 Vt = [
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
+ ], Ft = B("calendar-range", Vt);
114
+ /**
115
+ * @license lucide-react v1.8.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 Rt = [
121
+ ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
122
+ [
123
+ "path",
124
+ {
125
+ d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
126
+ key: "116196"
127
+ }
128
+ ],
129
+ ["path", { d: "m9 14 2 2 4-4", key: "df797q" }]
130
+ ], zt = B("clipboard-check", Rt);
131
+ /**
132
+ * @license lucide-react v1.8.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */
137
+ const $t = [
138
+ ["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" }],
139
+ ["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
140
+ ], Kt = B("ear", $t);
141
+ /**
142
+ * @license lucide-react v1.8.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */
147
+ const jt = [
148
+ ["path", { d: "M6 18h8", key: "1borvv" }],
149
+ ["path", { d: "M3 22h18", key: "8prr45" }],
150
+ ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
151
+ ["path", { d: "M9 14h2", key: "197e7h" }],
152
+ ["path", { d: "M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z", key: "1bmzmy" }],
153
+ ["path", { d: "M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3", key: "1drr47" }]
154
+ ], qt = B("microscope", jt);
155
+ /**
156
+ * @license lucide-react v1.8.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */
161
+ const Ht = [
162
+ [
163
+ "path",
164
+ { 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" }
165
+ ],
166
+ ["path", { d: "m8.5 8.5 7 7", key: "rvfmvr" }]
167
+ ], Gt = B("pill", Ht);
168
+ /**
169
+ * @license lucide-react v1.8.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */
174
+ const Ut = [
175
+ ["path", { d: "M3 7V5a2 2 0 0 1 2-2h2", key: "aa7l1z" }],
176
+ ["path", { d: "M17 3h2a2 2 0 0 1 2 2v2", key: "4qcy5o" }],
177
+ ["path", { d: "M21 17v2a2 2 0 0 1-2 2h-2", key: "6vwrx8" }],
178
+ ["path", { d: "M7 21H5a2 2 0 0 1-2-2v-2", key: "ioqczr" }],
179
+ ["path", { d: "M7 12h10", key: "b7w52i" }]
180
+ ], Yt = B("scan-line", Ut);
181
+ /**
182
+ * @license lucide-react v1.8.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */
187
+ const Zt = [
188
+ ["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
189
+ ["path", { d: "M8.12 8.12 12 12", key: "1alkpv" }],
190
+ ["path", { d: "M20 4 8.12 15.88", key: "xgtan2" }],
191
+ ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
192
+ ["path", { d: "M14.8 14.8 20 20", key: "ptml3r" }]
193
+ ], Jt = B("scissors", Zt);
194
+ /**
195
+ * @license lucide-react v1.8.0 - ISC
196
+ *
197
+ * This source code is licensed under the ISC license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */
200
+ const Xt = [
201
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
202
+ ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
203
+ ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
204
+ ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
205
+ ], Wt = B("smile", Xt);
206
+ /**
207
+ * @license lucide-react v1.8.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */
212
+ const Qt = [
213
+ ["path", { d: "M12 10V2", key: "16sf7g" }],
214
+ ["path", { d: "m4.93 10.93 1.41 1.41", key: "2a7f42" }],
215
+ ["path", { d: "M2 18h2", key: "j10viu" }],
216
+ ["path", { d: "M20 18h2", key: "wocana" }],
217
+ ["path", { d: "m19.07 10.93-1.41 1.41", key: "15zs5n" }],
218
+ ["path", { d: "M22 22H2", key: "19qnx5" }],
219
+ ["path", { d: "m16 6-4 4-4-4", key: "6wukr" }],
220
+ ["path", { d: "M16 18a4 4 0 0 0-8 0", key: "1lzouq" }]
221
+ ], ea = B("sunset", Qt);
222
+ /**
223
+ * @license lucide-react v1.8.0 - ISC
224
+ *
225
+ * This source code is licensed under the ISC license.
226
+ * See the LICENSE file in the root directory of this source tree.
227
+ */
228
+ const ta = [
229
+ ["path", { d: "m18 2 4 4", key: "22kx64" }],
230
+ ["path", { d: "m17 7 3-3", key: "1w1zoj" }],
231
+ ["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" }],
232
+ ["path", { d: "m9 11 4 4", key: "rovt3i" }],
233
+ ["path", { d: "m5 19-3 3", key: "59f2uf" }],
234
+ ["path", { d: "m14 4 6 6", key: "yqp9t2" }]
235
+ ], Ve = B("syringe", ta);
236
+ function aa(e, t, s) {
237
+ return je(e, -1, s);
238
+ }
239
+ const sa = {
240
+ id: "booking",
241
+ capabilities: ["navigate", "view_change"],
242
+ state: {
243
+ variant: {
244
+ type: "string",
245
+ descriptionKey: "ui.agent.booking.state.variant",
246
+ description: "Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.",
247
+ read: (e) => e.getVariant()
248
+ }
249
+ },
250
+ actions: {
251
+ reset: {
252
+ safety: "write",
253
+ descriptionKey: "ui.agent.booking.actions.reset",
254
+ description: "Clear the booking value back to an empty state. Use to abandon an in-progress flow.",
255
+ invoke: (e) => {
256
+ e.reset();
257
+ }
258
+ },
259
+ goto_step: {
260
+ safety: "read",
261
+ argsType: "{ step: 1 | 2 | 3 | 4 | 5 | 6 | 7 }",
262
+ descriptionKey: "ui.agent.booking.actions.gotoStep",
263
+ description: "Jump to the given step. Implementations may clamp to the first incomplete step if the requested one is not reachable yet.",
264
+ invoke: (e, t) => {
265
+ e.goToStep(t.step);
266
+ }
267
+ }
268
+ },
269
+ domHooks: {
270
+ root: {
271
+ attr: "data-component",
272
+ value: "booking",
273
+ description: "Marks the Booking root region."
274
+ },
275
+ instanceId: {
276
+ attr: "data-component-id",
277
+ sourceProp: "id",
278
+ description: "Sourced from the id prop."
279
+ }
280
+ }
281
+ }, Te = [
282
+ "email",
283
+ "whatsapp",
284
+ "sms"
285
+ ], pe = "all", na = "de";
286
+ function ia(e) {
287
+ return [...e.lockedOperatorId ? e.specialties.filter(
288
+ (s) => {
289
+ var n;
290
+ return (n = s.operatorIds) == null ? void 0 : n.includes(e.lockedOperatorId);
291
+ }
292
+ ) : e.specialties].sort((s, n) => {
293
+ const i = s.sequenceNumber ?? Number.POSITIVE_INFINITY, o = n.sequenceNumber ?? Number.POSITIVE_INFINITY;
294
+ return i - o;
295
+ });
296
+ }
297
+ function oa(e) {
298
+ let t = e.services;
299
+ return e.lockedOperatorId && (t = t.filter(
300
+ (s) => {
301
+ var n;
302
+ return (n = s.operatorIds) == null ? void 0 : n.includes(e.lockedOperatorId);
303
+ }
304
+ )), e.useSpecialties && e.value.specialtyId && (t = t.filter((s) => s.specialtyId === e.value.specialtyId)), t;
305
+ }
306
+ function ra(e) {
307
+ if (e.useSpecialties && e.value.specialtyId) {
308
+ const t = e.value.specialtyId;
309
+ return e.operators.filter(
310
+ (s) => {
311
+ var n;
312
+ return (n = s.specialtyIds) == null ? void 0 : n.includes(t);
313
+ }
314
+ );
315
+ }
316
+ if (!e.useSpecialties && e.value.serviceId) {
317
+ const t = e.value.serviceId;
318
+ return e.operators.filter(
319
+ (s) => {
320
+ var n;
321
+ return (n = s.appointmentBookingReasonIds) == null ? void 0 : n.includes(t);
322
+ }
323
+ );
324
+ }
325
+ return [];
326
+ }
327
+ function da(e, t) {
328
+ const s = e.country === na, n = !s || e.value.insuranceType !== void 0, i = !!e.useSpecialties && n, l = !i || e.value.specialtyId !== void 0, c = !l || e.value.serviceId !== void 0, d = t.operators, p = !!e.allowOperatorSelection && c && e.value.serviceId !== void 0 && !e.lockedOperatorId && d.length > 1, g = c && e.value.serviceId !== void 0, k = (!g || e.value.date !== void 0) && e.value.date !== void 0, x = (!k || e.value.slotKey !== void 0) && e.value.slotKey !== void 0, y = !!e.value.serviceId && d.length === 0;
329
+ return {
330
+ insurance: s,
331
+ specialty: i,
332
+ service: l,
333
+ operator: p,
334
+ date: g,
335
+ slot: k,
336
+ details: x,
337
+ onboardingIncomplete: y
338
+ };
339
+ }
340
+ function la(e, t) {
341
+ const s = [];
342
+ t.insurance && s.push(1), t.specialty && s.push(2), s.push(3), t.operator && s.push(4), s.push(5), s.push(6), s.push(7);
343
+ const n = {
344
+ 1: e.value.insuranceType !== void 0,
345
+ 2: e.value.specialtyId !== void 0,
346
+ 3: e.value.serviceId !== void 0,
347
+ 4: e.value.operatorId !== void 0,
348
+ 5: e.value.date !== void 0,
349
+ 6: e.value.slotKey !== void 0,
350
+ 7: !1
351
+ // details fulfilment is owned by the form's own validation
352
+ };
353
+ return {
354
+ currentStep: s.find((o) => !n[o]) ?? 7,
355
+ visibleSteps: s
356
+ };
357
+ }
358
+ function ca(e) {
359
+ const t = {
360
+ specialties: ia(e),
361
+ services: oa(e),
362
+ operators: ra(e)
363
+ }, s = da(e, t), { currentStep: n, visibleSteps: i } = la(e, s);
364
+ let o;
365
+ if (e.value.date && e.value.slotKey) {
366
+ const d = e.availableSlots[e.value.date];
367
+ d && (o = d.find((p) => p.key === e.value.slotKey));
368
+ }
369
+ const l = e.value.serviceId ? e.services.find((d) => d.id === e.value.serviceId) : void 0, c = e.value.serviceId !== void 0 && e.value.date !== void 0 && e.value.slotKey !== void 0 && (!s.insurance || e.value.insuranceType !== void 0) && (!s.specialty || e.value.specialtyId !== void 0);
370
+ return {
371
+ gates: s,
372
+ filtered: t,
373
+ currentStep: n,
374
+ totalSteps: i.length,
375
+ visibleSteps: i,
376
+ isReadyToSubmit: c,
377
+ durationMin: l == null ? void 0 : l.durationMin,
378
+ selectedSlot: o
379
+ };
380
+ }
381
+ function qe(e, t) {
382
+ return {
383
+ ...e,
384
+ insuranceType: t,
385
+ specialtyId: void 0,
386
+ serviceId: void 0,
387
+ operatorId: void 0,
388
+ date: void 0,
389
+ slotKey: void 0,
390
+ details: void 0
391
+ };
392
+ }
393
+ function He(e, t) {
394
+ return {
395
+ ...e,
396
+ specialtyId: t,
397
+ serviceId: void 0,
398
+ operatorId: void 0,
399
+ date: void 0,
400
+ slotKey: void 0,
401
+ details: void 0
402
+ };
403
+ }
404
+ function Ge(e, t) {
405
+ return {
406
+ ...e,
407
+ serviceId: t,
408
+ // Default the operator to the "All operators" sentinel so a patient
409
+ // who doesn't care about picking lands on a satisfied step 4 without
410
+ // any further input.
411
+ operatorId: t ? pe : void 0,
412
+ date: void 0,
413
+ slotKey: void 0,
414
+ details: void 0
415
+ };
416
+ }
417
+ function Ue(e, t) {
418
+ return {
419
+ ...e,
420
+ operatorId: t,
421
+ date: void 0,
422
+ slotKey: void 0,
423
+ details: void 0
424
+ };
425
+ }
426
+ function ke(e, t) {
427
+ return {
428
+ ...e,
429
+ date: t,
430
+ slotKey: void 0
431
+ // Keep details — date/slot changes shouldn't wipe the patient form
432
+ // since the user has already filled some fields.
433
+ };
434
+ }
435
+ function Ye(e, t) {
436
+ return {
437
+ ...e,
438
+ slotKey: t
439
+ };
440
+ }
441
+ function ma(e, t) {
442
+ let s = e;
443
+ if (t.lockedOperatorId && s.operatorId !== t.lockedOperatorId && (s = { ...s, operatorId: t.lockedOperatorId }), t.useSpecialties && t.specialties.length === 1 && s.specialtyId === void 0 && (s = { ...s, specialtyId: t.specialties[0].id }), t.autoSelectSingleService) {
444
+ const n = s.specialtyId ? t.services.filter((i) => i.specialtyId === s.specialtyId) : t.services;
445
+ n.length === 1 && s.serviceId === void 0 && (s = { ...s, serviceId: n[0].id }, s.operatorId === void 0 && (s = { ...s, operatorId: pe }));
446
+ }
447
+ return s;
448
+ }
449
+ function _e(e) {
450
+ if (e.operatorId && e.operatorId !== pe)
451
+ return e.operatorId;
452
+ }
453
+ function ua(e) {
454
+ if (!e) return !1;
455
+ const t = e.trim();
456
+ return /^\+?\d[\d\s\-()]{6,}$/.test(t);
457
+ }
458
+ function Ze(e) {
459
+ const t = e && e.length > 0 ? e : ["email"], s = new Set(t);
460
+ return Te.filter((n) => s.has(n));
461
+ }
462
+ function pa(e, t, s) {
463
+ const n = Ze(e), i = new Set(n);
464
+ if (s)
465
+ return Te.filter(
466
+ (p) => s.includes(p) && i.has(p)
467
+ );
468
+ const o = [];
469
+ i.has("email") && o.push("email");
470
+ const l = ua(t), c = i.has("whatsapp");
471
+ c && l && o.push("whatsapp"), !c && i.has("sms") && o.push("sms");
472
+ const d = new Set(o);
473
+ return Te.filter((p) => d.has(p));
474
+ }
475
+ const Fe = 500, ga = /^[A-Z0-9]{16}$/, fa = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Re = 300, ve = { state: "idle" }, Ae = ze(
476
+ ({
477
+ value: e,
478
+ onChange: t,
479
+ onSubmit: s,
480
+ requireCodiceFiscale: n = !1,
481
+ requireDateOfBirth: i = !1,
482
+ requireInsuranceNumber: o = !1,
483
+ insuranceType: l,
484
+ showNote: c = !1,
485
+ showReturningPatientFlag: d = !1,
486
+ privacyPolicyUrl: p,
487
+ termsUrl: g,
488
+ validateCodiceFiscale: u,
489
+ validateInsuranceNumber: k,
490
+ submitting: h = !1,
491
+ summarySlot: x,
492
+ defaultPhoneCountry: y,
493
+ confirmationChannels: C,
494
+ defaultConfirmationChannels: _,
495
+ submitError: S
496
+ }, v) => {
497
+ var U, me;
498
+ const { t: r } = T(), O = $e(), [M, b] = q(ve), [N, R] = q(ve), [E, J] = q({}), P = te(
499
+ (m) => J((I) => ({ ...I, [m]: !0 })),
500
+ []
501
+ ), z = de(null), H = de(
502
+ null
503
+ );
504
+ re(
505
+ () => () => {
506
+ z.current && clearTimeout(z.current), H.current && clearTimeout(H.current);
507
+ },
508
+ []
509
+ );
510
+ const D = te(
511
+ (m) => t({ ...e, ...m }),
512
+ [e, t]
513
+ ), X = w(
514
+ () => Ze(C),
515
+ [C]
516
+ ), G = X.length >= 2, se = de(!1);
517
+ re(() => {
518
+ if (!G) {
519
+ e.confirmationChannels !== void 0 && D({ confirmationChannels: void 0 });
520
+ return;
521
+ }
522
+ if (e.confirmationChannels !== void 0) {
523
+ se.current = !0;
524
+ return;
525
+ }
526
+ const m = pa(
527
+ X,
528
+ e.mobilePhone,
529
+ _
530
+ );
531
+ se.current = !0, D({ confirmationChannels: m });
532
+ }, [
533
+ G,
534
+ X,
535
+ e.mobilePhone,
536
+ _
537
+ ]);
538
+ const ne = w(
539
+ () => e.confirmationChannels ?? [],
540
+ [e.confirmationChannels]
541
+ ), Ne = G && ne.length === 0;
542
+ re(() => {
543
+ const m = e.codiceFiscale;
544
+ if (!n || !u || !m) {
545
+ b(ve);
546
+ return;
547
+ }
548
+ if (!ga.test(m)) {
549
+ b({
550
+ state: "invalid",
551
+ hint: r("booking.details.codiceFiscale.invalidFormat")
552
+ });
553
+ return;
554
+ }
555
+ b({ state: "pending" }), z.current && clearTimeout(z.current), z.current = setTimeout(() => {
556
+ u(m).then(
557
+ (I) => b(
558
+ I.valid ? { state: "valid" } : { state: "invalid", hint: I.hint }
559
+ )
560
+ ).catch(
561
+ () => b({
562
+ state: "invalid",
563
+ hint: r("booking.details.codiceFiscale.unavailable")
564
+ })
565
+ );
566
+ }, Re);
567
+ }, [n, u, e.codiceFiscale, r]);
568
+ const W = o && l === "public";
569
+ re(() => {
570
+ const m = e.insuranceNumber;
571
+ if (!W || !k || !m) {
572
+ R(ve);
573
+ return;
574
+ }
575
+ R({ state: "pending" }), H.current && clearTimeout(H.current), H.current = setTimeout(() => {
576
+ k(m).then(
577
+ (I) => R(
578
+ I.valid ? { state: "valid" } : { state: "invalid", hint: I.hint }
579
+ )
580
+ ).catch(
581
+ () => R({
582
+ state: "invalid",
583
+ hint: r("booking.details.insuranceNumber.unavailable")
584
+ })
585
+ );
586
+ }, Re);
587
+ }, [W, k, e.insuranceNumber, r]);
588
+ const Q = w(
589
+ () => !!(e.email && fa.test(e.email)),
590
+ [e.email]
591
+ ), le = w(
592
+ () => !!(e.mobilePhone && e.mobilePhone.length >= 6),
593
+ [e.mobilePhone]
594
+ ), L = w(() => {
595
+ var m, I;
596
+ return !(!((m = e.firstName) != null && m.trim()) || !((I = e.lastName) != null && I.trim()) || !Q || !le || n && M.state !== "valid" || i && !e.dateOfBirth || W && N.state !== "valid");
597
+ }, [
598
+ e.firstName,
599
+ e.lastName,
600
+ Q,
601
+ le,
602
+ n,
603
+ M.state,
604
+ i,
605
+ e.dateOfBirth,
606
+ W,
607
+ N.state
608
+ ]), ie = !!(e.privacyConsent && e.termsConsent), $ = !G || ne.length > 0, j = L && ie && $ && !h, A = (m) => {
609
+ if (m.preventDefault(), J({
610
+ firstName: !0,
611
+ lastName: !0,
612
+ email: !0,
613
+ mobilePhone: !0,
614
+ codiceFiscale: !0,
615
+ dateOfBirth: !0,
616
+ insuranceNumber: !0
617
+ }), !j) return;
618
+ const I = {
619
+ firstName: e.firstName.trim(),
620
+ lastName: e.lastName.trim(),
621
+ email: e.email.trim(),
622
+ mobilePhone: e.mobilePhone,
623
+ privacyConsent: !0,
624
+ termsConsent: !0,
625
+ codiceFiscale: e.codiceFiscale,
626
+ dateOfBirth: e.dateOfBirth,
627
+ insuranceNumber: e.insuranceNumber,
628
+ note: e.note,
629
+ returningPatient: e.returningPatient,
630
+ // Only include when the picker was visible; otherwise the single
631
+ // implicit channel is inferred backend-side from the practice
632
+ // config.
633
+ confirmationChannels: G ? ne : void 0
634
+ };
635
+ s(I);
636
+ }, ce = (m, I) => {
637
+ const oe = I && /^https?:\/\//i.test(I) ? I : void 0;
638
+ return oe ? /* @__PURE__ */ a(
639
+ ct,
640
+ {
641
+ i18nKey: m,
642
+ components: {
643
+ // The `<Trans>` runtime injects link text from the i18n
644
+ // string. The anchor renders empty at static-analysis time,
645
+ // so `jsx-a11y/anchor-has-content` would false-flag — silence
646
+ // it; the runtime content is the localised policy / terms
647
+ // label.
648
+ policyLink: (
649
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
650
+ /* @__PURE__ */ a(
651
+ "a",
652
+ {
653
+ href: oe,
654
+ target: "_blank",
655
+ rel: "noopener noreferrer",
656
+ className: "ds:underline ds:text-[var(--primary)]"
657
+ }
658
+ )
659
+ )
660
+ }
661
+ }
662
+ ) : r(m);
663
+ };
664
+ return /* @__PURE__ */ f(
665
+ "form",
666
+ {
667
+ ref: v,
668
+ id: O,
669
+ noValidate: !0,
670
+ onSubmit: A,
671
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
672
+ children: [
673
+ x,
674
+ /* @__PURE__ */ f("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
675
+ /* @__PURE__ */ a(
676
+ Y,
677
+ {
678
+ label: r("booking.details.firstName.label"),
679
+ required: !0,
680
+ error: E.firstName && !((U = e.firstName) != null && U.trim()) ? r("booking.details.firstName.required") : void 0,
681
+ children: /* @__PURE__ */ a(
682
+ fe,
683
+ {
684
+ autoComplete: "given-name",
685
+ value: e.firstName ?? "",
686
+ onChange: (m) => D({ firstName: m.target.value }),
687
+ onBlur: () => P("firstName")
688
+ }
689
+ )
690
+ }
691
+ ),
692
+ /* @__PURE__ */ a(
693
+ Y,
694
+ {
695
+ label: r("booking.details.lastName.label"),
696
+ required: !0,
697
+ error: E.lastName && !((me = e.lastName) != null && me.trim()) ? r("booking.details.lastName.required") : void 0,
698
+ children: /* @__PURE__ */ a(
699
+ fe,
700
+ {
701
+ autoComplete: "family-name",
702
+ value: e.lastName ?? "",
703
+ onChange: (m) => D({ lastName: m.target.value }),
704
+ onBlur: () => P("lastName")
705
+ }
706
+ )
707
+ }
708
+ )
709
+ ] }),
710
+ /* @__PURE__ */ f("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
711
+ /* @__PURE__ */ a(
712
+ Y,
713
+ {
714
+ label: r("booking.details.email.label"),
715
+ required: !0,
716
+ error: E.email && !Q ? r("booking.details.email.invalid") : void 0,
717
+ children: /* @__PURE__ */ a(
718
+ gt,
719
+ {
720
+ value: e.email ?? "",
721
+ onChange: (m) => D({ email: m.target.value }),
722
+ onBlur: () => P("email")
723
+ }
724
+ )
725
+ }
726
+ ),
727
+ /* @__PURE__ */ a(
728
+ Y,
729
+ {
730
+ label: r("booking.details.mobilePhone.label"),
731
+ required: !0,
732
+ error: E.mobilePhone && !le ? r("booking.details.mobilePhone.invalid") : void 0,
733
+ children: /* @__PURE__ */ a(
734
+ ft,
735
+ {
736
+ value: e.mobilePhone ?? "",
737
+ defaultCountry: y == null ? void 0 : y.toUpperCase(),
738
+ onChange: (m) => {
739
+ D({ mobilePhone: m }), P("mobilePhone");
740
+ }
741
+ }
742
+ )
743
+ }
744
+ )
745
+ ] }),
746
+ n || i ? /* @__PURE__ */ f("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-sm)] ds:sm:grid-cols-2", children: [
747
+ n ? /* @__PURE__ */ a(
748
+ Y,
749
+ {
750
+ label: r("booking.details.codiceFiscale.label"),
751
+ required: !0,
752
+ description: M.state === "pending" ? r("booking.details.codiceFiscale.checking") : r("booking.details.codiceFiscale.helper"),
753
+ error: E.codiceFiscale && M.state === "invalid" ? M.hint ?? r("booking.details.codiceFiscale.invalid") : void 0,
754
+ children: /* @__PURE__ */ a(
755
+ fe,
756
+ {
757
+ value: e.codiceFiscale ?? "",
758
+ maxLength: 16,
759
+ onChange: (m) => D({
760
+ codiceFiscale: m.target.value.slice(0, 16).toUpperCase()
761
+ }),
762
+ onBlur: () => P("codiceFiscale")
763
+ }
764
+ )
765
+ }
766
+ ) : null,
767
+ i ? /* @__PURE__ */ a(
768
+ Y,
769
+ {
770
+ label: r("booking.details.dateOfBirth.label"),
771
+ required: !0,
772
+ error: E.dateOfBirth && !e.dateOfBirth ? r("booking.details.dateOfBirth.required") : void 0,
773
+ children: /* @__PURE__ */ a(
774
+ pt,
775
+ {
776
+ value: e.dateOfBirth ? new Date(e.dateOfBirth) : void 0,
777
+ onChange: (m) => {
778
+ D({
779
+ dateOfBirth: m ? m.toISOString().slice(0, 10) : void 0
780
+ }), P("dateOfBirth");
781
+ }
782
+ }
783
+ )
784
+ }
785
+ ) : null
786
+ ] }) : null,
787
+ W ? /* @__PURE__ */ a(
788
+ Y,
789
+ {
790
+ label: r("booking.details.insuranceNumber.label"),
791
+ required: !0,
792
+ description: N.state === "pending" ? r("booking.details.insuranceNumber.checking") : void 0,
793
+ error: E.insuranceNumber && N.state === "invalid" ? N.hint ?? r("booking.details.insuranceNumber.invalid") : void 0,
794
+ children: /* @__PURE__ */ a(
795
+ fe,
796
+ {
797
+ value: e.insuranceNumber ?? "",
798
+ onChange: (m) => D({ insuranceNumber: m.target.value }),
799
+ onBlur: () => P("insuranceNumber")
800
+ }
801
+ )
802
+ }
803
+ ) : null,
804
+ c ? /* @__PURE__ */ a(
805
+ Y,
806
+ {
807
+ label: r("booking.details.note.label"),
808
+ description: r("booking.details.note.helper", {
809
+ max: Fe
810
+ }),
811
+ children: /* @__PURE__ */ a(
812
+ ht,
813
+ {
814
+ value: e.note ?? "",
815
+ maxLength: Fe,
816
+ rows: 3,
817
+ onChange: (m) => D({ note: m.target.value })
818
+ }
819
+ )
820
+ }
821
+ ) : null,
822
+ d ? /* @__PURE__ */ a(
823
+ Me,
824
+ {
825
+ checked: !!e.returningPatient,
826
+ onCheckedChange: (m) => D({ returningPatient: m === !0 }),
827
+ label: r("booking.details.returningPatient.label")
828
+ }
829
+ ) : null,
830
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
831
+ /* @__PURE__ */ a(
832
+ Me,
833
+ {
834
+ checked: !!e.privacyConsent,
835
+ onCheckedChange: (m) => D({ privacyConsent: m === !0 }),
836
+ label: /* @__PURE__ */ f(Z, { children: [
837
+ ce(
838
+ "booking.details.consent.privacy.label",
839
+ p
840
+ ),
841
+ /* @__PURE__ */ a(
842
+ "span",
843
+ {
844
+ "aria-hidden": "true",
845
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
846
+ children: "*"
847
+ }
848
+ )
849
+ ] })
850
+ }
851
+ ),
852
+ /* @__PURE__ */ a(
853
+ Me,
854
+ {
855
+ checked: !!e.termsConsent,
856
+ onCheckedChange: (m) => D({ termsConsent: m === !0 }),
857
+ label: /* @__PURE__ */ f(Z, { children: [
858
+ ce(
859
+ "booking.details.consent.terms.label",
860
+ g
861
+ ),
862
+ /* @__PURE__ */ a(
863
+ "span",
864
+ {
865
+ "aria-hidden": "true",
866
+ className: "ds:text-[var(--destructive)] ds:ms-[var(--spacing-2xs)]",
867
+ children: "*"
868
+ }
869
+ )
870
+ ] })
871
+ }
872
+ )
873
+ ] }),
874
+ G ? /* @__PURE__ */ a(
875
+ "div",
876
+ {
877
+ "data-component": "booking-confirmation-channels",
878
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
879
+ children: /* @__PURE__ */ a(
880
+ ut,
881
+ {
882
+ label: r("booking.confirmation.heading"),
883
+ helperText: r("booking.confirmation.helper"),
884
+ value: ne,
885
+ onChange: (m) => D({
886
+ confirmationChannels: m
887
+ }),
888
+ orientation: "vertical",
889
+ options: X.map((m) => ({
890
+ value: m,
891
+ label: r(`booking.confirmation.channel.${m}`)
892
+ })),
893
+ error: Ne ? r("booking.confirmation.atLeastOne") : void 0
894
+ }
895
+ )
896
+ }
897
+ ) : null,
898
+ S ? /* @__PURE__ */ a(F, { variant: "error", children: /* @__PURE__ */ a(F.Description, { children: S }) }) : null,
899
+ /* @__PURE__ */ a(
900
+ ae,
901
+ {
902
+ intent: "primary",
903
+ size: "md",
904
+ type: "submit",
905
+ disabled: !j,
906
+ startIcon: h ? /* @__PURE__ */ a(vt, { size: "sm" }) : void 0,
907
+ children: r("booking.details.submit")
908
+ }
909
+ )
910
+ ]
911
+ }
912
+ );
913
+ }
914
+ );
915
+ Ae.displayName = "BookingDetailsForm";
916
+ const ha = xe(
917
+ "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
918
+ {
919
+ variants: {
920
+ variant: {
921
+ "inline-list": "ds:gap-[var(--spacing-md)]",
922
+ accordion: "ds:gap-[var(--spacing-md)]",
923
+ calendar: "ds:gap-[var(--spacing-md)]",
924
+ flexible: "ds:gap-[var(--spacing-lg)]",
925
+ progress: "ds:gap-[var(--spacing-sm)]"
926
+ }
927
+ },
928
+ defaultVariants: { variant: "inline-list" }
929
+ }
930
+ ), va = [
931
+ [
932
+ /\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\s*plastic)/i,
933
+ Ve
934
+ ],
935
+ [/\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, Ct],
936
+ [/\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, Wt],
937
+ [/\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, Mt],
938
+ [/\b(otorin|udito|orecchi|hearing|ear)/i, Kt],
939
+ [/\b(neuro|brain|cervello)/i, Lt],
940
+ [/\b(pediatr|child|bambin)/i, Bt],
941
+ [/\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, Et],
942
+ [/\b(lab|analis|test|sang|esami)/i, qt],
943
+ [/\b(farmaco|pharm|pillol|refill)/i, Gt],
944
+ [/\b(chirurg|surg|intervent|operat)/i, Jt],
945
+ [/\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, Yt],
946
+ [/\b(vacc|inject|inie|punto)/i, Ve],
947
+ [/\b(derma|skin|pelle)/i, Dt],
948
+ [/\b(prima\s*visit|first\s*visit|consult|consulto|valutaz)/i, zt],
949
+ [/\b(general|medicin|family|control|check[-\s]?up)/i, _t]
950
+ ];
951
+ function ba(e) {
952
+ for (const [t, s] of va)
953
+ if (t.test(e)) return s;
954
+ return null;
955
+ }
956
+ function ya(e) {
957
+ const t = ba(e.label) ?? wt;
958
+ return /* @__PURE__ */ a(t, { "aria-hidden": "true", className: "ds:size-5" });
959
+ }
960
+ function De(e) {
961
+ return be(e, "yyyy-MM-dd");
962
+ }
963
+ const ka = [
964
+ "ds:relative ds:flex ds:items-center ds:justify-center",
965
+ "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
966
+ "ds:rounded-[var(--radius-sm)]",
967
+ "ds:text-[length:var(--font-size-sm)]",
968
+ "ds:transition-colors ds:duration-[var(--animation-duration)]",
969
+ "ds:motion-reduce:transition-none",
970
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
971
+ "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
972
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
973
+ ].join(" "), xa = xe(ka, {
974
+ variants: {
975
+ state: {
976
+ available: "ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30",
977
+ unavailable: "ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60",
978
+ selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]",
979
+ outside: "ds:text-[var(--muted-foreground)]/40"
980
+ }
981
+ },
982
+ defaultVariants: { state: "unavailable" }
983
+ });
984
+ function Je({
985
+ availableDates: e,
986
+ selectedDate: t,
987
+ onSelectDate: s,
988
+ locale: n,
989
+ loading: i
990
+ }) {
991
+ const { t: o } = T(), l = w(() => t ? ue(ee(t)) : e.length > 0 ? ue(ee(e[0])) : ue(/* @__PURE__ */ new Date()), [t, e]), [c, d] = q(l), [p, g] = q(null), u = w(() => {
992
+ const S = ue(c), v = kt(c), r = S.getDay(), O = v.getDate(), M = [];
993
+ for (let b = r; b > 0; b -= 1) {
994
+ const N = new Date(S);
995
+ N.setDate(S.getDate() - b), M.push(N);
996
+ }
997
+ for (let b = 0; b < O; b += 1) {
998
+ const N = new Date(S);
999
+ N.setDate(S.getDate() + b), M.push(N);
1000
+ }
1001
+ for (; M.length < 42; ) {
1002
+ const b = M[M.length - 1], N = new Date(b);
1003
+ N.setDate(b.getDate() + 1), M.push(N);
1004
+ }
1005
+ return M;
1006
+ }, [c]), k = w(() => {
1007
+ try {
1008
+ return new Intl.DateTimeFormat(n, {
1009
+ month: "long",
1010
+ year: "numeric"
1011
+ }).format(c);
1012
+ } catch {
1013
+ return be(c, "MMMM yyyy");
1014
+ }
1015
+ }, [c, n]), h = w(() => {
1016
+ const S = new Date(2024, 0, 7);
1017
+ return Array.from({ length: 7 }, (v, r) => {
1018
+ const O = new Date(S);
1019
+ O.setDate(S.getDate() + r);
1020
+ try {
1021
+ return new Intl.DateTimeFormat(n, { weekday: "short" }).format(O);
1022
+ } catch {
1023
+ return be(O, "EEE");
1024
+ }
1025
+ });
1026
+ }, [n]), x = w(() => new Set(e), [e]), y = te(
1027
+ (S) => x.has(De(S)),
1028
+ [x]
1029
+ ), C = w(() => {
1030
+ if (p) return p;
1031
+ if (t) return ee(t);
1032
+ const S = u.find(
1033
+ (v) => he(v, c) && y(v)
1034
+ );
1035
+ return S || (u.find((v) => he(v, c)) ?? null);
1036
+ }, [p, t, u, c, y]), _ = te(
1037
+ (S, v) => {
1038
+ let r = null;
1039
+ switch (S.key) {
1040
+ case "ArrowLeft":
1041
+ r = new Date(v), r.setDate(v.getDate() - 1);
1042
+ break;
1043
+ case "ArrowRight":
1044
+ r = new Date(v), r.setDate(v.getDate() + 1);
1045
+ break;
1046
+ case "ArrowUp":
1047
+ r = new Date(v), r.setDate(v.getDate() - 7);
1048
+ break;
1049
+ case "ArrowDown":
1050
+ r = new Date(v), r.setDate(v.getDate() + 7);
1051
+ break;
1052
+ case "Home":
1053
+ r = new Date(v), r.setDate(v.getDate() - v.getDay());
1054
+ break;
1055
+ case "End":
1056
+ r = new Date(v), r.setDate(v.getDate() + (6 - v.getDay()));
1057
+ break;
1058
+ case "Enter":
1059
+ case " ": {
1060
+ S.preventDefault(), y(v) && s(De(v));
1061
+ return;
1062
+ }
1063
+ default:
1064
+ return;
1065
+ }
1066
+ r && (S.preventDefault(), he(r, c) || d(ue(r)), g(r));
1067
+ },
1068
+ [y, s, c]
1069
+ );
1070
+ return i ? /* @__PURE__ */ f(
1071
+ "div",
1072
+ {
1073
+ role: "status",
1074
+ "aria-live": "polite",
1075
+ "aria-label": o("common.loading"),
1076
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1077
+ children: [
1078
+ /* @__PURE__ */ a(ye, { variant: "text", width: "40%" }),
1079
+ /* @__PURE__ */ a("div", { className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]", children: Array.from({ length: 42 }, (S, v) => /* @__PURE__ */ a(ye, { variant: "rounded", height: "2.5rem" }, `mg-skel-${v}`)) })
1080
+ ]
1081
+ }
1082
+ ) : /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1083
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1084
+ /* @__PURE__ */ a(
1085
+ Pe,
1086
+ {
1087
+ icon: /* @__PURE__ */ a(xt, {}),
1088
+ "aria-label": o("booking.previousMonth"),
1089
+ size: "sm",
1090
+ intent: "ghost",
1091
+ flipIconInRtl: !0,
1092
+ onClick: () => {
1093
+ d((S) => aa(S)), g(null);
1094
+ }
1095
+ }
1096
+ ),
1097
+ /* @__PURE__ */ a(
1098
+ "span",
1099
+ {
1100
+ className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
1101
+ "aria-live": "polite",
1102
+ children: k
1103
+ }
1104
+ ),
1105
+ /* @__PURE__ */ a(
1106
+ Pe,
1107
+ {
1108
+ icon: /* @__PURE__ */ a(St, {}),
1109
+ "aria-label": o("booking.nextMonth"),
1110
+ size: "sm",
1111
+ intent: "ghost",
1112
+ flipIconInRtl: !0,
1113
+ onClick: () => {
1114
+ d((S) => je(S, 1)), g(null);
1115
+ }
1116
+ }
1117
+ )
1118
+ ] }),
1119
+ /* @__PURE__ */ f(
1120
+ "div",
1121
+ {
1122
+ role: "grid",
1123
+ "aria-label": o("booking.monthGridLabel"),
1124
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
1125
+ children: [
1126
+ /* @__PURE__ */ a(
1127
+ "div",
1128
+ {
1129
+ role: "row",
1130
+ className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
1131
+ children: h.map((S, v) => /* @__PURE__ */ a(
1132
+ "div",
1133
+ {
1134
+ role: "columnheader",
1135
+ className: "type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]",
1136
+ children: S
1137
+ },
1138
+ `wd-${v}`
1139
+ ))
1140
+ }
1141
+ ),
1142
+ Array.from({ length: 6 }, (S, v) => /* @__PURE__ */ a(
1143
+ "div",
1144
+ {
1145
+ role: "row",
1146
+ className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
1147
+ children: u.slice(v * 7, v * 7 + 7).map((r, O) => {
1148
+ const M = v * 7 + O, b = he(r, c), N = b && y(r), R = t ? Le(r, ee(t)) : !1, E = b ? R ? "selected" : N ? "available" : "unavailable" : "outside", J = C ? Le(C, r) : !1, P = (() => {
1149
+ try {
1150
+ return new Intl.DateTimeFormat(n, {
1151
+ dateStyle: "full"
1152
+ }).format(r);
1153
+ } catch {
1154
+ return be(r, "PPP");
1155
+ }
1156
+ })();
1157
+ return /* @__PURE__ */ a(
1158
+ "button",
1159
+ {
1160
+ type: "button",
1161
+ role: "gridcell",
1162
+ "aria-label": P,
1163
+ "aria-selected": R || void 0,
1164
+ "aria-disabled": !N || void 0,
1165
+ tabIndex: J ? 0 : -1,
1166
+ disabled: !N,
1167
+ onClick: () => {
1168
+ N && s(De(r));
1169
+ },
1170
+ onKeyDown: (z) => _(z, r),
1171
+ className: xa({ state: E }),
1172
+ children: /* @__PURE__ */ a("span", { "aria-hidden": "true", children: r.getDate() })
1173
+ },
1174
+ `mg-cell-${M}`
1175
+ );
1176
+ })
1177
+ },
1178
+ `mg-row-${v}`
1179
+ ))
1180
+ ]
1181
+ }
1182
+ )
1183
+ ] });
1184
+ }
1185
+ const Sa = xe(
1186
+ [
1187
+ "ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]",
1188
+ "ds:min-h-[var(--min-target-size)]",
1189
+ "ds:rounded-[var(--radius-md)]",
1190
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
1191
+ "ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]",
1192
+ "ds:text-start",
1193
+ "ds:transition-[background-color,box-shadow]",
1194
+ "ds:duration-[var(--animation-duration)]",
1195
+ "ds:motion-reduce:transition-none",
1196
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1197
+ "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1198
+ "ds:forced-colors:[outline:1px_solid_CanvasText]",
1199
+ "ds:cursor-pointer"
1200
+ ].join(" "),
1201
+ {
1202
+ variants: {
1203
+ state: {
1204
+ idle: "ds:bg-[var(--card)] ds:shadow-[var(--shadow-sm)] ds:hover:shadow-[var(--shadow-md)]",
1205
+ selected: "ds:bg-[color-mix(in_srgb,var(--primary)_8%,var(--card))] ds:shadow-[var(--shadow-sm)]"
1206
+ }
1207
+ },
1208
+ defaultVariants: { state: "idle" }
1209
+ }
1210
+ );
1211
+ function Na({
1212
+ services: e,
1213
+ selectedServiceId: t,
1214
+ onSelect: s
1215
+ }) {
1216
+ const { t: n } = T(), i = $e(), [o, l] = q(() => {
1217
+ if (t) {
1218
+ const g = e.findIndex((u) => u.id === t);
1219
+ if (g >= 0) return g;
1220
+ }
1221
+ return 0;
1222
+ }), c = de(/* @__PURE__ */ new Map()), d = te((g) => {
1223
+ var u;
1224
+ (u = c.current.get(g)) == null || u.focus();
1225
+ }, []), p = te(
1226
+ (g, u, k) => {
1227
+ const h = e.length;
1228
+ if (h !== 0)
1229
+ switch (g.key) {
1230
+ case "ArrowDown":
1231
+ case "ArrowRight": {
1232
+ g.preventDefault();
1233
+ const x = (u + 1) % h;
1234
+ l(x), d(x);
1235
+ break;
1236
+ }
1237
+ case "ArrowUp":
1238
+ case "ArrowLeft": {
1239
+ g.preventDefault();
1240
+ const x = (u - 1 + h) % h;
1241
+ l(x), d(x);
1242
+ break;
1243
+ }
1244
+ case "Home": {
1245
+ g.preventDefault(), l(0), d(0);
1246
+ break;
1247
+ }
1248
+ case "End": {
1249
+ g.preventDefault();
1250
+ const x = h - 1;
1251
+ l(x), d(x);
1252
+ break;
1253
+ }
1254
+ case "Enter":
1255
+ case " ": {
1256
+ g.preventDefault(), s(k);
1257
+ break;
1258
+ }
1259
+ }
1260
+ },
1261
+ [e.length, d, s]
1262
+ );
1263
+ return e.length === 0 ? null : /* @__PURE__ */ a(
1264
+ "div",
1265
+ {
1266
+ role: "radiogroup",
1267
+ "aria-label": n("booking.serviceListLabel"),
1268
+ id: i,
1269
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
1270
+ children: e.map((g, u) => {
1271
+ const k = t === g.id, h = o === u, x = n("booking.serviceCardLabel", {
1272
+ label: g.label,
1273
+ duration: g.durationMin
1274
+ }), y = ya(g);
1275
+ return /* @__PURE__ */ f(
1276
+ "button",
1277
+ {
1278
+ ref: (C) => {
1279
+ C ? c.current.set(u, C) : c.current.delete(u);
1280
+ },
1281
+ type: "button",
1282
+ role: "radio",
1283
+ "aria-checked": k,
1284
+ "aria-label": x,
1285
+ tabIndex: h ? 0 : -1,
1286
+ onClick: () => s(g.id),
1287
+ onFocus: () => l(u),
1288
+ onKeyDown: (C) => p(C, u, g.id),
1289
+ className: Sa({
1290
+ state: k ? "selected" : "idle"
1291
+ }),
1292
+ children: [
1293
+ /* @__PURE__ */ a(
1294
+ "span",
1295
+ {
1296
+ "aria-hidden": "true",
1297
+ 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)]",
1298
+ children: y
1299
+ }
1300
+ ),
1301
+ /* @__PURE__ */ f("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
1302
+ /* @__PURE__ */ a("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: g.label }),
1303
+ /* @__PURE__ */ a("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: n("booking.serviceSummary", { minutes: g.durationMin }) })
1304
+ ] })
1305
+ ]
1306
+ },
1307
+ g.id
1308
+ );
1309
+ })
1310
+ }
1311
+ );
1312
+ }
1313
+ const Ia = xe(
1314
+ [
1315
+ "ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
1316
+ "ds:min-h-[var(--min-target-size)]",
1317
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
1318
+ "ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]",
1319
+ "ds:rounded-[var(--radius-md)]",
1320
+ "ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]",
1321
+ "ds:transition-[background-color,color,box-shadow] ds:duration-[var(--animation-duration)]",
1322
+ "ds:motion-reduce:transition-none",
1323
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
1324
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
1325
+ "ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
1326
+ "ds:forced-colors:[border:1px_solid_ButtonText] ds:forced-colors:text-[ButtonText]"
1327
+ ].join(" "),
1328
+ {
1329
+ variants: {
1330
+ state: {
1331
+ 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)]",
1332
+ selected: "ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:shadow-[var(--shadow-sm)]",
1333
+ unavailable: "ds:[outline:1px_dashed_color:var(--border)] ds:[outline-offset:-1px] ds:bg-transparent ds:text-[color:var(--muted-foreground)]"
1334
+ }
1335
+ },
1336
+ defaultVariants: { state: "idle" }
1337
+ }
1338
+ );
1339
+ function wa(e) {
1340
+ const [t] = e.split(":").map((n) => parseInt(n, 10)), s = Number.isFinite(t) ? t : 0;
1341
+ return s < 12 ? "morning" : s < 17 ? "afternoon" : "evening";
1342
+ }
1343
+ const Ca = {
1344
+ morning: It,
1345
+ afternoon: ea,
1346
+ evening: Nt
1347
+ };
1348
+ function Xe({
1349
+ date: e,
1350
+ slots: t,
1351
+ selectedSlotKey: s,
1352
+ onSelect: n,
1353
+ loading: i,
1354
+ locale: o
1355
+ }) {
1356
+ const { t: l } = T(), c = w(() => {
1357
+ try {
1358
+ return new Intl.DateTimeFormat(o, {
1359
+ weekday: "long",
1360
+ day: "numeric",
1361
+ month: "long"
1362
+ }).format(ee(e));
1363
+ } catch {
1364
+ return e;
1365
+ }
1366
+ }, [e, o]), d = w(() => {
1367
+ const u = {
1368
+ morning: [],
1369
+ afternoon: [],
1370
+ evening: []
1371
+ };
1372
+ for (const k of t)
1373
+ u[wa(k.time)].push(k);
1374
+ return u;
1375
+ }, [t]), p = t.filter((u) => u.available).length, g = ["morning", "afternoon", "evening"];
1376
+ return i ? /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1377
+ /* @__PURE__ */ a(ye, { variant: "text", width: "60%" }),
1378
+ [0, 1].map((u) => /* @__PURE__ */ a(
1379
+ "div",
1380
+ {
1381
+ className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]",
1382
+ children: [0, 1, 2].map((k) => /* @__PURE__ */ a(ye, { variant: "rounded", height: "44px" }, k))
1383
+ },
1384
+ u
1385
+ ))
1386
+ ] }) : p === 0 ? /* @__PURE__ */ a(Ke, { variant: "no-results", title: l("booking.noSlotsForDate") }) : /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1387
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1388
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
1389
+ /* @__PURE__ */ a(
1390
+ Ft,
1391
+ {
1392
+ "aria-hidden": "true",
1393
+ className: "ds:size-4 ds:text-[color:var(--accent)]"
1394
+ }
1395
+ ),
1396
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: c })
1397
+ ] }),
1398
+ /* @__PURE__ */ a("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: l("booking.slotsAvailable", { count: p }) })
1399
+ ] }),
1400
+ g.map((u) => {
1401
+ const k = d[u];
1402
+ if (k.length === 0) return null;
1403
+ const h = Ca[u];
1404
+ return /* @__PURE__ */ f(
1405
+ "div",
1406
+ {
1407
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
1408
+ children: [
1409
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
1410
+ /* @__PURE__ */ a(h, { "aria-hidden": "true", className: "ds:size-3.5" }),
1411
+ /* @__PURE__ */ a("span", { className: "type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase", children: l(`booking.timeOfDay.${u}`) })
1412
+ ] }),
1413
+ /* @__PURE__ */ a(
1414
+ "div",
1415
+ {
1416
+ role: "group",
1417
+ "aria-label": l(`booking.timeOfDay.${u}`),
1418
+ className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4",
1419
+ children: k.map((x) => {
1420
+ const y = x.key === s, C = x.available ? y ? "selected" : "idle" : "unavailable";
1421
+ return /* @__PURE__ */ a(
1422
+ "button",
1423
+ {
1424
+ type: "button",
1425
+ "data-slot-id": x.key,
1426
+ disabled: !x.available,
1427
+ "aria-pressed": y,
1428
+ "aria-label": l("booking.slotAvailableLabel", {
1429
+ time: x.time
1430
+ }),
1431
+ onClick: () => x.available && n(x),
1432
+ className: Ia({ state: C }),
1433
+ children: x.time
1434
+ },
1435
+ x.key
1436
+ );
1437
+ })
1438
+ }
1439
+ )
1440
+ ]
1441
+ },
1442
+ u
1443
+ );
1444
+ })
1445
+ ] });
1446
+ }
1447
+ function We({ value: e, onChange: t }) {
1448
+ const { t: s } = T(), n = [
1449
+ { value: "private", label: s("booking.insurance.private") },
1450
+ { value: "public", label: s("booking.insurance.public") }
1451
+ ];
1452
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1453
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: s("booking.insurance.heading") }),
1454
+ /* @__PURE__ */ a(
1455
+ Se,
1456
+ {
1457
+ options: n,
1458
+ value: e ?? "",
1459
+ onValueChange: (i) => {
1460
+ (i === "private" || i === "public") && t(i);
1461
+ },
1462
+ placeholder: s("booking.insurance.placeholder"),
1463
+ "aria-label": s("booking.insurance.heading")
1464
+ }
1465
+ )
1466
+ ] });
1467
+ }
1468
+ function Qe({ specialties: e, value: t, onChange: s }) {
1469
+ const { t: n } = T(), i = e.map((o) => ({
1470
+ value: o.id,
1471
+ label: o.label
1472
+ }));
1473
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1474
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: n("booking.specialty.heading") }),
1475
+ /* @__PURE__ */ a(
1476
+ Se,
1477
+ {
1478
+ options: i,
1479
+ value: t ?? "",
1480
+ onValueChange: (o) => s(o),
1481
+ placeholder: n("booking.specialty.placeholder"),
1482
+ "aria-label": n("booking.specialty.heading")
1483
+ }
1484
+ )
1485
+ ] });
1486
+ }
1487
+ function et({ services: e, value: t, onChange: s, compact: n }) {
1488
+ const { t: i } = T();
1489
+ if (n) {
1490
+ const o = e.map((l) => ({
1491
+ value: l.id,
1492
+ label: `${l.label} · ${i("booking.serviceSummary", {
1493
+ minutes: l.durationMin
1494
+ })}`
1495
+ }));
1496
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1497
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: i("booking.service.heading") }),
1498
+ /* @__PURE__ */ a(
1499
+ Se,
1500
+ {
1501
+ options: o,
1502
+ value: t ?? "",
1503
+ onValueChange: (l) => s(l),
1504
+ placeholder: i("booking.service.placeholder"),
1505
+ "aria-label": i("booking.service.heading")
1506
+ }
1507
+ )
1508
+ ] });
1509
+ }
1510
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1511
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: i("booking.service.heading") }),
1512
+ /* @__PURE__ */ a(
1513
+ Na,
1514
+ {
1515
+ services: e,
1516
+ selectedServiceId: t,
1517
+ onSelect: s
1518
+ }
1519
+ )
1520
+ ] });
1521
+ }
1522
+ function tt({ operators: e, value: t, onChange: s }) {
1523
+ const { t: n } = T(), i = [
1524
+ { value: pe, label: n("booking.operator.all") },
1525
+ ...e.map((o) => ({ value: o.id, label: o.name }))
1526
+ ];
1527
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1528
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: n("booking.operator.heading") }),
1529
+ /* @__PURE__ */ a(
1530
+ Se,
1531
+ {
1532
+ options: i,
1533
+ value: t ?? pe,
1534
+ onValueChange: (o) => s(o),
1535
+ placeholder: n("booking.operator.placeholder"),
1536
+ "aria-label": n("booking.operator.heading")
1537
+ }
1538
+ )
1539
+ ] });
1540
+ }
1541
+ function at({
1542
+ customSlot: e
1543
+ }) {
1544
+ const { t } = T();
1545
+ return e ? /* @__PURE__ */ a(Z, { children: e }) : /* @__PURE__ */ f(F, { variant: "warning", children: [
1546
+ /* @__PURE__ */ a(F.Title, { as: "h4", children: t("booking.onboardingIncomplete.title") }),
1547
+ /* @__PURE__ */ a(F.Description, { children: t("booking.onboardingIncomplete.description") })
1548
+ ] });
1549
+ }
1550
+ function st({
1551
+ nextAvailableDate: e,
1552
+ onJump: t,
1553
+ locale: s
1554
+ }) {
1555
+ const { t: n } = T(), i = w(() => {
1556
+ try {
1557
+ return new Intl.DateTimeFormat(s, { dateStyle: "long" }).format(
1558
+ ee(e)
1559
+ );
1560
+ } catch {
1561
+ return e;
1562
+ }
1563
+ }, [e, s]);
1564
+ return /* @__PURE__ */ f(F, { variant: "info", children: [
1565
+ /* @__PURE__ */ a(F.Description, { children: n("booking.nextAvailable.description", { date: i }) }),
1566
+ /* @__PURE__ */ a(F.Action, { children: /* @__PURE__ */ a(ae, { intent: "secondary", size: "sm", onClick: t, children: n("booking.nextAvailable.cta") }) })
1567
+ ] });
1568
+ }
1569
+ function Ma({
1570
+ snapshot: e,
1571
+ operators: t,
1572
+ specialties: s,
1573
+ services: n,
1574
+ locale: i,
1575
+ mode: o,
1576
+ showModify: l,
1577
+ onReset: c,
1578
+ onModify: d
1579
+ }) {
1580
+ const { t: p } = T(), u = (e.details.confirmationChannels ?? ["email"]).map(
1581
+ (_) => p(`booking.confirmation.channel.${_}`)
1582
+ ), k = o === "demo" ? p("booking.success.descriptionDemo") : u.length > 1 ? p("booking.success.descriptionMultiple", {
1583
+ channels: u.join(" · ")
1584
+ }) : p("booking.success.descriptionSingle", { channel: u[0] }), h = w(() => {
1585
+ if (e.date)
1586
+ try {
1587
+ return new Intl.DateTimeFormat(i, {
1588
+ weekday: "long",
1589
+ day: "numeric",
1590
+ month: "long"
1591
+ }).format(ee(e.date));
1592
+ } catch {
1593
+ return e.date;
1594
+ }
1595
+ }, [e.date, i]), x = e.operatorId ? t.find((_) => _.id === e.operatorId) : void 0, y = e.specialtyId ? s.find((_) => _.id === e.specialtyId) : void 0, C = e.serviceId ? n.find((_) => _.id === e.serviceId) : void 0;
1596
+ return /* @__PURE__ */ f(
1597
+ "div",
1598
+ {
1599
+ "data-component": "booking-success",
1600
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1601
+ children: [
1602
+ /* @__PURE__ */ f(F, { variant: "success", children: [
1603
+ /* @__PURE__ */ a(F.Title, { as: "h3", children: p("booking.success.heading") }),
1604
+ /* @__PURE__ */ a(F.Description, { children: k })
1605
+ ] }),
1606
+ /* @__PURE__ */ a("div", { className: "ds:rounded-[var(--radius-md)] ds:bg-[var(--secondary)] ds:p-[var(--spacing-md)]", children: /* @__PURE__ */ f("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: [
1607
+ y ? /* @__PURE__ */ f(Z, { children: [
1608
+ /* @__PURE__ */ a("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: p("booking.success.summarySpecialty") }),
1609
+ /* @__PURE__ */ a("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: y.label })
1610
+ ] }) : null,
1611
+ C ? /* @__PURE__ */ f(Z, { children: [
1612
+ /* @__PURE__ */ a("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: p("booking.success.summaryService") }),
1613
+ /* @__PURE__ */ a("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: C.label })
1614
+ ] }) : null,
1615
+ h ? /* @__PURE__ */ f(Z, { children: [
1616
+ /* @__PURE__ */ a("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: p("booking.success.summaryDate") }),
1617
+ /* @__PURE__ */ a("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: h })
1618
+ ] }) : null,
1619
+ /* @__PURE__ */ a("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: p("booking.success.summaryTime") }),
1620
+ /* @__PURE__ */ a("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: e.slot.time }),
1621
+ x ? /* @__PURE__ */ f(Z, { children: [
1622
+ /* @__PURE__ */ a("dt", { className: "type-label ds:text-[var(--muted-foreground)]", children: p("booking.success.summaryProvider") }),
1623
+ /* @__PURE__ */ a("dd", { className: "type-body ds:m-0 ds:text-[var(--foreground)]", children: x.name })
1624
+ ] }) : null
1625
+ ] }) }),
1626
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
1627
+ /* @__PURE__ */ a(ae, { intent: "secondary", size: "md", onClick: c, children: p("booking.success.bookAnother") }),
1628
+ l ? /* @__PURE__ */ a(ae, { intent: "ghost", size: "md", onClick: d, children: p("booking.success.modifyBooking") }) : null
1629
+ ] })
1630
+ ]
1631
+ }
1632
+ );
1633
+ }
1634
+ function nt({ customSlot: e }) {
1635
+ const { t } = T();
1636
+ return e ? /* @__PURE__ */ a(Z, { children: e }) : /* @__PURE__ */ a(
1637
+ Ke,
1638
+ {
1639
+ variant: "no-results",
1640
+ title: t("booking.emptyServices.title"),
1641
+ description: t("booking.emptyServices.description")
1642
+ }
1643
+ );
1644
+ }
1645
+ function Da(e) {
1646
+ const {
1647
+ cascade: t,
1648
+ inputs: s,
1649
+ value: n,
1650
+ onChange: i,
1651
+ onSubmit: o,
1652
+ emptyServicesSlot: l,
1653
+ onboardingIncompleteSlot: c,
1654
+ loadingSlots: d,
1655
+ submitting: p,
1656
+ locale: g,
1657
+ detailsProps: u
1658
+ } = e, { t: k } = T();
1659
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1660
+ t.gates.insurance ? /* @__PURE__ */ a(
1661
+ We,
1662
+ {
1663
+ value: n.insuranceType,
1664
+ onChange: (h) => i(qe(n, h))
1665
+ }
1666
+ ) : null,
1667
+ t.gates.specialty ? /* @__PURE__ */ a(
1668
+ Qe,
1669
+ {
1670
+ specialties: t.filtered.specialties,
1671
+ value: n.specialtyId,
1672
+ onChange: (h) => i(He(n, h))
1673
+ }
1674
+ ) : null,
1675
+ t.gates.service ? t.filtered.services.length === 0 ? /* @__PURE__ */ a(nt, { customSlot: l }) : /* @__PURE__ */ a(
1676
+ et,
1677
+ {
1678
+ services: t.filtered.services,
1679
+ value: n.serviceId,
1680
+ onChange: (h) => i(Ge(n, h))
1681
+ }
1682
+ ) : null,
1683
+ t.gates.onboardingIncomplete ? /* @__PURE__ */ a(at, { customSlot: c }) : null,
1684
+ t.gates.operator ? /* @__PURE__ */ a(
1685
+ tt,
1686
+ {
1687
+ operators: t.filtered.operators,
1688
+ value: n.operatorId,
1689
+ onChange: (h) => i(Ue(n, h))
1690
+ }
1691
+ ) : null,
1692
+ t.gates.date ? /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1693
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: k("booking.date.heading") }),
1694
+ s.availableDates.length === 0 && s.nextAvailableDate ? /* @__PURE__ */ a(
1695
+ st,
1696
+ {
1697
+ nextAvailableDate: s.nextAvailableDate,
1698
+ onJump: () => i(ke(n, s.nextAvailableDate)),
1699
+ locale: g
1700
+ }
1701
+ ) : /* @__PURE__ */ a(
1702
+ Je,
1703
+ {
1704
+ availableDates: s.availableDates,
1705
+ selectedDate: n.date,
1706
+ onSelectDate: (h) => i(ke(n, h)),
1707
+ locale: g,
1708
+ loading: d
1709
+ }
1710
+ )
1711
+ ] }) : null,
1712
+ t.gates.slot && n.date ? /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1713
+ /* @__PURE__ */ a("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: k("booking.slot.heading") }),
1714
+ /* @__PURE__ */ a(
1715
+ Xe,
1716
+ {
1717
+ date: n.date,
1718
+ slots: s.availableSlots[n.date] ?? [],
1719
+ selectedSlotKey: n.slotKey,
1720
+ onSelect: (h) => i(Ye(n, h.key)),
1721
+ loading: d,
1722
+ locale: g
1723
+ }
1724
+ )
1725
+ ] }) : null,
1726
+ t.gates.details && t.selectedSlot ? /* @__PURE__ */ a(
1727
+ Ae,
1728
+ {
1729
+ ...u,
1730
+ value: n.details ?? {},
1731
+ onChange: (h) => i({ ...n, details: h }),
1732
+ onSubmit: o,
1733
+ submitting: p,
1734
+ defaultPhoneCountry: e.policy.country
1735
+ }
1736
+ ) : null
1737
+ ] });
1738
+ }
1739
+ function K(e, t, s = {}) {
1740
+ const {
1741
+ cascade: n,
1742
+ inputs: i,
1743
+ value: o,
1744
+ onChange: l,
1745
+ onSubmit: c,
1746
+ emptyServicesSlot: d,
1747
+ onboardingIncompleteSlot: p,
1748
+ loadingSlots: g,
1749
+ submitting: u,
1750
+ locale: k,
1751
+ detailsProps: h,
1752
+ policy: x
1753
+ } = t;
1754
+ switch (e) {
1755
+ case 1:
1756
+ return /* @__PURE__ */ a(
1757
+ We,
1758
+ {
1759
+ value: o.insuranceType,
1760
+ onChange: (y) => l(qe(o, y))
1761
+ }
1762
+ );
1763
+ case 2:
1764
+ return /* @__PURE__ */ a(
1765
+ Qe,
1766
+ {
1767
+ specialties: n.filtered.specialties,
1768
+ value: o.specialtyId,
1769
+ onChange: (y) => l(He(o, y))
1770
+ }
1771
+ );
1772
+ case 3:
1773
+ return n.filtered.services.length === 0 ? /* @__PURE__ */ a(nt, { customSlot: d }) : n.gates.onboardingIncomplete ? /* @__PURE__ */ a(at, { customSlot: p }) : /* @__PURE__ */ a(
1774
+ et,
1775
+ {
1776
+ services: n.filtered.services,
1777
+ value: o.serviceId,
1778
+ onChange: (y) => l(Ge(o, y)),
1779
+ compact: s.compactService
1780
+ }
1781
+ );
1782
+ case 4:
1783
+ return /* @__PURE__ */ a(
1784
+ tt,
1785
+ {
1786
+ operators: n.filtered.operators,
1787
+ value: o.operatorId,
1788
+ onChange: (y) => l(Ue(o, y))
1789
+ }
1790
+ );
1791
+ case 5:
1792
+ return i.availableDates.length === 0 && i.nextAvailableDate ? /* @__PURE__ */ a(
1793
+ st,
1794
+ {
1795
+ nextAvailableDate: i.nextAvailableDate,
1796
+ onJump: () => l(ke(o, i.nextAvailableDate)),
1797
+ locale: k
1798
+ }
1799
+ ) : /* @__PURE__ */ a(
1800
+ Je,
1801
+ {
1802
+ availableDates: i.availableDates,
1803
+ selectedDate: o.date,
1804
+ onSelectDate: (y) => l(ke(o, y)),
1805
+ locale: k,
1806
+ loading: g
1807
+ }
1808
+ );
1809
+ case 6:
1810
+ return o.date ? /* @__PURE__ */ a(
1811
+ Xe,
1812
+ {
1813
+ date: o.date,
1814
+ slots: i.availableSlots[o.date] ?? [],
1815
+ selectedSlotKey: o.slotKey,
1816
+ onSelect: (y) => l(Ye(o, y.key)),
1817
+ loading: g,
1818
+ locale: k
1819
+ }
1820
+ ) : null;
1821
+ case 7:
1822
+ return n.selectedSlot ? /* @__PURE__ */ a(
1823
+ Ae,
1824
+ {
1825
+ ...h,
1826
+ value: o.details ?? {},
1827
+ onChange: (y) => l({ ...o, details: y }),
1828
+ onSubmit: c,
1829
+ submitting: u,
1830
+ defaultPhoneCountry: x.country
1831
+ }
1832
+ ) : null;
1833
+ /* c8 ignore next 2 */
1834
+ default:
1835
+ return null;
1836
+ }
1837
+ }
1838
+ function Be() {
1839
+ const { t: e } = T();
1840
+ return w(
1841
+ () => ({
1842
+ 1: e("booking.insurance.heading"),
1843
+ 2: e("booking.specialty.heading"),
1844
+ 3: e("booking.service.heading"),
1845
+ 4: e("booking.operator.heading"),
1846
+ 5: e("booking.date.heading"),
1847
+ 6: e("booking.slot.heading"),
1848
+ 7: e("booking.details.heading")
1849
+ }),
1850
+ [e]
1851
+ );
1852
+ }
1853
+ function Ta(e) {
1854
+ const { cascade: t, value: s, activeStep: n, setActiveStep: i } = e, o = Be(), l = w(
1855
+ () => t.visibleSteps.map((d) => ({
1856
+ label: o[d],
1857
+ summary: it(d, s, t),
1858
+ status: ge(d, s) && d < t.currentStep ? "completed" : void 0,
1859
+ content: K(d, e, { compactService: !0 })
1860
+ })),
1861
+ [t, s, o, e]
1862
+ ), c = Math.max(0, t.visibleSteps.indexOf(n));
1863
+ return /* @__PURE__ */ a(
1864
+ bt,
1865
+ {
1866
+ activeStep: c,
1867
+ steps: l,
1868
+ onStepChange: (d) => {
1869
+ const p = t.visibleSteps[d];
1870
+ p && i(p);
1871
+ }
1872
+ }
1873
+ );
1874
+ }
1875
+ function ge(e, t) {
1876
+ switch (e) {
1877
+ case 1:
1878
+ return t.insuranceType !== void 0;
1879
+ case 2:
1880
+ return t.specialtyId !== void 0;
1881
+ case 3:
1882
+ return t.serviceId !== void 0;
1883
+ case 4:
1884
+ return t.operatorId !== void 0;
1885
+ case 5:
1886
+ return t.date !== void 0;
1887
+ case 6:
1888
+ return t.slotKey !== void 0;
1889
+ case 7:
1890
+ return !1;
1891
+ }
1892
+ }
1893
+ function it(e, t, s) {
1894
+ var n;
1895
+ if (ge(e, t))
1896
+ switch (e) {
1897
+ case 1:
1898
+ return t.insuranceType;
1899
+ case 2: {
1900
+ const i = s.filtered.specialties.find(
1901
+ (o) => o.id === t.specialtyId
1902
+ );
1903
+ return i == null ? void 0 : i.label;
1904
+ }
1905
+ case 3: {
1906
+ const i = s.filtered.services.find(
1907
+ (o) => o.id === t.serviceId
1908
+ );
1909
+ return i == null ? void 0 : i.label;
1910
+ }
1911
+ case 4: {
1912
+ const i = _e(t);
1913
+ if (!i) return;
1914
+ const o = s.filtered.operators.find((l) => l.id === i);
1915
+ return o == null ? void 0 : o.name;
1916
+ }
1917
+ case 5:
1918
+ return t.date;
1919
+ case 6:
1920
+ return (n = s.selectedSlot) == null ? void 0 : n.time;
1921
+ case 7:
1922
+ return;
1923
+ }
1924
+ }
1925
+ function _a(e) {
1926
+ const { cascade: t, value: s, setActiveStep: n } = e, { t: i } = T(), o = Be(), l = t.visibleSteps.filter(
1927
+ (d) => d === 1 || d === 2 || d === 3 || d === 4
1928
+ ), c = l.some(
1929
+ (d) => !ge(d, s)
1930
+ );
1931
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1932
+ c ? l.filter((d) => !ge(d, s)).slice(0, 1).map((d) => /* @__PURE__ */ a("div", { children: K(d, e, { compactService: !0 }) }, `csf-${d}`)) : /* @__PURE__ */ a(
1933
+ "div",
1934
+ {
1935
+ role: "group",
1936
+ "aria-label": i("booking.regionLabel"),
1937
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
1938
+ children: l.map((d) => {
1939
+ const p = it(d, s, t);
1940
+ return p ? /* @__PURE__ */ f(
1941
+ ae,
1942
+ {
1943
+ intent: "tonal",
1944
+ size: "sm",
1945
+ onClick: () => n(d),
1946
+ children: [
1947
+ o[d],
1948
+ ": ",
1949
+ p
1950
+ ]
1951
+ },
1952
+ `csc-${d}`
1953
+ ) : null;
1954
+ })
1955
+ }
1956
+ ),
1957
+ !c && t.gates.date ? /* @__PURE__ */ f("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
1958
+ /* @__PURE__ */ a("div", { className: "ds:min-w-0", children: K(5, e) }),
1959
+ /* @__PURE__ */ a("div", { className: "ds:min-w-0", children: s.date ? K(6, e) : null })
1960
+ ] }) : null,
1961
+ t.gates.details ? /* @__PURE__ */ a("div", { children: K(7, e) }) : null
1962
+ ] });
1963
+ }
1964
+ function Aa(e) {
1965
+ const { cascade: t } = e, s = t.visibleSteps.filter(
1966
+ (n) => n === 1 || n === 2 || n === 3 || n === 4
1967
+ );
1968
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1969
+ /* @__PURE__ */ f("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
1970
+ /* @__PURE__ */ a("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: s.map((n) => /* @__PURE__ */ a("div", { children: K(n, e, { compactService: !0 }) }, `fbf-${n}`)) }),
1971
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1972
+ t.gates.date ? K(5, e) : null,
1973
+ t.gates.slot && e.value.date ? K(6, e) : null
1974
+ ] })
1975
+ ] }),
1976
+ t.gates.details ? K(7, e) : null
1977
+ ] });
1978
+ }
1979
+ function Ba(e) {
1980
+ const { cascade: t, value: s, activeStep: n, setActiveStep: i } = e, { t: o } = T(), l = Be(), c = t.visibleSteps, d = Math.max(0, c.indexOf(n)), p = c.length, g = w(
1981
+ () => c.map((h) => ({ label: l[h] })),
1982
+ [c, l]
1983
+ ), u = d > 0, k = d < p - 1 && ge(n, s);
1984
+ return /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1985
+ /* @__PURE__ */ a(yt, { activeStep: d, steps: g }),
1986
+ /* @__PURE__ */ a("div", { children: K(n, e, { compactService: !0 }) }),
1987
+ /* @__PURE__ */ f("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1988
+ /* @__PURE__ */ a(
1989
+ ae,
1990
+ {
1991
+ intent: "ghost",
1992
+ size: "md",
1993
+ disabled: !u,
1994
+ onClick: () => {
1995
+ const h = c[d - 1];
1996
+ h && i(h);
1997
+ },
1998
+ children: o("booking.actions.back")
1999
+ }
2000
+ ),
2001
+ n < 7 ? /* @__PURE__ */ a(
2002
+ ae,
2003
+ {
2004
+ intent: "primary",
2005
+ size: "md",
2006
+ disabled: !k,
2007
+ onClick: () => {
2008
+ const h = c[d + 1];
2009
+ h && i(h);
2010
+ },
2011
+ children: o("booking.actions.next")
2012
+ }
2013
+ ) : null
2014
+ ] })
2015
+ ] });
2016
+ }
2017
+ const Oa = [], Ea = [], Pa = ze(
2018
+ ({
2019
+ variant: e = "inline-list",
2020
+ country: t,
2021
+ useSpecialties: s = !1,
2022
+ allowOperatorSelection: n = !1,
2023
+ lockedOperatorId: i,
2024
+ autoSelectSingleService: o = !1,
2025
+ specialties: l,
2026
+ services: c,
2027
+ operators: d,
2028
+ availableDates: p,
2029
+ availableSlots: g,
2030
+ nextAvailableDate: u,
2031
+ requireCodiceFiscale: k,
2032
+ requireDateOfBirth: h,
2033
+ requireInsuranceNumber: x,
2034
+ showNote: y,
2035
+ showReturningPatientFlag: C,
2036
+ privacyPolicyUrl: _,
2037
+ termsUrl: S,
2038
+ validateCodiceFiscale: v,
2039
+ validateInsuranceNumber: r,
2040
+ confirmationChannels: O,
2041
+ defaultConfirmationChannels: M,
2042
+ value: b,
2043
+ onChange: N,
2044
+ onSubmit: R,
2045
+ loadingSlots: E,
2046
+ submitting: J,
2047
+ submitError: P,
2048
+ mode: z = "live",
2049
+ showModifyOnSuccess: H = !0,
2050
+ emptyServicesSlot: D,
2051
+ onboardingIncompleteSlot: X,
2052
+ "aria-label": G,
2053
+ id: se,
2054
+ className: ne,
2055
+ ...Ne
2056
+ }, W) => {
2057
+ const { t: Q, i18n: le } = T(), L = e ?? "inline-list", ie = le.language ?? "en", $ = l ?? Oa, j = d ?? Ea;
2058
+ re(() => {
2059
+ const V = ma(b, {
2060
+ useSpecialties: s,
2061
+ lockedOperatorId: i,
2062
+ autoSelectSingleService: o,
2063
+ specialties: $,
2064
+ services: c
2065
+ });
2066
+ (V.specialtyId !== b.specialtyId || V.operatorId !== b.operatorId || V.serviceId !== b.serviceId) && N(V);
2067
+ }, [
2068
+ i,
2069
+ s,
2070
+ o,
2071
+ $,
2072
+ c
2073
+ ]);
2074
+ const A = w(
2075
+ () => ca({
2076
+ country: t,
2077
+ useSpecialties: s,
2078
+ allowOperatorSelection: n,
2079
+ lockedOperatorId: i,
2080
+ specialties: $,
2081
+ services: c,
2082
+ operators: j,
2083
+ availableSlots: g,
2084
+ value: b
2085
+ }),
2086
+ [
2087
+ t,
2088
+ s,
2089
+ n,
2090
+ i,
2091
+ o,
2092
+ $,
2093
+ c,
2094
+ j,
2095
+ p,
2096
+ g,
2097
+ b
2098
+ ]
2099
+ ), [ce, U] = q(
2100
+ A.currentStep
2101
+ ), me = de(A.currentStep);
2102
+ re(() => {
2103
+ A.currentStep > me.current && U(A.currentStep), me.current = A.currentStep;
2104
+ }, [A.currentStep]);
2105
+ const [m, I] = q("idle"), [oe, Ie] = q(null), Oe = te(
2106
+ async (V) => {
2107
+ if (!A.selectedSlot) return;
2108
+ const Ce = {
2109
+ slot: A.selectedSlot,
2110
+ value: {
2111
+ ...b,
2112
+ details: V,
2113
+ operatorId: _e(b) ?? b.operatorId
2114
+ },
2115
+ details: V
2116
+ };
2117
+ I("submitting");
2118
+ try {
2119
+ await R(Ce), Ie({
2120
+ slot: A.selectedSlot,
2121
+ details: V,
2122
+ specialtyId: b.specialtyId,
2123
+ serviceId: b.serviceId,
2124
+ insuranceType: b.insuranceType,
2125
+ operatorId: _e(b),
2126
+ date: b.date
2127
+ }), I("success");
2128
+ } catch {
2129
+ throw I("error"), new Error("Booking submission failed");
2130
+ }
2131
+ },
2132
+ [A.selectedSlot, R, b]
2133
+ ), Ee = de(null);
2134
+ lt(W, () => Ee.current, []);
2135
+ const we = w(
2136
+ () => ({
2137
+ getVariant: () => L,
2138
+ reset: () => {
2139
+ N({}), Ie(null), I("idle"), U(1);
2140
+ },
2141
+ goToStep: (V) => {
2142
+ U(V);
2143
+ }
2144
+ }),
2145
+ [L, N]
2146
+ );
2147
+ mt(sa, we, se);
2148
+ const ot = G ?? Q("booking.regionLabel"), rt = w(() => m !== "success" || !oe ? null : /* @__PURE__ */ a(
2149
+ Ma,
2150
+ {
2151
+ snapshot: oe,
2152
+ operators: j,
2153
+ specialties: $,
2154
+ services: c,
2155
+ locale: ie,
2156
+ mode: z,
2157
+ showModify: H,
2158
+ onReset: () => we.reset(),
2159
+ onModify: () => {
2160
+ Ie(null), I("idle"), U(7);
2161
+ }
2162
+ }
2163
+ ), [
2164
+ m,
2165
+ oe,
2166
+ j,
2167
+ $,
2168
+ c,
2169
+ ie,
2170
+ z,
2171
+ H,
2172
+ we
2173
+ ]), dt = w(() => {
2174
+ if (m === "success") return null;
2175
+ const V = L === "accordion" ? Ta : L === "calendar" ? _a : L === "flexible" ? Aa : L === "progress" ? Ba : Da, Ce = {
2176
+ cascade: A,
2177
+ inputs: {
2178
+ specialties: $,
2179
+ services: c,
2180
+ operators: j,
2181
+ availableDates: p,
2182
+ availableSlots: g,
2183
+ nextAvailableDate: u
2184
+ },
2185
+ value: b,
2186
+ onChange: N,
2187
+ onSubmit: Oe,
2188
+ policy: { country: t, lockedOperatorId: i },
2189
+ detailsProps: {
2190
+ requireCodiceFiscale: k,
2191
+ requireDateOfBirth: h,
2192
+ requireInsuranceNumber: x,
2193
+ insuranceType: b.insuranceType,
2194
+ showNote: y,
2195
+ showReturningPatientFlag: C,
2196
+ privacyPolicyUrl: _,
2197
+ termsUrl: S,
2198
+ validateCodiceFiscale: v,
2199
+ validateInsuranceNumber: r,
2200
+ confirmationChannels: O,
2201
+ defaultConfirmationChannels: M,
2202
+ submitError: P
2203
+ },
2204
+ emptyServicesSlot: D,
2205
+ onboardingIncompleteSlot: X,
2206
+ loadingSlots: E,
2207
+ submitting: J,
2208
+ locale: ie,
2209
+ activeStep: ce,
2210
+ setActiveStep: U
2211
+ };
2212
+ return /* @__PURE__ */ a(V, { ...Ce });
2213
+ }, [
2214
+ m,
2215
+ L,
2216
+ A,
2217
+ $,
2218
+ c,
2219
+ j,
2220
+ p,
2221
+ g,
2222
+ u,
2223
+ b,
2224
+ N,
2225
+ Oe,
2226
+ t,
2227
+ i,
2228
+ k,
2229
+ h,
2230
+ x,
2231
+ P,
2232
+ y,
2233
+ C,
2234
+ _,
2235
+ S,
2236
+ v,
2237
+ r,
2238
+ O,
2239
+ M,
2240
+ D,
2241
+ X,
2242
+ E,
2243
+ J,
2244
+ ie,
2245
+ ce
2246
+ ]);
2247
+ return /* @__PURE__ */ f(
2248
+ "div",
2249
+ {
2250
+ ref: Ee,
2251
+ role: "region",
2252
+ "aria-label": ot,
2253
+ id: se,
2254
+ "data-component": "booking",
2255
+ "data-component-id": se,
2256
+ "data-variant": L,
2257
+ className: ha({ variant: L, className: ne }),
2258
+ ...Ne,
2259
+ children: [
2260
+ /* @__PURE__ */ f(
2261
+ "div",
2262
+ {
2263
+ className: [
2264
+ "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
2265
+ L === "inline-list" ? [
2266
+ "ds:rounded-[var(--radius-md)]",
2267
+ "ds:bg-[color-mix(in_srgb,var(--primary)_35%,var(--background))]",
2268
+ "ds:bg-[image:var(--gradient-hero-brand)]",
2269
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
2270
+ "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]"
2271
+ ].join(" ") : ""
2272
+ ].filter(Boolean).join(" "),
2273
+ children: [
2274
+ /* @__PURE__ */ a("h2", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: Q("booking.regionLabel") }),
2275
+ /* @__PURE__ */ a("p", { className: "type-body-sm ds:text-[var(--muted-foreground)] ds:m-0", children: Q("booking.headingSubtitle") })
2276
+ ]
2277
+ }
2278
+ ),
2279
+ rt ?? dt
2280
+ ]
2281
+ }
2282
+ );
2283
+ }
2284
+ );
2285
+ Pa.displayName = "Booking";
2286
+ export {
2287
+ Pa as B,
2288
+ Te as C,
2289
+ pe as O,
2290
+ sa as b
2291
+ };
2292
+ //# sourceMappingURL=booking-Bw9eOU4k.js.map