@alfadocs/ui-kit-debug 1.131.0 → 1.132.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 (125) hide show
  1. package/dist/_chunks/{address-autocomplete-D2uNpxcE.js → address-autocomplete-yDLqg43e.js} +2 -2
  2. package/dist/_chunks/{address-autocomplete-D2uNpxcE.js.map → address-autocomplete-yDLqg43e.js.map} +1 -1
  3. package/dist/_chunks/{address-fields-BU65pA-V.js → address-fields-DvSWdeR0.js} +2 -2
  4. package/dist/_chunks/{address-fields-BU65pA-V.js.map → address-fields-DvSWdeR0.js.map} +1 -1
  5. package/dist/_chunks/map-view-Cm69dCnY.js +1794 -0
  6. package/dist/_chunks/map-view-Cm69dCnY.js.map +1 -0
  7. package/dist/_chunks/{maps-core-gate-DKx96CC_.js → maps-core-gate-CP8SEHH1.js} +97 -93
  8. package/dist/_chunks/{maps-core-gate-DKx96CC_.js.map → maps-core-gate-CP8SEHH1.js.map} +1 -1
  9. package/dist/_chunks/{practice-results-M5A9-X9y.js → practice-results-DaxGw9_f.js} +762 -748
  10. package/dist/_chunks/practice-results-DaxGw9_f.js.map +1 -0
  11. package/dist/_chunks/{reserved.agent-BBuWWtYb.js → reserved.agent-W8mR179D.js} +2 -2
  12. package/dist/_chunks/{reserved.agent-BBuWWtYb.js.map → reserved.agent-W8mR179D.js.map} +1 -1
  13. package/dist/agent-catalog.json +25 -2
  14. package/dist/agent-i18n/en.json +3 -1
  15. package/dist/browser-support.js +1 -1
  16. package/dist/components/address-autocomplete/index.js +1 -1
  17. package/dist/components/address-fields/index.js +1 -1
  18. package/dist/components/booking/index.js +1 -1
  19. package/dist/components/map-view/index.d.ts +1 -1
  20. package/dist/components/map-view/index.d.ts.map +1 -1
  21. package/dist/components/map-view/index.js +1 -1
  22. package/dist/components/map-view/map-view.agent.d.ts.map +1 -1
  23. package/dist/components/map-view/map-view.d.ts +42 -1
  24. package/dist/components/map-view/map-view.d.ts.map +1 -1
  25. package/dist/components/practice-results/index.js +1 -1
  26. package/dist/components/practice-results/practice-results.d.ts +12 -1
  27. package/dist/components/practice-results/practice-results.d.ts.map +1 -1
  28. package/dist/core.css +1 -1
  29. package/dist/host-compat.css +4 -1
  30. package/dist/i18n/locales/ar.d.ts +2 -0
  31. package/dist/i18n/locales/ar.d.ts.map +1 -1
  32. package/dist/i18n/locales/ar.js +3 -1
  33. package/dist/i18n/locales/ar.js.map +1 -1
  34. package/dist/i18n/locales/de.d.ts +2 -0
  35. package/dist/i18n/locales/de.d.ts.map +1 -1
  36. package/dist/i18n/locales/de.js +3 -1
  37. package/dist/i18n/locales/de.js.map +1 -1
  38. package/dist/i18n/locales/el.d.ts +2 -0
  39. package/dist/i18n/locales/el.d.ts.map +1 -1
  40. package/dist/i18n/locales/el.js +3 -1
  41. package/dist/i18n/locales/el.js.map +1 -1
  42. package/dist/i18n/locales/en.d.ts +2 -0
  43. package/dist/i18n/locales/en.d.ts.map +1 -1
  44. package/dist/i18n/locales/en.js +3 -1
  45. package/dist/i18n/locales/en.js.map +1 -1
  46. package/dist/i18n/locales/es.d.ts +2 -0
  47. package/dist/i18n/locales/es.d.ts.map +1 -1
  48. package/dist/i18n/locales/es.js +3 -1
  49. package/dist/i18n/locales/es.js.map +1 -1
  50. package/dist/i18n/locales/fr.d.ts +2 -0
  51. package/dist/i18n/locales/fr.d.ts.map +1 -1
  52. package/dist/i18n/locales/fr.js +3 -1
  53. package/dist/i18n/locales/fr.js.map +1 -1
  54. package/dist/i18n/locales/hi.d.ts +2 -0
  55. package/dist/i18n/locales/hi.d.ts.map +1 -1
  56. package/dist/i18n/locales/hi.js +3 -1
  57. package/dist/i18n/locales/hi.js.map +1 -1
  58. package/dist/i18n/locales/it.d.ts +2 -0
  59. package/dist/i18n/locales/it.d.ts.map +1 -1
  60. package/dist/i18n/locales/it.js +3 -1
  61. package/dist/i18n/locales/it.js.map +1 -1
  62. package/dist/i18n/locales/ja.d.ts +2 -0
  63. package/dist/i18n/locales/ja.d.ts.map +1 -1
  64. package/dist/i18n/locales/ja.js +3 -1
  65. package/dist/i18n/locales/ja.js.map +1 -1
  66. package/dist/i18n/locales/nl.d.ts +2 -0
  67. package/dist/i18n/locales/nl.d.ts.map +1 -1
  68. package/dist/i18n/locales/nl.js +3 -1
  69. package/dist/i18n/locales/nl.js.map +1 -1
  70. package/dist/i18n/locales/pl.d.ts +2 -0
  71. package/dist/i18n/locales/pl.d.ts.map +1 -1
  72. package/dist/i18n/locales/pl.js +3 -1
  73. package/dist/i18n/locales/pl.js.map +1 -1
  74. package/dist/i18n/locales/pt.d.ts +2 -0
  75. package/dist/i18n/locales/pt.d.ts.map +1 -1
  76. package/dist/i18n/locales/pt.js +3 -1
  77. package/dist/i18n/locales/pt.js.map +1 -1
  78. package/dist/i18n/locales/ro.d.ts +2 -0
  79. package/dist/i18n/locales/ro.d.ts.map +1 -1
  80. package/dist/i18n/locales/ro.js +3 -1
  81. package/dist/i18n/locales/ro.js.map +1 -1
  82. package/dist/i18n/locales/ru.d.ts +2 -0
  83. package/dist/i18n/locales/ru.d.ts.map +1 -1
  84. package/dist/i18n/locales/ru.js +3 -1
  85. package/dist/i18n/locales/ru.js.map +1 -1
  86. package/dist/i18n/locales/sq.d.ts +2 -0
  87. package/dist/i18n/locales/sq.d.ts.map +1 -1
  88. package/dist/i18n/locales/sq.js +3 -1
  89. package/dist/i18n/locales/sq.js.map +1 -1
  90. package/dist/i18n/locales/sv.d.ts +2 -0
  91. package/dist/i18n/locales/sv.d.ts.map +1 -1
  92. package/dist/i18n/locales/sv.js +3 -1
  93. package/dist/i18n/locales/sv.js.map +1 -1
  94. package/dist/i18n/locales/tr.d.ts +2 -0
  95. package/dist/i18n/locales/tr.d.ts.map +1 -1
  96. package/dist/i18n/locales/tr.js +3 -1
  97. package/dist/i18n/locales/tr.js.map +1 -1
  98. package/dist/i18n/locales/zh.d.ts +2 -0
  99. package/dist/i18n/locales/zh.d.ts.map +1 -1
  100. package/dist/i18n/locales/zh.js +3 -1
  101. package/dist/i18n/locales/zh.js.map +1 -1
  102. package/dist/index.js +5 -5
  103. package/dist/locales/ar.json +3 -1
  104. package/dist/locales/de.json +3 -1
  105. package/dist/locales/el.json +3 -1
  106. package/dist/locales/en.json +3 -1
  107. package/dist/locales/es.json +3 -1
  108. package/dist/locales/fr.json +3 -1
  109. package/dist/locales/hi.json +3 -1
  110. package/dist/locales/it.json +3 -1
  111. package/dist/locales/ja.json +3 -1
  112. package/dist/locales/nl.json +3 -1
  113. package/dist/locales/pl.json +3 -1
  114. package/dist/locales/pt.json +3 -1
  115. package/dist/locales/ro.json +3 -1
  116. package/dist/locales/ru.json +3 -1
  117. package/dist/locales/sq.json +3 -1
  118. package/dist/locales/sv.json +3 -1
  119. package/dist/locales/tr.json +3 -1
  120. package/dist/locales/zh.json +3 -1
  121. package/dist/tokens.css +1 -1
  122. package/package.json +1 -1
  123. package/dist/_chunks/map-view-DkL58SRp.js +0 -1613
  124. package/dist/_chunks/map-view-DkL58SRp.js.map +0 -1
  125. package/dist/_chunks/practice-results-M5A9-X9y.js.map +0 -1
