export declare class Base64 {
    static encode(input: string): string;
    static decode(base64: string): string;
}

declare class CharacterBook implements SpecV3.Lorebook {
    static from_json(data: any): CharacterBook;
    name: string;
    description: string;
    token_budget?: number;
    recursive_scanning: boolean;
    extensions: SpecV3.Lorebook["extensions"];
    entries: SpecV3.Lorebook["entries"];
    scan_depth?: number | undefined;
    constructor(entries?: SpecV3.Lorebook["entries"]);
    _keys_fix(): void;
    private _scan;
    scan(context: string): SpecV3.Lorebook["entries"];
}
export { CharacterBook }
export { CharacterBook as CharacterBook_alias_1 }

declare class CharacterCard {
    readonly raw_data: CharRawData;
    readonly fallback_avatar: string;
    static from_file(file: ArrayBuffer | Uint8Array): Promise<CharacterCard>;
    static from_json(raw_data: CharRawData, fallback_avatar?: string): CharacterCard;
    static parse_char_info(file: ArrayBuffer | Uint8Array, exif: ParsedMetadata): any;
    constructor(raw_data: CharRawData, fallback_avatar?: string);
    get_avatar(without_fallback?: boolean): Promise<string>;
    get avatar(): CharacterSpec.Root["avatar"];
    get spec(): CharacterSpec.Root["spec"];
    get spec_version(): CharacterSpec.Root["spec_version"];
    get name(): CharacterSpec.Data["name"];
    get description(): CharacterSpec.Data["description"];
    get first_message(): CharacterSpec.Data["first_mes"];
    get message_example(): CharacterSpec.Root["mes_example"];
    get create_date(): CharacterSpec.Root["create_date"];
    get personality(): CharacterSpec.Data["personality"];
    get scenario(): CharacterSpec.Data["scenario"];
    get alternate_greetings(): CharacterSpec.Data["alternate_greetings"];
    get character_book(): CharacterSpec.CharacterBook;
    get tags(): CharacterSpec.Data["tags"];
    /**
     * Converts the current character card data to the SpecV1 format.
     *
     * This method constructs a SpecV1.TavernCard object by extracting the necessary
     * fields from the current instance's raw data using a getter function. The function
     * retrieves data from multiple sources, including instance properties, the raw data
     * object, and its nested data object. The resulting object contains fields defined
     * in the chara_card_v1 specification, such as name, description, personality, scenario,
     * first message, and example messages.
     *
     * @returns A SpecV1.TavernCard object representing the character card data in SpecV1 format.
     */
    toSpecV1(): SpecV1.TavernCard;
    /**
     * Converts the current character card data to the SpecV2 format.
     *
     * This method constructs a SpecV2.TavernCardV2 object by extracting the necessary
     * fields from the current instance's raw data using a getter function. The function
     * retrieves data from multiple sources, including instance properties, the raw data
     * object, and its nested data object. The resulting object contains fields defined
     * in the chara_card_v2 specification, including additional fields introduced in
     * later updates.
     *
     * @returns A deep-cloned SpecV2.TavernCardV2 object representing the character card
     *          data in SpecV2 format.
     */
    toSpecV2(): SpecV2.TavernCardV2;
    /**
     * Converts the current character card data to the SpecV3 format.
     *
     * This function utilizes a getter to retrieve properties from the
     * character card's raw data and returns a deep-cloned object
     * conforming to the SpecV3.CharacterCardV3 structure. It includes
     * fields from the CCV2 specification, changes specific to CCV3,
     * and new fields introduced in CCV3.
     *
     * @returns A deep-cloned object representing the character card data
     * in SpecV3 format.
     */
    toSpecV3(): SpecV3.CharacterCardV3;
    /**
     *  Returns the maximum compatible version of the character card
     *
     *  this card => merge(v1,v2,v3);
     */
    toMaxCompatibleSpec(): SpecV3.CharacterCardV3 | SpecV2.TavernCardV2 | SpecV1.TavernCard;
    /**
     * Creates a clone of the current CharacterCard instance in the specified version format.
     *
     * This method generates a new CharacterCard object with the data formatted to match
     * the specified version's specification. It supports conversion to SpecV1, SpecV2, and
     * SpecV3 formats by utilizing the respective `toSpecV1`, `toSpecV2`, and `toSpecV3` methods.
     *
     * @param version - The specification version ("v1", "v2", or "v3") to clone the character card into.
     *                  Defaults to "v3" if not specified.
     *
     * @returns A new CharacterCard instance formatted according to the specified version.
     *
     * @throws Will throw an error if the specified version is unsupported.
     */
    clone(version?: "v1" | "v2" | "v3"): CharacterCard;
    get_book(): CharacterBook;
}
export { CharacterCard }
export { CharacterCard as CharacterCard_alias_1 }

