const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ZwaveGraph-DOBX2b_9.js","./index-DwzE-W2i.js","./index-B2zoqM3Y.css","./VExpansionPanels-DapzAmhb.js","./VExpansionPanels-Dyw0hWW-.css","./index-D80-F-Ix.js","./ZwaveGraph-DKZdBA1O.css","./NodePanel-0sw2QBQD.js","./vuedraggable.umd-Df3l8PgK.js","./NodePanel-rUfgjk3s.css"])))=>i.map(i=>d[i]);
import{a3 as P,a4 as N,a5 as y,a6 as k,a7 as h,b as r,T as C,a8 as R,_ as b,m as x,a as D,d as f,I as S,e as c,w as u,s as _,G as A,F as B,u as I,a9 as T,x as w,y as g,z as m,aa as U}from"./index-DwzE-W2i.js";const L=N({inset:Boolean,...R({transition:"bottom-sheet-transition"})},"VBottomSheet"),E=P()({name:"VBottomSheet",props:L(),emits:{"update:modelValue":e=>!0},setup(e,o){let{slots:i}=o;const a=y(e,"modelValue");return k(()=>{const s=h.filterProps(e);return r(h,C(s,{contentClass:["v-bottom-sheet__content",e.contentClass],modelValue:a.value,"onUpdate:modelValue":n=>a.value=n,class:["v-bottom-sheet",{"v-bottom-sheet--inset":e.inset},e.class],style:e.style}),i)}),{}}}),p={name:"Mesh",mixins:[S],props:{socket:Object},components:{ZwaveGraph:f(()=>g(()=>import("./ZwaveGraph-DOBX2b_9.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),NodePanel:f(()=>g(()=>import("./NodePanel-0sw2QBQD.js"),__vite__mapDeps([7,1,2,8,9]),import.meta.url))},computed:{...D(w,["nodes"])},documentListeners:{},data(){return{selectedNode:null,showProperties:!1}},watch:{showProperties(e){!e&&this.selectedNode&&(this.selectedNode=null,this.$refs.mesh?.clearSelection())}},methods:{...x(w,["setNeighbors"]),setInitialPosition(e){const o=window.innerHeight,i=window.innerWidth,a=e.offsetHeight,s=e.offsetWidth;let n=(o-a)/2-50,t=(i-s)/10;n<0&&(n=10),t<0&&(t=10),e.style.top=n+"px",e.style.left=t+"px"},makeDivDraggable(){const e=document.getElementById("properties");if(!e||e.hasAttribute("data-draggable"))return;e.setAttribute("data-draggable",!0),setTimeout(()=>{this.setInitialPosition(e)},100);let o=0,i=0;e.onmousedown=a;function a(t){t=t||window.event,!t.target.classList.contains("handle")&&(t.preventDefault(),!t.target.classList.contains("u-over")&&(o=t.clientX,i=t.clientY,document.onmouseup=n,document.onmousemove=s))}function s(t){t=t||window.event,t.preventDefault();const d=o-t.clientX,l=i-t.clientY;o=t.clientX,i=t.clientY,e.style.top=e.offsetTop-l+"px",e.style.left=e.offsetLeft-d+"px"}function n(){document.onmouseup=null,document.onmousemove=null}},onNodeRemoved(e){this.selectedNode&&this.selectedNode.id===e.id&&this.nodeClick(null)},async fetchNodeRoutes(e){!e||e.isControllerNode||await Promise.allSettled([this.app.apiRequest("getPriorityRoute",[e.id]),this.app.apiRequest("getCustomSUCReturnRoute",[e.id]),this.app.apiRequest("getPrioritySUCReturnRoute",[e.id])])},async nodeClick(e){if(!e){this.selectedNode=null,this.showProperties=!1;return}this.selectedNode=e,this.showProperties=!0,this.$vuetify.display.mdAndUp&&(await T(),this.makeDivDraggable())}}},v=()=>{U(e=>({d958fac4:e.$vuetify.theme.current.colors.surface}))},V=p.setup;p.setup=V?(e,o)=>(v(),V(e,o)):v;function M(e,o,i,a,s,n){const t=_("zwave-graph"),d=_("node-panel");return m(),c(I,{class:"fill",fluid:""},{default:u(()=>[r(t,{ref:"mesh",id:"mesh",nodes:e.nodes,onNodeClick:n.nodeClick,onNodeAdded:n.fetchNodeRoutes,onNodeRemoved:n.onNodeRemoved},null,8,["nodes","onNodeClick","onNodeAdded","onNodeRemoved"]),e.$vuetify.display.mdAndUp?(m(),c(d,{key:0,node:s.selectedNode,socket:i.socket,modelValue:s.showProperties,"onUpdate:modelValue":o[0]||(o[0]=l=>s.showProperties=l),id:"properties",draggable:"",class:"details"},null,8,["node","socket","modelValue"])):(m(),c(E,{key:1,scrollable:"",modelValue:s.showProperties,"onUpdate:modelValue":o[2]||(o[2]=l=>s.showProperties=l)},{default:u(()=>[r(B,{scrollable:"",class:"text-center"},{default:u(()=>[r(A,null,{default:u(()=>[r(d,{node:s.selectedNode,socket:i.socket,modelValue:s.showProperties,"onUpdate:modelValue":o[1]||(o[1]=l=>s.showProperties=l)},null,8,["node","socket","modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"]))]),_:1})}const W=b(p,[["render",M],["__scopeId","data-v-65035c09"]]);export{W as default};
