"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LayoutCloneButton = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
const AdaptableContext_1 = require("../AdaptableContext");
const isPivotLayout_1 = require("../../Utilities/isPivotLayout");
const LayoutCloneButton = ({ data, accessLevel }) => {
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const isDisabled = accessLevel === 'ReadOnly';
    const handleClick = React.useCallback(() => {
        adaptable.api.layoutApi.showLayoutEditor(data.Name, (0, isPivotLayout_1.isPivotLayout)(data) ? 'pivot' : 'table', 'Clone');
    }, []);
    return (React.createElement(SimpleButton_1.default, { onClick: handleClick, disabled: isDisabled, variant: "text", icon: "clone", tooltip: "Clone" }));
};
exports.LayoutCloneButton = LayoutCloneButton;
