import Graphic from "@arcgis/core/Graphic";
import Point from "@arcgis/core/geometry/Point";
import type SpatialReference from "@arcgis/core/geometry/SpatialReference";
import type FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
import GeoJSONLayer from "@arcgis/core/layers/GeoJSONLayer";
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer";
import type { IArcEntity, ICircleEntity, IEntity, IInsertEntity, IPointEntity, ISolidEntity, ILineType } from "dxf-parser";
import type { IDxfJsonComponentContext, ILineEntityExtended, IPolylineEntityExtended, ILwpolylineEntityExtended, ITextEntityExtended, IMTextEntity, IAttDefEntity } from "./_dxfInterfaces.js";
/**
 * Handles DXF LINE, ARC, POLYLINE, and LWPOLYLINE entity parsing and converts
 * them into corresponding GeoJSON line features.
 */
export declare class DxfToGeoJsonLineMapper {
    dxfContext: IDxfJsonComponentContext;
    constructor(dxfContext: IDxfJsonComponentContext);
    processLine(entity: ILineEntityExtended): Promise<void>;
    processPolyline(entity: IPolylineEntityExtended): Promise<void>;
    processLWPolyline(entity: ILwpolylineEntityExtended): Promise<void>;
    processArc(entity: IArcEntity): Promise<void>;
    /**
     * Converts parsed DXF line features into a GeoJSONLayer and appends it to
     * the dxfContext collection.
     */
    lineToGeoJSON(): void;
    /**
     * Determines the appropriate RGBA color for a given DXF entity.
     *
     * This method prioritizes the provided color value, but falls back to a
     * default symbol color if the input color is undefined. It handles various
     * color formats including DXF integer codes, RGBA arrays, and Esri Color
     * objects.
     *
     * @private
     * @param entity The DXF entity for which to determine the color.
     * @param color The color value from the entity or its layer, which can be a
     *   number, number array, or Color object.
     * @returns An RGBA color array (e.g., `[255, 0, 0, 1]`).
     */
    private _getLayerColor;
    /**
     * Interpolates an arc segment defined by two points and a bulge value into
     * a series of straight line segments.
     *
     * The bulge is the tangent of one-fourth of the included angle of the arc.
     * A positive bulge indicates a counter-clockwise arc from the start point
     * to the end point. A negative bulge indicates a clockwise arc.
     *
     * @private
     * @param p1 The starting point of the arc segment.
     * @param p2 The ending point of the arc segment.
     * @param bulge The bulge value defining the arc's curvature.
     * @param segments The number of segments to use for interpolation. Defaults
     *   to 16.
     * @returns An array of coordinate pairs `[x, y]` representing the
     *   interpolated points along the arc, excluding the start point.
     */
    private _interpolateBulge;
    /**
     * Builds a series of interpolated points from a lightweight polyline
     * (LWPOLYLINE) entity, handling both straight segments and arc segments
     * defined by bulge values.
     *
     * @private
     * @param entity The LWPOLYLINE entity to process.
     * @returns An array of `DxfPoint` objects representing the vertices of the
     *   interpolated polyline.
     */
    private _buildBulgeInterpolatedPoints;
    /**
     * Builds a GeoJSON feature for a lightweight polyline (LWPOLYLINE) entity.
     *
     * This method creates either a `Polygon` or a `LineString` geometry based
     * on whether the polyline is closed. The resulting feature includes all
     * original entity properties, plus the resolved color.
     *
     * @private
     * @param entity The extended lightweight polyline entity.
     * @param coords The array of coordinates for the polyline.
     * @param closed A boolean indicating if the polyline is closed.
     * @param color The color to be associated with the feature.
     * @returns A GeoJSON feature object.
     */
    private _buildLWPolylineFeature;
    /**
     * Extracts and projects the coordinates of a POLYLINE entity.
     *
     * @private
     * @param entity The polyline entity to process.
     * @returns A promise that resolves to an array of projected coordinate
     *   pairs.
     */
    private _getPolylineCoordinates;
    /**
     * Ensures that a coordinate array represents a closed ring by adding the
     * start point to the end if it's not already closed.
     *
     * @private
     * @param coords The array of coordinate pairs to check and close.
     */
    private _ensureClosed;
    /**
     * Builds a GeoJSON feature from a POLYLINE entity.
     *
     * @private
     * @param entity The extended polyline entity.
     * @param coords The array of coordinates for the polyline.
     * @param closed A boolean indicating if the polyline is closed, which
     *   determines if the output is a Polygon or LineString.
     * @param color The optional color to be associated with the feature.
     * @returns A GeoJSON feature object.
     */
    private _buildPolylineFeature;
    /**
     * Adds a polygon feature to the context and configures its renderer symbol.
     *
     * @private
     * @param entity The polyline entity that forms the polygon.
     * @param layerColor The color to apply to the polygon's fill and outline.
     * @param feature The GeoJSON feature to be added.
     */
    private _applyPolygonRenderer;
    /**
     * Adds a line feature to the context and configures its renderer symbol.
     *
     * @private
     * @param entity The polyline entity that forms the line.
     * @param feature The GeoJSON feature to be added.
     */
    private _applyLineRenderer;
    /**
     * Checks if two points are approximately at the same location within a
     * given tolerance.
     *
     * @private
     * @param p1 The first point as a `[number, number]` tuple.
     * @param p2 The second point as a `[number, number]` tuple.
     * @param tol The tolerance for the comparison. Defaults to 1e-6.
     * @returns `true` if the points are within the tolerance, otherwise
     *   `false`.
     */
    private _isSamePoint;
    /**
     * Merges consecutive line and arc features that are connected end-to-end
     * and belong to the same layer.
     *
     * @private
     * @param lineFeatures An array of GeoJSON line features to process.
     * @returns A new array of features with connected segments merged into
     *   single `LineString` features.
     */
    private _mergeConnectedLinesAndArcs;
}
/**
 * The DxfToGeoJsonPolygonMapper class processes DXF polygon-based entities such
 * as SOLID and CIRCLE, converting them into GeoJSON features. It also builds
 * corresponding renderers and sublayers for visualization.
 */
