import type { WixClient } from '@wix/sdk/client';
import type { FC } from 'react';
import type { BISettings } from '../../ricos-common/ricos-types.js';
import type { RichContent } from '../../ricos-schema/next-schema/generated/ricos_document.js';
import type { ColorPaletteManager } from '../color-palette-types.js';
import type { CommandDescriptor } from '../commands.js';
import type { DebugMode } from '../debug-mode.js';
import type { AnchorTarget, AvailableExperiments, CustomAnchorScroll, FocusPosition, Link_Rel, RelValue, TextAlignment, onAtomicBlockFocus } from './common-types.js';
import type { OnErrorFunction } from './editor-types.js';
import type { EditorPluginOptions, GeneralLinkSettings, HistorySettings, LinkPanelSettings } from './plugin-types.js';
import type { CustomizableKeyboardShortcut } from './shortcuts.js';
import type { RicosTheme } from './theme-types.js';
import type { ToolbarsConfig } from './toolbars-v2.js';
export type Environment = 'businessManager' | 'liveSite' | 'wixel';
interface EditorEvents {
    subscribe: (event: string, callback: () => Promise<{
        type: string;
        data: unknown;
    }>) => (event: string, callback: () => Promise<{
        type: string;
        data: unknown;
    }>) => void;
    unsubscribe: (event: string, callback: () => Promise<{
        type: string;
        data: unknown;
    }>) => void;
    dispatch: (event: string) => Promise<unknown>;
    publish: () => Promise<RichContent>;
}
export interface EditorProps {
    plugins?: EditorPluginOptions[];
    /**
     * @deprecated
     */
    linkPanelSettings?: LinkPanelSettings;
    modalSettings?: ModalSettings;
    onChange?: OnContentChangeFunction;
    placeholder?: string;
    /**
     * Toolbars configuration — controls the text formatting toolbar, insert
     * plugin toolbars, plugin context toolbars and the quick-actions menu.
     */
    toolbars?: ToolbarsConfig;
    onBusyChange?: OnBusyChangeFunction;
    injectedContent?: RichContent;
    maxTextLength?: number;
    editorEvents?: EditorEvents;
    sideBlockComponent?: FC<{
        id: string;
    }>;
    commands?: CommandDescriptor<unknown>[];
    /** Settings for undo/redo history */
    historySettings?: HistorySettings;
    onLoad?: (editor: any) => void;
    autofocus?: FocusPosition;
    container?: HTMLElement | (() => HTMLElement | null);
    content?: RichContent;
    keyboardShortcuts?: CustomizableKeyboardShortcut[];
    /** The placeholder to be displayed while the editor is loading. */
    loadingPlaceholder?: React.ReactNode;
    /**
     * Controls focus behavior when tabbing into the editor:
     * - 'edit': (default) Immediately enables typing when editor receives keyboard focus
     * - 'container': Shows focus ring but requires Enter/key press to start editing.
     *                Tab will exit the editor. Useful for consumers who want to control
     *                focus flow without using external focus traps.
     */
    tabFocusBehavior?: 'edit' | 'container';
    /** Unified color manager for sharing custom colors across all plugins. */
    colorManager?: ColorPaletteManager;
    /** When `true`, renders in mobile-optimized mode. */
    isMobile?: boolean;
    /** @deprecated Use `generalLinkSettings` instead. */
    linkSettings?: LinkSettings;
    /** Link settings applied globally to all linkable plugins. */
    generalLinkSettings?: GeneralLinkSettings;
    /** Two-letter locale code (e.g., `'en'`, `'he'`). Determines the language and text direction of modals and settings. */
    locale?: string;
    /** Locale for content, when different from UI locale. Falls back to `locale` if not set. */
    localeContent?: string;
    mediaSettings?: MediaSettings;
    /** Callback fired when an error occurs in a Ricos component. */
    onError?: OnErrorFunction;
    /** Theme configuration for colors, fonts, and custom styles. */
    theme?: RicosTheme;
    /** Default text alignment direction. */
    textAlignment?: TextAlignment;
    /** Callback fired when an atomic block (plugin) receives focus. */
    onAtomicBlockFocus?: onAtomicBlockFocus;
    /** @deprecated */
    experiments?: AvailableExperiments;
    /** Domain used to render UGC source code in an isolated sandboxed iframe. */
    iframeSandboxDomain?: string;
    /** When `true`, wraps text around left/right-aligned plugins. */
    textWrap?: boolean;
    /**
     * Theme variant to apply:
     * - `'businessManager'`: BM theme is applied and cannot be overridden.
     * - `'liveSite'`: liveSite theme is applied and can be overridden via `theme`.
     * @default 'liveSite'
     */
    environment?: Environment;
    /** Debug mode flags for enabling development-time diagnostics. */
    debugMode?: DebugMode[];
    /**
     * Base URL of the site, used to resolve page-relative URLs.
     * Used by links, buttons, gallery items, and vertical embeds to construct full hrefs
     * from relative paths (e.g., `/my-page` → `https://example.com/my-site/my-page`).
     * For free Wix sites, must include the site slug (e.g., `https://user.wixsite.com/my-site`).
     *
     * - **Editor**: If not provided, fetched automatically from `/_api/ricos-site-pages/base-url`.
     * - **Viewer**: Must be provided explicitly. If missing, page links will render as relative paths without the site domain.
     *
     * @example 'https://www.example.com/my-site'
     */
    baseUrl?: string;
    /** Business intelligence configuration for analytics and tracking. */
    biSettings?: BISettings;
    /**
     * Authenticated `WixClient` from `@wix/sdk`. When provided, takes priority over
     * `instance` for authorizing every request the editor makes (media uploads,
     * link previews, etc.). Use this in headless apps where you own the React tree.
     */
    wixClient?: WixClient;
    /**
     * Per-session Wix instance token. Used when no `wixClient` is provided — Ricos
     * builds an internal client from it. Typically set by Wix-served host pages.
     */
    instance?: string;
    /**
     * Metasite ID. Scopes storage and CDN traffic to the owning site when no
     * `wixClient` is given.
     */
    msid?: string;
    /**
     * Whether to normalize rich content. When true, content will be normalized
     * using normalizeRicosDocument. When false, content normalization is skipped.
     * @default true
     */
    shouldNormalizeRichContent?: boolean;
    /** @deprecated Not used at runtime */
    wixExperiments?: any;
    /** @deprecated Not used at runtime */
    httpClient?: any;
}
export type ContentChangeSource = 'edit' | 'selection';
export type ContentChangeMeta = {
    source: ContentChangeSource;
};
export type OnContentChangeFunction = (content: RichContent, meta: ContentChangeMeta) => void;
export type OnBusyChangeFunction = (isBusy: boolean) => void;
export type ModalSettings = {
    onModalOpen?: () => void;
    onModalClose?: () => void;
} & ModalSettingsDeprecated;
/**
 * @deprecated
 */
type ModalSettingsDeprecated = {
    openModal?: (data: Record<string, unknown>) => void;
    closeModal?: () => void;
    ariaHiddenId?: string;
    container?: HTMLElement;
};
export type FullscreenProps = {
    backgroundColor?: string;
    foregroundColor?: string;
    container?: HTMLElement | (() => HTMLElement | null);
};
export interface MediaSettings {
    pauseMedia?: boolean;
    disableRightClick?: boolean;
    fullscreenProps?: FullscreenProps;
    /**
     * @deprecated
     */
    disableDownload?: boolean;
}
export interface LinkSettings {
    anchorTarget?: AnchorTarget;
    relValue?: RelValue;
    rel?: Link_Rel;
    customAnchorScroll?: CustomAnchorScroll;
}
export type RicosPortal = HTMLDivElement;
export {};
//# sourceMappingURL=ricos-types.d.ts.map