import type EsriMap from "@arcgis/core/Map";
import type WebScene from "@arcgis/core/WebScene";
import Collection from "@arcgis/core/core/Collection";
import type SpatialReference from "@arcgis/core/geometry/SpatialReference";
import type Layer from "@arcgis/core/layers/Layer";
import type PortalItem from "@arcgis/core/portal/PortalItem";
import type { EntityBaseProperties } from "../Entity.js";
import { EntityBase } from "../Entity.js";
import type { FeatureSource } from "../data/FeatureSource.js";
import type { TableExtensionProperties } from "../data/TableExtension.js";
import { TableExtension } from "../data/TableExtension.js";
import { type WebMapJson } from "../json/WebMapJson.js";
import { type WebSceneJson } from "../json/WebSceneJson.js";
import type { LayerPresetProperties } from "../layer-preset/LayerPreset.js";
import { LayerPreset } from "../layer-preset/LayerPreset.js";
import type { MenuProperties } from "../menus/Menu.js";
import { Menu } from "../menus/Menu.js";
import type { Action } from "../support/Action.js";
import type { ArcGISRequestHelper } from "../support/ArcGISRequestHelper.js";
import type { FormatSettingsProperties } from "../support/FormatSettings.js";
import { FormatSettings } from "../support/FormatSettings.js";
import type { InitializableBase, InitializableBaseEvents } from "../support/InitializableBase.js";
import type { InitializableCollection } from "../support/InitializableCollectionProxy.js";
import type { PropertyDefs } from "../support/Serializable.js";
import type { SublayerLike } from "../support/esri.js";
import type { PortalItemLike } from "../utilities/portal.js";
import type { BasemapExtensionProperties } from "./BasemapExtension.js";
import { BasemapExtension } from "./BasemapExtension.js";
import type { BookmarkProperties } from "./Bookmark.js";
import { Bookmark } from "./Bookmark.js";
import type { GroundExtensionProperties } from "./GroundExtension.js";
import { GroundExtension } from "./GroundExtension.js";
import type { MapConstraintsProperties } from "./MapConstraints.js";
import { MapConstraints } from "./MapConstraints.js";
import type { LayerExtension, LayerExtensionProperties } from "./_LayerExtension.js";
import type { LayerExtensionCollection, LayerExtensionCollectionBase } from "./support/_LayerExtensionCollection.js";
/**
 * A web map definition or reference.
 */
export type WebMapLike = PortalItemLike | WebMapJson;
/**
 * A web scene definition or reference.
 */
export type WebSceneLike = PortalItemLike | WebSceneJson;
/**
 * Viewing mode for a map (2D map or 3D scene).
 */
export type ViewMode = 
/**
 * A 2D map.
 */
"map"
/**
 * A 3D scene.
 */
 | "scene";
/**
 * Properties that can be passed into the constructor for
 * {@link mapping/MapExtension!MapExtension}.
 */
