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