import type { ComponentType, FC, PropsWithChildren, ReactNode, Ref } from 'react';
import type { PmMarkConverter, PmNodeConverter } from '../pm-converters/types.js';
import type { IEditorQuery } from '../ricos-content-query/index.js';
import type { SMART_BLOCK_TYPE } from '../ricos-content/consts.js';
import type { ACTION_BUTTON_TYPE, AUDIO_TYPE, CODE_BLOCK_TYPE, COLLAPSIBLE_LIST_TYPE, DIVIDER_TYPE, EMOJI_TYPE, EXTERNAL_LINK_TYPE, EXTERNAL_MENTIONS_TYPE, FILE_UPLOAD_TYPE, GALLERY_TYPE, GIPHY_TYPE, HASHTAG_TYPE, HEADERS_MARKDOWN_TYPE, HEADINGS_DROPDOWN_TYPE, HTML_TYPE, IMAGE_TYPE, IMAGE_TYPE_LEGACY, INDENT_TYPE, LINE_SPACING_TYPE, LINK_BUTTON_TYPE, LINK_PREVIEW_TYPE, LINK_TYPE, MENTION_TYPE, POLL_TYPE, PREVIEW, SHAPE_TYPE, SPOILER_TYPE, TABLE_TYPE, TOC_TYPE, TEXT_COLOR_TYPE, TEXT_HIGHLIGHT_TYPE, UNDO_REDO_TYPE, VERTICAL_EMBED_TYPE, VIDEO_TYPE, VIDEO_TYPE_LEGACY } from '../ricos-content/index.js';
import type { ModalService } from '../ricos-modals/index.js';
import type { EditorPlugins, PluginServices } from '../ricos-plugins/editor-plugins.js';
import type { MentionData as MentionPluginData, Node } from '@wix/ricos/schema';
import { Decoration_Type, Node_Type } from '@wix/ricos/schema';
import type { ToolbarButtonRenderer } from './plugin-toolbar';
import type { LinkOptions } from '../_shared/link-modal/open-link-modal/types';
import type { SitePagesDropdownOption } from '../_shared/site-pages/types.js';
import type { Editor } from '../tiptap/core/index';
import type { NodeSelection, Selection } from '../tiptap/pm/state';
import type { FileUploadData } from '../plugin-file-upload/types.js';
import type { PublicCommands } from './editor-commands-type.js';
import type { EditorPluginOptions } from './editor-plugin-options.js';
import type { ClassNameStrategy, GetToolbarSettings, IRicosEditor, PluginExports, ResolveReferenceElement, RicosExtension, RicosPluginToolbarNamesValues, TFunction, TextDirection, ThemeData, TiptapEditor } from './index.js';
import type { RicosServices } from './services.js';
import type { KeyboardShortcut } from './shortcuts.js';
import type { ToolbarType } from './toolbar-enums.js';
import type { Resolver, TextButton } from './toolbar-types.js';
import type { ViewerContextualData } from './viewer.js';
export type { EditorPluginOptions } from './editor-plugin-options.js';
export { Decoration_Type, Node_Type };
export type MentionData = {
    mention: MentionPluginData;
    trigger: string;
};
export type PluginMapping = {
    [type: string]: {
        component: ComponentType<PropsWithChildren>;
        classNameStrategies?: {
            size?: ClassNameStrategy;
            alignment?: ClassNameStrategy;
            textWrap?: ClassNameStrategy;
        };
        elementType?: 'inline' | 'block';
    };
};
export type PluginTypeMapper = (...args: $TSFixMe[]) => PluginMapping;
type PluginType = typeof LINK_BUTTON_TYPE | typeof ACTION_BUTTON_TYPE | typeof CODE_BLOCK_TYPE | typeof DIVIDER_TYPE | typeof EMOJI_TYPE | typeof FILE_UPLOAD_TYPE | typeof GALLERY_TYPE | typeof GIPHY_TYPE | typeof HASHTAG_TYPE | typeof HEADERS_MARKDOWN_TYPE | typeof HTML_TYPE | typeof IMAGE_TYPE | typeof IMAGE_TYPE_LEGACY | typeof INDENT_TYPE | typeof LINE_SPACING_TYPE | typeof HEADINGS_DROPDOWN_TYPE | typeof SPOILER_TYPE | typeof EXTERNAL_LINK_TYPE | typeof LINK_TYPE | typeof LINK_PREVIEW_TYPE | typeof EXTERNAL_MENTIONS_TYPE | typeof MENTION_TYPE | typeof TEXT_COLOR_TYPE | typeof TEXT_HIGHLIGHT_TYPE | typeof UNDO_REDO_TYPE | typeof VERTICAL_EMBED_TYPE | typeof VIDEO_TYPE | typeof AUDIO_TYPE | typeof VIDEO_TYPE_LEGACY | typeof POLL_TYPE | typeof COLLAPSIBLE_LIST_TYPE | typeof TABLE_TYPE | typeof TOC_TYPE | typeof SHAPE_TYPE | typeof SMART_BLOCK_TYPE;
interface BasePluginConfig {
    type: string;
}
export type MenuGroups = 'basic' | 'advanced' | 'embed' | 'embed_wix';
type MenuConfig = {
    group?: MenuGroups;
    tags?: string;
};
export type AddButton = {
    id: string;
    icon: ComponentType;
    command: (args: {
        publicCommands: PublicCommands;
        referenceElement?: HTMLElement | null;
    }) => boolean;
    tooltip: string;
    toolbars: ToolbarType[];
    dataHook: string;
    label: string;
    menuConfig?: MenuConfig;
    shortcuts?: KeyboardShortcut[];
};
/**
 * Tooltip shown on a plugin toolbar button. Either a translation key (resolved
 * via `t()` at construction time), or a function that receives the current
 * runtime `isActive` and returns a translation key — useful for toggle buttons
 * whose tooltip should differ in active vs inactive state (e.g. "Set as Banner"
 * vs "Remove Banner"). The function form is resolved at render time.
 */