export interface MapExtensionProperties extends EntityBaseProperties {
    /**
     * See {@link mapping/MapExtension!MapExtension.title}.
     */
    title?: string;
    /**
     * Sets the initial view mode. To change it after creation, use
     * {@link mapping/MapExtension!MapExtension.switchViewMode}.
     */
    initialViewMode?: ViewMode;
    /**
     * See {@link mapping/MapExtension!MapExtension.layerExtensions}.
     */
    layerExtensions?: (LayerExtension | LayerExtensionProperties)[];
    /**
     * See {@link mapping/MapExtension!MapExtension.tableExtensions}.
     */
    tableExtensions?: (TableExtension | TableExtensionProperties)[];
    /**
     * See {@link mapping/MapExtension!MapExtension.basemapExtension}.
     */
    basemapExtension?: BasemapExtension | BasemapExtensionProperties;
    /**
     * See {@link mapping/MapExtension!MapExtension.basemapOptions}.
     */
    basemapOptions?: (BasemapExtension | BasemapExtensionProperties)[];
    /**
     * See {@link mapping/MapExtension!MapExtension.groundExtension}.
     */
    groundExtension?: GroundExtension | GroundExtensionProperties;
    /**
     * See {@link mapping/MapExtension!MapExtension.bookmarks}.
     */
    bookmarks?: (Bookmark | BookmarkProperties)[];
    /**
     * See {@link mapping/MapExtension!MapExtension.onClick}.
     */
    onClick?: Action;
    /**
     * See {@link mapping/MapExtension!MapExtension.onHover}.
     */
    onHover?: Action;
    /**
     * See {@link mapping/MapExtension!MapExtension.onHoverEnd}.
     */
    onHoverEnd?: Action;
    /**
     * See {@link mapping/MapExtension!MapExtension.onInitialized}.
     */
    onInitialized?: Action;
    /**
     * See {@link mapping/MapExtension!MapExtension.onViewpointChanged}.
     */
    onViewpointChanged?: Action;
    /**
     * See {@link mapping/MapExtension!MapExtension.requestHelper}.
     */
    requestHelper?: ArcGISRequestHelper;
    /**
     * See {@link mapping/MapExtension!MapExtension.map}.
     */
    map?: EsriMap | MapProperties;
    /**
     * See {@link mapping/MapExtension!MapExtension.formatSettings}.
     */
    formatSettings?: FormatSettingsProperties;
    /**
     * See {@link mapping/MapExtension!MapExtension.constraints}.
     */
    constraints?: MapConstraintsProperties;
    /**
     * See {@link mapping/MapExtension!MapExtension.contextMenu}.
     */
    contextMenu?: Menu | MenuProperties;
    /**
     * See {@link mapping/MapExtension!MapExtension.webMap}.
     */
    webMap?: WebMapLike;
    /**
     * See {@link mapping/MapExtension!MapExtension.webScene}.
     */
    webScene?: WebSceneLike;
    /**
     * See {@link mapping/MapExtension!MapExtension.initialLayerPreset}.
     */
    initialLayerPreset?: LayerPreset | LayerPresetProperties;
}
/**
 * Properties that can be specified for the
 * {@link mapping/MapExtension!MapExtensionProperties.map} property.
 */
export type MapProperties = Partial<WebMapJson> | Partial<WebSceneJson>;
/**
 * The collection of table extensions belonging to a
 * {@link mapping/MapExtension!MapExtension}.
 */
export interface TableExtensionCollection extends InitializableCollection<TableExtensionProperties, TableExtension> {
    /**
     * Get the table extension for a given id.
     *
     * @param id The id of the table extension.
     * @returns The table extension.
     */
    findById(id: string): TableExtension;
    /**
     * Get the corresponding table extension for a given table id.
     *
     * @param id The id of the table.
     * @returns The corresponding table extension.
     */
    findByTableId(id: string): TableExtension;
    /**
     * Gets the corresponding table extension for a given table.
     *
     * @param table A table on the map.
     * @returns The corresponding table extension.
     */
    forTable(table: Layer): TableExtension;
}
/**
 * Events emitted by the {@link mapping/MapExtension!MapExtension} class.
 */
export interface MapExtensionEvents extends InitializableBaseEvents {
    /**
     * Emitted when the a layer or sublayer in the map has its definition
     * expression changed. The event object will contain a reference to the
     * layer or sublayer that triggered the change.
     */
    "layer-definition-expression-change": Layer | SublayerLike;
    /**
     * Emitted when the visibility of a layer or sublayer in the map changes.
     * The event object will contain a reference to the layer or sublayer that
     * triggered the change.
     */
    "layer-visibility-change": Layer | SublayerLike;
}
/**
 * Extends the capabilities of an Esri Map object.
 */
