"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CodeTextWrappingToggleButton = CodeTextWrappingToggleButton;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const icons_1 = require("@gravity-ui/icons");
const uikit_1 = require("@gravity-ui/uikit");
const viewer_1 = require("../../../i18n/viewer/index.js");
function CodeTextWrappingToggleButton({ qa, style, className, codeElement, }) {
    const [hasWrapping, setHasWrapping] = (0, react_1.useState)(() => Boolean(codeElement.querySelector('pre code')?.classList?.contains('wrap')));
    return ((0, jsx_runtime_1.jsx)(uikit_1.ActionTooltip, { title: (0, viewer_1.i18n)('code_wrapping'), children: (0, jsx_runtime_1.jsx)(uikit_1.Button, { size: "m", view: "flat", selected: hasWrapping, style: style, "data-qa": qa, className: className, onClick: () => {
                const preCode = codeElement.querySelector('pre code');
                setHasWrapping(Boolean(preCode?.classList?.toggle('wrap')));
            }, children: (0, jsx_runtime_1.jsx)(uikit_1.Button.Icon, { children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ArrowUturnCwLeft }) }) }) }));
}
//# sourceMappingURL=TextWrappingButton.js.map
