flowy-engine
Version:
The minimal javascript library to create flowcharts ✨
3 lines (2 loc) • 21.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.flowyEngine=t()}(this,function(){var e=function(t,n,i,r,l,o,d){n||(n=function(){}),i||(i=function(){}),r||(r=function(){return!0}),l||(l=function(){return!1}),o||(o=20),d||(d=80);var c=!1;function u(e,t,n){return r(e,t,n)}function f(e,t){return l(e,t)}e.load=function(){if(!c){c=!0;var r,l,a,s,p,w,g=[],h=[],y=t,v=!1,C=o,m=d,x=0,S=0,B=!1,L=!1,R=!1,b=0,k=document.createElement("DIV");k.classList.add("indicator"),k.classList.add("invisible"),y.appendChild(k),e.import=function(e){y.innerHTML=e.html,(g=e.blockarr).length>1&&N()},e.output=function(){var e={html:y.innerHTML,blockarr:g,blocks:[]};if(g.length>0){for(var t=0;t<g.length;t++){e.blocks.push({id:g[t].id,parent:g[t].parent,data:[],attr:[]});var n=document.querySelector(".blockid[value='"+g[t].id+"']").parentNode;n.querySelectorAll("input").forEach(function(n){var i=n.getAttribute("name");e.blocks[t].data.push({name:i,value:n.value})}),Array.prototype.slice.call(n.attributes).forEach(function(n){var i={};i[n.name]=n.value,e.blocks[t].attr.push(i)})}return e}},e.deleteBlocks=function(){g=[],y.innerHTML="<div class='indicator invisible'></div>"},e.beginDrag=function(e){if(e.targetTouches?(p=e.changedTouches[0].clientX,w=e.changedTouches[0].clientY):(p=e.clientX,w=e.clientY),3!=e.which&&e.target.closest(".create-flowy")){s=e.target.closest(".create-flowy");var t=e.target.closest(".create-flowy").cloneNode(!0);e.target.closest(".create-flowy").classList.add("dragnow"),t.classList.add("block"),t.classList.remove("create-flowy"),0===g.length?(t.innerHTML+="<input type='hidden' name='blockid' class='blockid' value='"+g.length+"'>",document.body.appendChild(t),r=document.querySelector(".blockid[value='"+g.length+"']").parentNode):(t.innerHTML+="<input type='hidden' name='blockid' class='blockid' value='"+(Math.max.apply(Math,g.map(function(e){return e.id}))+1)+"'>",document.body.appendChild(t),r=document.querySelector(".blockid[value='"+(parseInt(Math.max.apply(Math,g.map(function(e){return e.id})))+1)+"']").parentNode),i=e.target.closest(".create-flowy"),n(i),r.classList.add("dragging"),v=!0,l=p-e.target.closest(".create-flowy").getBoundingClientRect().left,a=w-e.target.closest(".create-flowy").getBoundingClientRect().top,r.style.left=p-l+"px",r.style.top=w-a+"px"}var i},document.addEventListener("mousedown",X,!1),document.addEventListener("touchstart",X,!1),document.addEventListener("mouseup",X,!1),e.touchDone=function(){R=!1},document.addEventListener("mousedown",e.beginDrag),document.addEventListener("touchstart",e.beginDrag),e.endDrag=function(e){if(3!=e.which&&(v||B))if(R=!1,i(),document.querySelector(".indicator").classList.contains("invisible")||document.querySelector(".indicator").classList.add("invisible"),v&&(s.classList.remove("dragnow"),r.classList.remove("dragging")),0===parseInt(r.querySelector(".blockid").value)&&B){r.classList.remove("dragging"),B=!1;for(var t=0;t<h.length;t++)if(h[t].id!=parseInt(r.querySelector(".blockid").value)){var n=document.querySelector(".blockid[value='"+h[t].id+"']").parentNode,l=document.querySelector(".arrowid[value='"+h[t].id+"']").parentNode;n.style.left=n.getBoundingClientRect().left+window.scrollX-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft-1+"px",n.style.top=n.getBoundingClientRect().top+window.scrollY-(y.getBoundingClientRect().top+window.scrollY)+y.scrollTop-1+"px",l.style.left=l.getBoundingClientRect().left+window.scrollX-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft-1+"px",l.style.top=l.getBoundingClientRect().top+window.scrollY-(y.getBoundingClientRect().top+y.scrollTop)-1+"px",y.appendChild(n),y.appendChild(l),h[t].x=n.getBoundingClientRect().left+window.scrollX+parseInt(n.offsetWidth)/2+y.scrollLeft-1,h[t].y=n.getBoundingClientRect().top+window.scrollY+parseInt(n.offsetHeight)/2+y.scrollTop-1}h.filter(function(e){return 0==e.id})[0].x=r.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(r).width)/2,h.filter(function(e){return 0==e.id})[0].y=r.getBoundingClientRect().top+window.scrollY+parseInt(window.getComputedStyle(r).height)/2,g=g.concat(h),h=[]}else if(v&&0==g.length&&r.getBoundingClientRect().top+window.scrollY>y.getBoundingClientRect().top+window.scrollY&&r.getBoundingClientRect().left+window.scrollX>y.getBoundingClientRect().left+window.scrollX)u(r,!0,void 0),v=!1,r.style.top=r.getBoundingClientRect().top+window.scrollY-(y.getBoundingClientRect().top+window.scrollY)+y.scrollTop+"px",r.style.left=r.getBoundingClientRect().left+window.scrollX-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft+"px",y.appendChild(r),g.push({parent:-1,childwidth:0,id:parseInt(r.querySelector(".blockid").value),x:r.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(r).width)/2+y.scrollLeft,y:r.getBoundingClientRect().top+window.scrollY+parseInt(window.getComputedStyle(r).height)/2+y.scrollTop,width:parseInt(window.getComputedStyle(r).width),height:parseInt(window.getComputedStyle(r).height)});else if(v&&0==g.length)y.appendChild(document.querySelector(".indicator")),r.parentNode.removeChild(r);else if(v)for(var o=r.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(r).width)/2+y.scrollLeft,d=r.getBoundingClientRect().top+window.scrollY+y.scrollTop,c=g.map(function(e){return e.id}),a=0;a<g.length;a++){if(o>=g.filter(function(e){return e.id==c[a]})[0].x-g.filter(function(e){return e.id==c[a]})[0].width/2-C&&o<=g.filter(function(e){return e.id==c[a]})[0].x+g.filter(function(e){return e.id==c[a]})[0].width/2+C&&d>=g.filter(function(e){return e.id==c[a]})[0].y-g.filter(function(e){return e.id==c[a]})[0].height/2&&d<=g.filter(function(e){return e.id==c[a]})[0].y+g.filter(function(e){return e.id==c[a]})[0].height){v=!1,!B&&u(r,!1,g.filter(function(e){return e.id==c[a]})[0])?q(r,a,c):B&&q(r,a,c);break}a==g.length-1&&(v=!1,y.appendChild(document.querySelector(".indicator")),r.parentNode.removeChild(r))}else if(B)for(o=r.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(r).width)/2+y.scrollLeft,d=r.getBoundingClientRect().top+window.scrollY+y.scrollTop,c=g.map(function(e){return e.id}),a=0;a<g.length;a++){if(o>=g.filter(function(e){return e.id==c[a]})[0].x-g.filter(function(e){return e.id==c[a]})[0].width/2-C&&o<=g.filter(function(e){return e.id==c[a]})[0].x+g.filter(function(e){return e.id==c[a]})[0].width/2+C&&d>=g.filter(function(e){return e.id==c[a]})[0].y-g.filter(function(e){return e.id==c[a]})[0].height/2&&d<=g.filter(function(e){return e.id==c[a]})[0].y+g.filter(function(e){return e.id==c[a]})[0].height){v=!1,r.classList.remove("dragging"),q(r,a,c);break}a==g.length-1&&(f(r,g.filter(function(e){return e.id==c[a]})[0])?(v=!1,r.classList.remove("dragging"),q(r,c.indexOf(b),c)):(B=!1,h=[],v=!1,y.appendChild(document.querySelector(".indicator")),r.parentNode.removeChild(r)))}},document.addEventListener("mouseup",e.endDrag,!1),document.addEventListener("touchend",e.endDrag,!1),e.moveBlock=function(e){if(e.targetTouches?(p=e.targetTouches[0].clientX,w=e.targetTouches[0].clientY):(p=e.clientX,w=e.clientY),R){B=!0,r.classList.add("dragging");var t=parseInt(r.querySelector(".blockid").value);b=g.filter(function(e){return e.id==t})[0].parent,h.push(g.filter(function(e){return e.id==t})[0]),g=g.filter(function(e){return e.id!=t}),0!=t&&document.querySelector(".arrowid[value='"+t+"']").parentNode.remove();for(var n=g.filter(function(e){return e.parent==t}),i=!1,o=[],d=[];!i;){for(var c=0;c<n.length;c++)if(n[c]!=t){h.push(g.filter(function(e){return e.id==n[c].id})[0]);var u=document.querySelector(".blockid[value='"+n[c].id+"']").parentNode,f=document.querySelector(".arrowid[value='"+n[c].id+"']").parentNode;u.style.left=u.getBoundingClientRect().left+window.scrollX-(r.getBoundingClientRect().left+window.scrollX)+"px",u.style.top=u.getBoundingClientRect().top+window.scrollY-(r.getBoundingClientRect().top+window.scrollY)+"px",f.style.left=f.getBoundingClientRect().left+window.scrollX-(r.getBoundingClientRect().left+window.scrollX)+"px",f.style.top=f.getBoundingClientRect().top+window.scrollY-(r.getBoundingClientRect().top+window.scrollY)+"px",r.appendChild(u),r.appendChild(f),o.push(n[c].id),d.push(n[c].id)}0==o.length?i=!0:(n=g.filter(function(e){return o.includes(e.parent)}),o=[])}for(c=0;c<g.filter(function(e){return e.parent==t}).length;c++){var s=g.filter(function(e){return e.parent==t})[c];g=g.filter(function(e){return e.id!=s})}for(c=0;c<d.length;c++)s=d[c],g=g.filter(function(e){return e.id!=s});g.length>1&&N(),L&&function(){if(S<y.getBoundingClientRect().left+window.scrollX){L=!1;for(var e=g.map(function(e){return e.id}),t=0;t<g.length;t++)if(document.querySelector(".blockid[value='"+g.filter(function(n){return n.id==e[t]})[0].id+"']").parentNode.style.left=g.filter(function(n){return n.id==e[t]})[0].x-g.filter(function(n){return n.id==e[t]})[0].width/2-S-20+"px",g.filter(function(n){return n.id==e[t]})[0].x=document.querySelector(".blockid[value='"+g.filter(function(n){return n.id==e[t]})[0].id+"']").parentNode.getBoundingClientRect().left+window.scrollX+g.filter(function(n){return n.id==e[t]})[0].width/2,-1!=g.filter(function(n){return n.id==e[t]})[0].parent){var n=g.filter(function(n){return n.id==e[t]})[0],i=n.x-g.filter(function(n){return n.id==g.filter(function(n){return n.id==e[t]})[0].parent})[0].x;document.querySelector('.arrowid[value="'+e[t]+'"]').parentNode.style.left=i<0?n.x-5-(y.getBoundingClientRect().left+window.scrollX)+"px":g.filter(function(n){return n.id==g.filter(function(n){return n.id==e[t]})[0].parent})[0].x-20-(y.getBoundingClientRect().left+window.scrollX)+"px"}S=0}}(),R=!1}if(v?(r.style.left=p-l+"px",r.style.top=w-a+"px"):B&&(r.style.left=p-l-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft+"px",r.style.top=w-a-(y.getBoundingClientRect().top+window.scrollY)+y.scrollTop+"px",h.filter(function(e){return e.id==parseInt(r.querySelector(".blockid").value)}).x=r.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(r).width)/2+y.scrollLeft,h.filter(function(e){return e.id==parseInt(r.querySelector(".blockid").value)}).y=r.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(r).height)/2+y.scrollTop),v||B){var m=r.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(r).width)/2+y.scrollLeft,x=r.getBoundingClientRect().top+window.scrollY+y.scrollTop,k=g.map(function(e){return e.id});for(c=0;c<g.length;c++){if(m>=g.filter(function(e){return e.id==k[c]})[0].x-g.filter(function(e){return e.id==k[c]})[0].width/2-C&&m<=g.filter(function(e){return e.id==k[c]})[0].x+g.filter(function(e){return e.id==k[c]})[0].width/2+C&&x>=g.filter(function(e){return e.id==k[c]})[0].y-g.filter(function(e){return e.id==k[c]})[0].height/2&&x<=g.filter(function(e){return e.id==k[c]})[0].y+g.filter(function(e){return e.id==k[c]})[0].height){document.querySelector(".blockid[value='"+k[c]+"']").parentNode.appendChild(document.querySelector(".indicator")),document.querySelector(".indicator").style.left=parseInt(window.getComputedStyle(document.querySelector(".blockid[value='"+k[c]+"']").parentNode).width)/2-5+"px",document.querySelector(".indicator").style.top=window.getComputedStyle(document.querySelector(".blockid[value='"+k[c]+"']").parentNode).height+"px",document.querySelector(".indicator").classList.remove("invisible");break}c==g.length-1&&(document.querySelector(".indicator").classList.contains("invisible")||document.querySelector(".indicator").classList.add("invisible"))}}},document.addEventListener("mousemove",e.moveBlock,!1),document.addEventListener("touchmove",e.moveBlock,!1)}function q(e,t,n){B||y.appendChild(e);for(var i=0,r=0,l=0;l<g.filter(function(e){return e.parent==n[t]}).length;l++)i+=(w=g.filter(function(e){return e.parent==n[t]})[l]).childwidth>w.width?w.childwidth+C:w.width+C;for(i+=parseInt(window.getComputedStyle(e).width),l=0;l<g.filter(function(e){return e.parent==n[t]}).length;l++)(w=g.filter(function(e){return e.parent==n[t]})[l]).childwidth>w.width?(document.querySelector(".blockid[value='"+w.id+"']").parentNode.style.left=g.filter(function(e){return e.id==n[t]})[0].x-i/2+r+w.childwidth/2-w.width/2+"px",w.x=g.filter(function(e){return e.parent==n[t]})[0].x-i/2+r+w.childwidth/2,r+=w.childwidth+C):(document.querySelector(".blockid[value='"+w.id+"']").parentNode.style.left=g.filter(function(e){return e.id==n[t]})[0].x-i/2+r+"px",w.x=g.filter(function(e){return e.parent==n[t]})[0].x-i/2+r+w.width/2,r+=w.width+C);if(e.style.left=g.filter(function(e){return e.id==n[t]})[0].x-i/2+r-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft+"px",e.style.top=g.filter(function(e){return e.id==n[t]})[0].y+g.filter(function(e){return e.id==n[t]})[0].height/2+m-(y.getBoundingClientRect().top+window.scrollY)+"px",B){for(h.filter(function(t){return t.id==parseInt(e.querySelector(".blockid").value)})[0].x=e.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(e).width)/2+y.scrollLeft+y.scrollLeft,h.filter(function(t){return t.id==parseInt(e.querySelector(".blockid").value)})[0].y=e.getBoundingClientRect().top+window.scrollY+parseInt(window.getComputedStyle(e).height)/2+y.scrollTop,h.filter(function(t){return t.id==e.querySelector(".blockid").value})[0].parent=n[t],l=0;l<h.length;l++)if(h[l].id!=parseInt(e.querySelector(".blockid").value)){var o=document.querySelector(".blockid[value='"+h[l].id+"']").parentNode,d=document.querySelector(".arrowid[value='"+h[l].id+"']").parentNode;o.style.left=o.getBoundingClientRect().left+window.scrollX-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft+"px",o.style.top=o.getBoundingClientRect().top+window.scrollY-(y.getBoundingClientRect().top+window.scrollY)+y.scrollTop+"px",d.style.left=d.getBoundingClientRect().left+window.scrollX-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft+20+"px",d.style.top=d.getBoundingClientRect().top+window.scrollY-(y.getBoundingClientRect().top+window.scrollY)+y.scrollTop+"px",y.appendChild(o),y.appendChild(d),h[l].x=o.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(o).width)/2+y.scrollLeft,h[l].y=o.getBoundingClientRect().top+window.scrollY+parseInt(window.getComputedStyle(o).height)/2+y.scrollTop}g=g.concat(h),h=[]}else g.push({childwidth:0,parent:n[t],id:parseInt(e.querySelector(".blockid").value),x:e.getBoundingClientRect().left+window.scrollX+parseInt(window.getComputedStyle(e).width)/2+y.scrollLeft,y:e.getBoundingClientRect().top+window.scrollY+parseInt(window.getComputedStyle(e).height)/2+y.scrollTop,width:parseInt(window.getComputedStyle(e).width),height:parseInt(window.getComputedStyle(e).height)});var c=g.filter(function(t){return t.id==parseInt(e.querySelector(".blockid").value)})[0],u=c.x-g.filter(function(e){return e.id==n[t]})[0].x+20,f=parseFloat(c.y-c.height/2-(g.filter(function(e){return e.parent==n[t]})[0].y+g.filter(function(e){return e.parent==n[t]})[0].height/2)+y.scrollTop);if(u<0?(y.innerHTML+='<div class="arrowblock"><input type="hidden" class="arrowid" value="'+e.querySelector(".blockid").value+'"><svg preserveaspectratio="none" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M'+(g.filter(function(e){return e.id==n[t]})[0].x-c.x+5)+" 0L"+(g.filter(function(e){return e.id==n[t]})[0].x-c.x+5)+" "+m/2+"L5 "+m/2+"L5 "+f+'" stroke="#C5CCD0" stroke-width="2px"/><path d="M0 '+(f-5)+"H10L5 "+f+"L0 "+(f-5)+'Z" fill="#C5CCD0"/></svg></div>',document.querySelector('.arrowid[value="'+e.querySelector(".blockid").value+'"]').parentNode.style.left=c.x-5-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft+"px"):(y.innerHTML+='<div class="arrowblock"><input type="hidden" class="arrowid" value="'+e.querySelector(".blockid").value+'"><svg preserveaspectratio="none" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 0L20 '+m/2+"L"+u+" "+m/2+"L"+u+" "+f+'" stroke="#C5CCD0" stroke-width="2px"/><path d="M'+(u-5)+" "+(f-5)+"H"+(u+5)+"L"+u+" "+f+"L"+(u-5)+" "+(f-5)+'Z" fill="#C5CCD0"/></svg></div>',document.querySelector('.arrowid[value="'+parseInt(e.querySelector(".blockid").value)+'"]').parentNode.style.left=g.filter(function(e){return e.id==n[t]})[0].x-20-(y.getBoundingClientRect().left+window.scrollX)+y.scrollLeft+"px"),document.querySelector('.arrowid[value="'+parseInt(e.querySelector(".blockid").value)+'"]').parentNode.style.top=g.filter(function(e){return e.id==n[t]})[0].y+g.filter(function(e){return e.id==n[t]})[0].height/2+"px",-1!=g.filter(function(e){return e.id==n[t]})[0].parent){for(var a=!1,s=n[t];!a;)if(-1==g.filter(function(e){return e.id==s})[0].parent)a=!0;else{var p=0;for(l=0;l<g.filter(function(e){return e.parent==s}).length;l++){var w;(w=g.filter(function(e){return e.parent==s})[l]).childwidth>w.width?l==g.filter(function(e){return e.parent==s}).length-1?p+=w.childwidth:p+=w.childwidth+C:l==g.filter(function(e){return e.parent==s}).length-1?p+=w.width:p+=w.width+C}g.filter(function(e){return e.id==s})[0].childwidth=p,s=g.filter(function(e){return e.id==s})[0].parent}g.filter(function(e){return e.id==s})[0].childwidth=i}B&&(B=!1,e.classList.remove("dragging")),N(),function(){x=g.map(function(e){return e.x});var e=g.map(function(e){return e.width}),t=x.map(function(t,n){return t-e[n]/2});if((x=Math.min.apply(Math,t))<y.getBoundingClientRect().left+window.scrollX){L=!0;for(var n=g.map(function(e){return e.id}),i=0;i<g.length;i++)if(document.querySelector(".blockid[value='"+g.filter(function(e){return e.id==n[i]})[0].id+"']").parentNode.style.left=g.filter(function(e){return e.id==n[i]})[0].x-g.filter(function(e){return e.id==n[i]})[0].width/2-x+20+"px",-1!=g.filter(function(e){return e.id==n[i]})[0].parent){var r=g.filter(function(e){return e.id==n[i]})[0],l=r.x-g.filter(function(e){return e.id==g.filter(function(e){return e.id==n[i]})[0].parent})[0].x;document.querySelector('.arrowid[value="'+n[i]+'"]').parentNode.style.left=l<0?r.x-x+20-5+"px":g.filter(function(e){return e.id==g.filter(function(e){return e.id==n[i]})[0].parent})[0].x-20-x+20+"px"}for(i=0;i<g.length;i++)g[i].x=document.querySelector(".blockid[value='"+g[i].id+"']").parentNode.getBoundingClientRect().left+window.scrollX+(y.getBoundingClientRect().left+y.scrollLeft)-parseInt(window.getComputedStyle(document.querySelector(".blockid[value='"+g[i].id+"']").parentNode).width)/2-40;S=x}}()}function X(e){if(R=!1,I(e.target,"block")){var t=e.target.closest(".block");e.targetTouches?(p=e.targetTouches[0].clientX,w=e.targetTouches[0].clientY):(p=e.clientX,w=e.clientY),"mouseup"!==e.type&&I(e.target,"block")&&3!=e.which&&(v||B||(R=!0,l=p-((r=t).getBoundingClientRect().left+window.scrollX),a=w-(r.getBoundingClientRect().top+window.scrollY)))}}function I(e,t){return!!(e.className&&e.className.split(" ").indexOf(t)>=0)||e.parentNode&&I(e.parentNode,t)}function N(){for(var e=g.map(function(e){return e.parent}),t=0;t<e.length;t++){-1==e[t]&&t++;for(var n=0,i=0,r=0;r<g.filter(function(n){return n.parent==e[t]}).length;r++){var l=g.filter(function(n){return n.parent==e[t]})[r];0==g.filter(function(e){return e.parent==l.id}).length&&(l.childwidth=0),l.childwidth>l.width?r==g.filter(function(n){return n.parent==e[t]}).length-1?n+=l.childwidth:n+=l.childwidth+C:r==g.filter(function(n){return n.parent==e[t]}).length-1?n+=l.width:n+=l.width+C}for(-1!=e[t]&&(g.filter(function(n){return n.id==e[t]})[0].childwidth=n),r=0;r<g.filter(function(n){return n.parent==e[t]}).length;r++){l=g.filter(function(n){return n.parent==e[t]})[r];var o=document.querySelector(".blockid[value='"+l.id+"']").parentNode,d=g.filter(function(n){return n.id==e[t]});o.style.top=d.y+m+"px",d.y=d.y+m,l.childwidth>l.width?(o.style.left=d[0].x-n/2+i+l.childwidth/2-l.width/2-(y.getBoundingClientRect().left+window.scrollX)+"px",l.x=d[0].x-n/2+i+l.childwidth/2,i+=l.childwidth+C):(o.style.left=d[0].x-n/2+i-(y.getBoundingClientRect().left+window.scrollX)+"px",l.x=d[0].x-n/2+i+l.width/2,i+=l.width+C);var c=g.filter(function(e){return e.id==l.id})[0],u=c.x-g.filter(function(e){return e.id==l.parent})[0].x+20,f=c.y-c.height/2-(g.filter(function(e){return e.id==l.parent})[0].y+g.filter(function(e){return e.id==l.parent})[0].height/2);document.querySelector('.arrowid[value="'+l.id+'"]').parentNode.style.top=g.filter(function(e){return e.id==l.parent})[0].y+g.filter(function(e){return e.id==l.parent})[0].height/2-(y.getBoundingClientRect().top+window.scrollY)+"px",u<0?(document.querySelector('.arrowid[value="'+l.id+'"]').parentNode.style.left=c.x-5-(y.getBoundingClientRect().left+window.scrollX)+"px",document.querySelector('.arrowid[value="'+l.id+'"]').parentNode.innerHTML='<input type="hidden" class="arrowid" value="'+l.id+'"><svg preserveaspectratio="none" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M'+(g.filter(function(e){return e.id==l.parent})[0].x-c.x+5)+" 0L"+(g.filter(function(e){return e.id==l.parent})[0].x-c.x+5)+" "+m/2+"L5 "+m/2+"L5 "+f+'" stroke="#C5CCD0" stroke-width="2px"/><path d="M0 '+(f-5)+"H10L5 "+f+"L0 "+(f-5)+'Z" fill="#C5CCD0"/></svg>'):(document.querySelector('.arrowid[value="'+l.id+'"]').parentNode.style.left=g.filter(function(e){return e.id==l.parent})[0].x-20-(y.getBoundingClientRect().left+window.scrollX)+"px",document.querySelector('.arrowid[value="'+l.id+'"]').parentNode.innerHTML='<input type="hidden" class="arrowid" value="'+l.id+'"><svg preserveaspectratio="none" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 0L20 '+m/2+"L"+u+" "+m/2+"L"+u+" "+f+'" stroke="#C5CCD0" stroke-width="2px"/><path d="M'+(u-5)+" "+(f-5)+"H"+(u+5)+"L"+u+" "+f+"L"+(u-5)+" "+(f-5)+'Z" fill="#C5CCD0"/></svg>')}}}},e.load()};return e});
//# sourceMappingURL=flowy-engine.umd.js.map