import { Node_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
class ShortcutsSheet {
  constructor(shortcuts, context) {
    this.ordering = {
      ShortcutsSheet_Section_General: [
        "MoveSelectionThroughElements",
        "UNDO",
        "REDO",
        "OpenShortcutsSheet",
        "SelectAll",
        "SelectTextBlocks",
        "ClearSelection"
      ],
      ShortcutsSheet_Section_ToolbarNavigation: [
        "EnterToolbar",
        "MoveSelectionToNextOption",
        "MoveSelectionToPreviousOption",
        "ApplySelection",
        "ExitToolbar"
      ],
      ShortcutsSheet_Section_Formatting: [
        "PARAGRAPH",
        `${Node_Type.HEADING}.1`,
        `${Node_Type.HEADING}.2`,
        `${Node_Type.HEADING}.3`,
        `${Node_Type.HEADING}.4`,
        `${Node_Type.HEADING}.5`,
        `${Node_Type.HEADING}.6`,
        "FONT_SIZE.increase",
        "FONT_SIZE.decrease",
        "INDENT.increase",
        "INDENT.decrease",
        "TextAlignment.LEFT",
        "TextAlignment.RIGHT",
        "TextAlignment.CENTER",
        "TextAlignment.JUSTIFY",
        "BOLD",
        "ITALIC",
        "UNDERLINE",
        "STRIKETHROUGH",
        "SUBSCRIPT",
        "SUPERSCRIPT",
        "ORDERED_LIST",
        "BULLETED_LIST",
        "BLOCKQUOTE",
        "LINK",
        "CODE_BLOCK",
        "PasteWithoutFormatting",
        "NewLine",
        "SoftNewLine",
        "Enter"
      ],
      ShortcutsSheet_Section_Table: [
        ["MoveToNextCellTab", "MoveToNextCellArrow"],
        ["MoveToPreviousCellTab", "MoveToPreviousCellArrow"],
        "EnterExitCell",
        ["AddNewLineShift", "AddNewLineAlt"],
        "DropLineInList",
        "SelectContentInCell",
        "SelectColumn",
        "SelectRow",
        "SelectTable",
        "AddNewColumnRow",
        "DeleteColumnRow"
      ],
      ShortcutsSheet_Section_CollapsibleList: [
        ["MoveToNextElementTab", "MoveToNextElementEnter"],
        // TODO: add SelectAllContentWithinSection
        "SelectEntireList"
      ]
    };
    this.shortcuts = shortcuts;
    this.translator = context.t;
    this.platform = context.platform;
  }
  getSections() {
    const displayData = this.shortcuts.getDisplayData(this.translator, this.platform);
    let sections = [
      "ShortcutsSheet_Section_General",
      "ShortcutsSheet_Section_ToolbarNavigation",
      "ShortcutsSheet_Section_Formatting"
    ];
    if (displayData.ShortcutsSheet_Section_Table) {
      sections = sections.concat("ShortcutsSheet_Section_Table");
    }
    return sections;
  }
  getDisplayData() {
    return this.getSections().reduce((map, sectionId) => {
      const sectionShortcuts = this.ordering[sectionId].map((id) => {
        if (Array.isArray(id)) {
          const displayDataItems = id.map((id2) => this.shortcuts.getShortcutDisplayData(id2, this.translator, this.platform)).filter((item) => item.name !== "Empty");
          if (displayDataItems.length === 0) {
            return null;
          }
          return {
            ...displayDataItems[0],
            keyCombinationText: displayDataItems.map(
              ({ keyCombinationText }) => keyCombinationText
            )
          };
        }
        const displayData = this.shortcuts.getShortcutDisplayData(
          id,
          this.translator,
          this.platform
        );
        return displayData.name !== "Empty" ? displayData : null;
      }).filter((item) => item !== null);
      return {
        ...map,
        [sectionId]: sectionShortcuts
      };
    }, {});
  }
}
export {
  ShortcutsSheet
};
//# sourceMappingURL=shortcuts-sheet.js.map
