import{d as A,X as D,o as i,c as u,f as m,w as E,g as v,S as w,x as F,t as U,a as p,$ as h,k as L,F as X,_ as q,__tla as z}from"./index-b9aa3289.js";import{V as $,__tla as B}from"./vuedraggable.umd-5f6c165d.js";import{_ as G}from"./_plugin-vue_export-helper-1b428a4d.js";let M,H=Promise.all([(()=>{try{return z}catch{}})(),(()=>{try{return B}catch{}})()]).then(async()=>{let x,I,g,y,b,V;x={class:"menu_bottom"},I=["onClick"],g={key:0,class:"submenu"},y={class:"menu_bottom subtitle"},b=["onClick"],V=["onClick"],M=G(A({__name:"MenuPreviewer",props:{modelValue:{},activeIndex:{},parentIndex:{},accountId:{}},emits:["update:modelValue","menu-clicked","submenu-clicked"],setup(N,{emit:O}){const d=N,o=O,s=D({get:()=>d.modelValue,set:n=>o("update:modelValue",n)}),P=()=>{const n=s.value.length,l={name:"\u83DC\u5355\u540D\u79F0",children:[],reply:{type:"text",accountId:d.accountId}};s.value[n]=l,f(l,n-1)},f=(n,l)=>{o("menu-clicked",n,l)},C=(n,l,a)=>{o("submenu-clicked",n,l,a)},S=({oldIndex:n,newIndex:l})=>{if(d.activeIndex==="__MENU_NOT_SELECTED__")return;let a=new Array(s.value.length).fill(!1);a[d.parentIndex]=!0;const[e]=a.splice(n,1);a.splice(l,0,e);const t=a.indexOf(!0),c=s.value[t];o("menu-clicked",c,t)},T=({newIndex:n})=>{var t;const l=d.parentIndex,a=n,e=(t=s.value[l])==null?void 0:t.children;if(e&&(e==null?void 0:e.length)>0){const c=e[a];o("submenu-clicked",c,l,a)}};return(n,l)=>{const a=q;return i(),u(X,null,[m(p($),{modelValue:p(s),"onUpdate:modelValue":l[0]||(l[0]=e=>L(s)?s.value=e:null),"item-key":"id","ghost-class":"draggable-ghost",animation:400,onEnd:S},{item:E(({element:e,index:t})=>[v("div",x,[v("div",{onClick:c=>f(e,t),class:w(["menu_item",{active:d.activeIndex===`${t}`}])},[m(a,{icon:"ep:fold",color:"black"}),F(U(e.name),1)],10,I),d.parentIndex===t&&e.children?(i(),u("div",g,[m(p($),{modelValue:e.children,"onUpdate:modelValue":c=>e.children=c,"item-key":"id","ghost-class":"draggable-ghost",animation:400,onEnd:T},{item:E(({element:c,index:r})=>[v("div",y,[e.children?(i(),u("div",{key:0,class:w(["menu_subItem",{active:d.activeIndex===`${t}-${r}`}]),onClick:_=>C(c,t,r)},U(c.name),11,b)):h("",!0)])]),_:2},1032,["modelValue","onUpdate:modelValue"]),!e.children||e.children.length<5?(i(),u("div",{key:0,class:"menu_bottom menu_addicon",onClick:c=>((r,_)=>{const k=_.children.length,j={name:"\u5B50\u83DC\u5355\u540D\u79F0",reply:{type:"text",accountId:d.accountId}};_.children[k]=j,C(_.children[k],r,k)})(t,e)},[m(a,{icon:"ep:plus",class:"plus"})],8,V)):h("",!0)])):h("",!0)])]),_:1},8,["modelValue"]),p(s).length<3?(i(),u("div",{key:0,class:"menu_bottom menu_addicon",onClick:P},[m(a,{icon:"ep:plus",class:"plus"})])):h("",!0)],64)}}}),[["__scopeId","data-v-d1e067b7"]])});export{H as __tla,M as default};