export type ToolbarButtonTooltip = string | null | ((args: {
    isActive?: boolean;
}) => string);
export type ToolbarButton<P = any> = ({
    id: string;
    type: 'toggle' | 'modal' | 'color';
    renderer: ToolbarButtonRenderer;
    tooltip: ToolbarButtonTooltip;
    label?: string;
    dataHook: string;
    command: ToolbarButtonCommand;
    attributes?: ToolbarButtonAttributes;
    getComponentProps?: GetComponentPropsFn<P>;
} & ({
    icon: ComponentType;
} | {
    getIcon: (args: {
        services: RicosServices;
        attributes: Record<string, any>;
    }) => ComponentType;
})) | {
    id: string;
    type: 'color';
    renderer: ToolbarButtonRenderer;
    attributes?: ToolbarButtonAttributes;
    tooltip: ToolbarButtonTooltip;
    dataHook: string;
    command: ToolbarButtonCommand;
    getComponentProps?: GetComponentPropsFn<P>;
} | {
    id: string;
    type: 'separator';
    renderer: ToolbarButtonRenderer;
    icon: ComponentType;
    attributes?: ToolbarButtonAttributes;
} | ({
    id: string;
    type: 'dropdown';
    tooltip: ToolbarButtonTooltip;
    label?: string;
    dataHook: string;
    renderer: ToolbarButtonRenderer;
    Component: ComponentType<P>;
    getComponentProps: GetComponentPropsFn<P>;
    command: ToolbarButtonCommand<P>;
    attributes?: ToolbarButtonAttributes;
} & ({
    icon: ComponentType;
} | {
    getIcon: (args: {
        services: RicosServices;
        attributes: Record<string, any>;
    }) => ComponentType;
}));
export type ToolbarButtonCommand<P = unknown> = (args: {
    referenceElement: HTMLElement | undefined;
    tiptapEditor: Editor;
    publicCommands: PublicCommands;
    attributes: $TSFixMe;
    modals: ModalService;
    isMobile: boolean;
    getComponentProps: GetComponentPropsFn<P> | undefined;
}) => void;
type GetComponentPropsFn<P> = (args: {
    tiptapEditor: Editor;
    attributes: $TSFixMe;
    publicCommands: PublicCommands;
    t: TFunction;
    modals: ModalService;
    languageDir: TextDirection;
}) => P;
export type ToolbarButtonAttributes = Record<string, Resolver | undefined>;
export type FloatingToolbarButton = {
    Component: ComponentType<any>;
    priority: number;
    isVisible: (args: {
        editorQuery: IEditorQuery['query'];
        modalService: ModalService;
        editor: TiptapEditor;
        nodeId?: string;
    }) => boolean;
};
export type PluginToolbarConfig<PluginConfig extends EditorPluginConfig = Record<string, any>> = {
    names: RicosPluginToolbarNamesValues[];
    getButtons: (config: PluginConfig, services: RicosServices) => ToolbarButton[];
    isVisible?: (selection: Selection | NodeSelection, editor: IRicosEditor) => boolean;
    resolveReferenceElement?: ResolveReferenceElement;
};
export type AddButtonsCreator<PluginConfig = Record<string, any>> = (config: PluginConfig, services: RicosServices) => AddButton[];
export interface EditorPlugin<PluginConfig extends EditorPluginConfig = Record<string, any>> extends BasePluginConfig {
    config: PluginConfig;
    tiptapExtensions: RicosExtension[];
    pmNodeConverters?: PmNodeConverter[];
    pmMarkConverters?: PmMarkConverter[];
    getAddButtons?: AddButtonsCreator<PluginConfig>;
    textButtons?: TextButton<any>[];
    getQuickActions?: ({ pluginServices }: {
        pluginServices: PluginServices;
        config: PluginConfig;
    }) => QuickAction[];
    disableOnMobile?: boolean;
    shortcuts?: KeyboardShortcut[];
    toolbar?: PluginToolbarConfig<PluginConfig>;
    floatingToolbarButton?: FloatingToolbarButton;
    exports?: Partial<PluginExports>;
    dependencies?: EditorPlugin[];
    Provider?: React.ComponentType<{
        children: React.ReactNode;
        plugins: EditorPlugins;
    }>;
    GlobalComponent?: React.ComponentType;
}
export type QuickAction = {
    id: string;
    title: string;
    icon: React.ComponentType;
    section: QuickActionsModalSection;
    command: ({ editor, publicCommands, modalService, referenceElement }: {
        editor: Editor;
        publicCommands: PublicCommands;
        modalService: ModalService;
        referenceElement?: HTMLElement;
    }) => void;
    tags: string[];
    /**
     * Optional predicate that decides whether this action is shown for the
     * current editor selection. Evaluated when the quick-actions modal opens.
     * Returning `false` hides the item entirely. Defaults to true
     */
    isVisible?: (editor: Editor) => boolean;
};
export interface ViewerPlugin<PluginConfig = Record<string, any>> extends BasePluginConfig {
    config: PluginConfig;
    typeMapper?: PluginTypeMapper;
    nodeViewRenderers?: NodeViewRenderers;
    nodeViewDecorators?: NodeViewDecorator<JSX.Element>[];
}
export type BasePlugin = EditorPlugin & ViewerPlugin;
/** Public-facing plugin creator: takes config without `type`, returns the full plugin options. */
export type EditorPluginOptionCreator<T extends EditorPluginOptions = EditorPluginOptions> = (config?: Omit<T, 'type'>) => T;
export type EditorPluginCreator<PluginConfig extends Record<string, any> = any> = (config?: PluginConfig) => EditorPlugin<PluginConfig>;
export type ViewerPluginCreator<PluginConfig> = (config?: PluginConfig) => ViewerPlugin<PluginConfig>;
export interface EditorPluginConfig {
    toolbar?: {
        hidden?: string[];
        icons?: {
            [key: string]: (props: $TSFixMe) => JSX.Element;
        };
    };
    getIsVisiblePromise?: (...args: $TSFixMe[]) => Promise<boolean>;
}
export interface ViewerPluginConfig {
}
export type LegacyEditorPluginConfig<PluginConfig extends EditorPluginConfig = Record<string, any>> = Partial<{
    [key in PluginType]: PluginConfig;
}> & {
    uiSettings?: UISettings;
    getToolbarSettings?: GetToolbarSettings;
    themeData?: ThemeData;
    resolveFileUrl?: (data: FileUploadData) => Promise<string>;
    [key: string]: any;
};
export type LegacyViewerPluginConfig<PluginConfig = Record<string, any>> = Partial<{
    [key in PluginType]: PluginConfig;
}> & {
    uiSettings?: UISettings;
    [PREVIEW]?: any;
    [key: string]: any;
};
export interface LinkPanelSettings {
    blankTargetToggleVisibilityFn?: () => boolean;
    nofollowRelToggleVisibilityFn?: () => boolean;
    showNewTabCheckbox?: boolean;
    showNoFollowCheckbox?: boolean;
    showNoReferrerCheckbox?: boolean;
    showSponsoredCheckbox?: boolean;
    placeholder?: string;
    dropDown?: any;
    externalPopups?: boolean;
}
export type PublicLinkType = 'section' | SitePagesDropdownOption;
export type GeneralLinkSettings = {
    /**
     *  web-address is always enabled
     * */
    enabledLinkTypes?: PublicLinkType[];
    /**
     *  Initial link options. These will be used when creating a new link and also displayed in the link panel
     * */
    initialLinkOptions?: LinkOptions;
    /**
     *  Whether to underline the link text automatically
     *  @default true
     * */
    autoUnderline?: boolean;
};
export type HistoryKeyboardShortcuts = {
    /**
     * Custom handler for undo keyboard shortcut (Mod-z)
     * Return true to prevent default behavior
     */
    undo?: () => boolean;
    /**
     * Custom handler for redo keyboard shortcut (Mod-y, Shift-Mod-z)
     * Return true to prevent default behavior
     */
    redo?: () => boolean;
};
export type HistorySettings = {
    /**
     * Callback invoked when items are added to the undo stack
     */
    onHistoryChange?: () => void;
    /**
     * Custom keyboard shortcut handlers for undo/redo.
     * Set to false to disable keyboard shortcuts entirely.
     * Provide an object with undo/redo handlers to override default behavior.
     * @default undefined (uses default keyboard shortcuts)
     */
    keyboardShortcuts?: HistoryKeyboardShortcuts | false;
};
export type UISettings = {
    linkPanel?: LinkPanelSettings;
    disableRightClick?: boolean;
    disableDownload?: boolean;
};
export interface RicosNodesViewRendererProps {
    nodes: Node[];
    forwardRef?: Ref<HTMLDivElement>;
    isRoot?: boolean;
    addAnchorsPrefix?: string;
    shouldParagraphApplyTextStyle?: boolean;
}
export type RicosNodesViewRenderer = FC<RicosNodesViewRendererProps>;
export type CustomClassNames = {
    alignment?: string;
    size?: string;
    textWrap?: string;
};
type NodeViewContainerProps = {
    node: Node;
    nodeIndex: number;
    customClassNames?: CustomClassNames;
    withHorizontalScroll?: boolean;
};
export type NodeViewContainer = FC<NodeViewContainerProps & {
    children: ReactNode | ((args: {
        ContainerElement: FC<PropsWithChildren>;
        SpoilerWrapper: FC<PropsWithChildren>;
        LinkWrapper: FC<PropsWithChildren>;
    }) => ReactNode);
}>;
export type NodeViewRendererProps = {
    node: Node;
    nodeIndex: number;
    RicosNodesRenderer: RicosNodesViewRenderer;
    NodeViewContainer: NodeViewContainer;
    isRoot?: boolean;
    shouldParagraphApplyTextStyle?: boolean;
    SpoilerViewerWrapper?: ComponentType<{
        className: unknown;
        width?: number;
    }>;
};
export type NodeViewRenderer = (props: NodeViewRendererProps) => JSX.Element;
export type NodeViewRenderers = Partial<Record<Node_Type, NodeViewRenderer>>;
export type Rule = (node: Node) => boolean;
type DecorateArgs<T> = {
    node: Node;
    context: ViewerContextualData;
    element?: T;
    isRoot: boolean;
};
export type Decorate<T> = (args: DecorateArgs<T>) => T;
export type NodeViewDecorator<T> = {
    rule: Rule;
    decorate: Decorate<T>;
    isText?: boolean;
    priority?: number;
};
export declare const quickActionsModalSections: {
    readonly ultra: 'ultra';
    readonly CommonlyUsed: 'QuickActionsPlugin_SectionTitle_CommonlyUsed';
    readonly AI: 'QuickActionsPlugin_SectionTitle_AI';
    readonly FormatLayout: 'QuickActionsPlugin_SectionTitle_FormatLayout';
    readonly Media: 'QuickActionsPlugin_SectionTitle_Media';
    readonly Embed: 'QuickActionsPlugin_SectionTitle_Embed';
    readonly EmbedWix: 'QuickActionsPlugin_SectionTitle_EmbedFromWIX';
};
export type QuickActionsModalSection = (typeof quickActionsModalSections)[keyof typeof quickActionsModalSections];
//# sourceMappingURL=plugin-types.d.ts.map