const e=require("../_util/omit.js"),t=require("../vc-virtual-list/index.js"),n=require("./contextTypes.js"),r=require("./props.js"),i=require("./utils/treeUtil.js"),a=require("./MotionTreeNode.js"),o=require("./utils/diffUtil.js");let s=require("vue");var c={width:0,height:0,display:`flex`,overflow:`hidden`,opacity:0,border:0,padding:0,margin:0},l=()=>{},u=`RC_TREE_MOTION_${Math.random()}`,d={key:u},f={key:u,level:0,index:0,pos:`0`,node:d,nodes:[d]},p={parent:null,children:[],pos:f.pos,data:d,title:null,key:u,isStart:[],isEnd:[]};function m(e,t,n,r){return t===!1||!n?e:e.slice(0,Math.ceil(n/r)+1)}function h(e){let{key:t,pos:n}=e;return i.getKey(t,n)}function g(e){let t=String(e.key),n=e;for(;n.parent;)n=n.parent,t=`${n.key} > ${t}`;return t}var _=(0,s.defineComponent)({compatConfig:{MODE:3},name:`NodeList`,inheritAttrs:!1,props:r.nodeListProps,setup(r,{expose:d,attrs:f}){let _=(0,s.ref)(),v=(0,s.ref)(),{expandedKeys:y,flattenNodes:b}=n.useInjectKeysState();d({scrollTo:e=>{_.value.scrollTo(e)},getIndentWidth:()=>v.value.offsetWidth});let x=(0,s.shallowRef)(b.value),S=(0,s.shallowRef)([]),C=(0,s.ref)(null);function w(){x.value=b.value,S.value=[],C.value=null,r.onListChangeEnd()}let T=n.useInjectTreeContext();(0,s.watch)([()=>y.value.slice(),b],([e,t],[n,i])=>{let a=o.findExpandedKeys(n,e);if(a.key!==null){let{virtual:e,height:n,itemHeight:s}=r;if(a.add){let r=i.findIndex(({key:e})=>e===a.key),c=m(o.getExpandRange(i,t,a.key),e,n,s),l=i.slice();l.splice(r+1,0,p),x.value=l,S.value=c,C.value=`show`}else{let r=t.findIndex(({key:e})=>e===a.key),c=m(o.getExpandRange(t,i,a.key),e,n,s),l=t.slice();l.splice(r+1,0,p),x.value=l,S.value=c,C.value=`hide`}}else i!==t&&(x.value=t)}),(0,s.watch)(()=>T.value.dragging,e=>{e||w()});let E=(0,s.computed)(()=>r.motion===void 0?x.value:b.value),D=()=>{r.onActiveChange(null)};return()=>{let{prefixCls:n,selectable:o,checkable:d,disabled:p,motion:m,height:y,itemHeight:b,virtual:x,focusable:T,activeItem:O,focused:k,tabindex:A,onKeydown:j,onFocus:M,onBlur:N,onListChangeStart:P,onListChangeEnd:F,...I}={...r,...f};return(0,s.createVNode)(s.Fragment,null,[k&&O&&(0,s.createVNode)(`span`,{style:c,"aria-live":`assertive`},[g(O)]),(0,s.createVNode)(`div`,null,[(0,s.createVNode)(`input`,{style:c,disabled:T===!1||p,tabindex:T===!1?null:A,onKeydown:j,onFocus:M,onBlur:N,value:``,onChange:l,"aria-label":`for screen reader`},null)]),(0,s.createVNode)(`div`,{class:`${n}-treenode`,"aria-hidden":!0,style:{position:`absolute`,pointerEvents:`none`,visibility:`hidden`,height:0,overflow:`hidden`}},[(0,s.createVNode)(`div`,{class:`${n}-indent`},[(0,s.createVNode)(`div`,{ref:v,class:`${n}-indent-unit`},null)])]),(0,s.createVNode)(t.default,{...e.default(I,[`onActiveChange`]),data:E.value,itemKey:h,height:y,fullHeight:!1,virtual:x,itemHeight:b,prefixCls:`${n}-list`,ref:_,onVisibleChange:(e,t)=>{let n=new Set(e);t.filter(e=>!n.has(e)).some(e=>h(e)===u)&&w()}},{default:e=>{let{pos:t,data:{...n},title:r,key:o,isStart:c,isEnd:l}=e,d=i.getKey(o,t);return delete n.key,delete n.children,(0,s.createVNode)(a.default,{...n,eventKey:d,title:r,active:!!O&&o===O.key,data:e.data,isStart:c,isEnd:l,motion:m,motionNodes:o===u?S.value:null,motionType:C.value,onMotionStart:P,onMotionEnd:w,onMousemove:D},null)}})])}}});exports.MOTION_KEY=u,exports.MotionEntity=f,exports.default=_,exports.getMinimumRangeTransitionRange=m;