import VectorTileWorkerSource from './vector_tile_worker_source';
import type { WorkerTileParameters, WorkerTileCallback } from '../source/worker_source';
import type Actor from '../util/actor';
import type StyleLayerIndex from '../style/style_layer_index';
import type { RequestParameters, ResponseCallback } from '../util/ajax';
import type { Callback } from '../types/callback';
export declare type LoadGeoJSONParameters = {
    request?: RequestParameters;
    data?: string;
    source: string;
    cluster: boolean;
    superclusterOptions?: any;
    geojsonVtOptions?: any;
    clusterProperties?: any;
    filter?: Array<unknown>;
};
export declare type LoadGeoJSON = (params: LoadGeoJSONParameters, callback: ResponseCallback<any>) => void;
export interface GeoJSONIndex {
    getTile(z: number, x: number, y: number): any;
    getClusterExpansionZoom(clusterId: number): number;
    getChildren(clusterId: number): Array<GeoJSON.Feature>;
    getLeaves(clusterId: number, limit: number, offset: number): Array<GeoJSON.Feature>;
}
export declare type SourceState = // Source empty or data loaded
'Idle' | // Data finished loading, but discard 'loadData' messages until receiving 'coalesced'
'Coalescing' | 'NeedsLoadData';
/**
 * The {@link WorkerSource} implementation that supports {@link GeoJSONSource}.
 * This class is designed to be easily reused to support custom source types
 * for data formats that can be parsed/converted into an in-memory GeoJSON
 * representation.  To do so, create it with
 * `new GeoJSONWorkerSource(actor, layerIndex, customLoadGeoJSONFunction)`.
 * For a full example, see [mapbox-gl-topojson](https://github.com/developmentseed/mapbox-gl-topojson).
 *
 * @private
 */
declare class GeoJSONWorkerSource extends VectorTileWorkerSource {
    _state: SourceState;
    _pendingCallback: Callback<{
        resourceTiming?: {
            [_: string]: Array<PerformanceResourceTiming>;
        };
        abandoned?: boolean;
    }>;
    _pendingLoadDataParams: LoadGeoJSONParameters;
    _geoJSONIndex: GeoJSONIndex;
    /**
     * @param [loadGeoJSON] Optional method for custom loading/parsing of
     * GeoJSON based on parameters passed from the main-thread Source.
     * See {@link GeoJSONWorkerSource#loadGeoJSON}.
     * @private
     */
    constructor(actor: Actor, layerIndex: StyleLayerIndex, availableImages: Array<string>, loadGeoJSON?: LoadGeoJSON | null);
    /**
     * Fetches (if appropriate), parses, and index geojson data into tiles. This
     * preparatory method must be called before {@link GeoJSONWorkerSource#loadTile}
     * can correctly serve up tiles.
     *
     * Defers to {@link GeoJSONWorkerSource#loadGeoJSON} for the fetching/parsing,
     * expecting `callback(error, data)` to be called with either an error or a
     * parsed GeoJSON object.
     *
     * When `loadData` requests come in faster than they can be processed,
     * they are coalesced into a single request using the latest data.
     * See {@link GeoJSONWorkerSource#coalesce}
     *
     * @param params
     * @param callback
     * @private
     */
    loadData(params: LoadGeoJSONParameters, callback: Callback<{
        resourceTiming?: {
            [_: string]: Array<PerformanceResourceTiming>;
        };
        abandoned?: boolean;
    }>): void;
    /**
     * Internal implementation: called directly by `loadData`
     * or by `coalesce` using stored parameters.
     */
    _loadData(): void;
    /**
     * While processing `loadData`, we coalesce all further
     * `loadData` messages into a single call to _loadData
     * that will happen once we've finished processing the
     * first message. {@link GeoJSONSource#_updateWorkerData}
     * is responsible for sending us the `coalesce` message
     * at the time it receives a response from `loadData`
     *
     *          State: Idle
     *          ↑          |
     *     'coalesce'   'loadData'
     *          |     (triggers load)
     *          |          ↓
     *        State: Coalescing
     *          ↑          |
     *   (triggers load)   |
     *     'coalesce'   'loadData'
     *          |          ↓
     *        State: NeedsLoadData
     */
    coalesce(): void;
    /**
    * Implements {@link WorkerSource#reloadTile}.
    *
    * If the tile is loaded, uses the implementation in VectorTileWorkerSource.
    * Otherwise, such as after a setData() call, we load the tile fresh.
    *
    * @param params
    * @param params.uid The UID for this tile.
    * @private
    */
    reloadTile(params: WorkerTileParameters, callback: WorkerTileCallback): void;
    /**
     * Fetch and parse GeoJSON according to the given params.  Calls `callback`
     * with `(err, data)`, where `data` is a parsed GeoJSON object.
     *
     * GeoJSON is loaded and parsed from `params.url` if it exists, or else
     * expected as a literal (string or object) `params.data`.
     *
     * @param params
     * @param [params.url] A URL to the remote GeoJSON data.
     * @param [params.data] Literal GeoJSON data. Must be provided if `params.url` is not.
     * @private
     */
    loadGeoJSON(params: LoadGeoJSONParameters, callback: ResponseCallback<any>): void;
    removeSource(params: {
        source: string;
    }, callback: WorkerTileCallback): void;
    getClusterExpansionZoom(params: {
        clusterId: number;
    }, callback: Callback<number>): void;
    getClusterChildren(params: {
        clusterId: number;
    }, callback: Callback<Array<GeoJSON.Feature>>): void;
    getClusterLeaves(params: {
        clusterId: number;
        limit: number;
        offset: number;
    }, callback: Callback<Array<GeoJSON.Feature>>): void;
}
export default GeoJSONWorkerSource;
//# sourceMappingURL=geojson_worker_source.d.ts.map