import{co as o,T as u}from"./app-k0jcl5PQ.js";function d(n,t,e){if(u.isEqual(n.id,t))return[n,e];const r=n.children;if(!r||!r.length)return[null,null];for(let l=0;l<r.length;l++){const[i,c]=d(r[l],t,[...e,n]);if(i)return[i,c]}return[null,null]}const a=7,h={find(n,t){if(!(!n||!n.children||!n.children.length))for(let e=0;e<n.children.length;e++){const[r]=d(n.children[e],t,[]);if(r)return r}},getPath(n,t){if(!(!n||!n.children||!n.children.length))for(let e=0;e<n.children.length;e++){const[,r]=d(n.children[e],t,[]);if(r!=null&&r.length)return r}},getParent(n,t){const e=h.getPath(n,t);return e!=null&&e.length?e[e.length-1]:null},convertNestedObjectToTree(n){var e;const t={...n.data,children:n.children};return(e=t.children)!=null&&e.length&&(t.children=t.children.map(h.convertNestedObjectToTree)),t},findDepth(n,t,e=0){var l,i;if(!n||n.length===0)return 0;let r=0;for(const c of n){if(((i=(l=c.data)==null?void 0:l.id)==null?void 0:i.toString())===t.toString())return e;const f=h.findDepth(c.children,t,e+1);if(f>0){r=f;break}}return r},findMaxChildDepth(n,t=0){if(!n||n.length===0)return t;let e=t;for(const r of n){const l=h.findMaxChildDepth(r.children,t+1);e=Math.max(e,l)}return e},findTargetNode(n,t){var e,r;if(!n||n.length===0)return null;for(const l of n){if(((r=(e=l.data)==null?void 0:e.id)==null?void 0:r.toString())===t.toString())return l;const i=h.findTargetNode(l.children,t);if(i!==null)return i}return null},isMaxDepth(n,t,e,r=a){const l=h.findTargetNode(n,t),i=h.findMaxChildDepth(l.children),c=h.findDepth(n,e);return i+c>=r},flatten(n){if(!n)return[];const t=[];function e(r){t.push(o.omit(r,["children"])),r.children.forEach(e)}return n.children.forEach(e),t}};export{a as D,h as T};
//# sourceMappingURL=CXQbE3g_.chunk.js.map
