import { isVNode, shallowRef } from 'vue'; import '../../utils/index.mjs'; import { flattedChildren } from '../../utils/vue/vnode.mjs'; const getOrderedChildren = (vm, childComponentName, children) => { const nodes = flattedChildren(vm.subTree).filter((n) => { var _a; return isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component; }); const uids = nodes.map((n) => n.component.uid); return uids.map((uid) => children[uid]).filter((p) => !!p); }; const useOrderedChildren = (vm, childComponentName) => { const children = {}; const orderedChildren = shallowRef([]); const addChild = (child) => { children[child.uid] = child; orderedChildren.value = getOrderedChildren(vm, childComponentName, children); }; const removeChild = (uid) => { delete children[uid]; orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid); }; return { children: orderedChildren, addChild, removeChild }; }; export { useOrderedChildren }; //# sourceMappingURL=index.mjs.map