import"vue";import"./contextTypes.mjs";import"./props.mjs";function $(e,n){if(!e)return[];const t=e.slice(),d=t.indexOf(n);return d>=0&&t.splice(d,1),t}function j(e,n){const t=(e||[]).slice();return t.includes(n)||t.push(n),t}function k(e){return e.split("-")}function B(e,n){return`${e}-${n}`}function F(e){return e&&e.type&&e.type.isTreeNode}function R(e,n){const t=[],d=n[e];function i(o=[]){o.forEach(({key:c,children:f})=>{t.push(c),i(f)})}return i(d.children),t}function T(e){if(e.parent){const n=k(e.pos);return Number(n[n.length-1])===e.parent.children.length-1}return!1}function I(e){const n=k(e.pos);return Number(n[n.length-1])===0}function S(e,n,t,d,i,o,c,f,g,C){const{clientX:v,clientY:y}=e,{top:N,height:P}=e.target.getBoundingClientRect(),K=((C==="rtl"?-1:1)*((i?.x||0)-v)-12)/d;let r=f[t.eventKey];if(y<N+P/2){const p=c.findIndex(m=>m.key===r.key),D=p<=0?0:p-1,O=c[D].key;r=f[O]}const x=r.key,A=r,b=r.key;let s=0,h=0;if(!g.has(x))for(let p=0;p<K&&T(r);p+=1)r=r.parent,h+=1;const a=n.eventData,l=r.node;let u=!0;return I(r)&&r.level===0&&y<N+P/2&&o({dragNode:a,dropNode:l,dropPosition:-1})&&r.key===t.eventKey?s=-1:(A.children||[]).length&&g.has(b)?o({dragNode:a,dropNode:l,dropPosition:0})?s=0:u=!1:h===0?K>-1.5?o({dragNode:a,dropNode:l,dropPosition:1})?s=1:u=!1:o({dragNode:a,dropNode:l,dropPosition:0})?s=0:o({dragNode:a,dropNode:l,dropPosition:1})?s=1:u=!1:o({dragNode:a,dropNode:l,dropPosition:1})?s=1:u=!1,{dropPosition:s,dropLevelOffset:h,dropTargetKey:r.key,dropTargetPos:r.pos,dragOverNodeKey:b,dropContainerKey:s===0?null:r.parent?.key||null,dropAllowed:u}}function U(e,n){if(!e)return;const{multiple:t}=n;return t?e.slice():e.length?[e[0]]:e}function X(e){if(!e)return null;let n;if(Array.isArray(e))n={checkedKeys:e,halfCheckedKeys:void 0};else if(typeof e=="object")n={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0};else return null;return n}function Y(e,n){const t=new Set;function d(i){if(t.has(i))return;const o=n[i];if(!o)return;t.add(i);const{parent:c,node:f}=o;f.disabled||c&&d(c.key)}return(e||[]).forEach(i=>{d(i)}),[...t]}export{j as arrAdd,$ as arrDel,S as calcDropPosition,U as calcSelectedKeys,Y as conductExpandParent,R as getDragChildrenKeys,B as getPosition,I as isFirstChild,T as isLastChild,F as isTreeNode,X as parseCheckedKeys,k as posToArr};
