UNPKG

@zklogic/draw.io

Version:

Draw.IO - Graph Editor integration in Angular-cli

1 lines 10.4 kB
!function(e,t){mxStencilRegistry.dynamicLoading=!1;try{var n=document.createElement("style");n.type="text/css",n.innerHTML=["div.mxTooltip {","-webkit-box-shadow: 3px 3px 12px #C0C0C0;","-moz-box-shadow: 3px 3px 12px #C0C0C0;","box-shadow: 3px 3px 12px #C0C0C0;","background: #FFFFCC;","border-style: solid;","border-width: 1px;","border-color: black;","font-family: Arial;","font-size: 8pt;","position: absolute;","cursor: default;","padding: 4px;","color: black;}"].join("\n"),document.getElementsByTagName("head")[0].appendChild(n)}catch(e){}var i=mxClient.NO_FO,a="undefined"!=typeof MathJax&&void 0!==MathJax.Hub,l=[];mxGraph.prototype.getImageFromBundles=function(e){return null!=e?("http://"!=e.substring(0,7)&&"https://"!=e.substring(0,8)&&"data:image"!=e.substring(0,10)&&("/"==e.charAt(0)&&(e=e.substring(1,e.length)),e="https://app.diagrams.net/"+e),e):null},mxClient.IS_TOUCH&&(mxPanningHandler.prototype.isPanningTrigger=function(e){return!0}),function(){function e(e){try{for(var t=e.firstChild;null!=t&&t.nodeType!=mxConstants.NODETYPE_ELEMENT;)t=t.nextSibling;var n=mxUtils.trim(t.innerHTML);e.innerHTML="";var r=new Graph(e);n="&lt;"==n.substring(0,4)?n.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;gt;/g,"&gt;").replace(/&amp;lt;/g,"&lt;").replace(/&amp;quot;/g,"&quot;").replace(/&#xa;/g,"\n"):"%3C"==n.substring(0,3)?decodeURIComponent(n):Graph.decompress(n);var o=mxUtils.parseXml(n),s=null,u=null;if(null!=o.documentElement&&"mxfile"==o.documentElement.nodeName&&(u=o.documentElement.getElementsByTagName("diagram"),s=o.documentElement,u.length>0&&(n=mxUtils.getTextContent(u[0]),n=Graph.decompress(n),o=mxUtils.parseXml(n))),null!=o.documentElement&&"mxGraphModel"==o.documentElement.nodeName){var m=new mxCodec(o),d=o.documentElement;if(null==s&&(s=d),r.resetViewOnRootChange=!1,r.setEnabled(!1),null!=u&&u.length>0){var c=r.getGlobalVariable;r.getGlobalVariable=function(e){return"page"==e?u[0].getAttribute("name")||"Page-1":"pagenumber"==e?1:"pagecount"==e?u.length:c.apply(this,arguments)}}r.foldingEnabled="1"==s.getAttribute("nav"),r.cellRenderer.forceControlClickHandler=r.foldingEnabled;var h=s.getAttribute("tooltips");"0"!=h?r.setTooltips(!0):r.setTooltips(!1);var g=s.getAttribute("math");"1"==g&&(mxClient.NO_FO=!0,function(){if(!a){a=!0,window.MathJax={skipStartupTypeset:!0,showMathMenu:!1,messageStyle:"none",AuthorInit:function(){MathJax.Hub.Config({jax:["input/TeX","input/MathML","input/AsciiMath","output/SVG"],extensions:["tex2jax.js","mml2jax.js","asciimath2jax.js"],TeX:{extensions:["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]}}),MathJax.Hub.Register.StartupHook("Begin",(function(){for(var e=0;e<l.length;e++)MathJax.Hub.Queue(["Typeset",MathJax.Hub,l[e]])}))}};var e=document.createElement("script");e.type="text/javascript",e.src="https://app.diagrams.net/math/MathJax.js",document.getElementsByTagName("head")[0].appendChild(e)}}()),"0"!=s.getAttribute("pan")?(r.panningHandler.useLeftButtonForPanning=!0,r.panningHandler.ignoreCell=!0,e.style.cursor="move",r.setPanning(!0)):e.style.cursor="default";var p=s.getAttribute("resize"),x=Number(s.getAttribute("border")||0);r.border=x;var f=s.getAttribute("fit");"100%"!=e.style.width&&"1"!=f&&"0"!=p||""==e.style.width&&""==e.style.height?(r.resizeContainer=!0,r.centerZoom=!1):"0"!=p&&"100%"==e.style.width&&""==e.style.height?(r.resizeContainer=!0,r.centerZoom=!1,r.doResizeContainer=function(e,t){mxClient.IS_IE?document.documentMode>=9?(e+=3,t+=5):(e+=1,t+=1):t+=1,null!=this.maximumContainerSize&&(e=Math.min(this.maximumContainerSize.width,e),t=Math.min(this.maximumContainerSize.height,t)),this.container.style.height=Math.ceil(t+18)+"px"}):r.centerZoom=!0;var v=s.getAttribute("links"),b=s.getAttribute("highlight");if("0"!=v||"0"!=h){var C=e.style.cursor,y=r.getTolerance();r.addMouseListener({currentState:null,currentLink:null,highlight:null!=b&&""!=b&&b!=mxConstants.NONE?new mxCellHighlight(r,b,2):null,startX:0,startY:0,mouseDown:function(e,t){this.startX=t.getGraphX(),this.startY=t.getGraphY()},mouseMove:function(e,t){if(r.isMouseDown){if(null!=this.currentLink){var n=Math.abs(this.startX-t.getGraphX()),i=Math.abs(this.startY-t.getGraphY());(n>y||i>y)&&this.clear()}}else{if(null!=this.currentState&&(t.getState()==this.currentState||null==t.getState())&&r.intersects(this.currentState,t.getGraphX(),t.getGraphY()))return;var a=r.view.getState(t.getCell());a!=this.currentState&&(null!=this.currentState&&this.clear(),this.currentState=a,null!=this.currentState&&this.activate(this.currentState))}},mouseUp:function(e,t){var n=this.currentLink;this.clear(),null!=n&&("#"==n.charAt(0)?window.location.hash=n:window.open(n))},activate:function(t){this.currentLink=r.getLinkForCell(t.cell),null!=this.currentLink&&(e.style.cursor="pointer",null!=this.highlight&&this.highlight.highlight(t))},clear:function(){e.style.cursor=C,this.currentState=null,this.currentLink=null,null!=this.highlight&&this.highlight.hide()}})}var E=Number(s.getAttribute("x0")||0),w=Number(s.getAttribute("y0")||0);function M(e){var t=e.getAttribute("backgroundImage");null!=t&&(t=JSON.parse(t),r.setBackgroundImage(new mxImage(t.src,t.width,t.height)),r.view.validateBackgroundImage()),"0"!=f&&r.fit(x),"1"==g&&function(e){"undefined"!=typeof MathJax&&void 0!==MathJax.Hub?MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.container]):l.push(e.container),e.addListener(mxEvent.SIZE,(function(t,n){"undefined"!=typeof MathJax&&void 0!==MathJax.Hub&&MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.container])}))}(r);var n=r.container.getElementsByTagName("a");if(null!=n)for(var i=0;i<n.length;i++){var a=n[i].getAttribute("href");null!=a&&"#"==a.charAt(0)&&"_blank"==n[i].getAttribute("target")&&n[i].removeAttribute("target")}}r.view.translate.x=-E+x,r.view.translate.y=-w+x;var T=s.getAttribute("url");if(null!=T)try{var S=null!=navigator.userAgent&&navigator.userAgent.indexOf("MSIE 9")>0?new XDomainRequest:new XMLHttpRequest;S.open("GET",T),S.onload=mxUtils.bind(this,(function(){try{if("1"==g&&(mxClient.NO_FO=mxClient.IS_SF),null!=(a=null!=S.getText?S.getText():S.responseText)){var e=mxUtils.parseXml(a);if(null!=e&&"html"==e.documentElement.nodeName){var t=e.documentElement.getElementsByTagName("div");if(t.length>0&&"mxgraph"==t[0].getAttribute("class")){var n=t[0].getElementsByTagName("div");if(n.length>0){var a=mxUtils.getTextContent(n[0]);(a=Graph.decompress(a)).length>0&&(e=mxUtils.parseXml(a))}}}if(null!=e&&"svg"==e.documentElement.nodeName&&(null!=(s=e.documentElement.getAttribute("content"))&&"<"!=s.charAt(0)&&"%"!=s.charAt(0)&&(s=unescape(window.atob?atob(s):Base64.decode(cont,s))),null!=s&&"%"==s.charAt(0)&&(s=decodeURIComponent(s)),null!=s&&s.length>0&&(e=mxUtils.parseXml(s))),"mxfile"==e.documentElement.nodeName){var l=e.documentElement.getElementsByTagName("diagram");if(l.length>0){var o=mxUtils.trim(mxUtils.getTextContent(l[0]));if(o.length>0){var s;null!=(s=Graph.decompress(o))&&s.length>0&&(e=mxUtils.parseXml(s))}else{var u=mxUtils.getChildNodes(l[0]);u.length>0&&(e=mxUtils.createXmlDocument()).appendChild(e.importNode(u[0],!0))}}}(m=new mxCodec(e)).decode(e.documentElement,r.getModel()),M(e.documentElement)}else r.container.innerHTML="Cannot load "+mxUtils.htmlEntities(T);mxClient.NO_FO=i}catch(e){r.container.innerHTML="Cannot load "+mxUtils.htmlEntities(T)+": "+mxUtils.htmlEntities(e.message)}})),S.onerror=function(){r.container.innerHTML="Cannot load "+mxUtils.htmlEntities(T)},S.send()}catch(e){r.container.innerHTML="Cannot load "+mxUtils.htmlEntities(T)+": "+mxUtils.htmlEntities(e.message)}else m.decode(d,r.getModel()),M(d);"100%"!=e.style.width&&"0"!=f&&"1"==p&&(r.resizeContainer=!0,r.centerZoom=!1);var A=document.createElement("div");A.style.position="absolute",A.style.overflow="visible",A.style.cursor="pointer";var L=r.getBorderSizes(),N=0,U=10,H=16,O=16;function I(e,t){var n=document.createElement("div");n.style.position="absolute",n.style.border="1px solid gray",n.style.textAlign="center",n.style.cursor="hand",n.style.width=H+"px",n.style.height=O+"px",n.style.left=N+"px",n.style.top="0px",n.style.backgroundColor="white",mxUtils.setOpacity(n,50);var i=document.createElement("table");i.style.borderWidth="0px",i.style.width="100%",i.style.height="100%";var a=document.createElement("tbody"),l=document.createElement("tr"),r=document.createElement("td");return r.style.verticalAlign="middle",r.style.textAlign="center",r.style.fontSize=U+"px",r.style.padding="0px",mxUtils.write(r,e),l.appendChild(r),a.appendChild(l),i.appendChild(a),n.appendChild(i),mxEvent.addListener(n,mxClient.IS_POINTER?"pointerdown":"mousedown",(function(e){mxEvent.consume(e)})),mxEvent.addListener(n,mxClient.IS_POINTER?"pointerup":"mouseup",(function(e){t(),mxEvent.consume(e)})),!mxClient.IS_POINTER&&mxClient.IS_TOUCH&&(mxEvent.addListener(n,"touchstart",(function(e){mxEvent.consume(e)})),mxEvent.addListener(n,"touchend",(function(e){t(),mxEvent.consume(e)}))),N+=H,A.appendChild(n),n}mxClient.IS_TOUCH&&(H=24,O=24,U=14),"0"!=s.getAttribute("zoom")&&(I("+",(function(){r.zoomIn()})),I("-",(function(){r.zoomOut()})));var k=s.getAttribute("edit");function _(){A.style.top=e.offsetTop+L.y+"px",A.style.left=e.offsetLeft+L.x+"px",A.style.visibility="visible"}if(null!=k&&(I("",(function(){if("_blank"==k)if(null!=T)window.open("https://app.diagrams.net/#U"+encodeURIComponent(T));else{var e=null,t=function(i){"ready"==i.data&&i.source==e&&(e.postMessage(n,"*"),window.removeEventListener("message",t))};window.addEventListener("message",t),e=window.open("https://app.diagrams.net/?client=1")}else window.open(k)})).innerHTML="..."),mxClient.IS_POINTER||mxClient.IS_TOUCH)_();else{function B(){A.style.visibility="hidden"}mxEvent.addListener(e,"mouseover",_),mxEvent.addListener(A,"mouseover",_),mxEvent.addListener(e,"mouseout",B),mxEvent.addListener(A,"mouseout",B),B()}null!=A.firstChild&&(null!=e.nextSibling?e.parentNode.insertBefore(A,e.nextSibling):e.parentNode.appendChild(A)),"function"==typeof window.mxClientOnCreate&&window.mxClientOnCreate(r)}}catch(e){null!=window.console&&console.log("Error:",e)}return mxClient.NO_FO=i,r}if("function"==typeof mxClientOnLoad)mxClientOnLoad(undefined,e);else if(mxClient.isBrowserSupported()){for(var t=document.getElementsByTagName("*"),n=[],r=0;r<t.length;r++)n.push(t[r]);for(r=0;r<n.length;r++)n[r].className.toString().indexOf("mxgraph")>=0&&e(n[r])}}()}();