import CheckCircleOutlined from '../../../../../../node_modules/@mui/icons-material/esm/CheckCircleOutlined.mjs';
import FileCopyOutlined from '../../../../../../node_modules/@mui/icons-material/esm/FileCopyOutlined.mjs';
import wn from '../../../../../../node_modules/preact/compat/dist/compat.module.mjs';
import styled from '../../../../../../node_modules/@mui/material/styles/styled.mjs';
import { useState as h } from '../../../../../../node_modules/preact/hooks/dist/hooks.module.mjs';

const CheckCircle = styled(CheckCircleOutlined)({
    display: 'block !important'
});
const useClickToCopyCore = ({ iconSize = 'small', text })=>{
    const [copied, setCopied] = h(false);
    const copyToClipboard = (e)=>{
        e.stopPropagation();
        setCopied(true);
        navigator.clipboard.writeText(text);
        setTimeout(()=>setCopied(false), 1000);
    };
    const CopyIcon = copied ? /*#__PURE__*/ wn.createElement(CheckCircle, {
        fontSize: iconSize
    }) : /*#__PURE__*/ wn.createElement(FileCopyOutlined, {
        fontSize: iconSize
    });
    return {
        copied,
        copyToClipboard,
        CopyIcon
    };
};

export { useClickToCopyCore };
//# sourceMappingURL=clickToCopyUtils.mjs.map
