"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toggleLineWrapping = exports.toggleLineNumbers = exports.isLineNumbersVisible = void 0;
const CodeBlockSpecs_1 = require("../../CodeBlockSpecs/index.js");
const codeBlockLineWrappingPlugin_1 = require("../plugins/codeBlockLineWrappingPlugin.js");
const utils_1 = require("../utils.js");
/** @internal */
var utils_2 = require("../utils.js");
Object.defineProperty(exports, "isLineNumbersVisible", { enumerable: true, get: function () { return utils_2.isLineNumbersVisible; } });
/** @internal */
const toggleLineNumbers = ({ node, pos, state, dispatch }) => {
    const showLineNumbers = (0, utils_1.isLineNumbersVisible)(node);
    dispatch(state.tr.setNodeAttribute(pos, CodeBlockSpecs_1.CodeBlockNodeAttr.ShowLineNumbers, showLineNumbers ? '' : 'true'));
};
exports.toggleLineNumbers = toggleLineNumbers;
/** @internal */
const toggleLineWrapping = ({ pos, state, dispatch }) => {
    const { tr } = state;
    const hasLineWrapping = (0, codeBlockLineWrappingPlugin_1.isNodeHasLineWrapping)(state, pos);
    if (hasLineWrapping)
        (0, codeBlockLineWrappingPlugin_1.disableLineWrapping)(tr, pos);
    else
        (0, codeBlockLineWrappingPlugin_1.enableLineWrapping)(tr, pos);
    dispatch(tr);
};
exports.toggleLineWrapping = toggleLineWrapping;
//# sourceMappingURL=utils.js.map
