import{V as f,bE as p,aL as x}from"./index-B-O76M86.js";function a(r){return r?r.__v_isVNode===!0:!1}function y(r){const n=[],e=t=>{Array.isArray(t)&&t.forEach(s=>{var i;a(s)&&(n.push(s),(i=s.component)!=null&&i.subTree&&(n.push(s.component.subTree),e(s.component.subTree.children)),s.children&&e(s.children))})};return e(r),n}const l=(r,n)=>{const e=r.indexOf(n);return e===-1?r.findIndex(t=>n.key!==void 0&&n.key!==null&&t.type===n.type&&t.key===n.key):e};function b(r,n,e){const t=r&&r.subTree&&r.subTree.children?y(r.subTree.children):[];e.sort((i,u)=>l(t,i.vnode)-l(t,u.vnode));const s=e.map(i=>i.proxy);n.sort((i,u)=>{const c=s.indexOf(i),o=s.indexOf(u);return c-o})}function h(r){const n=f([]),e=f([]),t=x();return{children:n,linkChildren:i=>{p(r,Object.assign({link:o=>{o.proxy&&(e.push(o),n.push(o.proxy),b(t,n,e))},unlink:o=>{const d=e.indexOf(o);n.splice(d,1),e.splice(d,1)},children:n,internalChildren:e},i))}}}export{h as u};