const e=require("../Divider.js"),t=require("../ItemGroup.js"),n=require("../MenuItem.js"),r=require("../SubMenu.js");let i=require("vue");function a(o,s,c){return(o||[]).map((o,l)=>{if(o&&typeof o==`object`){let{label:u,children:d,key:f,type:p,...m}=o,h=f??`tmp-${l}`,g=c?c.parentKeys.slice():[],_=[],v={eventKey:h,key:h,parentEventKeys:(0,i.ref)(g),parentKeys:(0,i.ref)(g),childrenEventKeys:(0,i.ref)(_),isLeaf:!1};if(d||p===`group`){if(p===`group`){let e=a(d,s,c);return(0,i.createVNode)(t.default,{key:h,...m,title:u,originItemValue:o},{default:()=>[e]})}s.set(h,v),c&&c.childrenEventKeys.push(h);let e=a(d,s,{childrenEventKeys:_,parentKeys:[].concat(g,h)});return(0,i.createVNode)(r.default,{key:h,...m,title:u,originItemValue:o},{default:()=>[e]})}return p===`divider`?(0,i.createVNode)(e.default,{key:h,...m},null):(v.isLeaf=!0,s.set(h,v),(0,i.createVNode)(n.default,{key:h,...m,originItemValue:o},{default:()=>[u]}))}return null}).filter(e=>e)}function o(e){let t=(0,i.shallowRef)([]),n=(0,i.shallowRef)(!1),r=(0,i.shallowRef)(new Map);return(0,i.watch)(()=>e.items,()=>{let i=new Map;n.value=!1,e.items?(n.value=!0,t.value=a(e.items,i)):t.value=void 0,r.value=i},{immediate:!0,deep:!0}),{itemsNodes:t,store:r,hasItmes:n}}exports.default=o;