function getBridgeKeyboardKey(interaction) {
    if (interaction.key)
        return interaction.key;
    if (interaction.code === "KeyZ")
        return interaction.shiftKey ? "Z" : "z";
    if (interaction.code === "KeyY")
        return interaction.shiftKey ? "Y" : "y";
    return "";
}
export function isBridgeUndoRedoKeyboardShortcut(interaction) {
    if (interaction.kind !== "keydown")
        return false;
    if (!interaction.ctrlKey && !interaction.metaKey)
        return false;
    if (interaction.altKey)
        return false;
    const key = getBridgeKeyboardKey(interaction).toLowerCase();
    if (key === "z")
        return true;
    return key === "y" && !interaction.shiftKey;
}
export function createKeyboardEventFromBridgeInteraction(interaction) {
    if (!isBridgeUndoRedoKeyboardShortcut(interaction))
        return undefined;
    return new KeyboardEvent("keydown", {
        bubbles: true,
        cancelable: true,
        key: getBridgeKeyboardKey(interaction),
        code: interaction.code ?? "",
        ctrlKey: !!interaction.ctrlKey,
        shiftKey: !!interaction.shiftKey,
        altKey: !!interaction.altKey,
        metaKey: !!interaction.metaKey,
    });
}
//# sourceMappingURL=bridgeKeyboardShortcuts.js.map