import { Nullable } from '../../../types/general';
import { RTENode } from './nodes/node.abstract';
export declare type RTERangeOptions = {
  startNode: Node | RTENode;
  endNode: Node | RTENode;
  startOffset: number;
  endOffset: number;
};
/** Manages selection range for a rich text editor, providing methods to set, sync, and create native ranges based on RTENodes and Nodes. */
export declare class RTERange {
  private _startContainer;
  private _endContainer;
  private _startOffset;
  private _endOffset;
  private _startNode;
  private _endNode;
  private _oldNativeRange;
  /**
   * Initial the rte range properties
   *
   * @param {Node} [startContainer] The range start element.
   * @param {Node} [endContainer] The range end element.
   * @param {number} [startOffset] The range start element content offset, default value is 0.
   * @param {number} [endOffset]  The range end element content offset, default value is 0.
   * @param {RTENode} [startNode] The range start node, the start node could be null if the start element is root element.
   * @param {RTENode} [endNode]  The range start node, the start node could be null if the start element is root element.
   * @param {Range} [nativeRange] The browser native range instance.
   */
  constructor(startContainer?: Nullable<Node>, endContainer?: Nullable<Node>, startOffset?: number, endOffset?: number, startNode?: Nullable<RTENode>, endNode?: Nullable<RTENode>, nativeRange?: Range);
  /**
   * Returns the start container as a Node or null if it is not set.
   * The start container could be null when the dom node should be create after re-render.
   *
   * @returns {Nullable<Node>} The range start element.
   */
  get startContainer(): Nullable<Node>;
  /**
   * Returns the end container as a Node or null if it is not set.
   * The end container could be null when the dom node should be create after re-render.
   *
   * @returns {Nullable<Node>} The range start element.
   */
  get endContainer(): Nullable<Node>;
  /**
   * Returns the range start RTE node as a RTENode or null if it is not set.
   * The start RTENode could be null when the range start node is the root element of the rich text editor.
   *
   * @returns {Nullable<RTENode>} The range start element.
   */
  get startNode(): Nullable<RTENode>;
  /**
   * Returns the range end RTE node as a RTENode or null if it is not set.
   * The end RTENode could be null when the range end node is the root element of the rich text editor.
   *
   * @returns {Nullable<RTENode>} The range start element.
   */
  get endNode(): Nullable<RTENode>;
  /**
   * Returns range's start offset.
   *
   * @returns {number} The character length in text node or the element index of parent element.
   */
  get startOffset(): number;
  /**
   * Returns range's start offset.
   *
   * @returns {number} The character length in text node or the element index of parent element.
   */
  get endOffset(): number;
  /**
   * Updates the range options for a Rich Text Editor.
   * This method will called after modify the content, the start node and end node should be rte node.
   * This method will called after selectionchange event emit, the start node and end node should be the html node.
   *
   * @param {RTERangeOptions} options - An object that contains the following properties:
   * @param {Range} [nativeRange] - The native range instance
   * @returns {RTERange} - The new RTERange instance
   */
  updateRTERange(options: RTERangeOptions, nativeRange?: Range): RTERange;
  /**
   * Creates a new instance of the `RTERange` class with the same properties as the current instance.
   *
   * @returns {RTERange} A new `RTERange` instance with the same start and end containers, offsets, and nodes.
   */
  clone(): RTERange;
  /**
   * Creates a Range object based on start and end nodes and offsets.
   * Invoke this method to get the future range state if the range content modified.
   * Invoke this method to get the native range instance if range start node and end node not defined
   *
   * @returns {Nullable<Range>} The range instance. The return value could be null if the start node or end node are not rendered.
   */
  toNativeRange(): Nullable<Range>;
  /**
   * Retrieves an RTENode based on the given element by checking its type and parent elements.
   *
   * @param {Node} element - An element in the DOM (Document Object Model).
   * @returns { Nullable<RTENode>} Returns a nullable `RTENode` object.
   */
  private getRTENodeByElement;
}
