"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.imagePopupItemView = exports.imageItemView = exports.codeItemMarkup = exports.codeItemWysiwyg = exports.codeItemView = exports.tableItemMarkup = exports.tableItemWysiwyg = exports.tableItemView = exports.noteItemMarkup = exports.noteItemWysiwyg = exports.noteItemView = exports.cutItemMarkup = exports.cutItemWysiwyg = exports.cutItemView = exports.quoteLinkItemMarkup = exports.quoteLinkItemWysiwyg = exports.quoteLinkItemView = exports.quoteItemMarkup = exports.quoteItemWysiwyg = exports.quoteItemView = exports.linkItemMarkup = exports.linkItemWysiwyg = exports.linkItemView = exports.checkboxItemMarkup = exports.checkboxItemWysiwyg = exports.checkboxItemView = exports.markedItemMarkup = exports.markedItemWysiwyg = exports.markedItemView = exports.monospaceItemMarkup = exports.monospaceItemWysiwyg = exports.monospaceItemView = exports.strikethroughItemMarkup = exports.strikethroughItemWysiwyg = exports.strikethroughItemView = exports.underlineItemMarkup = exports.underlineItemWysiwyg = exports.underlineItemView = exports.italicItemMarkup = exports.italicItemWysiwyg = exports.italicItemView = exports.boldItemMarkup = exports.boldItemWysiwyg = exports.boldItemView = exports.redoItemMarkup = exports.redoItemWysiwyg = exports.redoItemView = exports.undoItemMarkup = exports.undoItemWysiwyg = exports.undoItemView = void 0;
exports.bulletListItemWysiwyg = exports.bulletListItemView = exports.heading6ItemMarkup = exports.heading6ItemWysiwyg = exports.heading6ItemView = exports.heading5ItemMarkup = exports.heading5ItemWysiwyg = exports.heading5ItemView = exports.heading4ItemMarkup = exports.heading4ItemWysiwyg = exports.heading4ItemView = exports.heading3ItemMarkup = exports.heading3ItemWysiwyg = exports.heading3ItemView = exports.heading2ItemMarkup = exports.heading2ItemWysiwyg = exports.heading2ItemView = exports.heading1ItemMarkup = exports.heading1ItemWysiwyg = exports.heading1ItemView = exports.emojiItemMarkup = exports.emojiItemWysiwyg = exports.emojiItemView = exports.hruleItemMarkup = exports.hruleItemWysiwyg = exports.hruleItemView = exports.codeBlockItemMarkup = exports.codeBlockItemWysiwyg = exports.codeBlockItemView = exports.mermaidItemMarkup = exports.mermaidItemWysiwyg = exports.mermaidItemView = exports.yfmHtmlBlockItemMarkup = exports.yfmHtmlBlockItemWysiwyg = exports.yfmHtmlBlockItemView = exports.mathBlockItemMarkup = exports.mathBlockItemWysiwyg = exports.mathBlockItemView = exports.mathInlineItemMarkup = exports.mathInlineItemWysiwyg = exports.mathInlineItemView = exports.tabsItemMarkup = exports.tabsItemWysiwyg = exports.tabsItemView = exports.fileItemMarkup = exports.fileItemWysiwyg = exports.filePopupItemView = exports.fileItemView = exports.imageItemMarkup = exports.imageItemWysiwyg = void 0;
exports.mathListItemView = exports.codeBlocksListItemView = exports.moveListItemView = exports.listsListItemView = exports.headingListItemView = exports.gptItemMarkup = exports.gptItemWysiwyg = exports.gptItemView = exports.colorifyItemMarkup = exports.colorifyItemWysiwyg = exports.colorifyItemView = exports.paragraphItemMarkup = exports.paragraphItemWisywig = exports.paragraphItemView = exports.textContextItemWisywig = exports.textContextItemView = exports.toggleHeadingFoldingItemWysiwyg = exports.toggleHeadingFoldingItemView = exports.liftListItemMarkup = exports.liftListItemWysiwyg = exports.liftListItemView = exports.sinkListItemMarkup = exports.sinkListItemWysiwyg = exports.sinkListItemView = exports.orderedListItemMarkup = exports.orderedListItemWysiwyg = exports.orderedListItemView = exports.bulletListItemMarkup = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const icons_1 = require("../../bundle/config/icons.js");
const HeadingPreview_1 = require("../../bundle/config/previews/HeadingPreview.js");
const TextPreview_1 = require("../../bundle/config/previews/TextPreview.js");
const MToolbarColors_1 = require("../../bundle/toolbar/markup/MToolbarColors.js");
const MToolbarFilePopup_1 = require("../../bundle/toolbar/markup/MToolbarFilePopup.js");
const MToolbarImagePopup_1 = require("../../bundle/toolbar/markup/MToolbarImagePopup.js");
const WToolbarColors_1 = require("../../bundle/toolbar/wysiwyg/WToolbarColors.js");
const WToolbarTextSelect_1 = require("../../bundle/toolbar/wysiwyg/WToolbarTextSelect.js");
const constants_1 = require("../../extensions/additional/GPT/constants.js");
const specs_1 = require("../../extensions/specs.js");
const hints_1 = require("../../i18n/hints/index.js");
const menubar_1 = require("../../i18n/menubar/index.js");
const commands_1 = require("../../markup/commands/index.js");
const shortcuts_1 = require("../../shortcuts/index.js");
const toolbar_1 = require("../../toolbar/index.js");
const noop = () => { };
const inactive = () => false;
const enable = () => true;
const disable = () => false;
// ---- Undo ----
exports.undoItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'undo'),
    icon: icons_1.icons.undo,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Undo),
};
exports.undoItemWysiwyg = {
    hintWhenDisabled: false,
    exec: (e) => e.actions.undo.run(),
    isActive: (e) => e.actions.undo.isActive(),
    isEnable: (e) => e.actions.undo.isEnable(),
};
exports.undoItemMarkup = {
    hintWhenDisabled: false,
    exec: (e) => (0, commands_1.undo)(e.cm),
    isActive: inactive,
    isEnable: (e) => (0, commands_1.undoDepth)(e.cm.state) > 0,
};
// ---- Redo ----
exports.redoItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'redo'),
    icon: icons_1.icons.redo,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Redo),
};
exports.redoItemWysiwyg = {
    hintWhenDisabled: false,
    exec: (e) => e.actions.redo.run(),
    isActive: (e) => e.actions.redo.isActive(),
    isEnable: (e) => e.actions.redo.isEnable(),
};
exports.redoItemMarkup = {
    hintWhenDisabled: false,
    exec: (e) => (0, commands_1.redo)(e.cm),
    isActive: inactive,
    isEnable: (e) => (0, commands_1.redoDepth)(e.cm.state) > 0,
};
// ---- Bold ----
exports.boldItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'bold'),
    icon: icons_1.icons.bold,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Bold),
};
exports.boldItemWysiwyg = {
    exec: (e) => e.actions.bold.run(),
    isActive: (e) => e.actions.bold.isActive(),
    isEnable: (e) => e.actions.bold.isEnable(),
};
exports.boldItemMarkup = {
    exec: (e) => (0, commands_1.toggleBold)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Italic ----
exports.italicItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'italic'),
    icon: icons_1.icons.italic,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Italic),
};
exports.italicItemWysiwyg = {
    exec: (e) => e.actions.italic.run(),
    isActive: (e) => e.actions.italic.isActive(),
    isEnable: (e) => e.actions.italic.isEnable(),
};
exports.italicItemMarkup = {
    exec: (e) => (0, commands_1.toggleItalic)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Underline ----
exports.underlineItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'underline'),
    icon: icons_1.icons.underline,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Underline),
};
exports.underlineItemWysiwyg = {
    exec: (e) => e.actions.underline.run(),
    isActive: (e) => e.actions.underline.isActive(),
    isEnable: (e) => e.actions.underline.isEnable(),
};
exports.underlineItemMarkup = {
    exec: (e) => (0, commands_1.toggleUnderline)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Strikethrough ----
exports.strikethroughItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'strike'),
    icon: icons_1.icons.strikethrough,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Strike),
};
exports.strikethroughItemWysiwyg = {
    exec: (e) => e.actions.strike.run(),
    isActive: (e) => e.actions.strike.isActive(),
    isEnable: (e) => e.actions.strike.isEnable(),
};
exports.strikethroughItemMarkup = {
    exec: (e) => (0, commands_1.toggleStrikethrough)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Monospace ----
exports.monospaceItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'mono'),
    icon: icons_1.icons.mono,
};
exports.monospaceItemWysiwyg = {
    exec: (e) => e.actions.mono.run(),
    isActive: (e) => e.actions.mono.isActive(),
    isEnable: (e) => e.actions.mono.isEnable(),
};
exports.monospaceItemMarkup = {
    exec: (e) => (0, commands_1.toggleMonospace)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Marked ----
exports.markedItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'mark'),
    icon: icons_1.icons.mark,
};
exports.markedItemWysiwyg = {
    exec: (e) => e.actions.mark.run(),
    isActive: (e) => e.actions.mark.isActive(),
    isEnable: (e) => e.actions.mark.isEnable(),
};
exports.markedItemMarkup = {
    exec: (e) => (0, commands_1.toggleMarked)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Checkbox ----
exports.checkboxItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'checkbox'),
    icon: icons_1.icons.checklist,
};
exports.checkboxItemWysiwyg = {
    exec: (e) => e.actions.addCheckbox.run(),
    isActive: (e) => e.actions.addCheckbox.isActive(),
    isEnable: (e) => e.actions.addCheckbox.isEnable(),
};
exports.checkboxItemMarkup = {
    exec: (e) => (0, commands_1.wrapToCheckbox)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Link ----
exports.linkItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'link'),
    icon: icons_1.icons.link,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Link),
};
exports.linkItemWysiwyg = {
    exec: (e) => e.actions.addLink.run(),
    isActive: (e) => e.actions.addLink.isActive(),
    isEnable: (e) => e.actions.addLink.isEnable(),
};
exports.linkItemMarkup = {
    exec: (e) => (0, commands_1.insertLink)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Quote ----
exports.quoteItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'quote'),
    icon: icons_1.icons.quote,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Quote),
};
exports.quoteItemWysiwyg = {
    exec: (e) => e.actions.quote.run(),
    isActive: (e) => e.actions.quote.isActive(),
    isEnable: (e) => e.actions.quote.isEnable(),
};
exports.quoteItemMarkup = {
    exec: (e) => (0, commands_1.wrapToBlockquote)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Quote Link ----
exports.quoteLinkItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'quotelink'),
    icon: icons_1.icons.quoteLink,
};
exports.quoteLinkItemWysiwyg = {
    exec: (e) => {
        e.actions.quoteLink.run();
        e.actions.addLinkToQuoteLink.run();
    },
    isActive: (e) => e.actions.quoteLink.isActive(),
    isEnable: (e) => e.actions.quoteLink.isEnable(),
};
exports.quoteLinkItemMarkup = {
    exec: (e) => (0, commands_1.insertBlockquoteLink)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Cut ----
exports.cutItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'cut'),
    icon: icons_1.icons.cut,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Cut),
};
exports.cutItemWysiwyg = {
    exec: (e) => e.actions.toYfmCut.run(),
    isActive: (e) => e.actions.toYfmCut.isActive(),
    isEnable: (e) => e.actions.toYfmCut.isEnable(),
};
exports.cutItemMarkup = {
    exec: (e) => (0, commands_1.wrapToYfmCut)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Note ----
exports.noteItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'note'),
    icon: icons_1.icons.note,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Note),
};
exports.noteItemWysiwyg = {
    exec: (e) => e.actions.toYfmNote.run(),
    isActive: (e) => e.actions.toYfmNote.isActive(),
    isEnable: (e) => e.actions.toYfmNote.isEnable(),
};
exports.noteItemMarkup = {
    exec: (e) => (0, commands_1.wrapToYfmNote)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Table ----
exports.tableItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'table'),
    icon: icons_1.icons.table,
};
exports.tableItemWysiwyg = {
    exec: (e) => e.actions.createYfmTable.run(),
    isActive: (e) => e.actions.createYfmTable.isActive(),
    isEnable: (e) => e.actions.createYfmTable.isEnable(),
};
exports.tableItemMarkup = {
    exec: (e) => (0, commands_1.insertYfmTable)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Code ----
exports.codeItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'code_inline'),
    icon: icons_1.icons.code,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Code),
};
exports.codeItemWysiwyg = {
    exec: (e) => e.actions.code.run(),
    isActive: (e) => e.actions.code.isActive(),
    isEnable: (e) => e.actions.code.isEnable(),
};
exports.codeItemMarkup = {
    exec: (e) => (0, commands_1.wrapToInlineCode)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Image ----
exports.imageItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'image'),
    icon: icons_1.icons.image,
};
exports.imagePopupItemView = {
    type: toolbar_1.ToolbarDataType.ButtonPopup,
    title: menubar_1.i18n.bind(null, 'image'),
    icon: icons_1.icons.image,
};
exports.imageItemWysiwyg = {
    exec: (e) => e.actions.addImageWidget.run(),
    isActive: (e) => e.actions.addImageWidget.isActive(),
    isEnable: (e) => e.actions.addImageWidget.isEnable(),
};
exports.imageItemMarkup = {
    exec: noop,
    isActive: inactive,
    isEnable: enable,
    renderPopup: (props) => (0, jsx_runtime_1.jsx)(MToolbarImagePopup_1.MToolbarImagePopup, { ...props }),
};
// ---- File ----
exports.fileItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'file'),
    icon: icons_1.icons.file,
};
exports.filePopupItemView = {
    type: toolbar_1.ToolbarDataType.ButtonPopup,
    title: menubar_1.i18n.bind(null, 'file'),
    icon: icons_1.icons.file,
};
exports.fileItemWysiwyg = {
    exec: (e) => e.actions.addFile.run(),
    isActive: (e) => e.actions.addFile.isActive(),
    isEnable: (e) => e.actions.addFile.isEnable(),
};
exports.fileItemMarkup = {
    exec: noop,
    isActive: inactive,
    isEnable: enable,
    renderPopup: (props) => (0, jsx_runtime_1.jsx)(MToolbarFilePopup_1.MToolbarFilePopup, { ...props }),
};
// ---- Tabs ----
exports.tabsItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'tabs'),
    icon: icons_1.icons.tabs,
};
exports.tabsItemWysiwyg = {
    exec: (e) => e.actions.toYfmTabs.run(),
    isActive: (e) => e.actions.toYfmTabs.isActive(),
    isEnable: (e) => e.actions.toYfmTabs.isEnable(),
};
exports.tabsItemMarkup = {
    exec: (e) => (0, commands_1.insertYfmTabs)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Math Inline ----
exports.mathInlineItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'math_inline'),
    icon: icons_1.icons.functionInline,
    hint: () => `${hints_1.i18n.bind(null, 'math_hint')()} ${hints_1.i18n.bind(null, 'math_hint_katex')()}`,
};
exports.mathInlineItemWysiwyg = {
    exec: (e) => e.actions.addMathInline.run(),
    isActive: (e) => e.actions.addMathInline.isActive(),
    isEnable: (e) => e.actions.addMathInline.isEnable(),
};
exports.mathInlineItemMarkup = {
    exec: (e) => (0, commands_1.wrapToMathInline)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Math Block ----
exports.mathBlockItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'math_block'),
    icon: icons_1.icons.functionBlock,
    hint: () => `${hints_1.i18n.bind(null, 'math_hint')()} ${hints_1.i18n.bind(null, 'math_hint_katex')()}`,
};
exports.mathBlockItemWysiwyg = {
    exec: (e) => e.actions.toMathBlock.run(),
    isActive: (e) => e.actions.toMathBlock.isActive(),
    isEnable: (e) => e.actions.toMathBlock.isEnable(),
};
exports.mathBlockItemMarkup = {
    exec: (e) => (0, commands_1.wrapToMathBlock)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Yfm Html Block ----
exports.yfmHtmlBlockItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'html'),
    icon: icons_1.icons.html,
};
exports.yfmHtmlBlockItemWysiwyg = {
    exec: (e) => e.actions.createYfmHtmlBlock.run(),
    isActive: (e) => e.actions.createYfmHtmlBlock.isActive(),
    isEnable: (e) => e.actions.createYfmHtmlBlock.isEnable(),
};
exports.yfmHtmlBlockItemMarkup = {
    exec: (e) => (0, commands_1.insertYfmHtmlBlock)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Mermaid ----
exports.mermaidItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'mermaid'),
    icon: icons_1.icons.mermaid,
};
exports.mermaidItemWysiwyg = {
    exec: (e) => e.actions.createMermaid.run(),
    isActive: (e) => e.actions.createMermaid.isActive(),
    isEnable: (e) => e.actions.createMermaid.isEnable(),
};
exports.mermaidItemMarkup = {
    exec: (e) => (0, commands_1.insertMermaidDiagram)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Code Block ----
exports.codeBlockItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'codeblock'),
    icon: icons_1.icons.codeBlock,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.CodeBlock),
};
exports.codeBlockItemWysiwyg = {
    exec: (e) => e.actions.toCodeBlock.run(),
    isActive: (e) => e.actions.toCodeBlock.isActive(),
    isEnable: (e) => e.actions.toCodeBlock.isEnable(),
};
exports.codeBlockItemMarkup = {
    exec: (e) => (0, commands_1.wrapToCodeBlock)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Horizontal Rule ----
exports.hruleItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'hrule'),
    icon: icons_1.icons.horizontalRule,
};
exports.hruleItemWysiwyg = {
    exec: (e) => e.actions.hRule.run(),
    isActive: (e) => e.actions.hRule.isActive(),
    isEnable: (e) => e.actions.hRule.isEnable(),
};
exports.hruleItemMarkup = {
    exec: (e) => (0, commands_1.insertHRule)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Emoji ----
exports.emojiItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'emoji'),
    icon: icons_1.icons.emoji,
};
exports.emojiItemWysiwyg = {
    exec: (e) => e.actions.openEmojiSuggest.run({}),
    isActive: (e) => e.actions.openEmojiSuggest.isActive(),
    isEnable: (e) => e.actions.openEmojiSuggest.isEnable(),
};
exports.emojiItemMarkup = {
    exec: noop,
    hintWhenDisabled: menubar_1.i18n.bind(null, 'emoji__hint'),
    isActive: inactive,
    isEnable: disable,
};
// ---- Heading 1 ----
exports.heading1ItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'heading1'),
    icon: icons_1.icons.h1,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading1),
    preview: (0, jsx_runtime_1.jsx)(HeadingPreview_1.HeadingPreview, { level: 1 }),
};
exports.heading1ItemWysiwyg = {
    exec: (e) => e.actions.toH1.run(),
    isActive: (e) => e.actions.toH1.isActive(),
    isEnable: (e) => e.actions.toH1.isEnable(),
};
exports.heading1ItemMarkup = {
    exec: (e) => (0, commands_1.toH1)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Heading 2 ----
exports.heading2ItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'heading2'),
    icon: icons_1.icons.h2,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading2),
    preview: (0, jsx_runtime_1.jsx)(HeadingPreview_1.HeadingPreview, { level: 2 }),
};
exports.heading2ItemWysiwyg = {
    exec: (e) => e.actions.toH2.run(),
    isActive: (e) => e.actions.toH2.isActive(),
    isEnable: (e) => e.actions.toH2.isEnable(),
};
exports.heading2ItemMarkup = {
    exec: (e) => (0, commands_1.toH2)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Heading 3 ----
exports.heading3ItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'heading3'),
    icon: icons_1.icons.h3,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading3),
    preview: (0, jsx_runtime_1.jsx)(HeadingPreview_1.HeadingPreview, { level: 3 }),
};
exports.heading3ItemWysiwyg = {
    exec: (e) => e.actions.toH3.run(),
    isActive: (e) => e.actions.toH3.isActive(),
    isEnable: (e) => e.actions.toH3.isEnable(),
};
exports.heading3ItemMarkup = {
    exec: (e) => (0, commands_1.toH3)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Heading 4 ----
exports.heading4ItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'heading4'),
    icon: icons_1.icons.h4,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading4),
    preview: (0, jsx_runtime_1.jsx)(HeadingPreview_1.HeadingPreview, { level: 4 }),
};
exports.heading4ItemWysiwyg = {
    exec: (e) => e.actions.toH4.run(),
    isActive: (e) => e.actions.toH4.isActive(),
    isEnable: (e) => e.actions.toH4.isEnable(),
};
exports.heading4ItemMarkup = {
    exec: (e) => (0, commands_1.toH4)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Heading 5 ----
exports.heading5ItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'heading5'),
    icon: icons_1.icons.h5,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading5),
    preview: (0, jsx_runtime_1.jsx)(HeadingPreview_1.HeadingPreview, { level: 5 }),
};
exports.heading5ItemWysiwyg = {
    exec: (e) => e.actions.toH5.run(),
    isActive: (e) => e.actions.toH5.isActive(),
    isEnable: (e) => e.actions.toH5.isEnable(),
};
exports.heading5ItemMarkup = {
    exec: (e) => (0, commands_1.toH5)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Heading 6 ----
exports.heading6ItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'heading6'),
    icon: icons_1.icons.h6,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading6),
    preview: (0, jsx_runtime_1.jsx)(HeadingPreview_1.HeadingPreview, { level: 6 }),
};
exports.heading6ItemWysiwyg = {
    exec: (e) => e.actions.toH6.run(),
    isActive: (e) => e.actions.toH6.isActive(),
    isEnable: (e) => e.actions.toH6.isEnable(),
};
exports.heading6ItemMarkup = {
    exec: (e) => (0, commands_1.toH6)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Bullet List ----
exports.bulletListItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'ulist'),
    icon: icons_1.icons.bulletList,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.BulletList),
};
exports.bulletListItemWysiwyg = {
    exec: (e) => e.actions.toBulletList.run(),
    isActive: (e) => e.actions.toBulletList.isActive(),
    isEnable: (e) => e.actions.toBulletList.isEnable(),
};
exports.bulletListItemMarkup = {
    exec: (e) => (0, commands_1.toBulletList)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Ordered List ----
exports.orderedListItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'olist'),
    icon: icons_1.icons.orderedList,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.OrderedList),
};
exports.orderedListItemWysiwyg = {
    exec: (e) => e.actions.toOrderedList.run(),
    isActive: (e) => e.actions.toOrderedList.isActive(),
    isEnable: (e) => e.actions.toOrderedList.isEnable(),
};
exports.orderedListItemMarkup = {
    exec: (e) => (0, commands_1.toOrderedList)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Sink List ----
exports.sinkListItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'list__action_sink'),
    icon: icons_1.icons.sink,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.SinkListItem),
};
exports.sinkListItemWysiwyg = {
    exec: (e) => e.actions.sinkListItem.run(),
    hintWhenDisabled: () => (0, menubar_1.i18n)('list_action_disabled'),
    isActive: (e) => e.actions.sinkListItem.isActive(),
    isEnable: (e) => e.actions.sinkListItem.isEnable(),
};
exports.sinkListItemMarkup = {
    exec: (e) => (0, commands_1.sinkListItem)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Lift List ----
exports.liftListItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'list__action_lift'),
    icon: icons_1.icons.lift,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.LiftListItem),
};
exports.liftListItemWysiwyg = {
    exec: (e) => e.actions.liftListItem.run(),
    hintWhenDisabled: () => (0, menubar_1.i18n)('list_action_disabled'),
    isActive: (e) => e.actions.liftListItem.isActive(),
    isEnable: (e) => e.actions.liftListItem.isEnable(),
};
exports.liftListItemMarkup = {
    exec: (e) => (0, commands_1.liftListItem)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Toggle Heading Folding ----
exports.toggleHeadingFoldingItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    icon: icons_1.icons.foldingHeading,
    title: () => (0, menubar_1.i18n)('folding-heading'),
    hint: () => (0, menubar_1.i18n)('folding-heading__hint'),
};
exports.toggleHeadingFoldingItemWysiwyg = {
    isActive: (editor) => editor.actions.toggleHeadingFolding?.isActive() ?? false,
    isEnable: (editor) => editor.actions.toggleHeadingFolding?.isEnable() ?? false,
    exec: (editor) => editor.actions.toggleHeadingFolding.run(),
    condition: 'enabled',
};
// ---- Text Context ----
exports.textContextItemView = {
    type: toolbar_1.ToolbarDataType.ReactComponent,
};
exports.textContextItemWisywig = {
    component: WToolbarTextSelect_1.WToolbarTextSelect,
    width: 0,
    condition: ({ selection: { $from, $to }, schema }) => {
        if (!$from.sameParent($to))
            return false;
        const { parent } = $from;
        return parent.type === (0, specs_1.pType)(schema) || parent.type === (0, specs_1.headingType)(schema);
    },
};
// ---- Paragraph ----
exports.paragraphItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'text'),
    icon: icons_1.icons.text,
    hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Text),
    doNotActivateList: true,
    preview: (0, jsx_runtime_1.jsx)(TextPreview_1.TextPreview, {}),
};
exports.paragraphItemWisywig = {
    exec: (e) => e.actions.toParagraph.run(),
    isActive: (e) => e.actions.toParagraph.isActive(),
    isEnable: (e) => e.actions.toParagraph.isEnable(),
};
exports.paragraphItemMarkup = {
    exec: noop,
    isActive: inactive,
    isEnable: enable,
};
// --- Colorify ----
exports.colorifyItemView = {
    type: toolbar_1.ToolbarDataType.ReactComponent,
};
exports.colorifyItemWysiwyg = {
    component: WToolbarColors_1.WToolbarColors,
    width: 42,
};
exports.colorifyItemMarkup = {
    component: MToolbarColors_1.MToolbarColors,
    width: 42,
};
// ---- GPT ----
exports.gptItemView = {
    type: toolbar_1.ToolbarDataType.SingleButton,
    title: menubar_1.i18n.bind(null, 'gpt'),
    hotkey: constants_1.gptHotKeys.openGptKeyTooltip,
    icon: icons_1.icons.gpt,
};
exports.gptItemWysiwyg = {
    exec: (e) => e.actions.addGptWidget.run({}),
    isActive: (e) => e.actions.addGptWidget.isActive(),
    isEnable: (e) => e.actions.addGptWidget.isEnable(),
};
exports.gptItemMarkup = {
    exec: (e) => (0, commands_1.insertMermaidDiagram)(e.cm),
    isActive: inactive,
    isEnable: enable,
};
// ---- Heading list ----
exports.headingListItemView = {
    type: toolbar_1.ToolbarDataType.ListButton,
    icon: icons_1.icons.headline,
    title: menubar_1.i18n.bind(null, 'heading'),
    withArrow: true,
    replaceActiveIcon: true,
};
// ---- Lists list ----
exports.listsListItemView = {
    type: toolbar_1.ToolbarDataType.ListButton,
    icon: icons_1.icons.bulletList,
    withArrow: true,
    title: menubar_1.i18n.bind(null, 'list'),
};
// ---- Move list ----
exports.moveListItemView = {
    type: toolbar_1.ToolbarDataType.ListButton,
    icon: icons_1.icons.lift,
    withArrow: true,
    title: menubar_1.i18n.bind(null, 'move_list'),
};
// ---- Code list ----
exports.codeBlocksListItemView = {
    type: toolbar_1.ToolbarDataType.ListButton,
    icon: icons_1.icons.code,
    title: menubar_1.i18n.bind(null, 'code'),
    withArrow: true,
};
// ---- Math list ----
exports.mathListItemView = {
    type: toolbar_1.ToolbarDataType.ListButton,
    icon: icons_1.icons.functionInline,
    withArrow: true,
    title: menubar_1.i18n.bind(null, 'math'),
};
//# sourceMappingURL=items.js.map
