import React, { useContext } from "react";
import { actions } from "../../../platform/services/window/modules/actions";
import { WindowNameContext } from "./WindowTitleBarContext";
import { useDispatch, useSelector } from "react-redux";
export const CloneButton = () => {
    var _a;
    const dispatch = useDispatch();
    const state = useSelector((currentState) => currentState);
    const windowName = useContext(WindowNameContext);
    const showCloneButton = !!(windowName ? (_a = state.windows[windowName]) === null || _a === void 0 ? void 0 : _a.showCloneButton : true);
    if (!showCloneButton) {
        return React.createElement(React.Fragment, null);
    }
    const cloneThisWindow = () => {
        var _a;
        dispatch(actions.clone({
            targetWindowName: (_a = window.name) !== null && _a !== void 0 ? _a : "",
        }));
    };
    return (React.createElement("div", { onClick: cloneThisWindow, className: "fsbl-icon fsbl-clone", title: "Clone", id: "fsbl-window-clone" },
        React.createElement("i", { className: "ff-copy" })));
};
//# sourceMappingURL=CloneButton.js.map