@alfadocs/ui-kit 0.25.2 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/_chunks/booking-BYuc_8HV.js +2250 -0
  2. package/dist/_chunks/{calendar-9eOXumpH.js → calendar-WWNx448i.js} +10 -9
  3. package/dist/_chunks/{contact-card-CeEfEAxh.js → contact-card-DYbp--s-.js} +2 -2
  4. package/dist/_chunks/{header-B8V_sNPy.js → header-CkMb1TZS.js} +23 -23
  5. package/dist/_chunks/heart-pulse-CvuyFKHB.js +21 -0
  6. package/dist/_chunks/{link-DmM5IevO.js → link-DrD_cRUg.js} +50 -45
  7. package/dist/_chunks/parseISO-Dk4xa7q6.js +120 -0
  8. package/dist/_chunks/patient-search-BhlxYAI3.js +1102 -0
  9. package/dist/_chunks/{patient-shell-Bq8CjRYF.js → patient-shell-CAXYzbRw.js} +2 -2
  10. package/dist/_chunks/public-footer.agent-CA29gxHJ.js +516 -0
  11. package/dist/_chunks/reviews-panel-CFttsfuC.js +513 -0
  12. package/dist/_chunks/slot-grid-B2zprPcv.js +387 -0
  13. package/dist/_chunks/stethoscope-DT5qCW8Y.js +18 -0
  14. package/dist/agent-catalog.json +117 -22
  15. package/dist/components/booking/booking-types.d.ts +145 -0
  16. package/dist/components/booking/booking.agent.d.ts +1 -1
  17. package/dist/components/booking/booking.d.ts +4 -89
  18. package/dist/components/booking/cascade.d.ts +96 -0
  19. package/dist/components/booking/details-form.d.ts +32 -0
  20. package/dist/components/booking/index.d.ts +2 -1
  21. package/dist/components/booking/index.js +5 -3
  22. package/dist/components/calendar/index.js +1 -1
  23. package/dist/components/checkbox/checkbox.d.ts +6 -2
  24. package/dist/components/contact-card/index.js +1 -1
  25. package/dist/components/header/index.js +1 -1
  26. package/dist/components/index.d.ts +3 -0
  27. package/dist/components/link/index.js +1 -1
  28. package/dist/components/link/link.d.ts +7 -0
  29. package/dist/components/patient-search/index.d.ts +4 -0
  30. package/dist/components/patient-search/index.js +6 -0
  31. package/dist/components/patient-search/patient-search.agent.d.ts +4 -0
  32. package/dist/components/patient-search/patient-search.d.ts +103 -0
  33. package/dist/components/public-footer/index.d.ts +6 -0
  34. package/dist/components/public-footer/index.js +10 -0
  35. package/dist/components/public-footer/legal-urls.d.ts +18 -0
  36. package/dist/components/public-footer/public-footer.agent.d.ts +4 -0
  37. package/dist/components/public-footer/public-footer.d.ts +51 -0
  38. package/dist/components/public-footer/socials.d.ts +9 -0
  39. package/dist/components/reviews-panel/index.d.ts +4 -0
  40. package/dist/components/reviews-panel/index.js +6 -0
  41. package/dist/components/reviews-panel/reviews-panel.agent.d.ts +4 -0
  42. package/dist/components/reviews-panel/reviews-panel.d.ts +76 -0
  43. package/dist/components/slot-grid/index.js +1 -1
  44. package/dist/i18n/config.js +3866 -36
  45. package/dist/i18n/locales/ar.d.ts +214 -0
  46. package/dist/i18n/locales/de.d.ts +214 -0
  47. package/dist/i18n/locales/el.d.ts +214 -0
  48. package/dist/i18n/locales/es.d.ts +214 -0
  49. package/dist/i18n/locales/fr.d.ts +214 -0
  50. package/dist/i18n/locales/hi.d.ts +214 -0
  51. package/dist/i18n/locales/ja.d.ts +214 -0
  52. package/dist/i18n/locales/nl.d.ts +214 -0
  53. package/dist/i18n/locales/pl.d.ts +214 -0
  54. package/dist/i18n/locales/pt.d.ts +214 -0
  55. package/dist/i18n/locales/ro.d.ts +214 -0
  56. package/dist/i18n/locales/ru.d.ts +214 -0
  57. package/dist/i18n/locales/sq.d.ts +214 -0
  58. package/dist/i18n/locales/sv.d.ts +214 -0
  59. package/dist/i18n/locales/tr.d.ts +214 -0
  60. package/dist/i18n/locales/zh.d.ts +214 -0
  61. package/dist/i18n/resources.d.ts +428 -0
  62. package/dist/index.js +351 -336
  63. package/dist/locales/ar.json +215 -1
  64. package/dist/locales/de.json +215 -1
  65. package/dist/locales/el.json +215 -1
  66. package/dist/locales/en.json +215 -1
  67. package/dist/locales/es.json +215 -1
  68. package/dist/locales/fr.json +215 -1
  69. package/dist/locales/hi.json +215 -1
  70. package/dist/locales/it.json +215 -1
  71. package/dist/locales/ja.json +215 -1
  72. package/dist/locales/nl.json +215 -1
  73. package/dist/locales/pl.json +215 -1
  74. package/dist/locales/pt.json +215 -1
  75. package/dist/locales/ro.json +215 -1
  76. package/dist/locales/ru.json +215 -1
  77. package/dist/locales/sq.json +215 -1
  78. package/dist/locales/sv.json +215 -1
  79. package/dist/locales/tr.json +215 -1
  80. package/dist/locales/zh.json +215 -1
  81. package/dist/patterns/patient-shell/index.js +1 -1
  82. package/dist/tokens.css +1 -1
  83. package/package.json +13 -1
  84. package/dist/_chunks/booking-CXngC-1u.js +0 -1743
  85. package/dist/_chunks/slot-grid-DoodeQGZ.js +0 -502
  86. package/dist/_chunks/stethoscope-B8kpbtjh.js +0 -35
