declare module "bidi-js" {
  export interface BidiEmbeddingLevels {
    levels: Uint8Array;
    paragraphs: Array<{ start: number; end: number; level: 0 | 1 }>;
  }

  export interface BidiApi {
    getEmbeddingLevels(text: string, baseDirection?: "ltr" | "rtl" | "auto"): BidiEmbeddingLevels;
    getReorderedString(text: string, embeddingLevels: BidiEmbeddingLevels): string;
    getReorderedIndices(text: string, embeddingLevels: BidiEmbeddingLevels): number[];
    getReorderSegments(
      text: string,
      embeddingLevels: BidiEmbeddingLevels,
    ): Array<[number, number]>;
    getBidiCharType(char: string): number;
    getBidiCharTypeName(char: string): string;
    getMirroredCharacter(char: string): string | null;
  }

  export default function bidiFactory(): BidiApi;
}
