const e=require("../_util/collapseMotion.js"),t=require("./contextTypes.js"),n=require("./props.js"),r=require("./TreeNode.js");let i=require("vue");var a=(0,i.defineComponent)({compatConfig:{MODE:3},name:`MotionTreeNode`,inheritAttrs:!1,props:{...n.treeNodeProps,active:Boolean,motion:Object,motionNodes:{type:Array},onMotionStart:Function,onMotionEnd:Function,motionType:String},setup(n,{attrs:a,slots:o}){let s=(0,i.shallowRef)(!0),c=t.useInjectTreeContext(),l=(0,i.shallowRef)(!1),u=(0,i.computed)(()=>n.motion?n.motion:e.default()),d=(e,t)=>{t===`appear`?u.value?.onAfterEnter?.(e):t===`leave`&&u.value?.onAfterLeave?.(e),l.value||n.onMotionEnd(),l.value=!0};return(0,i.watch)(()=>n.motionNodes,()=>{n.motionNodes&&n.motionType===`hide`&&s.value&&(0,i.nextTick)(()=>{s.value=!1})},{immediate:!0,flush:`post`}),(0,i.onMounted)(()=>{n.motionNodes&&n.onMotionStart()}),(0,i.onBeforeUnmount)(()=>{n.motionNodes&&d()}),()=>{let{motion:e,motionNodes:t,motionType:l,active:f,eventKey:p,...m}=n;return t?(0,i.createVNode)(i.Transition,{...u.value,appear:l===`show`,onAfterAppear:e=>d(e,`appear`),onAfterLeave:e=>d(e,`leave`)},{default:()=>[(0,i.withDirectives)((0,i.createVNode)(`div`,{class:`${c.value.prefixCls}-treenode-motion`},[t.map(e=>{let{data:{...t},title:n,key:a,isStart:s,isEnd:c}=e;return delete t.children,(0,i.createVNode)(r.default,{...t,title:n,active:f,data:e.data,key:a,eventKey:a,isStart:s,isEnd:c},o)})]),[[i.vShow,s.value]])]}):(0,i.createVNode)(r.default,{class:a.class,style:a.style,...m,active:f,eventKey:p},o)}}});exports.default=a;