"use strict";const e=require("../../../../common/vendor.js"),a=require("../common/util.js"),l=require("./types.js"),t=require("../common/AbortablePromise.js"),u=e.defineComponent({name:"wd-transition",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"},props:l.transitionProps,emits:["click","before-enter","enter","before-leave","leave","after-leave","after-enter"],setup(l,{emit:u}){const v=e=>{let a=`${r.enterClass} ${r.enterActiveClass}`,l=`${r.enterToClass} ${r.enterActiveClass}`,t=`${r.leaveClass} ${r.leaveActiveClass}`,u=`${r.leaveToClass} ${r.leaveActiveClass}`;if(Array.isArray(e))for(let v=0;v<e.length;v++)a=`wd-${e[v]}-enter wd-${e[v]}-enter-active ${a}`,l=`wd-${e[v]}-enter-to wd-${e[v]}-enter-active ${l}`,t=`wd-${e[v]}-leave wd-${e[v]}-leave-active ${t}`,u=`wd-${e[v]}-leave-to wd-${e[v]}-leave-active ${u}`;else e&&(a=`wd-${e}-enter wd-${e}-enter-active ${a}`,l=`wd-${e}-enter-to wd-${e}-enter-active ${l}`,t=`wd-${e}-leave wd-${e}-leave-active ${t}`,u=`wd-${e}-leave-to wd-${e}-leave-active ${u}`);return{enter:a,"enter-to":l,leave:t,"leave-to":u}},r=l,n=u,o=e.ref(!1),s=e.ref(!1),i=e.ref(""),c=e.ref(!1),d=e.ref(300),$=e.ref(""),w=e.ref(null),f=e.ref(null),m=e.ref(null),b=e.computed((()=>`-webkit-transition-duration:${d.value}ms;transition-duration:${d.value}ms;${s.value||!r.destroy?"":"display: none;"}${r.customStyle}`)),p=e.computed((()=>`wd-transition ${r.customClass}  ${$.value}`)),h=e.computed((()=>!r.lazyRender||o.value));function y(){n("click")}function C(){w.value=new t.AbortablePromise((async e=>{try{const l=v(r.name),t=a.isObj(r.duration)?r.duration.enter:r.duration;i.value="enter",n("before-enter"),f.value=a.pause(),await f.value,n("enter"),$.value=l.enter,d.value=t,f.value=a.pause(),await f.value,o.value=!0,s.value=!0,f.value=a.pause(),await f.value,f.value=null,c.value=!1,$.value=l["enter-to"],e()}catch(l){}}))}function A(){c.value||(c.value=!0,"leave"===i.value?n("after-leave"):"enter"===i.value&&n("after-enter"),!r.show&&s.value&&(s.value=!1))}function T(){}return e.onBeforeMount((()=>{r.show&&C()})),e.watch((()=>r.show),(e=>{e?(a.isPromise(w.value)&&w.value.abort(),a.isPromise(f.value)&&f.value.abort(),a.isPromise(m.value)&&m.value.abort(),w.value=null,f.value=null,m.value=null,C()):async function(){if(!w.value)return c.value=!1,A();try{if(await w.value,!s.value)return;const e=v(r.name),l=a.isObj(r.duration)?r.duration.leave:r.duration;i.value="leave",n("before-leave"),d.value=l,m.value=a.pause(),await m.value,n("leave"),$.value=e.leave,m.value=a.pause(),await m.value,c.value=!1,$.value=e["leave-to"],m.value=function(e){return new t.AbortablePromise((a=>{const l=setTimeout((()=>{clearTimeout(l),a()}),e)}))}(d.value),await m.value,m.value=null,A(),w.value=null}catch(e){}}()}),{deep:!0}),(a,l)=>e.e({a:h.value&&a.disableTouchMove},h.value&&a.disableTouchMove?{b:e.n(p.value),c:e.s(b.value),d:e.o(A),e:e.o(y),f:e.o(T)}:h.value&&!a.disableTouchMove?{h:e.n(p.value),i:e.s(b.value),j:e.o(A),k:e.o(y)}:{},{g:h.value&&!a.disableTouchMove})}}),v=e._export_sfc(u,[["__scopeId","data-v-bf5ba1ab"]]);wx.createComponent(v);
