@alfadocs/ui-kit 0.30.5 → 0.31.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.
@@ -0,0 +1,1441 @@
1
+ import { jsx as t, jsxs as h } from "react/jsx-runtime";
2
+ import { forwardRef as Te, useState as Z, useRef as P, useMemo as A, useImperativeHandle as Fe, useEffect as L, useCallback as O } from "react";
3
+ import { c as K } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as k } from "react-i18next";
5
+ import { A as U } from "./alert-ywPR59NE.js";
6
+ import { A as xe } from "./avatar-D_H4emLo.js";
7
+ import { B as ue } from "./button-DD_0Xdmr.js";
8
+ import { D as z } from "./dropdown-menu-DZxwF23X.js";
9
+ import { E as $e } from "./empty-state-BLy7tigq.js";
10
+ import { M as De } from "./map-view-DyB8tr6c.js";
11
+ import { R as Re } from "./rating-BRD7O74e.js";
12
+ import { S } from "./sheet-D8Yl0nKR.js";
13
+ import { S as He } from "./skeleton-CZbwyJAA.js";
14
+ import { S as Ke } from "./spinner-CCByyvcb.js";
15
+ import { T as q } from "./tag-bBPAvXyh.js";
16
+ import { u as Ee } from "./registry-C9nwlNyL.js";
17
+ import { c as me } from "./createLucideIcon-CrFbzy84.js";
18
+ import { R as Ve } from "./refresh-cw-CC8jSKMr.js";
19
+ import { C as ke } from "./chevron-down-BX_NP2Yh.js";
20
+ import { M as W } from "./map-pin-B8STOPMJ.js";
21
+ import { S as Le } from "./smile-BSYLAHy6.js";
22
+ import { C as Oe } from "./calendar-clock-CYkcqdwl.js";
23
+ /**
24
+ * @license lucide-react v1.8.0 - ISC
25
+ *
26
+ * This source code is licensed under the ISC license.
27
+ * See the LICENSE file in the root directory of this source tree.
28
+ */
29
+ const je = [
30
+ ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
31
+ ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
32
+ ["path", { d: "M2 5h12", key: "or177f" }],
33
+ ["path", { d: "M7 2h1", key: "1t2jsx" }],
34
+ ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
35
+ ["path", { d: "M14 18h6", key: "1m8k6r" }]
36
+ ], Be = me("languages", je);
37
+ /**
38
+ * @license lucide-react v1.8.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */
43
+ const Ge = [
44
+ [
45
+ "path",
46
+ {
47
+ d: "M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",
48
+ key: "169xi5"
49
+ }
50
+ ],
51
+ ["path", { d: "M15 5.764v15", key: "1pn4in" }],
52
+ ["path", { d: "M9 3.236v15", key: "1uimfh" }]
53
+ ], Ue = me("map", Ge);
54
+ /**
55
+ * @license lucide-react v1.8.0 - ISC
56
+ *
57
+ * This source code is licensed under the ISC license.
58
+ * See the LICENSE file in the root directory of this source tree.
59
+ */
60
+ const qe = [
61
+ [
62
+ "path",
63
+ {
64
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
65
+ key: "oel41y"
66
+ }
67
+ ],
68
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
69
+ ], Ze = me("shield-check", qe), Je = {
70
+ id: "practice-results",
71
+ capabilities: ["navigate", "view_change"],
72
+ state: {
73
+ variant: {
74
+ type: "string",
75
+ descriptionKey: "ui.agent.practiceResults.state.variant",
76
+ description: "Active variant — one of `split-list-map`, `map-first`, `rich-cards`.",
77
+ read: (e) => e.getVariant()
78
+ }
79
+ },
80
+ actions: {
81
+ scroll_to_result: {
82
+ safety: "read",
83
+ argsType: "{ id: string }",
84
+ descriptionKey: "ui.agent.practiceResults.actions.scrollToResult",
85
+ description: "Scroll the result card with the given id into the visible viewport.",
86
+ invoke: (e, n) => {
87
+ e.scrollToResult(n.id);
88
+ }
89
+ },
90
+ focus_pin: {
91
+ safety: "read",
92
+ argsType: "{ id: string }",
93
+ descriptionKey: "ui.agent.practiceResults.actions.focusPin",
94
+ description: "Highlight the map pin for the given result id (no-op on rich-cards).",
95
+ invoke: (e, n) => {
96
+ e.focusPin(n.id);
97
+ }
98
+ }
99
+ },
100
+ domHooks: {
101
+ root: {
102
+ attr: "data-component",
103
+ value: "practice-results",
104
+ description: "Marks the PracticeResults root region."
105
+ },
106
+ instanceId: {
107
+ attr: "data-component-id",
108
+ sourceProp: "id",
109
+ description: "Sourced from the id prop."
110
+ }
111
+ }
112
+ }, Qe = 13, We = [
113
+ "distance",
114
+ "rating",
115
+ "next-available",
116
+ "relevance"
117
+ ];
118
+ function _(e, n) {
119
+ if (typeof window > "u") return;
120
+ const s = window.track;
121
+ try {
122
+ s == null || s(e, n);
123
+ } catch {
124
+ }
125
+ }
126
+ function D(e, n, s, o) {
127
+ const a = e.findIndex((d) => d.id === n);
128
+ if (a < 0) return;
129
+ const i = e[a];
130
+ i && (_("serp_result_clicked", { resultId: n, source: s, position: a }), o(i, s));
131
+ }
132
+ function Xe(e, n) {
133
+ const o = (n.lat - e.lat) * Math.PI / 180, a = (n.lng - e.lng) * Math.PI / 180, i = e.lat * Math.PI / 180, d = n.lat * Math.PI / 180, m = Math.sin(o / 2), r = Math.sin(a / 2), g = m * m + Math.cos(i) * Math.cos(d) * r * r;
134
+ return 2 * 6371 * Math.asin(Math.min(1, Math.sqrt(g)));
135
+ }
136
+ function Ye(e, n, s) {
137
+ return !n || Object.keys(n).length === 0 ? e : e.filter((o) => {
138
+ for (const a of s) {
139
+ const i = n[a.key];
140
+ if (!i || i.length === 0) continue;
141
+ if (a.options.length === 0) {
142
+ if (o[a.key] !== !0) return !1;
143
+ continue;
144
+ }
145
+ const d = a.key === "insurance" ? o.insurances : a.key === "language" ? o.languages : o[a.key];
146
+ if (!Array.isArray(d) || !(a.multi ? i.some((r) => d.includes(r)) : d.includes(i[0]))) return !1;
147
+ }
148
+ return !0;
149
+ });
150
+ }
151
+ function et(e, n, s) {
152
+ const o = e.map((i) => {
153
+ const d = i.location ? i.location.distanceKm ?? (s ? Xe(s, i.location) : void 0) : void 0;
154
+ return { result: i, distanceKm: d };
155
+ }), a = (i, d) => {
156
+ var m, r, g, c;
157
+ switch (n) {
158
+ case "distance":
159
+ return i.distanceKm == null && d.distanceKm == null ? 0 : i.distanceKm == null ? 1 : d.distanceKm == null ? -1 : i.distanceKm - d.distanceKm;
160
+ case "rating": {
161
+ const f = ((m = i.result.rating) == null ? void 0 : m.value) ?? -1;
162
+ return (((r = d.result.rating) == null ? void 0 : r.value) ?? -1) - f;
163
+ }
164
+ case "next-available": {
165
+ const f = ((g = i.result.nextAvailableSlot) == null ? void 0 : g.dateTime) ?? "", p = ((c = d.result.nextAvailableSlot) == null ? void 0 : c.dateTime) ?? "";
166
+ return !f && !p ? 0 : f ? p ? f.localeCompare(p) : -1 : 1;
167
+ }
168
+ case "relevance":
169
+ default:
170
+ return 0;
171
+ }
172
+ };
173
+ return [...o].sort(a).map(
174
+ ({ result: i, distanceKm: d }) => d != null && i.location ? {
175
+ ...i,
176
+ location: { ...i.location, distanceKm: d }
177
+ } : i
178
+ );
179
+ }
180
+ function be(e) {
181
+ let n = -1 / 0, s = 1 / 0, o = -1 / 0, a = 1 / 0, i = !1;
182
+ for (const d of e) {
183
+ if (!d.location) continue;
184
+ i = !0;
185
+ const { lat: m, lng: r } = d.location;
186
+ m > n && (n = m), m < s && (s = m), r > o && (o = r), r < a && (a = r);
187
+ }
188
+ if (i)
189
+ return { north: n, south: s, east: o, west: a };
190
+ }
191
+ const tt = K(
192
+ "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)] ds:gap-[var(--spacing-md)]",
193
+ {
194
+ variants: {
195
+ variant: {
196
+ "split-list-map": "",
197
+ "map-first": "",
198
+ "rich-cards": ""
199
+ }
200
+ },
201
+ defaultVariants: { variant: "split-list-map" }
202
+ }
203
+ );
204
+ function we({
205
+ heading: e,
206
+ intro: n,
207
+ totalCount: s,
208
+ searchCentreLabel: o
209
+ }) {
210
+ const { t: a } = k();
211
+ if (!e && !n && s == null) return null;
212
+ const i = s != null ? o ? a("practiceResults.results.heading", {
213
+ count: s,
214
+ place: o
215
+ }) : a("practiceResults.results.summary", { count: s }) : void 0;
216
+ return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
217
+ e ? /* @__PURE__ */ t("h2", { className: "type-title-section ds:m-0 ds:text-[var(--foreground)]", children: e }) : null,
218
+ n ? /* @__PURE__ */ t("p", { className: "type-body ds:m-0 ds:text-[var(--muted-foreground)]", children: n }) : null,
219
+ i ? /* @__PURE__ */ t(
220
+ "p",
221
+ {
222
+ className: "type-body-sm ds:m-0 ds:text-[var(--muted-foreground)]",
223
+ "aria-live": "polite",
224
+ children: i
225
+ }
226
+ ) : null
227
+ ] });
228
+ }
229
+ const J = K(
230
+ [
231
+ "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
232
+ "ds:min-h-[var(--min-target-size)]",
233
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
234
+ "ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]",
235
+ "ds:rounded-[var(--radius-full)]",
236
+ "type-label",
237
+ "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
238
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
239
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
240
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
241
+ ].join(" "),
242
+ {
243
+ variants: {
244
+ state: {
245
+ 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))]",
246
+ active: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:border ds:border-transparent ds:font-[var(--font-weight-semibold)]"
247
+ }
248
+ },
249
+ defaultVariants: { state: "idle" }
250
+ }
251
+ ), nt = K(
252
+ "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
253
+ {
254
+ variants: {
255
+ placement: {
256
+ inline: "",
257
+ // Floating chrome on map-first: soft `--popover` surface so chips
258
+ // read over the map without losing contrast. Same surface as
259
+ // dropdowns / sheets — themed and forced-colors safe.
260
+ floating: [
261
+ "ds:rounded-[var(--radius-full)]",
262
+ "ds:bg-[var(--popover)] ds:shadow-[var(--shadow-md)]",
263
+ "ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
264
+ "ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]"
265
+ ].join(" ")
266
+ }
267
+ },
268
+ defaultVariants: { placement: "inline" }
269
+ }
270
+ ), st = K(
271
+ [
272
+ "ds:ms-[var(--spacing-xs)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
273
+ "ds:min-h-[var(--min-target-size)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)]",
274
+ "type-label ds:text-[color:var(--muted-foreground)]",
275
+ "ds:rounded-[var(--radius-sm)]",
276
+ "ds:hover:text-[color:var(--foreground)]",
277
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
278
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
279
+ ].join(" ")
280
+ );
281
+ function ce({
282
+ facets: e,
283
+ value: n,
284
+ onChange: s,
285
+ floating: o
286
+ }) {
287
+ const { t: a } = k(), i = A(() => n ?? {}, [n]), d = A(
288
+ () => Object.values(i).some((c) => c && c.length > 0),
289
+ [i]
290
+ ), m = (c, f) => {
291
+ const p = { ...i };
292
+ f.length === 0 ? delete p[c] : p[c] = f, s(p), _("serp_filter_changed", { key: c, values: f });
293
+ }, r = (c) => {
294
+ var p;
295
+ const f = (((p = i[c]) == null ? void 0 : p.length) ?? 0) > 0;
296
+ m(c, f ? [] : ["true"]);
297
+ }, g = (c, f) => {
298
+ const p = i[c.key] ?? [], u = p.includes(f);
299
+ let l;
300
+ c.multi ? l = u ? p.filter((b) => b !== f) : [...p, f] : l = u ? [] : [f], m(c.key, l);
301
+ };
302
+ return e.length === 0 ? null : /* @__PURE__ */ h(
303
+ "div",
304
+ {
305
+ "data-component": "practice-results-filters",
306
+ role: "group",
307
+ "aria-label": a("practiceResults.filters.label"),
308
+ className: nt({
309
+ placement: o ? "floating" : "inline"
310
+ }),
311
+ children: [
312
+ e.map((c) => {
313
+ const f = c.options.length === 0, p = i[c.key] ?? [], u = p.length > 0;
314
+ if (f)
315
+ return /* @__PURE__ */ t(
316
+ "button",
317
+ {
318
+ type: "button",
319
+ "aria-pressed": u,
320
+ "aria-label": c.label,
321
+ onClick: () => r(c.key),
322
+ className: J({
323
+ state: u ? "active" : "idle"
324
+ }),
325
+ children: /* @__PURE__ */ t("span", { children: c.label })
326
+ },
327
+ c.key
328
+ );
329
+ const l = u ? ` (${p.length})` : "";
330
+ return /* @__PURE__ */ h(z.Root, { children: [
331
+ /* @__PURE__ */ t(z.Trigger, { asChild: !0, children: /* @__PURE__ */ h(
332
+ "button",
333
+ {
334
+ type: "button",
335
+ "aria-label": `${c.label}${l}`,
336
+ className: J({
337
+ state: u ? "active" : "idle"
338
+ }),
339
+ children: [
340
+ /* @__PURE__ */ h("span", { children: [
341
+ c.label,
342
+ l
343
+ ] }),
344
+ /* @__PURE__ */ t(
345
+ ke,
346
+ {
347
+ "aria-hidden": "true",
348
+ className: "ds:size-3.5 ds:shrink-0"
349
+ }
350
+ )
351
+ ]
352
+ }
353
+ ) }),
354
+ /* @__PURE__ */ t(z.Content, { sideOffset: 8, align: "start", children: c.options.map((b) => /* @__PURE__ */ t(
355
+ z.CheckboxItem,
356
+ {
357
+ checked: p.includes(b.value),
358
+ onSelect: (R) => {
359
+ c.multi && R.preventDefault(), g(c, b.value);
360
+ },
361
+ children: b.label
362
+ },
363
+ b.value
364
+ )) })
365
+ ] }, c.key);
366
+ }),
367
+ d ? /* @__PURE__ */ t(
368
+ "button",
369
+ {
370
+ type: "button",
371
+ onClick: () => {
372
+ s({}), _("serp_filter_changed", { key: "*", values: [] });
373
+ },
374
+ className: st(),
375
+ children: a("practiceResults.filters.clear")
376
+ }
377
+ ) : null
378
+ ]
379
+ }
380
+ );
381
+ }
382
+ function de({ value: e, onChange: n }) {
383
+ const { t: s } = k(), o = (a) => {
384
+ switch (a) {
385
+ case "distance":
386
+ return s("practiceResults.sort.distance");
387
+ case "rating":
388
+ return s("practiceResults.sort.rating");
389
+ case "next-available":
390
+ return s("practiceResults.sort.nextAvailable");
391
+ case "relevance":
392
+ default:
393
+ return s("practiceResults.sort.relevance");
394
+ }
395
+ };
396
+ return /* @__PURE__ */ h(z.Root, { children: [
397
+ /* @__PURE__ */ t(z.Trigger, { asChild: !0, children: /* @__PURE__ */ h(
398
+ "button",
399
+ {
400
+ type: "button",
401
+ "aria-label": `${s("practiceResults.sort.label")}: ${o(e)}`,
402
+ className: J({ state: "idle" }),
403
+ children: [
404
+ /* @__PURE__ */ h("span", { children: [
405
+ s("practiceResults.sort.label"),
406
+ ": ",
407
+ o(e)
408
+ ] }),
409
+ /* @__PURE__ */ t(ke, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" })
410
+ ]
411
+ }
412
+ ) }),
413
+ /* @__PURE__ */ t(z.Content, { sideOffset: 8, align: "end", children: /* @__PURE__ */ t(
414
+ z.RadioGroup,
415
+ {
416
+ value: e,
417
+ onValueChange: (a) => {
418
+ const i = a;
419
+ i !== e && (n(i), _("serp_sort_changed", { sort: i }));
420
+ },
421
+ children: We.map((a) => /* @__PURE__ */ t(z.RadioItem, { value: a, children: o(a) }, a))
422
+ }
423
+ ) })
424
+ ] });
425
+ }
426
+ function at({ distanceKm: e }) {
427
+ const { t: n, i18n: s } = k(), o = A(() => {
428
+ if (e < 1) return n("practiceResults.distance.below");
429
+ const a = new Intl.NumberFormat(s.language, {
430
+ maximumFractionDigits: 1
431
+ }).format(e);
432
+ return n("practiceResults.distance.km", { distance: a });
433
+ }, [e, n, s.language]);
434
+ return /* @__PURE__ */ t(
435
+ q,
436
+ {
437
+ label: o,
438
+ variant: "neutral",
439
+ fill: "outline",
440
+ size: "sm",
441
+ leading: /* @__PURE__ */ t(W, { "aria-hidden": "true" })
442
+ }
443
+ );
444
+ }
445
+ const ye = K(
446
+ [
447
+ "ds:inline-size-[12rem] ds:block-size-[8rem] ds:shrink-0",
448
+ "ds:rounded-[var(--radius-md)]"
449
+ ].join(" "),
450
+ {
451
+ variants: {
452
+ state: {
453
+ placeholder: "ds:flex ds:items-center ds:justify-center ds:bg-[var(--muted)] ds:text-[var(--muted-foreground)]",
454
+ image: "ds:[object-fit:cover]"
455
+ }
456
+ },
457
+ defaultVariants: { state: "placeholder" }
458
+ }
459
+ );
460
+ function it() {
461
+ if (typeof document > "u") return "4945a3";
462
+ const e = getComputedStyle(document.documentElement).getPropertyValue("--map-marker-color").trim(), n = /^#?([0-9a-fA-F]{6})$/.exec(e);
463
+ return n ? n[1] : "4945a3";
464
+ }
465
+ function rt({
466
+ apiKey: e,
467
+ center: n,
468
+ zoom: s = 14,
469
+ consentGranted: o
470
+ }) {
471
+ const { t: a } = k();
472
+ if (!o || !e)
473
+ return /* @__PURE__ */ t(
474
+ "div",
475
+ {
476
+ "aria-hidden": "true",
477
+ className: ye({ state: "placeholder" }),
478
+ children: /* @__PURE__ */ t(W, { "aria-hidden": "true", className: "ds:size-6" })
479
+ }
480
+ );
481
+ const i = it(), d = `https://maps.googleapis.com/maps/api/staticmap?center=${n.lat},${n.lng}&zoom=${s}&size=240x160&scale=2&markers=color:0x${i}%7C${n.lat},${n.lng}&key=${encodeURIComponent(e)}`;
482
+ return /* @__PURE__ */ t(
483
+ "img",
484
+ {
485
+ src: d,
486
+ alt: a("practiceResults.thumbnail.alt"),
487
+ loading: "lazy",
488
+ decoding: "async",
489
+ width: 240,
490
+ height: 160,
491
+ className: ye({ state: "image" })
492
+ }
493
+ );
494
+ }
495
+ const Se = K(
496
+ [
497
+ "ds:relative ds:flex ds:w-full ds:cursor-pointer",
498
+ "ds:rounded-[var(--radius-lg)]",
499
+ "ds:bg-[var(--card)] ds:text-[var(--card-foreground)]",
500
+ "ds:border ds:border-[color:var(--card-border)]",
501
+ "ds:p-[var(--spacing-md)]",
502
+ "ds:gap-[var(--spacing-md)]",
503
+ "ds:transition-[box-shadow,border-color] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
504
+ "ds:hover:shadow-[var(--shadow-md)]",
505
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
506
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
507
+ "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
508
+ // Use `data-highlighted` for the pin↔card sync visual so consumers
509
+ // can override (e.g. dim siblings) without fighting the kit.
510
+ "ds:data-[highlighted=true]:border-[color:var(--primary)]",
511
+ "ds:data-[highlighted=true]:shadow-[var(--shadow-md)]",
512
+ "ds:forced-colors:focus-visible:outline-[CanvasText]"
513
+ ].join(" "),
514
+ {
515
+ variants: {
516
+ density: {
517
+ compact: "",
518
+ rich: "ds:p-[var(--spacing-lg)] ds:gap-[var(--spacing-lg)]"
519
+ }
520
+ },
521
+ defaultVariants: { density: "compact" }
522
+ }
523
+ );
524
+ function lt({
525
+ result: e,
526
+ highlighted: n,
527
+ onSelect: s,
528
+ onHover: o,
529
+ density: a = "compact",
530
+ children: i
531
+ }) {
532
+ var m;
533
+ const d = e.rating;
534
+ return /* @__PURE__ */ h(
535
+ "div",
536
+ {
537
+ "data-component": "practice-result-card",
538
+ "data-result-id": e.id,
539
+ "data-highlighted": n ? "true" : "false",
540
+ role: "link",
541
+ tabIndex: 0,
542
+ "aria-labelledby": `practice-result-${e.id}-name`,
543
+ onClick: s,
544
+ onKeyDown: (r) => {
545
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), s());
546
+ },
547
+ onMouseEnter: o,
548
+ onFocus: o,
549
+ className: Se({ density: a }),
550
+ children: [
551
+ /* @__PURE__ */ t(xe, { src: e.imageUrl, name: e.name, size: "lg" }),
552
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
553
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
554
+ /* @__PURE__ */ t(
555
+ "span",
556
+ {
557
+ id: `practice-result-${e.id}-name`,
558
+ className: "type-title-card ds:text-[var(--foreground)]",
559
+ children: e.name
560
+ }
561
+ ),
562
+ e.subtitle ? /* @__PURE__ */ t("span", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: e.subtitle }) : null,
563
+ (m = e.location) != null && m.address ? /* @__PURE__ */ h("span", { className: "type-meta ds:text-[var(--muted-foreground)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
564
+ /* @__PURE__ */ t(W, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" }),
565
+ e.location.address
566
+ ] }) : null
567
+ ] }),
568
+ d && d.count > 0 ? /* @__PURE__ */ t(
569
+ Re,
570
+ {
571
+ value: d.value,
572
+ reviews: { count: d.count },
573
+ size: "sm"
574
+ }
575
+ ) : null,
576
+ i
577
+ ] })
578
+ ]
579
+ }
580
+ );
581
+ }
582
+ function ot({
583
+ result: e,
584
+ apiKey: n,
585
+ consentGranted: s,
586
+ highlighted: o,
587
+ onSelect: a,
588
+ onHover: i
589
+ }) {
590
+ var l, b, R, C;
591
+ const { t: d, i18n: m } = k(), r = A(() => {
592
+ if (e.nextAvailableSlot)
593
+ try {
594
+ return new Intl.DateTimeFormat(m.language, {
595
+ weekday: "short",
596
+ hour: "numeric",
597
+ minute: "numeric"
598
+ }).format(new Date(e.nextAvailableSlot.dateTime));
599
+ } catch {
600
+ return e.nextAvailableSlot.dateTime;
601
+ }
602
+ }, [e.nextAvailableSlot, m.language]), g = (((l = e.languages) == null ? void 0 : l.length) ?? 0) > 0, c = (((b = e.insurances) == null ? void 0 : b.length) ?? 0) > 0, f = e.specializedInFearPatients, p = g || c || f, u = (R = e.location) == null ? void 0 : R.distanceKm;
603
+ return /* @__PURE__ */ h(
604
+ "div",
605
+ {
606
+ "data-component": "practice-result-card",
607
+ "data-result-id": e.id,
608
+ "data-density": "rich",
609
+ "data-highlighted": o ? "true" : "false",
610
+ role: "link",
611
+ tabIndex: 0,
612
+ "aria-labelledby": `practice-result-${e.id}-name`,
613
+ onClick: a,
614
+ onKeyDown: (y) => {
615
+ (y.key === "Enter" || y.key === " ") && (y.preventDefault(), a());
616
+ },
617
+ onMouseEnter: i,
618
+ onFocus: i,
619
+ className: Se({ density: "rich" }),
620
+ children: [
621
+ e.location ? /* @__PURE__ */ t(
622
+ rt,
623
+ {
624
+ apiKey: n,
625
+ center: {
626
+ lat: e.location.lat,
627
+ lng: e.location.lng
628
+ },
629
+ consentGranted: s
630
+ }
631
+ ) : null,
632
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
633
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:items-start ds:gap-[var(--spacing-md)]", children: [
634
+ /* @__PURE__ */ t(xe, { src: e.imageUrl, name: e.name, size: "md" }),
635
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
636
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
637
+ /* @__PURE__ */ t(
638
+ "span",
639
+ {
640
+ id: `practice-result-${e.id}-name`,
641
+ className: "type-title-card ds:text-[var(--foreground)]",
642
+ children: e.name
643
+ }
644
+ ),
645
+ u != null ? /* @__PURE__ */ t(at, { distanceKm: u }) : null
646
+ ] }),
647
+ e.subtitle ? /* @__PURE__ */ t("span", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: e.subtitle }) : null,
648
+ (C = e.location) != null && C.address ? /* @__PURE__ */ h("span", { className: "type-meta ds:text-[var(--muted-foreground)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
649
+ /* @__PURE__ */ t(
650
+ W,
651
+ {
652
+ "aria-hidden": "true",
653
+ className: "ds:size-3.5 ds:shrink-0"
654
+ }
655
+ ),
656
+ e.location.address
657
+ ] }) : null
658
+ ] }),
659
+ e.rating && e.rating.count > 0 ? /* @__PURE__ */ t(
660
+ Re,
661
+ {
662
+ value: e.rating.value,
663
+ reviews: { count: e.rating.count },
664
+ size: "md"
665
+ }
666
+ ) : null
667
+ ] }),
668
+ p ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
669
+ g ? (e.languages ?? []).map((y) => /* @__PURE__ */ t(
670
+ q,
671
+ {
672
+ label: y.toUpperCase(),
673
+ variant: "info",
674
+ fill: "outline",
675
+ size: "sm",
676
+ leading: /* @__PURE__ */ t(Be, { "aria-hidden": "true" })
677
+ },
678
+ `lang-${y}`
679
+ )) : null,
680
+ c ? (e.insurances ?? []).map((y) => /* @__PURE__ */ t(
681
+ q,
682
+ {
683
+ label: y,
684
+ variant: "brand",
685
+ fill: "outline",
686
+ size: "sm",
687
+ leading: /* @__PURE__ */ t(Ze, { "aria-hidden": "true" })
688
+ },
689
+ `ins-${y}`
690
+ )) : null,
691
+ f ? /* @__PURE__ */ t(
692
+ q,
693
+ {
694
+ label: d("practiceResults.fearPatient.label"),
695
+ variant: "success",
696
+ fill: "outline",
697
+ size: "sm",
698
+ leading: /* @__PURE__ */ t(Le, { "aria-hidden": "true" })
699
+ }
700
+ ) : null
701
+ ] }) : null,
702
+ e.nextAvailableSlot && r ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
703
+ /* @__PURE__ */ h("span", { className: "type-body-sm ds:text-[var(--muted-foreground)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
704
+ /* @__PURE__ */ t(
705
+ Oe,
706
+ {
707
+ "aria-hidden": "true",
708
+ className: "ds:size-4 ds:text-[var(--primary)]"
709
+ }
710
+ ),
711
+ d("practiceResults.nextSlot.summary", { time: r })
712
+ ] }),
713
+ /* @__PURE__ */ t(
714
+ ue,
715
+ {
716
+ intent: "primary",
717
+ size: "sm",
718
+ asChild: !0,
719
+ onClick: (y) => {
720
+ y.stopPropagation();
721
+ },
722
+ children: /* @__PURE__ */ t(
723
+ "a",
724
+ {
725
+ href: e.nextAvailableSlot.bookingHref,
726
+ "data-component": "practice-result-next-slot-cta",
727
+ children: d("practiceResults.nextSlot.cta", { time: r })
728
+ }
729
+ )
730
+ }
731
+ )
732
+ ] }) : null
733
+ ] })
734
+ ]
735
+ }
736
+ );
737
+ }
738
+ function pe({
739
+ results: e,
740
+ highlightedId: n,
741
+ onCardHover: s,
742
+ onCardSelect: o,
743
+ onLoadMore: a,
744
+ loadingMore: i,
745
+ loadingSkeletons: d,
746
+ density: m = "compact",
747
+ apiKey: r,
748
+ consentGranted: g = !1,
749
+ containerRef: c
750
+ }) {
751
+ const { t: f } = k(), p = P(null);
752
+ return L(() => {
753
+ if (!a) return;
754
+ const u = p.current;
755
+ if (!u || typeof IntersectionObserver > "u") return;
756
+ const l = new IntersectionObserver(
757
+ (b) => {
758
+ for (const R of b)
759
+ R.isIntersecting && (_("serp_load_more", {
760
+ currentCount: e.length
761
+ }), a());
762
+ },
763
+ { root: null, rootMargin: "200px" }
764
+ );
765
+ return l.observe(u), () => l.disconnect();
766
+ }, [a, e.length]), d ? /* @__PURE__ */ t(
767
+ "div",
768
+ {
769
+ role: "status",
770
+ "aria-live": "polite",
771
+ "aria-label": f("practiceResults.loading"),
772
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
773
+ children: Array.from({ length: 4 }).map((u, l) => /* @__PURE__ */ t(
774
+ He,
775
+ {
776
+ variant: "rounded",
777
+ height: m === "rich" ? "11rem" : "7rem"
778
+ },
779
+ `pr-skel-${l}`
780
+ ))
781
+ }
782
+ ) : /* @__PURE__ */ h(
783
+ "div",
784
+ {
785
+ ref: c,
786
+ "data-component": "practice-results-list",
787
+ role: "list",
788
+ "aria-label": f("practiceResults.list.label"),
789
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:overflow-y-auto",
790
+ children: [
791
+ e.map((u) => /* @__PURE__ */ t("div", { role: "listitem", children: m === "rich" ? /* @__PURE__ */ t(
792
+ ot,
793
+ {
794
+ result: u,
795
+ apiKey: r,
796
+ consentGranted: g,
797
+ highlighted: n === u.id,
798
+ onSelect: () => o(u.id),
799
+ onHover: () => s(u.id)
800
+ }
801
+ ) : /* @__PURE__ */ t(
802
+ lt,
803
+ {
804
+ result: u,
805
+ highlighted: n === u.id,
806
+ onSelect: () => o(u.id),
807
+ onHover: () => s(u.id)
808
+ }
809
+ ) }, u.id)),
810
+ a ? /* @__PURE__ */ t(
811
+ "div",
812
+ {
813
+ ref: p,
814
+ "aria-hidden": "true",
815
+ className: "ds:flex ds:items-center ds:justify-center ds:py-[var(--spacing-md)]",
816
+ children: i ? /* @__PURE__ */ t(Ke, { size: "md", variant: "pulse" }) : /* @__PURE__ */ t("span", { className: "ds:size-1" })
817
+ }
818
+ ) : null
819
+ ]
820
+ }
821
+ );
822
+ }
823
+ function Q({
824
+ results: e,
825
+ searchCentre: n,
826
+ zoom: s,
827
+ apiKey: o,
828
+ highlightedId: a,
829
+ onPinClick: i,
830
+ onPinHover: d,
831
+ onPinFirstInteract: m,
832
+ onBoundsChange: r,
833
+ consentGranted: g,
834
+ onConsentRequest: c
835
+ }) {
836
+ const { t: f } = k(), p = A(
837
+ () => e.filter(
838
+ (l) => !!l.location
839
+ ).map((l) => ({
840
+ id: l.id,
841
+ position: {
842
+ lat: l.location.lat,
843
+ lng: l.location.lng
844
+ },
845
+ label: l.name
846
+ })),
847
+ [e]
848
+ ), u = A(() => {
849
+ if (n) return n;
850
+ const l = be(e);
851
+ return l ? {
852
+ lat: (l.north + l.south) / 2,
853
+ lng: (l.east + l.west) / 2
854
+ } : { lat: 45.4642, lng: 9.19 };
855
+ }, [e, n]);
856
+ return L(() => {
857
+ if (!r) return;
858
+ const l = be(e);
859
+ l && (r(l), _("serp_map_panned", { bounds: l }));
860
+ }, [e, r]), /* @__PURE__ */ t(
861
+ "div",
862
+ {
863
+ "data-component": "practice-results-map-panel",
864
+ className: "ds:relative ds:flex ds:size-full ds:min-h-[24rem] ds:flex-col",
865
+ children: /* @__PURE__ */ t(
866
+ De,
867
+ {
868
+ apiKey: o ?? "",
869
+ center: u,
870
+ zoom: s,
871
+ markers: p,
872
+ selectedMarkerId: a,
873
+ consentGranted: !!g,
874
+ onConsentRequest: c,
875
+ onMarkerClick: (l) => {
876
+ l != null && (d(l), m(l), i(l));
877
+ },
878
+ ariaLabel: f("practiceResults.map.label"),
879
+ size: "lg",
880
+ surface: "bordered",
881
+ className: "ds:size-full"
882
+ }
883
+ )
884
+ }
885
+ );
886
+ }
887
+ function Ce({
888
+ variantBodyProps: e
889
+ }) {
890
+ const { facets: n, value: s, onChange: o, heading: a, intro: i, totalCount: d, searchCentre: m } = e;
891
+ return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
892
+ /* @__PURE__ */ t(
893
+ we,
894
+ {
895
+ heading: a,
896
+ intro: i,
897
+ totalCount: d,
898
+ searchCentreLabel: m == null ? void 0 : m.label
899
+ }
900
+ ),
901
+ n.length > 0 ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
902
+ /* @__PURE__ */ t(
903
+ ce,
904
+ {
905
+ facets: n,
906
+ value: s.facets,
907
+ onChange: (r) => o({ ...s, facets: r })
908
+ }
909
+ ),
910
+ /* @__PURE__ */ t(
911
+ de,
912
+ {
913
+ value: s.sort ?? "relevance",
914
+ onChange: (r) => o({ ...s, sort: r })
915
+ }
916
+ )
917
+ ] }) : /* @__PURE__ */ t("div", { className: "ds:flex ds:justify-end", children: /* @__PURE__ */ t(
918
+ de,
919
+ {
920
+ value: s.sort ?? "relevance",
921
+ onChange: (r) => o({ ...s, sort: r })
922
+ }
923
+ ) })
924
+ ] });
925
+ }
926
+ function fe() {
927
+ const { t: e } = k();
928
+ return /* @__PURE__ */ t(
929
+ $e,
930
+ {
931
+ variant: "no-results",
932
+ title: e("practiceResults.empty.title"),
933
+ description: e("practiceResults.empty.description")
934
+ }
935
+ );
936
+ }
937
+ function he({ onRetry: e }) {
938
+ const { t: n } = k();
939
+ return /* @__PURE__ */ h(U, { variant: "error", children: [
940
+ /* @__PURE__ */ t(U.Title, { as: "h3", children: n("practiceResults.error.title") }),
941
+ /* @__PURE__ */ t(U.Description, { children: n("practiceResults.error.description") }),
942
+ e ? /* @__PURE__ */ t(U.Action, { children: /* @__PURE__ */ t(
943
+ ue,
944
+ {
945
+ intent: "secondary",
946
+ size: "sm",
947
+ startIcon: /* @__PURE__ */ t(Ve, { "aria-hidden": "true" }),
948
+ onClick: e,
949
+ children: n("practiceResults.error.retry")
950
+ }
951
+ ) }) : null
952
+ ] });
953
+ }
954
+ function ct(e) {
955
+ const {
956
+ results: n,
957
+ apiKey: s,
958
+ zoom: o,
959
+ searchCentre: a,
960
+ onLoadMore: i,
961
+ loadingMore: d,
962
+ loadingSkeletons: m,
963
+ emptyResultsSlot: r,
964
+ errorSlot: g,
965
+ error: c,
966
+ onRetry: f,
967
+ highlightedId: p,
968
+ onCardHover: u,
969
+ onPinClick: l,
970
+ consentGranted: b,
971
+ onConsentRequest: R,
972
+ onBoundsChange: C,
973
+ listContainerRef: y
974
+ } = e, { t: N } = k(), [M, I] = Z(!1), T = c ? g ?? /* @__PURE__ */ t(he, { onRetry: f }) : n.length === 0 && !m ? r ?? /* @__PURE__ */ t(fe, {}) : /* @__PURE__ */ t(
975
+ pe,
976
+ {
977
+ results: n,
978
+ highlightedId: p,
979
+ onCardHover: u,
980
+ onCardSelect: (w) => D(n, w, "card", e.onResultSelect),
981
+ onLoadMore: i,
982
+ loadingMore: d,
983
+ loadingSkeletons: m,
984
+ density: "compact",
985
+ containerRef: y
986
+ }
987
+ );
988
+ return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
989
+ /* @__PURE__ */ t(Ce, { variantBodyProps: e }),
990
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:lg:grid ds:lg:grid-cols-[55%_45%] ds:lg:gap-[var(--spacing-lg)] ds:lg:items-start", children: [
991
+ /* @__PURE__ */ t("div", { className: "ds:min-w-0 ds:lg:max-h-[40rem] ds:lg:overflow-hidden", children: T }),
992
+ /* @__PURE__ */ t("div", { className: "ds:hidden ds:lg:block ds:sticky ds:top-[var(--spacing-md)] ds:h-[40rem]", children: /* @__PURE__ */ t(
993
+ Q,
994
+ {
995
+ results: n,
996
+ searchCentre: a,
997
+ zoom: o,
998
+ apiKey: s,
999
+ highlightedId: p,
1000
+ onPinClick: (w) => {
1001
+ D(n, w, "pin", e.onResultSelect), l(w);
1002
+ },
1003
+ onPinHover: u,
1004
+ onPinFirstInteract: e.onPinFirstInteract,
1005
+ onBoundsChange: C,
1006
+ consentGranted: b,
1007
+ onConsentRequest: R
1008
+ }
1009
+ ) })
1010
+ ] }),
1011
+ /* @__PURE__ */ t("div", { className: "ds:flex ds:lg:hidden ds:sticky ds:bottom-[var(--spacing-md)] ds:justify-center", children: /* @__PURE__ */ t(
1012
+ ue,
1013
+ {
1014
+ intent: "primary",
1015
+ size: "md",
1016
+ startIcon: /* @__PURE__ */ t(Ue, { "aria-hidden": "true" }),
1017
+ onClick: () => I(!0),
1018
+ children: N("practiceResults.viewMap")
1019
+ }
1020
+ ) }),
1021
+ /* @__PURE__ */ t(S.Root, { open: M, onOpenChange: I, children: /* @__PURE__ */ h(S.Content, { side: "bottom", size: "lg", children: [
1022
+ /* @__PURE__ */ t(S.Header, { children: /* @__PURE__ */ t(S.Title, { children: N("practiceResults.map.label") }) }),
1023
+ /* @__PURE__ */ h(S.Body, { children: [
1024
+ /* @__PURE__ */ t(S.Description, { className: "ds:sr-only", children: N("practiceResults.sheet.description") }),
1025
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1026
+ /* @__PURE__ */ t("div", { className: "ds:h-[20rem]", children: /* @__PURE__ */ t(
1027
+ Q,
1028
+ {
1029
+ results: n,
1030
+ searchCentre: a,
1031
+ zoom: o,
1032
+ apiKey: s,
1033
+ highlightedId: p,
1034
+ onPinClick: (w) => {
1035
+ D(n, w, "pin", e.onResultSelect), l(w);
1036
+ },
1037
+ onPinHover: u,
1038
+ onPinFirstInteract: e.onPinFirstInteract,
1039
+ onBoundsChange: C,
1040
+ consentGranted: b,
1041
+ onConsentRequest: R
1042
+ }
1043
+ ) }),
1044
+ T
1045
+ ] })
1046
+ ] })
1047
+ ] }) })
1048
+ ] });
1049
+ }
1050
+ const dt = {
1051
+ peek: "sm",
1052
+ half: "md",
1053
+ full: "lg"
1054
+ }, $ = [
1055
+ "peek",
1056
+ "half",
1057
+ "full"
1058
+ ];
1059
+ function ut({ value: e, onChange: n }) {
1060
+ const { t: s, i18n: o } = k(), a = o.dir() === "rtl", i = P(
1061
+ /* @__PURE__ */ new Map()
1062
+ ), d = O((r) => {
1063
+ var g;
1064
+ (g = i.current.get(r)) == null || g.focus();
1065
+ }, []), m = O(
1066
+ (r, g) => {
1067
+ const c = $.indexOf(g), f = $.length, p = a ? "ArrowLeft" : "ArrowRight", u = a ? "ArrowRight" : "ArrowLeft";
1068
+ let l = null;
1069
+ switch (r.key) {
1070
+ case p:
1071
+ case "ArrowDown":
1072
+ l = $[(c + 1) % f];
1073
+ break;
1074
+ case u:
1075
+ case "ArrowUp":
1076
+ l = $[(c - 1 + f) % f];
1077
+ break;
1078
+ case "Home":
1079
+ l = $[0];
1080
+ break;
1081
+ case "End":
1082
+ l = $[f - 1];
1083
+ break;
1084
+ default:
1085
+ return;
1086
+ }
1087
+ r.preventDefault(), l && l !== g && n(l), l && d(l);
1088
+ },
1089
+ [d, a, n]
1090
+ );
1091
+ return /* @__PURE__ */ t(
1092
+ "div",
1093
+ {
1094
+ role: "radiogroup",
1095
+ "aria-label": s("practiceResults.sheet.snap.label"),
1096
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1097
+ children: $.map((r) => {
1098
+ const g = e === r;
1099
+ return /* @__PURE__ */ t(
1100
+ "button",
1101
+ {
1102
+ ref: (c) => {
1103
+ c ? i.current.set(r, c) : i.current.delete(r);
1104
+ },
1105
+ type: "button",
1106
+ role: "radio",
1107
+ "aria-checked": g,
1108
+ "aria-label": s(`practiceResults.sheet.snap.${r}`),
1109
+ tabIndex: g ? 0 : -1,
1110
+ onClick: () => n(r),
1111
+ onKeyDown: (c) => m(c, r),
1112
+ className: J({
1113
+ state: g ? "active" : "idle"
1114
+ }),
1115
+ children: s(`practiceResults.sheet.snap.${r}`)
1116
+ },
1117
+ r
1118
+ );
1119
+ })
1120
+ }
1121
+ );
1122
+ }
1123
+ function mt(e) {
1124
+ const {
1125
+ results: n,
1126
+ apiKey: s,
1127
+ zoom: o,
1128
+ searchCentre: a,
1129
+ onLoadMore: i,
1130
+ loadingMore: d,
1131
+ loadingSkeletons: m,
1132
+ emptyResultsSlot: r,
1133
+ errorSlot: g,
1134
+ error: c,
1135
+ onRetry: f,
1136
+ highlightedId: p,
1137
+ onCardHover: u,
1138
+ onPinClick: l,
1139
+ consentGranted: b,
1140
+ onConsentRequest: R,
1141
+ onBoundsChange: C,
1142
+ listContainerRef: y,
1143
+ facets: N,
1144
+ value: M,
1145
+ onChange: I
1146
+ } = e, { t: T } = k(), [w, E] = Z("peek"), [X, Y] = Z(!0), ee = dt[w], j = c ? g ?? /* @__PURE__ */ t(he, { onRetry: f }) : n.length === 0 && !m ? r ?? /* @__PURE__ */ t(fe, {}) : /* @__PURE__ */ t(
1147
+ pe,
1148
+ {
1149
+ results: n,
1150
+ highlightedId: p,
1151
+ onCardHover: u,
1152
+ onCardSelect: (x) => D(n, x, "card", e.onResultSelect),
1153
+ onLoadMore: i,
1154
+ loadingMore: d,
1155
+ loadingSkeletons: m,
1156
+ density: "rich",
1157
+ apiKey: s,
1158
+ consentGranted: b,
1159
+ containerRef: y
1160
+ }
1161
+ );
1162
+ return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1163
+ /* @__PURE__ */ t(
1164
+ we,
1165
+ {
1166
+ heading: e.heading,
1167
+ intro: e.intro,
1168
+ totalCount: e.totalCount,
1169
+ searchCentreLabel: a == null ? void 0 : a.label
1170
+ }
1171
+ ),
1172
+ /* @__PURE__ */ h("div", { className: "ds:hidden ds:lg:grid ds:lg:grid-cols-[65%_35%] ds:lg:gap-[var(--spacing-lg)] ds:lg:items-start", children: [
1173
+ /* @__PURE__ */ h("div", { className: "ds:relative ds:h-[40rem]", children: [
1174
+ /* @__PURE__ */ t(
1175
+ Q,
1176
+ {
1177
+ results: n,
1178
+ searchCentre: a,
1179
+ zoom: o,
1180
+ apiKey: s,
1181
+ highlightedId: p,
1182
+ onPinClick: (x) => {
1183
+ D(n, x, "pin", e.onResultSelect), l(x);
1184
+ },
1185
+ onPinHover: u,
1186
+ onPinFirstInteract: e.onPinFirstInteract,
1187
+ onBoundsChange: C,
1188
+ consentGranted: b,
1189
+ onConsentRequest: R
1190
+ }
1191
+ ),
1192
+ N.length > 0 ? /* @__PURE__ */ t("div", { className: "ds:absolute ds:start-[var(--spacing-md)] ds:top-[var(--spacing-md)] ds:max-w-[80%]", children: /* @__PURE__ */ t(
1193
+ ce,
1194
+ {
1195
+ facets: N,
1196
+ value: M.facets,
1197
+ onChange: (x) => I({ ...M, facets: x }),
1198
+ floating: !0
1199
+ }
1200
+ ) }) : null
1201
+ ] }),
1202
+ /* @__PURE__ */ t("div", { className: "ds:min-w-0 ds:max-h-[40rem] ds:overflow-y-auto", children: j })
1203
+ ] }),
1204
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:lg:hidden ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1205
+ /* @__PURE__ */ h("div", { className: "ds:relative ds:h-[60vh] ds:min-h-[20rem]", children: [
1206
+ /* @__PURE__ */ t(
1207
+ Q,
1208
+ {
1209
+ results: n,
1210
+ searchCentre: a,
1211
+ zoom: o,
1212
+ apiKey: s,
1213
+ highlightedId: p,
1214
+ onPinClick: (x) => {
1215
+ D(n, x, "pin", e.onResultSelect), l(x);
1216
+ },
1217
+ onPinHover: u,
1218
+ onPinFirstInteract: e.onPinFirstInteract,
1219
+ onBoundsChange: C,
1220
+ consentGranted: b,
1221
+ onConsentRequest: R
1222
+ }
1223
+ ),
1224
+ N.length > 0 ? /* @__PURE__ */ t("div", { className: "ds:absolute ds:start-[var(--spacing-md)] ds:top-[var(--spacing-md)] ds:max-w-[calc(100%-var(--spacing-lg))]", children: /* @__PURE__ */ t(
1225
+ ce,
1226
+ {
1227
+ facets: N,
1228
+ value: M.facets,
1229
+ onChange: (x) => I({ ...M, facets: x }),
1230
+ floating: !0
1231
+ }
1232
+ ) }) : null
1233
+ ] }),
1234
+ /* @__PURE__ */ t(S.Root, { open: X, onOpenChange: Y, children: /* @__PURE__ */ h(S.Content, { side: "bottom", size: ee, children: [
1235
+ /* @__PURE__ */ t(S.Header, { children: /* @__PURE__ */ t(S.Title, { children: T("practiceResults.sheet.title", {
1236
+ count: e.totalCount ?? n.length
1237
+ }) }) }),
1238
+ /* @__PURE__ */ h(S.Body, { children: [
1239
+ /* @__PURE__ */ t(S.Description, { className: "ds:sr-only", children: T("practiceResults.sheet.descriptionMapFirst") }),
1240
+ /* @__PURE__ */ h("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]", children: [
1241
+ /* @__PURE__ */ t(
1242
+ de,
1243
+ {
1244
+ value: M.sort ?? "relevance",
1245
+ onChange: (x) => I({ ...M, sort: x })
1246
+ }
1247
+ ),
1248
+ /* @__PURE__ */ t(
1249
+ ut,
1250
+ {
1251
+ value: w,
1252
+ onChange: E
1253
+ }
1254
+ )
1255
+ ] }),
1256
+ j
1257
+ ] })
1258
+ ] }) })
1259
+ ] })
1260
+ ] });
1261
+ }
1262
+ function pt(e) {
1263
+ const {
1264
+ results: n,
1265
+ apiKey: s,
1266
+ onLoadMore: o,
1267
+ loadingMore: a,
1268
+ loadingSkeletons: i,
1269
+ emptyResultsSlot: d,
1270
+ errorSlot: m,
1271
+ error: r,
1272
+ onRetry: g,
1273
+ highlightedId: c,
1274
+ onCardHover: f,
1275
+ consentGranted: p,
1276
+ listContainerRef: u
1277
+ } = e, l = r ? m ?? /* @__PURE__ */ t(he, { onRetry: g }) : n.length === 0 && !i ? d ?? /* @__PURE__ */ t(fe, {}) : /* @__PURE__ */ t(
1278
+ pe,
1279
+ {
1280
+ results: n,
1281
+ highlightedId: c,
1282
+ onCardHover: f,
1283
+ onCardSelect: (b) => D(n, b, "card", e.onResultSelect),
1284
+ onLoadMore: o,
1285
+ loadingMore: a,
1286
+ loadingSkeletons: i,
1287
+ density: "rich",
1288
+ apiKey: s,
1289
+ consentGranted: p,
1290
+ containerRef: u
1291
+ }
1292
+ );
1293
+ return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1294
+ /* @__PURE__ */ t(Ce, { variantBodyProps: e }),
1295
+ l
1296
+ ] });
1297
+ }
1298
+ const ft = Te(function({
1299
+ variant: n = "split-list-map",
1300
+ results: s,
1301
+ totalCount: o,
1302
+ searchCentre: a,
1303
+ facets: i,
1304
+ googleMapsApiKey: d,
1305
+ defaultZoom: m = Qe,
1306
+ onBoundsChange: r,
1307
+ consentGranted: g,
1308
+ onConsentRequest: c,
1309
+ onLoadMore: f,
1310
+ loadingMore: p,
1311
+ value: u,
1312
+ onChange: l,
1313
+ onResultSelect: b,
1314
+ loading: R,
1315
+ emptyResultsSlot: C,
1316
+ errorSlot: y,
1317
+ error: N,
1318
+ onRetry: M,
1319
+ heading: I,
1320
+ intro: T,
1321
+ "aria-label": w,
1322
+ id: E,
1323
+ className: X,
1324
+ ...Y
1325
+ }, ee) {
1326
+ const { t: j } = k(), [x, B] = Z(null), G = P(/* @__PURE__ */ new Set()), te = P(/* @__PURE__ */ new Set()), Ne = P(null), ne = P(null), se = A(
1327
+ () => ({
1328
+ getVariant: () => n,
1329
+ scrollToResult: (v) => {
1330
+ const V = ne.current;
1331
+ if (!V) return;
1332
+ const H = V.querySelector(
1333
+ `[data-component="practice-result-card"][data-result-id="${CSS.escape(v)}"]`
1334
+ );
1335
+ H && (H.scrollIntoView({ behavior: "smooth", block: "nearest" }), B(v));
1336
+ },
1337
+ focusPin: (v) => {
1338
+ B(v);
1339
+ }
1340
+ }),
1341
+ [n]
1342
+ );
1343
+ Fe(ee, () => se, [se]), Ee(Je, se, E);
1344
+ const ge = P(null);
1345
+ L(() => {
1346
+ ge.current !== n && (ge.current = n, _("serp_variant_exposed", {
1347
+ variant: n,
1348
+ totalCount: o ?? s.length
1349
+ }), G.current = /* @__PURE__ */ new Set(), te.current = /* @__PURE__ */ new Set());
1350
+ }, [n]);
1351
+ const ae = P(!1), ie = A(() => i ?? [], [i]), re = u.sort ?? (a ? "distance" : "relevance"), le = A(() => {
1352
+ const v = Ye(s, u.facets, ie);
1353
+ return et(v, re, a);
1354
+ }, [s, u.facets, ie, re, a]);
1355
+ L(() => {
1356
+ const v = le.length === 0;
1357
+ v && !ae.current ? (_("serp_empty_results", {
1358
+ appliedFacets: u.facets ?? {}
1359
+ }), ae.current = !0) : v || (ae.current = !1);
1360
+ }, [le.length, u.facets]);
1361
+ const F = P(null), ve = P(null);
1362
+ L(
1363
+ () => () => {
1364
+ F.current && clearTimeout(F.current);
1365
+ },
1366
+ []
1367
+ );
1368
+ const Me = O((v) => {
1369
+ B(v), !G.current.has(v) && (ve.current === v && F.current || (F.current && clearTimeout(F.current), ve.current = v, F.current = setTimeout(() => {
1370
+ G.current.has(v) || (G.current.add(v), _("serp_result_hovered_card", { resultId: v })), F.current = null;
1371
+ }, 500)));
1372
+ }, []), Pe = O((v) => {
1373
+ B(v);
1374
+ const V = ne.current;
1375
+ if (!V) return;
1376
+ const H = V.querySelector(
1377
+ `[data-component="practice-result-card"][data-result-id="${CSS.escape(v)}"]`
1378
+ );
1379
+ H == null || H.scrollIntoView({ behavior: "smooth", block: "nearest" });
1380
+ }, []), _e = O((v) => {
1381
+ te.current.has(v) || (te.current.add(v), _("serp_result_hovered_pin", { resultId: v }));
1382
+ }, []), ze = !!R && s.length === 0, oe = {
1383
+ results: le,
1384
+ totalCount: o,
1385
+ searchCentre: a,
1386
+ facets: ie,
1387
+ value: { ...u, sort: re },
1388
+ onChange: l,
1389
+ onResultSelect: b,
1390
+ onLoadMore: f,
1391
+ loadingMore: p,
1392
+ apiKey: d,
1393
+ zoom: m,
1394
+ consentGranted: g,
1395
+ onConsentRequest: c,
1396
+ onBoundsChange: r,
1397
+ loadingSkeletons: ze,
1398
+ emptyResultsSlot: C,
1399
+ errorSlot: y,
1400
+ error: N,
1401
+ onRetry: M,
1402
+ heading: I,
1403
+ intro: T,
1404
+ highlightedId: x,
1405
+ onCardHover: Me,
1406
+ onPinClick: Pe,
1407
+ onPinFirstInteract: _e,
1408
+ listContainerRef: Ne
1409
+ }, Ae = (() => {
1410
+ switch (n) {
1411
+ case "map-first":
1412
+ return /* @__PURE__ */ t(mt, { ...oe });
1413
+ case "rich-cards":
1414
+ return /* @__PURE__ */ t(pt, { ...oe });
1415
+ case "split-list-map":
1416
+ default:
1417
+ return /* @__PURE__ */ t(ct, { ...oe });
1418
+ }
1419
+ })(), Ie = w ?? j("practiceResults.regionLabel");
1420
+ return /* @__PURE__ */ t(
1421
+ "div",
1422
+ {
1423
+ ref: ne,
1424
+ role: "region",
1425
+ "aria-label": Ie,
1426
+ id: E,
1427
+ "data-component": "practice-results",
1428
+ "data-component-id": E,
1429
+ "data-variant": n,
1430
+ className: tt({ variant: n, className: X }),
1431
+ ...Y,
1432
+ children: Ae
1433
+ }
1434
+ );
1435
+ });
1436
+ ft.displayName = "PracticeResults";
1437
+ export {
1438
+ ft as P,
1439
+ Je as p
1440
+ };
1441
+ //# sourceMappingURL=practice-results-CEKjwsgS.js.map