1import{cP as $}from"./index-DhOIUQAt.js";import{r as k}from"./vue.runtime.esm-bundler-Bp9cVgqV.js";function H(m,d){for(var c=0;c<d.length;c++){const l=d[c];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in m)){const r=Object.getOwnPropertyDescriptor(l,u);r&&Object.defineProperty(m,u,r.get?r:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}))}var b={exports:{}};(function(m,d){(function(l,u){m.exports=u(k)})($,c=>(()=>{var l={113:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=(s,n)=>{const a=s.__vccOpts||s;for(const[p,g]of n)a[p]=g;return a}},594:e=>{e.exports=c}},u={};function r(e){var t=u[e];if(t!==void 0)return t.exports;var s=u[e]={exports:{}};return l[e](s,s.exports,r),s.exports}r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};r.r(f),r.d(f,{ToastComponent:()=>T,ToastPlugin:()=>O,ToastPositions:()=>o,default:()=>E,useToast:()=>_});var i=r(594);const y=["innerHTML"];function w(e,t,s,n,a,p){return(0,i.openBlock)(),(0,i.createBlock)(i.Transition,{"enter-active-class":e.transition.enter,"leave-active-class":e.transition.leave},{default:(0,i.withCtx)(()=>[(0,i.withDirectives)((0,i.createElementVNode)("div",{ref:"root",role:"alert",class:(0,i.normalizeClass)(["v-toast__item",[`v-toast__item--${e.type}`,`v-toast__item--${e.position}`]]),onMouseover:t[0]||(t[0]=g=>e.toggleTimer(!0)),onMouseleave:t[1]||(t[1]=g=>e.toggleTimer(!1)),onClick:t[2]||(t[2]=function(){return e.whenClicked&&e.whenClicked(...arguments)})},[t[3]||(t[3]=(0,i.createElementVNode)("div",{class:"v-toast__icon"},null,-1)),(0,i.createElementVNode)("p",{class:"v-toast__text",innerHTML:e.message},null,8,y)],34),[[i.vShow,e.isActive]])]),_:1},8,["enter-active-class","leave-active-class"])}function v(e){var t;typeof e.remove<"u"?e.remove():(t=e.parentNode)==null||t.removeChild(e)}function P(e,t,s){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const a=(0,i.h)(e,t,n),p=document.createElement("div");return p.classList.add("v-toast--pending"),s.appendChild(p),(0,i.render)(a,p),a.component}class B{constructor(t,s){this.startedAt=Date.now(),this.callback=t,this.delay=s,this.timer=setTimeout(t,s)}pause(){this.stop(),this.delay-=Date.now()-this.startedAt}resume(){this.stop(),this.startedAt=Date.now(),this.timer=setTimeout(this.callback,this.delay)}stop(){clearTimeout(this.timer)}}const o=Object.freeze({TOP_RIGHT:"top-right",TOP:"top",TOP_LEFT:"top-left",BOTTOM_RIGHT:"bottom-right",BOTTOM:"bottom",BOTTOM_LEFT:"bottom-left"});function j(e){return{all:e=e||new Map,on:function(t,s){var n=e.get(t);n?n.push(s):e.set(t,[s])},off:function(t,s){var n=e.get(t);n&&(s?n.splice(n.indexOf(s)>>>0,1):e.set(t,[]))},emit:function(t,s){var n=e.get(t);n&&n.slice().map(function(a){a(s)}),(n=e.get("*"))&&n.slice().map(function(a){a(t,s)})}}}const h=j(),M=(0,i.defineComponent)({name:"Toast",props:{message:{type:String,required:!0},type:{type:String,default:"success"},position:{type:String,default:o.BOTTOM_RIGHT,validator(e){return Object.values(o).includes(e)}},duration:{type:Number,default:3e3},dismissible:{type:Boolean,default:!0},onDismiss:{type:Function,default:()=>{}},onClick:{type:Function,default:()=>{}},queue:Boolean,pauseOnHover:{type:Boolean,default:!0}},data(){return{isActive:!1,parentTop:null,parentBottom:null,isHovered:!1}},beforeMount(){this.setupContainer()},mounted(){this.showNotice(),h.on("toast-clear",this.dismiss)},methods:{setupContainer(){if(this.parentTop=document.querySelector(".v-toast.v-toast--top"),this.parentBottom=document.querySelector(".v-toast.v-toast--bottom"),this.parentTop&&this.parentBottom)return;this.parentTop||(this.parentTop=document.createElement("div"),this.parentTop.className="v-toast v-toast--top"),this.parentBottom||(this.parentBottom=document.createElement("div"),this.parentBottom.className="v-toast v-toast--bottom");const e=document.body;e.appendChild(this.parentTop),e.appendChild(this.parentBottom)},shouldQueue(){return this.queue?this.parentTop.childElementCount>0||this.parentBottom.childElementCount>0:!1},dismiss(){this.timer&&this.timer.stop(),clearTimeout(this.queueTimer),this.isActive=!1,setTimeout(()=>{this.onDismiss.apply(null,arguments);const e=this.$refs.root;(0,i.render)(null,e),v(e)},150)},showNotice(){if(this.shouldQueue()){this.queueTimer=setTimeout(this.showNotice,250);return}const e=this.$refs.root.parentElement;this.correctParent.insertAdjacentElement("afterbegin",this.$refs.root),v(e),this.isActive=!0,this.duration&&(this.timer=new B(this.dismiss,this.duration))},whenClicked(){this.dismissible&&(this.onClick.apply(null,arguments),this.dismiss())},toggleTimer(e){!this.pauseOnHover||!this.timer||(e?this.timer.pause():this.timer.resume())}},computed:{correctParent(){switch(this.position){case o.TOP:case o.TOP_RIGHT:case o.TOP_LEFT:return this.parentTop;case o.BOTTOM:case o.BOTTOM_RIGHT:case o.BOTTOM_LEFT:return this.parentBottom}},transition(){switch(this.position){case o.TOP:case o.TOP_RIGHT:case o.TOP_LEFT:return{enter:"v-toast--fade-in-down",leave:"v-toast--fade-out"};case o.BOTTOM:case o.BOTTOM_RIGHT:case o.BOTTOM_LEFT:return{enter:"v-toast--fade-in-up",leave:"v-toast--fade-out"}}}},beforeUnmount(){h.off("toast-clear",this.dismiss)}});var C=r(113);const T=(0,C.default)(M,[["render",w]]),_=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{open(t){let s=null;typeof t=="string"&&(s=t);const a=Object.assign({},{message:s},e,t);return{dismiss:P(T,a,document.body).ctx.dismiss}},clear(){h.emit("toast-clear")},success(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.open(Object.assign({},{message:t,type:"success"},s))},error(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.open(Object.assign({},{message:t,type:"error"},s))},info(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.open(Object.assign({},{message:t,type:"info"},s))},warning(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.open(Object.assign({},{message:t,type:"warning"},s))},default(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.open(Object.assign({},{message:t,type:"default"},s))}}},O={install:function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=_(t);e.config.globalProperties.$toast=s,e.provide("$toast",s)}},E=O;return f})())})(b);var S=b.exports;const D=H({__proto__:null},[S]);
1export{S as d,D as i};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.