"use client";

import { Toaster, type ToasterProps } from "sonner";

let notificationSound: HTMLAudioElement | null = null;

export function playNotificationSound() {
  if (typeof window === "undefined") return;

  if (!notificationSound) {
    notificationSound = new Audio("/dragon-studio-new-notification-3-398649.mp3");
  }

  notificationSound.currentTime = 0;
  notificationSound.play().catch(() => {});
}

export function ToasterWithSound(props: ToasterProps) {
  return <Toaster {...props} />;
}