export declare class DxfToGeoJsonPolygonMapper {
    /**
     * The shared DXF context containing references to dxfContext, renderers,
     * and layers.
     */
    dxfContext: IDxfJsonComponentContext;
    /**
     * Creates a new instance of the DxfToGeoJsonPolygonMapper class.
     *
     * @param dxfContext The shared DXF conversion context.
     */
    constructor(dxfContext: IDxfJsonComponentContext);
    /**
     * Processes a DXF SOLID entity, converts it to a polygon feature, and
     * stores it within the context for GeoJSON conversion.
     *
     * @param entity The DXF SOLID entity to process.
     */
    processSolid(entity: ISolidEntity): Promise<void>;
    /**
     * Processes a DXF CIRCLE entity and converts it into an approximate polygon
     * (ring) for GeoJSON representation.
     *
     * @param entity The DXF CIRCLE entity to process.
     */
    processCircle(entity: ICircleEntity): Promise<void>;
    /**
     * Converts all processed polygon features into a GeoJSONLayer and adds it
     * to the dxfContext collection.
     */
    polygonToGeoJSON(): void;
}
/**
 * The DxfToGeoJsonTextMapper class processes DXF text-related entities (TEXT,
 * MTEXT, ATTDEF) and converts them into corresponding GeoJSON or graphics
 * layers. It manages text content, rotation, positioning, and labeling
 * details.
 */
