import ToastEventBus from 'openvue/toasteventbus';
import { PrimeVueToastSymbol } from 'openvue/usetoast';

var messageIdx = 0;
var ToastService = {
  install: function install(app) {
    var ToastService = {
      add: function add(message) {
        if (message.id == null) {
          message.id = messageIdx++;
        }
        ToastEventBus.emit('add', message);
        return message.id;
      },
      remove: function remove(message) {
        ToastEventBus.emit('remove', message);
      },
      removeGroup: function removeGroup(group) {
        ToastEventBus.emit('remove-group', group);
      },
      removeAllGroups: function removeAllGroups() {
        ToastEventBus.emit('remove-all-groups');
      }
    };
    app.config.globalProperties.$toast = ToastService;
    app.provide(PrimeVueToastSymbol, ToastService);
  }
};

export { ToastService as default };
//# sourceMappingURL=index.mjs.map