@@ -0,0 +1,1102 @@
1
+ import { jsx as a, jsxs as _ } from "react/jsx-runtime";
2
+ import { forwardRef as le, useRef as S, useEffect as B, useMemo as Y, useImperativeHandle as ue, useState as z, useCallback as M, useId as fe } from "react";
3
+ import { c as P } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as C } from "react-i18next";
5
+ import { A as re } from "./autocomplete-CUh0f7Dj.js";
6
+ import { B as pe } from "./button-DD_0Xdmr.js";
7
+ import { C as H } from "./card-DKTMLVrw.js";
8
+ import { S as he } from "./slider-CfEzeseL.js";
9
+ import { A as ee } from "./alert-ywPR59NE.js";
10
+ import { D as W } from "./dropdown-menu-DZxwF23X.js";
11
+ import { u as me } from "./registry-C9nwlNyL.js";
12
+ import { S as ne } from "./search-BonnQsHv.js";
13
+ import { X as ie } from "./x-CCcI3eJp.js";
14
+ import { c as ve } from "./createLucideIcon-CrFbzy84.js";
15
+ import { M as ge } from "./map-pin-B8STOPMJ.js";
16
+ import { S as be } from "./stethoscope-DT5qCW8Y.js";
17
+ import { C as xe } from "./chevron-down-BX_NP2Yh.js";
18
+ /**
19
+ * @license lucide-react v1.8.0 - ISC
20
+ *
21
+ * This source code is licensed under the ISC license.
22
+ * See the LICENSE file in the root directory of this source tree.
23
+ */
24
+ const ye = [
25
+ ["line", { x1: "2", x2: "5", y1: "12", y2: "12", key: "bvdh0s" }],
26
+ ["line", { x1: "19", x2: "22", y1: "12", y2: "12", key: "1tbv5k" }],
27
+ ["line", { x1: "12", x2: "12", y1: "2", y2: "5", key: "11lu5j" }],
28
+ ["line", { x1: "12", x2: "12", y1: "19", y2: "22", key: "x3vr5v" }],
29
+ ["circle", { cx: "12", cy: "12", r: "7", key: "fim9np" }],
30
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
31
+ ], we = ve("locate-fixed", ye), _e = {
32
+ id: "patient-search",
33
+ capabilities: ["navigate", "view_change"],
34
+ state: {
35
+ variant: {
36
+ type: "string",
37
+ descriptionKey: "ui.agent.patientSearch.state.variant",
38
+ description: "Active variant — one of `who-where`, `who-where-when`, `faceted`, `discovery`.",
39
+ read: (e) => e.getVariant()
40
+ }
41
+ },
42
+ actions: {
43
+ reset: {
44
+ safety: "write",
45
+ descriptionKey: "ui.agent.patientSearch.actions.reset",
46
+ description: "Clear the current selection (WHO, WHERE, WHEN, facets, geo) via the consumer-owned onChange.",
47
+ invoke: (e) => {
48
+ e.reset();
49
+ }
50
+ },
51
+ focus_primary: {
52
+ safety: "read",
53
+ descriptionKey: "ui.agent.patientSearch.actions.focusPrimary",
54
+ description: "Move keyboard focus to the most-relevant field for the current variant.",
55
+ invoke: (e) => {
56
+ e.focusPrimary();
57
+ }
58
+ }
59
+ },
60
+ domHooks: {
61
+ root: {
62
+ attr: "data-component",
63
+ value: "patient-search",
64
+ description: "Marks the PatientSearch root region."
65
+ },
66
+ instanceId: {
67
+ attr: "data-component-id",
68
+ sourceProp: "id",
69
+ description: "Sourced from the id prop."
70
+ }
71
+ }
72
+ };
73
+ function w(e, s) {
74
+ if (typeof window > "u") return;
75
+ const t = window.track;
76
+ try {
77
+ t == null || t(e, s);
78
+ } catch {
79
+ }
80
+ }
81
+ const A = [
82
+ "today",
83
+ "tomorrow",
84
+ "this_week",
85
+ "anytime"
86
+ ], D = [1, 5, 10, 25, 50], oe = 5, de = 200;
87
+ function Se(e) {
88
+ let s = 0, t = Number.POSITIVE_INFINITY;
89
+ return D.forEach((d, h) => {
90
+ const m = Math.abs(d - e);
91
+ m < t && (t = m, s = h);
92
+ }), s;
93
+ }
94
+ const Ne = P(
95
+ "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
96
+ {
97
+ variants: {
98
+ variant: {
99
+ "who-where": "ds:gap-[var(--spacing-md)]",
100
+ "who-where-when": "ds:gap-[var(--spacing-md)]",
101
+ faceted: "ds:gap-[var(--spacing-md)]",
102
+ discovery: "ds:gap-[var(--spacing-lg)]"
103
+ }
104
+ },
105
+ defaultVariants: { variant: "who-where" }
106
+ }
107
+ );
108
+ function $({
109
+ value: e,
110
+ onChange: s,
111
+ loadObjects: t,
112
+ onObjectSelect: d,
113
+ inputRef: h
114
+ }) {
115
+ var i, f, p, x;
116
+ const { t: m } = C(), [b, u] = z(((i = e.object) == null ? void 0 : i.label) ?? ""), y = S((f = e.object) == null ? void 0 : f.value);
117
+ B(() => {
118
+ var v, o, T;
119
+ ((v = e.object) == null ? void 0 : v.value) !== y.current && (y.current = (o = e.object) == null ? void 0 : o.value, u(((T = e.object) == null ? void 0 : T.label) ?? ""));
120
+ }, [(p = e.object) == null ? void 0 : p.value, (x = e.object) == null ? void 0 : x.label]);
121
+ const n = M(
122
+ async (v, { signal: o }) => await t(v, { signal: o }),
123
+ [t]
124
+ ), c = (v) => {
125
+ const o = {
126
+ value: v.value,
127
+ label: v.label,
128
+ description: v.description,
129
+ __payload: v.__payload
130
+ };
131
+ u(o.label), y.current = o.value, s({ ...e, object: o }), w("patient_search_object_selected", {
132
+ value: o.value,
133
+ type: o.__payload && typeof o.__payload == "object" ? o.__payload.type : void 0
134
+ }), d == null || d(o);
135
+ }, r = S(!1);
136
+ return /* @__PURE__ */ a(
137
+ "div",
138
+ {
139
+ "data-component": "patient-search-field",
140
+ "data-field": "who",
141
+ onFocus: () => {
142
+ r.current || (r.current = !0, w("patient_search_object_focused"));
143
+ },
144
+ onBlur: (v) => {
145
+ v.currentTarget && !v.currentTarget.contains(v.relatedTarget) && (r.current = !1);
146
+ },
147
+ children: /* @__PURE__ */ a(
148
+ re,
149
+ {
150
+ ref: h,
151
+ value: b,
152
+ onChange: (v) => {
153
+ u(v), e.object && v !== e.object.label && (y.current = void 0, s({ ...e, object: void 0 }));
154
+ },
155
+ onSelect: c,
156
+ loadOptions: n,
157
+ debounceMs: de,
158
+ placeholder: m("patientSearch.who.placeholder"),
159
+ "aria-label": m("patientSearch.who.label"),
160
+ startAdornment: /* @__PURE__ */ a(ne, { "aria-hidden": "true" })
161
+ }
162
+ )
163
+ }
164
+ );
165
+ }
166
+ const ae = [
167
+ "ds:inline-flex ds:items-center ds:justify-center",
168
+ "ds:size-8 ds:rounded-[var(--radius-sm)]",
169
+ "ds:text-[color:var(--muted-foreground)] ds:hover:text-[color:var(--primary)]",
170
+ "ds:hover:bg-[color-mix(in_srgb,var(--primary)_8%,transparent)]",
171
+ "ds:aria-pressed:text-[color:var(--primary)]",
172
+ "ds:aria-pressed:bg-[color-mix(in_srgb,var(--primary)_12%,transparent)]",
173
+ "ds:disabled:opacity-50 ds:disabled:cursor-not-allowed",
174
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
175
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
176
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
177
+ ].join(" ");
178
+ function q({
179
+ value: e,
180
+ onChange: s,
181
+ loadPlaces: t,
182
+ onPlaceSelect: d,
183
+ inputRef: h,
184
+ defaultRadiusKm: m = oe,
185
+ reverseGeocode: b
186
+ }) {
187
+ var V, L, E, R;
188
+ const { t: u } = C(), [y, n] = z(((V = e.place) == null ? void 0 : V.label) ?? ""), c = S((L = e.place) == null ? void 0 : L.value), r = e.geo ? "granted" : "pristine", [i, f] = z(r), [p, x] = z(
189
+ () => {
190
+ var l;
191
+ return Se(((l = e.geo) == null ? void 0 : l.radiusKm) ?? m);
192
+ }
193
+ );
194
+ B(() => {
195
+ var l, g, j;
196
+ ((l = e.place) == null ? void 0 : l.value) !== c.current && (c.current = (g = e.place) == null ? void 0 : g.value, n(((j = e.place) == null ? void 0 : j.label) ?? ""));
197
+ }, [(E = e.place) == null ? void 0 : E.value, (R = e.place) == null ? void 0 : R.label]);
198
+ const v = M(
199
+ async (l, { signal: g }) => await t(l, { signal: g }),
200
+ [t]
201
+ ), o = (l) => {
202
+ const g = {
203
+ value: l.value,
204
+ label: l.label,
205
+ lat: l.lat,
206
+ lng: l.lng
207
+ };
208
+ n(g.label), c.current = g.value, s({ ...e, place: g, geo: void 0 }), i === "granted" && f("pristine"), w("patient_search_place_selected", { value: g.value }), d == null || d(g);
209
+ }, T = () => {
210
+ if (typeof window > "u" || !(navigator != null && navigator.geolocation)) {
211
+ f("denied"), w("patient_search_geo_denied", { reason: "unsupported" });
212
+ return;
213
+ }
214
+ f("requesting"), w("patient_search_place_focused"), navigator.geolocation.getCurrentPosition(
215
+ async (l) => {
216
+ const { latitude: g, longitude: j } = l.coords;
217
+ let X;
218
+ try {
219
+ X = await (b == null ? void 0 : b(g, j));
220
+ } catch {
221
+ X = void 0;
222
+ }
223
+ const J = D[p] ?? m, Z = X ?? u("patientSearch.geo.fallbackLabel"), ce = {
224
+ value: `geo:${g.toFixed(4)},${j.toFixed(4)}`,
225
+ label: Z,
226
+ lat: g,
227
+ lng: j
228
+ };
229
+ s({
230
+ ...e,
231
+ place: ce,
232
+ geo: {
233
+ lat: g,
234
+ lng: j,
235
+ radiusKm: J,
236
+ label: Z
237
+ }
238
+ }), f("granted"), w("patient_search_geo_granted", { radiusKm: J });
239
+ },
240
+ () => {
241
+ f("denied"), w("patient_search_geo_denied", { reason: "user" });
242
+ },
243
+ { enableHighAccuracy: !1, maximumAge: 6e4, timeout: 1e4 }
244
+ );
245
+ }, F = () => {
246
+ s({ ...e, geo: void 0, place: void 0 }), n(""), c.current = void 0, f("pristine");
247
+ }, G = (l) => {
248
+ const g = D[l] ?? m;
249
+ e.geo && s({ ...e, geo: { ...e.geo, radiusKm: g } }), w("patient_search_radius_changed", { radiusKm: g });
250
+ }, Q = (l) => {
251
+ const g = D[Math.round(l)] ?? m;
252
+ return u("patientSearch.geo.radiusFormat", { km: g });
253
+ }, N = i === "granted" && !!e.geo, K = i === "requesting", I = i === "denied", k = S(!1), O = I ? null : /* @__PURE__ */ _("span", { className: "ds:absolute ds:end-[var(--spacing-xs)] ds:top-1/2 ds:-translate-y-1/2 ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
254
+ N ? /* @__PURE__ */ a(
255
+ "button",
256
+ {
257
+ type: "button",
258
+ "aria-label": u("patientSearch.geo.clear"),
259
+ onClick: F,
260
+ className: ae,
261
+ children: /* @__PURE__ */ a(ie, { "aria-hidden": "true", className: "ds:size-4" })
262
+ }
263
+ ) : null,
264
+ /* @__PURE__ */ a(
265
+ "button",
266
+ {
267
+ type: "button",
268
+ "aria-label": u("patientSearch.geo.cta"),
269
+ "aria-pressed": N || void 0,
270
+ disabled: K,
271
+ onClick: N ? F : T,
272
+ className: ae,
273
+ children: /* @__PURE__ */ a(we, { "aria-hidden": "true", className: "ds:size-4" })
274
+ }
275
+ )
276
+ ] });
277
+ return /* @__PURE__ */ _(
278
+ "div",
279
+ {
280
+ "data-component": "patient-search-field",
281
+ "data-field": "where",
282
+ onFocus: () => {
283
+ k.current || (k.current = !0, w("patient_search_place_focused"));
284
+ },
285
+ onBlur: (l) => {
286
+ l.currentTarget && !l.currentTarget.contains(l.relatedTarget) && (k.current = !1);
287
+ },
288
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
289
+ children: [
290
+ /* @__PURE__ */ _("div", { className: "ds:relative", children: [
291
+ /* @__PURE__ */ a(
292
+ re,
293
+ {
294
+ ref: h,
295
+ value: y,
296
+ onChange: (l) => {
297
+ n(l), e.place && l !== e.place.label && (c.current = void 0, s({ ...e, place: void 0, geo: void 0 }), i === "granted" && f("pristine"));
298
+ },
299
+ onSelect: o,
300
+ loadOptions: v,
301
+ debounceMs: de,
302
+ placeholder: u("patientSearch.where.placeholder"),
303
+ "aria-label": u("patientSearch.where.label"),
304
+ startAdornment: /* @__PURE__ */ a(ge, { "aria-hidden": "true" }),
305
+ endAdornment: I ? void 0 : (
306
+ // Decorative spacer — reserves inline-end room so the typed
307
+ // text doesn't run under the absolutely-positioned overlay.
308
+ // Autocomplete wraps endAdornment in `aria-hidden`, which is
309
+ // correct for this empty span. Granted-state shows an extra
310
+ // clear-X chip, so the spacer doubles in width when granted.
311
+ /* @__PURE__ */ a(
312
+ "span",
313
+ {
314
+ "aria-hidden": "true",
315
+ className: N ? "ds:inline-block ds:size-[4.5rem]" : "ds:inline-block ds:size-8"
316
+ }
317
+ )
318
+ )
319
+ }
320
+ ),
321
+ O
322
+ ] }),
323
+ N ? (
324
+ // Slider marks render with `translate(-50%)` so half of each
325
+ // end-mark ("1" and "50" labels) sits outside the slider's
326
+ // bounding box. The parent Card uses `overflow: hidden`, which
327
+ // would clip them — the inline padding pulls the rail inset by
328
+ // half a label width so the overhang lands inside the card.
329
+ /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pb-[var(--spacing-md)]", children: [
330
+ /* @__PURE__ */ a(
331
+ "span",
332
+ {
333
+ id: "patient-search-radius-label",
334
+ className: "type-meta ds:text-[color:var(--muted-foreground)]",
335
+ children: u("patientSearch.geo.radius")
336
+ }
337
+ ),
338
+ /* @__PURE__ */ a(
339
+ he,
340
+ {
341
+ value: [p],
342
+ min: 0,
343
+ max: D.length - 1,
344
+ step: 1,
345
+ marks: D.map((l, g) => ({
346
+ value: g,
347
+ label: `${l}`
348
+ })),
349
+ formatValue: Q,
350
+ alwaysShowValue: !0,
351
+ "aria-labelledby": "patient-search-radius-label",
352
+ onValueChange: (l) => x(l[0] ?? 0),
353
+ onValueCommit: (l) => G(l[0] ?? 0)
354
+ }
355
+ )
356
+ ] })
357
+ ) : null,
358
+ I ? (
359
+ // Alert defaults to `role="status"` + `aria-live="polite"` for the
360
+ // `info` variant — the user hears why the field reverted to plain
361
+ // text when their browser blocked the geolocation prompt.
362
+ /* @__PURE__ */ a(ee, { variant: "info", children: /* @__PURE__ */ a(ee.Description, { children: u("patientSearch.geo.denied") }) })
363
+ ) : null
364
+ ]
365
+ }
366
+ );
367
+ }
368
+ const ke = P(
369
+ [
370
+ "ds:inline-flex ds:items-center ds:justify-center",
371
+ "ds:min-h-[var(--min-target-size)]",
372
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
373
+ "ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]",
374
+ "ds:rounded-[var(--radius-full)]",
375
+ "type-label ds:font-[var(--font-weight-medium)]",
376
+ "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
377
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
378
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
379
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
380
+ ].join(" "),
381
+ {
382
+ variants: {
383
+ state: {
384
+ idle: "ds:bg-[var(--secondary)] ds:text-[var(--foreground)] ds:border ds:border-[color:var(--border)] ds:hover:bg-[color-mix(in_srgb,var(--primary)_8%,var(--secondary))]",
385
+ selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:border ds:border-transparent ds:font-[var(--font-weight-semibold)]"
386
+ }
387
+ },
388
+ defaultVariants: { state: "idle" }
389
+ }
390
+ );
391
+ function Re({ value: e, onChange: s }) {
392
+ const { t, i18n: d } = C(), h = fe(), m = d.dir() === "rtl", b = S(/* @__PURE__ */ new Map()), u = M((r) => {
393
+ var i;
394
+ (i = b.current.get(r)) == null || i.focus();
395
+ }, []), y = M(
396
+ (r, i) => {
397
+ const f = A.indexOf(i), p = A.length, x = m ? "ArrowLeft" : "ArrowRight", v = m ? "ArrowRight" : "ArrowLeft";
398
+ switch (r.key) {
399
+ case x:
400
+ case "ArrowDown": {
401
+ r.preventDefault();
402
+ const o = A[(f + 1) % p];
403
+ s(o), w("patient_search_when_selected", { when: o }), u(o);
404
+ break;
405
+ }
406
+ case v:
407
+ case "ArrowUp": {
408
+ r.preventDefault();
409
+ const o = A[(f - 1 + p) % p];
410
+ s(o), w("patient_search_when_selected", { when: o }), u(o);
411
+ break;
412
+ }
413
+ case "Home": {
414
+ r.preventDefault();
415
+ const o = A[0];
416
+ s(o), w("patient_search_when_selected", { when: o }), u(o);
417
+ break;
418
+ }
419
+ case "End": {
420
+ r.preventDefault();
421
+ const o = A[p - 1];
422
+ s(o), w("patient_search_when_selected", { when: o }), u(o);
423
+ break;
424
+ }
425
+ }
426
+ },
427
+ [u, m, s]
428
+ ), n = e ?? "anytime", c = {
429
+ today: "patientSearch.when.today",
430
+ tomorrow: "patientSearch.when.tomorrow",
431
+ this_week: "patientSearch.when.thisWeek",
432
+ anytime: "patientSearch.when.anytime"
433
+ };
434
+ return /* @__PURE__ */ a(
435
+ "div",
436
+ {
437
+ role: "radiogroup",
438
+ "aria-label": t("patientSearch.when.label"),
439
+ id: h,
440
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
441
+ children: A.map((r) => {
442
+ const i = e === r, f = n === r, p = t(c[r]);
443
+ return /* @__PURE__ */ a(
444
+ "button",
445
+ {
446
+ type: "button",
447
+ role: "radio",
448
+ "aria-checked": i,
449
+ "aria-label": p,
450
+ tabIndex: f ? 0 : -1,
451
+ ref: (x) => {
452
+ x ? b.current.set(r, x) : b.current.delete(r);
453
+ },
454
+ onClick: () => {
455
+ s(r), w("patient_search_when_selected", { when: r });
456
+ },
457
+ onKeyDown: (x) => y(x, r),
458
+ className: ke({
459
+ state: i ? "selected" : "idle"
460
+ }),
461
+ children: p
462
+ },
463
+ r
464
+ );
465
+ })
466
+ }
467
+ );
468
+ }
469
+ const te = P(
470
+ [
471
+ "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
472
+ "ds:min-h-[var(--min-target-size)]",
473
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
474
+ "ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]",
475
+ "ds:rounded-[var(--radius-full)]",
476
+ "type-label",
477
+ "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
478
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
479
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
480
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
481
+ ].join(" "),
482
+ {
483
+ variants: {
484
+ // Matches the WHEN chip strip's `selected` look — solid primary fill,
485
+ // primary-foreground text, transparent border. The earlier
486
+ // `color-mix(primary 12% / secondary)` tint read as a washed-out
487
+ // colour over the grey input row and didn't visually signal "this
488
+ // filter is active" with enough weight. Solid fill matches the kit's
489
+ // toggle-button precedent (SuggestionChip's `suggestion` intent + the
490
+ // ServiceGrid radio's selected state in Booking).
491
+ state: {
492
+ idle: "ds:bg-[var(--secondary)] ds:text-[var(--foreground)] ds:border ds:border-[color:var(--border)] ds:hover:bg-[color-mix(in_srgb,var(--primary)_8%,var(--secondary))]",
493
+ active: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:border ds:border-transparent ds:font-[var(--font-weight-semibold)]"
494
+ }
495
+ },
496
+ defaultVariants: { state: "idle" }
497
+ }
498
+ );
499
+ function je({ facets: e, value: s, onChange: t }) {
500
+ const { t: d } = C(), h = Y(() => s ?? {}, [s]), m = Y(
501
+ () => Object.values(h).some((n) => n && n.length > 0),
502
+ [h]
503
+ ), b = (n, c) => {
504
+ const r = { ...h };
505
+ c.length === 0 ? delete r[n] : r[n] = c, t(r), w("patient_search_facet_changed", { key: n, values: c });
506
+ }, u = (n) => {
507
+ var r;
508
+ const c = (((r = h[n]) == null ? void 0 : r.length) ?? 0) > 0;
509
+ b(n, c ? [] : ["true"]);
510
+ }, y = (n, c) => {
511
+ const r = h[n.key] ?? [], i = r.includes(c);
512
+ let f;
513
+ n.multi ? f = i ? r.filter((p) => p !== c) : [...r, c] : f = i ? [] : [c], b(n.key, f);
514
+ };
515
+ return /* @__PURE__ */ _(
516
+ "div",
517
+ {
518
+ role: "group",
519
+ "aria-label": d("patientSearch.facets.label"),
520
+ className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
521
+ children: [
522
+ e.map((n) => {
523
+ const c = n.options.length === 0, r = h[n.key] ?? [], i = r.length > 0;
524
+ if (c)
525
+ return /* @__PURE__ */ a(
526
+ "button",
527
+ {
528
+ type: "button",
529
+ "aria-pressed": i,
530
+ "aria-label": n.label,
531
+ onClick: () => u(n.key),
532
+ className: te({
533
+ state: i ? "active" : "idle"
534
+ }),
535
+ children: /* @__PURE__ */ a("span", { children: n.label })
536
+ },
537
+ n.key
538
+ );
539
+ const f = i ? ` (${r.length})` : "";
540
+ return /* @__PURE__ */ _(W.Root, { children: [
541
+ /* @__PURE__ */ a(W.Trigger, { asChild: !0, children: /* @__PURE__ */ _(
542
+ "button",
543
+ {
544
+ type: "button",
545
+ "aria-label": `${n.label}${f}`,
546
+ className: te({
547
+ state: i ? "active" : "idle"
548
+ }),
549
+ children: [
550
+ /* @__PURE__ */ _("span", { children: [
551
+ n.label,
552
+ f
553
+ ] }),
554
+ /* @__PURE__ */ a(
555
+ xe,
556
+ {
557
+ "aria-hidden": "true",
558
+ className: "ds:size-3.5 ds:shrink-0"
559
+ }
560
+ )
561
+ ]
562
+ }
563
+ ) }),
564
+ /* @__PURE__ */ a(W.Content, { sideOffset: 8, align: "start", children: n.options.map((p) => /* @__PURE__ */ a(
565
+ W.CheckboxItem,
566
+ {
567
+ checked: r.includes(p.value),
568
+ onSelect: (x) => {
569
+ n.multi && x.preventDefault(), y(n, p.value);
570
+ },
571
+ children: p.label
572
+ },
573
+ p.value
574
+ )) })
575
+ ] }, n.key);
576
+ }),
577
+ m ? /* @__PURE__ */ _(
578
+ "button",
579
+ {
580
+ type: "button",
581
+ onClick: () => {
582
+ t({}), w("patient_search_facet_changed", { key: "*", values: [] });
583
+ },
584
+ className: [
585
+ "ds:ms-[var(--spacing-xs)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
586
+ "ds:min-h-[var(--min-target-size)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)]",
587
+ "type-label ds:text-[color:var(--muted-foreground)]",
588
+ "ds:rounded-[var(--radius-sm)]",
589
+ "ds:hover:text-[color:var(--foreground)]",
590
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
591
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
592
+ ].join(" "),
593
+ children: [
594
+ /* @__PURE__ */ a(ie, { "aria-hidden": "true", className: "ds:size-3.5" }),
595
+ d("patientSearch.facets.clear")
596
+ ]
597
+ }
598
+ ) : null
599
+ ]
600
+ }
601
+ );
602
+ }
603
+ const se = ["violet", "purple", "magenta", "blue"], Ae = P(
604
+ [
605
+ "ds:relative ds:flex ds:h-full ds:flex-col ds:gap-[var(--spacing-sm)]",
606
+ "ds:rounded-[var(--radius-lg)] ds:overflow-hidden",
607
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
608
+ "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]",
609
+ "ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
610
+ "ds:border ds:border-[color:var(--card-border)]",
611
+ "ds:shadow-[var(--shadow-sm)]",
612
+ "ds:transition-[transform,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
613
+ "ds:motion-safe:hover:-translate-y-0.5",
614
+ "ds:hover:shadow-[var(--shadow-md)]",
615
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
616
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
617
+ "ds:no-underline"
618
+ ].join(" ")
619
+ ), Ce = P(
620
+ "ds:absolute ds:inset-inline-0 ds:top-0 ds:h-[3px] ds:pointer-events-none",
621
+ {
622
+ variants: {
623
+ accent: {
624
+ violet: "ds:bg-[var(--color-violet-500)]",
625
+ purple: "ds:bg-[var(--color-purple-500)]",
626
+ magenta: "ds:bg-[var(--color-magenta-500)]",
627
+ blue: "ds:bg-[var(--color-blue-500)]"
628
+ }
629
+ },
630
+ defaultVariants: { accent: "violet" }
631
+ }
632
+ ), Te = P(
633
+ "ds:inline-flex ds:size-9 ds:items-center ds:justify-center ds:rounded-[var(--radius-md)]",
634
+ {
635
+ variants: {
636
+ accent: {
637
+ violet: "ds:bg-[color-mix(in_srgb,var(--color-violet-500)_12%,var(--background))] ds:text-[var(--color-violet-700)]",
638
+ purple: "ds:bg-[color-mix(in_srgb,var(--color-purple-500)_12%,var(--background))] ds:text-[var(--color-purple-700)]",
639
+ magenta: "ds:bg-[color-mix(in_srgb,var(--color-magenta-500)_12%,var(--background))] ds:text-[var(--color-magenta-700)]",
640
+ blue: "ds:bg-[color-mix(in_srgb,var(--color-blue-500)_12%,var(--background))] ds:text-[var(--color-blue-700)]"
641
+ }
642
+ },
643
+ defaultVariants: { accent: "violet" }
644
+ }
645
+ );
646
+ function Le(e, s) {
647
+ return e && e !== "auto" ? e : se[s % se.length];
648
+ }
649
+ function De({ cards: e }) {
650
+ const { t: s } = C();
651
+ return e.length === 0 ? /* @__PURE__ */ a("p", { className: "type-body-sm ds:text-[color:var(--muted-foreground)] ds:m-0", children: s("patientSearch.discovery.empty") }) : /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
652
+ /* @__PURE__ */ a("h3", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: s("patientSearch.discovery.heading") }),
653
+ /* @__PURE__ */ a(
654
+ "ul",
655
+ {
656
+ className: [
657
+ "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)]",
658
+ "ds:md:grid-cols-2 ds:lg:grid-cols-3",
659
+ "ds:m-0 ds:p-0 ds:list-none"
660
+ ].join(" "),
661
+ children: e.map((t, d) => {
662
+ const h = Le(t.accent, d);
663
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ _(
664
+ "a",
665
+ {
666
+ href: t.href,
667
+ "data-component": "patient-search-card",
668
+ "data-card-id": t.id,
669
+ "aria-label": t.description ? `${t.label} — ${t.description}` : t.label,
670
+ onClick: () => w("patient_search_discovery_card_clicked", {
671
+ cardId: t.id
672
+ }),
673
+ className: Ae(),
674
+ children: [
675
+ /* @__PURE__ */ a(
676
+ "span",
677
+ {
678
+ "aria-hidden": "true",
679
+ className: Ce({ accent: h })
680
+ }
681
+ ),
682
+ /* @__PURE__ */ _("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
683
+ /* @__PURE__ */ a(
684
+ "span",
685
+ {
686
+ "aria-hidden": "true",
687
+ className: Te({ accent: h }),
688
+ children: t.icon ?? /* @__PURE__ */ a(be, { className: "ds:size-4", "aria-hidden": "true" })
689
+ }
690
+ ),
691
+ t.badge ? (
692
+ // The badge sits inside a softly-tinted accent bubble
693
+ // (15% accent + 85% background). The text colour must
694
+ // contrast with that mix, not with the accent's canonical
695
+ // foreground — `--accent-foreground` is calibrated against
696
+ // the 100% accent surface and fails AA on the 15% tint.
697
+ // Use `--foreground` which contrasts with the
698
+ // mostly-background mix in both light and dark themes.
699
+ /* @__PURE__ */ a("span", { className: "type-meta ds:ms-auto ds:inline-flex ds:items-center ds:rounded-[var(--radius-full)] ds:bg-[color-mix(in_srgb,var(--accent)_15%,var(--background))] ds:text-[color:var(--foreground)] ds:font-[var(--font-weight-semibold)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]", children: t.badge })
700
+ ) : null
701
+ ] }),
702
+ /* @__PURE__ */ a("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: t.label }),
703
+ t.description ? /* @__PURE__ */ a("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: t.description }) : null
704
+ ]
705
+ }
706
+ ) }, t.id);
707
+ })
708
+ }
709
+ )
710
+ ] });
711
+ }
712
+ function Pe(e) {
713
+ if (e.object || e.place || e.geo || e.when && e.when !== "anytime") return !0;
714
+ if (e.facets) {
715
+ for (const s of Object.values(e.facets))
716
+ if (s && s.length > 0) return !0;
717
+ }
718
+ return !1;
719
+ }
720
+ function U({
721
+ value: e,
722
+ variant: s,
723
+ submitting: t,
724
+ submitLabel: d,
725
+ onSubmit: h
726
+ }) {
727
+ const { t: m } = C(), b = t || !Pe(e), u = d ?? m("patientSearch.submit.cta");
728
+ return /* @__PURE__ */ a(
729
+ pe,
730
+ {
731
+ type: "button",
732
+ intent: "primary",
733
+ size: "lg",
734
+ startIcon: /* @__PURE__ */ a(ne, { "aria-hidden": "true" }),
735
+ loading: t,
736
+ disabled: b,
737
+ onClick: () => {
738
+ w("patient_search_submitted", {
739
+ variant: s,
740
+ hasObject: !!e.object,
741
+ hasPlace: !!e.place,
742
+ hasGeo: !!e.geo,
743
+ when: e.when,
744
+ facetKeys: e.facets ? Object.keys(e.facets) : []
745
+ }), h(e);
746
+ },
747
+ children: u
748
+ }
749
+ );
750
+ }
751
+ function Ie(e) {
752
+ const {
753
+ variant: s,
754
+ value: t,
755
+ onChange: d,
756
+ onSubmit: h,
757
+ loadObjects: m,
758
+ loadPlaces: b,
759
+ onObjectSelect: u,
760
+ onPlaceSelect: y,
761
+ submitting: n,
762
+ submitLabel: c,
763
+ whoRef: r,
764
+ whereRef: i,
765
+ defaultRadiusKm: f,
766
+ reverseGeocode: p,
767
+ cardLabel: x
768
+ } = e;
769
+ return /* @__PURE__ */ a(H, { variant: "elevated", "aria-label": x, children: /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)] ds:md:flex-row ds:md:items-center", children: [
770
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
771
+ $,
772
+ {
773
+ value: t,
774
+ onChange: d,
775
+ loadObjects: m,
776
+ onObjectSelect: u,
777
+ inputRef: r
778
+ }
779
+ ) }),
780
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
781
+ q,
782
+ {
783
+ value: t,
784
+ onChange: d,
785
+ loadPlaces: b,
786
+ onPlaceSelect: y,
787
+ defaultRadiusKm: f,
788
+ reverseGeocode: p,
789
+ inputRef: i
790
+ }
791
+ ) }),
792
+ /* @__PURE__ */ a(
793
+ U,
794
+ {
795
+ value: t,
796
+ variant: s,
797
+ submitting: n,
798
+ submitLabel: c,
799
+ onSubmit: h
800
+ }
801
+ )
802
+ ] }) });
803
+ }
804
+ function Oe(e) {
805
+ const {
806
+ variant: s,
807
+ value: t,
808
+ onChange: d,
809
+ onSubmit: h,
810
+ loadObjects: m,
811
+ loadPlaces: b,
812
+ onObjectSelect: u,
813
+ onPlaceSelect: y,
814
+ submitting: n,
815
+ submitLabel: c,
816
+ whoRef: r,
817
+ whereRef: i,
818
+ defaultRadiusKm: f,
819
+ reverseGeocode: p,
820
+ cardLabel: x
821
+ } = e;
822
+ return /* @__PURE__ */ a(H, { variant: "elevated", "aria-label": x, children: /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
823
+ /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:md:flex-row ds:md:items-center", children: [
824
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
825
+ $,
826
+ {
827
+ value: t,
828
+ onChange: d,
829
+ loadObjects: m,
830
+ onObjectSelect: u,
831
+ inputRef: r
832
+ }
833
+ ) }),
834
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
835
+ q,
836
+ {
837
+ value: t,
838
+ onChange: d,
839
+ loadPlaces: b,
840
+ onPlaceSelect: y,
841
+ defaultRadiusKm: f,
842
+ reverseGeocode: p,
843
+ inputRef: i
844
+ }
845
+ ) }),
846
+ /* @__PURE__ */ a(
847
+ U,
848
+ {
849
+ value: t,
850
+ variant: s,
851
+ submitting: n,
852
+ submitLabel: c,
853
+ onSubmit: h
854
+ }
855
+ )
856
+ ] }),
857
+ /* @__PURE__ */ a(
858
+ Re,
859
+ {
860
+ value: t.when,
861
+ onChange: (v) => d({ ...t, when: v })
862
+ }
863
+ )
864
+ ] }) });
865
+ }
866
+ function Ve(e) {
867
+ const {
868
+ variant: s,
869
+ value: t,
870
+ onChange: d,
871
+ onSubmit: h,
872
+ loadObjects: m,
873
+ loadPlaces: b,
874
+ onObjectSelect: u,
875
+ onPlaceSelect: y,
876
+ facets: n,
877
+ submitting: c,
878
+ submitLabel: r,
879
+ whoRef: i,
880
+ whereRef: f,
881
+ defaultRadiusKm: p,
882
+ reverseGeocode: x,
883
+ cardLabel: v
884
+ } = e;
885
+ return /* @__PURE__ */ a(H, { variant: "elevated", "aria-label": v, children: /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
886
+ /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:md:flex-row ds:md:items-center", children: [
887
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
888
+ $,
889
+ {
890
+ value: t,
891
+ onChange: d,
892
+ loadObjects: m,
893
+ onObjectSelect: u,
894
+ inputRef: i
895
+ }
896
+ ) }),
897
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
898
+ q,
899
+ {
900
+ value: t,
901
+ onChange: d,
902
+ loadPlaces: b,
903
+ onPlaceSelect: y,
904
+ defaultRadiusKm: p,
905
+ reverseGeocode: x,
906
+ inputRef: f
907
+ }
908
+ ) }),
909
+ /* @__PURE__ */ a(
910
+ U,
911
+ {
912
+ value: t,
913
+ variant: s,
914
+ submitting: c,
915
+ submitLabel: r,
916
+ onSubmit: h
917
+ }
918
+ )
919
+ ] }),
920
+ n && n.length > 0 ? /* @__PURE__ */ a(
921
+ je,
922
+ {
923
+ facets: n,
924
+ value: t.facets,
925
+ onChange: (o) => d({ ...t, facets: o })
926
+ }
927
+ ) : null
928
+ ] }) });
929
+ }
930
+ function Ee(e) {
931
+ const {
932
+ variant: s,
933
+ value: t,
934
+ onChange: d,
935
+ onSubmit: h,
936
+ loadObjects: m,
937
+ loadPlaces: b,
938
+ onObjectSelect: u,
939
+ onPlaceSelect: y,
940
+ discoveryCards: n,
941
+ submitting: c,
942
+ submitLabel: r,
943
+ whoRef: i,
944
+ whereRef: f,
945
+ defaultRadiusKm: p,
946
+ reverseGeocode: x,
947
+ cardLabel: v
948
+ } = e;
949
+ return /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
950
+ /* @__PURE__ */ a(H, { variant: "elevated", "aria-label": v, children: /* @__PURE__ */ _("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)] ds:md:flex-row ds:md:items-stretch", children: [
951
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
952
+ $,
953
+ {
954
+ value: t,
955
+ onChange: d,
956
+ loadObjects: m,
957
+ onObjectSelect: u,
958
+ inputRef: i
959
+ }
960
+ ) }),
961
+ /* @__PURE__ */ a("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ a(
962
+ q,
963
+ {
964
+ value: t,
965
+ onChange: d,
966
+ loadPlaces: b,
967
+ onPlaceSelect: y,
968
+ defaultRadiusKm: p,
969
+ reverseGeocode: x,
970
+ inputRef: f
971
+ }
972
+ ) }),
973
+ /* @__PURE__ */ a(
974
+ U,
975
+ {
976
+ value: t,
977
+ variant: s,
978
+ submitting: c,
979
+ submitLabel: r,
980
+ onSubmit: h
981
+ }
982
+ )
983
+ ] }) }),
984
+ /* @__PURE__ */ a(De, { cards: n })
985
+ ] });
986
+ }
987
+ const Be = le(function({
988
+ variant: s,
989
+ loadObjects: t,
990
+ loadPlaces: d,
991
+ onObjectSelect: h,
992
+ onPlaceSelect: m,
993
+ facets: b,
994
+ defaultRadiusKm: u = oe,
995
+ reverseGeocode: y,
996
+ discoveryCards: n,
997
+ countryCode: c,
998
+ value: r,
999
+ onChange: i,
1000
+ onSubmit: f,
1001
+ submitting: p,
1002
+ submitLabel: x,
1003
+ "aria-label": v,
1004
+ id: o,
1005
+ className: T,
1006
+ ...F
1007
+ }, G) {
1008
+ const { t: Q } = C(), N = S(null), K = S(null), I = S(null), k = S(!1);
1009
+ B(() => {
1010
+ if (!k.current && s === "who-where-when") {
1011
+ if (r.when !== void 0) {
1012
+ k.current = !0;
1013
+ return;
1014
+ }
1015
+ k.current = !0, i({ ...r, when: "anytime" });
1016
+ }
1017
+ }, [s]);
1018
+ const O = S(!1);
1019
+ B(() => {
1020
+ if (!O.current && s === "faceted") {
1021
+ if (r.facets !== void 0) {
1022
+ O.current = !0;
1023
+ return;
1024
+ }
1025
+ O.current = !0, i({ ...r, facets: {} });
1026
+ }
1027
+ }, [s]);
1028
+ const V = S(null);
1029
+ B(() => {
1030
+ V.current !== s && (V.current = s, w("patient_search_variant_exposed", { variant: s, country: c }));
1031
+ }, [s, c]);
1032
+ const L = Y(
1033
+ () => ({
1034
+ getVariant: () => s,
1035
+ reset: () => {
1036
+ i({});
1037
+ },
1038
+ focusPrimary: () => {
1039
+ requestAnimationFrame(() => {
1040
+ var g;
1041
+ (g = K.current) == null || g.focus();
1042
+ });
1043
+ }
1044
+ }),
1045
+ [s, i]
1046
+ );
1047
+ ue(G, () => L, [L]), me(_e, L, o);
1048
+ const E = v ?? Q("patientSearch.regionLabel"), R = {
1049
+ variant: s,
1050
+ value: r,
1051
+ onChange: i,
1052
+ onSubmit: f,
1053
+ loadObjects: t,
1054
+ loadPlaces: d,
1055
+ onObjectSelect: h,
1056
+ onPlaceSelect: m,
1057
+ facets: b,
1058
+ defaultRadiusKm: u,
1059
+ reverseGeocode: y,
1060
+ discoveryCards: n ?? [],
1061
+ submitting: p,
1062
+ submitLabel: x,
1063
+ whoRef: K,
1064
+ whereRef: I,
1065
+ cardLabel: E
1066
+ }, l = (() => {
1067
+ switch (s) {
1068
+ case "who-where":
1069
+ return /* @__PURE__ */ a(Ie, { ...R });
1070
+ case "who-where-when":
1071
+ return /* @__PURE__ */ a(Oe, { ...R });
1072
+ case "faceted":
1073
+ return /* @__PURE__ */ a(Ve, { ...R });
1074
+ case "discovery":
1075
+ return /* @__PURE__ */ a(Ee, { ...R });
1076
+ /* c8 ignore next 2 */
1077
+ default:
1078
+ return null;
1079
+ }
1080
+ })();
1081
+ return /* @__PURE__ */ a(
1082
+ "div",
1083
+ {
1084
+ ref: N,
1085
+ role: "region",
1086
+ "aria-label": E,
1087
+ id: o,
1088
+ "data-component": "patient-search",
1089
+ "data-component-id": o,
1090
+ "data-variant": s,
1091
+ className: Ne({ variant: s, className: T }),
1092
+ ...F,
1093
+ children: l
1094
+ }
1095
+ );
1096
+ });
1097
+ Be.displayName = "PatientSearch";
1098
+ export {
1099
+ Be as P,
1100
+ _e as p
1101
+ };
1102
+ //# sourceMappingURL=patient-search-BhlxYAI3.js.map