/**
 * Canonical shortcut definitions for the workflow canvas editor.
 *
 * Single source of truth for all keyboard shortcuts — consumed by
 * {@link useCanvasKeyboardShortcuts} (matching), {@link CanvasContextMenu}
 * (hint labels), {@link NodeActions} (toolbar tooltips), and any future
 * help dialog or documentation generator.
 *
 * Pure TypeScript — no React dependency. Safe to import from any layer.
 *
 * @since T11 (Context Menus and Keyboard Shortcuts)
 */
// ---------------------------------------------------------------------------
// Platform detection
// ---------------------------------------------------------------------------
const IS_MAC = typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/.test(navigator.platform);
// ---------------------------------------------------------------------------
// Hint formatting
// ---------------------------------------------------------------------------
function formatHint(keys) {
    if (IS_MAC) {
        return keys
            .replace(/Mod\+/g, "\u2318")
            .replace(/Shift\+/g, "\u21E7")
            .replace(/Alt\+/g, "\u2325")
            .replace(/Backspace/g, "\u232B")
            .replace(/Delete/g, "\u232B");
    }
    return keys
        .replace(/Mod\+/g, "Ctrl+")
        .replace(/Backspace/g, "Del")
        .replace(/Delete/g, "Del");
}
// ---------------------------------------------------------------------------
// Shortcut definitions
// ---------------------------------------------------------------------------
function def(id, label, keys, scope, requiresDesignMode) {
    return { id, label, keys, hint: formatHint(keys), scope, requiresDesignMode };
}
const DEFINITIONS = [
    // Single-node actions
    def("duplicate", "Duplicate", "Mod+D", "node", true),
    def("copy", "Copy", "Mod+C", "selection", true),
    def("cut", "Cut", "Mod+X", "selection", true),
    def("paste", "Paste", "Mod+V", "canvas", true),
    def("delete", "Delete", "Backspace", "selection", true),
    def("addTaskAfter", "Add task after\u2026", "N", "node", true),
    // Canvas-wide actions
    def("selectAll", "Select all", "Mod+A", "canvas", true),
    def("undo", "Undo", "Mod+Z", "canvas", true),
    def("redo", "Redo", "Mod+Shift+Z", "canvas", true),
    def("escape", "Deselect", "Escape", "canvas", false),
];
// ---------------------------------------------------------------------------
// Registry lookup
// ---------------------------------------------------------------------------
const BY_ID = new Map(DEFINITIONS.map((d) => [d.id, d]));
/** All registered shortcut definitions. */
export function getAllShortcuts() {
    return DEFINITIONS;
}
/**
 * Look up a shortcut by its stable identifier.
 *
 * Returns `undefined` if the id is not registered — callers should
 * treat this as a programming error (missing registry entry).
 */
export function getShortcut(id) {
    return BY_ID.get(id);
}
/**
 * Get the display hint for a shortcut, or an empty string if not found.
 *
 * Convenience wrapper for context menu and toolbar hint labels.
 */
export function getShortcutHint(id) {
    return BY_ID.get(id)?.hint ?? "";
}
/** Whether the runtime platform is macOS / iOS. */
export function isMacPlatform() {
    return IS_MAC;
}
//# sourceMappingURL=shortcut-registry.js.map