export declare class DxfToGeoJsonTextMapper {
    /**
     * Shared DXF context containing references to renderer objects, spatial
     * references, and feature collections.
     */
    dxfContext: IDxfJsonComponentContext;
    /**
     * Initializes a new instance of the DxfToGeoJsonTextMapper.
     *
     * @param dxfContext The shared DXF conversion context.
     */
    constructor(dxfContext: IDxfJsonComponentContext);
    /**
     * Processes a DXF TEXT entity and converts it into a GeoJSON point feature
     * with text attributes such as rotation and height.
     *
     * @param entity The DXF TEXT entity to process.
     */
    processText(entity: ITextEntityExtended): Promise<void>;
    /**
     * Processes a DXF MTEXT entity (multi-line text) and converts it into a
     * cleaned and formatted GeoJSON point feature.
     *
     * @param entity The DXF MTEXT entity to process.
     */
    processMText(entity: IMTextEntity): Promise<void>;
    /**
     * Processes a DXF ATTDEF (attribute definition) entity and converts it into
     * a text-based GeoJSON point feature with block, tag, and rotation
     * properties.
     *
     * @param entity The DXF ATTDEF entity to process.
     */
    processAttDef(entity: IAttDefEntity): Promise<void>;
    /**
     * Converts all processed text features (TEXT, MTEXT, ATTDEF) into a
     * GraphicsLayer for map annotation visualization.
     */
    AnnotationToGeoJSON(): void;
    getMaximumFontSize(graphics: (Graphic | undefined)[]): number;
    /**
     * Creates a graphic representation for a DXF text-based feature.
     *
     * @private
     * @param feature The GeoJSON feature representing the text entity.
     * @param placementMap A map from DXF attachment points to ArcGIS label
     *   placements.
     * @param hAlignMap A map for horizontal alignment.
     * @param vAlignMap A map for vertical alignment.
     * @returns A new `Graphic` object or `null` if the feature cannot be
     *   processed.
     */
    private _createTextGraphic;
    /**
     * Extracts and cleans the text string from various potential properties of
     * a DXF entity.
     *
     * @private
     * @param props The properties object from a GeoJSON feature.
     * @returns The extracted and trimmed text string, or an empty string if no
     *   text is found.
     */
    private _getTextString;
    /**
     * Determines the color for a text entity based on its properties or layer
     * settings.
     *
     * @private
     * @param props The properties object from a GeoJSON feature.
     * @returns An RGBA color array.
     */
    private _getTextColor;
    /**
     * Calculates the font size for a text entity from its height property.
     *
     * @private
     * @param props The properties object from a GeoJSON feature.
     * @returns The calculated font size.
     */
    private _getFontSize;
    /**
     * Determines the rotation angle for a text entity.
     *
     * @private
     * @param props The properties object from a GeoJSON feature.
     * @returns The rotation angle in degrees.
     */
    private _getRotation;
    /**
     * Extracts the x and y offsets from the entity's scale properties.
     *
     * @private
     * @param props The properties object from a GeoJSON feature.
     * @returns An object containing the x and y offsets.
     */
    private _getOffsets;
    /**
     * Determines the label placement and alignment for a text entity.
     *
     * @private
     * @param props The properties object from a GeoJSON feature.
     * @param placementMap A map from DXF attachment points to ArcGIS label
     *   placements.
     * @param hAlignMap A map for horizontal alignment.
     * @param vAlignMap A map for vertical alignment.
     * @returns An object with label placement and alignment properties.
     */
    private _getAlignment;
}
/**
 * Handles DXF `INSERT` entities (block insertions) and their nested entities.
 * This dxfContext processes inserted blocks, applies transformations (rotation,
 * scale, position), and generates GeoJSON or map layers for point-based block
 * placements.
 */
