import { createVNode as _createVNode, mergeProps as _mergeProps, Fragment as _Fragment } from "vue";
import "./styles/notification-provider.css";
import { useRender } from "@veno-ui/utils";
import { defineComponent } from "../../utils";
import { Overlay } from "../overlay";
import { Alert } from "../alert";
import { filterAlertProps } from "../alert/alert";
import { NotificationKey, notification, provideNotification, useNotification } from "../../composables/message";
import { SlideRightFadeInExpandTransition } from "../transition";
const NotificationProvider = defineComponent({
  name: "VeNotificationProvider",
  register(app) {
    app.provide(NotificationKey, notification);
  },
  props: {
    registered: Boolean
  },
  setup(props, {
    slots
  }) {
    const notification2 = props.registered ? useNotification() : provideNotification();
    const {
      items,
      remove
    } = notification2;
    useRender(() => {
      return _createVNode(_Fragment, null, [slots.default?.(), _createVNode(Overlay, {
        "modelValue": items.value.length > 0,
        "scrim": false,
        "scrollStrategy": "none",
        "class": "ve-notification-provider"
      }, {
        ...slots,
        default: () => _createVNode("ul", null, [items.value.map((item) => {
          const [alertProps] = filterAlertProps(item);
          return _createVNode(Alert, _mergeProps({
            "key": item.id,
            "tag": "li",
            "appear": true,
            "modelValue": item.modelValue,
            "onUpdate:modelValue": ($event) => item.modelValue = $event,
            "on-after-leave": () => remove(item.id),
            "min-width": "300",
            "transition": {
              component: SlideRightFadeInExpandTransition
            }
          }, alertProps), null);
        })])
      })]);
    });
    return notification2;
  }
});
export {
  NotificationProvider
};
//# sourceMappingURL=notification-provider.mjs.map
