import { type LatLngLike } from "../geo.js"; export interface SearchResult { name: string; center: LatLngLike; description?: string; bbox?: unknown; properties?: Record; } export interface SearchContext { limit?: number; signal?: AbortSignal; center?: LatLngLike; [key: string]: unknown; } export interface SearchAdapter { search(query: string, context: SearchContext): Promise | TResult[] | null | undefined; geocode?(query: string, context: SearchContext): Promise | TResult | null | undefined; reverse?(center: LatLngLike, context: SearchContext): Promise | TResult | null | undefined; } /** * What `reverse()` should do when the adapter implements no reverse geocoding. * `"none"` (default) reports the missing capability as `null`. `"coordinates"` restores the * older behaviour: a synthetic result whose `name` is the formatted latitude/longitude, which * is useful for a UI field but is not a reverse-geocoded place. */ export type ReverseFallback = "none" | "coordinates"; export interface SearchProviderConfig { limit?: number; fallbackReverse?: ReverseFallback; } export declare class SearchProvider { readonly adapter: SearchAdapter; readonly limit: number; readonly fallbackReverse: ReverseFallback; constructor(adapter: SearchAdapter, options?: SearchProviderConfig); search(query: string, context?: SearchContext): Promise; geocode(query: string, context?: SearchContext): Promise; /** * `null` means "no reverse-geocoded place" — including the case where the adapter has no * `reverse()` at all. An unsupported capability stays observable instead of being dressed up * as a successful lookup; opt into the coordinate placeholder with `fallbackReverse`. */ reverse(center: LatLngLike, context?: SearchContext): Promise; } export declare function createSearchProvider(adapter: SearchAdapter, options?: SearchProviderConfig): SearchProvider; export declare function createArraySearchProvider(items: TResult[], options?: SearchProviderConfig & { text?: (item: TResult) => string; }): SearchProvider; export type SearchProviderSource = SearchAdapter | TResult[]; export type SearchProviderOptions = SearchProviderConfig & { text?: (item: TResult) => string; }; export declare function searchProvider(source: TResult[], options?: SearchProviderOptions): SearchProvider; export declare function searchProvider(source: SearchAdapter, options?: SearchProviderConfig): SearchProvider; //# sourceMappingURL=search.d.ts.map