export declare class MapExtension extends EntityBase<MapExtensionProperties> {
    /**
     * Handle group key for listeners on the current 2D map instance.
     */
    private static readonly _mapEventHandlesKey;
    /**
     * Handle group key for listeners on the current 3D scene instance.
     */
    private static readonly _sceneEventHandlesKey;
    /**
     * @deprecated Do not directly reference this property. Use EventNames and
     *   EventTypes helpers from @arcgis/core/Evented.
     */
    "@eventTypes": MapExtensionEvents;
    /**
     * When present, {@link mapping/MapExtension!MapExtension.map} will be loaded
     * from the given web map in Portal when the view mode is 2D. The web map
     * can be specified either as a PortalItem object, or simply using the
     * portal item ID.
     */
    get webMap(): WebMapLike;
    /**
     * When present, {@link mapping/MapExtension!MapExtension.map} will be loaded
     * from the given web scene in Portal when the view mode is 3D. The web
     * scene can be specified either as a PortalItem object, or simply using the
     * portal item ID.
     */
    get webScene(): WebSceneLike;
    /**
     * The Esri Map object being extended.
     */
    get map(): EsriMap;
    /**
     * The current view mode for the map (2D or 3D).
     */
    get viewMode(): ViewMode;
    /**
     * The initial view mode for the map (2D or 3D).
     */
    get initialViewMode(): ViewMode;
    set initialViewMode(viewMode: ViewMode);
    /**
     * The {@link utilities/RequestHelper!RequestHelper} to use when making
     * requests to external services. If not specified,
     * {@link support/ArcGISRequestHelper!ArcGISRequestHelper} will be used.
     */
    get requestHelper(): ArcGISRequestHelper;
    set requestHelper(requestHelper: ArcGISRequestHelper);
    /**
     * The basemap extension associated with the map's basemap object.
     */
    get basemapExtension(): BasemapExtension;
    set basemapExtension(value: BasemapExtension);
    /**
     * The ground extension associated with the map's ground object.
     */
    get groundExtension(): GroundExtension;
    set groundExtension(value: GroundExtension);
    /**
     * Basemaps that are suitable for use with this map. Can be used to populate
     * a basemap picker.
     */
    get basemapOptions(): Collection<BasemapExtension>;
    /**
     * Bookmarked locations on this map.
     */
    get bookmarks(): Collection<Bookmark>;
    /**
     * The extension for the map's initial basemap.
     */
    get initialBasemapExtension(): BasemapExtension;
    /**
     * The {@link layer-preset/LayerPreset!LayerPreset} applied to the
     * MapExtension on construction.
     */
    get initialLayerPreset(): LayerPreset;
    set initialLayerPreset(layerPreset: LayerPreset);
    /**
     * @inheritDoc
     */
    /**
     * Gets the spatial reference of the map.
     */
    protected get _spatialReference(): SpatialReference;
    /**
     * The title of the web map portal item.
     */
    get webMapItemTitle(): string | undefined;
    /**
     * The title of the web scene portal item.
     */
    get webSceneItemTitle(): string | undefined;
    /**
     * A human-readable title for the map.
     */
    get title(): string;
    set title(value: string);
    /**
     * Settings that affect how values in this
     * {@link mapping/MapExtension!MapExtension} are formatted.
     */
    readonly formatSettings: FormatSettings;
    /**
     * Configured constraints for the map. Note that it is the caller's
     * responsibility to set these constraints on any MapView or SceneView
     * instances that are created.
     */
    readonly constraints: MapConstraints;
    /**
     * An action that will be performed when the user clicks on the map.
     */
    onClick?: Action;
    /**
     * An action that will be performed when the user hovers over the map.
     */
    onHover?: Action;
    /**
     * An action that will be performed when the user stops hovering over the
     * map.
     */
    onHoverEnd?: Action;
    /**
     * An action that will be performed when the map initializes.
     */
    onInitialized?: Action;
    /**
     * An action that will be performed when the viewpoint changes.
     */
    onViewpointChanged?: Action;
    /**
     * A menu for actions that can be performed with the map.
     */
    get contextMenu(): Menu | undefined;
    set contextMenu(value: Menu | undefined);
    /**
     * The layer extensions associated with each layer of the map.
     */
    get layerExtensions(): LayerExtensionCollection;
    /**
     * Indicates that the extension is in the process of switching maps.
     */
    get isSwitchingMap(): boolean;
    /**
     * The table extensions associated with each table in the map.
     */
    readonly tableExtensions: TableExtensionCollection;
    /**
     * A flat collection of all the layers extensions in the map. This
     * collection contains extensions for basemap layers, operational layers and
     * ground layers. Extensions for group layers and their children are also
     * part of this collection. This collection is read-only.
     */
    readonly allLayerExtensions: LayerExtensionCollection;
    /**
     * @inheritDoc
     */
    protected readonly _itemType: string;
    /**
     * Indicates that the extension is in the process of switching maps.
     */
    protected _isSwitchingMap: boolean;
    /**
     * The underlying WebMap instance created from
     * {@link mapping/MapExtension!MapExtension.webMap}.
     */
    protected _map: EsriMap;
    /**
     * The underlying WebScene instance created from
     * {@link mapping/MapExtension!MapExtension.webScene}.
     */
    protected _scene: WebScene;
    /**
     * The Promise created when the 'map' property is deserialized.
     */
    protected _deserializedMapPromise: Promise<void>;
    /**
     * The viewMode value deserialized from a saved project.
     */
    protected _deserializedViewMode: ViewMode;
    /**
     * The Promise created to switch viewModes when a saved project is loaded.
     */
    protected _deserializedViewModePromise: Promise<void>;
    /**
     * Properties that were specified at construction that need to be applied
     * during initialization instead.
     */
    private _deferredProperties;
    private _currentMap;
    private _requestHelper;
    private _basemapExtension;
    private _groundExtension;
    private readonly _basemapOptions;
    private readonly _groundExtensions;
    private readonly _bookmarks;
    private readonly _layerExtensions;
    private _webMap;
    private _webMapItem;
    private _webScene;
    private _webSceneItem;
    private _title;
    private _initialViewMode;
    private _initialLayerPreset;
    private _initialBasemapExtension;
    private _skipBasemapOptions;
    private _createScenePromise;
    private _createMapPromise;
    private _contextMenu;
    constructor(properties?: MapExtensionProperties);
    /**
     * Gets a flattened list of all feature sources for the associated map.
     *
     * @param predicate If specified, only sources that match the given
     *   predicate will be returned.
     */
    getAllFeatureSources(predicate?: FeatureSourcePredicate): FeatureSource[];
    /**
     * Determines whether this map extension supports the given view mode.
     *
     * @param viewMode The view mode to check.
     */
    isSupportedViewMode(viewMode: ViewMode): boolean;
    /**
     * Switches the map extension's view mode.
     *
     * @param viewMode The view mode to switch to.
     */
    switchViewMode(viewMode: ViewMode): Promise<void>;
    /**
     * Switches the current map for a new one. This operation will reconfigure
     * existing layer, sublayer, and table extensions to extend the equivalent
     * ones in the new map, if possible.
     *
     * The primary use case is for switching between maps that have a similar
     * configuration, for example when going between a map and a scene with
     * similar layers.
     *
     * @param newMap The new map.
     */
    switchMap(newMap: EsriMap): Promise<void>;
    /**
     * Updates the map that will load when the view mode is switched to MAP.
     *
     * @param webMap The web map to set.
     */
    setWebMap(webMap: WebMapLike | undefined): Promise<void>;
    /**
     * Updates the map that will load when the view mode is switched to SCENE.
     *
     * @param webScene The web scene to set.
     */
    setWebScene(webScene: WebSceneLike | undefined): Promise<void>;
    getDefaults(): MapExtensionProperties;
    protected _onDestroy(): Promise<void>;
    /**
     * Creates the 3D scene from the webScene if it's not already created.
     */
    protected _createScene(): Promise<void>;
    /**
     * Creates the 2D map from the webMap if it's not already created.
     */
    protected _createMap(): Promise<void>;
    protected _getSerializableProperties(): PropertyDefs<MapExtensionProperties>;
    /**
     * Invoked when web map/web scene json needs to be applied to the Map
     * object.
     *
     * @param mapProperties The properties to apply.
     * @param map The map/scene to apply the properties to.
     * @param portalItem Portal item that the properties came from, if
     *   applicable.
     */
    protected _applyMapProperties(mapProperties: MapProperties, map: EsriMap, portalItem?: PortalItem): Promise<void>;
    /**
     * Invoked to create FormatSettings.
     */
    protected _createFormatSettings(): FormatSettings;
    /**
     * Invoked to create a LayerExtensionCollection.
     */
    protected _createLayerExtensionCollection(): LayerExtensionCollectionBase;
    /**
     * Invoked to create a TableExtensionCollection.
     */
    protected _createTableExtensionCollection(): TableExtensionCollection;
    protected _onInitialize(): Promise<void>;
    protected _postInitialize(): Promise<void>;
    protected _initializableChildCollections(): IterableIterator<Collection<InitializableBase>>;
    private _preserveBasemapAndGround;
    private _initMapFromProperties;
    private _setMap;
    private _onBasemapChange;
    private _onGroundChange;
    private _createStandardBasemapOptions;
    private _ensureIsBasemapOption;
    private _cleanPreviousBasemapOptions;
    private _updateBookmarks;
}
/**
 * A predicate function for feature sources.
 */
export type FeatureSourcePredicate = (source: FeatureSource) => boolean;