declare class CharacterCardParserError extends Error {
}
export { CharacterCardParserError }
export { CharacterCardParserError as CharacterCardParserError_alias_1 }

declare namespace CharacterSpec {
    interface Root {
        spec: string;
        spec_version: string;
        data: Data;
        name: string;
        description: string;
        personality: string;
        scenario: string;
        first_mes: string;
        mes_example: string;
        creatorcomment: string;
        avatar: string;
        talkativeness: string;
        fav: boolean;
        tags: any[];
        create_date: string;
    }
    interface Data {
        name: string;
        description: string;
        personality: string;
        scenario: string;
        first_mes: string;
        mes_example: string;
        creator_notes: string;
        system_prompt: string;
        post_history_instructions: string;
        tags: string[];
        creator: string;
        character_version: string;
        alternate_greetings: string[];
        extensions: Extensions;
        group_only_greetings: any[];
        character_book: CharacterBook;
    }
    interface Extensions {
        talkativeness: string;
        fav: boolean;
        world: string;
        depth_prompt: DepthPrompt;
    }
    interface DepthPrompt {
        prompt: string;
        depth: number;
        role: string;
    }
    interface CharacterBook {
        entries: Entry[];
        name: string;
        extensions: Record<string, any>;
    }
    interface Entry {
        id: number;
        keys: string[];
        secondary_keys: any[];
        comment: string;
        content: string;
        constant: boolean;
        selective: boolean;
        insertion_order: number;
        enabled: boolean;
        position: "before_char" | "after_char";
        use_regex: boolean;
        extensions: Extensions2;
    }
    interface Extensions2 {
        position: number;
        exclude_recursion: boolean;
        display_index: number;
        probability: number;
        useProbability: boolean;
        depth: number;
        selectiveLogic: number;
        group: string;
        group_override: boolean;
        group_weight: number;
        prevent_recursion: boolean;
        delay_until_recursion: boolean;
        scan_depth: any;
        match_whole_words: any;
        use_group_scoring: boolean;
        case_sensitive: any;
        automation_id: string;
        role: number;
        vectorized: boolean;
        sticky: number;
        cooldown: number;
        delay: number;
        match_persona_description: boolean;
        match_character_description: boolean;
        match_character_personality: boolean;
        match_character_depth_prompt: boolean;
        match_scenario: boolean;
        match_creator_notes: boolean;
    }
}
export { CharacterSpec }
export { CharacterSpec as CharacterSpec_alias_1 }

declare type CharRawData = {
    spec: string;
    spec_version: string;
    data: any;
    [key: string]: any;
};
export { CharRawData }
export { CharRawData as CharRawData_alias_1 }

export declare const deepClone: <T>(x: T) => T;

declare function extractUserCommentFromWebPChunk(data: Uint8Array, chunk: WebPChunk): string | undefined;
export { extractUserCommentFromWebPChunk }
export { extractUserCommentFromWebPChunk as extractUserCommentFromWebPChunk_alias_1 }

export declare function isValidImageUrl(url: any): boolean;

declare type JpegSegment = {
    marker: string;
    offset: number;
    length: number;
    type: string;
    preview: string;
    comment?: string;
};
export { JpegSegment }
export { JpegSegment as JpegSegment_alias_1 }

/**
 * Recursively merge objects into a single object.
 *
 * If all values for a key are objects, merge them recursively.
 * If any value for a key is not an object, take the last non-null value.
 * @param {...any[]} objects objects to merge
 * @returns merged object
 */
export declare function mergeObjects(...objects: any[]): any;

declare type ParsedMetadata = {
    format: "png";
    chunks: PngChunk[];
} | {
    format: "jpeg";
    segments: JpegSegment[];
} | {
    format: "webp";
    chunks: WebPChunk[];
};
export { ParsedMetadata }
export { ParsedMetadata as ParsedMetadata_alias_1 }

