"use client";
import { __awaiter } from '../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs';
import { jsxs, jsx } from 'react/jsx-runtime';
import { useState } from 'react';

function FooterEmail({ email, clickToCopyText, copiedText, children }) {
    const [copied, setCopied] = useState(false);
    const displayTitle = clickToCopyText || 'Click to copy';
    const displayCopied = copiedText || 'Copied!';
    const handleCopy = (e) => __awaiter(this, void 0, void 0, function* () {
        // Prevent default to allow long press on mobile
        e.preventDefault();
        if (!navigator.clipboard)
            return;
        try {
            yield navigator.clipboard.writeText(email);
            setCopied(true);
            setTimeout(() => setCopied(false), 2000);
        }
        catch (_a) {
            // silent fail
        }
    });
    return (jsxs("div", { className: "relative group", children: [jsx("div", { className: "absolute right-0 sm:right-auto sm:left-2/3 sm:-translate-x-1/4 bottom-full pb-1 hidden group-hover:block z-10", children: jsx("div", { className: "bg-zinc-600 text-white text-xs rounded px-3 py-1 whitespace-nowrap shadow-lg cursor-pointer select-text", onMouseDown: handleCopy, title: displayTitle, children: copied ? displayCopied : email }) }), jsx("a", { href: `mailto:${email}`, className: "flex items-center space-x-1 underline cursor-pointer px-2", children: children })] }));
}

export { FooterEmail };
