"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.toastEmitter = void 0;
/**
 * Tiny pub/sub used by `ToastContext` so non-React code can fire a
 * toast. Replaces an out-of-tree port artifact (`../../../../utils/...`).
 */

const listeners = new Set();
const toastEmitter = exports.toastEmitter = {
  subscribe(fn) {
    listeners.add(fn);
    return () => {
      listeners.delete(fn);
    };
  },
  emit(toast) {
    listeners.forEach(fn => {
      try {
        fn(toast);
      } catch {
        /* swallow */
      }
    });
  }
};
//# sourceMappingURL=toastEmitter.js.map