const CLIPBOARD_KEY = "nextspark:block-clipboard";
function copyBlockToClipboard(block) {
  const data = {
    blockSlug: block.blockSlug,
    props: { ...block.props },
    copiedAt: Date.now()
  };
  localStorage.setItem(CLIPBOARD_KEY, JSON.stringify(data));
}
function getBlockFromClipboard() {
  const raw = localStorage.getItem(CLIPBOARD_KEY);
  if (!raw) return null;
  try {
    return JSON.parse(raw);
  } catch {
    return null;
  }
}
function hasBlockInClipboard() {
  return localStorage.getItem(CLIPBOARD_KEY) !== null;
}
function clearBlockClipboard() {
  localStorage.removeItem(CLIPBOARD_KEY);
}
export {
  clearBlockClipboard,
  copyBlockToClipboard,
  getBlockFromClipboard,
  hasBlockInClipboard
};
