import{x as w,e as C,E as z,a0 as te,Q as de,G as ae,r as g,c as b,P as ce,ah as re,m as K,V as Z,D as O,B as le,X as M,_ as q,H as Q,ae as ue,Y as se,$ as fe,cL as ve,cZ as ye,c_ as he}from"./index.ab0d47a4.js";import{r as pe,T as xe,t as Ke,f as ee,g as ke,c as me,h as be,V as Ne,i as Ee}from"./iconUtil.60568eec.js";import{w as _e}from"./useFlexGapSupport.f5eec5c4.js";var ne=4;function ge(t){var e,u=t.dropPosition,l=t.dropLevelOffset,o=t.prefixCls,d=t.indent,h=t.direction,p=h===void 0?"ltr":h,c=p==="ltr"?"left":"right",N=p==="ltr"?"right":"left",s=(e={},w(e,c,"".concat(-l*d+ne,"px")),w(e,N,0),e);switch(u){case-1:s.top="".concat(-3,"px");break;case 1:s.bottom="".concat(-3,"px");break;default:s.bottom="".concat(-3,"px"),s[c]="".concat(d+ne,"px");break}return C("div",{style:s,class:"".concat(o,"-drop-indicator")},null)}var oe=function(){var e=Ke();return K(K({},e),{showLine:{type:[Boolean,Object],default:void 0},multiple:{type:Boolean,default:void 0},autoExpandParent:{type:Boolean,default:void 0},checkStrictly:{type:Boolean,default:void 0},checkable:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},defaultExpandAll:{type:Boolean,default:void 0},defaultExpandParent:{type:Boolean,default:void 0},defaultExpandedKeys:{type:Array},expandedKeys:{type:Array},checkedKeys:{type:[Array,Object]},defaultCheckedKeys:{type:Array},selectedKeys:{type:Array},defaultSelectedKeys:{type:Array},selectable:{type:Boolean,default:void 0},loadedKeys:{type:Array},draggable:{type:Boolean,default:void 0},showIcon:{type:Boolean,default:void 0},icon:{type:Function},switcherIcon:M.any,prefixCls:String,replaceFields:{type:Object},blockNode:{type:Boolean,default:void 0},openAnimation:M.any,onDoubleclick:e.onDblclick,"onUpdate:selectedKeys":Function,"onUpdate:checkedKeys":Function,"onUpdate:expandedKeys":Function})};const j=z({name:"ATree",inheritAttrs:!1,props:te(oe(),{checkable:!1,selectable:!0,showIcon:!1,blockNode:!1}),slots:["icon","title","switcherIcon","titleRender"],setup:function(e,u){var l=u.attrs,o=u.expose,d=u.emit,h=u.slots;de(!(e.treeData===void 0&&h.default));var p=ae("tree",e),c=p.prefixCls,N=p.direction,s=p.virtual,f=g(),U=function(x){var y;(y=f.value)===null||y===void 0||y.scrollTo(x)};o({treeRef:f,onNodeExpand:function(){var x,y;(y=f.value)===null||y===void 0||(x=y).onNodeExpand.apply(x,arguments)},scrollTo:U,selectedKeys:b(function(){var a;return(a=f.value)===null||a===void 0?void 0:a.selectedKeys}),checkedKeys:b(function(){var a;return(a=f.value)===null||a===void 0?void 0:a.checkedKeys}),halfCheckedKeys:b(function(){var a;return(a=f.value)===null||a===void 0?void 0:a.halfCheckedKeys}),loadedKeys:b(function(){var a;return(a=f.value)===null||a===void 0?void 0:a.loadedKeys}),loadingKeys:b(function(){var a;return(a=f.value)===null||a===void 0?void 0:a.loadingKeys}),expandedKeys:b(function(){var a;return(a=f.value)===null||a===void 0?void 0:a.expandedKeys})}),ce(function(){re(e.replaceFields===void 0,"Tree","`replaceFields` is deprecated, please use fieldNames instead")});var I=function(x,y){d("update:checkedKeys",x),d("check",x,y)},D=function(x,y){d("update:expandedKeys",x),d("expand",x,y)},H=function(x,y){d("update:selectedKeys",x),d("select",x,y)};return function(){var a,x=e.showIcon,y=e.showLine,B=e.switcherIcon,_=B===void 0?h.switcherIcon:B,F=e.icon,R=F===void 0?h.icon:F,$=e.blockNode,S=e.checkable,L=e.selectable,n=e.fieldNames,i=n===void 0?e.replaceFields:n,r=e.motion,v=r===void 0?e.openAnimation:r,T=e.itemHeight,k=T===void 0?28:T,P=e.onDoubleclick,A=e.onDblclick,V=K(K(K({},l),_e(e,["onUpdate:checkedKeys","onUpdate:expandedKeys","onUpdate:selectedKeys","onDoubleclick"])),{showLine:Boolean(y),dropIndicatorRender:ge,fieldNames:i,icon:R,itemHeight:k}),G=h.default?Z(h.default()):void 0;return C(xe,O(O({},V),{},{virtual:s.value,motion:v,ref:f,prefixCls:c.value,class:le((a={},w(a,"".concat(c.value,"-icon-hide"),!x),w(a,"".concat(c.value,"-block-node"),$),w(a,"".concat(c.value,"-unselectable"),!L),w(a,"".concat(c.value,"-rtl"),N.value==="rtl"),a),l.class),direction:N.value,checkable:S,selectable:L,switcherIcon:function(ie){return pe(c.value,_,y,ie)},onCheck:I,onExpand:D,onSelect:H,onDblclick:A||P,children:G}),K(K({},h),{checkable:function(){return C("span",{class:"".concat(c.value,"-checkbox-inner")},null)}}))}}});var E;(function(t){t[t.None=0]="None",t[t.Start=1]="Start",t[t.End=2]="End"})(E||(E={}));function J(t,e,u){function l(o){var d=o[e.key],h=o[e.children];u(d,o)!==!1&&J(h||[],e,u)}t.forEach(l)}function we(t){var e=t.treeData,u=t.expandedKeys,l=t.startKey,o=t.endKey,d=t.fieldNames,h=d===void 0?{title:"title",key:"key",children:"children"}:d,p=[],c=E.None;if(l&&l===o)return[l];if(!l||!o)return[];function N(s){return s===l||s===o}return J(e,h,function(s){if(c===E.End)return!1;if(N(s)){if(p.push(s),c===E.None)c=E.Start;else if(c===E.Start)return c=E.End,!1}else c===E.Start&&p.push(s);return u.indexOf(s)!==-1}),p}function W(t,e,u){var l=q(e),o=[];return J(t,u,function(d,h){var p=l.indexOf(d);return p!==-1&&(o.push(h),l.splice(p,1)),!!l.length}),o}var Ce=globalThis&&globalThis.__rest||function(t,e){var u={};for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&e.indexOf(l)<0&&(u[l]=t[l]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,l=Object.getOwnPropertySymbols(t);o