export declare class DxfToGeoJsonInsertBlockMapper {
    /**
     * The shared DXF processing context, including renderer objects and feature
     * collections.
     */
    dxfContext: IDxfJsonComponentContext;
    /**
     * Creates a new instance of the DxfToGeoJsonInsertBlockMapper.
     *
     * @param dxfContext The shared DXF conversion context.
     */
    constructor(dxfContext: IDxfJsonComponentContext);
    /**
     * Processes a DXF `INSERT` entity that references a block definition.
     * Applies translation, rotation, and scaling to all entities within the
     * block, creating corresponding GeoJSON point features and rendering
     * symbols.
     *
     * @param insert The DXF insert definition representing the block reference.
     * @returns A Promise that resolves once all block entities are processed.
     */
    processInsertFunction(insert: IInsertEntity): Promise<void>;
    /**
     * Processes a DXF `POINT` entity and creates its corresponding GeoJSON
     * point representation.
     *
     * @param entity The DXF `POINT` entity to process.
     */
    processPoint(entity: IPointEntity): Promise<void>;
    /**
     * Processes a top-level DXF `INSERT` entity and creates its corresponding
     * GeoJSON point representation with block information.
     *
     * @param entity The DXF `INSERT` entity to process.
     */
    processInsert(entity: IInsertEntity): Promise<void>;
    /**
     * Converts all processed point features into a GeoJSONLayer and adds it to
     * the sublayer list for visualization.
     */
    pointToGeoJSON(): void;
    /**
     * Creates and pushes the GeoJSON point feature for the inserted block.
     *
     * @private
     * @param {{ name: string | number; layer: string | number }} insert The DXF
     *   insert definition containing name and layer information.
     * @param {DxfBlock | undefined} block The referenced DXF block definition,
     *   if available.
     * @param {number} rotation The rotation angle of the block in degrees.
     * @param {number} lon The longitude (X coordinate) of the block in the
     *   target spatial reference.
     * @param {number} lat The latitude (Y coordinate) of the block in the
     *   target spatial reference.
     * @returns {void}
     */
    private _createInsertPointFeature;
    /**
     * Builds a renderer object (symbol definition) for a given DXF layer.
     *
     * @private
     * @param {string} layerKey The unique identifier or name of the DXF layer.
     * @param {{ layer: string | number }} insert The DXF insert definition used
     *   to determine color and style.
     * @returns {RendererObjectPoint[string]} Returns the renderer entry for the
     *   specified layer.
     */
    private _createLayerSymbol;
    /**
     * Iterates through all entities within a DXF block and applies geometric
     * transformations (scaling, rotation, and translation) before sending them
     * for DXF entity processing.
     *
     * @private
     * @param {DxfBlock} block The DXF block containing entities to process.
     * @param {{
     *     name: string | number;
     *     rotation: number;
     *     scale: { x: number; y: number; z: number };
     *     position: { x: number; y: number };
     *     layer: string | number;
     * }} insert
     *   The DXF insert context providing block reference, layer, and
     *   transformation data.
     * @param {number} rotation The rotation angle in degrees to apply to
     *   entities.
     * @param {{ x: number; y: number; z: number }} scale The scaling factors
     *   per axis.
     * @param {{ x: number; y: number }} position The insertion position to
     *   offset transformed entities.
     * @returns {Promise<void>} Resolves once all entities have been transformed
     *   and processed.
     */
    private _normalizeBlockEntities;
    /**
     * Iterates through all entities within a DXF block and applies geometric
     * transformations (scaling, rotation, and translation) before sending them
     * for DXF entity processing.
     *
     * @private
     * @param block The DXF block containing entities to process.
     * @param insert The DXF insert context providing block reference, layer,
     *   and transformation data.
     * @param rotation The rotation angle in degrees to apply to entities.
     * @param scale The scaling factors per axis.
     * @param position The insertion position to offset transformed entities.
     * @param position.x The X coordinate of the insertion point.
     * @param position.y The Y coordinate of the insertion point.
     * @returns A promise that resolves once all entities have been transformed
     *   and processed.
     */
    private _processBlockEntities;
    /**
     * Applies geometric transformations (scaling, rotation, and translation) to
     * a DXF entity's geometric components.
     *
     * @private
     * @param {DxfEntity} entity The entity to transform.
     * @param {{ x: number; y: number; z: number }} scale Scaling factors along
     *   each axis.
     * @param {number} scale.x The scaling factor along the X-axis.
     * @param {number} scale.y The scaling factor along the Y-axis.
     * @param {number} scale.z The scaling factor along the Z-axis.
     * @param {number} rotation The rotation angle in degrees.
     * @param {{ x: number; y: number }} position Translation offset to apply.
     * @param {number} position.x The X coordinate offset.
     * @param {number} position.y The Y coordinate offset.
     * @returns {void}
     */
    private _transformEntityGeometry;
    /**
     * Adjusts non-geometric attributes such as radius, height, and rotation,
     * and assigns the block name after all transformations are applied.
     *
     * @private
     * @param {DxfEntity} entity The DXF entity being modified.
     * @param {{ x: number; y: number; z: number }} scale The scaling factors
     *   applied to the entity.
     * @param {number} scale.x The scale factor along the X-axis.
     * @param {number} scale.y The scale factor along the Y-axis.
     * @param {number} scale.z The scale factor along the Z-axis.
     * @param {number} rotation The rotation (in degrees) applied to the entity.
     * @param {string} blockName The name of the parent DXF block.
     * @returns {void} This function modifies the entity in place and does not
     *   return a value.
     */
    private _adjustEntityAttributes;
}
/**
 * Maps a DXF line type name to an equivalent Esri simple line style.
 *
 * This function attempts to map a DXF line type to a named Esri line style such
 * as "dash" or "dot". The mapping is based on a combination of the line type's
 * name and its pattern definition. It checks for common names (e.g., "HIDDEN",
 * "CENTER"), ISO patterns, and analyzes the dash-gap pattern for a best-fit
 * match.
 *
 * @param lineTypeName The name of the DXF line type (e.g., "DASHED", "ISO dash
 *   space").
 * @param lineTypeObj The full DXF line type object, which may contain a
 *   `pattern` array of numbers defining dashes and gaps.
 * @returns An Esri simple line style string. If no specific match is found, it
 *   defaults to "solid".
 */
