/**
 * This file is automatically generated.
 * Please do not modify or send pull requests for it.
 */

import { Extension, StateField } from '@codemirror/state';
import { EditorView, ViewPlugin } from '@codemirror/view';
import * as Moment from 'moment';

declare global {
    interface ObjectConstructor {
        isEmpty(object: Record<string, any>): boolean;
        each<T>(object: {
            [key: string]: T;
        }, callback: (value: T, key?: string) => boolean | void, context?: any): boolean;
    }
    interface ArrayConstructor {
        combine<T>(arrays: T[][]): T[];
    }
    interface Array<T> {
        first(): T | undefined;
        last(): T | undefined;
        contains(target: T): boolean;
        remove(target: T): void;
        shuffle(): this;
        unique(): T[];
        /**
         *
         * @since 1.4.4
         */
        findLastIndex(predicate: (value: T) => boolean): number;
    }
    interface Math {
        clamp(value: number, min: number, max: number): number;
        square(value: number): number;
    }
    interface StringConstructor {
        isString(obj: any): obj is string;
    }
    interface String {
        contains(target: string): boolean;
        startsWith(searchString: string, position?: number): boolean;
        endsWith(target: string, length?: number): boolean;
        format(...args: string[]): string;
    }
    interface NumberConstructor {
        isNumber(obj: any): obj is number;
    }
    interface Node {
        detach(): void;
        empty(): void;
        insertAfter<T extends Node>(node: T, child: Node | null): T;
        indexOf(other: Node): number;
        setChildrenInPlace(children: Node[]): void;
        appendText(val: string): void;
        /**
         * Cross-window capable instanceof check, a drop-in replacement
         * for instanceof checks on DOM Nodes. Remember to also check
         * for nulls when necessary.
         * @param type
         */
        instanceOf<T>(type: {
            new (): T;
        }): this is T;
        /**
         * The document this node belongs to, or the global document.
         */
        doc: Document;
        /**
         * The window object this node belongs to, or the global window.
         */
        win: Window;
        constructorWin: Window;
    }
    interface Element extends Node {
        getText(): string;
        setText(val: string | DocumentFragment): void;
        addClass(...classes: string[]): void;
        addClasses(classes: string[]): void;
        removeClass(...classes: string[]): void;
        removeClasses(classes: string[]): void;
        toggleClass(classes: string | string[], value: boolean): void;
        hasClass(cls: string): boolean;
        setAttr(qualifiedName: string, value: string | number | boolean | null): void;
        setAttrs(obj: {
            [key: string]: string | number | boolean | null;
        }): void;
        getAttr(qualifiedName: string): string | null;
        matchParent(selector: string, lastParent?: Element): Element | null;
        getCssPropertyValue(property: string, pseudoElement?: string): string;
        isActiveElement(): boolean;
    }
    interface HTMLElement extends Element {
        show(): void;
        hide(): void;
        toggle(show: boolean): void;
        toggleVisibility(visible: boolean): void;
        /**
         * Returns whether this element is shown, when the element is attached to the DOM and
         * none of the parent and ancestor elements are hidden with `display: none`.
         *
         * Exception: Does not work on `<body>` and `<html>`, or on elements with `position: fixed`.
         */
        isShown(): boolean;
        setCssStyles(styles: Partial<CSSStyleDeclaration>): void;
        setCssProps(props: Record<string, string>): void;
        /**
         * Get the inner width of this element without padding.
         */
        readonly innerWidth: number;
        /**
         * Get the inner height of this element without padding.
         */
        readonly innerHeight: number;
    }
    interface SVGElement extends Element {
        setCssStyles(styles: Partial<CSSStyleDeclaration>): void;
        setCssProps(props: Record<string, string>): void;
    }
    function isBoolean(obj: any): obj is boolean;
    function fish(selector: string): HTMLElement | null;
    function fishAll(selector: string): HTMLElement[];
    interface Element extends Node {
        find(selector: string): Element | null;
        findAll(selector: string): HTMLElement[];
        findAllSelf(selector: string): HTMLElement[];
    }
    interface HTMLElement extends Element {
        find(selector: string): HTMLElement;
        findAll(selector: string): HTMLElement[];
        findAllSelf(selector: string): HTMLElement[];
    }
    interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
        find(selector: string): HTMLElement;
        findAll(selector: string): HTMLElement[];
    }
    interface DomElementInfo {
        /**
         * The class to be assigned. Can be a space-separated string or an array of strings.
         */
        cls?: string | string[];
        /**
         * The textContent to be assigned.
         */
        text?: string | DocumentFragment;
        /**
         * HTML attributes to be added.
         */
        attr?: {
            [key: string]: string | number | boolean | null;
        };
        /**
         * HTML title (for hover tooltip).
         */
        title?: string;
        /**
         * The parent element to be assigned to.
         */
        parent?: Node;
        value?: string;
        type?: string;
        prepend?: boolean;
        placeholder?: string;
        href?: string;
    }
    interface SvgElementInfo {
        /**
         * The class to be assigned. Can be a space-separated string or an array of strings.
         */
        cls?: string | string[];
        /**
         * HTML attributes to be added.
         */
        attr?: {
            [key: string]: string | number | boolean | null;
        };
        /**
         * The parent element to be assigned to.
         */
        parent?: Node;
        prepend?: boolean;
    }
    interface Node {
        /**
         * Create an element and append it to this node.
         */
        createEl<K extends keyof HTMLElementTagNameMap>(tag: K, o?: DomElementInfo | string, callback?: (el: HTMLElementTagNameMap[K]) => void): HTMLElementTagNameMap[K];
        createDiv(o?: DomElementInfo | string, callback?: (el: HTMLDivElement) => void): HTMLDivElement;
        createSpan(o?: DomElementInfo | string, callback?: (el: HTMLSpanElement) => void): HTMLSpanElement;
        createSvg<K extends keyof SVGElementTagNameMap>(tag: K, o?: SvgElementInfo | string, callback?: (el: SVGElementTagNameMap[K]) => void): SVGElementTagNameMap[K];
    }
    function createEl<K extends keyof HTMLElementTagNameMap>(tag: K, o?: DomElementInfo | string, callback?: (el: HTMLElementTagNameMap[K]) => void): HTMLElementTagNameMap[K];
    function createDiv(o?: DomElementInfo | string, callback?: (el: HTMLDivElement) => void): HTMLDivElement;
    function createSpan(o?: DomElementInfo | string, callback?: (el: HTMLSpanElement) => void): HTMLSpanElement;
    function createSvg<K extends keyof SVGElementTagNameMap>(tag: K, o?: SvgElementInfo | string, callback?: (el: SVGElementTagNameMap[K]) => void): SVGElementTagNameMap[K];
    function createFragment(callback?: (el: DocumentFragment) => void): DocumentFragment;
    interface EventListenerInfo {
        selector: string;
        listener: Function;
        options?: boolean | AddEventListenerOptions;
        callback: Function;
    }
    interface HTMLElement extends Element {
        _EVENTS?: {
            [K in keyof HTMLElementEventMap]?: EventListenerInfo[];
        };
        on<K extends keyof HTMLElementEventMap>(this: HTMLElement, type: K, selector: string, listener: (this: HTMLElement, ev: HTMLElementEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
        off<K extends keyof HTMLElementEventMap>(this: HTMLElement, type: K, selector: string, listener: (this: HTMLElement, ev: HTMLElementEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
        onClickEvent(this: HTMLElement, listener: (this: HTMLElement, ev: MouseEvent) => any, options?: boolean | AddEventListenerOptions): void;
        /**
         * @param listener - the callback to call when this node is inserted into the DOM.
         * @param once - if true, this will only fire once and then unhook itself.
         * @returns destroy - a function to remove the event handler to avoid memory leaks.
         */
        onNodeInserted(this: HTMLElement, listener: () => any, once?: boolean): () => void;
        /**
         * @param listener - the callback to call when this node has been migrated to another window.
         * @returns destroy - a function to remove the event handler to avoid memory leaks.
         */
        onWindowMigrated(this: HTMLElement, listener: (win: Window) => any): () => void;
        trigger(eventType: string): void;
    }
    interface Document {
        _EVENTS?: {
            [K in keyof DocumentEventMap]?: EventListenerInfo[];
        };
        on<K extends keyof DocumentEventMap>(this: Document, type: K, selector: string, listener: (this: Document, ev: DocumentEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
        off<K extends keyof DocumentEventMap>(this: Document, type: K, selector: string, listener: (this: Document, ev: DocumentEventMap[K], delegateTarget: HTMLElement) => any, options?: boolean | AddEventListenerOptions): void;
    }
    interface UIEvent extends Event {
        targetNode: Node | null;
        win: Window;
        doc: Document;
        /**
         * Cross-window capable instanceof check, a drop-in replacement
         * for instanceof checks on UIEvents.
         * @param type
         */
        instanceOf<T>(type: {
            new (...data: any[]): T;
        }): this is T;
    }
    interface AjaxOptions {
        method?: 'GET' | 'POST';
        url: string;
        success?: (response: any, req: XMLHttpRequest) => any;
        error?: (error: any, req: XMLHttpRequest) => any;
        data?: object | string | ArrayBuffer;
        headers?: Record<string, string>;
        withCredentials?: boolean;
        req?: XMLHttpRequest;
    }
    function ajax(options: AjaxOptions): void;
    function ajaxPromise(options: AjaxOptions): Promise<any>;
    function ready(fn: () => any): void;
    function sleep(ms: number): Promise<void>;
    function nextFrame(): Promise<void>;
    /**
     * The actively focused Window object. This is usually the same as `window` but
     * it will be different when using popout windows.
     */
    let activeWindow: Window;
    /**
     * The actively focused Document object. This is usually the same as `document` but
     * it will be different when using popout windows.
     */
    let activeDocument: Document;
    interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage {
        /**
         * The actively focused Window object. This is usually the same as `window` but
         * it will be different when using popout windows.
         */
        activeWindow: Window;
        /**
         * The actively focused Document object. This is usually the same as `document` but
         * it will be different when using popout windows.
         */
        activeDocument: Document;
        sleep(ms: number): Promise<void>;
        nextFrame(): Promise<void>;
    }
    interface Touch {
        touchType: 'stylus' | 'direct';
    }
}

/**
 * Attach to an `<input>` element or a `<div contentEditable>` to add type-ahead
 * support.
 *
 * @public
 * @since 1.4.10
 */
export abstract class AbstractInputSuggest<T> extends PopoverSuggest<T> {

    /**
     * Limit to the number of elements rendered at once. Set to 0 to disable. Defaults to 100.
     * @public
     * @since 1.4.10
     */
    limit: number;
    /**
     * Accepts an `<input>` text box or a contenteditable div.
     * @public
     */
    constructor(app: App, textInputEl: HTMLInputElement | HTMLDivElement);

    /**
     * Sets the value into the input element.
     * @public
     * @since 1.4.10
     */
    setValue(value: string): void;
    /**
     * Gets the value from the input element.
     * @public
     * @since 1.4.10
     */
    getValue(): string;

    /**
     * @public
     * @since 1.5.7
     */
    protected abstract getSuggestions(query: string): T[] | Promise<T[]>;
    /**
     * @public
     * @since 1.6.6
     */
    selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void;
    /**
     * Registers a callback to handle when a suggestion is selected by the user.
     * @public
     * @since 1.4.10
     */
    onSelect(callback: (value: T, evt: MouseEvent | KeyboardEvent) => any): this;

}

/**
 * @public
 * @since 0.9.21
 */
export class AbstractTextComponent<T extends HTMLInputElement | HTMLTextAreaElement> extends ValueComponent<string> {
    /**
     * @public
     * @since 0.9.7
     */
    inputEl: T;

    /**
     * @public
     */
    constructor(inputEl: T);
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;
    /**
     * @public
     * @since 0.9.7
     */
    getValue(): string;
    /**
     * @public
     * @since 0.9.7
     */
    setValue(value: string): this;
    /**
     * @public
     * @since 0.9.7
     */
    setPlaceholder(placeholder: string): this;
    /**
     * @public
     * @since 0.9.21
     */
    onChanged(): void;
    /**
     * @public
     * @since 0.9.7
     */
    onChange(callback: (value: string) => any): this;
}

/**
 * Adds an icon to the library.
 * @param iconId - the icon ID
 * @param svgContent - the content of the SVG.
 * @public
 */
export function addIcon(iconId: string, svgContent: string): void;

/**
 * This is the API version of the app, which follows the release cycle of the desktop app.
 * Example: '0.13.21'
 * @public
 */
export let apiVersion: string;

/**
 * @public
 * @since 0.9.7
 */
export class App {

    /**
     * @public
     * @since 0.9.7
     */
    keymap: Keymap;
    /**
     * @public
     * @since 0.9.7
     */
    scope: Scope;

    /**
     * @public
     * @since 0.9.7
     */
    workspace: Workspace;

    /**
     * @public
     * @since 0.9.7
     */
    vault: Vault;
    /**
     * @public
     * @since 0.9.7
     */
    metadataCache: MetadataCache;

    /**
     * @public
     * @since 0.11.0
     */
    fileManager: FileManager;

    /**
     * The last known user interaction event, to help commands find out what modifier keys are pressed.
     * @public
     * @since 0.12.17
     */
    lastEvent: UserEvent | null;

    /**
     * @public
     * @since 1.10.0
     */
    renderContext: RenderContext;
    /**
     * @public
     * @since 1.11.4
     */
    secretStorage: SecretStorage;

    /**
     * @public
     * @since 1.10.0
     */
    isDarkMode(): boolean;

    /**
     * Retrieve value from `localStorage` for this vault.
     * @param key
     * @public
     * @since 1.8.7
     */
    loadLocalStorage(key: string): any | null;
    /**
     * Save vault-specific value to `localStorage`. If data is `null`, the entry will be cleared.
     * @param key
     * @param data value being saved to localStorage. Must be serializable.
     * @public
     * @since 1.8.7
     */
    saveLocalStorage(key: string, data: unknown | null): void;

}

/** @public */
export function arrayBufferToBase64(buffer: ArrayBuffer): string;

/** @public */
export function arrayBufferToHex(data: ArrayBuffer): string;

/** @public */
export function base64ToArrayBuffer(base64: string): ArrayBuffer;

/**
 * @public
 * @since 0.10.3
 */
export abstract class BaseComponent {
    /**
     * @public
     * @since 0.10.3
     */
    disabled: boolean;
    /**
     * Facilitates chaining
     * @public
     * @since 0.9.7
     */
    then(cb: (component: this) => any): this;
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;
}

/**
 * BasesOptions and the associated sub-types are configuration-driven settings controls
 * which can be provided by a {@link BasesViewRegistration} to expose configuration options
 * to users in the view config menu of the Bases toolbar.
 * @public
 * @since 1.10.0
 */
export type BasesAllOptions = BasesOptions | BasesOptionGroup<BasesOptions>;

/**
 * Represents the serialized format of a Bases query as stored in a `.base` file.
 *
 * @public
 * @since 1.10.0
 */
export interface BasesConfigFile {
    /**
     * @public
     * @since 1.10.0
     */
    filters?: BasesConfigFileFilter;

    /**
     * Configuration for properties in this Base.
     *
     * Valid keys for this object currently include:
     *
     *   - displayName: string
     *
     * @public
     * @since 1.10.0
     */
    properties?: Record<string, Record<string, any>>;
    /**
     * Configuration for formulas used in this Base.
     *
     * Key: Formula property name.
     * Value: Formula string.
     *
     * @public
     * @since 1.10.0
     */
    formulas?: Record<string, string>;
    /**
     * Configuration for summary formulas used in this Base.
     *
     * Key: Summary formula name.
     * Value: Formula string.
     *
     * @public
     * @since 1.10.0
     */
    summaries?: Record<string, string>;
    /**
     * Configuration for views used in this Base.
     *
     * @public
     * @since 1.10.0
     */
    views?: BasesConfigFileView[];

}

/**
 * @public
 * @since 1.10.0
 */
export type BasesConfigFileFilter = string | {
    /**
     * @public
     * @since 1.10.0
     */
    and: BasesConfigFileFilter[];
} | {
    /**
     * @public
     * @since 1.10.0
     */
    or: BasesConfigFileFilter[];
} | {
    /**
     * @public
     * @since 1.10.0
     */
    not: BasesConfigFileFilter[];
};

/**
 * @public
 * @since 1.10.0
 */
export interface BasesConfigFileView {
    /**
     * Unique identifier for the view type. Used to select the correct view renderer.
     *
     * @public
     * @since 1.10.0
     */
    type: string;
    /**
     * Friendly name for this view, displayed in the UI to select between views.
     *
     * @public
     * @since 1.10.0
     */
    name: string;
    /**
     * Additional filters, applied only to this view.
     *
     * @public
     * @since 1.10.0
     */
    filters?: BasesConfigFileFilter;
    /**
     * Configuration for grouping the results of this view.
     *
     * @public
     * @since 1.10.0
     */
    groupBy?: {

    };
    /**
     * An ordered list of the properties to display in this view.
     *
     * @public
     * @since 1.10.0
     */
    order?: string[];
    /**
     * Configuration of summaries to display for each property in this view.
     *
     * Key: Property name.
     * Value: Summary formula name.
     *
     * @public
     * @since 1.10.0
     */
    summaries?: Record<string, string>;

}

/**
 * @public
 * @since 1.10.0
 */
export interface BasesDropdownOption extends BasesOption {
    /**
     * @public
     * @since 1.10.0
     */
    type: 'dropdown';
    /**
     * @public
     * @since 1.10.0
     */
    default?: string;
    /**
     * @public
     * @since 1.10.0
     */
    options: Record<string, string>;
}

/**
 * Represent a single "row" or file in a base.
 * @public
 * @since 1.10.0
 */
export class BasesEntry implements FormulaContext {

    /**
     * @public
     * @since 1.10.0
     */
    file: TFile;

    /**
     * Get the value of the property.
     * Note: Errors are returned as {@link ErrorValue}
     * @public
     * @since 1.10.0
     */
    getValue(propertyId: BasesPropertyId): Value | null;

}

/**
 * A group of BasesEntry objects for a given value of the groupBy key.
 * If there are entries in the results which do not have a value for the
 * groupBy key, the key will be the {@link NullValue}.
 * @public
 * @since 1.10.0
 */
export class BasesEntryGroup {
    /**
     * The value of the groupBy key for this entry group.
     * @public
     * @since 1.10.0
     */
    key?: Value;
    /**
     * @public
     * @since 1.10.0
     */
    entries: BasesEntry[];

    /**
     * @returns true iff this entry group has a non-null key.
     * @public
     * @since 1.10.0
     */
    hasKey(): boolean;
}

/**
 * A text input allowing selection of a file from in the vault.
 * @public
 * @since 1.10.2
 */
export interface BasesFileOption extends BasesOption {
    /**
     * @public
     * @since 1.10.2
     */
    type: 'file';
    /**
     * @public
     * @since 1.10.2
     */
    default?: string;
    /**
     * @public
     * @since 1.10.2
     */
    placeholder?: string;
    /**
     * @public
     * @since 1.10.2
     */
    filter?: (file: TFile) => boolean;
}

/**
 * A text input allowing selection of a folder from in the vault.
 * @public
 * @since 1.10.2
 */
export interface BasesFolderOption extends BasesOption {
    /**
     * @public
     * @since 1.10.2
     */
    type: 'folder';
    /**
     * @public
     * @since 1.10.2
     */
    default?: string;
    /**
     * @public
     * @since 1.10.2
     */
    placeholder?: string;
    /**
     * @public
     * @since 1.10.2
     */
    filter?: (folder: TFolder) => boolean;
}

/**
 * A text input supporting formula evaluation.
 * @public
 * @since 1.10.2
 */
export interface BasesFormulaOption extends BasesOption {
    /**
     * @public
     * @since 1.10.2
     */
    type: 'formula';
    /**
     * @public
     * @since 1.10.2
     */
    default?: string;
    /**
     * @public
     * @since 1.10.2
     */
    placeholder?: string;
}

/**
 * @public
 * @since 1.10.0
 */
export interface BasesMultitextOption extends BasesOption {
    /**
     * @public
     * @since 1.10.0
     */
    type: 'multitext';
    /**
     * @public
     * @since 1.10.0
     */
    default?: string[];
}

/**
 * @public
 * @since 1.10.0
 */
export interface BasesOption {
    /**
     * @public
     * @since 1.10.0
     */
    key: string;
    /**
     * @public
     * @since 1.10.0
     */
    type: string;
    /**
     * @public
     * @since 1.10.0
     */
    displayName: string;
    /**
     * If provided, the option will be hidden if the function returns true.
     *
     * @public
     * @since 1.10.2
     */
    shouldHide?: () => boolean;
}

/**
 * Collapsible container for other ViewOptions.
 * @public
 * @since 1.10.0
 */
export interface BasesOptionGroup<T extends BasesOption> {
    /**
     * @public
     * @since 1.10.0
     */
    type: 'group';
    /**
     * @public
     * @since 1.10.0
     */
    displayName: string;
    /**
     * @public
     * @since 1.10.0
     */
    items: T[];
    /**
     * If provided, the group will be hidden if the function returns true.
     *
     * @public
     * @since 1.10.2
     * @param config - Read-only copy of the current view configuration.
     */
    shouldHide?: () => boolean;
}

/**
 * @public
 * @since 1.10.0
 */
export type BasesOptions = BasesDropdownOption | BasesFileOption | BasesFolderOption | BasesFormulaOption | BasesMultitextOption | BasesPropertyOption | BasesSliderOption | BasesTextOption | BasesToggleOption;

/**
 * A parsed version of the {@link BasesPropertyId}.
 *
 * @public
 * @since 1.10.0
 */
export interface BasesProperty {
    /**
     * @public
     * @since 1.10.0
     */
    type: BasesPropertyType;
    /**
     * @public
     * @since 1.10.0
     */
    name: string;
}

/**
 * The full ID of a property, used in the bases config file. The prefixed
 * {@link BasesPropertyType} disambiguates properties of the same name but from different sources.
 *
 * @public
 * @since 1.10.0
 */
export type BasesPropertyId = `${BasesPropertyType}.${string}`;

/**
 * A dropdown menu allowing selection of a property.
 * @public
 * @since 1.10.0
 */
export interface BasesPropertyOption extends BasesOption {
    /**
     * @public
     * @since 1.10.0
     */
    type: 'property';
    /**
     * @public
     * @since 1.10.0
     */
    default?: string;
    /**
     * @public
     * @since 1.10.0
     */
    placeholder?: string;
    /**
     * If provided, only properties which pass the filter will be included for selection in the property dropdown.
     *
     * @public
     * @since 1.10.0
     */
    filter?: (prop: BasesPropertyId) => boolean;
}

/**
 * The three valid "sources" of a property in a Base.
 *
 * - `note`: Properties from the frontmatter of markdown files in the vault.
 * - `formula`: Properties calculated by evaluating a formula from the base config file.
 * - `file`: Properties inherent to a file, such as the name, extension, size, etc.
 *
 * @public
 * @since 1.10.0
 */
export type BasesPropertyType = 'note' | 'formula' | 'file';

/**
 * The BasesQueryResult contains all of the available information from executing the
 * bases query, applying filters, and evaluating formulas. The `data` or `groupedData`
 * should be displayed by your view.
 *
 * @public
 * @since 1.10.0
 */
export class BasesQueryResult {

    /**
     * An ungrouped version of the data, with user-configured sort and limit applied.
     * Where appropriate, views should support groupBy by using `groupedData` instead of this value.
     *
     * @public
     * @since 1.10.0
     */
    data: BasesEntry[];

    /**
     * The data to be rendered, grouped according to the groupBy config.
     * If there is no groupBy configured, returns a single group with an empty key.
     * @public
     * @since 1.10.0
     */
    get groupedData(): BasesEntryGroup[];
    /**
     * Visible properties defined by the user.
     * @public
     * @since 1.10.0
     */
    get properties(): BasesPropertyId[];

    /**
     * Applies a summary function to a single property over a set of entries.
     * @public
     * @since 1.10.0
     */
    getSummaryValue(queryController: QueryController, entries: BasesEntry[], prop: BasesPropertyId, summaryKey: string): Value;
}

/**
 * @public
 * @since 1.10.0
 */
export interface BasesSliderOption extends BasesOption {
    /**
     * @public
     * @since 1.10.0
     */
    type: 'slider';
    /**
     * @public
     * @since 1.10.0
     */
    default?: number;
    /**
     * @public
     * @since 1.10.0
     */
    min?: number;
    /**
     * @public
     * @since 1.10.0
     */
    max?: number;
    /**
     * @public
     * @since 1.10.0
     */
    step?: number;
    /**
     * @public
     * @since 1.10.0
     */
    instant?: boolean;
}

/**
 * @public
 * @since 1.10.0
 */
export type BasesSortConfig = {
    /**
     * @public
     * @since 1.10.0
     */
    property: BasesPropertyId;
    /**
     * @public
     * @since 1.10.0
     */
    direction: 'ASC' | 'DESC';
};

/**
 * @public
 * @since 1.10.0
 */
export interface BasesTextOption extends BasesOption {
    /**
     * @public
     * @since 1.10.0
     */
    type: 'text';
    /**
     * @public
     * @since 1.10.0
     */
    default?: string;
    /**
     * @public
     * @since 1.10.0
     */
    placeholder?: string;
}

/**
 * @public
 * @since 1.10.0
 */
export interface BasesToggleOption extends BasesOption {
    /**
     * @public
     * @since 1.10.0
     */
    type: 'toggle';
    /**
     * @public
     * @since 1.10.0
     */
    default?: boolean;
}

/**
 * Plugins can create a class which extends this in order to render a Base.
 * Plugins should create a {@link BaseViewHandlerFactory} function, then call
 * `plugin.registerView` to register the view factory.
 *
 * @public
 * @since 1.10.0
 */
export abstract class BasesView extends Component {
    /**
     * The type ID of this view
     * @public
     * @since 1.10.0
     */
    abstract type: string;
    /**
     * @public
     * @since 1.10.0
     */
    app: App;

    /**
     * The config object for this view.
     * @public
     * @since 1.10.0
     */
    config: BasesViewConfig;
    /**
     * All available properties from the dataset.
     * @public
     * @since 1.10.0
     */
    allProperties: BasesPropertyId[];
    /**
     * The most recent output from executing the bases query, applying filters, and evaluating formulas.
     * This object will be replaced with a new result set when changes to the vault or Bases config occur,
     * so views should not keep a reference to it. Also note the contained BasesEntry objects will be recreated.
     * @public
     * @since 1.10.0
     */
    data: BasesQueryResult;

    /**
     * @public
     * @since 1.10.0
     */
    protected constructor(controller: QueryController);
    /**
     * Called when there is new data for the query. This view should rerender with the updated data.
     * @public
     * @since 1.10.0
     */
    abstract onDataUpdated(): void;

    /**
     * Display the new note menu for a file with the provided filename and optionally a function to modify the frontmatter.
     * @public
     * @since 1.10.2
     */
    createFileForView(baseFileName?: string, frontmatterProcessor?: (frontmatter: any) => void): Promise<void>;

}

/**
 * The in-memory representation of a single entry in the "views" section of a Bases file.
 * Contains settings and configuration options set by the user from the toolbar menus and view options.
 * @public
 * @since 1.10.0
 */
export class BasesViewConfig {

    /**
     * User-friendly name for this view.
     * @public
     * @since 1.10.0
     */
    name: string;

    /**
     * Retrieve the user-configured value of options exposed in `BasesViewRegistration.options`.
     * @public
     * @since 1.10.0
     */
    get(key: string): unknown;
    /**
     * Retrieve a user-configured value from the config, converting it to a BasesPropertyId.
     * Returns null if the requested key is not present in the config, or if the value is invalid.
     * @public
     * @since 1.10.0
     */
    getAsPropertyId(key: string): BasesPropertyId | null;
    /**
     * Retrieve a user-configured value from the config, evaluating it as a
     * formula in the context of the current Base. For embedded bases, or bases
     * in the sidebar, this means evaluating the formula against the currently
     * active file.
     *
     * @public
     * @returns the Value result from evaluating the formula, or NullValue if the formula is invalid, or the key is not present.
     * @since 1.10.2
     */
    getEvaluatedFormula(view: BasesView, key: string): Value;
    /**
     * Store configuration data for the view. Views should prefer `BasesViewRegistration.options`
     * to allow users to configure options where appropriate.
     * @public
     * @since 1.10.0
     */
    set(key: string, value: any | null): void;
    /**
     * Ordered list of properties to display in this view.
     * In a table, these can be interpreted as the list of visible columns.
     * Order is configured by the user through the properties toolbar menu.
     * @public
     * @since 1.10.0
     */
    getOrder(): BasesPropertyId[];

    /**
     * Retrieve the sorting config for this view. Sort is configured by the user through the sort toolbar menu.
     * Removes invalid sort configs. If no (valid) sort config, returns an empty array.
     * Does not validate that the properties exists.
     *
     * Note that data from BasesQueryResult will be presorted.
     *
     * @public
     * @since 1.10.0
     */
    getSort(): BasesSortConfig[];

    /**
     * Retrieve a friendly name for the provided property.
     * If the property has been renamed by the user in the Base config, that value is returned.
     * File properties may have a default name that is returned, otherwise the name with the property
     * type prefix removed is returned.
     *
     * @public
     * @since 1.10.0
     */
    getDisplayName(propertyId: BasesPropertyId): string;

}

/**
 * Implement this factory function in a {@link BasesViewRegistration} to create a
 * new instance of a custom Bases view.
 * @param containerEl - The container below the Bases toolbar where the view will be displayed.
 * @public
 * @since 1.10.0
 */
export type BasesViewFactory = (controller: QueryController, containerEl: HTMLElement) => BasesView;

/**
 * Container for options when registering a new Bases view type.
 * @public
 * @since 1.10.0
 */
export interface BasesViewRegistration {
    /**
     * @public
     * @since 1.10.0
     */
    name: string;
    /**
     * Icon ID to be used in the Bases view selector.
     * See {@link https://docs.obsidian.md/Plugins/User+interface/Icons} for available icons and how to add your own.
     * @public
     * @since 1.10.0
     */
    icon: IconName;
    /**
     * @public
     * @since 1.10.0
     */
    factory: BasesViewFactory;
    /**
     * @public
     * @since 1.10.0
     */
    options?: (config: BasesViewConfig) => BasesAllOptions[];
}

/**
 * @public
 * @since 0.11.13
 */
export interface BlockCache extends CacheItem {
    /** @public */
    id: string;
}

/**
 * @public
 * @since 0.13.26
 */
export interface BlockSubpathResult extends SubpathResult {
    /**
     * @public
     */
    type: 'block';
    /**
     * @public
     */
    block: BlockCache;
    /**
     * @public
     */
    list?: ListItemCache;
}

/**
 * {@link Value} wrapping a boolean.
 * @public
 * @since 1.10.0
 */
export class BooleanValue extends PrimitiveValue<boolean> {
    /**
     * @public
     * @since 1.10.0
     */
    static type: string;

}

/**
 * @public
 * @since 0.9.7
 */
export class ButtonComponent extends BaseComponent {
    /**
     * @public
     * @since 0.9.7
     */
    buttonEl: HTMLButtonElement;

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;

    /**
     * @public
     * @since 0.9.7
     */
    setCta(): this;
    /**
     * @public
     * @since 0.9.20
     */
    removeCta(): this;
    /**
     * @deprecated Use {@link setDestructive} for a destructive button, or
     * `setDestructive().setCta()` for a destructive primary action.
     * @public
     * @since 0.11.0
     */
    setWarning(): this;
    /**
     * Style the button as destructive (e.g. for actions that delete data or are
     * otherwise hard to undo). Compose with {@link setCta} for a destructive
     * primary action.
     * @public
     * @since 1.13.0
     */
    setDestructive(): this;
    /**
     * @public
     * @since 1.13.0
     */
    removeDestructive(): this;
    /**
     * @public
     * @since 1.1.0
     */
    setTooltip(tooltip: string, options?: TooltipOptions): this;
    /**
     * @public
     * @since 0.9.7
     */
    setButtonText(name: string): this;
    /**
     * @public
     * @since 1.1.0
     */
    setIcon(icon: IconName): this;
    /**
     * @public
     * @since 0.9.7
     */
    setClass(cls: string): this;
    /**
     * @public
     * @since 0.12.16
     */
    onClick(callback: (evt: MouseEvent) => unknown | Promise<unknown>): this;
}

/**
 * @public
 */
export interface CachedMetadata {
    /**
     * @public
     */
    links?: LinkCache[];
    /**
     * @public
     */
    embeds?: EmbedCache[];
    /**
     * @public
     */
    tags?: TagCache[];
    /**
     * @public
     */
    headings?: HeadingCache[];
    /**
     * @public
     * @since 1.6.6
     */
    footnotes?: FootnoteCache[];
    /**
     * @public
     * @since 1.8.7
     */
    footnoteRefs?: FootnoteRefCache[];
    /**
     * @public
     * @since 1.8.7
     */
    referenceLinks?: ReferenceLinkCache[];
    /**
     * Sections are root level markdown blocks, which can be used to divide the document up.
     * @public
     */
    sections?: SectionCache[];
    /**
     * @public
     */
    listItems?: ListItemCache[];
    /**
     * @public
     */
    frontmatter?: FrontMatterCache;
    /**
     * Position of the frontmatter in the file.
     * @public
     * @since 1.4.0
     */
    frontmatterPosition?: Pos;

    /**
     * @public
     * @since 1.4.0
     */
    frontmatterLinks?: FrontmatterLinkCache[];
    /**
     * @public
     */
    blocks?: Record<string, BlockCache>;

}

/**
 * @public
 */
export interface CacheItem {
    /**
     * Position of this item in the note.
     * @public
     */
    position: Pos;

}

/**
 * Implementation of the vault adapter for mobile devices.
 * @public
 * @since 1.7.2
 */
export class CapacitorAdapter implements DataAdapter {

    /**
     * @public
     * @since 1.7.2
     */
    getName(): string;

    /**
     * @public
     * @since 1.7.2
     */
    mkdir(normalizedPath: string): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    trashSystem(normalizedPath: string): Promise<boolean>;
    /**
     * @public
     * @since 1.7.2
     */
    trashLocal(normalizedPath: string): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    rmdir(normalizedPath: string, recursive: boolean): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    read(normalizedPath: string): Promise<string>;
    /**
     * @public
     * @since 1.7.2
     */
    readBinary(normalizedPath: string): Promise<ArrayBuffer>;
    /**
     * @public
     * @since 1.7.2
     */
    write(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    writeBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    append(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     * @since 1.12.3
     */
    appendBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;
    /**
     * @public
     * @since 1.7.2
     */
    getResourcePath(normalizedPath: string): string;

    /**
     * @public
     * @since 1.7.2
     */
    remove(normalizedPath: string): Promise<void>;

    /**
     * @public
     * @since 1.7.2
     */
    rename(normalizedPath: string, normalizedNewPath: string): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    copy(normalizedPath: string, normalizedNewPath: string): Promise<void>;
    /**
     * @public
     * @since 1.7.2
     */
    exists(normalizedPath: string, sensitive?: boolean): Promise<boolean>;

    /**
     * @public
     * @since 1.7.2
     */
    stat(normalizedPath: string): Promise<Stat | null>;
    /**
     * @public
     * @since 1.7.2
     */
    list(normalizedPath: string): Promise<ListedFiles>;

    /**
     * @public
     * @since 1.7.2
     */
    getFullPath(normalizedPath: string): string;

}

/**
 * @public
 * @since 1.12.2
 */
export interface CliData {
    /**
     * @public
     * @since 1.12.2
     */
    [key: string]: string | 'true';
}

/**
 * @public
 * @since 1.12.2
 */
export interface CliFlag {
    /**
     * Value placeholder (e.g., '<filename>', '<path>'). Omit for boolean flags.
     * @public
     * @since 1.12.2
     */
    value?: string;
    /**
     * Description shown in help and autocomplete
     * @public
     * @since 1.12.2
     */
    description: string;
    /**
     * Whether this flag is required (default: false)
     * @public
     * @since 1.12.2
     */
    required?: boolean;
}

/**
 * @public
 * @since 1.12.2
 */
export type CliFlags = Record<string, CliFlag>;

/**
 * @public
 * @since 1.12.2
 */
export type CliHandler = (params: CliData) => string | Promise<string>;

/**
 * Color picker component. Values are by default 6-digit hash-prefixed hex strings like `#000000`.
 * @public
 * @since 1.0.0
 */
export class ColorComponent extends ValueComponent<string> {

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;
    /**
     * @public
     * @since 1.0.0
     */
    getValue(): HexString;
    /**
     * @public
     * @since 1.0.0
     */
    getValueRgb(): RGB;
    /**
     * @public
     * @since 1.0.0
     */
    getValueHsl(): HSL;

    /**
     * @public
     * @since 1.0.0
     */
    setValue(value: HexString): this;
    /**
     * @public
     * @since 1.0.0
     */
    setValueRgb(rgb: RGB): this;
    /**
     * @public
     * @since 1.0.0
     */
    setValueHsl(hsl: HSL): this;

    /**
     * @public
     * @since 1.0.0
     */
    onChange(callback: (value: string) => any): this;
}

/**
 * @public
 */
export interface Command {
    /**
     * Globally unique ID to identify this command.
     * @public
     */
    id: string;
    /**
     * Human friendly name for searching.
     * @public
     */
    name: string;
    /**
     * Icon ID to be used in the toolbar.
     * See {@link https://docs.obsidian.md/Plugins/User+interface/Icons} for available icons and how to add your own.
     * @public
     */
    icon?: IconName;
    /** @public */
    mobileOnly?: boolean;
    /**
     * Whether holding the hotkey should repeatedly trigger this command.
     * @defaultValue false
     * @public
     */
    repeatable?: boolean;
    /**
     * Simple callback, triggered globally.
     * @example
     * ```ts
     * this.addCommand({
     *   id: 'print-greeting-to-console',
     *   name: 'Print greeting to console',
     *   callback: () => {
     *     console.log('Hey, you!');
     *   },
     * });
     * ```
     * @public
     */
    callback?: () => any;
    /**
     * Complex callback, overrides the simple callback.
     * Used to 'check' whether your command can be performed in the current circumstances.
     * For example, if your command requires the active focused pane to be a MarkdownView, then
     * you should only return true if the condition is satisfied. Returning false or undefined causes
     * the command to be hidden from the command palette.
     *
     * @param checking - Whether the command palette is just 'checking' if your command should show right now.
     * If checking is true, then this function should not perform any action.
     * If checking is false, then this function should perform the action.
     * @returns Whether this command can be executed at the moment.
     *
     * @example
     * ```ts
     * this.addCommand({
     *   id: 'example-command',
     *   name: 'Example command',
     *   checkCallback: (checking: boolean) => {
     *     const value = getRequiredValue();
     *
     *     if (value) {
     *       if (!checking) {
     *         doCommand(value);
     *       }
     *       return true;
     *     }
     *
     *     return false;
     *   }
     * });
     * ```
     *
     * @public
     */
    checkCallback?: (checking: boolean) => boolean | void;

    /**
     * A command callback that is only triggered when the user is in an editor.
     * Overrides `callback` and `checkCallback`
     * @example
     * ```ts
     * this.addCommand({
     *   id: 'example-command',
     *   name: 'Example command',
     *   editorCallback: (editor: Editor, view: MarkdownView) => {
     *     const sel = editor.getSelection();
     *
     *     console.log(`You have selected: ${sel}`);
     *   }
     * });
     * ```
     * @public
     * @since 0.12.2
     */
    editorCallback?: (editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => any;
    /**
     * A command callback that is only triggered when the user is in an editor.
     * Overrides `editorCallback`, `callback` and `checkCallback`
     * @example
     * ```ts
     * this.addCommand({
     *   id: 'example-command',
     *   name: 'Example command',
     *   editorCheckCallback: (checking: boolean, editor: Editor, view: MarkdownView) => {
     *     const value = getRequiredValue();
     *
     *     if (value) {
     *       if (!checking) {
     *         doCommand(value);
     *       }
     *
     *       return true;
     *     }
     *
     *     return false;
     *   }
     * });
     * ```
     * @public
     * @since 0.12.2
     */
    editorCheckCallback?: (checking: boolean, editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => boolean | void;
    /**
     * Sets the default hotkey. It is recommended for plugins to avoid setting default hotkeys if possible,
     * to avoid conflicting hotkeys with one that's set by the user, even though customized hotkeys have higher priority.
     * @public
     */
    hotkeys?: Hotkey[];

}

/**
 * @public
 * @since 0.9.7
 */
export class Component {

    /**
     * Load this component and its children
     * @public
     * @since 0.9.7
     */
    load(): void;
    /**
     * Override this to load your component
     * @public
     * @virtual
     * @since 0.9.7
     */
    onload(): void;
    /**
     * Unload this component and its children
     * @public
     * @since 0.9.7
     */
    unload(): void;
    /**
     * Override this to unload your component
     * @public
     * @virtual
     * @since 0.9.7
     */
    onunload(): void;
    /**
     * Adds a child component, loading it if this component is loaded
     * @public
     * @since 0.12.0
     */
    addChild<T extends Component>(component: T): T;
    /**
     * Removes a child component, unloading it
     * @public
     * @since 0.12.0
     */
    removeChild<T extends Component>(component: T): T;
    /**
     * Registers a callback to be called when unloading
     * @public
     * @since 0.9.7
     */
    register(cb: () => any): void;
    /**
     * Registers an event to be detached when unloading
     * @public
     * @since 0.9.7
     */
    registerEvent(eventRef: EventRef): void;
    /**
     * Registers a DOM event to be detached when unloading
     * @public
     * @since 0.14.8
     */
    registerDomEvent<K extends keyof WindowEventMap>(el: Window, type: K, callback: (this: HTMLElement, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
    /**
     * Registers a DOM event to be detached when unloading
     * @public
     * @since 0.14.8
     */
    registerDomEvent<K extends keyof DocumentEventMap>(el: Document, type: K, callback: (this: HTMLElement, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
    /**
     * Registers a DOM event to be detached when unloading
     * @public
     * @since 0.14.8
     */
    registerDomEvent<K extends keyof HTMLElementEventMap>(el: HTMLElement, type: K, callback: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;

    /**
     * Registers an interval (from setInterval) to be cancelled when unloading
     * Use {@link window.setInterval} instead of {@link setInterval} to avoid TypeScript confusing between NodeJS vs Browser API
     * @public
     * @since 0.13.8
     */
    registerInterval(id: number): number;
}

/**
 * A button inside a {@link ConfirmationModal}'s button row. Clicking the button
 * closes the modal after the click handler resolves; return a truthy value from
 * the handler to keep the modal open (for example, to surface a validation error).
 * @public
 * @since 1.13.0
 */
export class ConfirmationButton extends ButtonComponent {

    /**
     * Private constructor. Use {@link ConfirmationModal.addButton} instead.
     * @public
     */
    private constructor();
    /**
     * @public
     * @since 1.13.0
     */
    onClick(handler: (evt: MouseEvent) => unknown | Promise<unknown>): this;
    /**
     * Mark this button as the focus target when the modal opens. If multiple
     * buttons in the same modal have this set, the last-marked one wins.
     * @public
     * @since 1.13.0
     */
    setInitialFocus(): this;
    /**
     * Place the button separately from the main button group (e.g. for a
     * tertiary action that shouldn't sit next to the primary/cancel pair).
     * @public
     * @since 1.13.0
     */
    setSecondary(): this;
    /**
     * Style the button as the dismissal action.
     * @public
     * @since 1.13.0
     */
    setCancel(): this;
}

/**
 * A modal that asks the user to confirm an action. Use {@link ConfirmationModal.addButton}
 * to add each option to the button row, and {@link ConfirmationModal.addCancelButton} for
 * the dismissal button. Buttons auto-close the modal on click unless the handler returns truthy.
 * @public
 * @since 1.13.0
 */
export class ConfirmationModal extends Modal {
    /**
     * @public
     * @since 1.13.0
     */
    buttonContainerEl: HTMLElement;

    /**
     * @public
     * @since 1.13.0
     */
    constructor(app: App);
    /**
     * @public
     * @since 1.13.0
     */
    addClass(cls: string): this;
    /**
     * @public
     * @since 1.13.0
     */
    addCheckbox(label: string, cb: (value: boolean) => any | Promise<any>): this;
    /**
     * @public
     * @since 1.13.0
     */
    addButton(cb: (btn: ConfirmationButton) => any): this;
    /**
     * @public
     * @since 1.13.0
     */
    addCancelButton(text?: string): this;

}

/** @public */
export type Constructor<T> = abstract new (...args: any[]) => T;

/**
 * Work directly with files and folders inside a vault.
 * If possible prefer using the {@link Vault} API over this.
 * @public
 */
export interface DataAdapter {

    /**
     * @public
     */
    getName(): string;

    /**
     * Check if something exists at the given path. For a faster way to synchronously check
     * if a note or attachment is in the vault, use {@link Vault.getAbstractFileByPath}.
     * @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @param sensitive - Some file systems/operating systems are case-insensitive, set to true to force a case-sensitivity check.
     * @public
     */
    exists(normalizedPath: string, sensitive?: boolean): Promise<boolean>;
    /**
     * Retrieve metadata about the given file/folder.
     * @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @public
     * @since 0.12.2
     */
    stat(normalizedPath: string): Promise<Stat | null>;
    /**
     * Retrieve a list of all files and folders inside the given folder, non-recursive.
     * @param normalizedPath - path to folder, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    list(normalizedPath: string): Promise<ListedFiles>;
    /**
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    read(normalizedPath: string): Promise<string>;
    /**
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    readBinary(normalizedPath: string): Promise<ArrayBuffer>;
    /**
     * Write to a plaintext file.
     * If the file exists its content will be overwritten, otherwise the file will be created.
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @param data - new file content
     * @param options - (Optional)
     * @public
     */
    write(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * Write to a binary file.
     * If the file exists its content will be overwritten, otherwise the file will be created.
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @param data - the new file content
     * @param options - (Optional)
     * @public
     */
    writeBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * Add text to the end of a plaintext file.
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @param data - the text to append.
     * @param options - (Optional)
     * @public
     */
    append(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * Add data to the end of a binary file.
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @param data - the data to append.
     * @param options - (Optional)
     * @public
     * @since 1.12.3
     */
    appendBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * Atomically read, modify, and save the contents of a plaintext file.
     * @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @param fn - a callback function which returns the new content of the file synchronously.
     * @param options - write options.
     * @returns string - the text value of the file that was written.
     * @public
     */
    process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;
    /**
     * Returns a URI for the browser engine to use, for example to embed an image.
     * @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    getResourcePath(normalizedPath: string): string;
    /**
     * Create a directory.
     * @param normalizedPath - path to use for new folder, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    mkdir(normalizedPath: string): Promise<void>;
    /**
     * Try moving to system trash.
     * @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @returns Returns true if succeeded. This can fail due to system trash being disabled.
     * @public
     */
    trashSystem(normalizedPath: string): Promise<boolean>;
    /**
     * Move to local trash.
     * Files will be moved into the `.trash` folder at the root of the vault.
     * @param normalizedPath - path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    trashLocal(normalizedPath: string): Promise<void>;
    /**
     * Remove a directory.
     * @param normalizedPath - path to folder, use {@link normalizePath} to normalize beforehand.
     * @param recursive - If `true`, delete folders under this folder recursively, if `false` the folder needs to be empty.
     * @public
     */
    rmdir(normalizedPath: string, recursive: boolean): Promise<void>;
    /**
     * Delete a file.
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    remove(normalizedPath: string): Promise<void>;

    /**
     * Rename a file or folder.
     * @param normalizedPath - current path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @param normalizedNewPath - new path to file/folder, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    rename(normalizedPath: string, normalizedNewPath: string): Promise<void>;
    /**
     * Create a copy of a file.
     * This will fail if there is already a file at `normalizedNewPath`.
     * @param normalizedPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @param normalizedNewPath - path to file, use {@link normalizePath} to normalize beforehand.
     * @public
     */
    copy(normalizedPath: string, normalizedNewPath: string): Promise<void>;
}

/**
 * @public
 */
export interface DataWriteOptions {
    /**
     * Time of creation, represented as a unix timestamp, in milliseconds.
     * Omit this if you want to keep the default behaviour.
     * @public
     */
    ctime?: number;
    /**
     * Time of last modification, represented as a unix timestamp, in milliseconds.
     * Omit this if you want to keep the default behaviour.
     * @public
     */
    mtime?: number;

}

/**
 * {@link Value} wrapping a Date.
 * @public
 * @since 1.10.0
 */
export class DateValue extends NotNullValue {

    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;

    /**
     * @returns a new DateValue with any time portion in this DateValue removed.
     * @public
     * @since 1.10.0
     */
    dateOnly(): DateValue;

    /**
     * @returns a new {@link RelativeDateValue} based on this DateValue.
     * @public
     * @since 1.10.0
     */
    relative(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;

    /**
     * Create new DateValue from an input string.
     *
     * @example
     * parseFromString("2025-12-31")
     * parseFromString("2025-12-31T23:59")
     * parseFromString("2025-12-31T23:59:59")
     * parseFromString("2025-12-31T23:59:59Z-07")
     *
     * @param input - An ISO 8601 date or datetime string.
     * @public
     * @since 1.10.0
     */
    static parseFromString(input: string): DateValue | null;

}

/**
 * A standard debounce function.
 * Use this to have a time-delayed function only be called once in a given timeframe.
 *
 * @param cb - The function to call.
 * @param timeout - The timeout to wait, in milliseconds
 * @param resetTimer - Whether to reset the timeout when the debounce function is called again.
 * @returns a debounced function that takes the same parameter as the original function.
 * @example
 * ```ts
 * const debounced = debounce((text: string) => {
 *     console.log(text);
 * }, 1000, true);
 * debounced('Hello world'); // this will not be printed
 * await sleep(500);
 * debounced('World, hello'); // this will be printed to the console.
 * ```
 * @public
 */
export function debounce<T extends unknown[], V>(cb: (...args: [...T]) => V, timeout?: number, resetTimer?: boolean): Debouncer<T, V>;

/** @public */
export interface Debouncer<T extends unknown[], V> {
    /** @public */
    (...args: [...T]): this;
    /**
     * Cancel any pending debounced function call.
     * @public
     */
    cancel(): this;
    /**
     * If there is any pending function call, clear the timer and call the function immediately.
     * @public
     * @since 1.4.4
     */
    run(): V | void;
}

/**
 * Manually trigger a tooltip that will appear over the provided element.
 *
 * To display a tooltip on hover, use {@link setTooltip} instead.
 * @public
 * @since 1.8.7
 */
export function displayTooltip(newTargetEl: HTMLElement, content: string | DocumentFragment, options?: TooltipOptions): void;

/**
 * A read-only display value for a setting row: a value label and an optional
 * status indicator. On a navigable row, it surfaces the value edited on the
 * page the row opens, so the user can see it without opening that page.
 * @public
 * @since 1.13.1
 */
export class DisplayValueComponent {
    /**
     * @public
     * @since 1.13.1
     */
    valueEl: HTMLElement;

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * Set the value label text. Pass an empty string or `null` to clear it.
     * @public
     * @since 1.13.1
     */
    setValue(value: string | null): this;
    /**
     * Show a status indicator on the row. Use `'warning'` when the value needs
     * the user's attention; the explanation itself belongs on the page this
     * row leads to, while this only signals that there is something to look at.
     * Pass `null` to clear it.
     * @public
     * @since 1.13.1
     */
    setStatus(status: 'warning' | null): this;
}

/**
 * @public
 * @since 0.9.7
 */
export class DropdownComponent extends ValueComponent<string> {
    /**
     * @public
     * @since 0.9.7
     */
    selectEl: HTMLSelectElement;

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);

    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;
    /**
     * @public
     * @since 0.9.7
     */
    addOption(value: string, display: string): this;
    /**
     * @public
     * @since 0.9.7
     */
    addOptions(options: Record<string, string>): this;
    /**
     * @public
     * @since 0.9.7
     */
    getValue(): string;
    /**
     * @public
     * @since 0.9.7
     */
    setValue(value: string): this;
    /**
     * @public
     * @since 0.9.7
     */
    onChange(callback: (value: string) => any): this;
}

/**
 * {@link Value} wrapping a duration. Durations can be used to modify a {@link DateValue} or can
 * result from subtracting a DateValue from another.
 * @public
 * @since 1.10.0
 */
export class DurationValue extends NotNullValue {

    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;

    /**
     * Modifies the provided {@DateValue} by this duration.
     * @public
     * @since 1.10.0
     */
    addToDate(value: DateValue, subtract?: boolean): DateValue;
    /**
     * Convert this duration into milliseconds.
     * @public
     * @since 1.10.0
     */
    getMilliseconds(): number;

    /**
     * Create a new DurationValue using an ISO 8601 duration.
     * See {@link https://en.wikipedia.org/wiki/ISO_8601#Durations} for duration format details.
     * @public
     * @since 1.10.0
     */
    static parseFromString(input: string): DurationValue | null;
    /**
     * Create a new DurationValue from milliseconds.
     * @public
     * @since 1.10.0
     */
    static fromMilliseconds(milliseconds: number): DurationValue;
}

/**
 * @public
 * @since 0.9.7
 */
export abstract class EditableFileView extends FileView {

}

/**
 * A common interface that bridges the gap between CodeMirror 5 and CodeMirror 6.
 * @public
 * @since 0.11.11
 */
export abstract class Editor {

    /**
     * @public
     * @since 0.11.11
     */
    getDoc(): this;
    /**
     * @public
     * @since 0.11.11
     */
    abstract refresh(): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract getValue(): string;
    /** @public
     * @since 0.11.11
     */
    abstract setValue(content: string): void;
    /**
     * Get the text at line (0-indexed)
     * @public
     * @since 0.11.11
     */
    abstract getLine(line: number): string;
    /**
     * @public
     * @since 0.11.11
     */
    setLine(n: number, text: string): void;
    /**
     * Gets the number of lines in the document
     * @public
     * @since 0.11.11
     */
    abstract lineCount(): number;
    /**
     * @public
     * @since 0.11.11
     */
    abstract lastLine(): number;
    /**
     * @public
     * @since 0.11.11
     */
    abstract getSelection(): string;
    /**
     * @public
     * @since 0.11.11
     */
    somethingSelected(): boolean;
    /**
     * @public
     * @since 0.11.11
     */
    abstract getRange(from: EditorPosition, to: EditorPosition): string;
    /**
     * @public
     * @since 0.11.11
     */
    abstract replaceSelection(replacement: string, origin?: string): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract replaceRange(replacement: string, from: EditorPosition, to?: EditorPosition, origin?: string): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract getCursor(side?: 'from' | 'to' | 'head' | 'anchor'): EditorPosition;
    /**
     * @public
     * @since 0.11.11
     */
    abstract listSelections(): EditorSelection[];
    /**
     * @public
     * @since 0.11.11
     */
    setCursor(pos: EditorPosition | number, ch?: number): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract setSelection(anchor: EditorPosition, head?: EditorPosition): void;
    /**
     * @public
     * @since 0.12.11
     */
    abstract setSelections(ranges: EditorSelectionOrCaret[], main?: number): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract focus(): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract blur(): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract hasFocus(): boolean;
    /**
     * @public
     * @since 0.11.11
     */
    abstract getScrollInfo(): {
        /**
         * @public
         * @since 0.11.11
         */
        top: number;
        /**
         * @public
         * @since 0.11.11
         */
        left: number;
    };
    /**
     * @public
     * @since 0.11.11
     */
    abstract scrollTo(x?: number | null, y?: number | null): void;
    /**
     * @public
     * @since 0.13.0
     */
    abstract scrollIntoView(range: EditorRange, center?: boolean): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract undo(): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract redo(): void;
    /**
     * @public
     * @since 0.12.2
     */
    abstract exec(command: EditorCommandName): void;
    /**
     * @public
     * @since 0.13.0
     */
    abstract transaction(tx: EditorTransaction, origin?: string): void;
    /**
     * @public
     * @since 0.11.11
     */
    abstract wordAt(pos: EditorPosition): EditorRange | null;
    /**
     * @public
     * @since 0.11.11
     */
    abstract posToOffset(pos: EditorPosition): number;
    /**
     * @public
     * @since 0.11.11
     */
    abstract offsetToPos(offset: number): EditorPosition;

    /**
     * @public
     * @since 0.13.26
     */
    processLines<T>(read: (line: number, lineText: string) => T | null, write: (line: number, lineText: string, value: T | null) => EditorChange | void, ignoreEmpty?: boolean): void;

}

/**
 * @public
 * @since 0.12.11
 */
export interface EditorChange extends EditorRangeOrCaret {
    /** @public */
    text: string;
}

/** @public */
export type EditorCommandName = 'goUp' | 'goDown' | 'goLeft' | 'goRight' | 'goStart' | 'goEnd' | 'goWordLeft' | 'goWordRight' | 'indentMore' | 'indentLess' | 'newlineAndIndent' | 'swapLineUp' | 'swapLineDown' | 'deleteLine' | 'toggleFold' | 'foldAll' | 'unfoldAll';

/**
 * Use this StateField to get a reference to the EditorView
 * @public
 */
export const editorEditorField: StateField<EditorView>;

/**
 * Use this StateField to get information about this Markdown editor, such as the associated file, or the Editor.
 * @public
 */
export const editorInfoField: StateField<MarkdownFileInfo>;

/**
 * Use this StateField to check whether Live Preview is active
 * @public
 */
export const editorLivePreviewField: StateField<boolean>;

/**
 * @public
 * @since 0.12.11
 */
export interface EditorPosition {
    /** @public */
    line: number;
    /** @public */
    ch: number;
}

/**
 * @public
 * @since 0.12.11
 */
export interface EditorRange {
    /** @public */
    from: EditorPosition;
    /** @public */
    to: EditorPosition;
}

/**
 * @public
 * @since 0.12.11
 */
export interface EditorRangeOrCaret {
    /** @public */
    from: EditorPosition;
    /** @public */
    to?: EditorPosition;
}

/**
 * @public
 * @since 0.15.0
 */
export interface EditorScrollInfo {
    /** @public */
    left: number;
    /** @public */
    top: number;
    /** @public */
    width: number;
    /** @public */
    height: number;
    /** @public */
    clientWidth: number;
    /** @public */
    clientHeight: number;
}

/**
 * @public
 * @since 0.12.11
 */
export interface EditorSelection {
    /** @public */
    anchor: EditorPosition;
    /** @public */
    head: EditorPosition;
}

/**
 * @public
 * @since 0.12.11
 */
export interface EditorSelectionOrCaret {
    /** @public */
    anchor: EditorPosition;
    /** @public */
    head?: EditorPosition;
}

/**
 * @public
 * @since 0.12.17
 */
export abstract class EditorSuggest<T> extends PopoverSuggest<T> {

    /**
     * Current suggestion context, containing the result of `onTrigger`.
     * This will be null any time the EditorSuggest is not supposed to run.
     * @public
     * @since 0.12.17
     */
    context: EditorSuggestContext | null;
    /**
     * Override this to use a different limit for suggestion items
     * @public
     * @since 0.12.17
     */
    limit: number;
    /**
     * @public
     */
    constructor(app: App);
    /**
     * @public
     * @since 0.13.0
     */
    setInstructions(instructions: Instruction[]): void;

    /**
     * Based on the editor line and cursor position, determine if this EditorSuggest should be triggered at this moment.
     * Typically, you would run a regular expression on the current line text before the cursor.
     * Return null to indicate that this editor suggest is not supposed to be triggered.
     *
     * Please be mindful of performance when implementing this function, as it will be triggered very often (on each keypress).
     * Keep it simple, and return null as early as possible if you determine that it is not the right time.
     * @public
     * @since 1.1.13
     */
    abstract onTrigger(cursor: EditorPosition, editor: Editor, file: TFile | null): EditorSuggestTriggerInfo | null;
    /**
     * Generate suggestion items based on this context. Can be async, but preferably sync.
     * When generating async suggestions, you should pass the context along.
     * @public
     * @since 0.12.17
     */
    abstract getSuggestions(context: EditorSuggestContext): T[] | Promise<T[]>;

}

/**
 * @public
 * @since 0.12.17
 */
export interface EditorSuggestContext extends EditorSuggestTriggerInfo {
    /** @public */
    editor: Editor;
    /** @public */
    file: TFile;
}

/**
 * @public
 * @since 0.12.17
 */
export interface EditorSuggestTriggerInfo {
    /**
     * The start position of the triggering text. This is used to position the popover.
     * @public
     */
    start: EditorPosition;
    /**
     * The end position of the triggering text. This is used to position the popover.
     * @public
     */
    end: EditorPosition;
    /**
     * They query string (usually the text between start and end) that will be used to generate the suggestion content.
     * @public
     */
    query: string;
}

/** @public */
export interface EditorTransaction {
    /** @public */
    replaceSelection?: string;
    /** @public */
    changes?: EditorChange[];
    /**
     * Multiple selections, overrides `selection`.
     * @public
     */
    selections?: EditorRangeOrCaret[];
    /** @public */
    selection?: EditorRangeOrCaret;
}

/**
 * This is now deprecated - it is now mapped directly to `editorInfoField`, which return a MarkdownFileInfo, which may be a MarkdownView but not necessarily.
 * @public
 * @deprecated use {@link editorInfoField} instead.
 */
export const editorViewField: StateField<MarkdownFileInfo>;

/**
 * @public
 * @since 0.9.7
 */
export interface EmbedCache extends ReferenceCache {
}

/**
 * @public
 */
export interface EventRef {

}

/**
 * @public
 * @since 0.9.7
 */
export class Events {

    /**
     * @public
     * @since 0.9.7
     */
    on(name: string, callback: (...data: unknown[]) => unknown, ctx?: any): EventRef;
    /**
     * @public
     * @since 0.9.7
     */
    off(name: string, callback: (...data: unknown[]) => unknown): void;
    /**
     * @public
     * @since 0.9.7
     */
    offref(ref: EventRef): void;
    /**
     * @public
     * @since 0.9.7
     */
    trigger(name: string, ...data: unknown[]): void;
    /**
     * @public
     * @since 0.9.7
     */
    tryTrigger(evt: EventRef, args: unknown[]): void;
}

/**
 * @public
 * @since 0.9.7
 */
export class ExtraButtonComponent extends BaseComponent {
    /**
     * @public
     * @since 0.9.7
     */
    extraSettingsEl: HTMLElement;

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;
    /**
     * @public
     * @since 1.1.0
     */
    setTooltip(tooltip: string, options?: TooltipOptions): this;
    /**
     * @param icon - ID of the icon, can use any icon loaded with {@link addIcon} or from the inbuilt library.
     * @see The Obsidian icon library includes the {@link https://lucide.dev/ Lucide icon library}, any icon name from their site will work here.
     * @public
     * @since 0.9.7
     */
    setIcon(icon: IconName): this;
    /**
     * @public
     * @since 0.9.7
     */
    onClick(callback: () => any): this;
}

/**
 * Manage the creation, deletion and renaming of files from the UI.
 * @public
 * @since 0.9.7
 */
export class FileManager {

    /**
     * Gets the folder that new files should be saved to, given the user's preferences.
     * @param sourcePath - The path to the current open/focused file,
     * used when the user wants new files to be created 'in the same folder'.
     * Use an empty string if there is no active file.
     * @param newFilePath - The path to the file that will be newly created,
     * used to infer what settings to use based on the path's extension.
     * @public
     * @since 1.1.13
     */
    getNewFileParent(sourcePath: string, newFilePath?: string): TFolder;

    /**
     * Rename or move a file safely, and update all links to it depending on the user's preferences.
     * @param file - the file to rename
     * @param newPath - the new path for the file
     * @public
     * @since 0.11.0
     */
    renameFile(file: TAbstractFile, newPath: string): Promise<void>;

    /**
     * Prompt the user to confirm they want to delete the specified file or folder
     * @param file - the file or folder to delete
     * @returns A promise that resolves to true if the prompt was confirmed or false if it was canceled
     * @public
     * @since 0.15.0
     */
    promptForDeletion(file: TAbstractFile): Promise<boolean>;

    /**
     * Remove a file or a folder from the vault according the user's preferred 'trash'
     * options (either moving the file to .trash/ or the OS trash bin).
     * @param file
     * @public
     * @since 1.6.6
     */
    trashFile(file: TAbstractFile): Promise<void>;

    /**
     * Generate a Markdown link based on the user's preferences.
     * @param file - the file to link to.
     * @param sourcePath - where the link is stored in, used to compute relative links.
     * @param subpath - A subpath, starting with `#`, used for linking to headings or blocks.
     * @param alias - The display text if it's to be different than the file name. Pass empty string to use file name.
     * @public
     * @since 0.12.0
     */
    generateMarkdownLink(file: TFile, sourcePath: string, subpath?: string, alias?: string): string;

    /**
     * Atomically read, modify, and save the frontmatter of a note.
     * The frontmatter is passed in as a JS object, and should be mutated directly to achieve the desired result.
     *
     * Remember to handle errors thrown by this method.
     *
     * @param file - the file to be modified. Must be a Markdown file.
     * @param fn - a callback function which mutates the frontmatter object synchronously.
     * @param options - write options.
     * @throws YAMLParseError if the YAML parsing fails
     * @throws any errors that your callback function throws
     * @example
     * ```ts
     * app.fileManager.processFrontMatter(file, (frontmatter) => {
     *     frontmatter['key1'] = value;
     *     delete frontmatter['key2'];
     * });
     * ```
     * @public
     * @since 1.4.4
     */
    processFrontMatter(file: TFile, fn: (frontmatter: any) => void, options?: DataWriteOptions): Promise<void>;

    /**
     * Resolves a unique path for the attachment file being saved.
     * Ensures that the parent directory exists and dedupes the
     * filename if the destination filename already exists.
     *
     * @param filename Name of the attachment being saved
     * @param sourcePath The path to the note associated with this attachment, defaults to the workspace's active file.
     * @returns Full path for where the attachment should be saved, according to the user's settings
     * @public
     * @since 1.5.7
     */
    getAvailablePathForAttachment(filename: string, sourcePath?: string): Promise<string>;

}

/**
 * @public
 */
export interface FileStats {
    /**
     * Time of creation, represented as a unix timestamp, in milliseconds.
     * @public
     */
    ctime: number;
    /**
     * Time of last modification, represented as a unix timestamp, in milliseconds.
     * @public
     */
    mtime: number;
    /**
     * Size on disk, as bytes.
     * @public
     */
    size: number;
}

/**
 * Implementation of the vault adapter for desktop.
 * @public
 */
export class FileSystemAdapter implements DataAdapter {

    /**
     * @public
     */
    getName(): string;
    /**
     * @public
     */
    getBasePath(): string;

    /**
     * @public
     */
    mkdir(normalizedPath: string): Promise<void>;
    /**
     * @public
     */
    trashSystem(normalizedPath: string): Promise<boolean>;
    /**
     * @public
     */
    trashLocal(normalizedPath: string): Promise<void>;
    /**
     * @public
     */
    rmdir(normalizedPath: string, recursive: boolean): Promise<void>;
    /**
     * @public
     */
    read(normalizedPath: string): Promise<string>;
    /**
     * @public
     */
    readBinary(normalizedPath: string): Promise<ArrayBuffer>;
    /**
     * @public
     */
    write(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     */
    writeBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     */
    append(normalizedPath: string, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     * @since 1.12.3
     */
    appendBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * @public
     */
    process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;

    /**
     * @public
     */
    getResourcePath(normalizedPath: string): string;
    /**
     * Returns the file:// path of this file
     * @public
     * @since 0.14.3
     */
    getFilePath(normalizedPath: string): string;
    /**
     * @public
     */
    remove(normalizedPath: string): Promise<void>;

    /**
     * @public
     */
    rename(normalizedPath: string, normalizedNewPath: string): Promise<void>;

    /**
     * @public
     */
    copy(normalizedPath: string, normalizedNewPath: string): Promise<void>;
    /**
     * @public
     */
    exists(normalizedPath: string, sensitive?: boolean): Promise<boolean>;

    /**
     * @public
     * @since 0.12.2
     */
    stat(normalizedPath: string): Promise<Stat | null>;
    /**
     * @public
     */
    list(normalizedPath: string): Promise<ListedFiles>;

    /**
     * @public
     */
    getFullPath(normalizedPath: string): string;

    /**
     * @public
     */
    static readLocalFile(path: string): Promise<ArrayBuffer>;
    /**
     * @public
     */
    static mkdir(path: string): Promise<void>;
}

/**
 * {@link Value} wrapping a file in Obsidian.
 * @public
 * @since 1.10.0
 */
export class FileValue extends NotNullValue {

    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;

}

/**
 * @public
 */
export abstract class FileView extends ItemView {
    /**
     * @public
     */
    allowNoFile: boolean;
    /**
     * @public
     */
    file: TFile | null;
    /**
     * File views can be navigated by default.
     * @inheritDoc
     * @public
     */
    navigation: boolean;
    /**
     * @public
     */
    constructor(leaf: WorkspaceLeaf);

    /**
     * @public
     */
    getDisplayText(): string;
    /**
     * @public
     */
    onload(): void;
    /**
     * @public
     */
    getState(): Record<string, unknown>;

    /**
     * @public
     * @since 0.9.7
     */
    setState(state: any, result: ViewStateResult): Promise<void>;

    /**
     * @public
     */
    onLoadFile(file: TFile): Promise<void>;
    /**
     * @public
     */
    onUnloadFile(file: TFile): Promise<void>;
    /**
     * @public
     */
    onRename(file: TFile): Promise<void>;

    /**
     * @public
     * @since 0.9.7
     */
    canAcceptExtension(extension: string): boolean;
}

/**
 * Flush the MathJax stylesheet.
 * @public
 */
export function finishRenderMath(): Promise<void>;

/**
 * @public
 */
export interface FootnoteCache extends CacheItem {
    /**
     * @public
     */
    id: string;
}

/**
 * @public
 */
export interface FootnoteRefCache extends CacheItem {
    /**
     * @public
     */
    id: string;
}

/**
 * @public
 * @since 1.7.2
 */
export interface FootnoteSubpathResult extends SubpathResult {
    /**
     * @public
     */
    type: 'footnote';
    /**
     * @public
     */
    footnote: FootnoteCache;
}

/**
 * The context in which a formula is evaluated. In most cases, {@link BasesEntry} is the specific type to use.
 * @public
 * @since 1.10.0
 */
export interface FormulaContext {

}

/**
 * @public
 */
export interface FrontMatterCache {
    /**
     * @public
     */
    [key: string]: any;
}

/** @public */
export interface FrontMatterInfo {
    /** @public Whether this file has a frontmatter block */
    exists: boolean;
    /** @public String representation of the frontmatter */
    frontmatter: string;
    /** @public Start of the frontmatter contents (excluding the ---) */
    from: number;
    /** @public End of the frontmatter contents (excluding the ---) */
    to: number;
    /** @public Offset where the frontmatter block ends (including the ---) */
    contentStart: number;
}

/**
 * @public
 */
export interface FrontmatterLinkCache extends Reference {
    /**
     * @public
     */
    key: string;
}

/**
 * @public
 * @since 0.9.20
 */
export interface FuzzyMatch<T> {
    /**
     * @public
     * @since 0.9.20
     */
    item: T;
    /**
     * @public
     * @ince 0.9.20
     */
    match: SearchResult;
}

/**
 * @public
 * @since 0.9.20
 */
export abstract class FuzzySuggestModal<T> extends SuggestModal<FuzzyMatch<T>> {

    /**
     * @public
     * @since 0.9.20
     */
    getSuggestions(query: string): FuzzyMatch<T>[];
    /**
     * @public
     * @since 0.9.20
     */
    renderSuggestion(item: FuzzyMatch<T>, el: HTMLElement): void;
    /**
     * @public
     * @since 0.9.20
     */
    onChooseSuggestion(item: FuzzyMatch<T>, evt: MouseEvent | KeyboardEvent): void;
    /**
     * @public
     * @since 0.9.20
     */
    abstract getItems(): T[];
    /**
     * @public
     * @since 0.9.20
     */
    abstract getItemText(item: T): string;
    /**
     * @public
     * @since 0.9.20
     */
    abstract onChooseItem(item: T, evt: MouseEvent | KeyboardEvent): void;
}

/**
 * Combines all tags from frontmatter and note content into a single array.
 * @public
 */
export function getAllTags(cache: CachedMetadata): string[] | null;

/** @public */
export function getBlobArrayBuffer(blob: Blob): Promise<ArrayBuffer>;

/**
 * Given the contents of a file, get information about the frontmatter of the file, including
 * whether there is a frontmatter block, the offsets of where it starts and ends, and the frontmatter text.
 *
 * @public
 * @since 1.5.7
 */
export function getFrontMatterInfo(content: string): FrontMatterInfo;

/**
 * Create an SVG from an iconId. Returns null if no icon associated with the iconId.
 * @param iconId - the icon ID
 * @public
 */
export function getIcon(iconId: string): SVGSVGElement | null;

/**
 * Get the list of registered icons.
 * @public
 */
export function getIconIds(): IconName[];

/**
 * Get the ISO code for the currently configured app language. Defaults to 'en'.
 * See {@link https://github.com/obsidianmd/obsidian-translations?tab=readme-ov-file#existing-languages} for list of options.
 * @public
 * @since 1.8.7
 */
export function getLanguage(): string;

/**
 * Converts the linktext to a linkpath.
 * @param linktext A wikilink without the leading [[ and trailing ]]
 * @returns the name of the file that is being linked to.
 * @public
 */
export function getLinkpath(linktext: string): string;

/**
 * @public
 */
export interface HeadingCache extends CacheItem {
    /**
     * @public
     */
    heading: string;
    /**
     * Number between 1 and 6.
     * @public
     */
    level: number;
}

/**
 * @public
 * @since 0.9.16
 */
export interface HeadingSubpathResult extends SubpathResult {
    /**
     * @public
     * @since 0.9.16
     */
    type: 'heading';
    /**
     * @public
     * @since 0.9.16
     */
    current: HeadingCache;
    /**
     * @public
     * @since 0.9.16
     */
    next: HeadingCache;
}

/**
 * Hex strings are 6-digit hash-prefixed rgb strings in lowercase form.
 * Example: #ffffff
 * @public
 */
export type HexString = string;

/** @public */
export function hexToArrayBuffer(hex: string): ArrayBuffer;

/**
 * @public
 */
export interface HistoryHandler {
    /** @public */
    onHistoryBack(): void;
    /** @public */
    onHistoryForward?(): void;
}

/**
 * @public
 */
export interface Hotkey {
    /** @public */
    modifiers: Modifier[];
    /** @public */
    key: string;

}

/**
 * @public
 */
export interface HoverLinkSource {
    /**
     * Text displayed in the 'Page preview' plugin settings.
     * It should match the plugin's display name.
     * @public
     */
    display: string;
    /**
     * Whether the `hover-link` event requires the 'Mod' key to be pressed to trigger.
     * @public
     */
    defaultMod: boolean;
}

/**
 * @public
 * @since 0.11.13
 */
export interface HoverParent {
    /**
     * @public
     * @since 0.11.13
     */
    hoverPopover: HoverPopover | null;
}

/**
 * @public
 * @since 0.15.0
 */
export class HoverPopover extends Component {

    /**
     * @public
     */
    hoverEl: HTMLElement;
    /**
     * @public
     */
    state: PopoverState;

    /**
     * @public
     */
    constructor(parent: HoverParent, targetEl: HTMLElement | null, waitTime?: number, staticPos?: Point | null);

}

/**
 * @public
 * @since 0.16.0
 */
export interface HSL {
    /**
     * Hue integer value between 0 and 360
     * @public
     * @since 0.16.0
     */
    h: number;
    /**
     * Saturation integer value between 0 and 100
     * @public
     * @since 0.16.0
     */
    s: number;
    /**
     * Lightness integer value between 0 and 100
     * @public
     * @since 0.16.0
     */
    l: number;
}

/**
 * Converts HTML to a Markdown string.
 * @public
 */
export function htmlToMarkdown(html: string | HTMLElement | Document | DocumentFragment): string;

/**
 * {@link Value} wrapping raw HTML.
 * @public
 * @since 1.10.0
 */
export class HTMLValue extends StringValue {

}

/**
 * {@link Value} wrapping a renderable icon.
 * @public
 * @since 1.10.0
 */
export class IconValue extends StringValue {

}

/**
 * {@link Value} wrapping a path to an image resource in the vault.
 * @public
 * @since 1.10.0
 */
export class ImageValue extends StringValue {

}

/**
 * @public
 * @since 0.9.20
 */
export interface Instruction {
    /**
     * @public
     * @since 0.9.20
     */
    command: string;
    /**
     * @public
     * @since 0.9.20
     */
    purpose: string;
}

/**
 * @public
 */
export interface ISuggestOwner<T> {
    /**
     * Render the suggestion item into DOM.
     * @public
     */
    renderSuggestion(value: T, el: HTMLElement): void;
    /**
     * Called when the user makes a selection.
     * @public
     */
    selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void;

}

/**
 * @public
 *@since 0.9.7
 */
export abstract class ItemView extends View {

    /** @public */
    contentEl: HTMLElement;

    /**
     * @public
     */
    constructor(leaf: WorkspaceLeaf);

    /**
     * @public
     * @since 1.1.0
     */
    addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;

}

/**
 * Iterate links and embeds.
 * If callback returns true, the iteration process will be interrupted.
 * @returns true if callback ever returns true, false otherwise.
 * @public
 * @deprecated
 */
export function iterateCacheRefs(cache: CachedMetadata, cb: (ref: ReferenceCache) => boolean | void): boolean;

/**
 * If callback returns true, the iteration process will be interrupted.
 * @returns true if callback ever returns true, false otherwise.
 * @public
 */
export function iterateRefs(refs: Reference[], cb: (ref: Reference) => boolean | void): boolean;

/**
 * Manages keymap lifecycle for different {@link Scope}s.
 *
 * @public
 * @since 0.13.9
 */
export class Keymap {

    /**
     * Push a scope onto the scope stack, setting it as the active scope to handle all key events.
     * @public
     * @since 0.13.9
     */
    pushScope(scope: Scope): void;
    /**
     * Remove a scope from the scope stack.
     * If the given scope is active, the next scope in the stack will be made active.
     * @public
     * @since 0.13.9
     */
    popScope(scope: Scope): void;

    /**
     * Checks whether the modifier key is pressed during this event.
     * @public
     * @since 0.12.17
     */
    static isModifier(evt: MouseEvent | TouchEvent | KeyboardEvent, modifier: Modifier): boolean;

    /**
     * Translates an event into the type of pane that should open.
     * Returns 'tab' if the modifier key Cmd/Ctrl is pressed OR if this is a middle-click MouseEvent.
     * Returns 'split' if Cmd/Ctrl+Alt is pressed.
     * Returns 'window' if Cmd/Ctrl+Alt+Shift is pressed.
     * @public
     * @since 0.16.0
     */
    static isModEvent(evt?: UserEvent | null): PaneType | boolean;
}

/**
 * @public
 */
export interface KeymapContext extends KeymapInfo {
    /**
     * Interpreted virtual key.
     * @public
     */
    vkey: string;
}

/**
 * @public
 */
export interface KeymapEventHandler extends KeymapInfo {
    /** @public */
    scope: Scope;

}

/**
 * Return `false` to automatically preventDefault
 * @public
 */
export type KeymapEventListener = (evt: KeyboardEvent, ctx: KeymapContext) => false | any;

/**
 * @public
 * @since 0.10.4
 */
export interface KeymapInfo {
    /**
     * @public
     * @since 0.10.4
     */
    modifiers: string | null;
    /**
     * @public
     * @since 0.10.4
     */
    key: string | null;
}

/**
 * @public
 * @since 0.9.7
 */
export interface LinkCache extends ReferenceCache {
}

/**
 * {@link Value} wrapping an internal wikilink.
 * @public
 * @since 1.10.0
 */
export class LinkValue extends StringValue {

    /**
     * Create a new LinkValue from wikilink syntax.
     * @example
     * parseFromString("[[Welcome|Example Link]]")
     *
     * @public
     * @since 1.10.0
     */
    static parseFromString(app: App, input: string, sourcePath: string): LinkValue | null;

}

/**
 * @public
 */
export interface ListedFiles {
    /** @public */
    files: string[];
    /** @public */
    folders: string[];
}

/**
 * @public
 */
export interface ListItemCache extends CacheItem {
    /**
     * The block ID of this list item, if defined.
     * @public
     */
    id?: string | undefined;
    /**
     * A single character indicating the checked status of a task.
     * The space character `' '` is interpreted as an incomplete task.
     * Any other character is interpreted as completed task.
     * `undefined` if this item isn't a task.
     * @public
     */
    task?: string | undefined;
    /**
     * Line number of the parent list item (position.start.line).
     * If this item has no parent (e.g. it's a root level list),
     * then this value is the negative of the line number of the first list item (start of the list).
     *
     * Can be used to deduce which list items belongs to the same group (item1.parent === item2.parent).
     * Can be used to reconstruct hierarchy information (parentItem.position.start.line === childItem.parent).
     * @public
     */
    parent: number;
}

/**
 * {@link Value} wrapping an array of Values. Values do not all need to be of the same type.
 * @public
 * @since 1.10.0
 */
export class ListValue extends NotNullValue {
    /**
     * @public
     * @since 1.10.0
     */
    static type: string;

    /**
     * The array passed in will be modified!
     * @param value - Contents of the list.
     * @public
     * @since 1.10.0
     */
    constructor(value: (unknown | Value)[]);

    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;
    /**
     * @returns true if any elements in this list loosely equal the provided value.
     * @public
     * @since 1.10.0
     */
    includes(value: Value): boolean;

    /**
     * @returns the number of elements in this list.
     * @public
     * @since 1.10.0
     */
    length(): number;
    /**
     * @returns the value at the provided index, or {@link NullValue}.
     * @public
     * @since 1.10.0
     */
    get(index: number): Value;

    /**
     * @returns a new {@link ListValue} containing the elements from this ListValue and the provided ListValue.
     * @public
     * @since 1.10.0
     */
    concat(other: ListValue): ListValue;

}

/**
 * @public
 */
export const livePreviewState: ViewPlugin<LivePreviewStateType, undefined>;

/**
 * The object stored in the view plugin {@link livePreviewState}
 * @public
 */
export interface LivePreviewStateType {
    /**
     * True if the left mouse is currently held down in the editor
     * (for example, when drag-to-select text).
     * @public
     */
    mousedown: boolean;
}

/**
 * Load MathJax.
 * @see {@link https://www.mathjax.org/ Official MathJax documentation}
 * @public
 */
export function loadMathJax(): Promise<void>;

/**
 * Load Mermaid and return a promise to the global mermaid object.
 * Can also use `mermaid` after this promise resolves to get the same reference.
 * @see {@link https://mermaid.js.org/ Official Mermaid documentation}
 * @public
 */
export function loadMermaid(): Promise<any>;

/**
 * Load PDF.js and return a promise to the global pdfjsLib object.
 * Can also use `window.pdfjsLib` after this promise resolves to get the same reference.
 * @see {@link https://mozilla.github.io/pdf.js/ Official PDF.js documentation}
 * @public
 */
export function loadPdfJs(): Promise<any>;

/**
 * Load Prism.js and return a promise to the global Prism object.
 * Can also use `Prism` after this promise resolves to get the same reference.
 * @see {@link https://prismjs.com/ Official Prism documentation}
 * @public
 */
export function loadPrism(): Promise<any>;

/**
 * Location within a Markdown document
 * @public
 */
export interface Loc {
    /**
     * Line number. 0-based.
     * @public
     */
    line: number;
    /**
     * Column number.
     * @public
     */
    col: number;
    /**
     * Number of characters from the beginning of the file.
     * @public
     */
    offset: number;
}

/**
 * This is the editor for Obsidian Mobile as well as the WYSIWYG editor.
 * @public
 */
export class MarkdownEditView implements MarkdownSubView, HoverParent, MarkdownFileInfo {

    /** @public */
    app: App;

    /** @public */
    hoverPopover: HoverPopover;

    /**
     * @public
     */
    constructor(view: MarkdownView);

    /**
     * @public
     */
    clear(): void;
    /**
     * @public
     */
    get(): string;
    /**
     * @public
     */
    set(data: string, clear: boolean): void;

    /** @public */
    get file(): TFile;

    /**
     * @public
     */
    getSelection(): string;

    /**
     * @public
     */
    getScroll(): number;
    /**
     * @public
     */
    applyScroll(scroll: number): void;

}

/**
 * @public
 */
export interface MarkdownFileInfo extends HoverParent {
    /**
     * @public
     */
    app: App;
    /**
     * @public
     */
    get file(): TFile | null;

    /**
     * @public
     */
    editor?: Editor;
}

/**
 * A post processor receives an element which is a section of the preview.
 *
 * Post processors can mutate the DOM to render various things, such as mermaid graphs, latex equations, or custom controls.
 *
 * If your post processor requires lifecycle management, for example, to clear an interval, kill a subprocess, etc when this element is
 * removed from the app, look into {@link MarkdownPostProcessorContext.addChild}
 * @public
 * @since 0.10.12
 */
export interface MarkdownPostProcessor {
    /**
     * The processor function itself.
     * @public
     */
    (el: HTMLElement, ctx: MarkdownPostProcessorContext): Promise<any> | void;
    /**
     * An optional integer sort order. Defaults to 0. Lower number runs before higher numbers.
     * @public
     */
    sortOrder?: number;
}

/**
 * @public
 */
export interface MarkdownPostProcessorContext {
    /**
     * @public
     */
    docId: string;
    /**
     * The path to the associated file. Any links are assumed to be relative to the `sourcePath`.
     * @public
     */
    sourcePath: string;
    /** @public */
    frontmatter: any | null | undefined;

    /**
     * Adds a child component that will have its lifecycle managed by the renderer.
     *
     * Use this to add a dependent child to the renderer such that if the containerEl
     * of the child is ever removed, the component's unload will be called.
     * @public
     */
    addChild(child: MarkdownRenderChild): void;
    /**
     * Gets the section information of this element at this point in time.
     * Only call this function right before you need this information to get the most up-to-date version.
     * This function may also return null in many circumstances; if you use it, you must be prepared to deal with nulls.
     * @public
     */
    getSectionInfo(el: HTMLElement): MarkdownSectionInformation | null;

}

/** @public **/
export interface MarkdownPreviewEvents extends Component {

}

/**
 * @public
 * @since 0.9.7
 */
export class MarkdownPreviewRenderer {

    /**
     * @public
     * @since 0.10.12
     */
    static registerPostProcessor(postProcessor: MarkdownPostProcessor, sortOrder?: number): void;
    /**
     * @public
     * @since 0.9.7
     */
    static unregisterPostProcessor(postProcessor: MarkdownPostProcessor): void;

    /**
     * @public
     * @since 0.12.11
     */
    static createCodeBlockPostProcessor(language: string, handler: (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise<any> | void): (el: HTMLElement, ctx: MarkdownPostProcessorContext) => void;

}

/**
 * @public
 */
export class MarkdownPreviewView extends MarkdownRenderer implements MarkdownSubView, MarkdownPreviewEvents {

    /**
     * @public
     */
    containerEl: HTMLElement;

    /**
     * @public
     */
    get file(): TFile;

    /**
     * @public
     */
    get(): string;
    /**
     * @public
     */
    set(data: string, clear: boolean): void;
    /**
     * @public
     */
    clear(): void;

    /**
     * @public
     */
    rerender(full?: boolean): void;

    /**
     * @public
     */
    getScroll(): number;
    /**
     * @public
     */
    applyScroll(scroll: number): void;

}

/**
 * @public
 */
export class MarkdownRenderChild extends Component {
    /** @public */
    containerEl: HTMLElement;
    /**
     * @param containerEl - This HTMLElement will be used to test whether this component is still alive.
     * It should be a child of the Markdown preview sections, and when it's no longer attached
     * (for example, when it is replaced with a new version because the user edited the Markdown source code),
     * this component will be unloaded.
     * @public
     */
    constructor(containerEl: HTMLElement);
}

/**
 * @public
 * @since 0.9.7
 */
export abstract class MarkdownRenderer extends MarkdownRenderChild implements MarkdownPreviewEvents, HoverParent {
    /** @public */
    app: App;

    /** @public */
    hoverPopover: HoverPopover | null;

    /** @public */
    abstract get file(): TFile;

    /**
     * Renders Markdown string to an HTML element.
     * @public
     * @deprecated - use {@link MarkdownRenderer.render}
     * @since 0.10.6
     */
    static renderMarkdown(markdown: string, el: HTMLElement, sourcePath: string, component: Component): Promise<void>;
    /**
     * Renders Markdown string to an HTML element.
     * @param app - A reference to the app object
     * @param markdown - The Markdown source code
     * @param el - The element to append to
     * @param sourcePath - The normalized path of this Markdown file, used to resolve relative internal links
     * @param component - A parent component to manage the lifecycle of the rendered child components.
     * @public
     */
    static render(app: App, markdown: string, el: HTMLElement, sourcePath: string, component: Component): Promise<void>;
}

/** @public */
export interface MarkdownSectionInformation {
    /** @public */
    text: string;
    /** @public */
    lineStart: number;
    /** @public */
    lineEnd: number;
}

/**
 * @public
 */
export interface MarkdownSubView {

    /**
     * @public
     */
    getScroll(): number;
    /**
     * @public
     */
    applyScroll(scroll: number): void;

    /**
     * @public
     */
    get(): string;
    /**
     * @public
     */
    set(data: string, clear: boolean): void;

}

/**
 * @public
 */
export class MarkdownView extends TextFileView implements MarkdownFileInfo {

    /** @public */
    editor: Editor;

    /** @public */
    previewMode: MarkdownPreviewView;

    /** @public */
    currentMode: MarkdownSubView;

    /** @public */
    hoverPopover: HoverPopover | null;
    /**
     * @public
     */
    constructor(leaf: WorkspaceLeaf);

    /**
     * @public
     */
    getViewType(): string;

    /**
     * @public
     */
    getMode(): MarkdownViewModeType;

    /**
     * @public
     */
    getViewData(): string;
    /**
     * @public
     */
    clear(): void;

    /**
     * @public
     */
    setViewData(data: string, clear: boolean): void;

    /**
     * @public
     */
    showSearch(replace?: boolean): void;

}

/**
 * @public
 */
export type MarkdownViewModeType = 'source' | 'preview';

/**
 * @public
 */
export class Menu extends Component implements HistoryHandler {

    /**
     * @public
     */
    constructor();

    /**
     * @public
     */
    setNoIcon(): this;
    /**
     * Force this menu to use native or DOM.
     * (Only works on the desktop app)
     * @public
     * @since 0.16.0
     */
    setUseNativeMenu(useNativeMenu: boolean): this;

    /**
     * Adds a menu item. Only works when menu is not shown yet.
     * @public
     * @since 0.15.3
     */
    addItem(cb: (item: MenuItem) => any): this;
    /**
     * Adds a separator. Only works when menu is not shown yet.
     * @public
     * @since 0.15.3
     */
    addSeparator(): this;
    /**
     * @public
     * @since 0.16.0
     */
    setParentElement(el: HTMLElement): this;
    /**
     * @public
     * @since 0.12.6
     */
    showAtMouseEvent(evt: MouseEvent): this;
    /**
     * @public
     * @since 1.1.0
     */
    showAtPosition(position: MenuPositionDef, doc?: Document): this;

    /**
     * @public
     */
    hide(): this;
    /** @public */
    close(): void;
    /**
     * @public
     */
    onHide(callback: () => any): void;

    /**
     * @public
     * @since 1.6.0
     */
    static forEvent(evt: PointerEvent | MouseEvent): Menu;
}

/**
 * @public
 */
export class MenuItem {

    /**
     * Private constructor. Use {@link Menu.addItem} instead.
     * @public
     */
    private constructor();
    /**
     * @public
     */
    setTitle(title: string | DocumentFragment): this;
    /**
     * @param icon - ID of the icon, can use any icon loaded with {@link addIcon} or from the built-in lucide library.
     * @see The Obsidian icon library includes the {@link https://lucide.dev/ Lucide icon library}, any icon name from their site will work here.
     * @public
     * @since 0.16.2
     */
    setIcon(icon: IconName | null): this;

    /**
     * @public
     * @since 0.16.2
     */
    setChecked(checked: boolean | null): this;
    /**
     * @public
     * @since 0.15.0
     */
    setDisabled(disabled: boolean): this;
    /**
     * @param state - If the warning state is enabled
     * If set to true the MenuItem's title and icon will become red. Or whatever color is applied to the class 'is-warning' by a theme.
     * @public
     * @since 0.15.0
     */
    setWarning(isWarning: boolean): this;
    /**
     * @public
     * @since 0.15.0
     */
    setIsLabel(isLabel: boolean): this;

    /**
     * @public
     */
    onClick(callback: (evt: MouseEvent | KeyboardEvent) => any): this;

    /**
     * Sets the section this menu item should belong in.
     * To find the section IDs of an existing menu, inspect the DOM elements
     * to see their `data-section` attribute.
     * @public
     * @since 0.15.3
     */
    setSection(section: string): this;

}

/**
 * @public
 * @since 1.1.0
 */
export interface MenuPositionDef {
    /** @public */
    x: number;
    /** @public */
    y: number;
    /** @public */
    width?: number;
    /** @public */
    overlap?: boolean;
    /** @public */
    left?: boolean;
}

/**
 * @public
 * @since 0.15.3
 */
export class MenuSeparator {

}

/**
 *
 * Linktext is any internal link that is composed of a path and a subpath, such as 'My note#Heading'
 * Linkpath (or path) is the path part of a linktext
 * Subpath is the heading/block ID part of a linktext.
 *
 * @public
 */
export class MetadataCache extends Events {

    /**
     * Get the best match for a linkpath.
     * @public
     * @since 0.12.5
     */
    getFirstLinkpathDest(linkpath: string, sourcePath: string): TFile | null;

    /**
     * @public
     * @since 0.9.21
     */
    getFileCache(file: TFile): CachedMetadata | null;
    /**
     * @public
     * @since 0.14.5
     */
    getCache(path: string): CachedMetadata | null;

    /**
     * Generates a linktext for a file.
     *
     * If file name is unique, use the filename.
     * If not unique, use full path.
     * @public
     */
    fileToLinktext(file: TFile, sourcePath: string, omitMdExtension?: boolean): string;

    /**
     * Contains all resolved links. This object maps each source file's path to an object of destination file paths with the link count.
     * Source and destination paths are all vault absolute paths that comes from `TFile.path` and can be used with `Vault.getAbstractFileByPath(path)`.
     * @public
     */
    resolvedLinks: Record<string, Record<string, number>>;
    /**
     * Contains all unresolved links. This object maps each source file to an object of unknown destinations with count.
     * Source paths are all vault absolute paths, similar to `resolvedLinks`.
     * @public
     */
    unresolvedLinks: Record<string, Record<string, number>>;

    /**
     * Called when a file has been indexed, and its (updated) cache is now available.
     *
     * Note: This is not called when a file is renamed for performance reasons.
     * You must hook the vault rename event for those.
     * @public
     */
    on(name: 'changed', callback: (file: TFile, data: string, cache: CachedMetadata) => any, ctx?: any): EventRef;
    /**
     * Called when a file has been deleted. A best-effort previous version of the cached metadata is presented,
     * but it could be null in case the file was not successfully cached previously.
     * @public
     */
    on(name: 'deleted', callback: (file: TFile, prevCache: CachedMetadata | null) => any, ctx?: any): EventRef;

    /**
     * Called when a file has been resolved for `resolvedLinks` and `unresolvedLinks`.
     * This happens sometimes after a file has been indexed.
     * @public
     */
    on(name: 'resolve', callback: (file: TFile) => any, ctx?: any): EventRef;
    /**
     * Called when all files has been resolved. This will be fired each time files get modified after the initial load.
     * @public
     */
    on(name: 'resolved', callback: () => any, ctx?: any): EventRef;
}

/**
 * @public
 */
export class Modal implements HistoryHandler {
    /**
     * @public
     */
    app: App;
    /**
     * @public
     */
    scope: Scope;
    /**
     * @public
     */
    containerEl: HTMLElement;
    /**
     * @public
     */
    modalEl: HTMLElement;

    /**
     * @public
     */
    titleEl: HTMLElement;
    /**
     * @public
     */
    contentEl: HTMLElement;

    /**
     * @public
     * @since 0.9.16
     */
    shouldRestoreSelection: boolean;

    /**
     * @public
     */
    constructor(app: App);

    /**
     * Show the modal on the active window. On phones, the modal will animate on screen.
     * @public
     */
    open(): void;

    /**
     * Hide the modal.
     * @public
     */
    close(): void;
    /**
     * @public
     */
    onOpen(): Promise<void> | void;
    /**
     * @public
     */
    onClose(): void;

    /**
     * @public
     */
    setTitle(title: string): this;
    /**
     * @public
     */
    setContent(content: string | DocumentFragment): this;

    /**
     * @public
     * @since 1.10.0
     */
    setCloseCallback(callback: () => any): this;

}

/**
 * Mod = Cmd on MacOS and Ctrl on other OS
 * Ctrl = Ctrl key for every OS
 * Meta = Cmd on MacOS and Win key on other OS
 * @public
 */
export type Modifier = 'Mod' | 'Ctrl' | 'Meta' | 'Shift' | 'Alt';

/** @public */
export const moment: typeof Moment;


/**
 * @public
 * @since 0.9.7
 */
export class MomentFormatComponent extends TextComponent {
    /**
     * @public
     * @since 0.9.7
     */
    sampleEl: HTMLElement;

    /**
     * Sets the default format when input is cleared. Also used for placeholder.
     * @public
     * @since 0.9.7
     */
    setDefaultFormat(defaultFormat: string): this;
    /**
     * @public
     * @since 0.9.7
     */
    setSampleEl(sampleEl: HTMLElement): this;
    /**
     * @public
     * @since 0.9.7
     */
    setValue(value: string): this;
    /**
     * @public
     * @since 0.9.7
     */
    onChanged(): void;
    /**
     * @public
     * @since 0.9.7
     */
    updateSample(): void;
}

/**
 * @public
 */
export function normalizePath(path: string): string;

/**
 * Notification component. Use to present timely, high-value information.
 * @public
 * @since 0.9.7
 */
export class Notice {
    /**
     * @public
     * @deprecated Use `messageEl` instead
     * @since 0.9.7
     */
    noticeEl: HTMLElement;
    /**
     * @public
     * @since 1.8.7
     */
    containerEl: HTMLElement;
    /**
     * @public
     * @since 1.8.7
     */
    messageEl: HTMLElement;

    /**
     * @param message - The message to be displayed, can either be a simple string or a {@link DocumentFragment}
     * @param duration - Time in milliseconds to show the notice for. If this is 0, the
     * Notice will stay visible until the user manually dismisses it.
     * @public
     */
    constructor(message: string | DocumentFragment, duration?: number);
    /**
     * Change the message of this notice.
     * @public
     * @since 0.9.7
     */
    setMessage(message: string | DocumentFragment): this;

    /**
     * @public
     * @since 0.9.7
     */
    hide(): void;
}

/**
 * Base type for all non-null {@link Values}.
 * @public
 * @since 1.10.0
 */
export abstract class NotNullValue extends Value {
}

/**
 * {@link Value} which represents null.
 * NullValue is a singleton and `NullValue.value` should be used instead of calling the constructor.
 * @public
 * @since 1.10.0
 */
export class NullValue extends Value {

    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;

    /**
     * @public
     * @since 1.10.0
     */
    static value: NullValue;
}

/**
 * {@link Value} wrapping a number.
 * @public
 * @since 1.10.0
 */
export class NumberValue extends PrimitiveValue<number> {
    /**
     * @public
     * @since 1.10.0
     */
    static type: string;

}

/**
 * {@link Value} wrapping an object.
 * @public
 * @since 1.10.0
 */
export class ObjectValue extends NotNullValue {
    /**
     * @public
     * @since 1.10.0
     */
    static type: string;

    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;
    /**
     * @public
     * @since 1.10.0
     */
    isEmpty(): boolean;

    /**
     * @returns the {@link Value} associated with the provided key, or {@link NullValue}.
     * If the referenced property in the object is not a Value, it will be wrapped before returning.
     * @public
     * @since 1.10.0
     */
    get(key: string): Value | null;

}

/**
 * @public
 */
export interface ObsidianProtocolData {
    /** @public */
    action: string;
    /** @public */
    [key: string]: string | 'true';
}

/**
 * @public
 */
export type ObsidianProtocolHandler = (params: ObsidianProtocolData) => any;

/**
 * @public
 */
export interface OpenViewState {
    /** @public */
    state?: Record<string, unknown>;
    /** @public */
    eState?: Record<string, unknown>;
    /** @public */
    active?: boolean;
    /** @public */
    group?: WorkspaceLeaf;
}

/**
 * @public
 */
export type PaneType = 'tab' | 'split' | 'window';

/**
 * @public
 */
export function parseFrontMatterAliases(frontmatter: any | null): string[] | null;

/**
 * @public
 */
export function parseFrontMatterEntry(frontmatter: any | null, key: string | RegExp): any | null;

/**
 * @public
 */
export function parseFrontMatterStringArray(frontmatter: any | null, key: string | RegExp): string[] | null;

/**
 * @public
 */
export function parseFrontMatterTags(frontmatter: any | null): string[] | null;

/**
 * Parses the linktext of a wikilink into its component parts.
 * @param linktext A wikilink without the leading [[ and trailing ]]
 * @returns filepath and subpath (subpath can refer either to a block id, or a heading)
 * @public
 */
export function parseLinktext(linktext: string): {
    /**
     * @public
     */
    path: string;
    /**
     * @public
     */
    subpath: string;
};

/**
 * Split a Bases property ID into constituent parts.
 * @public
 * @since 1.10.0
 */
export function parsePropertyId(propertyId: BasesPropertyId): BasesProperty;

/** @public */
export function parseYaml(yaml: string): any;

/**
 * @public
 * @since 0.12.2
 */
export const Platform: {
    /**
     * The UI is in desktop mode.
     * @public
     */
    isDesktop: boolean;
    /**
     * The UI is in mobile mode.
     * @public
     */
    isMobile: boolean;
    /**
     * We're running the electron-based desktop app.
     * @public
     */
    isDesktopApp: boolean;
    /**
     * We're running the capacitor-js mobile app.
     * @public
     */
    isMobileApp: boolean;
    /**
     * We're running the iOS app.
     * @public
     */
    isIosApp: boolean;
    /**
     * We're running the Android app.
     * @public
     */
    isAndroidApp: boolean;
    /**
     * We're in a mobile app that has very limited screen space.
     * @public
     */
    isPhone: boolean;
    /**
     * We're in a mobile app that has sufficiently large screen space.
     * @public
     */
    isTablet: boolean;
    /**
     * We're on a macOS device, or a device that pretends to be one (like iPhones and iPads).
     * Typically used to detect whether to use command-based hotkeys vs ctrl-based hotkeys.
     * @public
     */
    isMacOS: boolean;
    /**
     * We're on a Windows device.
     * @public
     */
    isWin: boolean;
    /**
     * We're on a Linux device.
     * @public
     */
    isLinux: boolean;
    /**
     * We're running in Safari.
     * Typically used to provide workarounds for Safari bugs.
     * @public
     */
    isSafari: boolean;
    /**
     * The path prefix for resolving local files on this platform.
     * This returns:
     * - `file:///` on mobile
     * - `app://random-id/` on desktop (Replaces the old format of `app://local/`)
     * @public
     */
    resourcePathPrefix: string;

};

/**
 * @public
 * @since 0.9.7
 */
export abstract class Plugin extends Component {

    /**
     * @public
     * @since 0.9.7
     */
    app: App;
    /**
     * @public
     * @since 0.9.7
     */
    manifest: PluginManifest;
    /**
     * Plugin settings. Assign loaded data here in `onload`. Declare a
     * concrete type on your subclass to type it.
     * @public
     * @since 1.13.0
     */
    settings?: unknown;
    /**
     * @public
     */
    constructor(app: App, manifest: PluginManifest);

    /**
     * @public
     * @since 0.9.7
     */
    onload(): Promise<void> | void;
    /**
     * Adds a ribbon icon to the left bar.
     * @param icon - The icon name to be used. See {@link addIcon}
     * @param title - The title to be displayed in the tooltip.
     * @param callback - The `click` callback.
     * @public
     * @since 0.9.7
     */
    addRibbonIcon(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement;
    /**
     * Adds a status bar item to the bottom of the app.
     * Not available on mobile.
     * @see {@link https://docs.obsidian.md/Plugins/User+interface/Status+bar}
     * @return HTMLElement - element to modify.
     * @public
     * @since 0.9.7
     */
    addStatusBarItem(): HTMLElement;
    /**
     * Register a command globally.
     * Registered commands will be available from the {@link https://help.obsidian.md/Plugins/Command+palette Command palette}.
     * The command id and name will be automatically prefixed with this plugin's id and name.
     * @public
     * @since 0.9.7
     */
    addCommand(command: Command): Command;
    /**
     * Manually remove a command from the list of global commands.
     * This should not be needed unless your plugin registers commands dynamically.
     * @public
     * @since 1.7.2
     */
    removeCommand(commandId: string): void;
    /**
     * Register a settings tab, which allows users to change settings.
     * @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}
     * @public
     * @since 0.9.7
     */
    addSettingTab(settingTab: PluginSettingTab): void;
    /**
     * @public
     * @since 0.9.7
     */
    registerView(type: string, viewCreator: ViewCreator): void;
    /**
     * Registers a view with the 'Page preview' core plugin as an emitter of the 'hover-link' event.
     * @public
     * @since 1.1.0
     */
    registerHoverLinkSource(id: string, info: HoverLinkSource): void;
    /**
     * @public
     * @since 0.9.7
     */
    registerExtensions(extensions: string[], viewType: string): void;
    /**
     * Registers a post processor, to change how the document looks in reading mode.
     * @see {@link https://docs.obsidian.md/Plugins/Editor/Markdown+post+processing}
     * @public
     * @since 0.9.7
     */
    registerMarkdownPostProcessor(postProcessor: MarkdownPostProcessor, sortOrder?: number): MarkdownPostProcessor;
    /**
     * Register a special post processor that handles fenced code given a language and a handler.
     * This special post processor takes care of removing the `<pre><code>` and create a `<div>` that
     * will be passed to the handler, and is expected to be filled with custom elements.
     * @see {@link https://docs.obsidian.md/Plugins/Editor/Markdown+post+processing#Post-process+Markdown+code+blocks}
     * @public
     * @since 0.9.7
     */
    registerMarkdownCodeBlockProcessor(language: string, handler: (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise<any> | void, sortOrder?: number): MarkdownPostProcessor;
    /**
     * Register a Base view handler that can be used to render data from property queries.
     *
     * @returns false if bases are not enabled in this vault.
     * @public
     * @since 1.10.0
     */
    registerBasesView(viewId: string, registration: BasesViewRegistration): boolean;

    /**
     * Registers a CodeMirror 6 extension.
     * To reconfigure cm6 extensions for a plugin on the fly, an array should be passed in, and modified dynamically.
     * Once this array is modified, calling {@link Workspace.updateOptions} will apply the changes.
     * @param extension - must be a CodeMirror 6 `Extension`, or an array of Extensions.
     * @public
     * @since 0.12.8
     */
    registerEditorExtension(extension: Extension): void;
    /**
     * Register a handler for obsidian:// URLs.
     * @param action - the action string. For example, 'open' corresponds to `obsidian://open`.
     * @param handler - the callback to trigger. A key-value pair that is decoded from the query will be passed in.
     *                  For example, `obsidian://open?key=value` would generate `{'action': 'open', 'key': 'value'}`.
     * @public
     * @since 0.11.0
     */
    registerObsidianProtocolHandler(action: string, handler: ObsidianProtocolHandler): void;
    /**
     * Register an EditorSuggest which can provide live suggestions while the user is typing.
     * @public
     * @since 0.12.7
     */
    registerEditorSuggest(editorSuggest: EditorSuggest<any>): void;
    /**
     * Register a CLI handler to handle a command from the CLI.
     * Command IDs must be globally unique. Attempting to register a command that is already registered will throw an Error.
     *
     * Use the format `<plugin-id>` for your default command, and `<plugin-id>:<action>` for sub-commands and actions.
     *
     * @param command The command ID that will be used. Use alphanumeric characters without spaces.
     * @param description The description text to provide in the help command, and in auto-completion prompts.
     * @param flags Command line flags that can be passed in.
     * @param handler The callback handler to handle a CLI invocation.
     * @public
     * @since 1.12.2
     */
    registerCliHandler(command: string, description: string, flags: CliFlags | null, handler: CliHandler): void;
    /**
     * Load settings data from disk.
     * Data is stored in `data.json` in the plugin folder.
     * @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings}
     * @public
     * @since 0.9.7
     */
    loadData(): Promise<any>;
    /**
     * Write settings data to disk.
     * Data is stored in `data.json` in the plugin folder.
     * @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings}
     * @public
     * @since 0.9.7
     */
    saveData(data: any): Promise<void>;

    /**
     * Perform any initial setup code. The user has explicitly interacted with the plugin
     * so its safe to engage with the user. If your plugin registers a custom view,
     * you can open it here.
     * @public
     * @since 1.7.2
     */
    onUserEnable(): void;

    /**
     * Called when the `data.json` file is modified on disk externally from Obsidian.
     * This usually means that a Sync service or external program has modified
     * the plugin settings.
     *
     * Implement this method to reload plugin settings when they have changed externally.
     *
     * @public
     * @since 1.5.7
     */
    onExternalSettingsChange?(): any;
}


/**
 * Metadata about a Community plugin.
 * @see {@link https://docs.obsidian.md/Reference/Manifest}
 * @public
 */
export interface PluginManifest {
    /**
     * Vault path to the plugin folder in the config directory.
     * @public
     */
    dir?: string;
    /**
     * The plugin ID.
     * @public
     */
    id: string;
    /**
     * The display name.
     * @public
     */
    name: string;
    /**
     * The author's name.
     * @public
     */
    author: string;
    /**
     * The current version, using {@link https://semver.org/ Semantic Versioning}.
     * @public
     */
    version: string;
    /**
     * The minimum required Obsidian version to run this plugin.
     * @public
     */
    minAppVersion: string;
    /**
     * A description of the plugin.
     * @public
     */
    description: string;
    /**
     * A URL to the author's website.
     * @public
     */
    authorUrl?: string;

    /**
     * Whether the plugin can be used only on desktop.
     * @public
     */
    isDesktopOnly?: boolean;
}

/**
 * Provides a unified interface for users to configure the plugin.
 * @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}
 * @public
 * @since 0.9.7
 */
export abstract class PluginSettingTab extends SettingTab {

    /**
     * @public
     */
    constructor(app: App, plugin: Plugin);
    /**
     * @public
     * @since 1.13.0
     */
    getSettingDefinitions(): SettingDefinitionItem[];
    /**
     * Reads from `this.plugin.settings`. Override to read from a different
     * data source.
     * @public
     * @since 1.13.0
     */
    getControlValue(key: string): unknown;
    /**
     * Mutates and persists `this.plugin.settings`. Override to write to a
     * different data source.
     * @public
     * @since 1.13.0
     */
    setControlValue(key: string, value: unknown): void | Promise<void>;
}

/**
 * @public
 */
export interface Point {
    /**
     * @public
     */
    x: number;
    /**
     * @public
     */
    y: number;
}

/**
 * @public
 */
export enum PopoverState {

}

/**
 * Base class for adding a type-ahead popover.
 * @public
 */
export abstract class PopoverSuggest<T> implements ISuggestOwner<T>, HistoryHandler {
    /** @public */
    app: App;
    /** @public */
    scope: Scope;

    /** @public */
    constructor(app: App, scope?: Scope);

    /** @public */
    open(): void;
    /** @public */
    close(): void;

    /**
     * @inheritDoc
     * @public
     */
    abstract renderSuggestion(value: T, el: HTMLElement): void;
    /**
     * @inheritDoc
     * @public
     */
    abstract selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void;
}

/**
 * Describes a text range in a Markdown document.
 * @public
 */
export interface Pos {
    /**
     * Starting location.
     * @public
     */
    start: Loc;
    /**
     * End location.
     * @public
     */
    end: Loc;
}

/**
 * Construct a fuzzy search callback that runs on a target string.
 * Performance may be an issue if you are running the search for more than a few thousand times.
 * If performance is a problem, consider using `prepareSimpleSearch` instead.
 * @param query - the fuzzy query.
 * @return fn - the callback function to apply the search on.
 * @public
 */
export function prepareFuzzySearch(query: string): (text: string) => SearchResult | null;

/**
 * Construct a simple search callback that runs on a target string.
 * @param query - the space-separated words
 * @return fn - the callback function to apply the search on
 * @public
 */
export function prepareSimpleSearch(query: string): (text: string) => SearchResult | null;

/**
 * Base type for {@link Values} which wrap a single primitive.
 * @public
 * @since 1.10.0
 */
export abstract class PrimitiveValue<T> extends NotNullValue {

    /**
     * @public
     * @since 1.10.0
     */
    constructor(value: T);
    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;

}

/**
 * @public
 * @since 1.4.4
 */
export class ProgressBarComponent extends ValueComponent<number> {

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     */
    getValue(): number;
    /**
     * @param value - The progress amount, a value between 0-100.
     * @public
     */
    setValue(value: number): this;

}

/**
 * Responsible for executing the Bases query and evaluating filters and formulas.
 * Notifies views of updated results.
 * @public
 * @since 1.10.0
 */
export class QueryController extends Component {

}

/**
 * Base interface for items that point to a different location.
 * @public
 */
export interface Reference {
    /**
     * Link destination.
     * @public
     */
    link: string;
    /**
     * Contains the text as it's written in the document. Not available on Publish.
     * @public
     */
    original: string;
    /**
     * Available if title is different from link text, in the case of `[[page name|display name]]` this will return `display name`
     * @public
     */
    displayText?: string;
}

/**
 * @public
 */
export interface ReferenceCache extends Reference, CacheItem {
}

/**
 * @public
 * @since 1.8.7
 */
export interface ReferenceLinkCache extends CacheItem {
    /**
     * @public
     */
    id: string;
    /**
     * @public
     */
    link: string;
}

/**
 * {@link Value} wrapping a RegExp pattern.
 * @public
 * @since 1.10.0
 */
export class RegExpValue extends NotNullValue {

    /**
     * @public
     * @since 1.10.0
     */
    toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    isTruthy(): boolean;
}

/**
 * {@link Value} wrapping a Date.
 * RelativeDateValue behaves the same as a {@link DateValue} however it renders as a time relative to now.
 * @public
 * @since 1.10.0
 */
export class RelativeDateValue extends DateValue {

}

/**
 * Remove a custom icon from the library.
 * @param iconId - the icon ID
 * @public
 */
export function removeIcon(iconId: string): void;

/**
 * Utility functions for rendering Values within the app.
 * @public
 * @since 1.10.0
 */
export class RenderContext implements HoverParent {

    /**
     * @public
     * @since 1.10.0
     */
    hoverPopover: HoverPopover | null;

}

/**
 * @public
 */
export function renderMatches(el: HTMLElement | DocumentFragment, text: string, matches: SearchMatches | null, offset?: number): void;

/**
 * Render some LaTeX math using the MathJax engine. Returns an HTMLElement.
 * Requires calling `finishRenderMath` when rendering is all done to flush the MathJax stylesheet.
 * @public
 */
export function renderMath(source: string, display: boolean): HTMLElement;

/**
 * @public
 */
export function renderResults(el: HTMLElement, text: string, result: SearchResult, offset?: number): void;

/**
 * Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions.
 * Returns the text value of the response.
 * @public
 * @since 0.12.11
 */
export function request(request: RequestUrlParam | string): Promise<string>;

/**
 * Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions.
 * @public
 */
export function requestUrl(request: RequestUrlParam | string): RequestUrlResponsePromise;

/** @public */
export interface RequestUrlParam {
    /** @public */
    url: string;
    /** @public */
    method?: string;
    /** @public */
    contentType?: string;
    /** @public */
    body?: string | ArrayBuffer;
    /** @public */
    headers?: Record<string, string>;
    /**
     * Whether to throw an error when the status code is 400+
     * Defaults to true
     * @public
     */
    throw?: boolean;
}

/** @public */
export interface RequestUrlResponse {
    /** @public */
    status: number;
    /** @public */
    headers: Record<string, string>;
    /** @public */
    arrayBuffer: ArrayBuffer;
    /** @public */
    json: any;
    /** @public */
    text: string;
}

/** @public */
export interface RequestUrlResponsePromise extends Promise<RequestUrlResponse> {
    /** @public */
    arrayBuffer: Promise<ArrayBuffer>;
    /** @public */
    json: Promise<any>;
    /** @public */
    text: Promise<string>;
}

/**
 * Returns true if the API version is equal or higher than the requested version.
 * Use this to limit functionality that require specific API versions to avoid
 * crashing on older Obsidian builds.
 * @public
 */
export function requireApiVersion(version: string): boolean;

/**
 * Resolve the given subpath to a reference in the MetadataCache.
 * @public
 */
export function resolveSubpath(cache: CachedMetadata, subpath: string): HeadingSubpathResult | BlockSubpathResult | FootnoteSubpathResult | null;

/**
 * @public
 * @since 0.16.0
 */
export interface RGB {
    /**
     * Red integer value between 0 and 255
     * @public
     */
    r: number;
    /**
     * Green integer value between 0 and 255
     * @public
     */
    g: number;
    /**
     * Blue integer value between 0 and 255
     * @public
     */
    b: number;
}

/** @public */
export function sanitizeHTMLToDom(html: string): DocumentFragment;

/**
 * A scope receives keyboard events and binds callbacks to given hotkeys.
 * Only one scope is active at a time, but scopes may define parent scopes (in the constructor) and inherit their hotkeys.
 * @public
 */
export class Scope {

    /**
     * @public
     */
    constructor(parent?: Scope);
    /**
     * Add a keymap event handler to this scope.
     * @param modifiers - `Mod`, `Ctrl`, `Meta`, `Shift`, or `Alt`. `Mod` translates to `Meta` on macOS and `Ctrl` otherwise. Pass `null` to capture all events matching the `key`, regardless of modifiers.
     * @param key - Keycode from https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key%5FValues
     * @param func - the callback that will be called when a user triggers the keybind.
     * @public
     */
    register(modifiers: Modifier[] | null, key: string | null, func: KeymapEventListener): KeymapEventHandler;
    /**
     * Remove an existing keymap event handler.
     * @public
     */
    unregister(handler: KeymapEventHandler): void;

}

/**
 * @public
 * @since 0.9.21
 */
export class SearchComponent extends AbstractTextComponent<HTMLInputElement> {
    /**
     * @public
     * @since 0.9.21
     */
    clearButtonEl: HTMLElement;

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     */
    onChanged(): void;

}

/**
 * @public
 */
export type SearchMatches = SearchMatchPart[];

/**
 * Text position offsets within text file. Represents
 * a text range [from offset, to offset].
 *
 * @public
 */
export type SearchMatchPart = [number, number];

/**
 * @public
 * @since 0.9.21
 */
export interface SearchResult {
    /** @public */
    score: number;
    /** @public */
    matches: SearchMatches;
}

/**
 * @public
 * @since 0.9.21
 */
export interface SearchResultContainer {
    /** @public */
    match: SearchResult;
}

/**
 * @public
 * @since 1.11.1
 */
export class SecretComponent extends BaseComponent {

    /**
     * @public
     */
    constructor(app: App, containerEl: HTMLElement);
    /**
     * @public
     * @since 1.11.4
     */
    setValue(value: string): this;
    /**
     * @public
     * @since 1.11.4
     */
    onChange(cb: (value: string) => unknown): this;
}

/**
 * @public
 * @since 1.11.4
 */
export class SecretStorage extends Events {

    /**
     * Sets a secret in the storage.
     * @param id Lowercase alphanumeric ID with optional dashes
     * @param secret The secret value to store
     * @throws Error if ID is invalid
     * @public
     * @since 1.11.4
     */
    setSecret(id: string, secret: string): void;

    /**
     * Gets a secret from storage
     * @param id The secret ID
     * @returns The secret value or null if not found
     * @public
     * @since 1.11.4
     */
    getSecret(id: string): string | null;
    /**
     * Lists all secrets in storage
     * @returns Array of secret IDs
     * @public
     * @since 1.11.4
     */
    listSecrets(): string[];

}

/**
 * @public
 */
export interface SectionCache extends CacheItem {
    /**
     * The block ID of this section, if defined.
     * @public
     */
    id?: string | undefined;
    /**
     * The type string generated by the parser.
     * Typing is non-exhaustive, more types can be available than are documented here.
     * @public
     */
    type: 'blockquote' | 'callout' | 'code' | 'element' | 'footnoteDefinition' | 'heading' | 'html' | 'list' | 'paragraph' | 'table' | 'text' | 'thematicBreak' | 'yaml' | string;
}

/**
 * Insert an SVG into the element from an iconId. Does nothing if no icon associated with the iconId.
 * @param parent - the HTML element to insert the icon
 * @param iconId - the icon ID
 * @see The Obsidian icon library includes the {@link https://lucide.dev/ Lucide icon library}, any icon name from their site will work here.
 * @public
 */
export function setIcon(parent: HTMLElement, iconId: IconName): void;

/**
 * @public
 * @since 0.9.7
 */
export class Setting {
    /** @public
     * @since 0.9.7
     */
    settingEl: HTMLElement;
    /**
     * @public
     * @since 0.9.7
     */
    infoEl: HTMLElement;
    /**
     * @public
     * @since 0.9.7
     */
    nameEl: HTMLElement;
    /**
     * @public
     * @since 0.9.7
     */
    descEl: HTMLElement;
    /**
     * @public
     * @since 0.9.7
     */
    controlEl: HTMLElement;
    /**
     * @public
     * @since 0.9.7
     */
    components: BaseComponent[];
    /**
     * Error message element shown below the input.
     * Created by {@link setErrorMessage}.
     * @public
     * @since 1.13.0
     */
    errorEl: HTMLElement | null;
    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * Show a persistent validation error message below the setting. Pass an
     * empty string or `null` to clear it. Adds the `is-invalid` class to the
     * setting row when a message is present.
     * @public
     * @since 1.13.0
     */
    setErrorMessage(message: string | null): this;
    /**
     * Add a read-only display value to the row. On a navigable row, this
     * surfaces the value edited on the page the row opens, so the user can see
     * it without opening that page.
     * @public
     * @since 1.13.1
     */
    addDisplayValue(cb: (component: DisplayValueComponent) => any): this;
    /**
     * @public
     * @since 0.9.7
     */
    setName(name: string): this;
    /**
     * @public
     * @since 0.12.16
     */
    setName(name: string | DocumentFragment): this;
    /**
     * @public
     * @since 0.9.7
     */
    setDesc(desc: string | DocumentFragment): this;
    /**
     * @public
     * @since 0.9.7
     */
    setClass(cls: string): this;
    /**
     * @public
     * @since 1.1.0
     */
    setTooltip(tooltip: string, options?: TooltipOptions): this;
    /**
     * @public
     * @since 0.9.16
     */
    setHeading(): this;
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;

    /**
     * @public
     * @since 0.9.7
     */
    addButton(cb: (component: ButtonComponent) => any): this;
    /**
     * @public
     * @since 0.9.16
     */
    addExtraButton(cb: (component: ExtraButtonComponent) => any): this;
    /**
     * @public
     * @since 0.9.7
     */
    addToggle(cb: (component: ToggleComponent) => any): this;
    /**
     * @public
     * @since 0.9.7
     */
    addText(cb: (component: TextComponent) => any): this;
    /**
     * @public
     * @since 1.11.0
     */
    addComponent<T extends BaseComponent>(cb: (el: HTMLElement) => T): this;
    /**
     * @public
     * @since 0.9.21
     */
    addSearch(cb: (component: SearchComponent) => any): this;
    /**
     * @public
     * @since 0.9.7
     */
    addTextArea(cb: (component: TextAreaComponent) => any): this;
    /**
     * @public
     * @since 0.9.7
     */
    addMomentFormat(cb: (component: MomentFormatComponent) => any): this;
    /**
     * @public
     * @ince 0.9.7
     */
    addDropdown(cb: (component: DropdownComponent) => any): this;
    /**
     * @public
     * @ince 0.16.0
     */
    addColorPicker(cb: (component: ColorComponent) => any): this;
    /**
     * @public
     * @ince 1.4.4
     */
    addProgressBar(cb: (component: ProgressBarComponent) => any): this;
    /**
     * @public
     * @since 0.9.7
     */
    addSlider(cb: (component: SliderComponent) => any): this;
    /**
     * Facilitates chaining
     * @public
     * @since 0.9.20
     */
    then(cb: (setting: this) => any): this;
    /**
     * @public
     * @since 0.13.8
     */
    clear(): this;

}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingColorControl<K extends string = string> extends SettingControlBase<HexString, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'color';
}

/**
 * @public
 * @since 1.13.0
 */
export type SettingControl<K extends string = string> = SettingToggleControl<K> | SettingDropdownControl<K> | SettingTextControl<K> | SettingTextAreaControl<K> | SettingNumberControl<K> | SettingFileControl<K> | SettingFolderControl<K> | SettingSliderControl<K> | SettingColorControl<K>;

/**
 * @public
 * @since 1.13.0
 */
export interface SettingControlBase<V, K extends string = string> {
    /**
     * The config/storage property name passed to `getControlValue` and
     * `setControlValue` on the setting tab.
     * @public
     * @since 1.13.0
     */
    key: K;
    /**
     * Fallback when the resolver returns undefined/null.
     * @public
     * @since 1.13.0
     */
    defaultValue?: V;
    /**
     * Validate a candidate value before it is persisted. Return a non-empty
     * string to reject the change and surface it as an inline error message
     * below the setting; return void/empty/undefined to accept and persist.
     *
     * Primarily intended for text-bearing controls (`text`, `textarea`,
     * `number`, `file`, `folder`) where the user can enter values the bind's
     * type alone can't constrain.
     *
     * The stored value may already be invalid when the setting is rendered
     * (e.g. data from a previous version of your plugin). The framework
     * runs `validate` once on mount and shows the message if the seeded
     * value fails; it does not modify or replace the stored value. Plugins
     * that need to enforce invariants on stored data should validate again
     * when reading their settings.
     * @public
     * @since 1.13.0
     */
    validate?: (value: V) => string | void | Promise<string | void>;
    /**
     * Disables the control. Evaluated on each render, so a function form can
     * reflect runtime state (e.g. whether another plugin is installed). Call
     * `update()` on the setting tab to re-evaluate after the underlying state
     * changes.
     * @public
     * @since 1.13.0
     */
    disabled?: boolean | (() => boolean);
}

/**
 * @public
 * @since 1.13.0
 */
export type SettingDefinition<K extends string = string> = SettingDefinitionControl<K> | SettingDefinitionRender | SettingDefinitionAction | SettingDefinitionEmpty;

/**
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionAction extends SettingDefinitionBase {
    /**
     * Callback invoked when the action setting is clicked. Receives the row
     * element and the row's current index within its parent group or list.
     * @public
     * @since 1.13.0
     */
    action: (el: HTMLElement, index: number) => void;
    /**
     * Disables the row. Evaluated on each render. Call `update()` on the
     * setting tab to re-evaluate.
     * @public
     * @since 1.13.0
     */
    disabled?: boolean | (() => boolean);
    /**
     * @public
     * @since 1.13.0
     */
    control?: never;
    /**
     * @public
     * @since 1.13.0
     */
    render?: never;
}

/**
 * Configuration for a {@link SettingDefinitionList}'s `addItem` affordance.
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionAddItem {
    /**
     * Mobile row label and desktop button tooltip.
     * @public
     * @since 1.13.0
     */
    name: string;
    /**
     * Called when the affordance is clicked or tapped. Receives the affordance
     * element (the `+` button on desktop, the add-item row on mobile).
     * @public
     * @since 1.13.0
     */
    action: (el: HTMLElement) => void;
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionBase {
    /**
     * Display name — used for rendering and search.
     * @public
     * @since 1.13.0
     */
    name: string;
    /**
     * Description text or fragment. Used for rendering; the textContent of a
     * fragment is used for search.
     * @public
     * @since 1.13.0
     */
    desc?: string | DocumentFragment;
    /**
     * Additional search terms.
     * @public
     * @since 1.13.0
     */
    aliases?: string[];
    /**
     * Controls search visibility. `false` or `() => false` excludes from search. Default: true.
     * @public
     * @since 1.13.0
     */
    searchable?: boolean | (() => boolean);
    /**
     * Controls whether the item is rendered. `false` or `() => false` hides
     * the item and also excludes it from search for that render cycle.
     * Evaluated on each render; call `update()` on the setting tab to
     * re-evaluate after the underlying state changes. Default: true.
     * @public
     * @since 1.13.0
     */
    visible?: boolean | (() => boolean);
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionControl<K extends string = string> extends SettingDefinitionBase {
    /**
     * @public
     * @since 1.13.0
     */
    control: SettingControl<K>;
    /**
     * @public
     * @since 1.13.0
     */
    action?: never;
    /**
     * @public
     * @since 1.13.0
     */
    render?: never;
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionEmpty extends SettingDefinitionBase {
    /**
     * @public
     * @since 1.13.0
     */
    control?: never;
    /**
     * @public
     * @since 1.13.0
     */
    action?: never;
    /**
     * @public
     * @since 1.13.0
     */
    render?: never;
}

/**
 * A group of settings rendered under a shared heading. Used as an inline
 * group in the array returned by `getSettingDefinitions()`. For collections
 * of mutable data (with add/delete/reorder affordances), use
 * {@link SettingDefinitionList} instead.
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionGroup<K extends string = string> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'group' | 'list';
    /**
     * Heading text displayed above the group.
     * @public
     * @since 1.13.0
     */
    heading?: string;
    /**
     * CSS classes to add to the group element.
     * @public
     * @since 1.13.0
     */
    cls?: string;
    /**
     * Adds a search input to the group header that filters the group's
     * children by `match(def, query)`. The query is preserved across
     * re-renders and the filter is reapplied after each render.
     * @public
     * @since 1.13.1
     */
    search?: {
        /**
         * Placeholder text for the search input.
         * @public
         * @since 1.13.1
         */
        placeholder?: string;
        /**
         * Predicate called for each direct child definition of this group.
         * Return true to show the item, false to hide. Items with
         * `searchable: false` bypass this filter and always show.
         * @public
         * @since 1.13.1
         */
        match: (def: SettingDefinition, query: string) => boolean;
    };
    /**
     * Extra button configuration for the header.
     * @public
     * @since 1.13.0
     */
    extraButtons?: ((component: ExtraButtonComponent) => any)[];
    /**
     * Settings within this group.
     * @public
     * @since 1.13.0
     */
    items?: SettingGroupItem<K>[];
    /**
     * Controls whether the group is rendered. `false` or `() => false` hides
     * it entirely (heading, controls, and items). Evaluated on each render.
     * Default: true.
     * @public
     * @since 1.13.0
     */
    visible?: boolean | (() => boolean);
}

/**
 * A single item in the array returned by `getSettingDefinitions()`.
 * @public
 * @since 1.13.0
 */
export type SettingDefinitionItem<K extends string = string> = SettingDefinition<K> | SettingDefinitionGroup<K> | SettingDefinitionList<K> | SettingDefinitionPage<K>;

/**
 * A specialized {@link SettingDefinitionGroup} for collections of mutable
 * data: entries the user adds, reorders, or removes. Rendered with a more
 * compact visual style than a group, and supports `emptyState`, `onReorder`,
 * and `onDelete` for the mutation affordances.
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionList<K extends string = string> extends SettingDefinitionGroup<K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'list';
    /**
     * Text to display when `items` is empty.
     * @public
     * @since 1.13.0
     */
    emptyState?: string | DocumentFragment;
    /**
     * When set, adds a drag handle to each item and enables drag-to-reorder. Called with old and new indices.
     * @public
     * @since 1.13.0
     */
    onReorder?: (oldIndex: number, newIndex: number) => void;
    /**
     * When set, adds a delete button to each item and enables Delete/Backspace keyboard shortcut. Called with the item index.
     * @public
     * @since 1.13.0
     */
    onDelete?: (index: number) => void;
    /**
     * Add-entry affordance. The framework renders a platform-appropriate
     * control: on desktop, a `+` button in the list header (with `name` as
     * the tooltip); on mobile, a tappable `+ {name}` row appended below
     * the list.
     *
     * The mobile row is not part of the indexed `items`: it does not appear
     * in search, does not receive delete or reorder affordances, and is not
     * counted by `onDelete`/`onReorder` indices.
     * @public
     * @since 1.13.0
     */
    addItem?: SettingDefinitionAddItem;
}

/**
 * A declarative page of settings rendered as a navigable entry.
 * Used as an inline page in the array returned by `getSettingDefinitions()`.
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionPage<K extends string = string> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'page';
    /**
     * Display name shown as the navigable entry and page title.
     * @public
     * @since 1.13.0
     */
    name: string;
    /**
     * Description shown on the navigable entry.
     * @public
     * @since 1.13.0
     */
    desc?: string | DocumentFragment;
    /**
     * Surfaces the current value on the entry, so the user can see it without
     * opening the page where it is edited. Call `update()` on the setting tab
     * to refresh it after the value changes.
     * @public
     * @since 1.13.1
     */
    displayValue?: string | (() => string);
    /**
     * Adds a status indicator to the entry. Use `'warning'` when the value on
     * the page needs the user's attention. Call `update()` on the setting tab
     * to refresh it after the underlying state changes.
     * @public
     * @since 1.13.1
     */
    status?: 'warning' | null | (() => 'warning' | null);
    /**
     * Inline items rendered as a declarative sub-page. Can include groups
     * and nested pages. Mutually exclusive with `page`.
     * @public
     * @since 1.13.0
     */
    items?: SettingDefinitionItem<K>[];
    /**
     * Factory for a custom {@link SettingPage} subclass. Use this when the
     * sub-page is rendered imperatively rather than from a list of
     * definitions. Mutually exclusive with `items`. The factory is called
     * each time the page is opened.
     * @public
     * @since 1.13.0
     */
    page?: () => SettingPage;
    /**
     * Controls whether the page link is rendered. `false` or `() => false`
     * hides the navigable entry. Evaluated on each render. Default: true.
     * @public
     * @since 1.13.0
     */
    visible?: boolean | (() => boolean);
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingDefinitionRender extends SettingDefinitionBase {
    /**
     * @public
     * @since 1.13.0
     */
    control?: never;
    /**
     * @public
     * @since 1.13.0
     */
    action?: never;
    /**
     * Renders the setting row imperatively.
     *
     * May return a cleanup function, invoked before the row is torn down.
     * Not guaranteed to run when the host window is destroyed.
     * @public
     * @since 1.13.0
     */
    render: (setting: Setting, group: SettingGroup) => void | (() => void);
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingDropdownControl<K extends string = string> extends SettingControlBase<string, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'dropdown';
    /**
     * @public
     * @since 1.13.0
     */
    options: Record<string, string>;
}

/**
 * File-path input with a vault file suggester. Persists the selected file's
 * full path including extension (e.g. `folder/note.md`). Resolve the saved
 * path with `Vault.getFileByPath()`.
 * @public
 * @since 1.13.0
 */
export interface SettingFileControl<K extends string = string> extends SettingControlBase<string, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'file';
    /**
     * @public
     * @since 1.13.0
     */
    placeholder?: string;
    /**
     * Optional filter — only files for which this returns truthy are suggested.
     * @public
     * @since 1.13.0
     */
    filter?: (file: TFile) => boolean;
}

/**
 * Folder-path input with a vault folder suggester. Persists the selected folder's
 * path (a string).
 * @public
 * @since 1.13.0
 */
export interface SettingFolderControl<K extends string = string> extends SettingControlBase<string, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'folder';
    /**
     * @public
     * @since 1.13.0
     */
    placeholder?: string;
    /**
     * Optional filter — only folders for which this returns truthy are suggested.
     * @public
     * @since 1.13.0
     */
    filter?: (folder: TFolder) => boolean;
    /**
     * Whether the vault root is offered as a suggestion. Default: false.
     * @public
     * @since 1.13.0
     */
    includeRoot?: boolean;
}

/**
 * @public
 * @since 1.11.0
 */
export class SettingGroup {

    /**
     * @public
     * @since 1.11.0
     */
    listEl: HTMLElement;

    /**
     * @public
     * @since 1.11.0
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     * @since 1.11.0
     */
    setHeading(text: string | DocumentFragment): this;
    /**
     * @public
     * @since 1.11.0
     */
    addClass(...classes: string[]): this;
    /**
     * @public
     * @since 1.11.0
     */
    addSetting(cb: (setting: Setting) => void): this;
    /**
     * Add a search input at the beginning of the setting group. Useful for filtering
     * results or adding an input for quick entry.
     * @public
     * @since 1.11.0
     */
    addSearch(cb: (component: SearchComponent) => any): this;

    /**
     * @public
     * @since 1.11.0
     */
    addExtraButton(cb: (component: ExtraButtonComponent) => any): this;

}

/**
 * A single item within a SettingDefinitionGroup — either a setting or a navigable page.
 * @public
 * @since 1.13.0
 */
export type SettingGroupItem<K extends string = string> = SettingDefinition<K> | SettingDefinitionPage<K>;

/**
 * Numeric text input. Persists a number; falls back to `defaultValue` (or `0`) if the
 * input cannot be parsed.
 * @public
 * @since 1.13.0
 */
export interface SettingNumberControl<K extends string = string> extends SettingControlBase<number, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'number';
    /**
     * @public
     * @since 1.13.0
     */
    placeholder?: string;
    /**
     * @public
     * @since 1.13.0
     */
    min?: number;
    /**
     * @public
     * @since 1.13.0
     */
    max?: number;
    /**
     * @public
     * @since 1.13.0
     */
    step?: number | 'any';
}

/**
 * Base class for a sub-page within a {@link SettingTab}. Use with the `page`
 * factory on {@link SettingDefinitionPage} to render a sub-page imperatively
 * — useful when the page's content is dynamic or doesn't fit cleanly into a
 * list of definitions.
 *
 * For declarative sub-pages, use the `items` field on
 * {@link SettingDefinitionPage} instead.
 * @public
 * @since 1.13.0
 */
export abstract class SettingPage {
    /**
     * @public
     * @since 1.13.0
     */
    rootEl: HTMLElement;
    /**
     * @public
     * @since 1.13.0
     */
    titlebarEl: HTMLElement;
    /**
     * Container for the page's content. Render into this element from
     * {@link display}.
     * @public
     * @since 1.13.0
     */
    containerEl: HTMLElement;
    /**
     * Title displayed in the page titlebar.
     * @public
     * @since 1.13.0
     */
    title: string;
    /**
     * @public
     * @since 1.13.0
     */
    constructor();
    /**
     * Called when the page is opened. Clears and re-renders content
     * into {@link containerEl}.
     * @public
     * @since 1.13.0
     */
    abstract display(): void;
    /**
     * Hides the contents of the page. Any registered components should be
     * unloaded when the page is hidden. Override this if you need to perform
     * additional cleanup.
     * Called when the user navigates away, the containing tab is switched, or
     * the settings modal is closed. Not guaranteed to run when the host window
     * is destroyed.
     * @public
     * @since 1.13.0
     */
    hide(): void;
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingSliderControl<K extends string = string> extends SettingControlBase<number, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'slider';
    /**
     * @public
     * @since 1.13.0
     */
    min: number;
    /**
     * @public
     * @since 1.13.0
     */
    max: number;
    /**
     * @public
     * @since 1.13.0
     */
    step: number;
    /**
     * Formats the value shown inline next to the slider. Return an empty
     * string to hide the inline value entirely.
     * @public
     * @since 1.13.1
     */
    displayFormat?: (value: number) => string;
}

/**
 * @public
 * @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}
 * @since 0.9.7
 */
export abstract class SettingTab {

    /**
     * The icon to display in the settings sidebar.
     * @public
     * @since 1.11.0
     */
    icon: IconName;
    /**
     * Reference to the app instance.
     * @public
     */
    app: App;

    /**
     * HTML element for the setting tab content.
     * @public
     */
    containerEl: HTMLElement;

    /**
     * Nested setting definitions as returned by getSettingDefinitions().
     * Populated by update().
     * @public
     * @since 1.13.0
     */
    settingItems: SettingDefinitionItem[];

    /**
     * Override to provide setting definitions. Return an array of definitions
     * and inline groups. Called on every display() and once when the tab is
     * added to the setting modal for search indexing.
     * @public
     * @since 1.13.0
     */
    getSettingDefinitions(): SettingDefinitionItem[];
    /**
     * Stores the result of getSettingDefinitions() for rendering and search indexing.
     * Called by addSettingTab() and by dynamic tabs when their data changes.
     * @public
     * @since 1.13.0
     */
    update(): void;
    /**
     * Read the current value for a control key. Called on every render of a
     * `control`-type setting definition.
     *
     * The default implementation reads from `this.app.vault.getConfig` —
     * appropriate for the app's own setting tabs. `PluginSettingTab` and
     * `InternalPluginSettingTab` override this to read from their conventional
     * settings storage; plugins with custom storage override on their
     * subclass.
     * @public
     * @since 1.13.0
     */
    getControlValue(key: string): unknown;
    /**
     * Persist a new value for a control key. Called on user change of a
     * `control`-type setting definition.
     *
     * The default implementation writes to `this.app.vault.setConfig`.
     * Override to persist elsewhere; pair with `getControlValue`.
     * @public
     * @since 1.13.0
     */
    setControlValue(key: string, value: unknown): void | Promise<void>;

    /**
     * Re-evaluate every `visible` and `disabled` predicate against the
     * current state and apply the result to the rendered DOM. Call this
     * from a `render` callback's onChange (or any other imperative path)
     * after mutating state that other settings' predicates depend on.
     *
     * Cheap: toggles CSS state in place, no re-render. For changes that
     * affect the structure of the definitions themselves (added or removed
     * items), call `update()` instead.
     * @public
     * @since 1.13.0
     */
    refreshDomState(): void;

    /**
     * Override to render the tab imperatively.
     *
     * Not called when {@link getSettingDefinitions} returns a non-empty array;
     * the tab is rendered declaratively from those definitions instead. Only
     * implement display() as a fallback for plugins that need to support
     * Obsidian versions older than 1.13.0.
     * @see {@link https://docs.obsidian.md/Plugins/User+interface/Settings#Register+a+settings+tab}
     * @deprecated Since 1.13.0. Use {@link getSettingDefinitions} instead.
     * @public
     */
    display(): void;
    /**
     * Hides the contents of the setting tab.
     * Any registered components should be unloaded when the view is hidden.
     * Override this if you need to perform additional cleanup.
     * @public
     */
    hide(): void;
}

/**
 * Multi-line text input. Persists a string.
 * @public
 * @since 1.13.0
 */
export interface SettingTextAreaControl<K extends string = string> extends SettingControlBase<string, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'textarea';
    /**
     * @public
     * @since 1.13.0
     */
    placeholder?: string;
    /**
     * Initial number of visible rows.
     * @public
     * @since 1.13.0
     */
    rows?: number;
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingTextControl<K extends string = string> extends SettingControlBase<string, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'text';
    /**
     * @public
     * @since 1.13.0
     */
    placeholder?: string;
}

/**
 * @public
 * @since 1.13.0
 */
export interface SettingToggleControl<K extends string = string> extends SettingControlBase<boolean, K> {
    /**
     * @public
     * @since 1.13.0
     */
    type: 'toggle';
}

/**
 * @param el - The element to show the tooltip on
 * @param tooltip - The tooltip text to show
 * @param options
 * @public
 * @since 1.4.4
 */
export function setTooltip(el: HTMLElement, tooltip: string, options?: TooltipOptions): void;

/**
 * @public
 */
export type Side = 'left' | 'right';

/**
 * @public
 * @since 0.9.7
 */
export class SliderComponent extends ValueComponent<number> {
    /**
     * @public
     */
    sliderEl: HTMLInputElement;

    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;
    /**
     * @param instant whether or not the value should get updated while the slider is dragging
     * @public
     * @since 1.6.6
     */
    setInstant(instant: boolean): this;
    /**
     * @public
     * @since 0.9.7
     */
    setLimits(min: number | null, max: number | null, step: number | 'any'): this;
    /**
     * @public
     * @since 0.9.7
     */
    getValue(): number;
    /**
     * @public
     * @since 0.9.7
     */
    setValue(value: number): this;
    /**
     * @public
     * @since 0.9.7
     */
    getValuePretty(): string;
    /**
     * Set a custom formatter for the value shown inline next to the slider.
     * @public
     * @since 1.13.0
     */
    setDisplayFormat(format: (value: number) => string): this;
    /**
     * @public
     * @since 0.9.7
     * @deprecated The value is now always shown inline next to the slider.
     */
    setDynamicTooltip(): this;

    /**
     * @public
     * @since 0.9.7
     */
    onChange(callback: (value: number) => any): this;
}

/**
 * @public
 */
export function sortSearchResults(results: SearchResultContainer[]): void;

/**
 * @public
 */
export type SplitDirection = 'vertical' | 'horizontal';

/** @public */
export interface Stat {
    /** @public */
    type: 'file' | 'folder';
    /**
     * Time of creation, represented as a unix timestamp.
     * @public
     */
    ctime: number;
    /**
     * Time of last modification, represented as a unix timestamp.
     * @public
     */
    mtime: number;
    /**
     * Size on disk, as bytes.
     * @public
     */
    size: number;
}

/** @public */
export function stringifyYaml(obj: any): string;

/**
 * {@link Value} wrapping a string.
 * @public
 * @since 1.10.0
 */
export class StringValue extends PrimitiveValue<string> {
    /**
     * @public
     * @since 1.10.0
     */
    static type: string;

}

/**
 * Normalizes headings for link matching by stripping out special characters and shrinking consecutive spaces.
 * @public
 */
export function stripHeading(heading: string): string;

/**
 * Prepares headings for linking by stripping out some bad combinations of special characters that could break links.
 * @public
 */
export function stripHeadingForLink(heading: string): string;

/**
 * @public
 */
export interface SubpathResult {
    /**
     * @public
     */
    start: Loc;
    /**
     * @public
     */
    end: Loc | null;
}

/**
 * @public
 * @ince 0.9.20
 */
export abstract class SuggestModal<T> extends Modal implements ISuggestOwner<T> {
    /**
     * @public
     * @ince 0.9.20
     */
    limit: number;
    /**
     * @public
     * @since 0.9.20
     */
    emptyStateText: string;

    /**
     * @public
     * @0.9.20
     */
    inputEl: HTMLInputElement;

    /**
     * @public
     * @since 0.9.20
     */
    resultContainerEl: HTMLElement;

    /**
     * @public
     */
    constructor(app: App);
    /**
     * @public
     * @since 0.9.20
     */
    setPlaceholder(placeholder: string): void;
    /**
     * @public
     * @since 0.9.20
     */
    setInstructions(instructions: Instruction[]): void;

    /**
     * @public
     * @since 0.9.20
     */
    onNoSuggestion(): void;
    /**
     * @public
     * @since 0.9.20
     */
    selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void;
    /**
     * @public
     * @since 1.7.2
     */
    selectActiveSuggestion(evt: MouseEvent | KeyboardEvent): void;
    /**
     * @public
     * @since 1.5.7
     */
    abstract getSuggestions(query: string): T[] | Promise<T[]>;
    /**
     * @public
     * @since 1.5.7
     */
    abstract renderSuggestion(value: T, el: HTMLElement): void;
    /**
     * @public
     * @since 1.5.7
     */
    abstract onChooseSuggestion(item: T, evt: MouseEvent | KeyboardEvent): void;
}

/**
 * This can be either a `TFile` or a `TFolder`.
 * @public
 * @since 0.9.7
 */
export abstract class TAbstractFile {
    /**
     * @public
     * @since 0.9.7
     */
    vault: Vault;
    /**
     * @public
     * @since 0.9.7
     */
    path: string;
    /**
     * @public
     * @since 0.9.7
     */
    name: string;
    /**
     * @public
     * @since 0.9.7
     */
    parent: TFolder | null;

}

/**
 * @public
 * @since 0.9.7
 */
export interface TagCache extends CacheItem {
    /**
     * @public
     */
    tag: string;
}

/**
 * {@link Value} wrapping an Obsidian tag.
 * @public
 * @since 1.10.0
 */
export class TagValue extends StringValue {

    /**
     * @public
     * @since 1.10.0
     */
    constructor(value: string);

}

/**
 * @public
 * @since 0.10.2
 */
export class Tasks {

    /**
     * @public
     * @since 0.10.2
     */
    add(callback: () => Promise<any>): void;
    /**
     * @public
     * @since 0.10.2
     */
    addPromise(promise: Promise<any>): void;
    /**
     * @public
     * @since 0.10.2
     */
    isEmpty(): boolean;
    /**
     * @public
     * @since 0.10.2
     */
    promise(): Promise<any>;
}

/**
 * @public
 * @since 0.9.7
 */
export class TextAreaComponent extends AbstractTextComponent<HTMLTextAreaElement> {
    /**
     * @public
     */
    constructor(containerEl: HTMLElement);
}

/**
 * @public
 * @since 0.9.21
 */
export class TextComponent extends AbstractTextComponent<HTMLInputElement> {
    /**
     * @public
     */
    constructor(containerEl: HTMLElement);

}

/**
 * This class implements a plaintext-based editable file view, which can be loaded and saved given an editor.
 *
 * Note that by default, this view only saves when it's closing. To implement auto-save, your editor should
 * call `this.requestSave()` when the content is changed.
 * @public
 * @since 0.10.12
 */
export abstract class TextFileView extends EditableFileView {

    /**
     * In memory data
     * @public
     * @since 0.10.12
     */
    data: string;
    /**
     * Debounced save in 2 seconds from now
     * @public
     * @since 0.10.12
     */
    requestSave: () => void;

    /**
     * @public
     */
    constructor(leaf: WorkspaceLeaf);

    /**
     * @public
     * @since 0.10.12
     */
    onUnloadFile(file: TFile): Promise<void>;
    /**
     * @public
     * @since 0.10.12
     */
    onLoadFile(file: TFile): Promise<void>;

    /**
     * @public
     * @since 0.10.12
     */
    save(clear?: boolean): Promise<void>;

    /**
     * Gets the data from the editor. This will be called to save the editor contents to the file.
     * @public
     * @since 0.10.12
     */
    abstract getViewData(): string;
    /**
     * Set the data to the editor. This is used to load the file contents.
     *
     * If clear is set, then it means we're opening a completely different file.
     * In that case, you should call clear(), or implement a slightly more efficient
     * clearing mechanism given the new data to be set.
     * @public
     * @since 0.10.12
     */
    abstract setViewData(data: string, clear: boolean): void;
    /**
     * Clear the editor. This is usually called when we're about to open a completely
     * different file, so it's best to clear any editor states like undo-redo history,
     * and any caches/indexes associated with the previous file contents.
     * @public
     * @since 0.10.12
     */
    abstract clear(): void;
}

/**
 * @public
 * @since 0.9.7
 */
export class TFile extends TAbstractFile {
    /**
     * @public
     * @since 0.9.7
     */
    stat: FileStats;
    /**
     * @public
     * @since 0.9.7
     */
    basename: string;
    /**
     * @public
     * @since 0.9.7
     */
    extension: string;

}

/**
 * @public
 * @since 0.9.7
 */
export class TFolder extends TAbstractFile {
    /**
     * @public
     * @since 0.9.7
     */
    children: TAbstractFile[];

    /**
     * @public
     * @since 0.9.7
     */
    isRoot(): boolean;

}

/**
 * @public
 * @since 0.9.7
 */
export class ToggleComponent extends ValueComponent<boolean> {
    /**
     * @public
     * @since 0.9.7
     */
    toggleEl: HTMLElement;

    /**
     * @public
     * @since 0.9.7
     */
    constructor(containerEl: HTMLElement);
    /**
     * @public
     * @since 1.2.3
     */
    setDisabled(disabled: boolean): this;
    /**
     * @public
     * @since 0.9.7
     */
    getValue(): boolean;
    /**
     * @public
     * @since 0.9.7
     */
    setValue(on: boolean): this;

    /**
     * @public
     * @since 1.1.1
     */
    setTooltip(tooltip: string, options?: TooltipOptions): this;
    /**
     * @public
     * @since 0.9.7
     */
    onClick(): void;
    /**
     * @public
     * @since 0.9.7
     */
    onChange(callback: (value: boolean) => any): this;
}

/** @public */
export interface TooltipOptions {
    /** @public */
    placement?: TooltipPlacement;
    /**
     * @public
     * @since 1.8.7
     */
    classes?: string[];
    /**
     * @public
     * @since 1.8.7
     */
    gap?: number;

    /**
     * @public
     * @since 1.4.11
     */
    delay?: number;
}

/** @public */
export type TooltipPlacement = 'bottom' | 'right' | 'left' | 'top';

/**
 * {@link Value} wrapping an external link.
 * @public
 * @since 1.10.0
 */
export class UrlValue extends StringValue {

}

/**
 * @public
 */
export type UserEvent = MouseEvent | KeyboardEvent | TouchEvent | PointerEvent;

/**
 * Container type for data which can expose functions for retrieving, comparing, and rendering the data.
 * Most commonly used in conjunction with formulas for Bases. Values can be used as formula parameters,
 * intermediate values, and the result of evaluation.
 * @public
 * @since 1.10.0
 */
export abstract class Value {
    /**
     * @public
     * @since 1.10.0
     */
    static type: string;

    /**
     * @public
     * @since 1.10.0
     */
    static equals(a: Value | null, b: Value | null): boolean;
    /**
     * @public
     * @since 1.10.0
     */
    static looseEquals(a: Value | null, b: Value | null): boolean;

    /**
     * @public
     * @since 1.10.0
     */
    abstract toString(): string;
    /**
     * @public
     * @since 1.10.0
     */
    abstract isTruthy(): boolean;
    /**
     * @public
     * @since 1.10.0
     */
    equals(other: this): boolean;
    /**
     * @public
     * @since 1.10.0
     */
    looseEquals(other: Value): boolean;
    /**
     * Render this value into the provided HTMLElement.
     * @public
     * @since 1.10.0
     */
    renderTo(el: HTMLElement, ctx: RenderContext): void;

}

/**
 * @public
 * @since 0.9.7
 */
export abstract class ValueComponent<T> extends BaseComponent {
    /**
     * @public
     * @since 0.9.7
     */
    registerOptionListener(listeners: Record<string, (value?: T) => T>, key: string): this;
    /**
     * @public
     * @since 0.9.7
     */
    abstract getValue(): T;
    /**
     * @public
     * @since 0.9.7
     */
    abstract setValue(value: T): this;
}

/**
 * Work with files and folders stored inside a vault.
 * @see {@link https://docs.obsidian.md/Plugins/Vault}
 * @public
 * @since 0.9.7
 */
export class Vault extends Events {
    /**
     * @public
     * @since 0.9.7
     */
    adapter: DataAdapter;

    /**
     * Gets the path to the config folder.
     * This value is typically `.obsidian` but it could be different.
     * @public
     * @since 0.11.1
     */
    configDir: string;

    /**
     * Gets the name of the vault.
     * @public
     * @since 0.9.7
     */
    getName(): string;

    /**
     * Get a file inside the vault at the given path.
     * Returns `null` if the file does not exist.
     *
     * @param path
     * @public
     * @since 1.5.7
     */
    getFileByPath(path: string): TFile | null;
    /**
     * Get a folder inside the vault at the given path.
     * Returns `null` if the folder does not exist.
     *
     * @param path
     * @public
     * @since 1.5.7
     */
    getFolderByPath(path: string): TFolder | null;
    /**
     * Get a file or folder inside the vault at the given path. To check if the return type is
     * a file, use `instanceof TFile`. To check if it is a folder, use `instanceof TFolder`.
     * @param path - vault absolute path to the folder or file, with extension, case sensitive.
     * @returns the abstract file, if it's found.
     * @public
     * @since 0.11.11
     */
    getAbstractFileByPath(path: string): TAbstractFile | null;

    /**
     * Get the root folder of the current vault.
     * @public
     * @since 0.9.7
     */
    getRoot(): TFolder;

    /**
     * Create a new plaintext file inside the vault.
     * @param path - Vault absolute path for the new file, with extension.
     * @param data - text content for the new file.
     * @param options - (Optional)
     * @public
     * @since 0.9.7
     */
    create(path: string, data: string, options?: DataWriteOptions): Promise<TFile>;
    /**
     * Create a new binary file inside the vault.
     * @param path - Vault absolute path for the new file, with extension.
     * @param data - content for the new file.
     * @param options - (Optional)
     * @throws Error if file already exists
     * @public
     * @since 0.9.7
     */
    createBinary(path: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<TFile>;
    /**
     * Create a new folder inside the vault.
     * @param path - Vault absolute path for the new folder.
     * @throws Error if folder already exists
     * @public
     * @since 1.4.0
     */
    createFolder(path: string): Promise<TFolder>;
    /**
     * Read a plaintext file that is stored inside the vault, directly from disk.
     * Use this if you intend to modify the file content afterwards.
     * Use {@link Vault.cachedRead} otherwise for better performance.
     * @public
     * @since 0.9.7
     */
    read(file: TFile): Promise<string>;
    /**
     * Read the content of a plaintext file stored inside the vault
     * Use this if you only want to display the content to the user.
     * If you want to modify the file content afterward use {@link Vault.read}
     * @public
     * @since 0.9.7
     */
    cachedRead(file: TFile): Promise<string>;
    /**
     * Read the content of a binary file stored inside the vault.
     * @public
     * @since 0.9.7
     */
    readBinary(file: TFile): Promise<ArrayBuffer>;

    /**
     * Returns a URI for the browser engine to use, for example to embed an image.
     * @public
     * @since 0.9.7
     */
    getResourcePath(file: TFile): string;
    /**
     * Deletes the file completely.
     * @param file - The file or folder to be deleted
     * @param force - Should attempt to delete folder even if it has hidden children
     * @public
     * @since 0.9.7
     */
    delete(file: TAbstractFile, force?: boolean): Promise<void>;
    /**
     * Tries to move to system trash. If that isn't successful/allowed, use local trash
     * @param file - The file or folder to be deleted
     * @param system - Set to `false` to use local trash by default.
     * @public
     * @since 0.9.7
     */
    trash(file: TAbstractFile, system: boolean): Promise<void>;
    /**
     * Rename or move a file. To ensure links are automatically renamed,
     * use {@link FileManager.renameFile} instead.
     * @param file - the file to rename/move
     * @param newPath - vault absolute path to move file to.
     * @public
     * @since 0.9.11
     */
    rename(file: TAbstractFile, newPath: string): Promise<void>;
    /**
     * Modify the contents of a plaintext file.
     * @param file - The file
     * @param data - The new file content
     * @param options - (Optional)
     * @public
     * @since 0.9.7
     */
    modify(file: TFile, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * Modify the contents of a binary file.
     * @param file - The file
     * @param data - The new file content
     * @param options - (Optional)
     * @public
     * @since 0.9.7
     */
    modifyBinary(file: TFile, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * Add text to the end of a plaintext file inside the vault.
     * @param file - The file
     * @param data - the text to add
     * @param options - (Optional)
     * @public
     * @since 0.13.0
     */
    append(file: TFile, data: string, options?: DataWriteOptions): Promise<void>;
    /**
     * Add data to the end of a binary file inside the vault.
     * @param file - The file
     * @param data - the data to add
     * @param options - (Optional)
     * @public
     * @since 1.12.3
     */
    appendBinary(file: TFile, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
    /**
     * Atomically read, modify, and save the contents of a note.
     * @param file - the file to be read and modified.
     * @param fn - a callback function which returns the new content of the note synchronously.
     * @param options - write options.
     * @returns string - the text value of the note that was written.
     * @example
     * ```ts
     * app.vault.process(file, (data) => {
     *  return data.replace('Hello', 'World');
     * });
     * ```
     * @public
     * @since 1.1.0
     */
    process(file: TFile, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;
    /**
     * Create a copy of a file or folder.
     * @param file - The file or folder.
     * @param newPath - Vault absolute path for the new copy.
     * @public
     * @since 1.8.7
     */
    copy<T extends TAbstractFile>(file: T, newPath: string): Promise<T>;
    /**
     * Get all files and folders in the vault.
     * @public
     * @since 0.9.7
     */
    getAllLoadedFiles(): TAbstractFile[];
    /**
     * Get all folders in the vault.
     * @param includeRoot - Should the root folder (`/`) be returned
     * @public
     * @since 1.6.6
     */
    getAllFolders(includeRoot?: boolean): TFolder[];

    /**
     * @public
     * @since 0.9.7
     */
    static recurseChildren(root: TFolder, cb: (file: TAbstractFile) => any): void;
    /**
     * Get all Markdown files in the vault.
     * @public
     * @since 0.9.7
     */
    getMarkdownFiles(): TFile[];
    /**
     * Get all files in the vault.
     * @public
     * @since 0.9.7
     */
    getFiles(): TFile[];

    /**
     * Called when a file is created.
     * This is also called when the vault is first loaded for each existing file
     * If you do not wish to receive create events on vault load, register your event handler inside {@link Workspace.onLayoutReady}.
     * @public
     * @since 0.9.7
     */
    on(name: 'create', callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
    /**
     * Called when a file is modified.
     * @public
     * @since 0.9.7
     */
    on(name: 'modify', callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
    /**
     * Called when a file is deleted.
     * @public
     * @since 0.9.7
     */
    on(name: 'delete', callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
    /**
     * Called when a file is renamed.
     * @public
     * @since 0.9.7
     */
    on(name: 'rename', callback: (file: TAbstractFile, oldPath: string) => any, ctx?: any): EventRef;

}

/**
 * @public
 * @since 0.9.7
 */
export abstract class View extends Component {
    /**
     * @public
     * @since 0.9.7
     */
    app: App;
    /**
     * @public
     * @since 1.1.0
     */
    icon: IconName;
    /**
     * Whether or not the view is intended for navigation.
     * If your view is a static view that is not intended to be navigated away, set this to false.
     * (For example: File explorer, calendar, etc.)
     * If your view opens a file or can be otherwise navigated, set this to true.
     * (For example: Markdown editor view, Kanban view, PDF view, etc.)
     *
     * @public
     * @since 0.15.1
     */
    navigation: boolean;
    /**
     * @public
     * @since 0.9.7
     */
    leaf: WorkspaceLeaf;
    /**
     * @public
     * @since 0.9.7
     */
    containerEl: HTMLElement;
    /**
     * Assign an optional scope to your view to register hotkeys for when the view
     * is in focus.
     *
     * @example
     * ```ts
     * this.scope = new Scope(this.app.scope);
     * ```
     * @default null
     * @public
     * @since 1.5.7
     */
    scope: Scope | null;
    /**
     * @public
     * @since 0.9.7
     */
    constructor(leaf: WorkspaceLeaf);

    /**
     * @public
     * @since 0.9.7
     */
    protected onOpen(): Promise<void>;
    /**
     * @public
     * @since 0.9.7
     */
    protected onClose(): Promise<void>;
    /**
     * @public
     * @since 0.9.7
     */
    abstract getViewType(): string;
    /**
     * @public
     * @since 0.9.7
     */
    getState(): Record<string, unknown>;
    /**
     * @public
     * @since 0.9.7
     */
    setState(state: unknown, result: ViewStateResult): Promise<void>;
    /**
     * @public
     * @since 0.9.7
     */
    getEphemeralState(): Record<string, unknown>;
    /**
     * @public
     * @since 0.9.7
     */
    setEphemeralState(state: unknown): void;
    /**
     * @public
     * @since 1.1.0
     */
    getIcon(): IconName;
    /**
     * Called when the size of this view is changed.
     * @public
     * @since 0.9.7
     */
    onResize(): void;
    /**
     * @public
     * @since 0.9.7
     */
    abstract getDisplayText(): string;
    /**
     * Populates the pane menu.
     *
     * (Replaces the previously removed `onHeaderMenu` and `onMoreOptionsMenu`)
     * @public
     * @since 0.15.3
     */
    onPaneMenu(menu: Menu, source: 'more-options' | 'tab-header' | string): void;

}

/**
 * @public
 */
export type ViewCreator = (leaf: WorkspaceLeaf) => View;

/**
 * @public
 */
export interface ViewState {

    /**
     * @public
     */
    type: string;
    /**
     * @public
     */
    state?: Record<string, unknown>;
    /**
     * @public
     */
    active?: boolean;
    /**
     * @public
     */
    pinned?: boolean;
    /**
     * @public
     */
    group?: WorkspaceLeaf;

}

/**
 * @public
 */
export interface ViewStateResult {
    /**
     * Set this to true to indicate that there is a state change which should be recorded in the navigation history.
     * @public
     */
    history: boolean;

}

/**
 * @public
 * @since 0.9.7
 */
export class Workspace extends Events {

    /**
     * @public
     * @since 0.9.7
     */
    leftSplit: WorkspaceSidedock | WorkspaceMobileDrawer;
    /**
     * @public
     * @since 0.9.7
     */
    rightSplit: WorkspaceSidedock | WorkspaceMobileDrawer;
    /**
     * @public
     * @since 0.9.7
     */
    leftRibbon: WorkspaceRibbon;
    /**
     * @public
     * @deprecated No longer used
     */
    rightRibbon: WorkspaceRibbon;
    /**
     * @public
     * @since 0.9.7
     */
    rootSplit: WorkspaceRoot;

    /**
     * Indicates the currently focused leaf, if one exists.
     *
     * Please avoid using `activeLeaf` directly, especially without checking whether
     * `activeLeaf` is null.
     *
     * @public
     * @since 0.9.7
     * @deprecated The use of this field is discouraged.
     * The recommended alternatives are:
     * - If you need information about the current view, use {@link Workspace.getActiveViewOfType}.
     * - If you need to open a new file or navigate a view, use {@link Workspace.getLeaf}.
     */
    activeLeaf: WorkspaceLeaf | null;

    /**
     *
     * @public
     * @since 0.9.7
     */
    containerEl: HTMLElement;
    /**
     * If the layout of the app has been successfully initialized.
     * To react to the layout becoming ready, use {@link Workspace.onLayoutReady}
     * @public
     * @since 0.9.7
     */
    layoutReady: boolean;
    /**
     * Save the state of the current workspace layout.
     * @public
     * @since 0.16.0
     */
    requestSaveLayout: Debouncer<[], Promise<void>>;

    /**
     * A component managing the current editor.
     * This can be null if the active view has no editor.
     * @public
     */
    activeEditor: MarkdownFileInfo | null;

    /**
     * Runs the callback function right away if layout is already ready,
     * or push it to a queue to be called later when layout is ready.
     * @public
     * @since 0.11.0
     */
    onLayoutReady(callback: () => any): void;
    /**
     * @public
     * @since 0.9.7
     */
    changeLayout(workspace: any): Promise<void>;

    /**
     * @public
     * @since 0.9.7
     */
    getLayout(): Record<string, unknown>;

    /**
     * @public
     * @since 0.9.11
     */
    createLeafInParent(parent: WorkspaceSplit, index: number): WorkspaceLeaf;

    /**
     * @public
     * @since 0.9.7
     */
    createLeafBySplit(leaf: WorkspaceLeaf, direction?: SplitDirection, before?: boolean): WorkspaceLeaf;
    /**
     * @public
     * @deprecated - You should use {@link Workspace.getLeaf|getLeaf(true)} instead which does the same thing.
     * @since 0.9.7
     */
    splitActiveLeaf(direction?: SplitDirection): WorkspaceLeaf;

    /**
     * @public
     * @deprecated - Use the new form of this method instead
     * @since 0.13.8
     */
    duplicateLeaf(leaf: WorkspaceLeaf, direction?: SplitDirection): Promise<WorkspaceLeaf>;
    /**
     * @public
     * @since 1.1.0
     */
    duplicateLeaf(leaf: WorkspaceLeaf, leafType: PaneType | boolean, direction?: SplitDirection): Promise<WorkspaceLeaf>;
    /**
     * @public
     * @deprecated - You should use {@link Workspace.getLeaf|getLeaf(false)} instead which does the same thing.
     */
    getUnpinnedLeaf(): WorkspaceLeaf;
    /**
     * Creates a new leaf in a leaf adjacent to the currently active leaf.
     * If direction is `'vertical'`, the leaf will appear to the right.
     * If direction is `'horizontal'`, the leaf will appear below the current leaf.
     *
     * @public
     * @since 0.16.0
     */
    getLeaf(newLeaf?: 'split', direction?: SplitDirection): WorkspaceLeaf;
    /**
     * If newLeaf is false (or not set) then an existing leaf which can be navigated
     * is returned, or a new leaf will be created if there was no leaf available.
     *
     * If newLeaf is `'tab'` or `true` then a new leaf will be created in the preferred
     * location within the root split and returned.
     *
     * If newLeaf is `'split'` then a new leaf will be created adjacent to the currently active leaf.
     *
     * If newLeaf is `'window'` then a popout window will be created with a new leaf inside.
     *
     * @public
     * @since 0.16.0
     */
    getLeaf(newLeaf?: PaneType | boolean): WorkspaceLeaf;

    /**
     * Migrates this leaf to a new popout window.
     * Only works on the desktop app.
     * @public
     * @throws Error if the app does not support popout windows (i.e. on mobile or if Electron version is too old)
     * @since 0.15.4
     */
    moveLeafToPopout(leaf: WorkspaceLeaf, data?: WorkspaceWindowInitData): WorkspaceWindow;

    /**
     * Open a new popout window with a single new leaf and return that leaf.
     * Only works on the desktop app.
     * @public
     * @since 0.15.4
     */
    openPopoutLeaf(data?: WorkspaceWindowInitData): WorkspaceLeaf;
    /**
     * @public
     * @since 0.16.0
     */
    openLinkText(linktext: string, sourcePath: string, newLeaf?: PaneType | boolean, openViewState?: OpenViewState): Promise<void>;
    /**
     * Sets the active leaf
     * @param leaf - The new active leaf
     * @param params - Parameter object of whether to set the focus.
     * @public
     * @since 0.16.3
     */
    setActiveLeaf(leaf: WorkspaceLeaf, params?: {
        /** @public */
        focus?: boolean;
    }): void;
    /**
     * @deprecated - function signature changed. Use other form instead
     * @public
     */
    setActiveLeaf(leaf: WorkspaceLeaf, pushHistory: boolean, focus: boolean): void;

    /**
     * Retrieve a leaf by its id.
     * @param id id of the leaf to retrieve.
     * @public
     * @since 1.5.1
     */
    getLeafById(id: string): WorkspaceLeaf | null;
    /**
     * Get all leaves that belong to a group
     * @param group id
     * @public
     * @since 0.9.7
     */
    getGroupLeaves(group: string): WorkspaceLeaf[];

    /**
     * Get the most recently active leaf in a given workspace root. Useful for interacting with the leaf in the root split while a sidebar leaf might be active.
     * @param root Root for the leaves you want to search. If a root is not provided, the `rootSplit` and leaves within pop-outs will be searched.
     * @public
     * @since 0.15.4
     */
    getMostRecentLeaf(root?: WorkspaceParent): WorkspaceLeaf | null;
    /**
     * Create a new leaf inside the left sidebar.
     * @param split Should the existing split be split up?
     * @public
     * @since 0.9.7
     */
    getLeftLeaf(split: boolean): WorkspaceLeaf | null;
    /**
     * Create a new leaf inside the right sidebar.
     * @param split Should the existing split be split up?
     * @public
     * @since 0.9.7
     */
    getRightLeaf(split: boolean): WorkspaceLeaf | null;
    /**
     * Get side leaf or create one if one does not exist.
     * @public
     * @since 1.7.2
     */
    ensureSideLeaf(type: string, side: Side, options?: {
        /** @public */
        active?: boolean;
        /** @public */
        split?: boolean;
        /** @public */
        reveal?: boolean;
        /** @public */
        state?: any;
    }): Promise<WorkspaceLeaf>;

    /**
     * Get the currently active view of a given type.
     * @public
     * @since 0.9.16
     */
    getActiveViewOfType<T extends View>(type: Constructor<T>): T | null;

    /**
     * Returns the file for the current view if it's a `FileView`.
     * Otherwise, it will return the most recently active file.
     * @public
     */
    getActiveFile(): TFile | null;

    /**
     * Iterate through all leaves in the main area of the workspace.
     * @public
     * @since 0.9.7
     */
    iterateRootLeaves(callback: (leaf: WorkspaceLeaf) => any): void;
    /**
     * Iterate through all leaves, including main area leaves, floating leaves, and sidebar leaves.
     * @public
     * @since 0.9.7
     */
    iterateAllLeaves(callback: (leaf: WorkspaceLeaf) => any): void;
    /**
     * Get all leaves of a given type.
     * @public
     * @since 0.9.7
     */
    getLeavesOfType(viewType: string): WorkspaceLeaf[];
    /**
     * Remove all leaves of the given type.
     * @public
     * @since 0.9.7
     */
    detachLeavesOfType(viewType: string): void;

    /**
     * Bring a given leaf to the foreground. If the leaf is in a sidebar, the sidebar will be uncollapsed.
     * `await` this function to ensure your view has been fully loaded and is not deferred.
     * @public
     * @since 1.7.2
     */
    revealLeaf(leaf: WorkspaceLeaf): Promise<void>;
    /**
     * Get the filenames of the 10 most recently opened files.
     * @public
     * @since 0.9.7
     */
    getLastOpenFiles(): string[];

    /**
     * Calling this function will update/reconfigure the options of all Markdown views.
     * It is fairly expensive, so it should not be called frequently.
     * @public
     * @since 0.13.21
     */
    updateOptions(): void;

    /**
     * Add a context menu to internal file links.
     * @public
     * @since 0.12.10
     */
    handleLinkContextMenu(menu: Menu, linktext: string, sourcePath: string, leaf?: WorkspaceLeaf): boolean;

    /**
     * Triggered when the active Markdown file is modified. React to file changes before they
     * are saved to disk.
     * @public
     * @since 0.9.7
     */
    on(name: 'quick-preview', callback: (file: TFile, data: string) => any, ctx?: any): EventRef;
    /**
     * Triggered when a `WorkspaceItem` is resized or the workspace layout has changed.
     * @public
     * @since 0.9.7
     */
    on(name: 'resize', callback: () => any, ctx?: any): EventRef;

    /**
     * Triggered when the active leaf changes.
     * @public
     * @since 0.10.9
     */
    on(name: 'active-leaf-change', callback: (leaf: WorkspaceLeaf | null) => any, ctx?: any): EventRef;
    /**
     * Triggered when the active file changes. The file could be in a new leaf, an existing leaf,
     * or an embed.
     * @public
     * @since 0.10.9
     */
    on(name: 'file-open', callback: (file: TFile | null) => any, ctx?: any): EventRef;

    /**
     * @public
     * @since 0.9.20
     */
    on(name: 'layout-change', callback: () => any, ctx?: any): EventRef;
    /**
     * Triggered when a new popout window is created.
     * @public
     * @since 0.15.3
     */
    on(name: 'window-open', callback: (win: WorkspaceWindow, window: Window) => any, ctx?: any): EventRef;
    /**
     * Triggered when a popout window is closed.
     * @public
     * @since 0.15.3
     */
    on(name: 'window-close', callback: (win: WorkspaceWindow, window: Window) => any, ctx?: any): EventRef;
    /**
     * Triggered when the CSS of the app has changed.
     * @public
     * @since 0.9.7
     */
    on(name: 'css-change', callback: () => any, ctx?: any): EventRef;

    /**
     * Triggered when the user opens the context menu on a file.
     * @public
     * @since 0.9.12
     */
    on(name: 'file-menu', callback: (menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf) => any, ctx?: any): EventRef;
    /**
     * Triggered when the user opens the context menu with multiple files selected in the File Explorer.
     * @public
     * @since 1.4.10
     */
    on(name: 'files-menu', callback: (menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf) => any, ctx?: any): EventRef;

    /**
     * Triggered when the user opens the context menu on an external URL.
     * @public
     * @since 1.5.1
     */
    on(name: 'url-menu', callback: (menu: Menu, url: string) => any, ctx?: any): EventRef;
    /**
     * Triggered when the user opens the context menu on an editor.
     * @public
     * @since 1.1.0
     */
    on(name: 'editor-menu', callback: (menu: Menu, editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;
    /**
     * Triggered when changes to an editor has been applied, either programmatically or from a user event.
     * @public
     * @since 1.1.1
     */
    on(name: 'editor-change', callback: (editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;

    /**
     * Triggered when the editor receives a paste event.
     * Check for `evt.defaultPrevented` before attempting to handle this event, and return if it has been already handled.
     * Use `evt.preventDefault()` to indicate that you've handled the event.
     * @public
     * @since 1.1.0
     */
    on(name: 'editor-paste', callback: (evt: ClipboardEvent, editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;
    /**
     * Triggered when the editor receives a drop event.
     * Check for `evt.defaultPrevented` before attempting to handle this event, and return if it has been already handled.
     * Use `evt.preventDefault()` to indicate that you've handled the event.
     * @public
     * @since 1.1.0
     */
    on(name: 'editor-drop', callback: (evt: DragEvent, editor: Editor, info: MarkdownView | MarkdownFileInfo) => any, ctx?: any): EventRef;

    /**
     * Triggered when the app is about to quit.
     * Not guaranteed to actually run.
     * Perform some best effort cleanup here.
     * @public
     * @since 0.10.2
     */
    on(name: 'quit', callback: (tasks: Tasks) => any, ctx?: any): EventRef;

}

/**
 * @public
 * @since 0.15.4
 */
export abstract class WorkspaceContainer extends WorkspaceSplit {

    /**
     * @public
     * @since 0.15.4
     */
    abstract win: Window;
    /**
     * @public
     * @since 0.15.4
     */
    abstract doc: Document;

}

/**
 * @public
 * @since 0.15.2
 */
export class WorkspaceFloating extends WorkspaceParent {
    /**
     * @public
     * @since 0.15.2
     */
    parent: WorkspaceParent;

}

/**
 * @public
 * @since 0.10.2
 */
export abstract class WorkspaceItem extends Events {

    /**
     * The direct parent of the leaf.
     * @public
     * @since 1.6.6
     */
    abstract parent: WorkspaceParent;

    /**
     * @public
     * @since 0.10.2
     */
    getRoot(): WorkspaceItem;
    /**
     * Get the root container parent item, which can be one of:
     * - {@link WorkspaceRoot}
     * - {@link WorkspaceWindow}
     * @public
     * @since 0.15.4
     */
    getContainer(): WorkspaceContainer;

}

/**
 * @public
 */
export class WorkspaceLeaf extends WorkspaceItem implements HoverParent {

    /**
     * The direct parent of the leaf.
     *
     * On desktop, a leaf is always a child of a `WorkspaceTabs` component.
     * On mobile, a leaf might be a child of a `WorkspaceMobileDrawer`.
     * Perform an `instanceof` check before making an assumption about the
     * `parent`.
     *
     * @public
     */
    parent: WorkspaceTabs | WorkspaceMobileDrawer;

    /**
     * The view associated with this leaf. Do not attempt to cast this to your
     * custom `View` without first checking `instanceof`.
     * @public
     */
    view: View;

    /** @public */
    hoverPopover: HoverPopover | null;

    /**
     * Open a file in this leaf.
     *
     * @public
     */
    openFile(file: TFile, openState?: OpenViewState): Promise<void>;

    /**
     * @public
     */
    open(view: View): Promise<View>;

    /**
     * @public
     */
    getViewState(): ViewState;
    /**
     * @public
     */
    setViewState(viewState: ViewState, eState?: any): Promise<void>;
    /**
     * Returns true if this leaf is currently deferred because it is in the background.
     * A deferred leaf will have a DeferredView as its view, instead of the View that
     * it should normally have for its type (like MarkdownView for the `markdown` type).
     * @since 1.7.2
     * @public
     */
    get isDeferred(): boolean;
    /**
     * If this view is currently deferred, load it and await that it has fully loaded.
     * @since 1.7.2
     * @public
     */
    loadIfDeferred(): Promise<void>;

    /**
     * @public
     */
    getEphemeralState(): any;
    /**
     * @public
     */
    setEphemeralState(state: any): void;
    /**
     * @public
     */
    togglePinned(): void;
    /**
     * @public
     */
    setPinned(pinned: boolean): void;

    /**
     * @public
     */
    setGroupMember(other: WorkspaceLeaf): void;
    /**
     * @public
     */
    setGroup(group: string): void;
    /**
     * @public
     */
    detach(): void;

    /**
     * @public
     */
    getIcon(): IconName;
    /**
     * @public
     */
    getDisplayText(): string;

    /**
     * @public
     */
    onResize(): void;

    /**
     * @public
     */
    on(name: 'pinned-change', callback: (pinned: boolean) => any, ctx?: any): EventRef;
    /**
     * @public
     */
    on(name: 'group-change', callback: (group: string) => any, ctx?: any): EventRef;

}

/**
 * @public
 * @since 1.6.6
 */
export class WorkspaceMobileDrawer extends WorkspaceParent {

    /** @public */
    parent: WorkspaceParent;

    /** @public */
    collapsed: boolean;

    /** @public */
    expand(): void;

    /** @public */
    collapse(): void;

    /** @public */
    toggle(): void;

}

/**
 * @public
 * @since 0.9.7
 */
export abstract class WorkspaceParent extends WorkspaceItem {

}

/**
 * @public
 */
export class WorkspaceRibbon {

}

/**
 * @public
 * @since 0.15.2
 */
export class WorkspaceRoot extends WorkspaceContainer {
    /** @public */
    win: Window;
    /** @public */
    doc: Document;

}

/**
 * @public
 * @since 0.15.4
 */
export class WorkspaceSidedock extends WorkspaceSplit {

    /**
     * @public
     * @since 0.12.11
     */
    collapsed: boolean;

    /**
     * @public
     * @since 0.12.11
     */
    toggle(): void;
    /**
     * @public
     * @since 0.12.11
     */
    collapse(): void;
    /**
     * @public
     * @since 0.12.11
     */
    expand(): void;

}

/**
 * @public
 * @since 0.9.7
 */
export class WorkspaceSplit extends WorkspaceParent {
    /** @public */
    parent: WorkspaceParent;

}

/**
 * @public
 */
export class WorkspaceTabs extends WorkspaceParent {

    /** @public */
    parent: WorkspaceSplit;

}

/**
 * @public
 * @since 0.15.4
 */
export class WorkspaceWindow extends WorkspaceContainer {

    /** @public */
    win: Window;
    /** @public */
    doc: Document;

}

/**
 * @public
 */
export interface WorkspaceWindowInitData {
    /** @public */
    x?: number;
    /** @public */
    y?: number;

    /**
     * The suggested size
     * @public
     */
    size?: {
        /** @public */
        width: number;
        /** @public */
        height: number;
    };
}

export { }

/**
 * Can be any Lucide icon name or an internal icon name.
 * @public
 */
export type IconName = string;
