/*! UIkit 3.20.4-dev.c54f44b4f | https://www.getuikit.com | (c) 2014 - 2024 YOOtheme | MIT License */import{$ as n,append as a,toFloat as m,css as r,Transition as c,pointerEnter as u,pointerLeave as p,parent as f,trigger as d,remove as h,apply as $}from"uikit-util";var g={props:{container:Boolean},data:{container:!0},computed:{container({container:t}){return t===!0&&this.$container||t&&n(t)}}},l={mixins:[g],functional:!0,args:["message","status"],data:{message:"",status:"",timeout:5e3,group:"",pos:"top-center",clsContainer:"uk-notification",clsClose:"uk-notification-close",clsMsg:"uk-notification-message"},install:v,computed:{marginProp:({pos:t})=>`margin-${t.match(/[a-z]+(?=-)/)[0]}`,startProps(){return{opacity:0,[this.marginProp]:-this.$el.offsetHeight}}},created(){const t=`${this.clsContainer}-${this.pos}`,i=`data-${this.clsContainer}-container`,s=n(`.${t}[${i}]`,this.container)||a(this.container,`<div class="${this.clsContainer} ${t}" ${i}></div>`);this.$mount(a(s,`<div class="${this.clsMsg}${this.status?` ${this.clsMsg}-${this.status}`:""}" role="alert"> <a href class="${this.clsClose}" data-uk-close></a> <div>${this.message}</div> </div>`))},async connected(){const t=m(r(this.$el,this.marginProp));await c.start(r(this.$el,this.startProps),{opacity:1,[this.marginProp]:t}),this.timeout&&(this.timer=setTimeout(this.close,this.timeout))},events:{click(t){t.target.closest('a[href="#"],a[href=""]')&&t.preventDefault(),this.close()},[u](){this.timer&&clearTimeout(this.timer)},[p](){this.timeout&&(this.timer=setTimeout(this.close,this.timeout))}},methods:{async close(t){const i=s=>{const e=f(s);d(s,"close",[this]),h(s),e!=null&&e.hasChildNodes()||h(e)};this.timer&&clearTimeout(this.timer),t||await c.start(this.$el,this.startProps),i(this.$el)}}};function v(t){t.notification.closeAll=function(i,s){$(document.body,e=>{const o=t.getComponent(e,"notification");o&&(!i||i===o.group)&&o.close(s)})}}typeof window<"u"&&window.UIkit&&window.UIkit.component("notification",l);export{l as default};
