You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
1.1 KiB

import{m as v,u as O}from"./mount-component-62c39ff8.js";import{s as g}from"./Toast-3c5f40d9.js";import{e as n,i as y,a as h}from"./index-f3701452.js";import{r as w,O as C,D as b,b as x,aP as M}from"./index-f4658ae7.js";const P={icon:"",type:"text",message:"",className:"",overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:"body",iconSize:void 0,iconPrefix:void 0,position:"middle",transition:"van-fade",forbidClick:!1,loadingType:void 0,overlayClass:"",overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1};let o=[],S=!1,i=n({},P);const T=new Map;function c(e){return h(e)?e:{message:e}}function k(){const{instance:e,unmount:t}=v({setup(){const s=w(""),{open:u,state:a,close:p,toggle:d}=O(),f=()=>{},m=()=>x(g,M(a,{onClosed:f,"onUpdate:show":d}),null);return C(s,r=>{a.message=r}),b().render=m,{open:u,close:p,message:s}}});return e}function I(){if(!o.length||S){const e=k();o.push(e)}return o[o.length-1]}function N(e={}){if(!y)return{};const t=I(),s=c(e);return t.open(n({},i,T.get(s.type||i.type),s)),t}const l=e=>t=>N(n({type:e},c(t))),D=l("success"),F=l("fail");export{N as a,D as b,F as s};