// TypeScript bindings for emscripten-generated code.  Automatically generated at compile time.
declare namespace RuntimeExports {
    /**
     * @param {string=} returnType
     * @param {Array=} argTypes
     * @param {Object=} opts
     */
    function cwrap(ident: any, returnType?: string, argTypes?: any[], opts?: any): any;
    /**
     * @param {string|null=} returnType
     * @param {Array=} argTypes
     * @param {Array=} args
     * @param {Object=} opts
     */
    function ccall(ident: any, returnType?: string, argTypes?: any[], args?: any[], opts?: any): any;
    function allocateUTF8(...args: any[]): any;
    /**
     * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
     * emscripten HEAP, returns a copy of that string as a Javascript String object.
     *
     * @param {number} ptr
     * @param {number=} maxBytesToRead - An optional length that specifies the
     *   maximum number of bytes to read. You can omit this parameter to scan the
     *   string until the first 0 byte. If maxBytesToRead is passed, and the string
     *   at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
     *   string will cut short at that byte index.
     * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
     * @return {string}
     */
    function UTF8ToString(ptr: number, maxBytesToRead?: number, ignoreNul?: boolean): string;
}
interface WasmModule {
  _quickjsCheck(_0: number): void;
  _createBufferPool(): number;
  _dropBufferPool(_0: number): void;
  _readBufferPool_data(_0: number, _1: number): number;
  _readBufferPool_len(_0: number, _1: number): number;
  _reencode_template_debug(_0: number, _1: number, _2: number, _3: number): number;
  _lepusCheck(_0: number, _1: number, _2: number): number;
}

type EmbindString = ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string;
export interface ClassHandle {
  isAliasOf(other: ClassHandle): boolean;
  delete(): void;
  deleteLater(): this;
  isDeleted(): boolean;
  // @ts-ignore - If targeting lower than ESNext, this symbol might not exist.
  [Symbol.dispose](): void;
  clone(): this;
}
export interface VectorUInt8 extends ClassHandle {
  push_back(_0: number): void;
  resize(_0: number, _1: number): void;
  size(): number;
  get(_0: number): number | undefined;
  set(_0: number, _1: number): boolean;
}

export type EncodeResult = {
  status: number,
  error_msg: EmbindString,
  buffer: VectorUInt8,
  lepus_code: EmbindString,
  lepus_debug: EmbindString,
  section_size: EmbindString
};

export type DecodeResult = {
  status: number,
  result: EmbindString
};

interface EmbindModule {
  VectorUInt8: {
    new(): VectorUInt8;
  };
  _encode(_0: EmbindString): EncodeResult;
  _quickjsCheck(_0: EmbindString): string;
  _encode_ssr(_0: number, _1: number, _2: EmbindString): EncodeResult;
  _decode(_0: number, _1: number): DecodeResult;
}

export type MainModule = WasmModule & typeof RuntimeExports & EmbindModule;
export default function MainModuleFactory (options?: unknown): MainModule;