export declare function mapDXFLineTypeToEsri(lineTypeName: string, lineTypeObj: ILineType | undefined): "solid" | "dash" | "dot" | "dash-dot" | "long-dash" | "long-dash-dot" | "short-dash" | "short-dash-dot";
/**
 * Processes various DXF entities and dispatches them to the appropriate mapper
 * class for conversion to GeoJSON features.
 */
export declare class DxfEntityProcessor {
    /**
     * The shared DXF conversion context.
     *
     * @private
     */
    private readonly dxfContext;
    /**
     * A map of DXF entity types to their corresponding handler functions.
     *
     * @private
     */
    private readonly entityHandlers;
    /**
     * Initializes a new instance of the DxfEntityProcessor.
     *
     * @param sourceSR The source spatial reference of the DXF data.
     * @param targetSR The target spatial reference for the output layers.
     * @param contextOverrides Optional partial context to override default
     *   values.
     */
    constructor(sourceSR: SpatialReference, targetSR: SpatialReference, contextOverrides?: Partial<IDxfJsonComponentContext>);
    /**
     * Returns the fully constructed DXF conversion context.
     *
     * @returns The shared DXF conversion context.
     */
    getContext(): IDxfJsonComponentContext;
    /**
     * Converts a single coordinate pair from the source spatial reference to
     * the target spatial reference.
     *
     * @param x The x-coordinate to convert.
     * @param y The y-coordinate to convert.
     * @returns A promise that resolves with the converted [x, y] coordinates.
     */
    convertToSpatialReference(x: number, y: number): Promise<[number, number]>;
    /**
     * Project an array of points into the target spatial reference.
     *
     * @param points Array of points to project.
     * @returns Array of converted coordinate pairs.
     */
    projectMany(points: Point[]): Promise<[number, number][]>;
    /**
     * Processes a single DXF entity or an array of entities. It filters out
     * "BLOCK" and "ENDBLK" types and dispatches the rest to the appropriate
     * handler.
     *
     * @param entity The entity or array of entities to process.
     */
    process(entity: IEntity | IEntity[]): Promise<void>;
    /**
     * Processes all entities from the DXF data in batches to keep the UI
     * responsive.
     *
     * @returns A promise that resolves with an array of the generated layers.
     */
    processAll(): Promise<(GeoJSONLayer | GraphicsLayer | FeatureLayer)[]>;
}