declare function parseImageMetadata(buffer: ArrayBuffer | Uint8Array): ParsedMetadata;
export { parseImageMetadata }
export { parseImageMetadata as parseImageMetadata_alias_1 }

declare type PngChunk = {
    type: string;
    length: number;
    crc: number;
    [key: string]: any;
};
export { PngChunk }
export { PngChunk as PngChunk_alias_1 }

declare namespace SpecV1 {
    type TavernCard = {
        name: string;
        description: string;
        personality: string;
        scenario: string;
        first_mes: string;
        mes_example: string;
    };
}
export { SpecV1 }
export { SpecV1 as SpecV1_alias_1 }

declare namespace SpecV2 {
    type TavernCardV2 = {
        spec: "chara_card_v2";
        spec_version: "2.0";
        data: {
            name: string;
            description: string;
            personality: string;
            scenario: string;
            first_mes: string;
            mes_example: string;
            creator_notes: string;
            system_prompt: string;
            post_history_instructions: string;
            alternate_greetings: Array<string>;
            character_book?: CharacterBook;
            tags: Array<string>;
            creator: string;
            character_version: string;
            extensions: Record<string, any>;
        };
    };
    /**
     * ? as in `name?: string` means the `name` property may be absent from the JSON
     * (aka this property is optional)
     * OPTIONAL PROPERTIES ARE ALLOWED TO BE UNSUPPORTED BY EDITORS AND DISREGARDED BY
     * FRONTENDS, however they must never be destroyed if already in the data.
     *
     * the `extensions` properties may contain arbitrary key-value pairs, but you are encouraged
     * to namespace the keys to prevent conflicts, and you must never destroy
     * unknown key-value pairs from the data. `extensions` is mandatory and must
     * default to `{}`. `extensions` exists for the character book itself, and for
     * each entry.
     **/
    type CharacterBook = {
        name?: string;
        description?: string;
        scan_depth?: number;
        token_budget?: number;
        recursive_scanning?: boolean;
        extensions: Record<string, any>;
        entries: Array<{
            keys: Array<string>;
            content: string;
            extensions: Record<string, any>;
            enabled: boolean;
            insertion_order: number;
            case_sensitive?: boolean;
            name?: string;
            priority?: number;
            id?: number;
            comment?: string;
            selective?: boolean;
            secondary_keys?: Array<string>;
            constant?: boolean;
            position?: "before_char" | "after_char";
        }>;
    };
}
export { SpecV2 }
export { SpecV2 as SpecV2_alias_1 }

declare namespace SpecV3 {
    type Lorebook = {
        name?: string;
        description?: string;
        scan_depth?: number;
        token_budget?: number;
        recursive_scanning?: boolean;
        extensions: Record<string, any>;
        entries: Array<{
            keys: Array<string>;
            content: string;
            extensions: Record<string, any>;
            enabled: boolean;
            insertion_order: number;
            case_sensitive?: boolean;
            use_regex: boolean;
            constant?: boolean;
            name?: string;
            priority?: number;
            id?: number | string;
            comment?: string;
            selective?: boolean;
            secondary_keys?: Array<string>;
            position?: "before_char" | "after_char";
        }>;
    };
    interface CharacterCardV3 {
        spec: "chara_card_v3";
        spec_version: "3.0";
        data: {
            name: string;
            description: string;
            tags: Array<string>;
            creator: string;
            character_version: string;
            mes_example: string;
            extensions: Record<string, any>;
            system_prompt: string;
            post_history_instructions: string;
            first_mes: string;
            alternate_greetings: Array<string>;
            personality: string;
            scenario: string;
            creator_notes: string;
            character_book?: Lorebook;
            assets?: Array<{
                type: string;
                uri: string;
                name: string;
                ext: string;
            }>;
            nickname?: string;
            creator_notes_multilingual?: Record<string, string>;
            source?: string[];
            group_only_greetings: Array<string>;
            creation_date?: number;
            modification_date?: number;
        };
    }
}
export { SpecV3 }
export { SpecV3 as SpecV3_alias_1 }

export declare function toBase64(input: Blob | Buffer | ArrayBuffer | Uint8Array): Promise<string>;

export declare function uniq<T>(arr: T[]): T[];

declare type WebPChunk = {
    type: string;
    offset: number;
    length: number;
    preview: string;
};
export { WebPChunk }
export { WebPChunk as WebPChunk_alias_1 }

export { }
