!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define("$toast",["vue"],t):"object"===typeof exports?exports.$toast=t(require("vue")):e.$toast=t(e.Vue)}("undefined"!==typeof self?self:this,(function(e){return function(){"use strict";var t={895:function(t){t.exports=e}},o={};function n(e){var s=o[e];if(void 0!==s)return s.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return function(){n.r(s),n.d(s,{default:function(){return M},install:function(){return v},useToast:function(){return g}});var e=n(895);var t="undefined"===typeof window?e.createSSRApp:e.createApp;const o=/(?:^\[object\s(.*?)\]$)/;var i=e=>Object.prototype.toString.call(e).replace(o,"$1").toLowerCase();function r(e){return document.getElementById(e)||function(e){const t=document.createElement("div");return t.id=e,document.body.appendChild(t),t}(e)}const u={id:"balmui-toast",timeoutMs:{MIN:2e3,MAX:3500,DEFAULTS:2750},position:{TOP:"top",BOTTOM:"bottom",CENTER:"center"}},c={className:"",timeoutMs:u.timeoutMs.DEFAULTS,message:"",position:u.position.BOTTOM};let a,p,d,m=c;const l='<div :class="className">\n  <div class="mdc-snackbar__surface">\n    <div class="mdc-snackbar__label" v-text="message"></div>\n  </div>\n</div>';function f(o){return r(u.id),t({name:"Toast",expose:["render"],setup(){const t=(0,e.reactive)({open:!1,opening:!0,opened:!1,options:o}),n=(0,e.computed)((()=>["top","center"].includes(t.options.position)?`mdc-toast--${t.options.position}`:"")),s=(0,e.computed)((()=>["mdc-snackbar","mdc-toast",n.value,t.options.className,{"mdc-snackbar--opening":t.opening,"mdc-snackbar--open":t.opened}])),i=(0,e.computed)((()=>t.options.message));function r(){t.open=!0,p=setTimeout((()=>{t.open=!1}),t.options.timeoutMs)}function c(e){if(!(e.timeoutMs<=u.timeoutMs.MAX&&e.timeoutMs>=u.timeoutMs.MIN))throw new Error(`[$toast]: The timeoutMs of the toast must be between ${u.timeoutMs.MIN} and ${u.timeoutMs.MAX}`);t.options=e,r()}return(0,e.watch)((()=>t.open),(e=>{e?setTimeout((()=>{t.opened=!0,setTimeout((()=>{t.opening=!1}),150)}),150):(t.opening=!0,t.opened=!1)})),(0,e.onMounted)((()=>c(o))),{className:s,message:i,render:c}},template:l})}function b(){const e=function(e,t){let o=Object.assign({},e);return"string"===i(t)?o.message=`${t}`:"object"===i(t)&&(o=Object.assign({},o,t)),o}(m,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});a?(clearTimeout(p),clearTimeout(d),a.render(e)):a=f(e).mount(`#${u.id}`)}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};m=Object.assign({},c,t),e.config.globalProperties.$toast=b,e.provide("toast",b)}const g=()=>b;var M={install:v}}(),s}()}));