@yarrow-uz/rn-map-sdk 0.4.0 → 0.5.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,2689 @@
1
+ import { Animated, Image, StyleSheet, Text, View } from "react-native";
2
+ import { Camera, GeoJSONSource, Images, Layer, Map as Map$1, Marker, OfflineManager } from "@maplibre/maplibre-react-native";
3
+ import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+
6
+ // ../core/dist/index.js
7
+ const YARROW_MAP_URL = "https://gis.yarrow.uz";
8
+ const YARROW_SEARCH_API_URL = "https://api.yarrow.uz";
9
+ let _apiKey = null;
10
+ function setYarrowApiKey(apiKey) {
11
+ if (!apiKey) throw new Error("apiKey is required");
12
+ _apiKey = apiKey;
13
+ }
14
+ function getYarrowApiKey() {
15
+ if (!_apiKey) throw new Error("Yarrow API key not configured");
16
+ return _apiKey;
17
+ }
18
+ /**
19
+ * Appends the configured API key as the `api_key` query parameter. Returns the
20
+ * url unchanged when no key is configured yet or the url cannot be parsed.
21
+ */
22
+ function addApiKeyToUrl(url) {
23
+ if (!_apiKey) return url;
24
+ try {
25
+ const parsedUrl = new URL(url);
26
+ parsedUrl.searchParams.set("api_key", _apiKey);
27
+ return parsedUrl.toString();
28
+ } catch {
29
+ return url;
30
+ }
31
+ }
32
+ /**
33
+ * Computes the geographic bounding box of a FeatureCollection whose features
34
+ * are Points, LineStrings or Polygons. Pure platform-agnostic math shared by
35
+ * the web and React Native SDKs' camera helpers.
36
+ */
37
+ function getBoundingBox(data) {
38
+ const bounds = {
39
+ xMin: 180,
40
+ yMin: 90,
41
+ xMax: -180,
42
+ yMax: -90
43
+ };
44
+ const checkBounds = (coordinate) => {
45
+ const [longitude, latitude] = coordinate;
46
+ bounds.xMin = Math.min(bounds.xMin, longitude);
47
+ bounds.xMax = Math.max(bounds.xMax, longitude);
48
+ bounds.yMin = Math.min(bounds.yMin, latitude);
49
+ bounds.yMax = Math.max(bounds.yMax, latitude);
50
+ };
51
+ const isLngLat = (value) => Array.isArray(value) && value.length >= 2 && typeof value[0] === "number" && typeof value[1] === "number";
52
+ for (const feature of data.features) {
53
+ const type = feature.geometry?.type;
54
+ const coordinates = feature.geometry?.coordinates;
55
+ if (type === "Point" && isLngLat(coordinates)) checkBounds(coordinates);
56
+ else if (type === "LineString" && Array.isArray(coordinates)) {
57
+ for (const coord of coordinates) if (isLngLat(coord)) checkBounds(coord);
58
+ } else if (type === "Polygon" && Array.isArray(coordinates)) for (const ring of coordinates) {
59
+ if (!Array.isArray(ring)) continue;
60
+ for (const coord of ring) if (isLngLat(coord)) checkBounds(coord);
61
+ }
62
+ }
63
+ return bounds;
64
+ }
65
+ /** Style-API endpoint returning the icon registry (`IconListItem[]`). */
66
+ const ICONS_ENDPOINT = "/icons-image";
67
+ const DEFAULT_CACHE_LIFESPAN_DAYS = 30;
68
+ const MILLISECONDS_PER_DAY = 864e5;
69
+ const TILE_CACHE_NAME = "yarrow-cache-v1-tile";
70
+ const ICON_CACHE_NAME = "yarrow-cache-v1-icon";
71
+ const CACHE_PROTOCOL = "yarrowcache";
72
+ const CACHED_AT_HEADER = "x-yarrow-cached-at";
73
+ const hasCacheStorage = () => typeof globalThis !== "undefined" && typeof globalThis.caches !== "undefined" && typeof globalThis.caches.open === "function";
74
+ const extractCachedAt = (response) => {
75
+ const raw = response.headers.get(CACHED_AT_HEADER);
76
+ if (!raw) return null;
77
+ const parsed = Number(raw);
78
+ return Number.isFinite(parsed) ? parsed : null;
79
+ };
80
+ /**
81
+ * Pulls a `max-age=N` value (in seconds) out of a `Cache-Control` header, if
82
+ * present. Returns `null` when the header is missing or doesn't carry a
83
+ * numeric `max-age`. Returns 0 for `max-age=0` (treat as immediately stale).
84
+ *
85
+ * The Yarrow backend does not currently emit `Cache-Control` headers, so this
86
+ * is dead in production today. It's plumbed in so a future fix on the
87
+ * backend starts being honored without an SDK release.
88
+ */
89
+ const parseMaxAge = (cacheControl) => {
90
+ if (!cacheControl) return null;
91
+ for (const directive of cacheControl.split(",")) {
92
+ const [rawKey, rawValue] = directive.trim().split("=");
93
+ if (rawKey?.toLowerCase() !== "max-age") continue;
94
+ if (rawValue === void 0) return 0;
95
+ const parsed = Number(rawValue);
96
+ return Number.isFinite(parsed) ? parsed : null;
97
+ }
98
+ return null;
99
+ };
100
+ const toCachedArrayBufferResponse = async (response) => {
101
+ return {
102
+ data: await response.arrayBuffer(),
103
+ cacheControl: response.headers.get("cache-control"),
104
+ expires: response.headers.get("expires"),
105
+ contentType: response.headers.get("content-type")
106
+ };
107
+ };
108
+ const fetchFromNetwork = async (url, abortController, requestParameters) => {
109
+ const response = await fetch(url, {
110
+ method: requestParameters?.method ?? "GET",
111
+ headers: requestParameters?.headers,
112
+ body: requestParameters?.body,
113
+ credentials: requestParameters?.credentials,
114
+ signal: abortController.signal
115
+ });
116
+ if (!response.ok) throw new Error(`Request failed: ${response.status} ${response.statusText}`);
117
+ return toCachedArrayBufferResponse(response);
118
+ };
119
+ /**
120
+ * Best-effort LRU eviction for quota errors. Removes the oldest entries (by
121
+ * `x-yarrow-cached-at` header) until the new write fits, or until nothing
122
+ * remains to drop. Silently stops evicting when the cache becomes empty —
123
+ * callers still treat the original quota error as non-fatal.
124
+ */
125
+ const evictOldest = async (cache) => {
126
+ try {
127
+ const keys = await cache.keys();
128
+ if (keys.length === 0) return false;
129
+ let oldestKey = null;
130
+ let oldestAt = Number.POSITIVE_INFINITY;
131
+ for (const key of keys) {
132
+ const match = await cache.match(key);
133
+ if (!match) continue;
134
+ const at = extractCachedAt(match) ?? 0;
135
+ if (at < oldestAt) {
136
+ oldestAt = at;
137
+ oldestKey = key;
138
+ }
139
+ }
140
+ if (oldestKey === null) return false;
141
+ await cache.delete(oldestKey);
142
+ return true;
143
+ } catch {
144
+ return false;
145
+ }
146
+ };
147
+ const saveToCache = async (cache, cacheKey, response) => {
148
+ const headers = new Headers();
149
+ if (response.contentType) headers.set("content-type", response.contentType);
150
+ if (response.cacheControl) headers.set("cache-control", response.cacheControl);
151
+ if (response.expires) headers.set("expires", response.expires);
152
+ headers.set(CACHED_AT_HEADER, Date.now().toString());
153
+ const MAX_WRITE_EVICTIONS = 4;
154
+ let lastError;
155
+ for (let attempt = 0;; attempt++) {
156
+ const body = new Response(response.data.slice(0), {
157
+ status: 200,
158
+ headers
159
+ });
160
+ try {
161
+ await cache.put(cacheKey, body);
162
+ return;
163
+ } catch (error) {
164
+ lastError = error;
165
+ }
166
+ if (attempt >= MAX_WRITE_EVICTIONS || !await evictOldest(cache)) break;
167
+ }
168
+ console.warn("[YarrowMap] cache write failed:", lastError);
169
+ };
170
+ const fetchArrayBufferWithCache = async (url, cacheName, lifespanMs, abortController, requestParameters) => {
171
+ if (!hasCacheStorage()) return fetchFromNetwork(url, abortController, requestParameters);
172
+ const cache = await caches.open(cacheName);
173
+ const cachedResponse = await cache.match(url);
174
+ if (cachedResponse) {
175
+ const cachedAt = extractCachedAt(cachedResponse);
176
+ const maxAgeSeconds = parseMaxAge(cachedResponse.headers.get("cache-control"));
177
+ const effectiveLifespanMs = maxAgeSeconds !== null ? maxAgeSeconds * 1e3 : lifespanMs;
178
+ if (!(cachedAt === null || Date.now() - cachedAt > effectiveLifespanMs)) return toCachedArrayBufferResponse(cachedResponse);
179
+ try {
180
+ const refreshed = await fetchFromNetwork(url, abortController, requestParameters);
181
+ await saveToCache(cache, url, refreshed);
182
+ return refreshed;
183
+ } catch {
184
+ return toCachedArrayBufferResponse(cachedResponse);
185
+ }
186
+ }
187
+ const networkResponse = await fetchFromNetwork(url, abortController, requestParameters);
188
+ await saveToCache(cache, url, networkResponse);
189
+ return networkResponse;
190
+ };
191
+ const transformRouteCoordinates = (features) => {
192
+ return features.map((feature) => {
193
+ const transformedCoords = feature.geometry.coordinates.map((coord) => [coord.lng, coord.lat]);
194
+ return {
195
+ ...feature,
196
+ geometry: {
197
+ ...feature.geometry,
198
+ coordinates: transformedCoords
199
+ }
200
+ };
201
+ });
202
+ };
203
+ /** Routing API endpoint used by `fetchRoutes()`. */
204
+ const ROUTE_API_URL = "https://api.yarrow.uz/api/routing/route";
205
+ const emptyResult = (profile) => ({
206
+ features: [],
207
+ directions: [],
208
+ meta: {
209
+ profile,
210
+ totalRoutes: 0,
211
+ bestRouteIndex: 0,
212
+ duration: 0,
213
+ distance: 0
214
+ }
215
+ });
216
+ /**
217
+ * Network half of the routing flow: POSTs the route request to the Yarrow
218
+ * routing API, parses and normalizes the response (coordinate order fix
219
+ * included). Rendering, events and camera work stay in the platform SDKs —
220
+ * they consume the returned features/directions/meta verbatim.
221
+ *
222
+ * Early "no route" outcomes resolve to an empty result (never throw), exactly
223
+ * like the web SDK's historic `buildRoute()` behavior.
224
+ */
225
+ async function fetchRoutes(input) {
226
+ const { profile, coordinates, language, signal } = input;
227
+ if (coordinates.length < 2) throw new Error("At least two coordinates are required to build a route.");
228
+ const url = addApiKeyToUrl(ROUTE_API_URL);
229
+ const response = await fetch(url, {
230
+ method: "POST",
231
+ signal,
232
+ headers: {
233
+ "Content-Type": "application/json",
234
+ ...language ? { "Accept-Language": language } : {}
235
+ },
236
+ body: JSON.stringify({
237
+ profile: profile.toUpperCase(),
238
+ coordinates: coordinates.map((coord) => ({
239
+ lng: coord[0],
240
+ lat: coord[1]
241
+ }))
242
+ })
243
+ });
244
+ if (!response.ok) throw new Error(`Request failed: ${response.status} ${response.statusText}`);
245
+ const data = await response.json();
246
+ if (!data.success) {
247
+ console.warn("[YarrowMap] buildRoute: no route found");
248
+ return emptyResult(profile);
249
+ }
250
+ let features = data.data.path?.features || [];
251
+ features = transformRouteCoordinates(features);
252
+ if (!features.length) {
253
+ console.warn("[YarrowMap] buildRoute: route has no features to render");
254
+ return emptyResult(profile);
255
+ }
256
+ const bestCoords = features[0]?.geometry?.coordinates;
257
+ if (bestCoords?.every(([lng, lat]) => lng === bestCoords[0][0] && lat === bestCoords[0][1])) console.warn("[YarrowMap] buildRoute: the returned route has zero length — the requested coordinates may be outside the routing coverage area.");
258
+ const directions = data.data.directions?.routes?.map((r) => r.properties || []) || [];
259
+ return {
260
+ features,
261
+ directions,
262
+ meta: {
263
+ profile,
264
+ totalRoutes: features.length,
265
+ bestRouteIndex: 0,
266
+ duration: features[0]?.properties.duration || 0,
267
+ distance: features[0]?.properties.distance || 0
268
+ }
269
+ };
270
+ }
271
+ const haversineDistance = (lat1, lon1, lat2, lon2) => {
272
+ const toRad = (value) => value * Math.PI / 180;
273
+ const R = 6371e3;
274
+ const phi1 = toRad(lat1);
275
+ const phi2 = toRad(lat2);
276
+ const deltaPhi = toRad(lat2 - lat1);
277
+ const deltaLambda = toRad(lon2 - lon1);
278
+ const a = Math.sin(deltaPhi / 2) ** 2 + Math.cos(phi1) * Math.cos(phi2) * Math.sin(deltaLambda / 2) ** 2;
279
+ return R * (2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)));
280
+ };
281
+ /**
282
+ * Queries the Yarrow search API around a coordinate. Pure network + mapping —
283
+ * marker rendering stays in the platform SDKs.
284
+ */
285
+ async function fetchSearchResults(query, input) {
286
+ const searchUrl = addApiKeyToUrl(`${YARROW_SEARCH_API_URL}/api/search/`);
287
+ const url = new URL(searchUrl);
288
+ url.searchParams.set("q", query);
289
+ url.searchParams.set("lat", String(input.lat));
290
+ url.searchParams.set("lng", String(input.lon));
291
+ url.searchParams.set("country", "Uzbekistan");
292
+ url.searchParams.set("sort_by", "relevance");
293
+ url.searchParams.set("page", String(input.page ?? 1));
294
+ url.searchParams.set("page_size", String(input.pageSize ?? 15));
295
+ const response = await fetch(url.toString(), {
296
+ headers: { "Content-Type": "application/json" },
297
+ signal: input.signal
298
+ });
299
+ if (!response.ok) throw new Error(`Request failed: ${response.status} ${response.statusText}`);
300
+ return ((await response.json())?.results || []).map((r) => ({
301
+ id: r.id,
302
+ name: r.name,
303
+ icon_img: r.icon_img,
304
+ latitude: r.address?.location?.lat,
305
+ longitude: r.address?.location?.lng,
306
+ category: r.category
307
+ }));
308
+ }
309
+ /**
310
+ * Validates a user-supplied style type, warning (and falling back to
311
+ * `"default"`) on anything unrecognized. Verbatim behavior of the web SDK's
312
+ * `changeStyles()` guard.
313
+ */
314
+ function normalizeStyleType(styleType) {
315
+ if (styleType !== void 0 && styleType !== "default" && styleType !== "satellite" && styleType !== "hybrid") console.warn(`[YarrowMap] changeStyles: unknown style type "${styleType}", falling back to "default".`);
316
+ return styleType === "satellite" || styleType === "hybrid" ? styleType : "default";
317
+ }
318
+ /**
319
+ * Style-fetch endpoint for a style type/theme combination, e.g.
320
+ * `/styles/satellite/?dark=true`. Verbatim behavior of the web SDK's
321
+ * `YarrowStylesManager.buildStyleEndpoint()`.
322
+ */
323
+ function buildStyleEndpoint(styleType, theme) {
324
+ let endpoint = "/styles/";
325
+ if (styleType === "satellite") endpoint = "/styles/satellite/";
326
+ else if (styleType === "hybrid") endpoint = "/styles/hybrid/";
327
+ if (theme === "dark") endpoint += endpoint.includes("?") ? "&dark=true" : "?dark=true";
328
+ return endpoint;
329
+ }
330
+ const STORAGE_KEY = "yarrow:user_token";
331
+ /**
332
+ * Public alias of `STORAGE_KEY` so platform SDKs can build storage adapters
333
+ * (e.g. React Native AsyncStorage bridges) without hard-coding the key.
334
+ */
335
+ const USER_TOKEN_STORAGE_KEY = STORAGE_KEY;
336
+ let override = null;
337
+ function setTokenStorage(storage) {
338
+ override = storage;
339
+ }
340
+ function resolveStorage() {
341
+ if (override) return override;
342
+ try {
343
+ if (typeof localStorage !== "undefined") return localStorage;
344
+ } catch {}
345
+ return null;
346
+ }
347
+ function generateUuid() {
348
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") return crypto.randomUUID();
349
+ const bytes = /* @__PURE__ */ new Uint8Array(16);
350
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) crypto.getRandomValues(bytes);
351
+ else for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
352
+ bytes[6] = bytes[6] & 15 | 64;
353
+ bytes[8] = bytes[8] & 63 | 128;
354
+ const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0"));
355
+ return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10, 16).join("")}`;
356
+ }
357
+ function getOrCreateUserToken() {
358
+ const storage = resolveStorage();
359
+ if (storage) try {
360
+ const existing = storage.getItem(STORAGE_KEY);
361
+ if (existing) return existing;
362
+ const token = generateUuid();
363
+ storage.setItem(STORAGE_KEY, token);
364
+ return token;
365
+ } catch {}
366
+ return generateUuid();
367
+ }
368
+ /** Hard cap on how long a single tracking request may stay open. */
369
+ const TRACK_REQUEST_TIMEOUT_MS = 5e3;
370
+ function trackDau$1(apiKey, sdkType = "javascript") {
371
+ try {
372
+ const user_token = getOrCreateUserToken();
373
+ const controller = new AbortController();
374
+ const timeout = setTimeout(() => controller.abort(), TRACK_REQUEST_TIMEOUT_MS);
375
+ fetch(`${YARROW_SEARCH_API_URL}/api/tracking/track-dau`, {
376
+ method: "POST",
377
+ headers: { "Content-Type": "application/json" },
378
+ body: JSON.stringify({
379
+ api_key: apiKey,
380
+ sdk_type: sdkType,
381
+ user_token
382
+ }),
383
+ signal: controller.signal
384
+ }).catch(() => {}).finally(() => clearTimeout(timeout));
385
+ } catch {}
386
+ }
387
+
388
+ // src/clustering/ClusterBadge.tsx
389
+ const CLUSTER_COLORS = {
390
+ light: {
391
+ bg: "#2f80ed",
392
+ text: "#ffffff"
393
+ },
394
+ dark: {
395
+ bg: "#3b6fd4",
396
+ text: "#ffffff"
397
+ }
398
+ };
399
+ const ENTER_MS$1 = 280;
400
+ /**
401
+ * The count badge that stands in for clustered highlight/search markers —
402
+ * the native counterpart of the web SDK's cluster DOM marker (blue circle,
403
+ * white border, bold count).
404
+ */
405
+ const ClusterBadge = memo(function ClusterBadge({ lngLat, count, theme, onPress }) {
406
+ const progress = useRef(new Animated.Value(0)).current;
407
+ useEffect(() => {
408
+ Animated.timing(progress, {
409
+ toValue: 1,
410
+ duration: ENTER_MS$1,
411
+ useNativeDriver: true
412
+ }).start();
413
+ }, [progress]);
414
+ const colors = CLUSTER_COLORS[theme];
415
+ return /* @__PURE__ */ jsx(Marker, {
416
+ lngLat,
417
+ anchor: "center",
418
+ onPress: onPress ? () => onPress() : void 0,
419
+ children: /* @__PURE__ */ jsx(Animated.View, {
420
+ style: [styles$3.inner, {
421
+ transform: [{ scale: progress }],
422
+ opacity: progress
423
+ }],
424
+ children: /* @__PURE__ */ jsx(Text, {
425
+ style: [styles$3.badge, {
426
+ backgroundColor: colors.bg,
427
+ color: colors.text
428
+ }],
429
+ children: count
430
+ })
431
+ })
432
+ });
433
+ });
434
+ const styles$3 = StyleSheet.create({
435
+ inner: {
436
+ alignItems: "center",
437
+ justifyContent: "center"
438
+ },
439
+ badge: {
440
+ minWidth: 40,
441
+ height: 40,
442
+ paddingHorizontal: 10,
443
+ borderRadius: 20,
444
+ borderWidth: 3,
445
+ borderColor: "#ffffff",
446
+ fontSize: 15,
447
+ fontWeight: "700",
448
+ lineHeight: 34,
449
+ textAlign: "center",
450
+ textAlignVertical: "center"
451
+ }
452
+ });
453
+
454
+ // src/clustering/config.ts
455
+ /**
456
+ * Clustering configuration and normalization — the declarative counterpart of
457
+ * the web SDK's `setClustering`. Defaults match the web SDK exactly:
458
+ * 60 px merge radius, no clustering above zoom 16, clusters need ≥ 2 markers.
459
+ */
460
+ const DEFAULT_CLUSTER_RADIUS_PX = 60;
461
+ const DEFAULT_CLUSTER_MAX_ZOOM = 16;
462
+ const DEFAULT_CLUSTER_MIN_POINTS = 2;
463
+ /**
464
+ * Normalizes the public clustering option (`true` / config object / falsy)
465
+ * into a fully-resolved config. Passing an object enables clustering.
466
+ * `minPoints` is clamped to at least 2 — a "cluster" of one is just the
467
+ * marker itself.
468
+ */
469
+ function normalizeClusteringConfig(input) {
470
+ const disabled = {
471
+ enabled: false,
472
+ radius: 60,
473
+ maxZoom: 16,
474
+ minPoints: 2
475
+ };
476
+ if (input === void 0 || input === false) return disabled;
477
+ if (input === true) return {
478
+ ...disabled,
479
+ enabled: true
480
+ };
481
+ return {
482
+ enabled: true,
483
+ radius: input.radius ?? 60,
484
+ maxZoom: input.maxZoom ?? 16,
485
+ minPoints: Math.max(2, input.minPoints ?? 2),
486
+ onClusterClick: input.onClusterClick
487
+ };
488
+ }
489
+ /**
490
+ * Groups projected points greedily by pixel distance: each unvisited point
491
+ * seeds a group and absorbs every remaining point within `radius`. O(n²), but
492
+ * the highlighted/search-marker count is small (dozens at most), so this
493
+ * stays cheap and deterministic. Ported from the web SDK's cluster engine.
494
+ */
495
+ function groupByPixelRadius(items, radius) {
496
+ const radiusSq = radius * radius;
497
+ const visited = new Array(items.length).fill(false);
498
+ const groups = [];
499
+ for (let i = 0; i < items.length; i++) {
500
+ if (visited[i]) continue;
501
+ visited[i] = true;
502
+ const seed = items[i];
503
+ const group = [seed];
504
+ for (let j = i + 1; j < items.length; j++) {
505
+ if (visited[j]) continue;
506
+ const candidate = items[j];
507
+ const dx = seed.x - candidate.x;
508
+ const dy = seed.y - candidate.y;
509
+ if (dx * dx + dy * dy <= radiusSq) {
510
+ visited[j] = true;
511
+ group.push(candidate);
512
+ }
513
+ }
514
+ groups.push(group);
515
+ }
516
+ return groups;
517
+ }
518
+
519
+ // src/icons/registry.ts
520
+ /**
521
+ * Fetches the Yarrow icon registry (`/icons-image`) and reduces it to a
522
+ * name → URL map. Native has no Cache Storage, so the result is not persisted
523
+ * — `<YarrowMapView>` fetches it once per mount when icons are enabled.
524
+ *
525
+ * Also seeds core's API-key module state (like every standalone client), so
526
+ * the key is current even if the hook runs before a map mounts.
527
+ */
528
+ async function fetchYarrowIcons(apiKey) {
529
+ if (apiKey) setYarrowApiKey(apiKey);
530
+ const response = await fetch(addApiKeyToUrl(`${YARROW_MAP_URL}${ICONS_ENDPOINT}`));
531
+ if (!response.ok) throw new Error(`Request failed: ${response.status} ${response.statusText}`);
532
+ return (await response.json()).reduce((acc, icon) => {
533
+ acc[icon.icon_image_name] = icon.icon_image_url;
534
+ return acc;
535
+ }, {});
536
+ }
537
+ /**
538
+ * Best-effort icon URL for a search-result `category.name` / tile
539
+ * `node_type`. The registry is keyed by sprite names, which usually match
540
+ * category names — the same fallback the web SDK applies via its icon
541
+ * expression.
542
+ */
543
+ function resolveCategoryIcon(iconsByName, name) {
544
+ if (!name) return void 0;
545
+ const icons = iconsByName;
546
+ if (!icons) return void 0;
547
+ return Object.hasOwn(icons, name) ? icons[name] : void 0;
548
+ }
549
+
550
+ // src/poiHighlight/resolve.ts
551
+ /** The base style's POI symbol layer (`node_tile` source). */
552
+ const POI_BASE_LAYER = "pois_tile_layer";
553
+ const PLACE_TIMEOUT_MS = 15e3;
554
+ /**
555
+ * Fetches a POI's coordinates and icon from the place-detail API — the
556
+ * off-screen / below-zoom fallback of the resolution chain. Returns `null`
557
+ * on any failure or missing coordinates (web parity).
558
+ *
559
+ * When the response carries no `icon_img`, the icon is derived from
560
+ * `node_type` (falling back to `category.name`) — the web SDK resolves it
561
+ * through its style `icon-image` expression; native approximates that with
562
+ * an icon-registry lookup by the same name, since the detail endpoint
563
+ * returns the node type rather than an icon URL.
564
+ */
565
+ async function fetchPlaceLocation(id, iconsByName) {
566
+ const controller = new AbortController();
567
+ const timeout = setTimeout(() => controller.abort(), PLACE_TIMEOUT_MS);
568
+ try {
569
+ const url = addApiKeyToUrl(`${YARROW_SEARCH_API_URL}/api/search/${id}?is_bus_stop=false`);
570
+ const res = await fetch(url, { signal: controller.signal });
571
+ if (!res.ok) return null;
572
+ const data = (await res.json())?.search?.data;
573
+ const loc = data?.address?.location;
574
+ if (!loc) return null;
575
+ const nodeType = typeof data?.node_type === "string" ? data.node_type : typeof data?.category?.name === "string" ? data.category.name : void 0;
576
+ const iconUrl = data?.icon_img ?? (nodeType ? resolveCategoryIcon(iconsByName, nodeType) : void 0);
577
+ return {
578
+ lng: loc.lng,
579
+ lat: loc.lat,
580
+ iconUrl,
581
+ title: data?.name
582
+ };
583
+ } catch (error) {
584
+ if (error?.name !== "AbortError") console.warn(`[YarrowMap] fetchPlaceLocation(${id}) failed:`, error);
585
+ return null;
586
+ } finally {
587
+ clearTimeout(timeout);
588
+ }
589
+ }
590
+ /**
591
+ * Reads a POI's point geometry from the style's POI layer within the current
592
+ * viewport — the free, no-network resolution step. Native can only query
593
+ * *rendered* features (no `querySourceFeatures` on undeclared sources), so
594
+ * off-screen POIs fall through to the place-detail API. Icons are resolved
595
+ * best-effort from the registry via the feature's `node_type`.
596
+ */
597
+ async function lookupPoiInViewport(mapRef, id, iconsByName) {
598
+ let features = [];
599
+ try {
600
+ features = await mapRef.queryRenderedFeatures({
601
+ layers: [POI_BASE_LAYER],
602
+ filter: [
603
+ "==",
604
+ ["get", "id"],
605
+ id
606
+ ]
607
+ });
608
+ } catch {
609
+ return null;
610
+ }
611
+ const feature = features.find((f) => f.geometry?.type === "Point");
612
+ if (!feature) return null;
613
+ const coordinates = feature.geometry.coordinates;
614
+ const properties = feature.properties ?? {};
615
+ const nodeType = typeof properties.node_type === "string" ? properties.node_type : void 0;
616
+ const name = typeof properties.name === "string" ? properties.name : void 0;
617
+ return {
618
+ lng: coordinates[0],
619
+ lat: coordinates[1],
620
+ iconUrl: nodeType ? resolveCategoryIcon(iconsByName, nodeType) : void 0,
621
+ title: name
622
+ };
623
+ }
624
+ /**
625
+ * Resolves a POI's coordinates, icon and title cheapest-first:
626
+ * 1. caller-provided `location` / `icon` / `title`
627
+ * 2. local lookup in the rendered POI layer (no network)
628
+ * 3. the place-detail API (off-screen / below the POI zoom range, or when
629
+ * anything is still missing — web parity: the API fills icon and title
630
+ * too, not just coordinates)
631
+ *
632
+ * The web SDK additionally evaluates the style's `icon-image` expression for
633
+ * both the tile and the place-detail steps; native approximates it with a
634
+ * registry lookup by `node_type`. Coordinate resolution is the hard
635
+ * requirement — if it fails, the highlight is rolled back by the caller.
636
+ */
637
+ async function resolvePoiData(id, options, runtime) {
638
+ let lng = options.location?.lng;
639
+ let lat = options.location?.lat;
640
+ let iconUrl = options.icon;
641
+ let title = options.title;
642
+ if (lng === void 0 || iconUrl === void 0 || title === void 0) {
643
+ const mapRef = runtime.mapRef.current;
644
+ const local = mapRef ? await lookupPoiInViewport(mapRef, id, runtime.iconsByName) : null;
645
+ if (local) {
646
+ if (lng === void 0) {
647
+ lng = local.lng;
648
+ lat = local.lat;
649
+ }
650
+ if (iconUrl === void 0) iconUrl = local.iconUrl;
651
+ if (title === void 0) title = local.title;
652
+ }
653
+ }
654
+ if (lng === void 0 || iconUrl === void 0 || title === void 0) {
655
+ const remote = await fetchPlaceLocation(id, runtime.iconsByName);
656
+ if (remote) {
657
+ if (lng === void 0) {
658
+ lng = remote.lng;
659
+ lat = remote.lat;
660
+ }
661
+ if (iconUrl === void 0) iconUrl = remote.iconUrl;
662
+ if (title === void 0) title = remote.title;
663
+ }
664
+ }
665
+ if (lng === void 0 || lat === void 0) return null;
666
+ return {
667
+ lng,
668
+ lat,
669
+ iconUrl,
670
+ title
671
+ };
672
+ }
673
+
674
+ // src/runtime/context.ts
675
+ const YarrowMapContext = createContext(null);
676
+ /** Reads the enclosing `<YarrowMapView>` runtime, or `null` outside one. */
677
+ function useYarrowMapRuntime() {
678
+ return useContext(YarrowMapContext);
679
+ }
680
+
681
+ // src/events/useYarrowLayerPress.ts
682
+ const YARROW_CLICK_LAYER_IDS = {
683
+ pois: [POI_BASE_LAYER],
684
+ buildings: ["buildings_tile_layer"],
685
+ mahalla: ["mahallah_label_tile_layer"],
686
+ district: ["districts_label_tile_layer"],
687
+ region: ["regions_label_tile_layer"],
688
+ country: ["countries_label_tile_layer"]
689
+ };
690
+ /**
691
+ * Base-style-layer press handler — the native counterpart of the web SDK's
692
+ * `onIconClick('pois' | 'buildings')` and `onLayerClick(<admin label>)`. On
693
+ * every map press it queries the rendered features at the press point for the
694
+ * target layers and invokes `handler` with the topmost hit. Must be called
695
+ * inside `<YarrowMapView>` — extract a child component rendered as a map
696
+ * child (hooks outside the map can't see the runtime):
697
+ *
698
+ * ```tsx
699
+ * function PoiPressReporter() {
700
+ * useYarrowLayerPress('pois', ({ lat, lng, properties, selected }) => {
701
+ * console.log('POI pressed', properties.id, selected);
702
+ * });
703
+ * return null;
704
+ * }
705
+ *
706
+ * <YarrowMapView apiKey={KEY}>
707
+ * <PoiPressReporter />
708
+ * </YarrowMapView>
709
+ * ```
710
+ *
711
+ * Unlike the web SDK, targets resolve to the canonical Yarrow style layer
712
+ * ids (verified against the served `/styles/` document, identical in light
713
+ * and dark) instead of dynamic style inspection — override `layerIds` if
714
+ * your style variant names them differently.
715
+ */
716
+ function useYarrowLayerPress(target, handler, options) {
717
+ const runtime = useYarrowMapRuntime();
718
+ const targets = Array.isArray(target) ? target : [target];
719
+ const targetsKey = targets.join(",");
720
+ const handlerRef = useRef(handler);
721
+ handlerRef.current = handler;
722
+ useEffect(() => {
723
+ if (!runtime) {
724
+ console.warn("[YarrowMap] useYarrowLayerPress: no map runtime — call it inside <YarrowMapView>.");
725
+ return;
726
+ }
727
+ const layerIds = targets.flatMap((t) => options?.layerIds?.[t] ?? YARROW_CLICK_LAYER_IDS[t]);
728
+ const includesPois = targets.includes("pois");
729
+ return runtime.subscribePress((press) => {
730
+ const map = runtime.mapRef.current;
731
+ if (!map || layerIds.length === 0) return;
732
+ map.queryRenderedFeatures(press.point, { layers: layerIds }).then((features) => {
733
+ const feature = features[0];
734
+ if (!feature?.properties) return;
735
+ const properties = feature.properties;
736
+ let selected;
737
+ if (includesPois) {
738
+ const fid = properties.id;
739
+ selected = typeof fid === "number" ? runtime.highlightedPoiIds.current.has(fid) : false;
740
+ }
741
+ handlerRef.current({
742
+ lat: press.lngLat[1],
743
+ lng: press.lngLat[0],
744
+ properties,
745
+ selected
746
+ });
747
+ }).catch(() => {});
748
+ });
749
+ }, [
750
+ runtime,
751
+ targetsKey,
752
+ options?.layerIds
753
+ ]);
754
+ }
755
+
756
+ // src/hooks/useYarrowSearch.ts
757
+ /**
758
+ * Debounced, abortable search against the Yarrow search API.
759
+ *
760
+ * Requires the API key to be configured (`YarrowMapView` does this on mount;
761
+ * otherwise call `setYarrowApiKey()` first).
762
+ *
763
+ * ```tsx
764
+ * const { results, isLoading } = useYarrowSearch(query, {
765
+ * lat: position?.lat ?? 41.2995,
766
+ * lon: position?.lng ?? 69.2401,
767
+ * });
768
+ * ```
769
+ */
770
+ const useYarrowSearch = (query, options) => {
771
+ const { lat, lon, page = 1, pageSize = 15, debounceMs = 300, enabled = true } = options;
772
+ const [results, setResults] = useState([]);
773
+ const [isLoading, setIsLoading] = useState(false);
774
+ const [error, setError] = useState(null);
775
+ const latestRequestRef = useRef(0);
776
+ useEffect(() => {
777
+ const trimmed = query.trim();
778
+ if (!enabled || trimmed.length === 0) {
779
+ latestRequestRef.current += 1;
780
+ setResults([]);
781
+ setError(null);
782
+ setIsLoading(false);
783
+ return;
784
+ }
785
+ const controller = new AbortController();
786
+ const requestId = ++latestRequestRef.current;
787
+ setIsLoading(true);
788
+ const timeout = setTimeout(() => {
789
+ fetchSearchResults(trimmed, {
790
+ lat,
791
+ lon,
792
+ page,
793
+ pageSize,
794
+ signal: controller.signal
795
+ }).then((resolved) => {
796
+ if (latestRequestRef.current === requestId) {
797
+ setResults(resolved);
798
+ setError(null);
799
+ }
800
+ }).catch((caught) => {
801
+ if (controller.signal.aborted) return;
802
+ if (latestRequestRef.current === requestId) setError(caught instanceof Error ? caught : new Error(String(caught)));
803
+ }).finally(() => {
804
+ if (latestRequestRef.current === requestId) setIsLoading(false);
805
+ });
806
+ }, debounceMs);
807
+ return () => {
808
+ clearTimeout(timeout);
809
+ controller.abort();
810
+ };
811
+ }, [
812
+ query,
813
+ enabled,
814
+ lat,
815
+ lon,
816
+ page,
817
+ pageSize,
818
+ debounceMs
819
+ ]);
820
+ return {
821
+ results,
822
+ isLoading,
823
+ error
824
+ };
825
+ };
826
+
827
+ // src/hooks/useYarrowMapSearch.ts
828
+ const DEFAULT_THRESHOLD_METERS = 500;
829
+ const DEFAULT_MOVE_DEBOUNCE_MS = 250;
830
+ /**
831
+ * `useYarrowSearch` plus web-parity re-query on camera movement: when the map
832
+ * moves ≥ 500 m from where the current results were fetched for, the search
833
+ * re-runs around the new center. Must be called inside `<YarrowMapView>` to
834
+ * observe camera moves (outside one it behaves exactly like `useYarrowSearch`).
835
+ *
836
+ * ```tsx
837
+ * const { results, isLoading, center } = useYarrowMapSearch(query, {
838
+ * lat: 41.2995,
839
+ * lon: 69.2401,
840
+ * refetchOnMove: true,
841
+ * });
842
+ * <SearchResultsLayer results={results} />
843
+ * ```
844
+ */
845
+ function useYarrowMapSearch(query, options) {
846
+ const { lat, lon, refetchOnMove, ...searchOptions } = options;
847
+ const runtime = useYarrowMapRuntime();
848
+ const [center, setCenter] = useState({
849
+ lat,
850
+ lon
851
+ });
852
+ const centerRef = useRef(center);
853
+ centerRef.current = center;
854
+ const callerKey = `${lat},${lon}`;
855
+ useEffect(() => {
856
+ const [callerLat, callerLon] = callerKey.split(",").map(Number);
857
+ setCenter((current) => current.lat === callerLat && current.lon === callerLon ? current : {
858
+ lat: callerLat,
859
+ lon: callerLon
860
+ });
861
+ }, [callerKey]);
862
+ useEffect(() => {
863
+ if (!refetchOnMove || !runtime) return;
864
+ const { thresholdMeters = DEFAULT_THRESHOLD_METERS, debounceMs = DEFAULT_MOVE_DEBOUNCE_MS } = typeof refetchOnMove === "object" ? refetchOnMove : {};
865
+ let timeout = null;
866
+ const unsubscribe = runtime.subscribeRegionChange(({ center: [lng, mapLat] }) => {
867
+ if (timeout) clearTimeout(timeout);
868
+ timeout = setTimeout(() => {
869
+ timeout = null;
870
+ const current = centerRef.current;
871
+ if (haversineDistance(current.lat, current.lon, mapLat, lng) >= thresholdMeters) setCenter({
872
+ lat: mapLat,
873
+ lon: lng
874
+ });
875
+ }, debounceMs);
876
+ });
877
+ return () => {
878
+ if (timeout) clearTimeout(timeout);
879
+ unsubscribe();
880
+ };
881
+ }, [refetchOnMove, runtime]);
882
+ return {
883
+ ...useYarrowSearch(query, {
884
+ ...searchOptions,
885
+ lat: center.lat,
886
+ lon: center.lon
887
+ }),
888
+ center
889
+ };
890
+ }
891
+
892
+ // src/hooks/useYarrowRouting.ts
893
+ /**
894
+ * Headless routing state for the Yarrow routing API — pairs with
895
+ * `<RouteLayer>` for rendering.
896
+ *
897
+ * ```tsx
898
+ * const { routes, isLoading, buildRoute } = useYarrowRouting({ profile: 'driving' });
899
+ * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
900
+ * <RouteLayer routes={routes} />
901
+ * </YarrowMapView>
902
+ * ```
903
+ */
904
+ const useYarrowRouting = (options = {}) => {
905
+ const { profile = "driving", language } = options;
906
+ const [result, setResult] = useState(null);
907
+ const [isLoading, setIsLoading] = useState(false);
908
+ const [error, setError] = useState(null);
909
+ const latestRequestRef = useRef(0);
910
+ const buildRoute = useCallback(async (input) => {
911
+ const requestId = ++latestRequestRef.current;
912
+ setIsLoading(true);
913
+ setError(null);
914
+ try {
915
+ const resolved = await fetchRoutes({
916
+ profile: input.profile ?? profile,
917
+ coordinates: input.coordinates,
918
+ language: input.language ?? language,
919
+ signal: input.signal
920
+ });
921
+ if (latestRequestRef.current === requestId) setResult(resolved);
922
+ return resolved;
923
+ } catch (caught) {
924
+ if (latestRequestRef.current === requestId) setError(caught instanceof Error ? caught : new Error(String(caught)));
925
+ throw caught;
926
+ } finally {
927
+ if (latestRequestRef.current === requestId) setIsLoading(false);
928
+ }
929
+ }, [profile, language]);
930
+ const clearRoutes = useCallback(() => {
931
+ latestRequestRef.current += 1;
932
+ setResult(null);
933
+ setError(null);
934
+ setIsLoading(false);
935
+ }, []);
936
+ return {
937
+ routes: result?.features ?? [],
938
+ directions: result?.directions ?? [],
939
+ meta: result?.meta ?? null,
940
+ isLoading,
941
+ error,
942
+ buildRoute,
943
+ clearRoutes
944
+ };
945
+ };
946
+
947
+ // src/icons/YarrowImages.tsx
948
+ /**
949
+ * Adds the Yarrow icon images to the native style so symbol layers can
950
+ * resolve their `icon-image` names — the native counterpart of the web SDK's
951
+ * `addIconsToMap` prefetch plus its missing-image resolver. `Images` accepts
952
+ * remote URLs and downloads them natively; `onImageMissing` covers icons
953
+ * referenced before the registry fetch lands or after a failed fetch.
954
+ */
955
+ const YarrowImages = memo(function YarrowImages({ iconsByName, onMissingIcon }) {
956
+ const images = useMemo(() => ({ ...iconsByName }), [iconsByName]);
957
+ const handleMissing = useCallback((event) => {
958
+ const name = event.nativeEvent?.image;
959
+ if (name) onMissingIcon?.(name);
960
+ }, [onMissingIcon]);
961
+ return /* @__PURE__ */ jsx(Images, {
962
+ images,
963
+ onImageMissing: handleMissing
964
+ });
965
+ });
966
+
967
+ // src/assets/brandBadgeLogo.ts
968
+ const BRAND_BADGE_LOGO_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAi4AAACfCAYAAADeQ1ImAABmhklEQVR4nO2dB2AcxfX/v7N7Tb1Zsi1Z7r1jG7CNDTahd0JsAiTUBEJzGun5/bFTIIQkJJQECCVAIMQKndBiwBQb416wjG1Zbuq9na7uzn9m704+SVf2pNvTyZ4PnHW3tzc7OzM78+a9N29M0AGllDAo/xs4xj8Hvgs+N3A82nfB3/c8Huk7PWlG+43e/Pf8Xu93fblepN9Ey0fw933Nf8+8hLqGHvRcL1z+YzkuEAgEghMTAoFAIBAIBIJBggSBQCAQCASCQYIQXAQCgUAgEAwahOAiEAgEAoFg0CAEF4FAIBAIBIMGIbgIBAKBQCAYNAjBRSAQCAQCwaBBCC4CgUAgEAgGDUJwEQgEAoFAMGgQgotAIBAIBIJBgwnHAT23JAi1PYH/c89IwaEiB+s9FjFLOn5DYjg3ON1QqMHvQ20jEK58RDh9gUAgEAwmBmXI/6ABmWuM0sAFsNr1JrjTC5A/sQ02WyfQ4oXdbENamkJXkJrATxE7/RUqoqUXS56Ijt8pZNnDC7D49l1wucbCam2C3S7BbB6C+kMm2CuB4fMqkeFyAUM8THBxRtsHSSAQCASCZGF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3dKDqowEI5ZDCwQCgWDgBRdCqPyjrVeR7743mS+pxSCCrPjsa0gEHfVFSBLIub+4nvzq6AwMACJyrkAgEAiSbgar3jf7TRzdfgHLWdLPrhOyqeKG5yfQ56/Zh4EmNadKuq+paCCbjNhkUSAQCARJKRywAUqmv5m0FXX7ZiJZsaTWSn/sHAaDUX8zdStqS09C4uECAoFsbiQPuEcmYsl31AwFCS5CiBEIBILjm3D9fFIGgWMZVcgv987W9v+57P6b2YFg/5ekGKzINU/cjgRAEi+08Mg0lC65815W/jITWvKTQWgRCAQCwYlF8EQ12MdxUDg7+jK8imDfotPo3y54Cl73uB45D3yiEd6HOh8hztVFQsxEtbuG0t/MCF61FCmfsd5D4HwFPs1KG7nmmW9h3lWv8CCBQqMhEAgEgmRkUK/SYINrFr547Tz6r29fB3fncKhKITzOXPg0Sd7AafDdJ9X+IxE1NjTob7AgcOwvT0OSqqUH1fEwGPWxi9/F7jeWsCuqQXkK5CN83QX8g1hO/Tk2a39N1noim9pYuZWTrz78byy84TUmnDRBIBAIBIJBwnGzvDSUhiBItUSCXjToL4K+j3qJwCsRmogQeQfCa5BCoQbnM1A+QpMiEAgEgsHMCREXI97xPxI58IfIe0+hKyxCQBEIBALB8YYI6CUQCAQCgWDQkJSrigQCgUAgEAhCIQQXgUAgEAgEgwYhuAgEAoFAIBg0CMFFIBAIBALBoEEILgKBQCAQCAYNQnARCAQCgUAwaBCCi0AgEAgEgkGDEFwEAoFAIBAMGoTgIhAIBAKBYNAgBBeBQCAQCASDBiG4CAQCgUAgGDQIwUUgEAgEAsGgQQguAoFAIBAIBg1CcBEIBAKBQDBoEIKLQCAQCASCQYOJUkoYNNwJ4b7nx/nfnt+FO673u/78Nh55ifSb4O8jnROOUGXZnzyG+11/0433b/r6vUAgEAgEPfn/uHDNdswmxrsAAAAASUVORK5CYII=";
969
+
970
+ // src/maps/brandBadge.tsx
971
+ const DEFAULT_BRAND_BADGE_POSITION = "bottom-left";
972
+ const BRAND_BADGE_OFFSET_PX = 6;
973
+ const BADGE_WEB_LOGO_WIDTH_PX = 106;
974
+ const DEFAULT_BRAND_BADGE_SCALE = 1;
975
+ const LOGO_ASPECT = 53 / 186;
976
+ const BADGE_BORDER_PX = 1;
977
+ const TINT = {
978
+ light: "rgba(255, 255, 255, 0.55)",
979
+ dark: "rgba(15, 23, 42, 0.55)"
980
+ };
981
+ const normalizeBrandBadgePosition = (position) => {
982
+ switch (position) {
983
+ case "top-left":
984
+ case "top-right":
985
+ case "bottom-left":
986
+ case "bottom-right": return position;
987
+ default: return DEFAULT_BRAND_BADGE_POSITION;
988
+ }
989
+ };
990
+ const getPositionStyle = (position) => {
991
+ switch (position) {
992
+ case "top-left": return {
993
+ top: BRAND_BADGE_OFFSET_PX,
994
+ left: BRAND_BADGE_OFFSET_PX
995
+ };
996
+ case "top-right": return {
997
+ top: BRAND_BADGE_OFFSET_PX,
998
+ right: BRAND_BADGE_OFFSET_PX
999
+ };
1000
+ case "bottom-right": return {
1001
+ bottom: BRAND_BADGE_OFFSET_PX,
1002
+ right: BRAND_BADGE_OFFSET_PX
1003
+ };
1004
+ default: return {
1005
+ bottom: BRAND_BADGE_OFFSET_PX,
1006
+ left: BRAND_BADGE_OFFSET_PX
1007
+ };
1008
+ }
1009
+ };
1010
+ const styles$2 = StyleSheet.create({
1011
+ badgeDark: { borderColor: "rgba(255, 255, 255, 0.16)" },
1012
+ fill: {
1013
+ display: "flex",
1014
+ alignItems: "center",
1015
+ justifyContent: "center"
1016
+ }
1017
+ });
1018
+ const badgeStyle = (scale) => {
1019
+ const logoWidth = Math.round(BADGE_WEB_LOGO_WIDTH_PX * scale);
1020
+ const logoHeight = Math.round(logoWidth * LOGO_ASPECT);
1021
+ return {
1022
+ position: "absolute",
1023
+ zIndex: 1e3,
1024
+ width: logoWidth + Math.round(10 * scale) * 2 + 2,
1025
+ height: logoHeight + Math.round(2 * scale) * 2 + 2,
1026
+ overflow: "hidden",
1027
+ borderRadius: Math.round(16 * scale),
1028
+ borderWidth: BADGE_BORDER_PX,
1029
+ borderColor: "rgba(255, 255, 255, 0.3)"
1030
+ };
1031
+ };
1032
+ /**
1033
+ * The Yarrow brand badge as an overlay view — the RN counterpart of the web
1034
+ * SDK's `BrandBadgeController` host (same pill styles, same logo, same
1035
+ * default corner). `pointerEvents="none"` so map gestures pass through.
1036
+ *
1037
+ * The pill is a translucent tint on both platforms — see the TINT note above
1038
+ * for why native skips the web badge's backdrop blur.
1039
+ */
1040
+ function BrandBadge({ theme = "light", position, scale = 1 }) {
1041
+ const dark = theme === "dark";
1042
+ const logoWidth = Math.round(BADGE_WEB_LOGO_WIDTH_PX * scale);
1043
+ const logoHeight = Math.round(logoWidth * LOGO_ASPECT);
1044
+ const tint = dark ? TINT.dark : TINT.light;
1045
+ return /* @__PURE__ */ jsx(View, {
1046
+ testID: "yarrow-brand-badge",
1047
+ pointerEvents: "none",
1048
+ accessibilityElementsHidden: true,
1049
+ importantForAccessibility: "no-hide-descendants",
1050
+ "aria-hidden": true,
1051
+ style: [
1052
+ badgeStyle(scale),
1053
+ dark ? styles$2.badgeDark : null,
1054
+ getPositionStyle(normalizeBrandBadgePosition(position))
1055
+ ],
1056
+ children: /* @__PURE__ */ jsx(View, {
1057
+ testID: "yarrow-brand-badge-tint",
1058
+ style: [
1059
+ StyleSheet.absoluteFill,
1060
+ styles$2.fill,
1061
+ { backgroundColor: tint }
1062
+ ],
1063
+ children: /* @__PURE__ */ jsx(Image, {
1064
+ source: { uri: BRAND_BADGE_LOGO_URI },
1065
+ style: {
1066
+ width: logoWidth,
1067
+ height: logoHeight
1068
+ },
1069
+ resizeMode: "contain"
1070
+ })
1071
+ })
1072
+ });
1073
+ }
1074
+
1075
+ // src/maps/config.ts
1076
+ /**
1077
+ * Validated, defaulted RN map configuration. Mirrors the web SDK's
1078
+ * `YarrowMapConfig` minus the DOM container (the native view is sized by the
1079
+ * consuming app's layout) and minus web-only rendering options (hover,
1080
+ * clustering, controls, tile cache — none of which exist on native).
1081
+ */
1082
+ var YarrowMapConfig = class {
1083
+ constructor(config) {
1084
+ const { apiKey, center, zoom: resolvedZoom = 10, minZoom: resolvedMinZoom = 0, maxZoom: resolvedMaxZoom = 19, theme: resolvedTheme = "light", styleType: resolvedStyleType } = config;
1085
+ if (!apiKey) throw new Error("apiKey is required");
1086
+ this.center = center;
1087
+ this.zoom = resolvedZoom;
1088
+ this.minZoom = resolvedMinZoom;
1089
+ this.maxZoom = resolvedMaxZoom;
1090
+ this.theme = resolvedTheme;
1091
+ this.styleType = normalizeStyleType(resolvedStyleType);
1092
+ this.apiKey = apiKey;
1093
+ }
1094
+ };
1095
+
1096
+ // src/maps/routing/types.ts
1097
+ /** Best-route + alternatives palette — same values as the web SDK's
1098
+ * `buildRoute()` defaults (index 0 is the best route, index 1 the shared
1099
+ * alternative color). */
1100
+ const ROUTE_LAYER_COLORS = [
1101
+ "#22c55e",
1102
+ "#aaaaaa",
1103
+ "#cccccc",
1104
+ "#dddddd",
1105
+ "#eeeeee"
1106
+ ];
1107
+ /** Distinct-series palette — same values as the web SDK's `renderRoutes()`. */
1108
+ const ROUTE_COLORS = [
1109
+ "#3b82f6",
1110
+ "#10b981",
1111
+ "#f59e0b",
1112
+ "#ef4444",
1113
+ "#8b5cf6"
1114
+ ];
1115
+
1116
+ // src/maps/routing/RouteLayer.tsx
1117
+ const DEFAULT_LAYER_PREFIX = "yarrow-route";
1118
+ /** Line styling of `renderRoutes()` — web parity for the distinct series. */
1119
+ const DISTINCT_ROUTE_WIDTH = 4;
1120
+ const DISTINCT_ROUTE_OPACITY = .8;
1121
+ const toFeatureCollection = (route) => ({
1122
+ type: "FeatureCollection",
1123
+ features: [route]
1124
+ });
1125
+ /**
1126
+ * Declarative route rendering: one GeoJSON source + line layer per route.
1127
+ * Compose inside `<YarrowMapView>` and drive it with `useYarrowRouting()`:
1128
+ *
1129
+ * ```tsx
1130
+ * const { routes } = useYarrowRouting();
1131
+ * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
1132
+ * <RouteLayer routes={routes} onPressRoute={…} />
1133
+ * </YarrowMapView>
1134
+ * ```
1135
+ *
1136
+ * Pass `distinct` to render independent series instead of best-route-plus-
1137
+ * alternatives — the declarative counterpart of the web SDK's
1138
+ * `renderRoutes()`.
1139
+ */
1140
+ const RouteLayer = memo(function RouteLayer({ routes, bestIndex = 0, routeColor = ROUTE_LAYER_COLORS[0], routeWidth = 5, routeOpacity = 1, alternativeColor = ROUTE_LAYER_COLORS[1], alternativeWidth = 2.5, alternativeOpacity = .5, layerPrefix = DEFAULT_LAYER_PREFIX, onPressRoute, distinct = false }) {
1141
+ const styleFor = (index) => {
1142
+ if (distinct) return {
1143
+ color: ROUTE_COLORS[index % ROUTE_COLORS.length],
1144
+ width: DISTINCT_ROUTE_WIDTH,
1145
+ opacity: DISTINCT_ROUTE_OPACITY
1146
+ };
1147
+ const isBest = index === bestIndex;
1148
+ return {
1149
+ color: isBest ? routeColor : alternativeColor,
1150
+ width: isBest ? routeWidth : alternativeWidth,
1151
+ opacity: isBest ? routeOpacity : alternativeOpacity
1152
+ };
1153
+ };
1154
+ return routes.map((route, index) => {
1155
+ const sourceId = `${layerPrefix}-${index}`;
1156
+ const { color, width, opacity } = styleFor(index);
1157
+ return /* @__PURE__ */ jsx(GeoJSONSource, {
1158
+ id: sourceId,
1159
+ data: toFeatureCollection(route),
1160
+ onPress: onPressRoute ? (event) => onPressRoute(event, index) : void 0,
1161
+ children: /* @__PURE__ */ jsx(Layer, {
1162
+ id: `${layerPrefix}-line-${index}`,
1163
+ type: "line",
1164
+ layout: {
1165
+ "line-cap": "round",
1166
+ "line-join": "round"
1167
+ },
1168
+ paint: {
1169
+ "line-color": color,
1170
+ "line-width": width,
1171
+ "line-opacity": opacity
1172
+ }
1173
+ })
1174
+ }, sourceId);
1175
+ });
1176
+ });
1177
+
1178
+ // src/maps/styles.ts
1179
+ /**
1180
+ * Full style URL for MapLibre React Native's `mapStyle` prop, built from the
1181
+ * platform-agnostic style endpoint plus the configured API key. The key comes
1182
+ * from core's module state (`setYarrowApiKey`) — `YarrowMapView` calls it for
1183
+ * you; standalone callers must set it first.
1184
+ */
1185
+ function buildStyleUrl(styleType, theme = "light") {
1186
+ const endpoint = buildStyleEndpoint(normalizeStyleType(styleType), theme);
1187
+ return addApiKeyToUrl(`${YARROW_MAP_URL}${endpoint}`);
1188
+ }
1189
+
1190
+ // src/maps/YarrowMapView.tsx
1191
+ const assignRef = (ref, instance) => {
1192
+ if (typeof ref === "function") ref(instance);
1193
+ else if (ref) ref.current = instance;
1194
+ };
1195
+ /** Hides the API key when a style URL is echoed into an error message. */
1196
+ const redactApiKey = (url) => url.replace(/([?&])api_key=[^&]*/g, "$1api_key=***");
1197
+ /**
1198
+ * React Native Yarrow map. Renders MapLibre Native with a Yarrow style URL
1199
+ * (theme + styleType aware, API key attached) and a default camera, and
1200
+ * provides the runtime (refs, icon registry, camera/event subscriptions) to
1201
+ * the SDK layers rendered inside it.
1202
+ *
1203
+ * ```tsx
1204
+ * const mapRef = useRef<MapRef>(null);
1205
+ * <YarrowMapView
1206
+ * apiKey="YOUR_API_KEY"
1207
+ * center={[69.2401, 41.2995]} // Tashkent
1208
+ * zoom={12}
1209
+ * theme="dark"
1210
+ * onReady={(map) => map.getCenter().then(console.log)}
1211
+ * />
1212
+ * ```
1213
+ *
1214
+ * Camera props (`center`, `zoom`) apply only on mount — recenter through
1215
+ * `cameraRef` (`flyTo`, `jumpTo`, `fitBounds`). Theme and styleType changes
1216
+ * hot-swap the style URL natively.
1217
+ */
1218
+ const YarrowMapView = forwardRef(({ apiKey, center, zoom, minZoom, maxZoom, theme, styleType, onReady, onLoadError, onPress, onMoveEnd, cameraRef, attribution = false, logo = false, compass = true, brandBadgePosition, brandBadgeScale, androidView, dauTracking = true, icons = true, style, children }, ref) => {
1219
+ const config = useMemo(() => new YarrowMapConfig({
1220
+ apiKey,
1221
+ center,
1222
+ zoom,
1223
+ minZoom,
1224
+ maxZoom,
1225
+ theme,
1226
+ styleType
1227
+ }), [
1228
+ apiKey,
1229
+ center,
1230
+ zoom,
1231
+ minZoom,
1232
+ maxZoom,
1233
+ theme,
1234
+ styleType
1235
+ ]);
1236
+ const readyRef = useRef(onReady);
1237
+ readyRef.current = onReady;
1238
+ const dauTrackedRef = useRef(false);
1239
+ const mapRef = useRef(null);
1240
+ const internalCameraRef = useRef(null);
1241
+ const highlightedPoiIds = useRef(/* @__PURE__ */ new Set());
1242
+ const [iconsByName, setIconsByName] = useState({});
1243
+ const iconsFetchAttemptedRef = useRef(false);
1244
+ useEffect(() => {
1245
+ iconsFetchAttemptedRef.current = false;
1246
+ if (!icons) {
1247
+ setIconsByName({});
1248
+ return;
1249
+ }
1250
+ let cancelled = false;
1251
+ fetchYarrowIcons(config.apiKey).then((map) => {
1252
+ if (!cancelled) {
1253
+ iconsFetchAttemptedRef.current = true;
1254
+ setIconsByName(map);
1255
+ }
1256
+ }).catch((error) => {
1257
+ console.warn("[YarrowMap] icon registry fetch failed:", error);
1258
+ });
1259
+ return () => {
1260
+ cancelled = true;
1261
+ };
1262
+ }, [config.apiKey, icons]);
1263
+ const handleMissingIcon = useCallback(() => {
1264
+ if (!icons || iconsFetchAttemptedRef.current) return;
1265
+ iconsFetchAttemptedRef.current = true;
1266
+ fetchYarrowIcons(config.apiKey).then(setIconsByName).catch(() => {
1267
+ iconsFetchAttemptedRef.current = false;
1268
+ });
1269
+ }, [config.apiKey, icons]);
1270
+ const regionListeners = useRef(/* @__PURE__ */ new Set());
1271
+ const pressListeners = useRef(/* @__PURE__ */ new Set());
1272
+ const onMoveEndRef = useRef(onMoveEnd);
1273
+ onMoveEndRef.current = onMoveEnd;
1274
+ const onPressRef = useRef(onPress);
1275
+ onPressRef.current = onPress;
1276
+ const subscribeRegionChange = useCallback((listener) => {
1277
+ regionListeners.current.add(listener);
1278
+ return () => {
1279
+ regionListeners.current.delete(listener);
1280
+ };
1281
+ }, []);
1282
+ const subscribePress = useCallback((listener) => {
1283
+ pressListeners.current.add(listener);
1284
+ return () => {
1285
+ pressListeners.current.delete(listener);
1286
+ };
1287
+ }, []);
1288
+ const handleRegionDidChange = useCallback((event) => {
1289
+ const { center: lngLat, zoom: eventZoom } = event.nativeEvent;
1290
+ const [lng, lat] = lngLat;
1291
+ for (const listener of regionListeners.current) listener({
1292
+ center: [lng, lat],
1293
+ zoom: eventZoom
1294
+ });
1295
+ onMoveEndRef.current?.(lat, lng, eventZoom);
1296
+ }, []);
1297
+ const handleMapPress = useCallback((event) => {
1298
+ const lngLat = event.nativeEvent?.lngLat;
1299
+ const point = event.nativeEvent?.point;
1300
+ if (lngLat && point) {
1301
+ const press = {
1302
+ lngLat: [lngLat[0], lngLat[1]],
1303
+ point: [point[0], point[1]]
1304
+ };
1305
+ for (const listener of pressListeners.current) listener(press);
1306
+ }
1307
+ onPressRef.current?.(event);
1308
+ }, []);
1309
+ const mapStyle = useMemo(() => {
1310
+ setYarrowApiKey(config.apiKey);
1311
+ return buildStyleUrl(config.styleType, config.theme);
1312
+ }, [config]);
1313
+ const handleDidFinishLoadingMap = useCallback(() => {
1314
+ if (dauTracking && !dauTrackedRef.current) {
1315
+ dauTrackedRef.current = true;
1316
+ trackDau$1(config.apiKey, "react-native");
1317
+ }
1318
+ const map = mapRef.current;
1319
+ if (map) readyRef.current?.(map);
1320
+ }, [config.apiKey, dauTracking]);
1321
+ const handleDidFailLoadingMap = useCallback((_event) => {
1322
+ onLoadError?.(/* @__PURE__ */ new Error("Yarrow map failed to load — check the API key and network. Opening the style URL in a browser shows the underlying response: " + redactApiKey(mapStyle)));
1323
+ }, [onLoadError, mapStyle]);
1324
+ const runtime = useMemo(() => ({
1325
+ apiKey: config.apiKey,
1326
+ theme: config.theme,
1327
+ mapRef,
1328
+ cameraRef: internalCameraRef,
1329
+ iconsByName,
1330
+ highlightedPoiIds,
1331
+ subscribeRegionChange,
1332
+ subscribePress
1333
+ }), [
1334
+ config.apiKey,
1335
+ config.theme,
1336
+ iconsByName,
1337
+ subscribeRegionChange,
1338
+ subscribePress
1339
+ ]);
1340
+ return /* @__PURE__ */ jsx(YarrowMapContext.Provider, {
1341
+ value: runtime,
1342
+ children: /* @__PURE__ */ jsxs(View, {
1343
+ style: [styles$1.container, style],
1344
+ children: [/* @__PURE__ */ jsxs(Map$1, {
1345
+ ref: (instance) => {
1346
+ mapRef.current = instance;
1347
+ assignRef(ref, instance);
1348
+ },
1349
+ mapStyle,
1350
+ style: styles$1.map,
1351
+ androidView,
1352
+ attribution,
1353
+ logo,
1354
+ compass,
1355
+ onPress: handleMapPress,
1356
+ onRegionDidChange: handleRegionDidChange,
1357
+ onDidFinishLoadingMap: handleDidFinishLoadingMap,
1358
+ onDidFailLoadingMap: handleDidFailLoadingMap,
1359
+ children: [
1360
+ /* @__PURE__ */ jsx(Camera, {
1361
+ ref: (instance) => {
1362
+ internalCameraRef.current = instance;
1363
+ assignRef(cameraRef, instance);
1364
+ },
1365
+ initialViewState: {
1366
+ center: config.center,
1367
+ zoom: config.zoom
1368
+ },
1369
+ minZoom: config.minZoom,
1370
+ maxZoom: config.maxZoom
1371
+ }),
1372
+ icons ? /* @__PURE__ */ jsx(YarrowImages, {
1373
+ iconsByName,
1374
+ onMissingIcon: handleMissingIcon
1375
+ }) : null,
1376
+ children
1377
+ ]
1378
+ }), /* @__PURE__ */ jsx(BrandBadge, {
1379
+ theme: config.theme,
1380
+ position: brandBadgePosition,
1381
+ scale: brandBadgeScale
1382
+ })]
1383
+ })
1384
+ });
1385
+ });
1386
+ const styles$1 = StyleSheet.create({
1387
+ container: { flex: 1 },
1388
+ map: { flex: 1 }
1389
+ });
1390
+
1391
+ // src/markers/HighlightMarkerView.tsx
1392
+ const ENTER_MS = 280;
1393
+ const EXIT_MS = 200;
1394
+ const DEFAULT_ICON_SIZE = 56;
1395
+ /**
1396
+ * The animated icon+label marker shared by `<PoiHighlightLayer>` and
1397
+ * `<SearchResultsLayer>` — the native counterpart of the web SDK's
1398
+ * `createMarkerElement` + enter/exit CSS transitions. The scale/fade runs on
1399
+ * an inner view (never on the `Marker` itself, which the map repositions
1400
+ * every frame).
1401
+ */
1402
+ const HighlightMarkerView = memo(function HighlightMarkerView({ lngLat, iconUrl, title, iconSize, leaving = false, onPress }) {
1403
+ const progress = useRef(new Animated.Value(0)).current;
1404
+ useEffect(() => {
1405
+ Animated.timing(progress, {
1406
+ toValue: leaving ? 0 : 1,
1407
+ duration: leaving ? EXIT_MS : ENTER_MS,
1408
+ useNativeDriver: true
1409
+ }).start();
1410
+ }, [progress, leaving]);
1411
+ const [width, height] = iconSize ? Array.isArray(iconSize) ? iconSize : [iconSize, iconSize] : [DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE];
1412
+ return /* @__PURE__ */ jsx(Marker, {
1413
+ lngLat,
1414
+ anchor: "center",
1415
+ onPress: onPress ? () => onPress() : void 0,
1416
+ children: /* @__PURE__ */ jsxs(Animated.View, {
1417
+ style: [styles.inner, {
1418
+ transform: [{ scale: progress }],
1419
+ opacity: progress
1420
+ }],
1421
+ children: [iconUrl ? /* @__PURE__ */ jsx(Image, {
1422
+ source: { uri: iconUrl },
1423
+ style: {
1424
+ width,
1425
+ height
1426
+ },
1427
+ resizeMode: "contain"
1428
+ }) : /* @__PURE__ */ jsx(View, { style: styles.dot }), title ? /* @__PURE__ */ jsx(View, {
1429
+ style: styles.titleWrap,
1430
+ pointerEvents: "none",
1431
+ children: /* @__PURE__ */ jsx(Text, {
1432
+ style: styles.title,
1433
+ children: title
1434
+ })
1435
+ }) : null]
1436
+ })
1437
+ });
1438
+ });
1439
+ const styles = StyleSheet.create({
1440
+ inner: {
1441
+ alignItems: "center",
1442
+ opacity: 0
1443
+ },
1444
+ dot: {
1445
+ width: 18,
1446
+ height: 18,
1447
+ borderRadius: 9,
1448
+ backgroundColor: "#2f80ed",
1449
+ borderWidth: 3,
1450
+ borderColor: "#ffffff"
1451
+ },
1452
+ titleWrap: {
1453
+ position: "absolute",
1454
+ top: "100%",
1455
+ width: "100%",
1456
+ alignItems: "center"
1457
+ },
1458
+ title: {
1459
+ marginTop: 3,
1460
+ maxWidth: 200,
1461
+ fontSize: 15,
1462
+ lineHeight: 18,
1463
+ fontWeight: "600",
1464
+ color: "#1a1a1a",
1465
+ textAlign: "center",
1466
+ textShadowColor: "#ffffff",
1467
+ textShadowRadius: 3,
1468
+ textShadowOffset: {
1469
+ width: 0,
1470
+ height: 0
1471
+ }
1472
+ }
1473
+ });
1474
+
1475
+ // src/markers/YarrowMarker.tsx
1476
+ /**
1477
+ * Declarative counterpart of the web SDK's `addMarker()` / `removeMarker()`.
1478
+ * Mounting places the marker, unmounting removes it; the React lifecycle
1479
+ * replaces the imperative manager pair.
1480
+ *
1481
+ * ```tsx
1482
+ * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
1483
+ * <YarrowMarker lngLat={[69.2401, 41.2995]} onPress={() => …}>
1484
+ * <PinIcon />
1485
+ * </YarrowMarker>
1486
+ * </YarrowMapView>
1487
+ * ```
1488
+ */
1489
+ const YarrowMarker = memo(function YarrowMarker({ lngLat, anchor = "bottom", offset, onPress, children }) {
1490
+ return /* @__PURE__ */ jsx(Marker, {
1491
+ lngLat,
1492
+ anchor,
1493
+ offset,
1494
+ onPress: onPress ? () => onPress() : void 0,
1495
+ children
1496
+ });
1497
+ });
1498
+
1499
+ // src/navigation/useYarrowCamera.ts
1500
+ const MIN_DIMENSION_DEGREES = .003;
1501
+ const DEFAULT_PADDING = 50;
1502
+ const DEFAULT_DURATION_MS = 1e3;
1503
+ /**
1504
+ * Web-parity camera helpers on top of a `CameraRef`. Reads the enclosing
1505
+ * `<YarrowMapView>` camera when called inside the map; otherwise pass a ref:
1506
+ *
1507
+ * ```tsx
1508
+ * const cameraRef = useRef<CameraRef>(null);
1509
+ * <YarrowMapView apiKey={KEY} cameraRef={cameraRef}>…</YarrowMapView>
1510
+ * const camera = useYarrowCamera(cameraRef);
1511
+ * camera.zoomTo(41.2995, 69.2401, 14);
1512
+ * ```
1513
+ */
1514
+ function useYarrowCamera(cameraRefInput) {
1515
+ const runtime = useYarrowMapRuntime();
1516
+ const cameraRef = cameraRefInput ?? runtime?.cameraRef ?? null;
1517
+ return useMemo(() => {
1518
+ const getCamera = () => cameraRef?.current ?? null;
1519
+ return {
1520
+ zoomTo(lat, lng, zoom, options) {
1521
+ const camera = getCamera();
1522
+ if (!camera) return;
1523
+ camera.flyTo({
1524
+ center: [lng, lat],
1525
+ zoom,
1526
+ ...options?.duration !== void 0 ? { duration: options.duration } : {}
1527
+ });
1528
+ },
1529
+ fitBounds(data, options) {
1530
+ const camera = getCamera();
1531
+ if (!camera) return;
1532
+ const box = getBoundingBox(data);
1533
+ const padding = options?.padding ?? DEFAULT_PADDING;
1534
+ const duration = options?.duration ?? DEFAULT_DURATION_MS;
1535
+ if (Math.abs(box.xMax - box.xMin) < MIN_DIMENSION_DEGREES) {
1536
+ box.xMin -= MIN_DIMENSION_DEGREES / 2;
1537
+ box.xMax += MIN_DIMENSION_DEGREES / 2;
1538
+ }
1539
+ if (Math.abs(box.yMax - box.yMin) < MIN_DIMENSION_DEGREES) {
1540
+ box.yMin -= MIN_DIMENSION_DEGREES / 2;
1541
+ box.yMax += MIN_DIMENSION_DEGREES / 2;
1542
+ }
1543
+ camera.fitBounds([
1544
+ box.xMin,
1545
+ box.yMin,
1546
+ box.xMax,
1547
+ box.yMax
1548
+ ], {
1549
+ padding: {
1550
+ top: padding,
1551
+ right: padding,
1552
+ bottom: padding,
1553
+ left: padding
1554
+ },
1555
+ duration
1556
+ });
1557
+ },
1558
+ getBoundingBox(data) {
1559
+ return getBoundingBox(data);
1560
+ }
1561
+ };
1562
+ }, [cameraRef]);
1563
+ }
1564
+
1565
+ // src/offline/estimate.ts
1566
+ /**
1567
+ * Web-Mercator latitude limit — tiles outside it don't exist.
1568
+ */
1569
+ const MAX_LAT = 85.05112878;
1570
+ /**
1571
+ * Rough bytes per downloaded `z/x/y` tile, empirically measured from a
1572
+ * Tashkent z14 tile: ≈64 KB × ~8 sources carrying data ≈ 0.5 MB. A region's
1573
+ * true size depends on the style's source count and local data density —
1574
+ * pass `avgTileBytes` for a tighter estimate.
1575
+ */
1576
+ const AVG_TILE_BYTES = 5e5;
1577
+ /**
1578
+ * Bounds must not cross the antimeridian — `west < east` strictly. Regions
1579
+ * spanning ±180° need two downloads or a shifted projection.
1580
+ */
1581
+ const validateBounds = (bounds) => {
1582
+ if (!Array.isArray(bounds) || bounds.length !== 4 || !bounds.every((value) => typeof value === "number" && Number.isFinite(value))) throw new Error("bounds must be [west, south, east, north] with four finite numbers");
1583
+ const [west, south, east, north] = bounds;
1584
+ if (west < -180 || west > 180 || east < -180 || east > 180) throw new Error("bounds longitudes must be within [-180, 180]");
1585
+ if (south < -85.05112878 || south > MAX_LAT || north < -85.05112878 || north > MAX_LAT) throw new Error(`bounds latitudes must be within [-85.05112878, ${MAX_LAT}]`);
1586
+ if (west >= east) throw new Error("bounds west longitude must be less than east");
1587
+ if (south >= north) throw new Error("bounds south latitude must be less than north");
1588
+ };
1589
+ const validateZoomRange = (minZoom, maxZoom) => {
1590
+ if (!Number.isFinite(minZoom) || !Number.isFinite(maxZoom) || minZoom < 0 || maxZoom > 22 || minZoom > maxZoom) throw new Error("zoom range must satisfy 0 <= minZoom <= maxZoom <= 22");
1591
+ };
1592
+ const lngToWorldX = (lng, zoom) => {
1593
+ return (Math.min(180, Math.max(-180, lng)) + 180) / 360 * 2 ** zoom;
1594
+ };
1595
+ const latToWorldY = (lat, zoom) => {
1596
+ const radians = Math.min(MAX_LAT, Math.max(-85.05112878, lat)) * Math.PI / 180;
1597
+ return (1 - Math.log(Math.tan(radians) + 1 / Math.cos(radians)) / Math.PI) / 2 * 2 ** zoom;
1598
+ };
1599
+ /** Unique `z/x/y` tiles covering the bounds at one zoom level. */
1600
+ const countTilesAtZoom = (bounds, zoom) => {
1601
+ const [west, south, east, north] = bounds;
1602
+ const maxTile = 2 ** zoom - 1;
1603
+ const clamp = (index) => Math.min(maxTile, Math.max(0, index));
1604
+ const x0 = clamp(Math.floor(lngToWorldX(west, zoom)));
1605
+ const x1 = clamp(Math.floor(lngToWorldX(east, zoom)));
1606
+ const y0 = clamp(Math.floor(latToWorldY(north, zoom)));
1607
+ const y1 = clamp(Math.floor(latToWorldY(south, zoom)));
1608
+ return (x1 - x0 + 1) * (y1 - y0 + 1);
1609
+ };
1610
+ /**
1611
+ * Estimates the download/storage cost of an offline region — pure tile math,
1612
+ * no native calls. Tile counts are exact for the XYZ scheme; byte estimates
1613
+ * are rough (see `AVG_TILE_BYTES`).
1614
+ *
1615
+ * ```ts
1616
+ * const { tileCount, estSizeBytes } = estimateRegion({
1617
+ * bounds: [69.15, 41.2, 69.4, 41.4], // Tashkent
1618
+ * minZoom: 8,
1619
+ * maxZoom: 15,
1620
+ * });
1621
+ * ```
1622
+ */
1623
+ const estimateRegion = (input) => {
1624
+ validateBounds(input.bounds);
1625
+ const { bounds, avgTileBytes = AVG_TILE_BYTES, minZoom, maxZoom } = input;
1626
+ validateZoomRange(minZoom, maxZoom);
1627
+ const tilesPerLevel = [];
1628
+ let tileCount = 0;
1629
+ for (let zoom = Math.floor(minZoom); zoom <= Math.ceil(maxZoom); zoom++) {
1630
+ const tiles = countTilesAtZoom(bounds, zoom);
1631
+ tilesPerLevel.push({
1632
+ zoom,
1633
+ tiles
1634
+ });
1635
+ tileCount += tiles;
1636
+ }
1637
+ return {
1638
+ tileCount,
1639
+ estSizeBytes: tileCount * avgTileBytes,
1640
+ tilesPerLevel
1641
+ };
1642
+ };
1643
+
1644
+ // src/offline/types.ts
1645
+ /** Default minimum zoom for offline regions. */
1646
+ const DEFAULT_OFFLINE_MIN_ZOOM = 8;
1647
+ /** Default maximum zoom for offline regions. */
1648
+ const DEFAULT_OFFLINE_MAX_ZOOM = 15;
1649
+ /** Schema version of the pack metadata this SDK writes. */
1650
+ const OFFLINE_METADATA_VERSION = 1;
1651
+
1652
+ // src/offline/manager.ts
1653
+ const DAY_MS = MILLISECONDS_PER_DAY;
1654
+ const stripId = (status) => {
1655
+ const { id: _id, ...progress } = status;
1656
+ return progress;
1657
+ };
1658
+ /** Reads pack status, treating bridge-level absence (Android resolves null
1659
+ * for unknown ids — e.g. after `resetDatabase` without an app restart) as
1660
+ * `null` instead of a crash. */
1661
+ const statusOrNull = async (pack) => {
1662
+ try {
1663
+ return await pack.status() ?? null;
1664
+ } catch {
1665
+ return null;
1666
+ }
1667
+ };
1668
+ const notFoundError = (name, regionId) => {
1669
+ const error = /* @__PURE__ */ new Error(`Offline region "${name}" is no longer available natively — resetDatabase() requires an app restart to clear the JS cache.`);
1670
+ error.code = "not-found";
1671
+ error.regionId = regionId;
1672
+ return error;
1673
+ };
1674
+ const asYarrowMetadata = (pack) => {
1675
+ const meta = pack.metadata;
1676
+ if (!meta || meta.v !== 1 || typeof meta.name !== "string") return null;
1677
+ return meta;
1678
+ };
1679
+ const classifyError = (raw, regionId) => {
1680
+ const message = raw instanceof Error ? raw.message : typeof raw === "string" ? raw : "Unknown offline error";
1681
+ let code = "unknown";
1682
+ if (/tile (count )?limit|tile limit exceeded/i.test(message)) code = "tile-count-limit-exceeded";
1683
+ else if (/too large|region exceeds/i.test(message)) code = "region-too-large";
1684
+ else if (/disk|storage|space/i.test(message)) code = "disk";
1685
+ else if (/not\s*found/i.test(message)) code = "not-found";
1686
+ else if (/network|connection|offline|unreachable|timeout|resolve|host/i.test(message)) code = "network";
1687
+ const error = new Error(message);
1688
+ error.code = code;
1689
+ if (regionId) error.regionId = regionId;
1690
+ return error;
1691
+ };
1692
+ /**
1693
+ * Offline region manager for React Native — a Yarrow-flavoured wrapper around
1694
+ * MapLibre React Native's `OfflineManager`.
1695
+ *
1696
+ * The web SDK's `yarrowcache` protocol cannot exist on native (no
1697
+ * `addProtocol`), so offline support here is region packs: pick a bounding
1698
+ * box and zoom range, download it once, and the map renders from the native
1699
+ * offline database with no network.
1700
+ *
1701
+ * ```ts
1702
+ * const offline = new YarrowOfflineManager({ apiKey: 'YOUR_API_KEY' });
1703
+ * const { tileCount, estSizeBytes } = offline.estimateRegion({
1704
+ * bounds: [69.15, 41.2, 69.4, 41.4], // Tashkent
1705
+ * minZoom: 8,
1706
+ * maxZoom: 15,
1707
+ * });
1708
+ * const region = await offline.downloadRegion({
1709
+ * name: 'tashkent-city',
1710
+ * bounds: [69.15, 41.2, 69.4, 41.4],
1711
+ * maxAgeDays: 30,
1712
+ * onProgress: (p) => console.log(`${p.percentage}%`),
1713
+ * });
1714
+ * await region.done;
1715
+ * ```
1716
+ */
1717
+ var YarrowOfflineManager = class {
1718
+ constructor(options) {
1719
+ this.activeDownloads = /* @__PURE__ */ new Map();
1720
+ if (!options.apiKey) throw new Error("apiKey is required");
1721
+ this.apiKey = options.apiKey;
1722
+ setYarrowApiKey(this.apiKey);
1723
+ }
1724
+ /**
1725
+ * Pure tile-math estimate of a region's download/storage cost — no native
1726
+ * calls. See `estimateRegion` for the math and caveats.
1727
+ */
1728
+ estimateRegion(input) {
1729
+ return estimateRegion(input);
1730
+ }
1731
+ /**
1732
+ * Starts (or resumes) a region download. Resolves with a handle once the
1733
+ * pack is created and downloading — progress arrives via `options.onProgress`
1734
+ * and `handle.done` settles with the outcome.
1735
+ *
1736
+ * Idempotent by `name`: an existing matching region is returned as-is
1737
+ * (resumed when incomplete); a name reused with different parameters throws
1738
+ * a `params-mismatch` error. Pass `force: true` to delete and re-download.
1739
+ */
1740
+ async downloadRegion(options) {
1741
+ const name = options.name?.trim();
1742
+ if (!name) throw new Error("name is required");
1743
+ const bounds = options.bounds;
1744
+ validateBounds(bounds);
1745
+ const minZoom = options.minZoom ?? 8;
1746
+ const maxZoom = options.maxZoom ?? 15;
1747
+ validateZoomRange(minZoom, maxZoom);
1748
+ const styleType = normalizeStyleType(options.styleType);
1749
+ const theme = options.theme === "dark" ? "dark" : "light";
1750
+ await this.hydrate();
1751
+ const existing = await this.findRegionPacks(name);
1752
+ const target = existing.find((pack) => pack.meta.styleType === styleType && pack.meta.theme === theme);
1753
+ if (target && !options.force) {
1754
+ const mismatches = this.findParamMismatches(target.meta, {
1755
+ bounds,
1756
+ minZoom,
1757
+ maxZoom,
1758
+ maxAgeDays: options.maxAgeDays ?? null
1759
+ });
1760
+ if (mismatches.length > 0) {
1761
+ const error = /* @__PURE__ */ new Error(`Region "${name}" already exists with different ${mismatches.join(", ")}. Use a different name or pass force: true to re-download.`);
1762
+ error.code = "params-mismatch";
1763
+ error.regionId = target.pack.id;
1764
+ throw error;
1765
+ }
1766
+ return this.reattachExisting(target, { resumeIfIncomplete: true });
1767
+ }
1768
+ if (existing.length > 0 && !options.force) {
1769
+ const styles = existing.map(({ meta }) => `${meta.styleType}/${meta.theme}`).join(", ");
1770
+ const error = /* @__PURE__ */ new Error(`Region "${name}" is pinned to ${styles}. Use a different name or pass force: true to replace it.`);
1771
+ error.code = "params-mismatch";
1772
+ throw error;
1773
+ }
1774
+ for (const { pack } of existing) await this.deletePack(pack.id);
1775
+ setYarrowApiKey(this.apiKey);
1776
+ const metadata = {
1777
+ v: 1,
1778
+ name,
1779
+ styleType,
1780
+ theme,
1781
+ bounds,
1782
+ minZoom,
1783
+ maxZoom,
1784
+ maxAgeDays: options.maxAgeDays ?? null,
1785
+ createdAt: Date.now(),
1786
+ ...options.metadata ? { user: options.metadata } : {}
1787
+ };
1788
+ let settle = () => {};
1789
+ const done = new Promise((resolve, reject) => {
1790
+ settle = ({ progress, error }) => {
1791
+ if (error) reject(error);
1792
+ else if (progress) resolve(progress);
1793
+ };
1794
+ });
1795
+ const routeProgress = (_pack, status) => {
1796
+ const progress = stripId(status);
1797
+ if (status.state === "complete") {
1798
+ this.activeDownloads.delete(_pack.id);
1799
+ settle({ progress });
1800
+ } else options.onProgress?.(progress);
1801
+ };
1802
+ const routeError = (_pack, raw) => {
1803
+ this.activeDownloads.delete(_pack.id);
1804
+ const error = classifyError(raw.message, _pack.id);
1805
+ options.onError?.(error);
1806
+ settle({ error });
1807
+ };
1808
+ try {
1809
+ const pack = await OfflineManager.createPack({
1810
+ mapStyle: buildStyleUrl(styleType, theme),
1811
+ bounds,
1812
+ minZoom,
1813
+ maxZoom,
1814
+ metadata
1815
+ }, routeProgress, routeError);
1816
+ this.activeDownloads.set(pack.id, { done });
1817
+ const status = await statusOrNull(pack);
1818
+ if (status?.state === "complete") {
1819
+ OfflineManager.removeListener(pack.id);
1820
+ this.activeDownloads.delete(pack.id);
1821
+ settle({ progress: stripId(status) });
1822
+ }
1823
+ return this.toHandle(pack, metadata, done);
1824
+ } catch (caught) {
1825
+ throw classifyError(caught);
1826
+ }
1827
+ }
1828
+ /** Lists regions created through this SDK (native packs created directly
1829
+ * against `OfflineManager` are not included), newest first. */
1830
+ async listRegions() {
1831
+ const packs = await OfflineManager.getPacks();
1832
+ const summaries = [];
1833
+ for (const pack of packs) {
1834
+ const meta = asYarrowMetadata(pack);
1835
+ if (!meta) continue;
1836
+ const status = await statusOrNull(pack);
1837
+ if (!status) continue;
1838
+ summaries.push({
1839
+ id: pack.id,
1840
+ name: meta.name,
1841
+ styleType: meta.styleType,
1842
+ theme: meta.theme,
1843
+ bounds: meta.bounds,
1844
+ minZoom: meta.minZoom,
1845
+ maxZoom: meta.maxZoom,
1846
+ status: status.state,
1847
+ percentage: status.percentage,
1848
+ completedTileSize: status.completedTileSize,
1849
+ userMetadata: meta.user,
1850
+ isStale: meta.maxAgeDays !== null && Date.now() - meta.createdAt > meta.maxAgeDays * DAY_MS,
1851
+ createdAt: meta.createdAt
1852
+ });
1853
+ }
1854
+ return summaries.sort((a, b) => b.createdAt - a.createdAt);
1855
+ }
1856
+ /** Returns the handle for a region by name, or `null`. */
1857
+ async getRegion(name) {
1858
+ const entry = (await this.findRegionPacks(name.trim()))[0];
1859
+ if (!entry) return null;
1860
+ return this.reattachExisting(entry);
1861
+ }
1862
+ /** Ambient cache (seen-tiles LRU) max size in bytes. May erase resources
1863
+ * when shrinking — call once at app startup. `0` disables the cache. */
1864
+ async setAmbientCacheSize(size) {
1865
+ await OfflineManager.setMaximumAmbientCacheSize(size);
1866
+ }
1867
+ /** Revalidates ambient-cache tiles against the server — the recommended
1868
+ * way to refresh cached data. */
1869
+ async invalidateAmbientCache() {
1870
+ await OfflineManager.invalidateAmbientCache();
1871
+ }
1872
+ /** Erases ambient-cache resources. Computationally expensive. */
1873
+ async clearAmbientCache() {
1874
+ await OfflineManager.clearAmbientCache();
1875
+ }
1876
+ /** Maximum number of tiles offline packs may store. Raise it when large
1877
+ * regions fail with a `tile-count-limit-exceeded` error. */
1878
+ setTileCountLimit(limit) {
1879
+ OfflineManager.setTileCountLimit(limit);
1880
+ }
1881
+ /** Download status event throttle in ms. Platform-defined default (300 ms
1882
+ * today on both iOS and Android). Note errors bypass the throttle. */
1883
+ setProgressEventThrottle(ms) {
1884
+ OfflineManager.setProgressEventThrottle(ms);
1885
+ }
1886
+ /** Deletes the offline database (ambient cache + packs), then
1887
+ * reinitializes it. Destructive — and MLRN's JS pack cache only clears
1888
+ * on app restart, so subsequent reads may hit stale ids (guarded as
1889
+ * `not-found`). Prefer per-region `invalidate`/`delete`. */
1890
+ async resetDatabase() {
1891
+ await OfflineManager.resetDatabase();
1892
+ }
1893
+ async hydrate() {
1894
+ await OfflineManager.getPacks();
1895
+ }
1896
+ async findRegionPacks(name) {
1897
+ return (await OfflineManager.getPacks()).map((pack) => ({
1898
+ pack,
1899
+ meta: asYarrowMetadata(pack)
1900
+ })).filter((entry) => entry.meta !== null && entry.meta.name === name);
1901
+ }
1902
+ findParamMismatches(meta, params) {
1903
+ const mismatches = [];
1904
+ if (!(meta.bounds.length === params.bounds.length && meta.bounds.every((value, index) => value === params.bounds[index]))) mismatches.push("bounds");
1905
+ if (meta.minZoom !== params.minZoom) mismatches.push("minZoom");
1906
+ if (meta.maxZoom !== params.maxZoom) mismatches.push("maxZoom");
1907
+ if (meta.maxAgeDays !== params.maxAgeDays) mismatches.push("maxAgeDays");
1908
+ return mismatches;
1909
+ }
1910
+ /** Attaches listeners to a pack that may have outlived the JS layer
1911
+ * (created in a previous app session) and builds a fresh handle.
1912
+ *
1913
+ * Deliberately cautious: it never hijacks a download this session owns,
1914
+ * never attaches listeners to packs that don't need them, and — on
1915
+ * Android, where attaching an observer *activates* the region — never
1916
+ * wakes a paused pack unless the caller explicitly asked for a download. */
1917
+ async reattachExisting(entry, { resumeIfIncomplete = false } = {}) {
1918
+ const { pack, meta } = entry;
1919
+ const known = this.activeDownloads.get(pack.id);
1920
+ if (known) return this.toHandle(pack, meta, known.done);
1921
+ const status = await statusOrNull(pack);
1922
+ if (!status) throw notFoundError(meta.name, pack.id);
1923
+ if (status.state === "complete") return this.toHandle(pack, meta, Promise.resolve(stripId(status)));
1924
+ let settle = () => {};
1925
+ const done = new Promise((resolve, reject) => {
1926
+ settle = ({ progress, error }) => {
1927
+ if (error) reject(error);
1928
+ else if (progress) resolve(progress);
1929
+ };
1930
+ });
1931
+ const routeProgress = (_pack, progressEvent) => {
1932
+ if (progressEvent.state === "complete") settle({ progress: stripId(progressEvent) });
1933
+ };
1934
+ const routeError = (_pack, raw) => {
1935
+ settle({ error: classifyError(raw.message, pack.id) });
1936
+ };
1937
+ if (status.state === "active" || resumeIfIncomplete) {
1938
+ OfflineManager.addListener(pack.id, routeProgress, routeError);
1939
+ if (status.state !== "active") await pack.resume();
1940
+ }
1941
+ return this.toHandle(pack, meta, done);
1942
+ }
1943
+ toHandle(pack, meta, done) {
1944
+ return {
1945
+ id: pack.id,
1946
+ name: meta.name,
1947
+ done,
1948
+ refreshStatus: async () => {
1949
+ const status = await statusOrNull(pack);
1950
+ if (!status) throw notFoundError(meta.name, pack.id);
1951
+ return stripId(status);
1952
+ },
1953
+ pause: () => pack.pause(),
1954
+ resume: () => pack.resume(),
1955
+ invalidate: async () => {
1956
+ await OfflineManager.invalidatePack(pack.id);
1957
+ },
1958
+ delete: async () => {
1959
+ await this.deletePack(pack.id);
1960
+ }
1961
+ };
1962
+ }
1963
+ async deletePack(id) {
1964
+ try {
1965
+ await OfflineManager.deletePack(id);
1966
+ } catch (caught) {
1967
+ throw classifyError(caught, id);
1968
+ } finally {
1969
+ this.activeDownloads.delete(id);
1970
+ }
1971
+ }
1972
+ };
1973
+
1974
+ // src/offline/hook.ts
1975
+ /**
1976
+ * Offline region state for settings/offline screens — pairs with
1977
+ * `YarrowOfflineManager`. Polls the native layer while downloads run, so
1978
+ * `regions` (and progress bars) stay current.
1979
+ *
1980
+ * ```tsx
1981
+ * const { regions, download, remove } = useYarrowOfflineRegions({ apiKey });
1982
+ * await download({ name: 'tashkent', bounds: [69.15, 41.2, 69.4, 41.4] });
1983
+ * ```
1984
+ */
1985
+ const useYarrowOfflineRegions = (options) => {
1986
+ const { apiKey, pollMs = 1e3 } = options;
1987
+ const [regions, setRegions] = useState([]);
1988
+ const [isLoading, setIsLoading] = useState(true);
1989
+ const [error, setError] = useState(null);
1990
+ const managerRef = useRef(null);
1991
+ const getManager = useCallback(() => {
1992
+ const cached = managerRef.current;
1993
+ if (cached && cached.key === apiKey) return cached.manager;
1994
+ const manager = new YarrowOfflineManager({ apiKey });
1995
+ managerRef.current = {
1996
+ key: apiKey,
1997
+ manager
1998
+ };
1999
+ return manager;
2000
+ }, [apiKey]);
2001
+ const recordError = useCallback((caught) => {
2002
+ const error = caught instanceof Error ? caught : new Error(String(caught));
2003
+ setError(error);
2004
+ return error;
2005
+ }, []);
2006
+ const refresh = useCallback(async () => {
2007
+ try {
2008
+ setRegions(await getManager().listRegions());
2009
+ setError(null);
2010
+ } catch (caught) {
2011
+ recordError(caught);
2012
+ }
2013
+ }, [getManager, recordError]);
2014
+ useEffect(() => {
2015
+ if (!apiKey) {
2016
+ setIsLoading(false);
2017
+ return;
2018
+ }
2019
+ let cancelled = false;
2020
+ (async () => {
2021
+ setIsLoading(true);
2022
+ try {
2023
+ const summaries = await getManager().listRegions();
2024
+ if (!cancelled) {
2025
+ setRegions(summaries);
2026
+ setError(null);
2027
+ }
2028
+ } catch (caught) {
2029
+ if (!cancelled) recordError(caught);
2030
+ } finally {
2031
+ if (!cancelled) setIsLoading(false);
2032
+ }
2033
+ })();
2034
+ return () => {
2035
+ cancelled = true;
2036
+ };
2037
+ }, [
2038
+ apiKey,
2039
+ getManager,
2040
+ recordError
2041
+ ]);
2042
+ const hasActive = regions.some((region) => region.status === "active");
2043
+ useEffect(() => {
2044
+ if (!hasActive) return;
2045
+ const timer = setInterval(() => {
2046
+ refresh();
2047
+ }, pollMs);
2048
+ return () => clearInterval(timer);
2049
+ }, [
2050
+ hasActive,
2051
+ pollMs,
2052
+ refresh
2053
+ ]);
2054
+ const download = useCallback(async (downloadOptions) => {
2055
+ try {
2056
+ const handle = await getManager().downloadRegion(downloadOptions);
2057
+ await refresh();
2058
+ return handle;
2059
+ } catch (caught) {
2060
+ throw recordError(caught);
2061
+ }
2062
+ }, [
2063
+ getManager,
2064
+ recordError,
2065
+ refresh
2066
+ ]);
2067
+ const withRegion = useCallback(async (name, run) => {
2068
+ try {
2069
+ const handle = await getManager().getRegion(name.trim());
2070
+ if (!handle) {
2071
+ const error = /* @__PURE__ */ new Error(`Offline region "${name}" not found`);
2072
+ error.code = "not-found";
2073
+ throw error;
2074
+ }
2075
+ await run(handle);
2076
+ await refresh();
2077
+ } catch (caught) {
2078
+ throw recordError(caught);
2079
+ }
2080
+ }, [
2081
+ getManager,
2082
+ recordError,
2083
+ refresh
2084
+ ]);
2085
+ return {
2086
+ regions,
2087
+ isLoading,
2088
+ error,
2089
+ refresh,
2090
+ download,
2091
+ pause: (name) => withRegion(name, (handle) => handle.pause()),
2092
+ resume: (name) => withRegion(name, (handle) => handle.resume()),
2093
+ invalidate: (name) => withRegion(name, (handle) => handle.invalidate()),
2094
+ remove: (name) => withRegion(name, (handle) => handle.delete())
2095
+ };
2096
+ };
2097
+
2098
+ // src/clustering/usePixelClusters.ts
2099
+ const REGION_DEBOUNCE_MS = 120;
2100
+ /**
2101
+ * Clusters marker points by screen distance — the runtime counterpart of the
2102
+ * web SDK's `PoiClusterController`. Native MapLibre can only cluster GeoJSON
2103
+ * *sources*, not marker views, so this re-projects the points on every map
2104
+ * move and regroups them: members of a group large enough (`minPoints`) are
2105
+ * hidden and replaced by a single count badge.
2106
+ *
2107
+ * Recompute runs when the points/config change and (debounced) on every map
2108
+ * move; badges are keyed by their first member id so React reuses them
2109
+ * across recomputes instead of flickering.
2110
+ */
2111
+ function usePixelClusters(points, config, runtime) {
2112
+ const normalized = useMemo(() => normalizeClusteringConfig(config), [config]);
2113
+ const [clusters, setClusters] = useState([]);
2114
+ const [clusteredIds, setClusteredIds] = useState(() => /* @__PURE__ */ new Set());
2115
+ const debounceRef = useRef(null);
2116
+ const runIdRef = useRef(0);
2117
+ const pointsRef = useRef(points);
2118
+ pointsRef.current = points;
2119
+ const pointsKey = useMemo(() => points.map((p) => `${p.id}:${p.lng},${p.lat}`).join("|"), [points]);
2120
+ useEffect(() => {
2121
+ const mapRef = runtime?.mapRef;
2122
+ if (!mapRef) {
2123
+ setClusters([]);
2124
+ setClusteredIds(/* @__PURE__ */ new Set());
2125
+ return;
2126
+ }
2127
+ const recompute = async () => {
2128
+ const map = mapRef.current;
2129
+ const current = pointsRef.current;
2130
+ if (!(normalized.enabled && map != null && current.length >= normalized.minPoints) || !map) {
2131
+ runIdRef.current += 1;
2132
+ setClusters([]);
2133
+ setClusteredIds(/* @__PURE__ */ new Set());
2134
+ return;
2135
+ }
2136
+ let zoom;
2137
+ try {
2138
+ zoom = await map.getZoom();
2139
+ } catch {
2140
+ return;
2141
+ }
2142
+ if (zoom > normalized.maxZoom) {
2143
+ runIdRef.current += 1;
2144
+ setClusters([]);
2145
+ setClusteredIds(/* @__PURE__ */ new Set());
2146
+ return;
2147
+ }
2148
+ const runId = ++runIdRef.current;
2149
+ const projected = await Promise.all(current.map(async (point) => {
2150
+ const pixel = await map.project([point.lng, point.lat]);
2151
+ return {
2152
+ point,
2153
+ x: pixel[0],
2154
+ y: pixel[1]
2155
+ };
2156
+ }));
2157
+ if (runId !== runIdRef.current) return;
2158
+ const nextClusters = [];
2159
+ const nextIds = /* @__PURE__ */ new Set();
2160
+ for (const group of groupByPixelRadius(projected, normalized.radius)) {
2161
+ if (group.length < normalized.minPoints) continue;
2162
+ const members = group.map((g) => g.point);
2163
+ let sumLng = 0;
2164
+ let sumLat = 0;
2165
+ for (const m of members) {
2166
+ sumLng += m.lng;
2167
+ sumLat += m.lat;
2168
+ nextIds.add(m.id);
2169
+ }
2170
+ nextClusters.push({
2171
+ key: members[0]?.id ?? 0,
2172
+ lng: sumLng / members.length,
2173
+ lat: sumLat / members.length,
2174
+ members: members.map((m) => ({
2175
+ id: m.id,
2176
+ lng: m.lng,
2177
+ lat: m.lat
2178
+ }))
2179
+ });
2180
+ }
2181
+ setClusters(nextClusters);
2182
+ setClusteredIds(nextIds);
2183
+ };
2184
+ recompute();
2185
+ const unsubscribe = runtime.subscribeRegionChange(() => {
2186
+ if (debounceRef.current) clearTimeout(debounceRef.current);
2187
+ debounceRef.current = setTimeout(() => {
2188
+ debounceRef.current = null;
2189
+ recompute();
2190
+ }, REGION_DEBOUNCE_MS);
2191
+ });
2192
+ return () => {
2193
+ unsubscribe();
2194
+ if (debounceRef.current) {
2195
+ clearTimeout(debounceRef.current);
2196
+ debounceRef.current = null;
2197
+ }
2198
+ };
2199
+ }, [
2200
+ runtime,
2201
+ normalized,
2202
+ pointsKey
2203
+ ]);
2204
+ return {
2205
+ clusters,
2206
+ clusteredIds
2207
+ };
2208
+ }
2209
+
2210
+ // src/utils/useExitAnimation.ts
2211
+ /**
2212
+ * Duration of the marker exit animation: 200 ms of visible ease-out (web
2213
+ * parity) plus a small buffer before the marker unmounts.
2214
+ */
2215
+ const EXIT_ANIMATION_MS = 220;
2216
+ /**
2217
+ * Tracks ids that left an "active" list so their exit animation can play
2218
+ * before unmount — the declarative replacement of the web SDK's
2219
+ * `animateOutMarker`. Returns the active ids unchanged and the ids that are
2220
+ * currently animating out; a caller renders those with a `leaving` flag and
2221
+ * keeps their last-resolved data until the animation finishes.
2222
+ *
2223
+ * Each removed id gets its own timer (per-id map, not one shared timeout), so
2224
+ * removing A and then B within the window removes both when their own timers
2225
+ * fire, and an id that comes back before its timer fires stops leaving
2226
+ * immediately.
2227
+ */
2228
+ function useExitAnimation(ids, exitMs = 220) {
2229
+ const [leavingIds, setLeavingIds] = useState([]);
2230
+ const prevRef = useRef(ids);
2231
+ const timersRef = useRef(/* @__PURE__ */ new Map());
2232
+ useEffect(() => {
2233
+ const prevSet = new Set(prevRef.current);
2234
+ prevRef.current = ids;
2235
+ const activeSet = new Set(ids);
2236
+ for (const id of activeSet) {
2237
+ const timer = timersRef.current.get(id);
2238
+ if (timer !== void 0) {
2239
+ clearTimeout(timer);
2240
+ timersRef.current.delete(id);
2241
+ }
2242
+ }
2243
+ for (const id of prevSet) {
2244
+ if (activeSet.has(id) || timersRef.current.has(id)) continue;
2245
+ timersRef.current.set(id, setTimeout(() => {
2246
+ timersRef.current.delete(id);
2247
+ setLeavingIds((current) => {
2248
+ if (!current.includes(id)) return current;
2249
+ return current.filter((x) => x !== id);
2250
+ });
2251
+ }, exitMs));
2252
+ }
2253
+ setLeavingIds((current) => {
2254
+ const pending = [...timersRef.current.keys()];
2255
+ if (pending.length === current.length) {
2256
+ const currentSet = new Set(current);
2257
+ if (pending.every((id) => currentSet.has(id))) return current;
2258
+ }
2259
+ return pending;
2260
+ });
2261
+ }, [ids, exitMs]);
2262
+ useEffect(() => {
2263
+ const timers = timersRef.current;
2264
+ return () => {
2265
+ for (const timer of timers.values()) clearTimeout(timer);
2266
+ timers.clear();
2267
+ };
2268
+ }, []);
2269
+ const activeSet = useMemo(() => new Set(ids), [ids]);
2270
+ return {
2271
+ activeIds: ids,
2272
+ leavingIds: useMemo(() => leavingIds.filter((id) => !activeSet.has(id)), [leavingIds, activeSet])
2273
+ };
2274
+ }
2275
+
2276
+ // src/poiHighlight/PoiHighlightLayer.tsx
2277
+ const DEFAULT_PAN_ZOOM = 13;
2278
+ /** Milliseconds after an exit before an id's resolved data is pruned. */
2279
+ const EXIT_PRUNE_MS = 250;
2280
+ /**
2281
+ * Declarative counterpart of the web SDK's `highlightPOI()`: renders an
2282
+ * animated icon+label marker for each highlighted POI id, resolving each id
2283
+ * cheapest-first (caller data → rendered tiles → place-detail API).
2284
+ * Highlight state is owned by the `ids` prop (or
2285
+ * `useYarrowPoiHighlight().highlightedIds`); removing an id plays the exit
2286
+ * animation and unmounts the marker.
2287
+ *
2288
+ * Known native limitation (documented in the README): the base style's own
2289
+ * POI icon is not hidden behind the highlight marker — native has no runtime
2290
+ * `setFilter`, so the marker simply draws on top of it.
2291
+ *
2292
+ * ```tsx
2293
+ * <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
2294
+ * <PoiHighlightLayer ids={[123]} dataById={{ 123: { location } }} panTo />
2295
+ * </YarrowMapView>
2296
+ * ```
2297
+ */
2298
+ function PoiHighlightLayer({ ids, dataById, iconSize, panTo = false, zoom, clustering, onHighlightPress, onResolveError }) {
2299
+ const runtime = useYarrowMapRuntime();
2300
+ const camera = useYarrowCamera();
2301
+ const idList = useMemo(() => {
2302
+ return [...new Set(Array.isArray(ids) ? ids : [ids])];
2303
+ }, [ids]);
2304
+ const { activeIds, leavingIds } = useExitAnimation(idList);
2305
+ const [resolved, setResolved] = useState({});
2306
+ const resolveCacheRef = useRef(/* @__PURE__ */ new Map());
2307
+ const failedIdsRef = useRef(/* @__PURE__ */ new Set());
2308
+ const dataByIdRef = useRef(dataById);
2309
+ dataByIdRef.current = dataById;
2310
+ const onResolveErrorRef = useRef(onResolveError);
2311
+ onResolveErrorRef.current = onResolveError;
2312
+ const resolveOnce = useMemo(() => (id) => {
2313
+ if (!runtime) return Promise.resolve(null);
2314
+ const pending = resolveCacheRef.current.get(id);
2315
+ if (pending) return pending;
2316
+ const promise = resolvePoiData(id, dataByIdRef.current?.[id] ?? {}, runtime).then((result) => {
2317
+ if (result === null) {
2318
+ if (resolveCacheRef.current.get(id) === promise) resolveCacheRef.current.delete(id);
2319
+ onResolveErrorRef.current?.(id);
2320
+ }
2321
+ return result;
2322
+ });
2323
+ resolveCacheRef.current.set(id, promise);
2324
+ return promise;
2325
+ }, [runtime]);
2326
+ useEffect(() => {
2327
+ if (!runtime) return;
2328
+ let cancelled = false;
2329
+ for (const id of activeIds) {
2330
+ if (resolved[id] !== void 0 || failedIdsRef.current.has(id)) continue;
2331
+ resolveOnce(id).then((data) => {
2332
+ if (cancelled) return;
2333
+ if (!data) {
2334
+ failedIdsRef.current.add(id);
2335
+ return;
2336
+ }
2337
+ setResolved((current) => current[id] !== void 0 ? current : {
2338
+ ...current,
2339
+ [id]: data
2340
+ });
2341
+ });
2342
+ }
2343
+ return () => {
2344
+ cancelled = true;
2345
+ };
2346
+ }, [
2347
+ runtime,
2348
+ activeIds,
2349
+ resolved,
2350
+ resolveOnce
2351
+ ]);
2352
+ useEffect(() => {
2353
+ const failed = failedIdsRef.current;
2354
+ for (const id of [...failed]) if (!idList.includes(id)) failed.delete(id);
2355
+ }, [idList]);
2356
+ useEffect(() => {
2357
+ if (!runtime) return;
2358
+ const registry = runtime.highlightedPoiIds.current;
2359
+ if (!registry) return;
2360
+ const next = new Set(activeIds);
2361
+ let changed = registry.size !== next.size;
2362
+ if (!changed) {
2363
+ for (const id of next) if (!registry.has(id)) {
2364
+ changed = true;
2365
+ break;
2366
+ }
2367
+ }
2368
+ if (changed) runtime.highlightedPoiIds.current = next;
2369
+ }, [runtime, activeIds]);
2370
+ useEffect(() => {
2371
+ if (leavingIds.length === 0) return;
2372
+ const timers = leavingIds.map((id) => setTimeout(() => {
2373
+ setResolved((current) => {
2374
+ if (current[id] === void 0) return current;
2375
+ const next = { ...current };
2376
+ delete next[id];
2377
+ return next;
2378
+ });
2379
+ resolveCacheRef.current.delete(id);
2380
+ }, EXIT_PRUNE_MS));
2381
+ return () => {
2382
+ for (const timer of timers) clearTimeout(timer);
2383
+ };
2384
+ }, [leavingIds]);
2385
+ const points = useMemo(() => activeIds.flatMap((id) => {
2386
+ const data = resolved[id];
2387
+ return data ? [{
2388
+ id,
2389
+ lng: data.lng,
2390
+ lat: data.lat
2391
+ }] : [];
2392
+ }), [activeIds, resolved]);
2393
+ const { clusters, clusteredIds } = usePixelClusters(points, clustering, runtime);
2394
+ const panToKey = panTo ? idList.join(",") : "";
2395
+ useEffect(() => {
2396
+ if (!panToKey || !runtime) return;
2397
+ let cancelled = false;
2398
+ const idsToPan = panToKey.split(",").map(Number);
2399
+ (async () => {
2400
+ const places = (await Promise.all(idsToPan.map((id) => resolveOnce(id)))).filter((p) => p !== null);
2401
+ if (cancelled || places.length === 0) return;
2402
+ const [first] = places;
2403
+ if (!first) return;
2404
+ if (places.length === 1) {
2405
+ const currentZoom = await runtime.mapRef.current?.getZoom().catch(() => null);
2406
+ const targetZoom = zoom ?? Math.max(DEFAULT_PAN_ZOOM, currentZoom ?? DEFAULT_PAN_ZOOM);
2407
+ camera.zoomTo(first.lat, first.lng, targetZoom);
2408
+ return;
2409
+ }
2410
+ camera.fitBounds({
2411
+ type: "FeatureCollection",
2412
+ features: places.map((p) => ({ geometry: {
2413
+ type: "Point",
2414
+ coordinates: [p.lng, p.lat]
2415
+ } }))
2416
+ });
2417
+ })();
2418
+ return () => {
2419
+ cancelled = true;
2420
+ };
2421
+ }, [
2422
+ panToKey,
2423
+ zoom,
2424
+ runtime,
2425
+ camera,
2426
+ resolveOnce
2427
+ ]);
2428
+ const handleClusterPress = (children) => {
2429
+ let zoomToExpand = true;
2430
+ if (clustering && typeof clustering === "object") {
2431
+ if (clustering.onClusterClick?.(children) === false) zoomToExpand = false;
2432
+ }
2433
+ if (!zoomToExpand || children.length === 0) return;
2434
+ camera.fitBounds({
2435
+ type: "FeatureCollection",
2436
+ features: children.map((c) => ({ geometry: {
2437
+ type: "Point",
2438
+ coordinates: [c.lng, c.lat]
2439
+ } }))
2440
+ });
2441
+ };
2442
+ if (!runtime) return null;
2443
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2444
+ activeIds.map((id) => {
2445
+ const data = resolved[id];
2446
+ if (!data || clusteredIds.has(id)) return null;
2447
+ return /* @__PURE__ */ jsx(HighlightMarkerView, {
2448
+ lngLat: [data.lng, data.lat],
2449
+ iconUrl: data.iconUrl,
2450
+ title: data.title,
2451
+ iconSize,
2452
+ onPress: () => onHighlightPress?.({
2453
+ id,
2454
+ lng: data.lng,
2455
+ lat: data.lat,
2456
+ title: data.title,
2457
+ iconUrl: data.iconUrl
2458
+ })
2459
+ }, id);
2460
+ }),
2461
+ leavingIds.map((id) => {
2462
+ const data = resolved[id];
2463
+ if (!data) return null;
2464
+ return /* @__PURE__ */ jsx(HighlightMarkerView, {
2465
+ lngLat: [data.lng, data.lat],
2466
+ iconUrl: data.iconUrl,
2467
+ title: data.title,
2468
+ iconSize,
2469
+ leaving: true
2470
+ }, `leaving-${id}`);
2471
+ }),
2472
+ clusters.map((cluster) => /* @__PURE__ */ jsx(ClusterBadge, {
2473
+ lngLat: [cluster.lng, cluster.lat],
2474
+ count: cluster.members.length,
2475
+ theme: runtime.theme,
2476
+ onPress: () => handleClusterPress(cluster.members)
2477
+ }, cluster.key))
2478
+ ] });
2479
+ }
2480
+
2481
+ // src/poiHighlight/useYarrowPoiHighlight.ts
2482
+ /**
2483
+ * Headless highlight state — the declarative counterpart of the web SDK's
2484
+ * `highlightPOI` / `resetPOIHighlight` / `isPOIHighlighted` /
2485
+ * `getHighlightedPOIs` quartet. Rendering is owned by `<PoiHighlightLayer>`:
2486
+ *
2487
+ * ```tsx
2488
+ * const { highlightedIds, highlight } = useYarrowPoiHighlight();
2489
+ * <YarrowMapView apiKey={KEY}>
2490
+ * <PoiHighlightLayer ids={highlightedIds} panTo />
2491
+ * </YarrowMapView>
2492
+ * ```
2493
+ */
2494
+ function useYarrowPoiHighlight() {
2495
+ const [highlightedIds, setHighlightedIds] = useState([]);
2496
+ const reset = useCallback((input) => {
2497
+ setHighlightedIds((current) => {
2498
+ if (input === void 0) return [];
2499
+ const remove = new Set(Array.isArray(input) ? input : [input]);
2500
+ return current.filter((id) => !remove.has(id));
2501
+ });
2502
+ }, []);
2503
+ const highlight = useCallback((input, options) => {
2504
+ const ids = Array.isArray(input) ? input : [input];
2505
+ setHighlightedIds((current) => {
2506
+ const next = [...options?.replace ? [] : current];
2507
+ for (const id of ids) if (!next.includes(id)) next.push(id);
2508
+ return next;
2509
+ });
2510
+ return ids.map((id) => ({
2511
+ id,
2512
+ remove: () => reset(id)
2513
+ }));
2514
+ }, [reset]);
2515
+ const isHighlighted = useCallback((id) => highlightedIds.includes(id), [highlightedIds]);
2516
+ return useMemo(() => ({
2517
+ highlightedIds,
2518
+ highlight,
2519
+ reset,
2520
+ isHighlighted
2521
+ }), [
2522
+ highlightedIds,
2523
+ highlight,
2524
+ reset,
2525
+ isHighlighted
2526
+ ]);
2527
+ }
2528
+
2529
+ // src/search/SearchResultsLayer.tsx
2530
+ /**
2531
+ * Renders search results on the map — the declarative counterpart of the web
2532
+ * SDK's `highlightSearchResults()`. Icon precedence per result:
2533
+ * `icon_img` → registry icon by `category.name` → blue-dot fallback.
2534
+ *
2535
+ * ```tsx
2536
+ * const { results, isLoading } = useYarrowSearch(query, { lat, lon });
2537
+ * <YarrowMapView apiKey={KEY}>
2538
+ * <SearchResultsLayer results={results} onResultPress={…} />
2539
+ * </YarrowMapView>
2540
+ * ```
2541
+ */
2542
+ function SearchResultsLayer({ results, iconSize, zoomToResults = true, fitKey, clustering, onResultPress }) {
2543
+ const runtime = useYarrowMapRuntime();
2544
+ const camera = useYarrowCamera();
2545
+ const markers = useMemo(() => {
2546
+ const keyed = [];
2547
+ const seen = /* @__PURE__ */ new Set();
2548
+ results.forEach((result) => {
2549
+ const { latitude, longitude } = result;
2550
+ if (typeof latitude !== "number" || typeof longitude !== "number") return;
2551
+ const id = result.id;
2552
+ let key;
2553
+ if (id !== void 0 && !seen.has(id)) key = id;
2554
+ else key = `idx:${keyed.length}`;
2555
+ seen.add(key);
2556
+ keyed.push({
2557
+ key,
2558
+ result,
2559
+ lng: longitude,
2560
+ lat: latitude
2561
+ });
2562
+ });
2563
+ return keyed;
2564
+ }, [results]);
2565
+ const points = useMemo(() => markers.map((m) => ({
2566
+ id: m.key,
2567
+ lng: m.lng,
2568
+ lat: m.lat
2569
+ })), [markers]);
2570
+ useEffect(() => {
2571
+ if (results.length > 0 && markers.length === 0) console.warn(`[YarrowMap] SearchResultsLayer: ${results.length} result(s) returned, none with displayable coordinates`);
2572
+ }, [results, markers]);
2573
+ const { clusters, clusteredIds } = usePixelClusters(points, clustering, runtime);
2574
+ const fittedRef = useRef(false);
2575
+ const lastFitKeyRef = useRef(fitKey);
2576
+ if (lastFitKeyRef.current !== fitKey) {
2577
+ lastFitKeyRef.current = fitKey;
2578
+ fittedRef.current = false;
2579
+ }
2580
+ const firstCoords = useMemo(() => {
2581
+ const [first] = markers;
2582
+ return first ? `${first.lat},${first.lng}` : null;
2583
+ }, [markers]);
2584
+ useEffect(() => {
2585
+ if (!zoomToResults || !runtime || fittedRef.current) return;
2586
+ if (!firstCoords) return;
2587
+ fittedRef.current = true;
2588
+ camera.fitBounds({
2589
+ type: "FeatureCollection",
2590
+ features: markers.map((m) => ({
2591
+ geometry: {
2592
+ type: "Point",
2593
+ coordinates: [m.lng, m.lat]
2594
+ },
2595
+ properties: { name: m.result.name }
2596
+ }))
2597
+ });
2598
+ }, [
2599
+ firstCoords,
2600
+ zoomToResults,
2601
+ runtime,
2602
+ camera,
2603
+ markers
2604
+ ]);
2605
+ const handleClusterPress = (children) => {
2606
+ let zoomToExpand = true;
2607
+ if (clustering && typeof clustering === "object") {
2608
+ if (clustering.onClusterClick?.(children) === false) zoomToExpand = false;
2609
+ }
2610
+ if (!zoomToExpand || children.length === 0) return;
2611
+ camera.fitBounds({
2612
+ type: "FeatureCollection",
2613
+ features: children.map((c) => ({ geometry: {
2614
+ type: "Point",
2615
+ coordinates: [c.lng, c.lat]
2616
+ } }))
2617
+ });
2618
+ };
2619
+ if (!runtime) return null;
2620
+ return /* @__PURE__ */ jsxs(Fragment, { children: [markers.map(({ key, result, lng, lat }) => {
2621
+ if (clusteredIds.has(key)) return null;
2622
+ const iconUrl = result.icon_img ?? resolveCategoryIcon(runtime.iconsByName, result.category?.name);
2623
+ return /* @__PURE__ */ jsx(HighlightMarkerView, {
2624
+ lngLat: [lng, lat],
2625
+ iconUrl: typeof iconUrl === "string" ? iconUrl : void 0,
2626
+ title: result.name,
2627
+ iconSize,
2628
+ onPress: () => onResultPress?.(lat, lng, result)
2629
+ }, key);
2630
+ }), clusters.map((cluster) => /* @__PURE__ */ jsx(ClusterBadge, {
2631
+ lngLat: [cluster.lng, cluster.lat],
2632
+ count: cluster.members.length,
2633
+ theme: runtime.theme,
2634
+ onPress: () => handleClusterPress(cluster.members)
2635
+ }, cluster.key))] });
2636
+ }
2637
+
2638
+ // src/tracking/dau.ts
2639
+ /**
2640
+ * DAU tracking for the RN SDK — wraps the platform-agnostic core
2641
+ * implementation with the RN default `sdk_type: "react-native"`. Core's own
2642
+ * default (`'javascript'`) exists for the web SDK and would misattribute
2643
+ * direct calls from React Native apps, so this wrapper owns the RN default.
2644
+ * `<YarrowMapView>` passes the key from its own config (see `dauTracking`).
2645
+ */
2646
+ function trackDau(apiKey, sdkType = "react-native") {
2647
+ trackDau$1(apiKey, sdkType);
2648
+ }
2649
+
2650
+ // src/utils/userToken.ts
2651
+ /**
2652
+ * Bridges the async AsyncStorage API onto core's synchronous TokenStorage
2653
+ * contract: the existing token hydrates into memory once, reads are served
2654
+ * synchronously from that cache, and writes mirror in-memory before flushing
2655
+ * to AsyncStorage (fire-and-forget).
2656
+ *
2657
+ * If the initial read throws, the override is left unset entirely: core then
2658
+ * degrades to ephemeral tokens *without persisting anything*, so a transient
2659
+ * read failure can never overwrite the stored identity with a fresh token.
2660
+ *
2661
+ * Await this once during app startup, before the first map or tracking call
2662
+ * (tokens generated before this resolves are ephemeral by design):
2663
+ *
2664
+ * ```ts
2665
+ * import AsyncStorage from '@react-native-async-storage/async-storage';
2666
+ * import { setAsyncStorageTokenStorage } from '@yarrow-uz/rn-map-sdk';
2667
+ *
2668
+ * await setAsyncStorageTokenStorage(AsyncStorage);
2669
+ * ```
2670
+ */
2671
+ async function setAsyncStorageTokenStorage(storage) {
2672
+ let existing;
2673
+ try {
2674
+ existing = await storage.getItem(USER_TOKEN_STORAGE_KEY);
2675
+ } catch {
2676
+ return;
2677
+ }
2678
+ const cache = /* @__PURE__ */ new Map();
2679
+ if (existing) cache.set(USER_TOKEN_STORAGE_KEY, existing);
2680
+ setTokenStorage({
2681
+ getItem: (key) => cache.get(key) ?? null,
2682
+ setItem: (key, value) => {
2683
+ cache.set(key, value);
2684
+ Promise.resolve(storage.setItem(key, value)).catch(() => {});
2685
+ }
2686
+ });
2687
+ }
2688
+
2689
+ export { buildStyleEndpoint as $, fetchPlaceLocation as A, ClusterBadge as B, useYarrowMapSearch as C, YarrowMapContext as D, useYarrowLayerPress as E, DEFAULT_CLUSTER_MAX_ZOOM as F, ICON_CACHE_NAME as G, CACHE_PROTOCOL as H, DEFAULT_CLUSTER_MIN_POINTS as I, TILE_CACHE_NAME as J, MILLISECONDS_PER_DAY as K, DEFAULT_CLUSTER_RADIUS_PX as L, resolvePoiData as M, fetchYarrowIcons as N, useYarrowMapRuntime as O, resolveCategoryIcon as P, addApiKeyToUrl as Q, groupByPixelRadius as R, useYarrowRouting as S, YARROW_CLICK_LAYER_IDS as T, DEFAULT_CACHE_LIFESPAN_DAYS as U, CACHED_AT_HEADER as V, ICONS_ENDPOINT as W, YARROW_MAP_URL as X, USER_TOKEN_STORAGE_KEY as Y, YARROW_SEARCH_API_URL as Z, buildStyleUrl as _, PoiHighlightLayer as a, getYarrowApiKey as at, DEFAULT_BRAND_BADGE_SCALE as b, DEFAULT_OFFLINE_MAX_ZOOM as c, normalizeStyleType as ct, AVG_TILE_BYTES as d, transformRouteCoordinates as dt, fetchArrayBufferWithCache as et, estimateRegion as f, YarrowMapView as g, HighlightMarkerView as h, useYarrowPoiHighlight as i, getOrCreateUserToken as it, lookupPoiInViewport as j, POI_BASE_LAYER as k, DEFAULT_OFFLINE_MIN_ZOOM as l, setTokenStorage as lt, YarrowMarker as m, trackDau as n, fetchSearchResults as nt, useYarrowOfflineRegions as o, hasCacheStorage as ot, useYarrowCamera as p, ROUTE_API_URL as q, SearchResultsLayer as r, getBoundingBox as rt, YarrowOfflineManager as s, haversineDistance as st, setAsyncStorageTokenStorage as t, fetchRoutes as tt, OFFLINE_METADATA_VERSION as u, setYarrowApiKey as ut, RouteLayer as v, useYarrowSearch as w, YarrowImages as x, YarrowMapConfig as y, normalizeClusteringConfig as z };