import { defineComponent , h , ref } from 'vue' ; const CSidebarNav = defineComponent ( { name : 'CSidebarNav' , setup ( _ , { slots } ) { const visibleGroup = ref ( ) ; const handleVisibleChange = ( visible , index ) => { if ( visible ) { visibleGroup . value = index ; } else { if ( visibleGroup . value === index ) { visibleGroup . value = 0 ; } } } ; const isVisible = ( index ) => Boolean ( visibleGroup . value === index ) ; return ( ) => h ( 'ul' , { class : 'sidebar-nav' , } , slots . default && slots . default ( ) . map ( ( vnode , index ) => { if ( vnode . type . name === 'CNavGroup' ) { return h ( vnode , { onVisibleChange : ( visible ) => handleVisibleChange ( visible , index + 1 ) , ... ( visibleGroup . value && { visible : isVisible ( index + 1 ) } ) , } ) ; } return vnode ; } ) ) ; } , } ) ; export { CSidebarNav } ;