import{d as V,P as x,O as B,o as n,n as f,w as y,a as l,V as a,c as C,r as D,F as b,l as E,v as A,q as _,dL as $,cB as F}from"./index-Jv7TaKWs.js";import{_ as L}from"./NodeAvatar-CMw5GNkR.js";import{u as T}from"./networkGraphStore-ChYHJq_o.js";const H=V({__name:"NetworkEditorToolbar",setup(j){const N=T(),e=x(()=>N.state.graph),i=B({collapse:!1,dialogDelete:!1,dialogDownload:!1}),S=()=>{var r,o,s;(r=e.value)!=null&&r.selector&&($((o=e.value)==null?void 0:o.selector.node(),(s=e.value)==null?void 0:s.network.project.name),i.dialogDownload=!1)},h=()=>{F({buttons:[{title:"no",key:"no"},{title:"yes",key:"yes"}],text:"Are you sure to delete all elements of this network?",title:"Empty network?"}).then(r=>{var o;r==="yes"&&((o=e.value)==null||o.network.clear())})},G=()=>{e&&e.value&&(e.value.network.nodes.groupSelected(),e.value.nodeGroupGraph.update())};return(r,o)=>{var s;return n(),f(_,{collapse:i.collapse,key:(s=e.value)==null?void 0:s.network.hash,absolute:"",density:"compact"},{default:y(()=>{var d,c,u,m,k,p,w,g;return[l(a,{onClick:o[0]||(o[0]=t=>G()),icon:"mdi:mdi-select-group",size:"small",disabled:!((d=e.value)!=null&&d.network.nodes.hasAnySelectedNodes)},null,8,["disabled"]),(n(!0),C(b,null,D((c=e.value)==null?void 0:c.network.nodes.state.selectedNodes,(t,z)=>(n(),f(a,{onClick:q=>{var v;return(v=e.value)==null?void 0:v.network.nodes.toggleNodeSelection(t)},key:z,icon:"",size:"small"},{default:y(()=>[l(L,{node:t,size:32},null,8,["node"])]),_:2},1032,["onClick"]))),128)),l(E),l(a,{onClick:S,icon:"mdi:mdi-camera",size:"small",title:"Export network graph"}),i.collapse?A("",!0):(n(),C(b,{key:0},[l(a,{disabled:(u=e.value)==null?void 0:u.network.isEmpty,onClick:o[1]||(o[1]=t=>h()),icon:"mdi:mdi-trash-can-outline",size:"small",title:"Delete all network elements"},null,8,["disabled"]),l(a,{color:(m=e.value)!=null&&m.workspace.state.centerSelected?"amber":"grey",icon:(k=e.value)!=null&&k.workspace.state.centerSelected?"mdi:mdi-image-filter-center-focus":"mdi:mdi-image-filter-center-focus-strong-outline",onClick:o[2]||(o[2]=()=>{var t;return(t=e.value)==null?void 0:t.workspace.toggleCenterSelected()}),size:"small",title:"Auto-center currently selected element"},null,8,["color","icon"]),l(a,{color:(p=e.value)!=null&&p.workspace.state.centerNetwork?"amber":"grey",onClick:o[3]||(o[3]=()=>{var t;return(t=e.value)==null?void 0:t.workspace.toggleCenterNetwork()}),icon:"mdi:mdi-focus-field",size:"small",title:"Auto-center whole network graph"},null,8,["color"]),l(a,{color:(w=e.value)!=null&&w.workspace.state.showGrid?"amber":"grey",icon:(g=e.value)!=null&&g.workspace.state.showGrid?"mdi:mdi-grid":"mdi:mdi-grid-off",onClick:o[4]||(o[4]=()=>{var t;return(t=e.value)==null?void 0:t.workspace.toggleGrid()}),size:"small",title:"Show background grid"},null,8,["color","icon"])],64))]}),_:1},8,["collapse"])}}});export{H as _};
