/**
 * Copyright 2018-2024 Denis Haev <dogafox@gmail.com>
 *
 * MIT License
 *
 */
import React from 'react';
import type { Types } from '@iobroker/type-detector';
import type { IobTheme, ThemeName, ThemeType } from '../types';
type SmartNameObject = {
    [lang in ioBroker.Languages]?: string;
} & {
    /** Which kind of device it is */
    smartType?: string | null;
    /** Which value to set when the ON command is issued */
    byON?: string | null;
};
type SmartName = null | false | string | SmartNameObject;
type ClassDictionary = Record<string, any>;
type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
type ClassArray = ClassValue[];
export declare class Utils {
    static namespace: string;
    static INSTANCES: string;
    static dateFormat: string[];
    static FORBIDDEN_CHARS: RegExp;
    /**
     * Capitalize words.
     */
    static CapitalWords(name: string | null | undefined): string;
    static formatSeconds(seconds: number): string;
    /**
     * Get the name of the object by id from the name or description.
     */
    static getObjectName(objects: Record<string, ioBroker.Object>, id: string, settings?: {
        name: ioBroker.StringOrTranslated;
    } | ioBroker.Languages | null, options?: {
        language?: ioBroker.Languages;
    }, 
    /** Set to true to get the description. */
    isDesc?: boolean): string;
    /**
     * Get the name of the object from the name or description.
     */
    static getObjectNameFromObj(obj: ioBroker.PartialObject, 
    /** settings or language */
    settings: {
        name: ioBroker.StringOrTranslated;
    } | ioBroker.Languages | null, options?: {
        language?: ioBroker.Languages;
    }, 
    /** Set to true to get the description. */
    isDesc?: boolean, 
    /** Allow using spaces in name (by edit) */
    noTrim?: boolean): string;
    /**
     * Extracts from the object material settings, depends on username
     */
    static getSettingsOrder(obj: ioBroker.StateObject | ioBroker.StateCommon, forEnumId: string, options: {
        user?: string;
    }): string | null;
    /**
        Used in material
     */
    static getSettingsCustomURLs(obj: ioBroker.StateObject | ioBroker.StateCommon, forEnumId: string, options: {
        user?: string;
    }): string | null;
    /**
     * Reorder the array items in list between source and dest.
     */
    static reorder(list: Iterable<any> | ArrayLike<any>, source: number, dest: number): Iterable<any> | ArrayLike<any>;
    /**
        Get smart name settings for the given object.
     */
    static getSettings(obj: ioBroker.StateObject | ioBroker.StateCommon, options: {
        id?: string;
        user?: string;
        name?: ioBroker.StringOrTranslated;
        icon?: string;
        color?: string;
        language?: ioBroker.Languages;
    }, defaultEnabling?: boolean): {
        name: string;
        enabled?: boolean;
        useCustom?: boolean;
        icon?: string;
        color?: string;
    };
    /**
        Sets smartName settings for the given object.
     */
    static setSettings(obj: Partial<ioBroker.Object>, settings: Record<string, any>, options: {
        user?: string;
        language?: ioBroker.Languages;
    }): boolean;
    /**
     * Get the icon for the given settings.
     */
    static getIcon(settings: {
        icon?: string;
        name?: string;
        prefix?: string;
    }, style?: React.CSSProperties): React.JSX.Element | null;
    /**
     * Get the icon for the given object.
     */
    static getObjectIcon(id: string | ioBroker.PartialObject, obj?: ioBroker.PartialObject): string | null;
    /**
     * Converts word1_word2 to word1Word2.
     */
    static splitCamelCase(text: string | null | undefined): string;
    /**
     * Check if the given color is bright.
     * https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
     */
    static isUseBright(color: string | null | undefined, defaultValue?: boolean): boolean;
    /**
     * Get the time string in the format 00:00.
     */
    static getTimeString(seconds: string | number): string;
    /**
     * Gets the wind direction with the given angle (degrees).
     */
    static getWindDirection(
    /** angle in degrees from 0° to 360° */
    angle: number): string;
    /**
     * Pad the given number with a zero if it's not two digits long.
     */
    static padding(num: string | number): string;
    /**
     * Sets the date format.
     */
    static setDataFormat(format: string): void;
    /**
     * Converts the date to a string.
     */
    static date2string(now: string | number | Date): string;
    /**
     * Render a text as a link.
     */
    static renderTextWithA(text: string): React.JSX.Element[] | string;
    /**
     * Get the smart name of the given state.
     */
    static getSmartName(states: Record<string, ioBroker.StateObject> | ioBroker.StateObject | ioBroker.StateCommon, id: string, instanceId: string, noCommon?: boolean): SmartName | undefined;
    /**
     * Get the smart name from a state.
     */
    static getSmartNameFromObj(obj: ioBroker.StateObject | ioBroker.StateCommon, instanceId: string, noCommon?: boolean): SmartName | undefined;
    /**
     * Enable smart name for a state.
     */
    static enableSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, instanceId: string, noCommon?: boolean): void;
    /**
     * Completely remove smart name from a state.
     */
    static removeSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, instanceId: string, noCommon?: boolean): void;
    /**
     * Update the smart name of a state.
     *
     * @deprecated Use updateSmartNameEx instead
     */
    static updateSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, newSmartName: ioBroker.StringOrTranslated | undefined, byON: string | null | undefined, smartType: string | null | undefined, instanceId: string, noCommon?: boolean): void;
    /**
     * Update the smart name of a state.
     */
    static updateSmartNameEx(obj: ioBroker.StateObject | ioBroker.EnumObject, options: {
        smartName?: ioBroker.StringOrTranslated;
        byON?: string | null;
        smartType?: Types | null;
        instanceId: string;
        noCommon?: boolean;
        noAutoDetect?: boolean;
    }): void;
    /**
     * Disable the smart name of a state.
     */
    static disableSmartName(obj: ioBroker.StateObject | ioBroker.EnumObject, instanceId: string, noCommon?: boolean): void;
    /**
     * Copy text to the clipboard.
     */
    static copyToClipboard(text: string, e?: Event): boolean;
    /**
     * Gets the extension of a file name.
     *
     * @param fileName the file name.
     * @returns The extension in lower case.
     */
    static getFileExtension(fileName: string): string | null;
    /**
     * Format number of bytes as a string with B, KB, MB or GB.
     * The base for all calculations is 1024.
     *
     * @param bytes The number of bytes.
     * @returns The formatted string (e.g. '723.5 KB')
     */
    static formatBytes(bytes: number): string;
    /**
     * Invert the given color according to a theme type to get the inverted text color for background
     *
     * @param color Color in the format '#rrggbb' or '#rgb' (or without a hash)
     * @param themeType 'light' or 'dark'
     * @param invert If true, the dark theme has a light color in the control, or the dark theme has a light color in the control
     */
    static getInvertedColor(color: string, themeType: ThemeType, invert?: boolean): string | undefined;
    /**
     * Invert the given color
     *
     * @param hex Color in the format '#rrggbb' or '#rgb' (or without a hash)
     * @param bw Set to black or white.
     */
    static invertColor(hex: string | null | undefined, bw?: boolean): string;
    /**
     * Convert RGB to array [r, g, b]
     *
     * @param hex Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
     * @returns Array with 3 elements [r, g, b]
     */
    static color2rgb(hex: string): false | [number, number, number] | '';
    /**
     * Convert RGB to LAB
     *
     * @param rgb color in format [r,g,b]
     * @returns lab color in format [l,a,b]
     */
    static rgb2lab(rgb: [number, number, number]): [number, number, number];
    /**
     * Calculate the distance between two colors in LAB color space in the range 0-100^2
     * If the distance is less than 1000, the colors are similar
     *
     * @param color1 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
     * @param color2 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
     * @returns distance in the range 0-100^2
     */
    static colorDistance(color1: string, color2: string): number;
    private static _toVal;
    /**
     * Convert any object to a string with its values.
     */
    static clsx(...inputs: ClassValue[]): string;
    /**
     * Get the current theme name (either from local storage or the browser settings).
     */
    static getThemeName(themeName?: ThemeName | null): ThemeName;
    /**
     * Get the type of theme.
     */
    static getThemeType(themeName?: ThemeName): ThemeType;
    /**
     * Set the theme name and theme type.
     */
    static setThemeName(themeName: ThemeName): void;
    /**
     * Toggle the theme name between 'dark' and 'colored'.
     *
     * @returns the new theme name.
     */
    static toggleTheme(themeName?: ThemeName | null): ThemeName;
    /**
     * Get the list of themes
     *
     * @returns list of possible themes
     */
    static getThemeNames(): ThemeName[];
    /**
     * Parse a query string into its parts.
     */
    static parseQuery(query: string): Record<string, string | number | boolean>;
    /**
     * Returns parent ID.
     *
     * @returns parent ID or null if no parent
     */
    static getParentId(id: string): string | null;
    static formatDate(dateObj: Date, dateFormat: string): string;
    /**
     *  Format seconds to string like 'h:mm:ss' or 'd.hh:mm:ss'
     */
    static formatTime(seconds: number): string;
    static MDtext2link(text: string): string;
    /**
     * Open url link in the new target window
     */
    static openLink(url: string, target?: string): void;
    static MDgetTitle(text: string): string;
    static MDextractHeader(text: string): {
        header: Record<string, string | boolean | number>;
        body: string;
    };
    static MDremoveDocsify(text: string): string;
    /**
     * Generate the file for download from JSON object.
     */
    static generateFile(fileName: string, 
    /**  json file data */
    json: Record<string, any>): void;
    /**
     * Convert quality code into text
     *
     * @returns lines that decode quality
     */
    static quality2text(quality: ioBroker.STATE_QUALITY[keyof ioBroker.STATE_QUALITY]): string[];
    /**
     * Deep copy object
     */
    static clone(object: Record<string, any>): Record<string, any>;
    /**
     * Get states of object
     *
     * @returns states as an object in form {"value1": "label1", "value2": "label2"} or null
     */
    static getStates(obj: ioBroker.StateObject | null | undefined): Record<string, string> | null;
    /**
     * Get svg file as text
     *
     * @param url URL of SVG file
     * @returns Promise with "data:image..."
     */
    static getSvg(url: string): Promise<string>;
    /**
     * Detect a file extension by its content
     *
     * @returns The detected extension, like 'jpg'
     */
    static detectMimeType(
    /** Base64 encoded binary file */
    base64: string): string | null;
    /**
     * Check if configured repository is the stable repository
     */
    static isStableRepository(
    /** current configured repository or multi repository */
    activeRepo: string | string[]): boolean;
    /**
     * Check if a given string is an integer
     */
    static isStringInteger(str: string | number): boolean;
    /**
     * Check if the date is valid
     */
    static isValidDate(date: any): boolean;
    static getStyle(theme: IobTheme, ...args: (((_theme: IobTheme) => Record<string, any>) | undefined | Record<string, any>)[]): Record<string, any>;
}
export {};
