import{e as j,E as D,o as s,c,A as x,n as f,a as i,b as g,f as u,t as h,m as N,F as w,r as M,H as T,h as $,G as B,_ as E}from"./DpdQcRr7.js";const I={class:"tree-node"},L={class:"panel-icon"},b={class:"panel-icon"},S={class:"tree-text"},V={class:"panel-icon"},z={class:"tree-text"},A=j({__name:"TreeNode",props:{node:{},level:{},expandedDirs:{},activeFile:{}},emits:["toggle","select-file","context-menu"],setup(e,{emit:y}){const o=e,m=y,r=B(()=>o.expandedDirs.has(o.node.path)),k=()=>{m("toggle",o.node.path)},C=()=>{m("select-file",{path:o.node.path,name:o.node.name})},p=n=>{m("context-menu",{node:o.node,x:n.clientX,y:n.clientY})},F=n=>{var d;const t=(d=n.split(".").pop())==null?void 0:d.toLowerCase();return{js:"mdi:language-javascript",ts:"mdi:language-typescript",vue:"mdi:vuejs",py:"mdi:language-python",java:"mdi:language-java",html:"mdi:language-html5",css:"mdi:language-css3",scss:"mdi:language-css3",json:"mdi:code-json",md:"mdi:language-markdown",txt:"mdi:file-document-outline",xml:"mdi:file-code",yml:"mdi:file-code",yaml:"mdi:file-code"}[t||""]||"mdi:file-outline"};return(n,t)=>{const l=D("Icon"),d=G;return s(),c("div",I,[e.node.isDirectory?(s(),c("a",{key:0,class:"panel-block tree-item",style:f({paddingLeft:`${e.level*20+10}px`}),onClick:k,onContextmenu:x(p,["prevent"])},[i("span",L,[g(l,{icon:u(r)?"mdi:chevron-down":"mdi:chevron-right",class:"has-text-grey"},null,8,["icon"])]),i("span",b,[g(l,{icon:u(r)?"mdi:folder-open":"mdi:folder",class:"has-text-warning"},null,8,["icon"])]),i("span",S,h(e.node.name),1)],36)):(s(),c("a",{key:1,class:N(["panel-block tree-item",{"is-active":e.activeFile===e.node.path}]),style:f({paddingLeft:`${e.level*20+30}px`}),onClick:C,onContextmenu:x(p,["prevent"])},[i("span",V,[g(l,{icon:F(e.node.name)},null,8,["icon"])]),i("span",z,h(e.node.name),1)],38)),e.node.isDirectory&&u(r)&&e.node.children?(s(!0),c(w,{key:2},M(e.node.children,v=>(s(),T(d,{key:v.path,node:v,level:e.level+1,"expanded-dirs":e.expandedDirs,"active-file":e.activeFile,onToggle:t[0]||(t[0]=a=>n.$emit("toggle",a)),onSelectFile:t[1]||(t[1]=a=>n.$emit("select-file",a)),onContextMenu:t[2]||(t[2]=a=>n.$emit("context-menu",a))},null,8,["node","level","expanded-dirs","active-file"]))),128)):$("",!0)])}}}),G=E(A,[["__scopeId","data-v-5a373da6"]]);export{G as T};