@@ -0,0 +1,1794 @@
1
+ import { jsx as u, jsxs as N, Fragment as Vt } from "react/jsx-runtime";
2
+ import { forwardRef as Ot, useRef as k, useMemo as G, useId as nt, useState as L, useEffect as x, useCallback as A, useImperativeHandle as Ft, useLayoutEffect as oe, Fragment as jt, useContext as rt, createContext as Gt } from "react";
3
+ import { createPortal as ot } from "react-dom";
4
+ import { c as se } from "./index-D2ZczOXr.js";
5
+ import { useTranslation as H } from "react-i18next";
6
+ import { M as Dt, A as Zt, a as Ut, _ as Wt, b as Bt, u as st, c as X, d as at, e as it } from "./maps-core-gate-CP8SEHH1.js";
7
+ import { B as $e } from "./button-DohK_Ak_.js";
8
+ import { S as Kt } from "./skeleton-tTWJpvAq.js";
9
+ import { V as ct } from "./visually-hidden-BHxEUGyT.js";
10
+ import { E as qt } from "./error-boundary-tAn_GuCu.js";
11
+ import { u as Ht } from "./registry-DvAUVLHh.js";
12
+ import { l as Te } from "./length-token-DwMnGEYT.js";
13
+ import { E as lt } from "./external-link-CY6zAXXU.js";
14
+ import { M as dt } from "./map-pin-BaY37-Km.js";
15
+ const Xt = {
16
+ id: "map-view",
17
+ // pan → scroll (viewport move); set_zoom → set_value; select_marker → pick
18
+ // (NON-persisting marker focus, no value state slot); open → retry_load
19
+ // (loads the interactive map again after a failure).
20
+ capabilities: ["scroll", "set_value", "pick", "open"],
21
+ // Every action routes through the imperative bridge, which only exists
22
+ // once the map has loaded: consent granted (the default is
23
+ // `consentGranted={false}`) and Google Maps finished loading. Until then
24
+ // all three actions are silent no-ops. `consentGranted` says whether the
25
+ // gate is passed, and a null `center` after it means the map is still
26
+ // loading. `center` / `zoom` are read off the live
27
+ // map because Google clamps zoom and animates pans, so requested is not
28
+ // applied; `selectedMarkerId` is the only confirmation the host accepted
29
+ // a `select_marker` proposal.
30
+ //
31
+ // A9: marker ids only (`MapMarker.id` is a stable opaque id). Never
32
+ // `MapMarker.label`, never the `address` prop (consumer-supplied free
33
+ // text, PII in any patient-address deployment), never `apiKey`.
34
+ state: {
35
+ consentGranted: {
36
+ type: "boolean",
37
+ descriptionKey: "ui.agent.mapView.state.consentGranted",
38
+ description: "True when the GDPR consent gate has been passed. Read this FIRST: while it is false every action is a silent no-op against a placeholder, and nothing else in the surface says so. When it is true but `center` is still null, Google Maps is loading; wait for `center` before acting.",
39
+ read: (e) => e.isConsentGranted()
40
+ },
41
+ markerCount: {
42
+ type: "number",
43
+ descriptionKey: "ui.agent.mapView.state.markerCount",
44
+ description: "Number of markers the consumer passed. Zero means there is nothing for `select_marker` to select. A count only — no ids, labels or positions.",
45
+ read: (e) => e.getMarkerCount()
46
+ },
47
+ selectedMarkerId: {
48
+ type: "string | null",
49
+ descriptionKey: "ui.agent.mapView.state.selectedMarkerId",
50
+ description: "Id of the marker the host currently holds as selected, or null. Selection is fully controlled by the consumer, so `select_marker` only proposes — this slot is the only way to see whether the proposal was accepted.",
51
+ read: (e) => e.getSelectedMarkerId()
52
+ },
53
+ center: {
54
+ type: "{ lat: number; lng: number } | null",
55
+ descriptionKey: "ui.agent.mapView.state.center",
56
+ description: "Live map centre in lat/lng, or null until the map has loaded (consent not granted, or Google Maps still loading). The read-back for `pan_to`, and the sign that the map is ready.",
57
+ read: (e) => e.getCenter()
58
+ },
59
+ zoom: {
60
+ type: "number | null",
61
+ descriptionKey: "ui.agent.mapView.state.zoom",
62
+ description: "Live zoom level, or null until the map has loaded. Google clamps zoom to the map type's range, so this is not necessarily the value last passed to `set_zoom`.",
63
+ read: (e) => e.getZoom()
64
+ },
65
+ loadError: {
66
+ type: "'script' | 'auth' | 'import' | 'timeout' | null",
67
+ descriptionKey: "ui.agent.mapView.state.loadError",
68
+ description: 'Why the interactive map could not be shown, or null while it is loading or loaded. When set, the map is gone and the page shows "The map is not available right now" with a retry button: `pan_to`, `set_zoom` and `select_marker` do nothing until `retry_load` succeeds and `center` is no longer null. `script` and `timeout` are usually network, `auth` is the host\'s key or referrer, `import` is a library or render failure.',
69
+ read: (e) => e.getLoadError()
70
+ }
71
+ },
72
+ actions: {
73
+ retry_load: {
74
+ // Reloads Google's script: no data change, the same click the visitor
75
+ // has on the Retry button.
76
+ safety: "read",
77
+ argsType: "{}",
78
+ argsSchema: { type: "object", properties: {} },
79
+ idempotent: !0,
80
+ descriptionKey: "ui.agent.mapView.actions.retryLoad",
81
+ description: "Try loading the interactive map again after a failure. Read `loadError` first: it is the only time this does anything. Read `loadError` and `center` back afterwards; a retry that fails again sets `loadError` once more. A retry after `auth` only repeats the same rejected request until the host fixes its key.",
82
+ errors: [
83
+ "Silent no-op while `loadError` is null (nothing failed, or consent has not been granted).",
84
+ "A hung request cannot be cancelled: after `timeout` the retry waits for the same request to finish."
85
+ ],
86
+ invoke: (e) => {
87
+ e.retryLoad();
88
+ }
89
+ },
90
+ pan_to: {
91
+ // Ephemeral viewport move, no data loss → read.
92
+ safety: "read",
93
+ argsType: "{ position: { lat: number; lng: number } }",
94
+ argsSchema: {
95
+ type: "object",
96
+ properties: {
97
+ position: {
98
+ type: "object",
99
+ properties: {
100
+ lat: { type: "number", description: "Latitude in degrees." },
101
+ lng: { type: "number", description: "Longitude in degrees." }
102
+ },
103
+ required: ["lat", "lng"]
104
+ }
105
+ },
106
+ required: ["position"]
107
+ },
108
+ idempotent: !0,
109
+ descriptionKey: "ui.agent.mapView.actions.panTo",
110
+ description: "Pan the map to a new centre without changing zoom. Read the `center` slot back to confirm — Google animates the pan, so the applied centre settles after the call.",
111
+ errors: [
112
+ "Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading)."
113
+ ],
114
+ invoke: (e, t) => {
115
+ e.panTo(t.position);
116
+ }
117
+ },
118
+ set_zoom: {
119
+ // Ephemeral viewport zoom, no data loss → read.
120
+ safety: "read",
121
+ argsType: "{ zoom: number }",
122
+ argsSchema: {
123
+ type: "object",
124
+ properties: {
125
+ zoom: {
126
+ type: "number",
127
+ description: "Zoom level, typical range 1–20."
128
+ }
129
+ },
130
+ required: ["zoom"]
131
+ },
132
+ idempotent: !0,
133
+ descriptionKey: "ui.agent.mapView.actions.setZoom",
134
+ description: "Set the map zoom level (typical range 1–20). Read the `zoom` slot back — Google clamps the request to the map type’s supported range, so requested and applied can differ.",
135
+ errors: [
136
+ "Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading).",
137
+ "Requested zoom is clamped to the map type's range; `zoom` reports what was actually applied."
138
+ ],
139
+ invoke: (e, t) => {
140
+ e.setZoom(t.zoom);
141
+ }
142
+ },
143
+ select_marker: {
144
+ // Ephemeral marker focus, no data loss → read.
145
+ safety: "read",
146
+ argsType: "{ id: string | null }",
147
+ argsSchema: {
148
+ type: "object",
149
+ properties: {
150
+ id: {
151
+ type: ["string", "null"],
152
+ description: "Marker id to select, or null to clear the selection."
153
+ }
154
+ },
155
+ required: ["id"]
156
+ },
157
+ idempotent: !0,
158
+ descriptionKey: "ui.agent.mapView.actions.selectMarker",
159
+ description: "Propose a marker selection by id, or pass null to clear it. Fires the host's `onMarkerClick`; selection is controlled by the host, so read the `selectedMarkerId` slot back to see whether it accepted.",
160
+ errors: [
161
+ "Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading).",
162
+ "The host owns `selectedMarkerId` and may ignore the proposal; `selectedMarkerId` is unchanged when it does."
163
+ ],
164
+ invoke: (e, t) => {
165
+ e.selectMarker(t.id);
166
+ }
167
+ }
168
+ },
169
+ domHooks: {
170
+ root: {
171
+ attr: "data-component",
172
+ value: "map-view",
173
+ description: "Marks the element as a kit MapView."
174
+ },
175
+ instanceId: {
176
+ attr: "data-component-id",
177
+ sourceProp: "id",
178
+ description: "Sourced from the id prop."
179
+ }
180
+ }
181
+ }, ne = 32, re = 40, he = "M16 38C16 38 2 26 2 16A14 14 0 0 1 30 16C30 26 16 38 16 38Z", ut = 2, mt = 4, pt = "translate(8.25 8.25) scale(0.10473)", ft = [
182
+ {
183
+ tag: "rect",
184
+ attrs: {
185
+ x: "53.04",
186
+ y: "2.54",
187
+ width: "33.99",
188
+ height: "49.34",
189
+ rx: "4.56",
190
+ ry: "4.56",
191
+ transform: "translate(-4.66 19.05) rotate(-15)"
192
+ }
193
+ },
194
+ {
195
+ tag: "rect",
196
+ attrs: {
197
+ x: "96.12",
198
+ y: "53.04",
199
+ width: "49.34",
200
+ height: "33.99",
201
+ rx: "4.56",
202
+ ry: "4.56",
203
+ transform: "translate(-14.01 33.65) rotate(-15)"
204
+ }
205
+ },
206
+ {
207
+ tag: "path",
208
+ attrs: {
209
+ d: "M47.82,59.56c-.65-2.43-3.15-3.87-5.58-3.22L3.38,66.75c-2.43.65-3.87,3.15-3.22,5.58l6.44,24.03c.65,2.43,3.15,3.87,5.58,3.22l38.86-10.41c2.43-.65,3.87-3.15,3.22-5.58l-6.44-24.03Z"
210
+ }
211
+ },
212
+ {
213
+ tag: "rect",
214
+ attrs: {
215
+ x: "60.97",
216
+ y: "96.12",
217
+ width: "33.99",
218
+ height: "49.34",
219
+ rx: "4.56",
220
+ ry: "4.56",
221
+ transform: "translate(-28.61 24.29) rotate(-15)"
222
+ }
223
+ }
224
+ ], Jt = (e) => Object.entries(e).map(([t, n]) => `${t}="${n}"`).join(" ");
225
+ function Yt(e, t, n, s = {
226
+ width: ne,
227
+ height: re
228
+ }) {
229
+ const r = ft.map(
230
+ ({ tag: o, attrs: a }) => `<${o} ${Jt(a)}/>`
231
+ ).join("");
232
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${s.width}" height="${s.height}" viewBox="0 0 ${ne} ${re}"><path d="${he}" fill="none" stroke="${n}" stroke-width="${mt}" stroke-linejoin="round"/><path d="${he}" fill="${e}" stroke="${t}" stroke-width="${ut}" stroke-linejoin="round"/><g fill="${t}" transform="${pt}">${r}</g></svg>`;
233
+ }
234
+ const ht = 1.4, Qt = [
235
+ "ds:[gmp-advanced-marker:focus-visible_&]:outline-[length:var(--focus-ring-width)]",
236
+ "ds:[gmp-advanced-marker:focus-visible_&]:outline-solid",
237
+ "ds:[gmp-advanced-marker:focus-visible_&]:outline-[color:var(--map-marker-hover-color)]",
238
+ "ds:[gmp-advanced-marker:focus-visible_&]:outline-offset-[length:var(--focus-ring-offset)]",
239
+ "ds:[gmp-advanced-marker:focus-visible_&]:forced-colors:outline-[CanvasText]"
240
+ ].join(" ");
241
+ function en({ hovered: e }) {
242
+ const t = e ? ht : 1, n = e ? "ds:fill-[var(--map-marker-selected-color)]" : "ds:fill-[var(--map-marker-color)]";
243
+ return /* @__PURE__ */ u(
244
+ "span",
245
+ {
246
+ "data-component": "map-view-pin",
247
+ className: "ds:flex ds:items-end ds:justify-center ds:[min-inline-size:var(--min-target-size)] ds:[min-block-size:var(--min-target-size)]",
248
+ children: /* @__PURE__ */ N(
249
+ "svg",
250
+ {
251
+ "aria-hidden": "true",
252
+ focusable: "false",
253
+ "data-map-pin": e ? "hovered" : "normal",
254
+ width: ne * t,
255
+ height: re * t,
256
+ viewBox: `0 0 ${ne} ${re}`,
257
+ className: `ds:block ds:fill-[var(--map-marker-hover-ring)] ds:forced-colors:fill-[Canvas] ${Qt}`,
258
+ children: [
259
+ /* @__PURE__ */ u(
260
+ "path",
261
+ {
262
+ d: he,
263
+ fill: "none",
264
+ strokeWidth: mt,
265
+ strokeLinejoin: "round",
266
+ className: "ds:stroke-[color:var(--map-marker-hover-color)] ds:forced-colors:stroke-[ButtonText]"
267
+ }
268
+ ),
269
+ /* @__PURE__ */ u(
270
+ "path",
271
+ {
272
+ d: he,
273
+ strokeWidth: ut,
274
+ strokeLinejoin: "round",
275
+ className: `${n} ds:stroke-[color:var(--map-marker-hover-ring)] ds:forced-colors:fill-[ButtonText] ds:forced-colors:stroke-[Canvas]`
276
+ }
277
+ ),
278
+ /* @__PURE__ */ u("g", { transform: pt, children: ft.map(
279
+ ({ tag: s, attrs: r }, o) => s === "path" ? /* @__PURE__ */ u("path", { d: r.d }, o) : /* @__PURE__ */ u(
280
+ "rect",
281
+ {
282
+ x: r.x,
283
+ y: r.y,
284
+ width: r.width,
285
+ height: r.height,
286
+ rx: r.rx,
287
+ ry: r.ry,
288
+ transform: r.transform
289
+ },
290
+ o
291
+ )
292
+ ) })
293
+ ]
294
+ }
295
+ )
296
+ }
297
+ );
298
+ }
299
+ const tn = 30, nn = 56, Se = 17, rn = 256, on = (e) => e * Math.PI / 180;
300
+ function sn(e, t, n) {
301
+ const s = rn * 2 ** n, r = Math.min(Math.max(Math.sin(on(e)), -0.9999), 0.9999), o = Math.log((1 + r) / (1 - r)) / 2;
302
+ return {
303
+ x: (t + 180) / 360 * s,
304
+ y: (0.5 - o / (2 * Math.PI)) * s
305
+ };
306
+ }
307
+ function an(e, t) {
308
+ return e === "auto" ? t > tn : e && t > 1;
309
+ }
310
+ function cn(e, t, n = nn) {
311
+ if (t >= Se || e.length < 2)
312
+ return { singles: [...e], clusters: [] };
313
+ const s = e.map((i) => ({
314
+ marker: i,
315
+ ...sn(i.position.lat, i.position.lng, t)
316
+ })).sort(
317
+ (i, l) => i.x - l.x || i.y - l.y || (i.marker.id < l.marker.id ? -1 : 1)
318
+ ), r = [], o = /* @__PURE__ */ new Map(), a = (i) => Math.floor(i / n), m = n * n;
319
+ for (const i of s) {
320
+ const l = a(i.x), h = a(i.y);
321
+ let v = null, c = m;
322
+ for (let g = -1; g <= 1; g += 1)
323
+ for (let b = -1; b <= 1; b += 1)
324
+ for (const y of o.get(`${l + g}:${h + b}`) ?? []) {
325
+ const E = (y.x - i.x) ** 2 + (y.y - i.y) ** 2;
326
+ E <= c && (v = y, c = E);
327
+ }
328
+ if (v) {
329
+ const g = v.members.length, b = `${a(v.x)}:${a(v.y)}`;
330
+ v.x = (v.x * g + i.x) / (g + 1), v.y = (v.y * g + i.y) / (g + 1), v.lat = (v.lat * g + i.marker.position.lat) / (g + 1), v.lng = (v.lng * g + i.marker.position.lng) / (g + 1), v.members.push(i.marker);
331
+ const y = `${a(v.x)}:${a(v.y)}`;
332
+ if (b !== y) {
333
+ const E = o.get(b);
334
+ E && E.splice(E.indexOf(v), 1);
335
+ const C = o.get(y);
336
+ C ? C.push(v) : o.set(y, [v]);
337
+ }
338
+ } else {
339
+ const g = {
340
+ x: i.x,
341
+ y: i.y,
342
+ members: [i.marker],
343
+ lat: i.marker.position.lat,
344
+ lng: i.marker.position.lng
345
+ };
346
+ r.push(g);
347
+ const b = `${l}:${h}`, y = o.get(b);
348
+ y ? y.push(g) : o.set(b, [g]);
349
+ }
350
+ }
351
+ const f = [], d = [];
352
+ for (const i of r)
353
+ i.members.length === 1 ? f.push(i.members[0]) : d.push({
354
+ id: i.members[0].id,
355
+ position: { lat: i.lat, lng: i.lng },
356
+ members: i.members
357
+ });
358
+ return { singles: f, clusters: d };
359
+ }
360
+ function Je(e) {
361
+ if (!(e instanceof Element)) return !1;
362
+ try {
363
+ return e.matches(":focus-visible");
364
+ } catch {
365
+ return !0;
366
+ }
367
+ }
368
+ const ln = 0.08;
369
+ function dn(e, t) {
370
+ let n = 0;
371
+ for (let s = 1; s < e.length; s += 1)
372
+ Math.abs(e[s] - t) < Math.abs(e[n] - t) && (n = s);
373
+ return n;
374
+ }
375
+ function un(e, t) {
376
+ const [n, s] = L(null), r = (e ?? []).map((o) => `${o.width}x${o.height}`).join();
377
+ return oe(() => {
378
+ const o = t.current, a = r ? r.split(",").map((d) => {
379
+ const [i, l] = d.split("x").map(Number);
380
+ return Math.log(i / l);
381
+ }) : [];
382
+ if (!o || a.length === 0 || a.some((d) => !isFinite(d))) {
383
+ s(null);
384
+ return;
385
+ }
386
+ s(null);
387
+ const m = (d) => {
388
+ const { width: i, height: l } = o.getBoundingClientRect();
389
+ if (!(i > 0 && l > 0)) {
390
+ d && s(null);
391
+ return;
392
+ }
393
+ const h = Math.log(i / l), v = dn(a, h);
394
+ s((c) => c === null || c >= a.length || Math.abs(a[c] - h) - Math.abs(a[v] - h) > ln ? v : c);
395
+ };
396
+ if (m(!0), typeof ResizeObserver > "u") return;
397
+ const f = new ResizeObserver(() => m(!1));
398
+ return f.observe(o), () => f.disconnect();
399
+ }, [t, r]), n;
400
+ }
401
+ const mn = 1e4, Le = /* @__PURE__ */ new Set();
402
+ function Ye(e, t) {
403
+ var n;
404
+ if (e !== "timeout") {
405
+ for (const s of Le) if (s !== t) return;
406
+ try {
407
+ (n = Wt) == null || n();
408
+ } catch {
409
+ }
410
+ }
411
+ }
412
+ const pn = se(
413
+ [
414
+ "ds:relative ds:overflow-hidden ds:block",
415
+ "ds:bg-[var(--muted)]",
416
+ // Focus lands on the region when the interactive map replaces its button.
417
+ "ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
418
+ ].join(" "),
419
+ {
420
+ variants: {
421
+ size: {
422
+ sm: "ds:[--map-block-size:14rem]",
423
+ md: "ds:[--map-block-size:20rem]",
424
+ lg: "ds:[--map-block-size:28rem]",
425
+ // `fill` defers sizing to the parent. The outer takes
426
+ // `block-size: 100%` so the inner (also 100%) has something
427
+ // to inherit from. Use inside a viewport-locked column —
428
+ // `<PracticeResults variant="map-first">` wires this through
429
+ // automatically; standalone consumers must give the parent
430
+ // a constrained block-size or the map collapses to 0.
431
+ fill: "ds:[block-size:100%]"
432
+ },
433
+ surface: {
434
+ bordered: "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
435
+ elevated: "ds:rounded-[var(--radius-md)] ds:shadow-[var(--shadow-card)] ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)]",
436
+ bare: "ds:rounded-none ds:border-0"
437
+ }
438
+ },
439
+ defaultVariants: { size: "md", surface: "bordered" }
440
+ }
441
+ ), fn = se("ds:block ds:w-full", {
442
+ variants: {
443
+ size: {
444
+ sm: "ds:[block-size:var(--map-block-size)]",
445
+ md: "ds:[block-size:var(--map-block-size)]",
446
+ lg: "ds:[block-size:var(--map-block-size)]",
447
+ fill: "ds:[block-size:100%]"
448
+ }
449
+ },
450
+ defaultVariants: { size: "md" }
451
+ }), gt = se(
452
+ [
453
+ "ds:absolute ds:inset-0",
454
+ "ds:flex ds:flex-col ds:items-center ds:justify-center",
455
+ "ds:gap-[var(--spacing-sm)]",
456
+ "ds:p-[var(--spacing-md)]",
457
+ "ds:bg-[var(--muted)] ds:text-[var(--foreground)]",
458
+ "ds:text-center"
459
+ ].join(" ")
460
+ ), vt = se("type-heading-3 ds:m-0"), Ne = se(
461
+ "type-body-sm ds:text-[var(--muted-foreground)] ds:[max-inline-size:28rem] ds:m-0"
462
+ );
463
+ function hn({
464
+ onHandleReady: e,
465
+ onMarkerSelect: t,
466
+ onCameraMove: n
467
+ }) {
468
+ const s = X();
469
+ return x(() => {
470
+ if (s)
471
+ return e({
472
+ panTo: (r) => {
473
+ n(), s.panTo(r);
474
+ },
475
+ setZoom: (r) => {
476
+ n(), s.setZoom(r);
477
+ },
478
+ jumpTo: (r, o) => {
479
+ n(), s.moveCamera({ center: r, zoom: o });
480
+ },
481
+ selectMarker: (r) => t(r),
482
+ // Read straight off the live map: Google clamps `setZoom` to the
483
+ // map type's range and animates `panTo`, so requested and applied
484
+ // are not the same value.
485
+ getCenter: () => {
486
+ var r;
487
+ return ((r = s.getCenter()) == null ? void 0 : r.toJSON()) ?? null;
488
+ },
489
+ getZoom: () => s.getZoom() ?? null
490
+ }), () => e(null);
491
+ }, [s, e, t, n]), null;
492
+ }
493
+ function gn({
494
+ onBoundsChange: e,
495
+ userInteraction: t
496
+ }) {
497
+ const n = X(), s = k(e);
498
+ return s.current = e, x(() => {
499
+ if (!n) return;
500
+ const r = n.getDiv();
501
+ let o = null;
502
+ const a = () => {
503
+ t.current = {
504
+ pendingInput: !1,
505
+ moved: !1,
506
+ programmatic: !1
507
+ };
508
+ };
509
+ a();
510
+ let m;
511
+ const f = /* @__PURE__ */ new Set(), d = (c) => {
512
+ if (c instanceof PointerEvent && c.pointerType === "touch" && (c.type === "pointerdown" && f.add(c.pointerId), c.type === "pointerup" || c.type === "pointercancel")) {
513
+ f.delete(c.pointerId);
514
+ return;
515
+ }
516
+ if (c instanceof PointerEvent && c.type === "pointermove" && c.buttons === 0 && c.pointerType !== "touch" || c instanceof KeyboardEvent && ![
517
+ "ArrowUp",
518
+ "ArrowDown",
519
+ "ArrowLeft",
520
+ "ArrowRight",
521
+ "+",
522
+ "=",
523
+ "-",
524
+ "_",
525
+ "Enter",
526
+ " ",
527
+ "PageUp",
528
+ "PageDown"
529
+ ].includes(c.key))
530
+ return;
531
+ const g = document.fullscreenElement, b = !!(g && (g.contains(r) || r.contains(g)));
532
+ let y = c.type === "dblclick";
533
+ c instanceof PointerEvent && c.type === "pointermove" && (y = c.pointerType !== "touch" || f.size >= 2 || b), c.type === "touchmove" && (y = c.touches.length >= 2 || b), c instanceof KeyboardEvent && (y = c.key !== "Enter" && c.key !== " "), c instanceof WheelEvent && (y = c.ctrlKey || c.metaKey || b), c.type === "click" && (y = c.target instanceof Element && c.target.closest('button, [role="button"]') != null), y && (t.current.programmatic = !1), t.current.pendingInput = !0, clearTimeout(m), m = setTimeout(() => {
534
+ t.current.pendingInput = !1;
535
+ }, 250);
536
+ }, i = () => {
537
+ t.current.pendingInput && !t.current.programmatic && (t.current.moved = !0);
538
+ }, l = () => {
539
+ var R, D;
540
+ const c = (R = n.getBounds()) == null ? void 0 : R.toJSON(), g = (D = n.getCenter()) == null ? void 0 : D.toJSON(), b = n.getZoom(), y = t.current.moved;
541
+ if (a(), clearTimeout(m), !c || !g || b == null) return;
542
+ const E = !o || Object.keys(c).some(
543
+ (J) => c[J] !== o.bounds[J]
544
+ ), C = o != null && (b !== o.zoom || g.lat !== o.center.lat || g.lng !== o.center.lng);
545
+ o = { bounds: c, center: g, zoom: b }, E && s.current(c, { userInteraction: y && C });
546
+ }, h = [
547
+ "pointerdown",
548
+ "pointermove",
549
+ "pointerup",
550
+ "pointercancel",
551
+ "touchstart",
552
+ "touchmove",
553
+ "click",
554
+ "dblclick",
555
+ "wheel",
556
+ "keydown"
557
+ ];
558
+ h.forEach(
559
+ (c) => r.addEventListener(c, d, { capture: !0, passive: !0 })
560
+ );
561
+ const v = [
562
+ n.addListener("dragstart", () => {
563
+ t.current.programmatic = !1, t.current.moved = !0;
564
+ }),
565
+ n.addListener("center_changed", i),
566
+ n.addListener("zoom_changed", i),
567
+ n.addListener("idle", l)
568
+ ];
569
+ return l(), () => {
570
+ v.forEach((c) => c.remove()), h.forEach(
571
+ (c) => r.removeEventListener(c, d, !0)
572
+ ), clearTimeout(m), a();
573
+ };
574
+ }, [n, t]), null;
575
+ }
576
+ function vn(e, t) {
577
+ const n = X(), [s, r] = L(null), { lat: o, lng: a } = t;
578
+ return x(() => {
579
+ if (!n || typeof n.getCenter != "function") return;
580
+ const m = () => {
581
+ var g, b;
582
+ const d = (g = n.getCenter()) == null ? void 0 : g.toJSON(), i = n.getZoom(), l = (b = n.getDiv) == null ? void 0 : b.call(n);
583
+ if (!d || i == null || !l) {
584
+ r(null);
585
+ return;
586
+ }
587
+ const h = l.clientWidth, v = l.clientHeight, c = bt * 2 ** i;
588
+ r({
589
+ id: e,
590
+ width: h,
591
+ height: v,
592
+ x: h / 2 + (a - d.lng) / 360 * c,
593
+ y: v / 2 - (ge(o) - ge(d.lat)) * c / (2 * Math.PI)
594
+ });
595
+ };
596
+ m();
597
+ const f = ["bounds_changed", "zoom_changed", "center_changed", "idle"].flatMap(
598
+ (d) => typeof n.addListener == "function" ? [n.addListener(d, m)] : []
599
+ );
600
+ return () => f.forEach((d) => d.remove());
601
+ }, [n, e, o, a]), (s == null ? void 0 : s.id) === e ? s : null;
602
+ }
603
+ function bn({
604
+ marker: e,
605
+ frame: t,
606
+ direction: n,
607
+ children: s
608
+ }) {
609
+ const r = vn(e.id, e.position);
610
+ return !r || !t ? null : ot(
611
+ /* @__PURE__ */ u(kn, { anchor: r, direction: n, children: s }),
612
+ t
613
+ );
614
+ }
615
+ const yn = 52, wn = 12, pe = 8;
616
+ function kn({
617
+ anchor: e,
618
+ children: t,
619
+ direction: n
620
+ }) {
621
+ const s = k(null), [r, o] = L(
622
+ null
623
+ );
624
+ if (oe(() => {
625
+ const c = s.current;
626
+ c && o(
627
+ (g) => (g == null ? void 0 : g.width) === c.offsetWidth && g.height === c.offsetHeight ? g : { width: c.offsetWidth, height: c.offsetHeight }
628
+ );
629
+ }, [t, e.id]), !(e.x >= 0 && e.x <= e.width && e.y >= 0 && e.y <= e.height)) return null;
630
+ const m = (r == null ? void 0 : r.width) ?? 0, f = (r == null ? void 0 : r.height) ?? 0, d = Math.max(pe, e.width - m - pe), i = Math.min(Math.max(e.x - m / 2, pe), d), l = e.y - yn - f, h = l < pe, v = h ? e.y + wn : l;
631
+ return (
632
+ // The layer is `ltr` because the map is geographic: x is always measured
633
+ // from the physical left. The card inside takes the page direction.
634
+ /* @__PURE__ */ u(
635
+ "div",
636
+ {
637
+ dir: "ltr",
638
+ "aria-hidden": "true",
639
+ "data-component": "map-view-marker-card-layer",
640
+ className: "ds:pointer-events-none ds:absolute ds:inset-0 ds:overflow-hidden",
641
+ children: /* @__PURE__ */ u(
642
+ "div",
643
+ {
644
+ ref: s,
645
+ "data-component": "map-view-marker-card",
646
+ "data-marker-id": e.id,
647
+ "data-placement": h ? "below" : "above",
648
+ style: {
649
+ "--marker-card-x": `${i}px`,
650
+ "--marker-card-y": `${v}px`
651
+ },
652
+ "data-measured": r ? "true" : "false",
653
+ className: "ds:absolute ds:[inset-inline-start:var(--marker-card-x)] ds:[inset-block-start:var(--marker-card-y)] ds:[inline-size:max-content] ds:[max-inline-size:calc(100%-var(--spacing-md))] ds:data-[measured=false]:invisible",
654
+ children: /* @__PURE__ */ u("div", { dir: n, children: t })
655
+ }
656
+ )
657
+ }
658
+ )
659
+ );
660
+ }
661
+ function fe(e) {
662
+ if (!e) return null;
663
+ if (e instanceof HTMLElement) return e;
664
+ const t = e.element;
665
+ return t instanceof HTMLElement ? t : null;
666
+ }
667
+ function xn({
668
+ marker: e,
669
+ label: t,
670
+ isSelected: n,
671
+ isHovered: s,
672
+ onSelect: r,
673
+ onHover: o,
674
+ elements: a
675
+ }) {
676
+ const [m, f] = L(null), { id: d } = e, i = k(!1);
677
+ return x(() => {
678
+ const l = fe(m);
679
+ if (l && (l.style.outline = "none"), !l || !a) return;
680
+ const h = a.current;
681
+ return h.set(`pin:${e.id}`, l), () => {
682
+ h.delete(`pin:${e.id}`);
683
+ };
684
+ }, [m, a, e.id]), x(() => {
685
+ const l = fe(m);
686
+ if (!l || !o) return;
687
+ const h = (g) => {
688
+ Je(g.target) && o(d, !0, "focus");
689
+ }, v = (g) => {
690
+ l.contains(g.relatedTarget) || i.current || o(d, !1, "focus");
691
+ }, c = (g) => {
692
+ g.key === "Escape" && o(d, !1, "focus");
693
+ };
694
+ return l.addEventListener("focusin", h), l.addEventListener("focusout", v), l.addEventListener("keydown", c), () => {
695
+ l.removeEventListener("focusin", h), l.removeEventListener("focusout", v), l.removeEventListener("keydown", c);
696
+ };
697
+ }, [m, d, o]), /* @__PURE__ */ u(
698
+ at,
699
+ {
700
+ ref: f,
701
+ position: e.position,
702
+ title: t,
703
+ "aria-label": t,
704
+ "data-selected": n ? "true" : "false",
705
+ "data-hovered": s ? "true" : "false",
706
+ zIndex: s ? 1e3 : n ? 500 : void 0,
707
+ onClick: () => r(d),
708
+ onMouseEnter: o ? () => {
709
+ i.current = !0, o(d, !0, "pointer");
710
+ } : void 0,
711
+ onMouseLeave: o ? () => {
712
+ i.current = !1;
713
+ const l = fe(m), h = document.activeElement;
714
+ l && h && l.contains(h) && Je(h) || o(d, !1, "pointer");
715
+ } : void 0,
716
+ children: /* @__PURE__ */ u(en, { hovered: s })
717
+ }
718
+ );
719
+ }
720
+ const bt = 256, Mn = (e) => e * Math.PI / 180;
721
+ function ge(e) {
722
+ const t = Math.min(Math.max(Math.sin(Mn(e)), -0.9999), 0.9999);
723
+ return Math.log((1 + t) / (1 - t)) / 2;
724
+ }
725
+ const En = (e) => Math.atan(Math.sinh(e)) * 180 / Math.PI;
726
+ function _n(e) {
727
+ let t = -90, n = 90, s = -180, r = 180;
728
+ for (const { lat: o, lng: a } of e)
729
+ t = Math.max(t, o), n = Math.min(n, o), s = Math.max(s, a), r = Math.min(r, a);
730
+ return { north: t, south: n, east: s, west: r };
731
+ }
732
+ function yt(e, t, n, s, r) {
733
+ const { north: o, south: a, east: m, west: f } = _n(e);
734
+ if (o === a && m === f)
735
+ return { center: { lat: o, lng: m }, zoom: r };
736
+ const d = ge(o), i = ge(a), l = {
737
+ lat: En((d + i) / 2),
738
+ lng: (m + f) / 2
739
+ }, h = (c, g) => g > 0 ? Math.log2(Math.max(c, 1) / bt / g) : r, v = Math.min(
740
+ h(t - 2 * s, (m - f) / 360),
741
+ h(n - 2 * s, (d - i) / (2 * Math.PI)),
742
+ r
743
+ );
744
+ return { center: l, zoom: Math.max(0, Math.floor(v)) };
745
+ }
746
+ const wt = ({ id: e, lat: t, lng: n }) => e != null ? `id:${e}` : `at:${t},${n}`;
747
+ function zn({
748
+ points: e,
749
+ fitKey: t,
750
+ maxZoom: n,
751
+ onCameraMove: s
752
+ }) {
753
+ const r = X(), o = k(null), a = k(!1), m = k(null);
754
+ return x(() => {
755
+ if (!r) return;
756
+ const f = () => {
757
+ var c;
758
+ const i = m.current, l = (c = r.getCenter()) == null ? void 0 : c.toJSON(), h = r.getZoom();
759
+ i != null && h === i.zoom && l != null && Math.abs(l.lat - i.center.lat) < 1e-6 && Math.abs(l.lng - i.center.lng) < 1e-6 || (a.current = !0);
760
+ }, d = [
761
+ r.addListener("dragstart", () => {
762
+ a.current = !0;
763
+ }),
764
+ r.addListener("center_changed", f),
765
+ r.addListener("zoom_changed", f)
766
+ ];
767
+ return () => d.forEach((i) => i.remove());
768
+ }, [r]), x(() => {
769
+ var b;
770
+ if (!r) return;
771
+ const f = ((b = o.current) == null ? void 0 : b.map) === r ? o.current : null;
772
+ if ((f == null ? void 0 : f.key) === t) return;
773
+ const d = new Set(e.map(wt)), i = (y, E) => {
774
+ m.current = { center: y, zoom: E }, s(), r.moveCamera({ center: y, zoom: E }), a.current = !1;
775
+ };
776
+ if (e.length === 0) {
777
+ o.current = { map: r, key: t, points: d };
778
+ return;
779
+ }
780
+ if (f != null && f.points.size > 0 && [...f.points].every((y) => d.has(y)) && a.current) {
781
+ o.current = { map: r, key: t, points: d };
782
+ return;
783
+ }
784
+ const h = r.getDiv();
785
+ if (!(h instanceof Element)) return;
786
+ const v = () => {
787
+ o.current = { map: r, key: t, points: d };
788
+ const y = Math.min(
789
+ Te("--spacing-2xl", h, 48),
790
+ h.clientWidth / 4,
791
+ h.clientHeight / 4
792
+ ), { center: E, zoom: C } = yt(
793
+ e,
794
+ h.clientWidth,
795
+ h.clientHeight,
796
+ y,
797
+ n
798
+ );
799
+ i(E, C);
800
+ }, c = () => h.clientWidth > 0 && h.clientHeight > 0;
801
+ if (c() || typeof ResizeObserver > "u") {
802
+ v();
803
+ return;
804
+ }
805
+ const g = new ResizeObserver(() => {
806
+ c() && (g.disconnect(), v());
807
+ });
808
+ return g.observe(h), () => g.disconnect();
809
+ }, [r, t, e, n, s]), null;
810
+ }
811
+ const Qe = 10;
812
+ function Sn(e) {
813
+ const t = X(), [n, s] = L(e);
814
+ return x(() => {
815
+ if (!t || typeof t.addListener != "function" || typeof t.getZoom != "function")
816
+ return;
817
+ const r = () => {
818
+ const a = t.getZoom();
819
+ a != null && s(Math.round(a * 4) / 4);
820
+ };
821
+ r();
822
+ const o = ["zoom_changed", "idle"].map(
823
+ (a) => t.addListener(a, r)
824
+ );
825
+ return () => o.forEach((a) => a.remove());
826
+ }, [t]), n;
827
+ }
828
+ const Ln = [
829
+ "ds:inline-flex ds:items-center ds:justify-center",
830
+ // 44 px, 48 px in the accessible themes, with room for a long count.
831
+ "ds:[min-inline-size:var(--min-target-size)] ds:[min-block-size:var(--min-target-size)]",
832
+ "ds:px-[var(--spacing-xs)] ds:rounded-full",
833
+ "ds:border-2 ds:border-solid ds:border-[color:var(--map-marker-hover-ring)]",
834
+ // The theme-stable map marker colour, as the pins (see KitAdvancedMarker).
835
+ "ds:bg-[var(--map-marker-color)] ds:text-[var(--map-marker-hover-ring)]",
836
+ // A 1 px ink edge outside the white ring: the ring separates the marker on
837
+ // dark tiles, the edge carries 3:1 on light ones (WCAG 1.4.11).
838
+ "ds:shadow-[0_0_0_1px_var(--map-marker-hover-color),var(--shadow-md)] ds:tabular-nums ds:select-none type-label",
839
+ "ds:forced-colors:border-[ButtonText]",
840
+ // Google's marker element takes the focus; the ring is drawn on the badge,
841
+ // and the element's own outline is removed (see KitClusterMarker). The ring
842
+ // is the theme-stable deep ink, not `--ring`, which is light in the dark
843
+ // themes: the tiles do not follow the kit theme. `--focus-ring-width` is
844
+ // thicker in the accessible themes.
845
+ "ds:[gmp-advanced-marker:focus-visible_&]:outline-[length:var(--focus-ring-width)] ds:[gmp-advanced-marker:focus-visible_&]:outline-solid ds:[gmp-advanced-marker:focus-visible_&]:outline-[color:var(--map-marker-hover-color)] ds:[gmp-advanced-marker:focus-visible_&]:outline-offset-[length:var(--focus-ring-offset)]",
846
+ "ds:[gmp-advanced-marker:focus-visible_&]:forced-colors:outline-[CanvasText]"
847
+ ].join(" ");
848
+ function Nn({ count: e }) {
849
+ return /* @__PURE__ */ u(
850
+ "span",
851
+ {
852
+ "aria-hidden": "true",
853
+ "data-component": "map-view-cluster",
854
+ "data-count": e,
855
+ className: Ln,
856
+ children: e
857
+ }
858
+ );
859
+ }
860
+ function te(e, t) {
861
+ const n = document.createElement("span");
862
+ n.style.color = `var(${e})`, n.style.display = "none", (t.isConnected ? t : document.documentElement).append(n);
863
+ const s = getComputedStyle(n).color;
864
+ return n.remove(), s || "currentColor";
865
+ }
866
+ function $n(e) {
867
+ const t = X(), [n, s] = L(null);
868
+ return x(() => {
869
+ var i;
870
+ if (!e || !t) return;
871
+ const r = (i = t.getDiv) == null ? void 0 : i.call(t), o = r instanceof Element ? r : document.documentElement, a = () => {
872
+ const l = {
873
+ fill: te("--map-marker-color", o),
874
+ ink: te("--map-marker-hover-ring", o),
875
+ ring: te("--map-marker-hover-ring", o),
876
+ hover: te("--map-marker-hover-color", o),
877
+ selected: te("--map-marker-selected-color", o),
878
+ target: Te("--min-target-size", o, 44)
879
+ };
880
+ s(
881
+ (h) => h && h.fill === l.fill && h.ink === l.ink && h.ring === l.ring && h.hover === l.hover && h.selected === l.selected && h.target === l.target ? h : l
882
+ );
883
+ };
884
+ a();
885
+ const m = new MutationObserver(a), f = {
886
+ attributes: !0,
887
+ attributeFilter: ["class", "data-theme"]
888
+ };
889
+ m.observe(document.documentElement, f);
890
+ const d = o.closest('[data-component="theme-root"]');
891
+ return d && m.observe(d, f), () => m.disconnect();
892
+ }, [t, e]), n;
893
+ }
894
+ function Tn(e, { fill: t, ink: n, ring: s, hover: r, target: o }) {
895
+ var l;
896
+ const a = Math.max(o, 20 + String(e).length * 12), m = `x="2" y="2" width="${a - 4}" height="${o - 4}" rx="${o / 2}"`, f = `<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${o}"><rect ${m} fill="none" stroke="${r}" stroke-width="4"/><rect ${m} fill="${t}" stroke="${s}" stroke-width="2"/></svg>`, d = (l = globalThis.google) == null ? void 0 : l.maps;
897
+ return {
898
+ icon: {
899
+ url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(f)}`,
900
+ scaledSize: d ? new d.Size(a, o) : void 0,
901
+ anchor: d ? new d.Point(a / 2, o / 2) : void 0
902
+ },
903
+ label: { text: String(e), color: n, fontWeight: "600" }
904
+ };
905
+ }
906
+ const Ie = Gt(null);
907
+ function In({
908
+ enabled: e,
909
+ children: t
910
+ }) {
911
+ const n = $n(e);
912
+ return /* @__PURE__ */ u(Ie.Provider, { value: n, children: t });
913
+ }
914
+ function Cn({ fill: e, ring: t, hover: n, selected: s }, r) {
915
+ var i;
916
+ const o = r ? ht : 1, a = ne * o, m = re * o, f = Yt(r ? s : e, t, n, {
917
+ width: a,
918
+ height: m
919
+ }), d = (i = globalThis.google) == null ? void 0 : i.maps;
920
+ return {
921
+ url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(f)}`,
922
+ scaledSize: d ? new d.Size(a, m) : void 0,
923
+ anchor: d ? new d.Point(a / 2, m) : void 0
924
+ };
925
+ }
926
+ function Rn({
927
+ marker: e,
928
+ label: t,
929
+ isSelected: n,
930
+ isHovered: s,
931
+ onSelect: r,
932
+ onHover: o
933
+ }) {
934
+ const a = rt(Ie), m = G(
935
+ () => a ? Cn(a, s) : void 0,
936
+ [a, s]
937
+ );
938
+ return m ? /* @__PURE__ */ u(
939
+ it,
940
+ {
941
+ position: e.position,
942
+ title: t,
943
+ icon: m,
944
+ zIndex: s ? 1e3 : n ? 500 : void 0,
945
+ onClick: () => r(e.id),
946
+ onMouseOver: o ? () => o(e.id, !0, "pointer") : void 0,
947
+ onMouseOut: o ? () => o(e.id, !1, "pointer") : void 0
948
+ }
949
+ ) : null;
950
+ }
951
+ function An({
952
+ cluster: e,
953
+ label: t,
954
+ mapId: n,
955
+ iconTheme: s,
956
+ elements: r,
957
+ onActivate: o
958
+ }) {
959
+ const [a, m] = L(null), f = `cluster:${e.id}`;
960
+ x(() => {
961
+ const l = fe(a);
962
+ if (!l) return;
963
+ const h = r.current;
964
+ return h.set(f, l), l.style.outline = "none", () => {
965
+ h.delete(f);
966
+ };
967
+ }, [a, r, f]);
968
+ const d = e.members.length, i = G(
969
+ () => n || !s ? null : Tn(d, s),
970
+ [n, d, s]
971
+ );
972
+ return n ? /* @__PURE__ */ u(
973
+ at,
974
+ {
975
+ ref: m,
976
+ position: e.position,
977
+ title: t,
978
+ "aria-label": t,
979
+ zIndex: Qe,
980
+ anchorPoint: ["50%", "50%"],
981
+ onClick: () => o(e),
982
+ children: /* @__PURE__ */ u(Nn, { count: d })
983
+ }
984
+ ) : /* @__PURE__ */ u(
985
+ it,
986
+ {
987
+ position: e.position,
988
+ title: t,
989
+ zIndex: Qe,
990
+ icon: i == null ? void 0 : i.icon,
991
+ label: i == null ? void 0 : i.label,
992
+ onClick: () => o(e)
993
+ }
994
+ );
995
+ }
996
+ const Pn = 100, Vn = 30;
997
+ function On({
998
+ markers: e,
999
+ fallbackZoom: t,
1000
+ selectedMarkerId: n,
1001
+ hoveredMarkerId: s,
1002
+ renderMarker: r,
1003
+ mapId: o,
1004
+ frame: a,
1005
+ elements: m,
1006
+ labelFor: f,
1007
+ onCameraMove: d,
1008
+ onClusterClick: i
1009
+ }) {
1010
+ const l = X(), { t: h } = H("ui"), v = Sn(t), c = rt(Ie), g = G(
1011
+ () => cn(e, v),
1012
+ [e, v]
1013
+ ), { singles: b, clusters: y } = G(() => {
1014
+ const M = ($) => $.id === n || $.id === s, _ = g.singles.slice(), O = [];
1015
+ for (const $ of g.clusters) {
1016
+ const F = $.members.filter((z) => !M(z));
1017
+ _.push(...$.members.filter(M)), F.length > 1 ? O.push({ ...$, members: F }) : _.push(...F);
1018
+ }
1019
+ return { singles: _, clusters: O };
1020
+ }, [g, n, s]), [E, C] = L(""), R = k(null), D = k(void 0);
1021
+ x(() => () => clearTimeout(D.current), []);
1022
+ const J = (M) => {
1023
+ var S;
1024
+ const _ = (S = l == null ? void 0 : l.getDiv) == null ? void 0 : S.call(l);
1025
+ if (!l || !(_ instanceof Element)) return;
1026
+ const O = Math.min(
1027
+ Te("--spacing-2xl", _, 48),
1028
+ _.clientWidth / 4,
1029
+ _.clientHeight / 4
1030
+ ), $ = yt(
1031
+ M.members.map((j) => j.position),
1032
+ _.clientWidth,
1033
+ _.clientHeight,
1034
+ O,
1035
+ Se
1036
+ ), F = l.getZoom() ?? v, z = Math.min(
1037
+ Se,
1038
+ Math.max($.zoom, Math.ceil(F + 1))
1039
+ ), P = M.members.length;
1040
+ R.current = {
1041
+ ids: new Set(M.members.map((j) => j.id)),
1042
+ centre: M.position
1043
+ }, C(""), clearTimeout(D.current), D.current = setTimeout(
1044
+ () => C(h("mapView.clusterZoomed", { label: f(P) })),
1045
+ Pn
1046
+ ), d(), i == null || i({
1047
+ count: P,
1048
+ markerIds: M.members.map((j) => j.id)
1049
+ }), l.moveCamera({ center: $.center, zoom: z });
1050
+ };
1051
+ return x(() => {
1052
+ const M = R.current;
1053
+ if (!M) return;
1054
+ let _ = 0, O = 0;
1055
+ const $ = () => {
1056
+ let z = null;
1057
+ for (const S of y) {
1058
+ if (!S.members.some((ve) => M.ids.has(ve.id)))
1059
+ continue;
1060
+ const j = (S.position.lat - M.centre.lat) ** 2 + (S.position.lng - M.centre.lng) ** 2;
1061
+ (!z || j < z.distance) && (z = { key: `cluster:${S.id}`, distance: j });
1062
+ }
1063
+ if (z) return z.key;
1064
+ const P = b.find((S) => M.ids.has(S.id));
1065
+ return P ? `pin:${P.id}` : null;
1066
+ }, F = () => {
1067
+ const z = $(), P = z ? m.current.get(z) : null;
1068
+ if (P && (P.focus({ preventScroll: !0 }), P.contains(document.activeElement))) {
1069
+ R.current = null;
1070
+ return;
1071
+ }
1072
+ if (O += 1, O < Vn && o) {
1073
+ _ = requestAnimationFrame(F);
1074
+ return;
1075
+ }
1076
+ R.current = null;
1077
+ const S = a == null ? void 0 : a.closest('[data-component="map-view"]');
1078
+ S && (S.hasAttribute("tabindex") || S.setAttribute("tabindex", "-1"), S.focus({ preventScroll: !0 }));
1079
+ };
1080
+ return _ = requestAnimationFrame(F), () => cancelAnimationFrame(_);
1081
+ }, [y, b, m, a, o]), /* @__PURE__ */ N(Vt, { children: [
1082
+ b.map(r),
1083
+ y.map((M) => /* @__PURE__ */ u(
1084
+ An,
1085
+ {
1086
+ cluster: M,
1087
+ label: f(M.members.length),
1088
+ mapId: o,
1089
+ iconTheme: c,
1090
+ elements: m,
1091
+ onActivate: J
1092
+ },
1093
+ `${Math.floor(v)}:${M.id}`
1094
+ )),
1095
+ a ? ot(
1096
+ /* @__PURE__ */ u("div", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: E }),
1097
+ a
1098
+ ) : null
1099
+ ] });
1100
+ }
1101
+ const kt = (e) => {
1102
+ var t, n;
1103
+ return typeof ((n = (t = globalThis.google) == null ? void 0 : t.maps) == null ? void 0 : n[e]) == "function";
1104
+ };
1105
+ function et() {
1106
+ const { t: e } = H("ui");
1107
+ return /* @__PURE__ */ N(
1108
+ "div",
1109
+ {
1110
+ role: "status",
1111
+ "data-testid": "map-view-loading",
1112
+ className: "ds:[inline-size:100%] ds:[block-size:100%]",
1113
+ children: [
1114
+ /* @__PURE__ */ u(Kt, { variant: "rectangular", width: "100%", height: "100%" }),
1115
+ /* @__PURE__ */ u(ct, { children: e("common.loading") })
1116
+ ]
1117
+ }
1118
+ );
1119
+ }
1120
+ function tt({
1121
+ preview: e,
1122
+ onError: t
1123
+ }) {
1124
+ const { t: n } = H("ui");
1125
+ return /* @__PURE__ */ N(
1126
+ "div",
1127
+ {
1128
+ "data-testid": "map-view-loading",
1129
+ className: "ds:relative ds:[inline-size:100%] ds:[block-size:100%]",
1130
+ children: [
1131
+ /* @__PURE__ */ u(Ce, { preview: e, onError: t }),
1132
+ /* @__PURE__ */ u("div", { role: "status", children: /* @__PURE__ */ u(ct, { children: n("common.loading") }) })
1133
+ ]
1134
+ }
1135
+ );
1136
+ }
1137
+ function Ce({
1138
+ preview: e,
1139
+ onError: t
1140
+ }) {
1141
+ var d, i;
1142
+ const n = (((d = e.sources) == null ? void 0 : d.length) ?? 0) > 0, s = k(null), r = un(e.sources, s), [o, a] = L(!n);
1143
+ oe(() => {
1144
+ a(!0);
1145
+ }, []);
1146
+ const m = (r !== null ? (i = e.sources) == null ? void 0 : i[r] : void 0) ?? e, f = /* @__PURE__ */ u(
1147
+ "img",
1148
+ {
1149
+ src: m.src,
1150
+ srcSet: m.srcSet,
1151
+ alt: e.alt,
1152
+ width: m.width,
1153
+ height: m.height,
1154
+ loading: "lazy",
1155
+ decoding: "async",
1156
+ onError: t,
1157
+ "data-testid": "map-view-preview-image",
1158
+ className: "ds:block ds:[inline-size:100%] ds:[block-size:100%] ds:[object-fit:contain]"
1159
+ }
1160
+ );
1161
+ return n ? /* @__PURE__ */ u(
1162
+ "div",
1163
+ {
1164
+ ref: s,
1165
+ "data-testid": "map-view-preview-area",
1166
+ className: "ds:absolute ds:inset-0",
1167
+ children: o ? f : null
1168
+ }
1169
+ ) : f;
1170
+ }
1171
+ function Fn({
1172
+ children: e,
1173
+ pending: t,
1174
+ holdUntilLoaded: n = !1
1175
+ }) {
1176
+ const s = Bt();
1177
+ return st("maps") || kt("Map") || !s && !n ? e : t;
1178
+ }
1179
+ function jn({ children: e }) {
1180
+ return st("marker") || kt("Marker") ? e : null;
1181
+ }
1182
+ function xt(e, t) {
1183
+ oe(() => {
1184
+ const n = e.current;
1185
+ return () => {
1186
+ t == null || t(!!(n && n.contains(document.activeElement)));
1187
+ };
1188
+ }, [e, t]);
1189
+ }
1190
+ const Mt = "ds:rounded-[var(--radius-md)] ds:bg-[color-mix(in_srgb,var(--popover)_calc(100%-(100%-var(--glass-surface-alpha,85%))*0.27),transparent)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-sm)] ds:backdrop-blur-md ds:contrast-more:bg-[var(--popover)] ds:[@media(prefers-reduced-transparency:reduce)]:bg-[var(--popover)] ds:forced-colors:bg-[Canvas] ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--border)] ds:shadow-[var(--shadow-sm)]";
1191
+ function Gn({
1192
+ preview: e,
1193
+ onLoadMap: t,
1194
+ consentCta: n,
1195
+ onImageError: s,
1196
+ description: r,
1197
+ onUnmount: o
1198
+ }) {
1199
+ const { t: a } = H("ui"), m = nt(), f = k(null);
1200
+ return xt(f, o), /* @__PURE__ */ N(
1201
+ "div",
1202
+ {
1203
+ ref: f,
1204
+ className: "ds:absolute ds:inset-0 ds:@container/mapbar ds:bg-[var(--muted)]",
1205
+ "data-testid": "map-view-preview",
1206
+ children: [
1207
+ /* @__PURE__ */ u(Ce, { preview: e, onError: s }),
1208
+ /* @__PURE__ */ u("div", { className: "ds:absolute ds:start-0 ds:end-0 ds:top-[var(--map-preview-inset-block-start,var(--spacing-sm))] ds:px-[var(--spacing-sm)]", children: /* @__PURE__ */ N(
1209
+ "div",
1210
+ {
1211
+ "data-testid": "map-view-preview-plate",
1212
+ className: `ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:items-center ds:text-center ds:@[640px]/mapbar:flex-row ds:@[640px]/mapbar:justify-center ds:@[640px]/mapbar:gap-[var(--spacing-md)] ${Mt}`,
1213
+ children: [
1214
+ /* @__PURE__ */ u(
1215
+ "p",
1216
+ {
1217
+ id: m,
1218
+ className: "type-meta ds:m-0 ds:min-w-0 ds:text-[var(--foreground)] ds:@[640px]/mapbar:text-start",
1219
+ children: r
1220
+ }
1221
+ ),
1222
+ /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-2xs)]", children: n ?? /* @__PURE__ */ u(
1223
+ $e,
1224
+ {
1225
+ type: "button",
1226
+ intent: "primary",
1227
+ size: "sm",
1228
+ className: "ds:min-h-[var(--min-target-size)] ds:sm:min-h-[var(--min-target-size)]",
1229
+ onClick: t,
1230
+ "aria-describedby": m,
1231
+ "data-testid": "map-view-load-cta",
1232
+ children: a("mapView.consentTitle")
1233
+ }
1234
+ ) })
1235
+ ]
1236
+ }
1237
+ ) })
1238
+ ]
1239
+ }
1240
+ );
1241
+ }
1242
+ function Dn({
1243
+ reason: e,
1244
+ preview: t,
1245
+ onPreviewError: n,
1246
+ address: s,
1247
+ contentLang: r,
1248
+ openInGoogleMapsHref: o,
1249
+ onRetry: a,
1250
+ retryRef: m
1251
+ }) {
1252
+ const { t: f } = H("ui"), d = /* @__PURE__ */ N("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-center ds:gap-x-[var(--spacing-sm)] ds:gap-y-[var(--spacing-2xs)]", children: [
1253
+ /* @__PURE__ */ u(
1254
+ $e,
1255
+ {
1256
+ ref: m,
1257
+ type: "button",
1258
+ intent: "primary",
1259
+ size: "sm",
1260
+ className: "ds:min-h-[var(--min-target-size)] ds:sm:min-h-[var(--min-target-size)]",
1261
+ onClick: a,
1262
+ "data-testid": "map-view-retry",
1263
+ children: f("mapView.retry")
1264
+ }
1265
+ ),
1266
+ /* @__PURE__ */ N(
1267
+ "a",
1268
+ {
1269
+ href: o,
1270
+ target: "_blank",
1271
+ rel: "noopener noreferrer",
1272
+ className: "ds:inline-flex ds:min-h-[var(--min-target-size)] ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[var(--primary-readable)] ds:underline ds:underline-offset-2",
1273
+ "data-testid": "map-view-open-in-google-maps",
1274
+ children: [
1275
+ f("mapView.openInGoogleMaps"),
1276
+ /* @__PURE__ */ u(lt, { "aria-hidden": "true", className: "ds:size-3" })
1277
+ ]
1278
+ }
1279
+ )
1280
+ ] });
1281
+ return t ? /* @__PURE__ */ N(
1282
+ "div",
1283
+ {
1284
+ className: "ds:absolute ds:inset-0 ds:@container/mapbar ds:bg-[var(--muted)]",
1285
+ "data-testid": "map-view-error",
1286
+ "data-reason": e,
1287
+ children: [
1288
+ /* @__PURE__ */ u(Ce, { preview: t, onError: n }),
1289
+ /* @__PURE__ */ u("div", { className: "ds:absolute ds:start-0 ds:end-0 ds:top-[var(--map-preview-inset-block-start,var(--spacing-sm))] ds:px-[var(--spacing-sm)]", children: /* @__PURE__ */ N(
1290
+ "div",
1291
+ {
1292
+ className: `ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center ${Mt} ds:@[640px]/mapbar:flex-row ds:@[640px]/mapbar:justify-center ds:@[640px]/mapbar:gap-[var(--spacing-md)]`,
1293
+ children: [
1294
+ /* @__PURE__ */ u(
1295
+ "p",
1296
+ {
1297
+ role: "status",
1298
+ className: "type-meta ds:m-0 ds:min-w-0 ds:text-[var(--foreground)]",
1299
+ children: f("mapView.unavailable")
1300
+ }
1301
+ ),
1302
+ d
1303
+ ]
1304
+ }
1305
+ ) })
1306
+ ]
1307
+ }
1308
+ ) : /* @__PURE__ */ N(
1309
+ "div",
1310
+ {
1311
+ className: gt(),
1312
+ "data-testid": "map-view-error",
1313
+ "data-reason": e,
1314
+ children: [
1315
+ /* @__PURE__ */ u(
1316
+ dt,
1317
+ {
1318
+ "aria-hidden": "true",
1319
+ className: "ds:size-6 ds:text-[var(--muted-foreground)]"
1320
+ }
1321
+ ),
1322
+ /* @__PURE__ */ u("p", { role: "status", className: vt(), children: f("mapView.unavailable") }),
1323
+ s ? /* @__PURE__ */ u(
1324
+ "p",
1325
+ {
1326
+ className: Ne(),
1327
+ "data-testid": "map-view-address",
1328
+ lang: r,
1329
+ children: s
1330
+ }
1331
+ ) : null,
1332
+ d
1333
+ ]
1334
+ }
1335
+ );
1336
+ }
1337
+ function Zn({
1338
+ address: e,
1339
+ contentLang: t,
1340
+ description: n,
1341
+ onLoadMap: s,
1342
+ openInGoogleMapsHref: r,
1343
+ consentCta: o,
1344
+ onUnmount: a
1345
+ }) {
1346
+ const { t: m } = H("ui"), f = k(null);
1347
+ return xt(f, a), /* @__PURE__ */ N(
1348
+ "div",
1349
+ {
1350
+ ref: f,
1351
+ className: gt(),
1352
+ "data-testid": "map-view-consent",
1353
+ children: [
1354
+ /* @__PURE__ */ u(
1355
+ dt,
1356
+ {
1357
+ "aria-hidden": "true",
1358
+ className: "ds:size-6 ds:text-[var(--muted-foreground)]"
1359
+ }
1360
+ ),
1361
+ /* @__PURE__ */ u("p", { className: vt(), children: m("mapView.consentTitle") }),
1362
+ e ? /* @__PURE__ */ u(
1363
+ "p",
1364
+ {
1365
+ className: Ne(),
1366
+ "data-testid": "map-view-address",
1367
+ lang: t,
1368
+ children: e
1369
+ }
1370
+ ) : null,
1371
+ /* @__PURE__ */ u("p", { className: Ne(), children: n }),
1372
+ /* @__PURE__ */ N(
1373
+ "div",
1374
+ {
1375
+ className: "ds:flex ds:gap-[var(--spacing-sm)] ds:flex-wrap ds:items-center ds:justify-center",
1376
+ "data-testid": "map-view-consent-actions",
1377
+ children: [
1378
+ o ?? /* @__PURE__ */ u(
1379
+ $e,
1380
+ {
1381
+ type: "button",
1382
+ intent: "primary",
1383
+ size: "sm",
1384
+ onClick: s,
1385
+ "data-testid": "map-view-load-cta",
1386
+ children: m("mapView.consentCta")
1387
+ }
1388
+ ),
1389
+ /* @__PURE__ */ N(
1390
+ "a",
1391
+ {
1392
+ href: r,
1393
+ target: "_blank",
1394
+ rel: "noopener noreferrer",
1395
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[var(--primary-readable)] ds:underline ds:underline-offset-2",
1396
+ children: [
1397
+ m("mapView.openInGoogleMaps"),
1398
+ /* @__PURE__ */ u(lt, { "aria-hidden": "true", className: "ds:size-3" })
1399
+ ]
1400
+ }
1401
+ )
1402
+ ]
1403
+ }
1404
+ )
1405
+ ]
1406
+ }
1407
+ );
1408
+ }
1409
+ const Un = Ot(
1410
+ ({
1411
+ id: e,
1412
+ apiKey: t,
1413
+ center: n,
1414
+ zoom: s = 15,
1415
+ markers: r,
1416
+ selectedMarkerId: o,
1417
+ hoveredMarkerId: a,
1418
+ renderMarkerCard: m,
1419
+ onMarkerHover: f,
1420
+ onMarkerClick: d,
1421
+ onBoundsChange: i,
1422
+ consentGranted: l = !1,
1423
+ loadTimeoutMs: h = mn,
1424
+ onLoadError: v,
1425
+ onConsentRequest: c,
1426
+ staticPreview: g,
1427
+ address: b,
1428
+ contentLang: y,
1429
+ consentDescription: E,
1430
+ consentCta: C,
1431
+ mapId: R,
1432
+ size: D,
1433
+ surface: J,
1434
+ ariaLabel: M,
1435
+ fitToPoints: _,
1436
+ fitKey: O,
1437
+ fitMaxZoom: $ = 15,
1438
+ clusterMarkers: F = "auto",
1439
+ clusterLabel: z,
1440
+ onClusterClick: P,
1441
+ className: S,
1442
+ ...j
1443
+ }, ve) => {
1444
+ const { t: Y, i18n: Re } = H("ui"), Ae = k(/* @__PURE__ */ new Map()), ae = G(() => _ ?? [], [_]), Et = G(
1445
+ () => O ?? ae.map((p) => `${wt(p)}@${p.lat},${p.lng}`).sort().join("|"),
1446
+ [O, ae]
1447
+ ), K = ae.length > 0, Pe = k(K), Ve = nt(), _t = G(
1448
+ () => `map-${Ve.replace(/[^a-zA-Z0-9-_]/g, "")}`,
1449
+ [Ve]
1450
+ ), [Oe, zt] = L(!1);
1451
+ x(() => {
1452
+ if (typeof window > "u") return;
1453
+ const p = window.matchMedia("(prefers-reduced-motion: reduce)"), w = () => zt(p.matches);
1454
+ return w(), p.addEventListener("change", w), () => p.removeEventListener("change", w);
1455
+ }, []);
1456
+ const Fe = G(() => `https://www.google.com/maps/search/?api=1&query=${b ? encodeURIComponent(b) : `${n.lat},${n.lng}`}`, [b, n.lat, n.lng]), ie = k(null), je = k(null), [T, be] = L(null), [ye, we] = L(!1), Q = k(null);
1457
+ Q.current = T;
1458
+ const q = k({}).current, ce = k(v);
1459
+ ce.current = v;
1460
+ const le = k(!1), ke = k(!1), U = A((p) => {
1461
+ be((w) => w ?? p);
1462
+ }, []), St = A(
1463
+ () => U("script"),
1464
+ [U]
1465
+ ), Lt = A(
1466
+ () => U("import"),
1467
+ [U]
1468
+ ), xe = A(() => {
1469
+ Q.current !== null && (ke.current = !0, le.current = !0, Ye(Q.current, q), we(!1), be(null));
1470
+ }, [q]), Z = k(null), Ge = k({
1471
+ pendingInput: !1,
1472
+ moved: !1,
1473
+ programmatic: !1
1474
+ }), ee = A(() => {
1475
+ Ge.current = {
1476
+ pendingInput: !1,
1477
+ moved: !1,
1478
+ programmatic: !0
1479
+ };
1480
+ }, []), de = A(
1481
+ (p) => {
1482
+ ee(), d == null || d(p);
1483
+ },
1484
+ [ee, d]
1485
+ ), [De, Nt] = L(null), Me = G(
1486
+ () => a != null && m ? (r ?? []).find((p) => p.id === a) ?? null : null,
1487
+ [a, m, r]
1488
+ ), $t = A((p) => {
1489
+ Z.current = p, we(p !== null);
1490
+ }, []), Ze = k(!1), Ue = k(null), We = k(0), ue = A(
1491
+ () => ({
1492
+ panTo: (p) => {
1493
+ var w;
1494
+ return (w = Z.current) == null ? void 0 : w.panTo(p);
1495
+ },
1496
+ setZoom: (p) => {
1497
+ var w;
1498
+ return (w = Z.current) == null ? void 0 : w.setZoom(p);
1499
+ },
1500
+ selectMarker: (p) => {
1501
+ var w;
1502
+ return (w = Z.current) == null ? void 0 : w.selectMarker(p);
1503
+ },
1504
+ // Without `isConsentGranted` an agent has no way to learn that
1505
+ // its pan / zoom / select was swallowed by the GDPR gate rather
1506
+ // than applied: under the default (`consentGranted={false}`) the
1507
+ // whole Maps subtree is unmounted and every action optional-chains
1508
+ // into nothing.
1509
+ isConsentGranted: () => Ze.current,
1510
+ getCenter: () => {
1511
+ var p;
1512
+ return ((p = Z.current) == null ? void 0 : p.getCenter()) ?? null;
1513
+ },
1514
+ getZoom: () => {
1515
+ var p;
1516
+ return ((p = Z.current) == null ? void 0 : p.getZoom()) ?? null;
1517
+ },
1518
+ getSelectedMarkerId: () => Ue.current,
1519
+ getMarkerCount: () => We.current,
1520
+ getLoadError: () => Q.current,
1521
+ retryLoad: xe
1522
+ }),
1523
+ [xe]
1524
+ );
1525
+ Ft(ve, ue, [ue]);
1526
+ const Tt = G(
1527
+ () => ue(),
1528
+ [ue]
1529
+ );
1530
+ Ht(Xt, Tt, e), x(() => {
1531
+ var w, I;
1532
+ const p = Pe.current && !K;
1533
+ if (Pe.current = K, !K) {
1534
+ if (p) {
1535
+ (w = Z.current) == null || w.jumpTo(n, s);
1536
+ return;
1537
+ }
1538
+ Oe || (I = Z.current) == null || I.panTo(n);
1539
+ }
1540
+ }, [n.lat, n.lng, Oe, K]), x(() => {
1541
+ var p;
1542
+ K || (p = Z.current) == null || p.setZoom(s);
1543
+ }, [s, K]);
1544
+ const [It, Be] = L(!1), V = l || It;
1545
+ Ze.current = V, Ue.current = o ?? null, We.current = (r ?? []).length;
1546
+ const [Ct, Rt] = L(null), W = g && g.src !== Ct ? g : void 0, Ee = g == null ? void 0 : g.src, me = A(() => {
1547
+ Ee && Rt(Ee);
1548
+ }, [Ee]), _e = k(!1), ze = k(!1), Ke = A((p) => {
1549
+ ze.current = p;
1550
+ }, []);
1551
+ x(() => {
1552
+ var B;
1553
+ if (!V) return;
1554
+ const p = document.activeElement, w = !p || p === document.body, I = _e.current || ze.current && w;
1555
+ _e.current = !1, ze.current = !1, I && ((B = ie.current) == null || B.focus({ preventScroll: !0 }));
1556
+ }, [V]);
1557
+ const qe = A(() => {
1558
+ if (_e.current = !0, le.current = !0, c) {
1559
+ c(), Be(!0);
1560
+ return;
1561
+ }
1562
+ Be(!0);
1563
+ }, [c]);
1564
+ x(() => {
1565
+ if (!V || T !== null || ye || !(h > 0) || !Number.isFinite(h))
1566
+ return;
1567
+ const p = setTimeout(() => U("timeout"), h);
1568
+ return () => clearTimeout(p);
1569
+ }, [V, T, ye, h, U]), x(() => {
1570
+ if (!V || T !== null) return;
1571
+ const p = window, w = p.gm_authFailure, I = () => {
1572
+ U("auth"), w == null || w();
1573
+ };
1574
+ return p.gm_authFailure = I, () => {
1575
+ p.gm_authFailure === I && (w ? p.gm_authFailure = w : delete p.gm_authFailure);
1576
+ };
1577
+ }, [V, T, U]);
1578
+ const He = V && T === null && !ye;
1579
+ x(() => {
1580
+ if (He)
1581
+ return Le.add(q), () => {
1582
+ Le.delete(q);
1583
+ };
1584
+ }, [He, q]), x(() => {
1585
+ V || (Q.current !== null && (Ye(Q.current, q), be(null)), we(!1));
1586
+ }, [V, q]), x(() => {
1587
+ var p;
1588
+ T !== null && ((p = ce.current) == null || p.call(ce, T));
1589
+ }, [T]), oe(() => {
1590
+ var I, B;
1591
+ if (T === null) {
1592
+ ke.current && (ke.current = !1, (I = ie.current) == null || I.focus({ preventScroll: !0 }));
1593
+ return;
1594
+ }
1595
+ const p = document.activeElement, w = !p || p === document.body || p === ie.current;
1596
+ le.current && w && ((B = je.current) == null || B.focus({ preventScroll: !0 })), le.current = !1;
1597
+ }, [T]);
1598
+ const Xe = (p) => {
1599
+ const w = o != null && o === p.id, I = a != null && a === p.id, B = Y("mapView.markerLabel", {
1600
+ label: p.label ?? p.id
1601
+ });
1602
+ return R ? /* @__PURE__ */ u(
1603
+ xn,
1604
+ {
1605
+ marker: p,
1606
+ label: B,
1607
+ isSelected: w,
1608
+ isHovered: I,
1609
+ onSelect: de,
1610
+ onHover: f,
1611
+ elements: Ae
1612
+ },
1613
+ p.id
1614
+ ) : /* @__PURE__ */ u(
1615
+ Rn,
1616
+ {
1617
+ marker: p,
1618
+ label: B,
1619
+ isSelected: w,
1620
+ isHovered: I,
1621
+ onSelect: de,
1622
+ onHover: f
1623
+ },
1624
+ p.id
1625
+ );
1626
+ }, At = A(
1627
+ (p) => typeof z == "function" ? z(p) : typeof z == "string" ? z.replaceAll("{count}", String(p)) : Y("mapView.clusterLabel", { count: p }),
1628
+ [z, Y]
1629
+ ), Pt = an(F, (r ?? []).length);
1630
+ return /* @__PURE__ */ u(
1631
+ "div",
1632
+ {
1633
+ ref: ie,
1634
+ className: pn({ size: D, surface: J, className: S }),
1635
+ "data-component": "map-view",
1636
+ "data-component-id": e ?? _t,
1637
+ role: "region",
1638
+ "aria-label": M ?? Y("mapView.label"),
1639
+ tabIndex: -1,
1640
+ ...j,
1641
+ children: /* @__PURE__ */ u(
1642
+ "div",
1643
+ {
1644
+ ref: Nt,
1645
+ className: fn({ size: D, className: "ds:relative" }),
1646
+ children: V ? T !== null ? /* @__PURE__ */ u(
1647
+ Dn,
1648
+ {
1649
+ reason: T,
1650
+ preview: W,
1651
+ onPreviewError: me,
1652
+ address: b,
1653
+ contentLang: y,
1654
+ openInGoogleMapsHref: Fe,
1655
+ onRetry: xe,
1656
+ retryRef: je
1657
+ }
1658
+ ) : (
1659
+ // Any failure of the Maps subtree ends in the "not available"
1660
+ // state (its "Open in Google Maps" link needs no script, and
1661
+ // "Retry" tries again) instead of unmounting the host's React
1662
+ // tree. The gate starts the provider only once Google's `core`
1663
+ // and `maps` libraries have arrived.
1664
+ /* @__PURE__ */ u(qt, { onError: Lt, fallback: /* @__PURE__ */ u(jt, {}), children: /* @__PURE__ */ u(
1665
+ Dt,
1666
+ {
1667
+ libraries: ["maps"],
1668
+ pending: W ? /* @__PURE__ */ u(
1669
+ tt,
1670
+ {
1671
+ preview: W,
1672
+ onError: me
1673
+ }
1674
+ ) : /* @__PURE__ */ u(et, {}),
1675
+ children: /* @__PURE__ */ u(
1676
+ Zt,
1677
+ {
1678
+ apiKey: t,
1679
+ onError: St,
1680
+ language: Re.language,
1681
+ children: /* @__PURE__ */ u(
1682
+ Fn,
1683
+ {
1684
+ holdUntilLoaded: !!W,
1685
+ pending: W ? /* @__PURE__ */ u(
1686
+ tt,
1687
+ {
1688
+ preview: W,
1689
+ onError: me
1690
+ }
1691
+ ) : /* @__PURE__ */ u(et, {}),
1692
+ children: /* @__PURE__ */ N(
1693
+ Ut,
1694
+ {
1695
+ defaultCenter: n,
1696
+ defaultZoom: s,
1697
+ mapId: R,
1698
+ gestureHandling: "cooperative",
1699
+ disableDefaultUI: !1,
1700
+ onClick: () => de(null),
1701
+ className: "ds:[inline-size:100%] ds:[block-size:100%]",
1702
+ children: [
1703
+ /* @__PURE__ */ u(
1704
+ hn,
1705
+ {
1706
+ onHandleReady: $t,
1707
+ onMarkerSelect: de,
1708
+ onCameraMove: ee
1709
+ }
1710
+ ),
1711
+ i ? /* @__PURE__ */ u(
1712
+ gn,
1713
+ {
1714
+ onBoundsChange: i,
1715
+ userInteraction: Ge
1716
+ }
1717
+ ) : null,
1718
+ _ ? /* @__PURE__ */ u(
1719
+ zn,
1720
+ {
1721
+ points: ae,
1722
+ fitKey: Et,
1723
+ maxZoom: $,
1724
+ onCameraMove: ee
1725
+ }
1726
+ ) : null,
1727
+ Me && m ? /* @__PURE__ */ u(
1728
+ bn,
1729
+ {
1730
+ marker: Me,
1731
+ frame: De,
1732
+ direction: Re.dir(),
1733
+ children: m(Me.id)
1734
+ }
1735
+ ) : null,
1736
+ /* @__PURE__ */ u(jn, { children: /* @__PURE__ */ u(In, { enabled: !R, children: Pt ? /* @__PURE__ */ u(
1737
+ On,
1738
+ {
1739
+ markers: r ?? [],
1740
+ fallbackZoom: s,
1741
+ selectedMarkerId: o ?? null,
1742
+ hoveredMarkerId: a ?? null,
1743
+ renderMarker: Xe,
1744
+ mapId: !!R,
1745
+ frame: De,
1746
+ elements: Ae,
1747
+ labelFor: At,
1748
+ onCameraMove: ee,
1749
+ onClusterClick: P
1750
+ }
1751
+ ) : (r ?? []).map(Xe) }) })
1752
+ ]
1753
+ }
1754
+ )
1755
+ }
1756
+ )
1757
+ }
1758
+ )
1759
+ }
1760
+ ) })
1761
+ ) : W ? /* @__PURE__ */ u(
1762
+ Gn,
1763
+ {
1764
+ preview: W,
1765
+ onLoadMap: qe,
1766
+ consentCta: C,
1767
+ onImageError: me,
1768
+ description: E ?? Y("mapView.consentDescription"),
1769
+ onUnmount: Ke
1770
+ }
1771
+ ) : /* @__PURE__ */ u(
1772
+ Zn,
1773
+ {
1774
+ address: b,
1775
+ contentLang: y,
1776
+ description: E ?? Y("mapView.consentDescription"),
1777
+ onLoadMap: qe,
1778
+ consentCta: C,
1779
+ openInGoogleMapsHref: Fe,
1780
+ onUnmount: Ke
1781
+ }
1782
+ )
1783
+ }
1784
+ )
1785
+ }
1786
+ );
1787
+ }
1788
+ );
1789
+ Un.displayName = "MapView";
1790
+ export {
1791
+ Un as M,
1792
+ Je as i
1793
+ };
1794
+ //# sourceMappingURL=map-view-Cm69dCnY.js.map