import{d as z,N as M,M as b,b3 as D,o as a,n as w,w as o,a as e,c as r,g as V,F as S,r as j,v as u,P as B,i as m,b as v,j as h,f as d,cC as x,V as p,c2 as I,l as L,O as P,h as R,aV as T,y as A,aW as O,A as $,cB as F}from"./index-lT0LPxUj.js";const J={key:0},U={key:1},W={key:2},G=z({__name:"NodeMenu",props:{node:{}},setup(y){const _=y,t=M(()=>_.node),s=b({content:void 0,dialog:!1,show:!1}),E=[{icon:"mdi:mdi-reload",iconClass:"mdi-flip-h",id:"paramsReset",onClick:()=>{t.value.resetParams(),c()},append:!1,show:()=>!0,title:"Reset all parameters"},{icon:"mdi:mdi-format-color-fill",iconClass:"",id:"nodeColor",onClick:()=>{s.content="nodeColor",window.dispatchEvent(new Event("resize"))},append:!0,show:()=>!0,title:"Colorize node"},{icon:"mdi:mdi-information-outline",iconClass:"",id:"modelDoc",onClick:()=>{s.dialog=!0},show:()=>t.value.modelId!=="voltmeter",title:"Model documentation"},{icon:"mdi:mdi-content-copy",iconClass:"",id:"nodeClone",onClick:()=>{const i=t.value.clone().toJSON();i.view&&(i.view.position.x+=50,i.view.color=void 0),t.value.nodes.addNode(i),t.value.changes(),c()},show:()=>!0,title:"Clone node"},{icon:"mdi:mdi-download",iconClass:"",id:"eventsExport",onClick:()=>{s.content="eventsExport"},show:()=>t.value.model.isRecorder&&t.value.activity&&t.value.activity.hasEvents,title:"Export events",append:!0},{icon:"mdi:mdi-trash-can-outline",iconClass:"",id:"nodeDelete",onClick:()=>{F({title:"Delete node?",text:"Are you sure to delete node?",buttons:[{title:"no",key:"no"},{title:"yes",key:"yes"}]}).then(i=>{i==="yes"&&t.value.remove()})},show:()=>!0,title:"Delete node"}],C=()=>{t.value.changes(),T(()=>t.value.nodes.updateRecordsColor())},g=()=>{t.value.view.color="",C()},f=(i="json")=>{var l,n;i==="json"?(l=t.value.activity)==null||l.exportEvents():i==="csv"&&((n=t.value.activity)==null||n.exportEventsCSV()),c()},k=()=>{s.content=void 0},c=()=>{s.content=void 0,s.show=!1};return D(()=>{c()}),(i,l)=>(a(),w(R,{"close-on-content-click":!1,activator:"parent",modelValue:s.show,"onUpdate:modelValue":l[4]||(l[4]=n=>s.show=n)},{default:o(()=>[e(P,{flat:"",style:{"min-width":"300px"}},{default:o(()=>[s.content==null?(a(),r("span",J,[e(V,{density:"compact"},{default:o(()=>[(a(),r(S,null,j(E,(n,N)=>A(e(m,{key:N,title:n.title,onClick:n.onClick},{append:o(()=>[n.append?(a(),w(v,{key:0,icon:"mdi:mdi-menu-right",size:"small"})):u("",!0)]),prepend:o(()=>[e(v,{class:O(n.iconClass),icon:n.icon},null,8,["class","icon"])]),_:2},1032,["title","onClick"]),[[$,n.show()]])),64))]),_:1})])):u("",!0),s.content==="eventsExport"?(a(),r("span",U,[e(B,{class:"py-1 px-0"},{default:o(()=>[e(V,{dense:""},{default:o(()=>[e(m,{onClick:l[0]||(l[0]=n=>f("json"))},{prepend:o(()=>[e(v,{icon:"mdi:mdi-code-json"})]),default:o(()=>[e(h,null,{default:o(()=>[d("Export events to JSON file")]),_:1})]),_:1}),e(m,{onClick:l[1]||(l[1]=n=>f("csv"))},{prepend:o(()=>[e(v,{icon:"mdi:mdi-file-delimited-outline"})]),default:o(()=>[e(h,null,{default:o(()=>[d("Export events to CSV file")]),_:1})]),_:1})]),_:1})]),_:1}),e(x,null,{default:o(()=>[e(p,{onClick:k,"prepend-icon":"mdi:mdi-menu-left",size:"small",variant:"text"},{default:o(()=>[d(" back ")]),_:1})]),_:1})])):u("",!0),s.content==="nodeColor"?(a(),r("span",W,[e(I,{"onUpdate:modelValue":[l[2]||(l[2]=n=>C()),l[3]||(l[3]=n=>t.value.view.color=n)],flat:"","show-swatches":"",elevation:"0",modelValue:t.value.view.color},null,8,["modelValue"]),e(x,null,{default:o(()=>[e(p,{onClick:k,"prepend-icon":"mdi:mdi-menu-left",size:"small",variant:"text"},{default:o(()=>[d(" back ")]),_:1}),e(L),e(p,{onClick:g,size:"small",variant:"outlined"},{default:o(()=>[d(" reset ")]),_:1})]),_:1})])):u("",!0)]),_:1})]),_:1},8,["modelValue"]))}});export{G as _};
