@abi-software/map-utilities 1.3.3-beta.4 → 1.3.3-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/map-utilities.js
CHANGED
|
@@ -26897,8 +26897,6 @@ const Z5 = "#8300bf", J5 = "#f3ecf6", Q5 = [
|
|
|
26897
26897
|
style: {
|
|
26898
26898
|
width: 1,
|
|
26899
26899
|
"line-color": "dimgray",
|
|
26900
|
-
"target-arrow-color": "dimgray",
|
|
26901
|
-
"target-arrow-shape": "triangle",
|
|
26902
26900
|
"curve-style": "bezier"
|
|
26903
26901
|
}
|
|
26904
26902
|
},
|
|
@@ -42,7 +42,7 @@ Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
|
42
42
|
`),p=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value,g=d==="anywhere",h=[],v=/[\s\u200b]+|$/g,b=0;b<f.length;b++){var y=f[b],x=this.calculateLabelDimensions(e,y),w=x.width;if(g){var _=y.split("").join(c);y=_}if(w>p){var k=y.matchAll(v),S="",A=0,C=Qh(k),E;try{for(C.s();!(E=C.n()).done;){var I=E.value,T=I[0],D=y.substring(A,I.index);A=I.index+T.length;var P=S.length===0?D:S+D+T,B=this.calculateLabelDimensions(e,P),V=B.width;V<=p?S+=D+T:(S&&h.push(S),S=D+T)}}catch(U){C.e(U)}finally{C.f()}S.match(/^[\s\u200b]+$/)||h.push(S)}else h.push(y)}s("labelWrapCachedLines",h),n=s("labelWrapCachedText",h.join(`
|
|
43
43
|
`)),s("labelWrapKey",u)}else if(o==="ellipsis"){var M=e.pstyle("text-max-width").pfValue,R="",F="…",q=!1;if(this.calculateLabelDimensions(e,n).width<M)return n;for(var H=0;H<n.length;H++){var $=this.calculateLabelDimensions(e,R+n[H]+F).width;if($>M)break;R+=n[H],H===n.length-1&&(q=!0)}return q||(R+=F),R}return n},Pr.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t},Pr.calculateLabelDimensions=function(e,t){var r=this,i=r.cy.window(),n=i.document,a=tn(t,e._private.labelDimsKey),s=r.labelDimCache||(r.labelDimCache=[]),o=s[a];if(o!=null)return o;var u=0,c=e.pstyle("font-style").strValue,f=e.pstyle("font-size").pfValue,p=e.pstyle("font-family").strValue,d=e.pstyle("font-weight").strValue,g=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!g){g=this.labelCalcCanvas=n.createElement("canvas"),h=this.labelCalcCanvasContext=g.getContext("2d");var v=g.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}h.font="".concat(c," ").concat(d," ").concat(f,"px ").concat(p);for(var b=0,y=0,x=t.split(`
|
|
44
44
|
`),w=0;w<x.length;w++){var _=x[w],k=h.measureText(_),S=Math.ceil(k.width),A=f;b=Math.max(S,b),y+=A}return b+=u,y+=u,s[a]={width:b,height:y}},Pr.calculateLabelAngle=function(e,t){var r=e._private,i=r.rscratch,n=e.isEdge(),a=t?t+"-":"",s=e.pstyle(a+"text-rotation"),o=s.strValue;return o==="none"?0:n&&o==="autorotate"?i.labelAutoAngle:o==="autorotate"?0:s.pfValue},Pr.calculateLabelAngles=function(e){var t=this,r=e.isEdge(),i=e._private,n=i.rscratch;n.labelAngle=t.calculateLabelAngle(e),r&&(n.sourceLabelAngle=t.calculateLabelAngle(e,"source"),n.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var bv={},xv=28,wv=!1;bv.getNodeShape=function(e){var t=this,r=e.pstyle("shape").value;if(r==="cutrectangle"&&(e.width()<xv||e.height()<xv))return wv||(Ve("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),wv=!0),"rectangle";if(e.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var i=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(i).name}return r};var Tl={};Tl.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),r=this,i=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(s),o)for(var u=0;u<s.length;u++){var c=s[u],f=c._private,p=f.rstyle;p.clean=!1,p.cleanConnected=!1}};r.binder(e).on("bounds.* dirty.*",function(s){var o=s.target;i(o)}).on("style.* background.*",function(s){var o=s.target;i(o,!1)});var n=function(s){if(s){var o=r.onUpdateEleCalcsFns;t.cleanStyle();for(var u=0;u<t.length;u++){var c=t[u],f=c._private.rstyle;c.isNode()&&!f.cleanConnected&&(i(c.connectedEdges()),f.cleanConnected=!0)}if(o)for(var p=0;p<o.length;p++){var d=o[p];d(s,t)}r.recalculateRenderedStyle(t),t=e.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)},Tl.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)},Tl.recalculateRenderedStyle=function(e,t){var r=function(_){return _._private.rstyle.cleanConnected},i=[],n=[];if(!this.destroyed){t===void 0&&(t=!0);for(var a=0;a<e.length;a++){var s=e[a],o=s._private,u=o.rstyle;s.isEdge()&&(!r(s.source())||!r(s.target()))&&(u.clean=!1),!(t&&u.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?n.push(s):i.push(s),u.clean=!0)}for(var c=0;c<n.length;c++){var f=n[c],p=f._private,d=p.rstyle,g=f.position();this.recalculateNodeLabelProjection(f),d.nodeX=g.x,d.nodeY=g.y,d.nodeW=f.pstyle("width").pfValue,d.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(i);for(var h=0;h<i.length;h++){var v=i[h],b=v._private,y=b.rstyle,x=b.rscratch;y.srcX=x.arrowStartX,y.srcY=x.arrowStartY,y.tgtX=x.arrowEndX,y.tgtY=x.arrowEndY,y.midX=x.midX,y.midY=x.midY,y.labelAngle=x.labelAngle,y.sourceLabelAngle=x.sourceLabelAngle,y.targetLabelAngle=x.targetLabelAngle}}};var Al={};Al.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],r=0;r<e.length;r++){var i=e[r],n=i._private.rscratch;i.grabbed()&&!i.isParent()?t.push(i):n.inDragLayer?e.drag.push(i):e.nondrag.push(i)}for(var r=0;r<t.length;r++){var i=t[r];e.drag.push(i)}}},Al.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},Al.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Lg),t.interactive=t.filter(function(r){return r.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var _v={};[cn,Cl,Ut,As,Gc,Pr,bv,Tl,Al].forEach(function(e){Ne(_v,e)});var Ev={};Ev.getCachedImage=function(e,t,r){var i=this,n=i.imageCache=i.imageCache||{},a=n[e];if(a)return a.image.complete||a.image.addEventListener("load",r),a.image;a=n[e]=n[e]||{};var s=a.image=new Image;s.addEventListener("load",r),s.addEventListener("error",function(){s.error=!0});var o="data:",u=e.substring(0,o.length).toLowerCase()===o;return u||(t=t==="null"?null:t,s.crossOrigin=t),s.src=e,s};var pa={};pa.registerBinding=function(e,t,r,i){var n=Array.prototype.slice.apply(arguments,[1]),a=this.binder(e);return a.on.apply(a,n)},pa.binder=function(e){var t=this,r=t.cy.window(),i=e===r||e===r.document||e===r.document.body||nO(e);if(t.supportsPassiveEvents==null){var n=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,a)}catch{}t.supportsPassiveEvents=n}var s=function(u,c,f){var p=Array.prototype.slice.call(arguments);return i&&t.supportsPassiveEvents&&(p[2]={capture:f??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:p}),(e.addEventListener||e.on).apply(e,p),this};return{on:s,addEventListener:s,addListener:s,bind:s}},pa.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},pa.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},pa.load=function(){var e=this,t=e.cy.window(),r=function(L){return L.selected()},i=function(L,J,ne,se){L==null&&(L=e.cy);for(var oe=0;oe<J.length;oe++){var me=J[oe];L.emit({originalEvent:ne,type:me,position:se})}},n=function(L){return L.shiftKey||L.metaKey||L.ctrlKey},a=function(L,J){var ne=!0;if(e.cy.hasCompoundNodes()&&L&&L.pannable())for(var se=0;J&&se<J.length;se++){var L=J[se];if(L.isNode()&&L.isParent()&&!L.pannable()){ne=!1;break}}else ne=!0;return ne},s=function(L){L[0]._private.grabbed=!0},o=function(L){L[0]._private.grabbed=!1},u=function(L){L[0]._private.rscratch.inDragLayer=!0},c=function(L){L[0]._private.rscratch.inDragLayer=!1},f=function(L){L[0]._private.rscratch.isGrabTarget=!0},p=function(L){L[0]._private.rscratch.isGrabTarget=!1},d=function(L,J){var ne=J.addToList,se=ne.has(L);!se&&L.grabbable()&&!L.locked()&&(ne.merge(L),s(L))},g=function(L,J){if(L.cy().hasCompoundNodes()&&!(J.inDragLayer==null&&J.addToList==null)){var ne=L.descendants();J.inDragLayer&&(ne.forEach(u),ne.connectedEdges().forEach(u)),J.addToList&&d(ne,J)}},h=function(L,J){J=J||{};var ne=L.cy().hasCompoundNodes();J.inDragLayer&&(L.forEach(u),L.neighborhood().stdFilter(function(se){return!ne||se.isEdge()}).forEach(u)),J.addToList&&L.forEach(function(se){d(se,J)}),g(L,J),y(L,{inDragLayer:J.inDragLayer}),e.updateCachedGrabbedEles()},v=h,b=function(L){L&&(e.getCachedZSortedEles().forEach(function(J){o(J),c(J),p(J)}),e.updateCachedGrabbedEles())},y=function(L,J){if(!(J.inDragLayer==null&&J.addToList==null)&&L.cy().hasCompoundNodes()){var ne=L.ancestors().orphans();if(!ne.same(L)){var se=ne.descendants().spawnSelf().merge(ne).unmerge(L).unmerge(L.descendants()),oe=se.connectedEdges();J.inDragLayer&&(oe.forEach(u),se.forEach(u)),J.addToList&&se.forEach(function(me){d(me,J)})}}},x=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},w=typeof MutationObserver<"u",_=typeof ResizeObserver<"u";w?(e.removeObserver=new MutationObserver(function(ae){for(var L=0;L<ae.length;L++){var J=ae[L],ne=J.removedNodes;if(ne)for(var se=0;se<ne.length;se++){var oe=ne[se];if(oe===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(ae){e.destroy()});var k=$o(function(){e.cy.resize()},100);w&&(e.styleObserver=new MutationObserver(k),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",k),_&&(e.resizeObserver=new ResizeObserver(k),e.resizeObserver.observe(e.container));var S=function(L,J){for(;L!=null;)J(L),L=L.parentNode},A=function(){e.invalidateContainerClientCoordsCache()};S(e.container,function(ae){e.registerBinding(ae,"transitionend",A),e.registerBinding(ae,"animationend",A),e.registerBinding(ae,"scroll",A)}),e.registerBinding(e.container,"contextmenu",function(ae){ae.preventDefault()});var C=function(){return e.selection[4]!==0},E=function(L){for(var J=e.findContainerClientCoords(),ne=J[0],se=J[1],oe=J[2],me=J[3],ce=L.touches?L.touches:[L],he=!1,Ee=0;Ee<ce.length;Ee++){var Ce=ce[Ee];if(ne<=Ce.clientX&&Ce.clientX<=ne+oe&&se<=Ce.clientY&&Ce.clientY<=se+me){he=!0;break}}if(!he)return!1;for(var we=e.container,Ae=L.target,xe=Ae.parentNode,ke=!1;xe;){if(xe===we){ke=!0;break}xe=xe.parentNode}return!!ke};e.registerBinding(e.container,"mousedown",function(L){if(E(L)&&!(e.hoverData.which===1&&L.which!==1)){L.preventDefault(),x(),e.hoverData.capture=!0,e.hoverData.which=L.which;var J=e.cy,ne=[L.clientX,L.clientY],se=e.projectIntoViewport(ne[0],ne[1]),oe=e.selection,me=e.findNearestElements(se[0],se[1],!0,!1),ce=me[0],he=e.dragData.possibleDragElements;e.hoverData.mdownPos=se,e.hoverData.mdownGPos=ne;var Ee=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var Ke=e.hoverData.down;Ke?Ke.emit({originalEvent:L,type:"taphold",position:{x:se[0],y:se[1]}}):J.emit({originalEvent:L,type:"taphold",position:{x:se[0],y:se[1]}})}},e.tapholdDuration)};if(L.which==3){e.hoverData.cxtStarted=!0;var Ce={originalEvent:L,type:"cxttapstart",position:{x:se[0],y:se[1]}};ce?(ce.activate(),ce.emit(Ce),e.hoverData.down=ce):J.emit(Ce),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(L.which==1){ce&&ce.activate();{if(ce!=null&&e.nodeIsGrabbable(ce)){var we=function(Ke){return{originalEvent:L,type:Ke,position:{x:se[0],y:se[1]}}},Ae=function(Ke){Ke.emit(we("grab"))};if(f(ce),!ce.selected())he=e.dragData.possibleDragElements=J.collection(),v(ce,{addToList:he}),ce.emit(we("grabon")).emit(we("grab"));else{he=e.dragData.possibleDragElements=J.collection();var xe=J.$(function(ke){return ke.isNode()&&ke.selected()&&e.nodeIsGrabbable(ke)});h(xe,{addToList:he}),ce.emit(we("grabon")),xe.forEach(Ae)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=ce,e.hoverData.downs=me,e.hoverData.downTime=new Date().getTime()}i(ce,["mousedown","tapstart","vmousedown"],L,{x:se[0],y:se[1]}),ce==null?(oe[4]=1,e.data.bgActivePosistion={x:se[0],y:se[1]},e.redrawHint("select",!0),e.redraw()):ce.pannable()&&(oe[4]=1),Ee()}oe[0]=oe[2]=se[0],oe[1]=oe[3]=se[1]}},!1),e.registerBinding(t,"mousemove",function(L){var J=e.hoverData.capture;if(!(!J&&!E(L))){var ne=!1,se=e.cy,oe=se.zoom(),me=[L.clientX,L.clientY],ce=e.projectIntoViewport(me[0],me[1]),he=e.hoverData.mdownPos,Ee=e.hoverData.mdownGPos,Ce=e.selection,we=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(we=e.findNearestElement(ce[0],ce[1],!0,!1));var Ae=e.hoverData.last,xe=e.hoverData.down,ke=[ce[0]-Ce[2],ce[1]-Ce[3]],Ke=e.dragData.possibleDragElements,Pe;if(Ee){var je=me[0]-Ee[0],tt=je*je,qe=me[1]-Ee[1],pt=qe*qe,ut=tt+pt;e.hoverData.isOverThresholdDrag=Pe=ut>=e.desktopTapThreshold2}var lt=n(L);Pe&&(e.hoverData.tapholdCancelled=!0);var bt=function(){var ue=e.hoverData.dragDelta=e.hoverData.dragDelta||[];ue.length===0?(ue.push(ke[0]),ue.push(ke[1])):(ue[0]+=ke[0],ue[1]+=ke[1])};ne=!0,i(we,["mousemove","vmousemove","tapdrag"],L,{x:ce[0],y:ce[1]});var xt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||se.emit({originalEvent:L,type:"boxstart",position:{x:ce[0],y:ce[1]}}),Ce[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Pe){var kt={originalEvent:L,type:"cxtdrag",position:{x:ce[0],y:ce[1]}};xe?xe.emit(kt):se.emit(kt),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||we!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:L,type:"cxtdragout",position:{x:ce[0],y:ce[1]}}),e.hoverData.cxtOver=we,we&&we.emit({originalEvent:L,type:"cxtdragover",position:{x:ce[0],y:ce[1]}}))}}else if(e.hoverData.dragging){if(ne=!0,se.panningEnabled()&&se.userPanningEnabled()){var at;if(e.hoverData.justStartedPan){var rt=e.hoverData.mdownPos;at={x:(ce[0]-rt[0])*oe,y:(ce[1]-rt[1])*oe},e.hoverData.justStartedPan=!1}else at={x:ke[0]*oe,y:ke[1]*oe};se.panBy(at),se.emit("dragpan"),e.hoverData.dragged=!0}ce=e.projectIntoViewport(L.clientX,L.clientY)}else if(Ce[4]==1&&(xe==null||xe.pannable())){if(Pe){if(!e.hoverData.dragging&&se.boxSelectionEnabled()&&(lt||!se.panningEnabled()||!se.userPanningEnabled()))xt();else if(!e.hoverData.selecting&&se.panningEnabled()&&se.userPanningEnabled()){var wt=a(xe,e.hoverData.downs);wt&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ce[4]=0,e.data.bgActivePosistion=Kn(he),e.redrawHint("select",!0),e.redraw())}xe&&xe.pannable()&&xe.active()&&xe.unactivate()}}else{if(xe&&xe.pannable()&&xe.active()&&xe.unactivate(),(!xe||!xe.grabbed())&&we!=Ae&&(Ae&&i(Ae,["mouseout","tapdragout"],L,{x:ce[0],y:ce[1]}),we&&i(we,["mouseover","tapdragover"],L,{x:ce[0],y:ce[1]}),e.hoverData.last=we),xe)if(Pe){if(se.boxSelectionEnabled()&<)xe&&xe.grabbed()&&(b(Ke),xe.emit("freeon"),Ke.emit("free"),e.dragData.didDrag&&(xe.emit("dragfreeon"),Ke.emit("dragfree"))),xt();else if(xe&&xe.grabbed()&&e.nodeIsDraggable(xe)){var it=!e.dragData.didDrag;it&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||h(Ke,{inDragLayer:!0});var dt={x:0,y:0};if(ve(ke[0])&&ve(ke[1])&&(dt.x+=ke[0],dt.y+=ke[1],it)){var St=e.hoverData.dragDelta;St&&ve(St[0])&&ve(St[1])&&(dt.x+=St[0],dt.y+=St[1])}e.hoverData.draggingEles=!0,Ke.silentShift(dt).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else bt();ne=!0}if(Ce[2]=ce[0],Ce[3]=ce[1],ne)return L.stopPropagation&&L.stopPropagation(),L.preventDefault&&L.preventDefault(),!1}},!1);var I,T,D;e.registerBinding(t,"mouseup",function(L){if(!(e.hoverData.which===1&&L.which!==1&&e.hoverData.capture)){var J=e.hoverData.capture;if(J){e.hoverData.capture=!1;var ne=e.cy,se=e.projectIntoViewport(L.clientX,L.clientY),oe=e.selection,me=e.findNearestElement(se[0],se[1],!0,!1),ce=e.dragData.possibleDragElements,he=e.hoverData.down,Ee=n(L);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,he&&he.unactivate(),e.hoverData.which===3){var Ce={originalEvent:L,type:"cxttapend",position:{x:se[0],y:se[1]}};if(he?he.emit(Ce):ne.emit(Ce),!e.hoverData.cxtDragged){var we={originalEvent:L,type:"cxttap",position:{x:se[0],y:se[1]}};he?he.emit(we):ne.emit(we)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(me,["mouseup","tapend","vmouseup"],L,{x:se[0],y:se[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(he,["click","tap","vclick"],L,{x:se[0],y:se[1]}),T=!1,L.timeStamp-D<=ne.multiClickDebounceTime()?(I&&clearTimeout(I),T=!0,D=null,i(he,["dblclick","dbltap","vdblclick"],L,{x:se[0],y:se[1]})):(I=setTimeout(function(){T||i(he,["oneclick","onetap","voneclick"],L,{x:se[0],y:se[1]})},ne.multiClickDebounceTime()),D=L.timeStamp)),he==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!n(L)&&(ne.$(r).unselect(["tapunselect"]),ce.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=ce=ne.collection()),me==he&&!e.dragData.didDrag&&!e.hoverData.selecting&&me!=null&&me._private.selectable&&(e.hoverData.dragging||(ne.selectionType()==="additive"||Ee?me.selected()?me.unselect(["tapunselect"]):me.select(["tapselect"]):Ee||(ne.$(r).unmerge(me).unselect(["tapunselect"]),me.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var Ae=ne.collection(e.getAllInBox(oe[0],oe[1],oe[2],oe[3]));e.redrawHint("select",!0),Ae.length>0&&e.redrawHint("eles",!0),ne.emit({type:"boxend",originalEvent:L,position:{x:se[0],y:se[1]}});var xe=function(Pe){return Pe.selectable()&&!Pe.selected()};ne.selectionType()==="additive"||Ee||ne.$(r).unmerge(Ae).unselect(),Ae.emit("box").stdFilter(xe).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!oe[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var ke=he&&he.grabbed();b(ce),ke&&(he.emit("freeon"),ce.emit("free"),e.dragData.didDrag&&(he.emit("dragfreeon"),ce.emit("dragfree")))}}oe[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var P=function(L){if(!e.scrollingPage){var J=e.cy,ne=J.zoom(),se=J.pan(),oe=e.projectIntoViewport(L.clientX,L.clientY),me=[oe[0]*ne+se.x,oe[1]*ne+se.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||C()){L.preventDefault();return}if(J.panningEnabled()&&J.userPanningEnabled()&&J.zoomingEnabled()&&J.userZoomingEnabled()){L.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var ce;L.deltaY!=null?ce=L.deltaY/-250:L.wheelDeltaY!=null?ce=L.wheelDeltaY/1e3:ce=L.wheelDelta/1e3,ce=ce*e.wheelSensitivity;var he=L.deltaMode===1;he&&(ce*=33);var Ee=J.zoom()*Math.pow(10,ce);L.type==="gesturechange"&&(Ee=e.gestureStartZoom*L.scale),J.zoom({level:Ee,renderedPosition:{x:me[0],y:me[1]}}),J.emit(L.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",P,!0),e.registerBinding(t,"scroll",function(L){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(L){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||L.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(ae){e.hasTouchStarted||P(ae)},!0),e.registerBinding(e.container,"mouseout",function(L){var J=e.projectIntoViewport(L.clientX,L.clientY);e.cy.emit({originalEvent:L,type:"mouseout",position:{x:J[0],y:J[1]}})},!1),e.registerBinding(e.container,"mouseover",function(L){var J=e.projectIntoViewport(L.clientX,L.clientY);e.cy.emit({originalEvent:L,type:"mouseover",position:{x:J[0],y:J[1]}})},!1);var B,V,M,R,F,q,H,$,U,K,Q,X,W,ee=function(L,J,ne,se){return Math.sqrt((ne-L)*(ne-L)+(se-J)*(se-J))},Y=function(L,J,ne,se){return(ne-L)*(ne-L)+(se-J)*(se-J)},G;e.registerBinding(e.container,"touchstart",G=function(L){if(e.hasTouchStarted=!0,!!E(L)){x(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var J=e.cy,ne=e.touchData.now,se=e.touchData.earlier;if(L.touches[0]){var oe=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);ne[0]=oe[0],ne[1]=oe[1]}if(L.touches[1]){var oe=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);ne[2]=oe[0],ne[3]=oe[1]}if(L.touches[2]){var oe=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);ne[4]=oe[0],ne[5]=oe[1]}if(L.touches[1]){e.touchData.singleTouchMoved=!0,b(e.dragData.touchDragEles);var me=e.findContainerClientCoords();U=me[0],K=me[1],Q=me[2],X=me[3],B=L.touches[0].clientX-U,V=L.touches[0].clientY-K,M=L.touches[1].clientX-U,R=L.touches[1].clientY-K,W=0<=B&&B<=Q&&0<=M&&M<=Q&&0<=V&&V<=X&&0<=R&&R<=X;var ce=J.pan(),he=J.zoom();F=ee(B,V,M,R),q=Y(B,V,M,R),H=[(B+M)/2,(V+R)/2],$=[(H[0]-ce.x)/he,(H[1]-ce.y)/he];var Ee=200,Ce=Ee*Ee;if(q<Ce&&!L.touches[2]){var we=e.findNearestElement(ne[0],ne[1],!0,!0),Ae=e.findNearestElement(ne[2],ne[3],!0,!0);we&&we.isNode()?(we.activate().emit({originalEvent:L,type:"cxttapstart",position:{x:ne[0],y:ne[1]}}),e.touchData.start=we):Ae&&Ae.isNode()?(Ae.activate().emit({originalEvent:L,type:"cxttapstart",position:{x:ne[0],y:ne[1]}}),e.touchData.start=Ae):J.emit({originalEvent:L,type:"cxttapstart",position:{x:ne[0],y:ne[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(L.touches[2])J.boxSelectionEnabled()&&L.preventDefault();else if(!L.touches[1]){if(L.touches[0]){var xe=e.findNearestElements(ne[0],ne[1],!0,!0),ke=xe[0];if(ke!=null&&(ke.activate(),e.touchData.start=ke,e.touchData.starts=xe,e.nodeIsGrabbable(ke))){var Ke=e.dragData.touchDragEles=J.collection(),Pe=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ke.selected()?(Pe=J.$(function(ut){return ut.selected()&&e.nodeIsGrabbable(ut)}),h(Pe,{addToList:Ke})):v(ke,{addToList:Ke}),f(ke);var je=function(lt){return{originalEvent:L,type:lt,position:{x:ne[0],y:ne[1]}}};ke.emit(je("grabon")),Pe?Pe.forEach(function(ut){ut.emit(je("grab"))}):ke.emit(je("grab"))}i(ke,["touchstart","tapstart","vmousedown"],L,{x:ne[0],y:ne[1]}),ke==null&&(e.data.bgActivePosistion={x:oe[0],y:oe[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&i(e.touchData.start,["taphold"],L,{x:ne[0],y:ne[1]})},e.tapholdDuration)}}if(L.touches.length>=1){for(var tt=e.touchData.startPosition=[null,null,null,null,null,null],qe=0;qe<ne.length;qe++)tt[qe]=se[qe]=ne[qe];var pt=L.touches[0];e.touchData.startGPosition=[pt.clientX,pt.clientY]}}},!1);var te;e.registerBinding(t,"touchmove",te=function(L){var J=e.touchData.capture;if(!(!J&&!E(L))){var ne=e.selection,se=e.cy,oe=e.touchData.now,me=e.touchData.earlier,ce=se.zoom();if(L.touches[0]){var he=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);oe[0]=he[0],oe[1]=he[1]}if(L.touches[1]){var he=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);oe[2]=he[0],oe[3]=he[1]}if(L.touches[2]){var he=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);oe[4]=he[0],oe[5]=he[1]}var Ee=e.touchData.startGPosition,Ce;if(J&&L.touches[0]&&Ee){for(var we=[],Ae=0;Ae<oe.length;Ae++)we[Ae]=oe[Ae]-me[Ae];var xe=L.touches[0].clientX-Ee[0],ke=xe*xe,Ke=L.touches[0].clientY-Ee[1],Pe=Ke*Ke,je=ke+Pe;Ce=je>=e.touchTapThreshold2}if(J&&e.touchData.cxt){L.preventDefault();var tt=L.touches[0].clientX-U,qe=L.touches[0].clientY-K,pt=L.touches[1].clientX-U,ut=L.touches[1].clientY-K,lt=Y(tt,qe,pt,ut),bt=lt/q,xt=150,kt=xt*xt,at=1.5,rt=at*at;if(bt>=rt||lt>=kt){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var wt={originalEvent:L,type:"cxttapend",position:{x:oe[0],y:oe[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(wt),e.touchData.start=null):se.emit(wt)}}if(J&&e.touchData.cxt){var wt={originalEvent:L,type:"cxtdrag",position:{x:oe[0],y:oe[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(wt):se.emit(wt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var it=e.findNearestElement(oe[0],oe[1],!0,!0);(!e.touchData.cxtOver||it!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:L,type:"cxtdragout",position:{x:oe[0],y:oe[1]}}),e.touchData.cxtOver=it,it&&it.emit({originalEvent:L,type:"cxtdragover",position:{x:oe[0],y:oe[1]}}))}else if(J&&L.touches[2]&&se.boxSelectionEnabled())L.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||se.emit({originalEvent:L,type:"boxstart",position:{x:oe[0],y:oe[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,ne[4]=1,!ne||ne.length===0||ne[0]===void 0?(ne[0]=(oe[0]+oe[2]+oe[4])/3,ne[1]=(oe[1]+oe[3]+oe[5])/3,ne[2]=(oe[0]+oe[2]+oe[4])/3+1,ne[3]=(oe[1]+oe[3]+oe[5])/3+1):(ne[2]=(oe[0]+oe[2]+oe[4])/3,ne[3]=(oe[1]+oe[3]+oe[5])/3),e.redrawHint("select",!0),e.redraw();else if(J&&L.touches[1]&&!e.touchData.didSelect&&se.zoomingEnabled()&&se.panningEnabled()&&se.userZoomingEnabled()&&se.userPanningEnabled()){L.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var dt=e.dragData.touchDragEles;if(dt){e.redrawHint("drag",!0);for(var St=0;St<dt.length;St++){var Li=dt[St]._private;Li.grabbed=!1,Li.rscratch.inDragLayer=!1}}var ue=e.touchData.start,tt=L.touches[0].clientX-U,qe=L.touches[0].clientY-K,pt=L.touches[1].clientX-U,ut=L.touches[1].clientY-K,ye=ee(tt,qe,pt,ut),Re=ye/F;if(W){var We=tt-B,Ur=qe-V,Mi=pt-M,Ta=ut-R,si=(We+Mi)/2,pr=(Ur+Ta)/2,$i=se.zoom(),rp=$i*Re,Wl=se.pan(),Ob=$[0]*$i+Wl.x,Nb=$[1]*$i+Wl.y,r8={x:-rp/$i*(Ob-Wl.x-si)+Ob,y:-rp/$i*(Nb-Wl.y-pr)+Nb};if(ue&&ue.active()){var dt=e.dragData.touchDragEles;b(dt),e.redrawHint("drag",!0),e.redrawHint("eles",!0),ue.unactivate().emit("freeon"),dt.emit("free"),e.dragData.didDrag&&(ue.emit("dragfreeon"),dt.emit("dragfree"))}se.viewport({zoom:rp,pan:r8,cancelOnFailedZoom:!0}),se.emit("pinchzoom"),F=ye,B=tt,V=qe,M=pt,R=ut,e.pinching=!0}if(L.touches[0]){var he=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);oe[0]=he[0],oe[1]=he[1]}if(L.touches[1]){var he=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);oe[2]=he[0],oe[3]=he[1]}if(L.touches[2]){var he=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);oe[4]=he[0],oe[5]=he[1]}}else if(L.touches[0]&&!e.touchData.didSelect){var Er=e.touchData.start,ip=e.touchData.last,it;if(!e.hoverData.draggingEles&&!e.swipePanning&&(it=e.findNearestElement(oe[0],oe[1],!0,!0)),J&&Er!=null&&L.preventDefault(),J&&Er!=null&&e.nodeIsDraggable(Er))if(Ce){var dt=e.dragData.touchDragEles,Db=!e.dragData.didDrag;Db&&h(dt,{inDragLayer:!0}),e.dragData.didDrag=!0;var Ws={x:0,y:0};if(ve(we[0])&&ve(we[1])&&(Ws.x+=we[0],Ws.y+=we[1],Db)){e.redrawHint("eles",!0);var Cr=e.touchData.dragDelta;Cr&&ve(Cr[0])&&ve(Cr[1])&&(Ws.x+=Cr[0],Ws.y+=Cr[1])}e.hoverData.draggingEles=!0,dt.silentShift(Ws).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==me[0]&&e.touchData.startPosition[1]==me[1]&&e.redrawHint("eles",!0),e.redraw()}else{var Cr=e.touchData.dragDelta=e.touchData.dragDelta||[];Cr.length===0?(Cr.push(we[0]),Cr.push(we[1])):(Cr[0]+=we[0],Cr[1]+=we[1])}if(i(Er||it,["touchmove","tapdrag","vmousemove"],L,{x:oe[0],y:oe[1]}),(!Er||!Er.grabbed())&&it!=ip&&(ip&&ip.emit({originalEvent:L,type:"tapdragout",position:{x:oe[0],y:oe[1]}}),it&&it.emit({originalEvent:L,type:"tapdragover",position:{x:oe[0],y:oe[1]}})),e.touchData.last=it,J)for(var St=0;St<oe.length;St++)oe[St]&&e.touchData.startPosition[St]&&Ce&&(e.touchData.singleTouchMoved=!0);if(J&&(Er==null||Er.pannable())&&se.panningEnabled()&&se.userPanningEnabled()){var i8=a(Er,e.touchData.starts);i8&&(L.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Kn(e.touchData.startPosition)),e.swipePanning?(se.panBy({x:we[0]*ce,y:we[1]*ce}),se.emit("dragpan")):Ce&&(e.swipePanning=!0,se.panBy({x:xe*ce,y:Ke*ce}),se.emit("dragpan"),Er&&(Er.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var he=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);oe[0]=he[0],oe[1]=he[1]}}for(var Ae=0;Ae<oe.length;Ae++)me[Ae]=oe[Ae];J&&L.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var re;e.registerBinding(t,"touchcancel",re=function(L){var J=e.touchData.start;e.touchData.capture=!1,J&&J.unactivate()});var fe,ge,de,pe;if(e.registerBinding(t,"touchend",fe=function(L){var J=e.touchData.start,ne=e.touchData.capture;if(ne)L.touches.length===0&&(e.touchData.capture=!1),L.preventDefault();else return;var se=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var oe=e.cy,me=oe.zoom(),ce=e.touchData.now,he=e.touchData.earlier;if(L.touches[0]){var Ee=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);ce[0]=Ee[0],ce[1]=Ee[1]}if(L.touches[1]){var Ee=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);ce[2]=Ee[0],ce[3]=Ee[1]}if(L.touches[2]){var Ee=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);ce[4]=Ee[0],ce[5]=Ee[1]}J&&J.unactivate();var Ce;if(e.touchData.cxt){if(Ce={originalEvent:L,type:"cxttapend",position:{x:ce[0],y:ce[1]}},J?J.emit(Ce):oe.emit(Ce),!e.touchData.cxtDragged){var we={originalEvent:L,type:"cxttap",position:{x:ce[0],y:ce[1]}};J?J.emit(we):oe.emit(we)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!L.touches[2]&&oe.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var Ae=oe.collection(e.getAllInBox(se[0],se[1],se[2],se[3]));se[0]=void 0,se[1]=void 0,se[2]=void 0,se[3]=void 0,se[4]=0,e.redrawHint("select",!0),oe.emit({type:"boxend",originalEvent:L,position:{x:ce[0],y:ce[1]}});var xe=function(kt){return kt.selectable()&&!kt.selected()};Ae.emit("box").stdFilter(xe).select().emit("boxselect"),Ae.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(J!=null&&J.unactivate(),L.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!L.touches[1]){if(!L.touches[0]){if(!L.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ke=e.dragData.touchDragEles;if(J!=null){var Ke=J._private.grabbed;b(ke),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Ke&&(J.emit("freeon"),ke.emit("free"),e.dragData.didDrag&&(J.emit("dragfreeon"),ke.emit("dragfree"))),i(J,["touchend","tapend","vmouseup","tapdragout"],L,{x:ce[0],y:ce[1]}),J.unactivate(),e.touchData.start=null}else{var Pe=e.findNearestElement(ce[0],ce[1],!0,!0);i(Pe,["touchend","tapend","vmouseup","tapdragout"],L,{x:ce[0],y:ce[1]})}var je=e.touchData.startPosition[0]-ce[0],tt=je*je,qe=e.touchData.startPosition[1]-ce[1],pt=qe*qe,ut=tt+pt,lt=ut*me*me;e.touchData.singleTouchMoved||(J||oe.$(":selected").unselect(["tapunselect"]),i(J,["tap","vclick"],L,{x:ce[0],y:ce[1]}),ge=!1,L.timeStamp-pe<=oe.multiClickDebounceTime()?(de&&clearTimeout(de),ge=!0,pe=null,i(J,["dbltap","vdblclick"],L,{x:ce[0],y:ce[1]})):(de=setTimeout(function(){ge||i(J,["onetap","voneclick"],L,{x:ce[0],y:ce[1]})},oe.multiClickDebounceTime()),pe=L.timeStamp)),J!=null&&!e.dragData.didDrag&&J._private.selectable&<<e.touchTapThreshold2&&!e.pinching&&(oe.selectionType()==="single"?(oe.$(r).unmerge(J).unselect(["tapunselect"]),J.select(["tapselect"])):J.selected()?J.unselect(["tapunselect"]):J.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}}}for(var bt=0;bt<ce.length;bt++)he[bt]=ce[bt];e.dragData.didDrag=!1,L.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),L.touches.length<2&&(L.touches.length===1&&(e.touchData.startGPosition=[L.touches[0].clientX,L.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var z=[],O=function(L){return{clientX:L.clientX,clientY:L.clientY,force:1,identifier:L.pointerId,pageX:L.pageX,pageY:L.pageY,radiusX:L.width/2,radiusY:L.height/2,screenX:L.screenX,screenY:L.screenY,target:L.target}},N=function(L){return{event:L,touch:O(L)}},j=function(L){z.push(N(L))},Z=function(L){for(var J=0;J<z.length;J++){var ne=z[J];if(ne.event.pointerId===L.pointerId){z.splice(J,1);return}}},ie=function(L){var J=z.filter(function(ne){return ne.event.pointerId===L.pointerId})[0];J.event=L,J.touch=O(L)},le=function(L){L.touches=z.map(function(J){return J.touch})},be=function(L){return L.pointerType==="mouse"||L.pointerType===4};e.registerBinding(e.container,"pointerdown",function(ae){be(ae)||(ae.preventDefault(),j(ae),le(ae),G(ae))}),e.registerBinding(e.container,"pointerup",function(ae){be(ae)||(Z(ae),le(ae),fe(ae))}),e.registerBinding(e.container,"pointercancel",function(ae){be(ae)||(Z(ae),le(ae),re(ae))}),e.registerBinding(e.container,"pointermove",function(ae){be(ae)||(ae.preventDefault(),ie(ae),le(ae),te(ae))})}};var ri={};ri.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(i,n,a,s,o,u){this.renderer.nodeShapeImpl("polygon",i,n,a,s,o,this.points)},intersectLine:function(i,n,a,s,o,u,c,f){return hs(o,u,this.points,i,n,a/2,s/2,c)},checkPoint:function(i,n,a,s,o,u,c,f){return Qr(i,n,this.points,u,c,s,o,[0,-1],a)}}},ri.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(t,r,i,n,a,s){this.renderer.nodeShapeImpl(this.name,t,r,i,n,a)},intersectLine:function(t,r,i,n,a,s,o,u){return ZN(a,s,t,r,i/2+o,n/2+o)},checkPoint:function(t,r,i,n,a,s,o,u){return an(t,r,n,a,s,o,i)}}},ri.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(i,n,a,s,o,u,c){if(u[c]!==void 0&&u[c+"-cx"]===i&&u[c+"-cy"]===n)return u[c];u[c]=new Array(t.length/2),u[c+"-cx"]=i,u[c+"-cy"]=n;var f=a/2,p=s/2;o=o==="auto"?Bm(a,s):o;for(var d=new Array(t.length/2),g=0;g<t.length/2;g++)d[g]={x:i+f*t[g*2],y:n+p*t[g*2+1]};var h,v,b,y,x=d.length;for(v=d[x-1],h=0;h<x;h++)b=d[h%x],y=d[(h+1)%x],u[c][h]=Hc(v,b,y,o),v=b,b=y;return u[c]},draw:function(i,n,a,s,o,u,c){this.renderer.nodeShapeImpl("round-polygon",i,n,a,s,o,this.points,this.getOrCreateCorners(n,a,s,o,u,c,"drawCorners"))},intersectLine:function(i,n,a,s,o,u,c,f,p){return JN(o,u,this.points,i,n,a,s,c,this.getOrCreateCorners(i,n,a,s,f,p,"corners"))},checkPoint:function(i,n,a,s,o,u,c,f,p){return YN(i,n,this.points,u,c,s,o,this.getOrCreateCorners(u,c,s,o,f,p,"corners"))}}},ri.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Gt(4,0),draw:function(t,r,i,n,a,s){this.renderer.nodeShapeImpl(this.name,t,r,i,n,a,this.points,s)},intersectLine:function(t,r,i,n,a,s,o,u){return Nm(a,s,t,r,i,n,o,u)},checkPoint:function(t,r,i,n,a,s,o,u){var c=n/2,f=a/2;u=u==="auto"?sn(n,a):u,u=Math.min(c,f,u);var p=u*2;return!!(Qr(t,r,this.points,s,o,n,a-p,[0,-1],i)||Qr(t,r,this.points,s,o,n-p,a,[0,-1],i)||an(t,r,p,p,s-c+u,o-f+u,i)||an(t,r,p,p,s+c-u,o-f+u,i)||an(t,r,p,p,s+c-u,o+f-u,i)||an(t,r,p,p,s-c+u,o+f-u,i))}}},ri.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:gc(),points:Gt(4,0),draw:function(t,r,i,n,a,s){this.renderer.nodeShapeImpl(this.name,t,r,i,n,a,null,s)},generateCutTrianglePts:function(t,r,i,n,a){var s=a==="auto"?this.cornerLength:a,o=r/2,u=t/2,c=i-u,f=i+u,p=n-o,d=n+o;return{topLeft:[c,p+s,c+s,p,c+s,p+s],topRight:[f-s,p,f,p+s,f-s,p+s],bottomRight:[f,d-s,f-s,d,f-s,d-s],bottomLeft:[c+s,d,c,d-s,c+s,d-s]}},intersectLine:function(t,r,i,n,a,s,o,u){var c=this.generateCutTrianglePts(i+2*o,n+2*o,t,r,u),f=[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]);return hs(a,s,f,t,r)},checkPoint:function(t,r,i,n,a,s,o,u){var c=u==="auto"?this.cornerLength:u;if(Qr(t,r,this.points,s,o,n,a-2*c,[0,-1],i)||Qr(t,r,this.points,s,o,n-2*c,a,[0,-1],i))return!0;var f=this.generateCutTrianglePts(n,a,s,o);return Qt(t,r,f.topLeft)||Qt(t,r,f.topRight)||Qt(t,r,f.bottomRight)||Qt(t,r,f.bottomLeft)}}},ri.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Gt(4,0),draw:function(t,r,i,n,a,s){this.renderer.nodeShapeImpl(this.name,t,r,i,n,a)},intersectLine:function(t,r,i,n,a,s,o,u){var c=.15,f=.5,p=.85,d=this.generateBarrelBezierPts(i+2*o,n+2*o,t,r),g=function(b){var y=Wn({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},c),x=Wn({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},f),w=Wn({x:b[0],y:b[1]},{x:b[2],y:b[3]},{x:b[4],y:b[5]},p);return[b[0],b[1],y.x,y.y,x.x,x.y,w.x,w.y,b[4],b[5]]},h=[].concat(g(d.topLeft),g(d.topRight),g(d.bottomRight),g(d.bottomLeft));return hs(a,s,h,t,r)},generateBarrelBezierPts:function(t,r,i,n){var a=r/2,s=t/2,o=i-s,u=i+s,c=n-a,f=n+a,p=vc(t,r),d=p.heightOffset,g=p.widthOffset,h=p.ctrlPtOffsetPct*t,v={topLeft:[o,c+d,o+h,c,o+g,c],topRight:[u-g,c,u-h,c,u,c+d],bottomRight:[u,f-d,u-h,f,u-g,f],bottomLeft:[o+g,f,o+h,f,o,f-d]};return v.topLeft.isTop=!0,v.topRight.isTop=!0,v.bottomLeft.isBottom=!0,v.bottomRight.isBottom=!0,v},checkPoint:function(t,r,i,n,a,s,o,u){var c=vc(n,a),f=c.heightOffset,p=c.widthOffset;if(Qr(t,r,this.points,s,o,n,a-2*f,[0,-1],i)||Qr(t,r,this.points,s,o,n-2*p,a,[0,-1],i))return!0;for(var d=this.generateBarrelBezierPts(n,a,s,o),g=function(C,E,I){var T=I[4],D=I[2],P=I[0],B=I[5],V=I[1],M=Math.min(T,P),R=Math.max(T,P),F=Math.min(B,V),q=Math.max(B,V);if(M<=C&&C<=R&&F<=E&&E<=q){var H=QN(T,D,P),$=GN(H[0],H[1],H[2],C),U=$.filter(function(K){return 0<=K&&K<=1});if(U.length>0)return U[0]}return null},h=Object.keys(d),v=0;v<h.length;v++){var b=h[v],y=d[b],x=g(t,r,y);if(x!=null){var w=y[5],_=y[3],k=y[1],S=Et(w,_,k,x);if(y.isTop&&S<=r||y.isBottom&&r<=S)return!0}}return!1}}},ri.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Gt(4,0),draw:function(t,r,i,n,a,s){this.renderer.nodeShapeImpl(this.name,t,r,i,n,a,this.points,s)},intersectLine:function(t,r,i,n,a,s,o,u){var c=t-(i/2+o),f=r-(n/2+o),p=f,d=t+(i/2+o),g=Ei(a,s,t,r,c,f,d,p,!1);return g.length>0?g:Nm(a,s,t,r,i,n,o,u)},checkPoint:function(t,r,i,n,a,s,o,u){u=u==="auto"?sn(n,a):u;var c=2*u;if(Qr(t,r,this.points,s,o,n,a-c,[0,-1],i)||Qr(t,r,this.points,s,o,n-c,a,[0,-1],i))return!0;var f=n/2+2*i,p=a/2+2*i,d=[s-f,o-p,s-f,o,s+f,o,s+f,o-p];return!!(Qt(t,r,d)||an(t,r,c,c,s+n/2-u,o+a/2-u,i)||an(t,r,c,c,s-n/2+u,o+a/2-u,i))}}},ri.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Gt(3,0)),this.generateRoundPolygon("round-triangle",Gt(3,0)),this.generatePolygon("rectangle",Gt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",Gt(5,0)),this.generateRoundPolygon("round-pentagon",Gt(5,0)),this.generatePolygon("hexagon",Gt(6,0)),this.generateRoundPolygon("round-hexagon",Gt(6,0)),this.generatePolygon("heptagon",Gt(7,0)),this.generateRoundPolygon("round-heptagon",Gt(7,0)),this.generatePolygon("octagon",Gt(8,0)),this.generateRoundPolygon("round-octagon",Gt(8,0));var i=new Array(20);{var n=mc(5,0),a=mc(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<a.length/2;o++)a[o*2]*=s,a[o*2+1]*=s;for(var o=0;o<20/4;o++)i[o*4]=n[o*2],i[o*4+1]=n[o*2+1],i[o*4+2]=a[o*2],i[o*4+3]=a[o*2+1]}i=Dm(i),this.generatePolygon("star",i),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}e.makePolygon=function(c){var f=c.join("$"),p="polygon-"+f,d;return(d=this[p])?d:t.generatePolygon(p,c)}};var Os={};Os.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},Os.redraw=function(e){e=e||Em();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},Os.beforeRender=function(e,t){if(!this.destroyed){t==null&&st("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:e,priority:t}),r.sort(function(i,n){return n.priority-i.priority})}};var Cv=function(t,r,i){for(var n=t.beforeRenderCallbacks,a=0;a<n.length;a++)n[a].fn(r,i)};Os.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var r=function i(n){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){Cv(e,!0,n);var a=Jr();e.render(e.renderOptions);var s=e.lastDrawTime=Jr();e.averageRedrawTime===void 0&&(e.averageRedrawTime=s-a),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=s-a;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Cv(e,!1,n);e.skipFrame=!1,zo(i)}};zo(r)}};var RP=function(t){this.init(t)},kv=RP,da=kv.prototype;da.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],da.init=function(e){var t=this;t.options=e,t.cy=e.cy;var r=t.container=e.cy.container(),i=t.cy.window();if(i){var n=i.document,a=n.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",u=n.getElementById(s)!=null;if(r.className.indexOf(o)<0&&(r.className=(r.className||"")+" "+o),!u){var c=n.createElement("style");c.id=s,c.textContent="."+o+" { position: relative; }",a.insertBefore(c,a.children[0])}var f=i.getComputedStyle(r),p=f.getPropertyValue("position");p==="static"&&Ve("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=ve(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},da.notify=function(e,t){var r=this,i=r.cy;if(!this.destroyed){if(e==="init"){r.load();return}if(e==="destroy"){r.destroy();return}(e==="add"||e==="remove"||e==="move"&&i.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&r.invalidateCachedZSortedEles(),e==="viewport"&&r.redrawHint("select",!0),(e==="load"||e==="resize"||e==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},da.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var r=e.bindings[t],i=r,n=i.target;(n.off||n.removeEventListener).apply(n,i.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},da.isHeadless=function(){return!1},[zc,_v,Ev,pa,ri,Os].forEach(function(e){Ne(da,e)});var Kc=1e3/60,Sv={setupDequeueing:function(t){return function(){var i=this,n=this.renderer;if(!i.dequeueingSetup){i.dequeueingSetup=!0;var a=$o(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},t.deqRedrawThreshold),s=function(c,f){var p=Jr(),d=n.averageRedrawTime,g=n.lastRedrawTime,h=[],v=n.cy.extent(),b=n.getPixelRatio();for(c||n.flushRenderedStyleQueue();;){var y=Jr(),x=y-p,w=y-f;if(g<Kc){var _=Kc-(c?d:0);if(w>=t.deqFastCost*_)break}else if(c){if(x>=t.deqCost*g||x>=t.deqAvgCost*d)break}else if(w>=t.deqNoDrawCost*Kc)break;var k=t.deq(i,b,v);if(k.length>0)for(var S=0;S<k.length;S++)h.push(k[S]);else break}h.length>0&&(t.onDeqd(i,h),!c&&t.shouldRedraw(i,h,b,v)&&a())},o=t.priority||uc;n.beforeRender(s,o(i))}}}},PP=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uo;rc(this,e),this.idsByKey=new Dr,this.keyForId=new Dr,this.cachesByLvl=new Dr,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=r}return ic(e,[{key:"getIdsFor",value:function(r){r==null&&st("Can not get id list for null key");var i=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new Gn,i.set(r,n)),n}},{key:"addIdForKey",value:function(r,i){r!=null&&this.getIdsFor(r).add(i)}},{key:"deleteIdForKey",value:function(r,i){r!=null&&this.getIdsFor(r).delete(i)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var i=r.id(),n=this.keyForId.get(i),a=this.getKey(r);this.deleteIdForKey(n,i),this.addIdForKey(a,i),this.keyForId.set(i,a)}},{key:"deleteKeyMappingFor",value:function(r){var i=r.id(),n=this.keyForId.get(i);this.deleteIdForKey(n,i),this.keyForId.delete(i)}},{key:"keyHasChangedFor",value:function(r){var i=r.id(),n=this.keyForId.get(i),a=this.getKey(r);return n!==a}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var i=this.cachesByLvl,n=this.lvls,a=i.get(r);return a||(a=new Dr,i.set(r,a),n.push(r)),a}},{key:"getCache",value:function(r,i){return this.getCachesAt(i).get(r)}},{key:"get",value:function(r,i){var n=this.getKey(r),a=this.getCache(n,i);return a!=null&&this.updateKeyMappingFor(r),a}},{key:"getForCachedKey",value:function(r,i){var n=this.keyForId.get(r.id()),a=this.getCache(n,i);return a}},{key:"hasCache",value:function(r,i){return this.getCachesAt(i).has(r)}},{key:"has",value:function(r,i){var n=this.getKey(r);return this.hasCache(n,i)}},{key:"setCache",value:function(r,i,n){n.key=r,this.getCachesAt(i).set(r,n)}},{key:"set",value:function(r,i,n){var a=this.getKey(r);this.setCache(a,i,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,i){this.getCachesAt(i).delete(r)}},{key:"delete",value:function(r,i){var n=this.getKey(r);this.deleteCache(n,i)}},{key:"invalidateKey",value:function(r){var i=this;this.lvls.forEach(function(n){return i.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var i=r.id(),n=this.keyForId.get(i);this.deleteKeyMappingFor(r);var a=this.doesEleInvalidateKey(r);return a&&this.invalidateKey(n),a||this.getNumberOfIdsForKey(n)===0}}]),e}(),Tv=25,Ol=50,Nl=-4,Wc=3,FP=7.99,LP=8,MP=1024,$P=1024,zP=1024,VP=.2,UP=.8,jP=10,qP=.15,HP=.1,GP=.9,KP=.9,WP=100,XP=1,ha={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},YP=Bt({getKey:null,doesEleInvalidateKey:Uo,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:bm,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Ns=function(t,r){var i=this;i.renderer=t,i.onDequeues=[];var n=YP(r);Ne(i,n),i.lookup=new PP(n.getKey,n.doesEleInvalidateKey),i.setupDequeueing()},yt=Ns.prototype;yt.reasons=ha,yt.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},yt.getRetiredTextureQueue=function(e){var t=this,r=t.eleImgCaches.retired=t.eleImgCaches.retired||{},i=r[e]=r[e]||[];return i},yt.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new fs(function(r,i){return i.reqs-r.reqs});return t},yt.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},yt.getElement=function(e,t,r,i,n){var a=this,s=this.renderer,o=s.cy.zoom(),u=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(i==null&&(i=Math.ceil(pc(o*r))),i<Nl)i=Nl;else if(o>=FP||i>Wc)return null;var c=Math.pow(2,i),f=t.h*c,p=t.w*c,d=s.eleTextBiggerThanMin(e,c);if(!this.isVisible(e,d))return null;var g=u.get(e,i);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;var h;if(f<=Tv?h=Tv:f<=Ol?h=Ol:h=Math.ceil(f/Ol)*Ol,f>zP||p>$P)return null;var v=a.getTextureQueue(h),b=v[v.length-2],y=function(){return a.recycleTexture(h,p)||a.addTexture(h,p)};b||(b=v[v.length-1]),b||(b=y()),b.width-b.usedWidth<p&&(b=y());for(var x=function(M){return M&&M.scaledLabelShown===d},w=n&&n===ha.dequeue,_=n&&n===ha.highQuality,k=n&&n===ha.downscale,S,A=i+1;A<=Wc;A++){var C=u.get(e,A);if(C){S=C;break}}var E=S&&S.level===i+1?S:null,I=function(){b.context.drawImage(E.texture.canvas,E.x,0,E.width,E.height,b.usedWidth,0,p,f)};if(b.context.setTransform(1,0,0,1,0,0),b.context.clearRect(b.usedWidth,0,p,h),x(E))I();else if(x(S))if(_){for(var T=S.level;T>i;T--)E=a.getElement(e,t,r,T,ha.downscale);I()}else return a.queueElement(e,S.level-1),S;else{var D;if(!w&&!_&&!k)for(var P=i-1;P>=Nl;P--){var B=u.get(e,P);if(B){D=B;break}}if(x(D))return a.queueElement(e,i),D;b.context.translate(b.usedWidth,0),b.context.scale(c,c),this.drawElement(b.context,e,t,d,!1),b.context.scale(1/c,1/c),b.context.translate(-b.usedWidth,0)}return g={x:b.usedWidth,texture:b,level:i,scale:c,width:p,height:f,scaledLabelShown:d},b.usedWidth+=Math.ceil(p+LP),b.eleCaches.push(g),u.set(e,i,g),a.checkTextureFullness(b),g},yt.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},yt.invalidateElement=function(e){var t=this,r=t.lookup,i=[],n=r.isInvalid(e);if(n){for(var a=Nl;a<=Wc;a++){var s=r.getForCachedKey(e,a);s&&i.push(s)}var o=r.invalidate(e);if(o)for(var u=0;u<i.length;u++){var c=i[u],f=c.texture;f.invalidatedWidth+=c.width,c.invalidated=!0,t.checkTextureUtility(f)}t.removeFromQueue(e)}},yt.checkTextureUtility=function(e){e.invalidatedWidth>=VP*e.width&&this.retireTexture(e)},yt.checkTextureFullness=function(e){var t=this,r=t.getTextureQueue(e.height);e.usedWidth/e.width>UP&&e.fullnessChecks>=jP?wi(r,e):e.fullnessChecks++},yt.retireTexture=function(e){var t=this,r=e.height,i=t.getTextureQueue(r),n=this.lookup;wi(i,e),e.retired=!0;for(var a=e.eleCaches,s=0;s<a.length;s++){var o=a[s];n.deleteCache(o.key,o.level)}cc(a);var u=t.getRetiredTextureQueue(r);u.push(e)},yt.addTexture=function(e,t){var r=this,i=r.getTextureQueue(e),n={};return i.push(n),n.eleCaches=[],n.height=e,n.width=Math.max(MP,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},yt.recycleTexture=function(e,t){for(var r=this,i=r.getTextureQueue(e),n=r.getRetiredTextureQueue(e),a=0;a<n.length;a++){var s=n[a];if(s.width>=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,cc(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),wi(n,s),i.push(s),s}},yt.queueElement=function(e,t){var r=this,i=r.getElementQueue(),n=r.getElementKeyToQueue(),a=this.getKey(e),s=n[a];if(s)s.level=Math.max(s.level,t),s.eles.merge(e),s.reqs++,i.updateItem(s);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};i.push(o),n[a]=o}},yt.dequeue=function(e){for(var t=this,r=t.getElementQueue(),i=t.getElementKeyToQueue(),n=[],a=t.lookup,s=0;s<XP&&r.size()>0;s++){var o=r.pop(),u=o.key,c=o.eles[0],f=a.hasCache(c,o.level);if(i[u]=null,f)continue;n.push(o);var p=t.getBoundingBox(c);t.getElement(c,p,e,o.level,ha.dequeue)}return n},yt.removeFromQueue=function(e){var t=this,r=t.getElementQueue(),i=t.getElementKeyToQueue(),n=this.getKey(e),a=i[n];a!=null&&(a.eles.length===1?(a.reqs=lc,r.updateItem(a),r.pop(),i[n]=null):a.eles.unmerge(e))},yt.onDequeue=function(e){this.onDequeues.push(e)},yt.offDequeue=function(e){wi(this.onDequeues,e)},yt.setupDequeueing=Sv.setupDequeueing({deqRedrawThreshold:WP,deqCost:qP,deqAvgCost:HP,deqNoDrawCost:GP,deqFastCost:KP,deq:function(t,r,i){return t.dequeue(r,i)},onDeqd:function(t,r){for(var i=0;i<t.onDequeues.length;i++){var n=t.onDequeues[i];n(r)}},shouldRedraw:function(t,r,i,n){for(var a=0;a<r.length;a++)for(var s=r[a].eles,o=0;o<s.length;o++){var u=s[o].boundingBox();if(dc(u,n))return!0}return!1},priority:function(t){return t.renderer.beforeRenderPriorities.eleTxrDeq}});var ZP=1,Ds=-4,Dl=2,JP=3.99,QP=50,e4=50,t4=.15,r4=.1,i4=.9,n4=.9,a4=1,Av=250,s4=4e3*4e3,o4=!0,Ov=function(t){var r=this,i=r.renderer=t,n=i.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Jr()-2*Av,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=$o(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},e4),i.beforeRender(function(s,o){o-r.lastInvalidationTime<=Av?r.skipping=!0:r.skipping=!1},i.beforeRenderPriorities.lyrTxrSkip);var a=function(o,u){return u.reqs-o.reqs};r.layersQueue=new fs(a),r.setupDequeueing()},Ft=Ov.prototype,Nv=0,l4=Math.pow(2,53)-1;Ft.makeLayer=function(e,t){var r=Math.pow(2,t),i=Math.ceil(e.w*r),n=Math.ceil(e.h*r),a=this.renderer.makeOffscreenCanvas(i,n),s={id:Nv=++Nv%l4,bb:e,level:t,width:i,height:n,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,u=-s.bb.x1,c=-s.bb.y1;return o.scale(r,r),o.translate(u,c),s},Ft.getLayers=function(e,t,r){var i=this,n=i.renderer,a=n.cy,s=a.zoom(),o=i.firstGet;if(i.firstGet=!1,r==null){if(r=Math.ceil(pc(s*t)),r<Ds)r=Ds;else if(s>=JP||r>Dl)return null}i.validateLayersElesOrdering(r,e);var u=i.layersByLevel,c=Math.pow(2,r),f=u[r]=u[r]||[],p,d=i.levelIsComplete(r,e),g,h=function(){var I=function(V){if(i.validateLayersElesOrdering(V,e),i.levelIsComplete(V,e))return g=u[V],!0},T=function(V){if(!g)for(var M=r+V;Ds<=M&&M<=Dl&&!I(M);M+=V);};T(1),T(-1);for(var D=f.length-1;D>=0;D--){var P=f[D];P.invalid&&wi(f,P)}};if(!d)h();else return f;var v=function(){if(!p){p=Jt();for(var I=0;I<e.length;I++)Tm(p,e[I].boundingBox())}return p},b=function(I){I=I||{};var T=I.after;v();var D=p.w*c*(p.h*c);if(D>s4)return null;var P=i.makeLayer(p,r);if(T!=null){var B=f.indexOf(T)+1;f.splice(B,0,P)}else(I.insert===void 0||I.insert)&&f.unshift(P);return P};if(i.skipping&&!o)return null;for(var y=null,x=e.length/ZP,w=!o,_=0;_<e.length;_++){var k=e[_],S=k._private.rscratch,A=S.imgLayerCaches=S.imgLayerCaches||{},C=A[r];if(C){y=C;continue}if((!y||y.eles.length>=x||!Om(y.bb,k.boundingBox()))&&(y=b({insert:!0,after:y}),!y))return null;g||w?i.queueLayer(y,k):i.drawEleInLayer(y,k,r,t),y.eles.push(k),A[r]=y}return g||(w?null:f)},Ft.getEleLevelForLayerLevel=function(e,t){return e},Ft.drawEleInLayer=function(e,t,r,i){var n=this,a=this.renderer,s=e.context,o=t.boundingBox();o.w===0||o.h===0||!t.visible()||(r=n.getEleLevelForLayerLevel(r,i),a.setImgSmoothing(s,!1),a.drawCachedElement(s,t,null,null,r,o4),a.setImgSmoothing(s,!0))},Ft.levelIsComplete=function(e,t){var r=this,i=r.layersByLevel[e];if(!i||i.length===0)return!1;for(var n=0,a=0;a<i.length;a++){var s=i[a];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===t.length},Ft.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var i=0;i<r.length;i++){for(var n=r[i],a=-1,s=0;s<t.length;s++)if(n.eles[0]===t[s]){a=s;break}if(a<0){this.invalidateLayer(n);continue}for(var o=a,s=0;s<n.eles.length;s++)if(n.eles[s]!==t[o+s]){this.invalidateLayer(n);break}}},Ft.updateElementsInLayers=function(e,t){for(var r=this,i=rs(e[0]),n=0;n<e.length;n++)for(var a=i?null:e[n],s=i?e[n]:e[n].ele,o=s._private.rscratch,u=o.imgLayerCaches=o.imgLayerCaches||{},c=Ds;c<=Dl;c++){var f=u[c];f&&(a&&r.getEleLevelForLayerLevel(f.level)!==a.level||t(f,s,a))}},Ft.haveLayers=function(){for(var e=this,t=!1,r=Ds;r<=Dl;r++){var i=e.layersByLevel[r];if(i&&i.length>0){t=!0;break}}return t},Ft.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Jr(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(i,n,a){t.invalidateLayer(i)}))},Ft.invalidateLayer=function(e){if(this.lastInvalidationTime=Jr(),!e.invalid){var t=e.level,r=e.eles,i=this.layersByLevel[t];wi(i,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var n=0;n<r.length;n++){var a=r[n]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},Ft.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(i,n,a){var s=i.replacement;if(s||(s=i.replacement=t.makeLayer(i.bb,i.level),s.replaces=i,s.eles=i.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)t.queueLayer(s,s.eles[o])})},Ft.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},Ft.queueLayer=function(e,t){var r=this,i=r.layersQueue,n=e.elesQueue,a=n.hasId=n.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;n.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,i.updateItem(e)):(e.reqs=1,i.push(e))}},Ft.dequeue=function(e){for(var t=this,r=t.layersQueue,i=[],n=0;n<a4&&r.size()!==0;){var a=r.peek();if(a.replacement){r.pop();continue}if(a.replaces&&a!==a.replaces.replacement){r.pop();continue}if(a.invalid){r.pop();continue}var s=a.elesQueue.shift();s&&(t.drawEleInLayer(a,s,a.level,e),n++),i.length===0&&i.push(!0),a.elesQueue.length===0&&(r.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}return i},Ft.applyLayerReplacement=function(e){var t=this,r=t.layersByLevel[e.level],i=e.replaces,n=r.indexOf(i);if(!(n<0||i.invalid)){r[n]=e;for(var a=0;a<e.eles.length;a++){var s=e.eles[a]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[e.level]=e)}t.requestRedraw()}},Ft.requestRedraw=$o(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),Ft.setupDequeueing=Sv.setupDequeueing({deqRedrawThreshold:QP,deqCost:t4,deqAvgCost:r4,deqNoDrawCost:i4,deqFastCost:n4,deq:function(t,r){return t.dequeue(r)},onDeqd:uc,shouldRedraw:bm,priority:function(t){return t.renderer.beforeRenderPriorities.lyrTxrDeq}});var Dv={},Bv;function u4(e,t){for(var r=0;r<t.length;r++){var i=t[r];e.lineTo(i.x,i.y)}}function c4(e,t,r){for(var i,n=0;n<t.length;n++){var a=t[n];n===0&&(i=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(r.x,r.y,i.x,i.y)}function Iv(e,t,r){e.beginPath&&e.beginPath();for(var i=t,n=0;n<i.length;n++){var a=i[n];e.lineTo(a.x,a.y)}var s=r,o=r[0];e.moveTo(o.x,o.y);for(var n=1;n<s.length;n++){var a=s[n];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function f4(e,t,r,i,n){e.beginPath&&e.beginPath(),e.arc(r,i,n,0,Math.PI*2,!1);var a=t,s=a[0];e.moveTo(s.x,s.y);for(var o=0;o<a.length;o++){var u=a[o];e.lineTo(u.x,u.y)}e.closePath&&e.closePath()}function p4(e,t,r,i){e.arc(t,r,i,0,Math.PI*2,!1)}Dv.arrowShapeImpl=function(e){return(Bv||(Bv={polygon:u4,"triangle-backcurve":c4,"triangle-tee":Iv,"circle-triangle":f4,"triangle-cross":Iv,circle:p4}))[e]};var Fr={};Fr.drawElement=function(e,t,r,i,n,a){var s=this;t.isNode()?s.drawNode(e,t,r,i,n,a):s.drawEdge(e,t,r,i,n,a)},Fr.drawElementOverlay=function(e,t){var r=this;t.isNode()?r.drawNodeOverlay(e,t):r.drawEdgeOverlay(e,t)},Fr.drawElementUnderlay=function(e,t){var r=this;t.isNode()?r.drawNodeUnderlay(e,t):r.drawEdgeUnderlay(e,t)},Fr.drawCachedElementPortion=function(e,t,r,i,n,a,s,o){var u=this,c=r.getBoundingBox(t);if(!(c.w===0||c.h===0)){var f=r.getElement(t,c,i,n,a);if(f!=null){var p=o(u,t);if(p===0)return;var d=s(u,t),g=c.x1,h=c.y1,v=c.w,b=c.h,y,x,w,_,k;if(d!==0){var S=r.getRotationPoint(t);w=S.x,_=S.y,e.translate(w,_),e.rotate(d),k=u.getImgSmoothing(e),k||u.setImgSmoothing(e,!0);var A=r.getRotationOffset(t);y=A.x,x=A.y}else y=g,x=h;var C;p!==1&&(C=e.globalAlpha,e.globalAlpha=C*p),e.drawImage(f.texture.canvas,f.x,0,f.width,f.height,y,x,v,b),p!==1&&(e.globalAlpha=C),d!==0&&(e.rotate(-d),e.translate(-w,-_),k||u.setImgSmoothing(e,!1))}else r.drawElement(e,t)}};var d4=function(){return 0},h4=function(t,r){return t.getTextAngle(r,null)},m4=function(t,r){return t.getTextAngle(r,"source")},g4=function(t,r){return t.getTextAngle(r,"target")},v4=function(t,r){return r.effectiveOpacity()},Xc=function(t,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Fr.drawCachedElement=function(e,t,r,i,n,a){var s=this,o=s.data,u=o.eleTxrCache,c=o.lblTxrCache,f=o.slbTxrCache,p=o.tlbTxrCache,d=t.boundingBox(),g=a===!0?u.reasons.highQuality:null;if(!(d.w===0||d.h===0||!t.visible())&&(!i||dc(d,i))){var h=t.isEdge(),v=t.element()._private.rscratch.badLine;s.drawElementUnderlay(e,t),s.drawCachedElementPortion(e,t,u,r,n,g,d4,v4),(!h||!v)&&s.drawCachedElementPortion(e,t,c,r,n,g,h4,Xc),h&&!v&&(s.drawCachedElementPortion(e,t,f,r,n,g,m4,Xc),s.drawCachedElementPortion(e,t,p,r,n,g,g4,Xc)),s.drawElementOverlay(e,t)}},Fr.drawElements=function(e,t){for(var r=this,i=0;i<t.length;i++){var n=t[i];r.drawElement(e,n)}},Fr.drawCachedElements=function(e,t,r,i){for(var n=this,a=0;a<t.length;a++){var s=t[a];n.drawCachedElement(e,s,r,i)}},Fr.drawCachedNodes=function(e,t,r,i){for(var n=this,a=0;a<t.length;a++){var s=t[a];s.isNode()&&n.drawCachedElement(e,s,r,i)}},Fr.drawLayeredElements=function(e,t,r,i){var n=this,a=n.data.lyrTxrCache.getLayers(t,r);if(a)for(var s=0;s<a.length;s++){var o=a[s],u=o.bb;u.w===0||u.h===0||e.drawImage(o.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(e,t,r,i)};var ii={};ii.drawEdge=function(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=t._private.rscratch;if(!(a&&!t.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var u;r&&(u=r,e.translate(-u.x1,-u.y1));var c=a?t.pstyle("opacity").value:1,f=a?t.pstyle("line-opacity").value:1,p=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,g=t.pstyle("width").pfValue,h=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,b=t.pstyle("line-outline-color").value,y=c*f,x=c*f,w=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;p==="straight-triangle"?(s.eleStrokeStyle(e,t,V),s.drawEdgeTrianglePath(t,e,o.allpts)):(e.lineWidth=g,e.lineCap=h,s.eleStrokeStyle(e,t,V),s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},_=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(e.lineWidth=g+v,e.lineCap=h,v>0)s.colorStrokeStyle(e,b[0],b[1],b[2],V);else{e.lineCap="butt";return}p==="straight-triangle"?s.drawEdgeTrianglePath(t,e,o.allpts):(s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},k=function(){n&&s.drawEdgeOverlay(e,t)},S=function(){n&&s.drawEdgeUnderlay(e,t)},A=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;s.drawArrowheads(e,t,V)},C=function(){s.drawElementText(e,t,null,i)};e.lineJoin="round";var E=t.pstyle("ghost").value==="yes";if(E){var I=t.pstyle("ghost-offset-x").pfValue,T=t.pstyle("ghost-offset-y").pfValue,D=t.pstyle("ghost-opacity").value,P=y*D;e.translate(I,T),w(P),A(P),e.translate(-I,-T)}else _();S(),w(),A(),k(),C(),r&&e.translate(u.x1,u.y1)}};var Rv=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(r,i){if(i.visible()){var n=i.pstyle("".concat(t,"-opacity")).value;if(n!==0){var a=this,s=a.usePaths(),o=i._private.rscratch,u=i.pstyle("".concat(t,"-padding")).pfValue,c=2*u,f=i.pstyle("".concat(t,"-color")).value;r.lineWidth=c,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",a.colorStrokeStyle(r,f[0],f[1],f[2],n),a.drawEdgePath(i,r,o.allpts,"solid")}}}};ii.drawEdgeOverlay=Rv("overlay"),ii.drawEdgeUnderlay=Rv("underlay"),ii.drawEdgePath=function(e,t,r,i){var n=e._private.rscratch,a=t,s,o=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,f=e.pstyle("line-dash-offset").pfValue;if(u){var p=r.join("$"),d=n.pathCacheKey&&n.pathCacheKey===p;d?(s=t=n.pathCache,o=!0):(s=t=new Path2D,n.pathCacheKey=p,n.pathCache=s)}if(a.setLineDash)switch(i){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(c),a.lineDashOffset=f;break;case"solid":a.setLineDash([]);break}if(!o&&!n.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var g=2;g+3<r.length;g+=4)t.quadraticCurveTo(r[g],r[g+1],r[g+2],r[g+3]);break;case"straight":case"haystack":for(var h=2;h+1<r.length;h+=2)t.lineTo(r[h],r[h+1]);break;case"segments":if(n.isRound){var v=Qh(n.roundCorners),b;try{for(v.s();!(b=v.n()).done;){var y=b.value;mv(t,y)}}catch(w){v.e(w)}finally{v.f()}t.lineTo(r[r.length-2],r[r.length-1])}else for(var x=2;x+1<r.length;x+=2)t.lineTo(r[x],r[x+1]);break}t=a,u?t.stroke(s):t.stroke(),t.setLineDash&&t.setLineDash([])},ii.drawEdgeTrianglePath=function(e,t,r){t.fillStyle=t.strokeStyle;for(var i=e.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var a=[r[n+2]-r[n],r[n+3]-r[n+1]],s=Math.sqrt(a[0]*a[0]+a[1]*a[1]),o=[a[1]/s,-a[0]/s],u=[o[0]*i/2,o[1]*i/2];t.beginPath(),t.moveTo(r[n]-u[0],r[n+1]-u[1]),t.lineTo(r[n]+u[0],r[n+1]+u[1]),t.lineTo(r[n+2],r[n+3]),t.closePath(),t.fill()}},ii.drawArrowheads=function(e,t,r){var i=t._private.rscratch,n=i.edgeType==="haystack";n||this.drawArrowhead(e,t,"source",i.arrowStartX,i.arrowStartY,i.srcArrowAngle,r),this.drawArrowhead(e,t,"mid-target",i.midX,i.midY,i.midtgtArrowAngle,r),this.drawArrowhead(e,t,"mid-source",i.midX,i.midY,i.midsrcArrowAngle,r),n||this.drawArrowhead(e,t,"target",i.arrowEndX,i.arrowEndY,i.tgtArrowAngle,r)},ii.drawArrowhead=function(e,t,r,i,n,a,s){if(!(isNaN(i)||i==null||isNaN(n)||n==null||isNaN(a)||a==null)){var o=this,u=t.pstyle(r+"-arrow-shape").value;if(u!=="none"){var c=t.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=t.pstyle(r+"-arrow-fill").value,p=t.pstyle("width").pfValue,d=t.pstyle(r+"-arrow-width"),g=d.value==="match-line"?p:d.pfValue;d.units==="%"&&(g*=p);var h=t.pstyle("opacity").value;s===void 0&&(s=h);var v=e.globalCompositeOperation;(s!==1||f==="hollow")&&(e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,1),o.colorStrokeStyle(e,255,255,255,1),o.drawArrowShape(t,e,c,p,u,g,i,n,a),e.globalCompositeOperation=v);var b=t.pstyle(r+"-arrow-color").value;o.colorFillStyle(e,b[0],b[1],b[2],s),o.colorStrokeStyle(e,b[0],b[1],b[2],s),o.drawArrowShape(t,e,f,p,u,g,i,n,a)}}},ii.drawArrowShape=function(e,t,r,i,n,a,s,o,u){var c=this,f=this.usePaths()&&n!=="triangle-cross",p=!1,d,g=t,h={x:s,y:o},v=e.pstyle("arrow-scale").value,b=this.getArrowWidth(i,v),y=c.arrowShapes[n];if(f){var x=c.arrowPathCache=c.arrowPathCache||[],w=tn(n),_=x[w];_!=null?(d=t=_,p=!0):(d=t=new Path2D,x[w]=d)}p||(t.beginPath&&t.beginPath(),f?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,b,u,h,i),t.closePath&&t.closePath()),t=g,f&&(t.translate(s,o),t.rotate(u),t.scale(b,b)),(r==="filled"||r==="both")&&(f?t.fill(d):t.fill()),(r==="hollow"||r==="both")&&(t.lineWidth=a/(f?b:1),t.lineJoin="miter",f?t.stroke(d):t.stroke()),f&&(t.scale(1/b,1/b),t.rotate(-u),t.translate(-s,-o))};var Yc={};Yc.safeDrawImage=function(e,t,r,i,n,a,s,o,u,c){if(!(n<=0||a<=0||u<=0||c<=0))try{e.drawImage(t,r,i,n,a,s,o,u,c)}catch(f){Ve(f)}},Yc.drawInscribedImage=function(e,t,r,i,n){var a=this,s=r.position(),o=s.x,u=s.y,c=r.cy().style(),f=c.getIndexedStyle.bind(c),p=f(r,"background-fit","value",i),d=f(r,"background-repeat","value",i),g=r.width(),h=r.height(),v=r.padding()*2,b=g+(f(r,"background-width-relative-to","value",i)==="inner"?0:v),y=h+(f(r,"background-height-relative-to","value",i)==="inner"?0:v),x=r._private.rscratch,w=f(r,"background-clip","value",i),_=w==="node",k=f(r,"background-image-opacity","value",i)*n,S=f(r,"background-image-smoothing","value",i),A=r.pstyle("corner-radius").value;A!=="auto"&&(A=r.pstyle("corner-radius").pfValue);var C=t.width||t.cachedW,E=t.height||t.cachedH;(C==null||E==null)&&(document.body.appendChild(t),C=t.cachedW=t.width||t.offsetWidth,E=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var I=C,T=E;if(f(r,"background-width","value",i)!=="auto"&&(f(r,"background-width","units",i)==="%"?I=f(r,"background-width","pfValue",i)*b:I=f(r,"background-width","pfValue",i)),f(r,"background-height","value",i)!=="auto"&&(f(r,"background-height","units",i)==="%"?T=f(r,"background-height","pfValue",i)*y:T=f(r,"background-height","pfValue",i)),!(I===0||T===0)){if(p==="contain"){var D=Math.min(b/I,y/T);I*=D,T*=D}else if(p==="cover"){var D=Math.max(b/I,y/T);I*=D,T*=D}var P=o-b/2,B=f(r,"background-position-x","units",i),V=f(r,"background-position-x","pfValue",i);B==="%"?P+=(b-I)*V:P+=V;var M=f(r,"background-offset-x","units",i),R=f(r,"background-offset-x","pfValue",i);M==="%"?P+=(b-I)*R:P+=R;var F=u-y/2,q=f(r,"background-position-y","units",i),H=f(r,"background-position-y","pfValue",i);q==="%"?F+=(y-T)*H:F+=H;var $=f(r,"background-offset-y","units",i),U=f(r,"background-offset-y","pfValue",i);$==="%"?F+=(y-T)*U:F+=U,x.pathCache&&(P-=o,F-=u,o=0,u=0);var K=e.globalAlpha;e.globalAlpha=k;var Q=a.getImgSmoothing(e),X=!1;if(S==="no"&&Q?(a.setImgSmoothing(e,!1),X=!0):S==="yes"&&!Q&&(a.setImgSmoothing(e,!0),X=!0),d==="no-repeat")_&&(e.save(),x.pathCache?e.clip(x.pathCache):(a.nodeShapes[a.getNodeShape(r)].draw(e,o,u,b,y,A,x),e.clip())),a.safeDrawImage(e,t,0,0,C,E,P,F,I,T),_&&e.restore();else{var W=e.createPattern(t,d);e.fillStyle=W,a.nodeShapes[a.getNodeShape(r)].draw(e,o,u,b,y,A,x),e.translate(P,F),e.fill(),e.translate(-P,-F)}e.globalAlpha=K,X&&a.setImgSmoothing(e,Q)}};var hn={};hn.eleTextBiggerThanMin=function(e,t){if(!t){var r=e.cy().zoom(),i=this.getPixelRatio(),n=Math.ceil(pc(r*i));t=Math.pow(2,n)}var a=e.pstyle("font-size").pfValue*t,s=e.pstyle("min-zoomed-font-size").pfValue;return!(a<s)},hn.drawElementText=function(e,t,r,i,n){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(i==null){if(a&&!s.eleTextBiggerThanMin(t))return}else if(i===!1)return;if(t.isNode()){var o=t.pstyle("label");if(!o||!o.value)return;var u=s.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var c=t.element()._private.rscratch.badLine,f=t.pstyle("label"),p=t.pstyle("source-label"),d=t.pstyle("target-label");if(c||(!f||!f.value)&&(!p||!p.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var g=!r,h;r&&(h=r,e.translate(-h.x1,-h.y1)),n==null?(s.drawText(e,t,null,g,a),t.isEdge()&&(s.drawText(e,t,"source",g,a),s.drawText(e,t,"target",g,a))):s.drawText(e,t,n,g,a),r&&e.translate(h.x1,h.y1)},hn.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(t=this.fontCaches[r],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},hn.setupTextStyle=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=t.pstyle("font-style").strValue,n=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,o=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*o,c=t.pstyle("color").value,f=t.pstyle("text-outline-color").value;e.font=i+" "+s+" "+n+" "+a,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],o),this.colorStrokeStyle(e,f[0],f[1],f[2],u)};function Zc(e,t,r,i,n){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,r),e.lineTo(t+i-a,r),e.quadraticCurveTo(t+i,r,t+i,r+a),e.lineTo(t+i,r+n-a),e.quadraticCurveTo(t+i,r+n,t+i-a,r+n),e.lineTo(t+a,r+n),e.quadraticCurveTo(t,r+n,t,r+n-a),e.lineTo(t,r+a),e.quadraticCurveTo(t,r,t+a,r),e.closePath(),s?e.stroke():e.fill()}hn.getTextAngle=function(e,t){var r,i=e._private,n=i.rscratch,a=t?t+"-":"",s=e.pstyle(a+"text-rotation"),o=xr(n,"labelAngle",t);return s.strValue==="autorotate"?r=e.isEdge()?o:0:s.strValue==="none"?r=0:r=s.pfValue,r},hn.drawText=function(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private,s=a.rscratch,o=n?t.effectiveOpacity():1;if(!(n&&(o===0||t.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=xr(s,"labelX",r),c=xr(s,"labelY",r),f,p,d=this.getLabelText(t,r);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,n);var g=r?r+"-":"",h=xr(s,"labelWidth",r),v=xr(s,"labelHeight",r),b=t.pstyle(g+"text-margin-x").pfValue,y=t.pstyle(g+"text-margin-y").pfValue,x=t.isEdge(),w=t.pstyle("text-halign").value,_=t.pstyle("text-valign").value;x&&(w="center",_="center"),u+=b,c+=y;var k;switch(i?k=this.getTextAngle(t,r):k=0,k!==0&&(f=u,p=c,e.translate(f,p),e.rotate(k),u=0,c=0),_){case"top":break;case"center":c+=v/2;break;case"bottom":c+=v;break}var S=t.pstyle("text-background-opacity").value,A=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,E=t.pstyle("text-background-padding").pfValue,I=t.pstyle("text-background-shape").strValue,T=I.indexOf("round")===0,D=2;if(S>0||C>0&&A>0){var P=u-E;switch(w){case"left":P-=h;break;case"center":P-=h/2;break}var B=c-v-E,V=h+2*E,M=v+2*E;if(S>0){var R=e.fillStyle,F=t.pstyle("text-background-color").value;e.fillStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+S*o+")",T?Zc(e,P,B,V,M,D):e.fillRect(P,B,V,M),e.fillStyle=R}if(C>0&&A>0){var q=e.strokeStyle,H=e.lineWidth,$=t.pstyle("text-border-color").value,U=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+$[0]+","+$[1]+","+$[2]+","+A*o+")",e.lineWidth=C,e.setLineDash)switch(U){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(T?Zc(e,P,B,V,M,D,"stroke"):e.strokeRect(P,B,V,M),U==="double"){var K=C/2;T?Zc(e,P+K,B+K,V-K*2,M-K*2,D,"stroke"):e.strokeRect(P+K,B+K,V-K*2,M-K*2)}e.setLineDash&&e.setLineDash([]),e.lineWidth=H,e.strokeStyle=q}}var Q=2*t.pstyle("text-outline-width").pfValue;if(Q>0&&(e.lineWidth=Q),t.pstyle("text-wrap").value==="wrap"){var X=xr(s,"labelWrapCachedLines",r),W=xr(s,"labelLineHeight",r),ee=h/2,Y=this.getLabelJustification(t);switch(Y==="auto"||(w==="left"?Y==="left"?u+=-h:Y==="center"&&(u+=-ee):w==="center"?Y==="left"?u+=-ee:Y==="right"&&(u+=ee):w==="right"&&(Y==="center"?u+=ee:Y==="right"&&(u+=h))),_){case"top":c-=(X.length-1)*W;break;case"center":case"bottom":c-=(X.length-1)*W;break}for(var G=0;G<X.length;G++)Q>0&&e.strokeText(X[G],u,c),e.fillText(X[G],u,c),c+=W}else Q>0&&e.strokeText(d,u,c),e.fillText(d,u,c);k!==0&&(e.rotate(-k),e.translate(-f,-p))}}};var ma={};ma.drawNode=function(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,u,c=t._private,f=c.rscratch,p=t.position();if(!(!ve(p.x)||!ve(p.y))&&!(a&&!t.visible())){var d=a?t.effectiveOpacity():1,g=s.usePaths(),h,v=!1,b=t.padding();o=t.width()+2*b,u=t.height()+2*b;var y;r&&(y=r,e.translate(-y.x1,-y.y1));for(var x=t.pstyle("background-image"),w=x.value,_=new Array(w.length),k=new Array(w.length),S=0,A=0;A<w.length;A++){var C=w[A],E=_[A]=C!=null&&C!=="none";if(E){var I=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",A);S++,k[A]=s.getCachedImage(C,I,function(){c.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var T=t.pstyle("background-blacken").value,D=t.pstyle("border-width").pfValue,P=t.pstyle("background-opacity").value*d,B=t.pstyle("border-color").value,V=t.pstyle("border-style").value,M=t.pstyle("border-join").value,R=t.pstyle("border-cap").value,F=t.pstyle("border-position").value,q=t.pstyle("border-dash-pattern").pfValue,H=t.pstyle("border-dash-offset").pfValue,$=t.pstyle("border-opacity").value*d,U=t.pstyle("outline-width").pfValue,K=t.pstyle("outline-color").value,Q=t.pstyle("outline-style").value,X=t.pstyle("outline-opacity").value*d,W=t.pstyle("outline-offset").value,ee=t.pstyle("corner-radius").value;ee!=="auto"&&(ee=t.pstyle("corner-radius").pfValue);var Y=function(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P;s.eleFillStyle(e,t,me)},G=function(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$;s.colorStrokeStyle(e,B[0],B[1],B[2],me)},te=function(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;s.colorStrokeStyle(e,K[0],K[1],K[2],me)},re=function(me,ce,he,Ee){var Ce=s.nodePathCache=s.nodePathCache||[],we=vm(he==="polygon"?he+","+Ee.join(","):he,""+ce,""+me,""+ee),Ae=Ce[we],xe,ke=!1;return Ae!=null?(xe=Ae,ke=!0,f.pathCache=xe):(xe=new Path2D,Ce[we]=f.pathCache=xe),{path:xe,cacheHit:ke}},fe=t.pstyle("shape").strValue,ge=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(p.x,p.y);var de=re(o,u,fe,ge);h=de.path,v=de.cacheHit}var pe=function(){if(!v){var me=p;g&&(me={x:0,y:0}),s.nodeShapes[s.getNodeShape(t)].draw(h||e,me.x,me.y,o,u,ee,f)}g?e.fill(h):e.fill()},z=function(){for(var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,he=c.backgrounding,Ee=0,Ce=0;Ce<k.length;Ce++){var we=t.cy().style().getIndexedStyle(t,"background-image-containment","value",Ce);if(ce&&we==="over"||!ce&&we==="inside"){Ee++;continue}_[Ce]&&k[Ce].complete&&!k[Ce].error&&(Ee++,s.drawInscribedImage(e,k[Ce],t,Ce,me))}c.backgrounding=Ee!==S,he!==c.backgrounding&&t.updateStyle(!1)},O=function(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasPie(t)&&(s.drawPie(e,t,ce),me&&(g||s.nodeShapes[s.getNodeShape(t)].draw(e,p.x,p.y,o,u,ee,f)))},N=function(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,ce=(T>0?T:-T)*me,he=T>0?0:255;T!==0&&(s.colorFillStyle(e,he,he,he,ce),g?e.fill(h):e.fill())},j=function(){if(D>0){if(e.lineWidth=D,e.lineCap=R,e.lineJoin=M,e.setLineDash)switch(V){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(q),e.lineDashOffset=H;break;case"solid":case"double":e.setLineDash([]);break}if(F!=="center"){if(e.save(),e.lineWidth*=2,F==="inside")g?e.clip(h):e.clip();else{var me=new Path2D;me.rect(-o/2-D,-u/2-D,o+2*D,u+2*D),me.addPath(h),e.clip(me,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if(V==="double"){e.lineWidth=D/3;var ce=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=ce}e.setLineDash&&e.setLineDash([])}},Z=function(){if(U>0){if(e.lineWidth=U,e.lineCap="butt",e.setLineDash)switch(Q){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var me=p;g&&(me={x:0,y:0});var ce=s.getNodeShape(t),he=D;F==="inside"&&(he=0),F==="outside"&&(he*=2);var Ee=(o+he+(U+W))/o,Ce=(u+he+(U+W))/u,we=o*Ee,Ae=u*Ce,xe=s.nodeShapes[ce].points,ke;if(g){var Ke=re(we,Ae,ce,xe);ke=Ke.path}if(ce==="ellipse")s.drawEllipsePath(ke||e,me.x,me.y,we,Ae);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(ce)){var Pe=0,je=0,tt=0;ce==="round-diamond"?Pe=(he+W+U)*1.4:ce==="round-heptagon"?(Pe=(he+W+U)*1.075,tt=-(he/2+W+U)/35):ce==="round-hexagon"?Pe=(he+W+U)*1.12:ce==="round-pentagon"?(Pe=(he+W+U)*1.13,tt=-(he/2+W+U)/15):ce==="round-tag"?(Pe=(he+W+U)*1.12,je=(he/2+U+W)*.07):ce==="round-triangle"&&(Pe=(he+W+U)*(Math.PI/2),tt=-(he+W/2+U)/Math.PI),Pe!==0&&(Ee=(o+Pe)/o,we=o*Ee,["round-hexagon","round-tag"].includes(ce)||(Ce=(u+Pe)/u,Ae=u*Ce)),ee=ee==="auto"?Bm(we,Ae):ee;for(var qe=we/2,pt=Ae/2,ut=ee+(he+U+W)/2,lt=new Array(xe.length/2),bt=new Array(xe.length/2),xt=0;xt<xe.length/2;xt++)lt[xt]={x:me.x+je+qe*xe[xt*2],y:me.y+tt+pt*xe[xt*2+1]};var kt,at,rt,wt,it=lt.length;for(at=lt[it-1],kt=0;kt<it;kt++)rt=lt[kt%it],wt=lt[(kt+1)%it],bt[kt]=Hc(at,rt,wt,ut),at=rt,rt=wt;s.drawRoundPolygonPath(ke||e,me.x+je,me.y+tt,o*Ee,u*Ce,xe,bt)}else if(["roundrectangle","round-rectangle"].includes(ce))ee=ee==="auto"?sn(we,Ae):ee,s.drawRoundRectanglePath(ke||e,me.x,me.y,we,Ae,ee+(he+U+W)/2);else if(["cutrectangle","cut-rectangle"].includes(ce))ee=ee==="auto"?gc():ee,s.drawCutRectanglePath(ke||e,me.x,me.y,we,Ae,null,ee+(he+U+W)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(ce))ee=ee==="auto"?sn(we,Ae):ee,s.drawBottomRoundRectanglePath(ke||e,me.x,me.y,we,Ae,ee+(he+U+W)/2);else if(ce==="barrel")s.drawBarrelPath(ke||e,me.x,me.y,we,Ae);else if(ce.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(ce)){var dt=(he+U+W)/o;xe=Wo(Xo(xe,dt)),s.drawPolygonPath(ke||e,me.x,me.y,o,u,xe)}else{var St=(he+U+W)/o;xe=Wo(Xo(xe,-St)),s.drawPolygonPath(ke||e,me.x,me.y,o,u,xe)}if(g?e.stroke(ke):e.stroke(),Q==="double"){e.lineWidth=he/3;var Li=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(ke):e.stroke(),e.globalCompositeOperation=Li}e.setLineDash&&e.setLineDash([])}},ie=function(){n&&s.drawNodeOverlay(e,t,p,o,u)},le=function(){n&&s.drawNodeUnderlay(e,t,p,o,u)},be=function(){s.drawElementText(e,t,null,i)},ae=t.pstyle("ghost").value==="yes";if(ae){var L=t.pstyle("ghost-offset-x").pfValue,J=t.pstyle("ghost-offset-y").pfValue,ne=t.pstyle("ghost-opacity").value,se=ne*d;e.translate(L,J),te(),Z(),Y(ne*P),pe(),z(se,!0),G(ne*$),j(),O(T!==0||D!==0),z(se,!1),N(se),e.translate(-L,-J)}g&&e.translate(-p.x,-p.y),le(),g&&e.translate(p.x,p.y),te(),Z(),Y(),pe(),z(d,!0),G(),j(),O(T!==0||D!==0),z(d,!1),N(),g&&e.translate(-p.x,-p.y),be(),ie(),r&&e.translate(y.x1,y.y1)}};var Pv=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(r,i,n,a,s){var o=this;if(i.visible()){var u=i.pstyle("".concat(t,"-padding")).pfValue,c=i.pstyle("".concat(t,"-opacity")).value,f=i.pstyle("".concat(t,"-color")).value,p=i.pstyle("".concat(t,"-shape")).value,d=i.pstyle("".concat(t,"-corner-radius")).value;if(c>0){if(n=n||i.position(),a==null||s==null){var g=i.padding();a=i.width()+2*g,s=i.height()+2*g}o.colorFillStyle(r,f[0],f[1],f[2],c),o.nodeShapes[p].draw(r,n.x,n.y,a+u*2,s+u*2,d),r.fill()}}}};ma.drawNodeOverlay=Pv("overlay"),ma.drawNodeUnderlay=Pv("underlay"),ma.hasPie=function(e){return e=e[0],e._private.hasPie},ma.drawPie=function(e,t,r,i){t=t[0],i=i||t.position();var n=t.cy().style(),a=t.pstyle("pie-size"),s=i.x,o=i.y,u=t.width(),c=t.height(),f=Math.min(u,c)/2,p=0,d=this.usePaths();d&&(s=0,o=0),a.units==="%"?f=f*a.pfValue:a.pfValue!==void 0&&(f=a.pfValue/2);for(var g=1;g<=n.pieBackgroundN;g++){var h=t.pstyle("pie-"+g+"-background-size").value,v=t.pstyle("pie-"+g+"-background-color").value,b=t.pstyle("pie-"+g+"-background-opacity").value*r,y=h/100;y+p>1&&(y=1-p);var x=1.5*Math.PI+2*Math.PI*p,w=2*Math.PI*y,_=x+w;h===0||p>=1||p+y>1||(e.beginPath(),e.moveTo(s,o),e.arc(s,o,f,x,_),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],b),e.fill(),p+=y)}};var ir={},y4=100;ir.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),r=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/r},ir.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],r=!0,i,n=0;n<t.length;n++)if(i=t[n],i.context===e){r=!1;break}return r&&(i={context:e},t.push(i)),i},ir.createGradientStyleFor=function(e,t,r,i,n){var a,s=this.usePaths(),o=r.pstyle(t+"-gradient-stop-colors").value,u=r.pstyle(t+"-gradient-stop-positions").pfValue;if(i==="radial-gradient")if(r.isEdge()){var c=r.sourceEndpoint(),f=r.targetEndpoint(),p=r.midpoint(),d=rn(c,p),g=rn(f,p);a=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(d,g))}else{var h=s?{x:0,y:0}:r.position(),v=r.paddedWidth(),b=r.paddedHeight();a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(v,b))}else if(r.isEdge()){var y=r.sourceEndpoint(),x=r.targetEndpoint();a=e.createLinearGradient(y.x,y.y,x.x,x.y)}else{var w=s?{x:0,y:0}:r.position(),_=r.paddedWidth(),k=r.paddedHeight(),S=_/2,A=k/2,C=r.pstyle("background-gradient-direction").value;switch(C){case"to-bottom":a=e.createLinearGradient(w.x,w.y-A,w.x,w.y+A);break;case"to-top":a=e.createLinearGradient(w.x,w.y+A,w.x,w.y-A);break;case"to-left":a=e.createLinearGradient(w.x+S,w.y,w.x-S,w.y);break;case"to-right":a=e.createLinearGradient(w.x-S,w.y,w.x+S,w.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(w.x-S,w.y-A,w.x+S,w.y+A);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(w.x-S,w.y+A,w.x+S,w.y-A);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(w.x+S,w.y-A,w.x-S,w.y+A);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(w.x+S,w.y+A,w.x-S,w.y-A);break}}if(!a)return null;for(var E=u.length===o.length,I=o.length,T=0;T<I;T++)a.addColorStop(E?u[T]:T/(I-1),"rgba("+o[T][0]+","+o[T][1]+","+o[T][2]+","+n+")");return a},ir.gradientFillStyle=function(e,t,r,i){var n=this.createGradientStyleFor(e,"background",t,r,i);if(!n)return null;e.fillStyle=n},ir.colorFillStyle=function(e,t,r,i,n){e.fillStyle="rgba("+t+","+r+","+i+","+n+")"},ir.eleFillStyle=function(e,t,r){var i=t.pstyle("background-fill").value;if(i==="linear-gradient"||i==="radial-gradient")this.gradientFillStyle(e,t,i,r);else{var n=t.pstyle("background-color").value;this.colorFillStyle(e,n[0],n[1],n[2],r)}},ir.gradientStrokeStyle=function(e,t,r,i){var n=this.createGradientStyleFor(e,"line",t,r,i);if(!n)return null;e.strokeStyle=n},ir.colorStrokeStyle=function(e,t,r,i,n){e.strokeStyle="rgba("+t+","+r+","+i+","+n+")"},ir.eleStrokeStyle=function(e,t,r){var i=t.pstyle("line-fill").value;if(i==="linear-gradient"||i==="radial-gradient")this.gradientStrokeStyle(e,t,i,r);else{var n=t.pstyle("line-color").value;this.colorStrokeStyle(e,n[0],n[1],n[2],r)}},ir.matchCanvasSize=function(e){var t=this,r=t.data,i=t.findContainerClientCoords(),n=i[2],a=i[3],s=t.getPixelRatio(),o=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var u=n*s,c=a*s,f;if(!(u===t.canvasWidth&&c===t.canvasHeight)){t.fontCaches=null;var p=r.canvasContainer;p.style.width=n+"px",p.style.height=a+"px";for(var d=0;d<t.CANVAS_LAYERS;d++)f=r.canvases[d],f.width=u,f.height=c,f.style.width=n+"px",f.style.height=a+"px";for(var d=0;d<t.BUFFER_COUNT;d++)f=r.bufferCanvases[d],f.width=u,f.height=c,f.style.width=n+"px",f.style.height=a+"px";t.textureMult=1,s<=1&&(f=r.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,f.width=u*t.textureMult,f.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},ir.renderTo=function(e,t,r,i){this.render({forcedContext:e,forcedZoom:t,forcedPan:r,drawAllLayers:!0,forcedPxRatio:i})},ir.render=function(e){e=e||Em();var t=e.forcedContext,r=e.drawAllLayers,i=e.drawOnlyNodeLayer,n=e.forcedZoom,a=e.forcedPan,s=this,o=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,u=s.cy,c=s.data,f=c.canvasNeedsRedraw,p=s.textureOnViewport&&!t&&(s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming),d=e.motionBlur!==void 0?e.motionBlur:s.motionBlur,g=s.motionBlurPxRatio,h=u.hasCompoundNodes(),v=s.hoverData.draggingEles,b=!!(s.hoverData.selecting||s.touchData.selecting);d=d&&!t&&s.motionBlurEnabled&&!b;var y=d;t||(s.prevPxRatio!==o&&(s.invalidateContainerClientCoordsCache(),s.matchCanvasSize(s.container),s.redrawHint("eles",!0),s.redrawHint("drag",!0)),s.prevPxRatio=o),!t&&s.motionBlurTimeout&&clearTimeout(s.motionBlurTimeout),d&&(s.mbFrames==null&&(s.mbFrames=0),s.mbFrames++,s.mbFrames<3&&(y=!1),s.mbFrames>s.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!p&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var x=u.style(),w=u.zoom(),_=n!==void 0?n:w,k=u.pan(),S={x:k.x,y:k.y},A={zoom:w,pan:{x:k.x,y:k.y}},C=s.prevViewport,E=C===void 0||A.zoom!==C.zoom||A.pan.x!==C.pan.x||A.pan.y!==C.pan.y;!E&&!(v&&!h)&&(s.motionBlurPxRatio=1),a&&(S=a),_*=o,S.x*=o,S.y*=o;var I=s.getCachedZSortedEles();function T(de,pe,z,O,N){var j=de.globalCompositeOperation;de.globalCompositeOperation="destination-out",s.colorFillStyle(de,255,255,255,s.motionBlurTransparency),de.fillRect(pe,z,O,N),de.globalCompositeOperation=j}function D(de,pe){var z,O,N,j;!s.clearingMotionBlur&&(de===c.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||de===c.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(z={x:k.x*g,y:k.y*g},O=w*g,N=s.canvasWidth*g,j=s.canvasHeight*g):(z=S,O=_,N=s.canvasWidth,j=s.canvasHeight),de.setTransform(1,0,0,1,0,0),pe==="motionBlur"?T(de,0,0,N,j):!t&&(pe===void 0||pe)&&de.clearRect(0,0,N,j),r||(de.translate(z.x,z.y),de.scale(O,O)),a&&de.translate(a.x,a.y),n&&de.scale(n,n)}if(p||(s.textureDrawLastFrame=!1),p){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=u.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var P=s.data.bufferContexts[s.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var A=s.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:s.canvasWidth,height:s.canvasHeight};A.mpan={x:(0-A.pan.x)/A.zoom,y:(0-A.pan.y)/A.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var B=c.contexts[s.NODE],V=s.textureCache.texture,A=s.textureCache.viewport;B.setTransform(1,0,0,1,0,0),d?T(B,0,0,A.width,A.height):B.clearRect(0,0,A.width,A.height);var M=x.core("outside-texture-bg-color").value,R=x.core("outside-texture-bg-opacity").value;s.colorFillStyle(B,M[0],M[1],M[2],R),B.fillRect(0,0,A.width,A.height);var w=u.zoom();D(B,!1),B.clearRect(A.mpan.x,A.mpan.y,A.width/A.zoom/o,A.height/A.zoom/o),B.drawImage(V,A.mpan.x,A.mpan.y,A.width/A.zoom/o,A.height/A.zoom/o)}else s.textureOnViewport&&!t&&(s.textureCache=null);var F=u.extent(),q=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),H=s.hideEdgesOnViewport&&q,$=[];if($[s.NODE]=!f[s.NODE]&&d&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,$[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),$[s.DRAG]=!f[s.DRAG]&&d&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,$[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||r||i||$[s.NODE]){var U=d&&!$[s.NODE]&&g!==1,B=t||(U?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:c.contexts[s.NODE]),K=d&&!U?"motionBlur":void 0;D(B,K),H?s.drawCachedNodes(B,I.nondrag,o,F):s.drawLayeredElements(B,I.nondrag,o,F),s.debug&&s.drawDebugPoints(B,I.nondrag),!r&&!d&&(f[s.NODE]=!1)}if(!i&&(f[s.DRAG]||r||$[s.DRAG])){var U=d&&!$[s.DRAG]&&g!==1,B=t||(U?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:c.contexts[s.DRAG]);D(B,d&&!U?"motionBlur":void 0),H?s.drawCachedNodes(B,I.drag,o,F):s.drawCachedElements(B,I.drag,o,F),s.debug&&s.drawDebugPoints(B,I.drag),!r&&!d&&(f[s.DRAG]=!1)}if(s.showFps||!i&&f[s.SELECT_BOX]&&!r){var B=t||c.contexts[s.SELECT_BOX];if(D(B),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var w=s.cy.zoom(),Q=x.core("selection-box-border-width").value/w;B.lineWidth=Q,B.fillStyle="rgba("+x.core("selection-box-color").value[0]+","+x.core("selection-box-color").value[1]+","+x.core("selection-box-color").value[2]+","+x.core("selection-box-opacity").value+")",B.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),Q>0&&(B.strokeStyle="rgba("+x.core("selection-box-border-color").value[0]+","+x.core("selection-box-border-color").value[1]+","+x.core("selection-box-border-color").value[2]+","+x.core("selection-box-opacity").value+")",B.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(c.bgActivePosistion&&!s.hoverData.selecting){var w=s.cy.zoom(),X=c.bgActivePosistion;B.fillStyle="rgba("+x.core("active-bg-color").value[0]+","+x.core("active-bg-color").value[1]+","+x.core("active-bg-color").value[2]+","+x.core("active-bg-opacity").value+")",B.beginPath(),B.arc(X.x,X.y,x.core("active-bg-size").pfValue/w,0,2*Math.PI),B.fill()}var W=s.lastRedrawTime;if(s.showFps&&W){W=Math.round(W);var ee=Math.round(1e3/W);B.setTransform(1,0,0,1,0,0),B.fillStyle="rgba(255, 0, 0, 0.75)",B.strokeStyle="rgba(255, 0, 0, 0.75)",B.lineWidth=1,B.fillText("1 frame = "+W+" ms = "+ee+" fps",0,20);var Y=60;B.strokeRect(0,30,250,20),B.fillRect(0,30,250*Math.min(ee/Y,1),20)}r||(f[s.SELECT_BOX]=!1)}if(d&&g!==1){var G=c.contexts[s.NODE],te=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],re=c.contexts[s.DRAG],fe=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],ge=function(pe,z,O){pe.setTransform(1,0,0,1,0,0),O||!y?pe.clearRect(0,0,s.canvasWidth,s.canvasHeight):T(pe,0,0,s.canvasWidth,s.canvasHeight);var N=g;pe.drawImage(z,0,0,s.canvasWidth*N,s.canvasHeight*N,0,0,s.canvasWidth,s.canvasHeight)};(f[s.NODE]||$[s.NODE])&&(ge(G,te,$[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||$[s.DRAG])&&(ge(re,fe,$[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=A,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),d&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!p,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},y4)),t||u.emit("render")};var Di={};Di.drawPolygonPath=function(e,t,r,i,n,a){var s=i/2,o=n/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*a[0],r+o*a[1]);for(var u=1;u<a.length/2;u++)e.lineTo(t+s*a[u*2],r+o*a[u*2+1]);e.closePath()},Di.drawRoundPolygonPath=function(e,t,r,i,n,a,s){s.forEach(function(o){return mv(e,o)}),e.closePath()},Di.drawRoundRectanglePath=function(e,t,r,i,n,a){var s=i/2,o=n/2,u=a==="auto"?sn(i,n):Math.min(a,o,s);e.beginPath&&e.beginPath(),e.moveTo(t,r-o),e.arcTo(t+s,r-o,t+s,r,u),e.arcTo(t+s,r+o,t,r+o,u),e.arcTo(t-s,r+o,t-s,r,u),e.arcTo(t-s,r-o,t,r-o,u),e.lineTo(t,r-o),e.closePath()},Di.drawBottomRoundRectanglePath=function(e,t,r,i,n,a){var s=i/2,o=n/2,u=a==="auto"?sn(i,n):a;e.beginPath&&e.beginPath(),e.moveTo(t,r-o),e.lineTo(t+s,r-o),e.lineTo(t+s,r),e.arcTo(t+s,r+o,t,r+o,u),e.arcTo(t-s,r+o,t-s,r,u),e.lineTo(t-s,r-o),e.lineTo(t,r-o),e.closePath()},Di.drawCutRectanglePath=function(e,t,r,i,n,a,s){var o=i/2,u=n/2,c=s==="auto"?gc():s;e.beginPath&&e.beginPath(),e.moveTo(t-o+c,r-u),e.lineTo(t+o-c,r-u),e.lineTo(t+o,r-u+c),e.lineTo(t+o,r+u-c),e.lineTo(t+o-c,r+u),e.lineTo(t-o+c,r+u),e.lineTo(t-o,r+u-c),e.lineTo(t-o,r-u+c),e.closePath()},Di.drawBarrelPath=function(e,t,r,i,n){var a=i/2,s=n/2,o=t-a,u=t+a,c=r-s,f=r+s,p=vc(i,n),d=p.widthOffset,g=p.heightOffset,h=p.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(o,c+g),e.lineTo(o,f-g),e.quadraticCurveTo(o+h,f,o+d,f),e.lineTo(u-d,f),e.quadraticCurveTo(u-h,f,u,f-g),e.lineTo(u,c+g),e.quadraticCurveTo(u-h,c,u-d,c),e.lineTo(o+d,c),e.quadraticCurveTo(o+h,c,o,c+g),e.closePath()};for(var Fv=Math.sin(0),Lv=Math.cos(0),Jc={},Qc={},Mv=Math.PI/40,ga=0*Math.PI;ga<2*Math.PI;ga+=Mv)Jc[ga]=Math.sin(ga),Qc[ga]=Math.cos(ga);Di.drawEllipsePath=function(e,t,r,i,n){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,r,i/2,n/2,0,0,2*Math.PI);else for(var a,s,o=i/2,u=n/2,c=0*Math.PI;c<2*Math.PI;c+=Mv)a=t-o*Jc[c]*Fv+o*Qc[c]*Lv,s=r+u*Qc[c]*Fv+u*Jc[c]*Lv,c===0?e.moveTo(a,s):e.lineTo(a,s);e.closePath()};var Bs={};Bs.createBuffer=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,[r,r.getContext("2d")]},Bs.bufferCanvasImage=function(e){var t=this.cy,r=t.mutableElements(),i=r.boundingBox(),n=this.findContainerClientCoords(),a=e.full?Math.ceil(i.w):n[2],s=e.full?Math.ceil(i.h):n[3],o=ve(e.maxWidth)||ve(e.maxHeight),u=this.getPixelRatio(),c=1;if(e.scale!==void 0)a*=e.scale,s*=e.scale,c=e.scale;else if(o){var f=1/0,p=1/0;ve(e.maxWidth)&&(f=c*e.maxWidth/a),ve(e.maxHeight)&&(p=c*e.maxHeight/s),c=Math.min(f,p),a*=c,s*=c}o||(a*=u,s*=u,c*=u);var d=document.createElement("canvas");d.width=a,d.height=s,d.style.width=a+"px",d.style.height=s+"px";var g=d.getContext("2d");if(a>0&&s>0){g.clearRect(0,0,a,s),g.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(e.full)g.translate(-i.x1*c,-i.y1*c),g.scale(c,c),this.drawElements(g,h),g.scale(1/c,1/c),g.translate(i.x1*c,i.y1*c);else{var v=t.pan(),b={x:v.x*c,y:v.y*c};c*=t.zoom(),g.translate(b.x,b.y),g.scale(c,c),this.drawElements(g,h),g.scale(1/c,1/c),g.translate(-b.x,-b.y)}e.bg&&(g.globalCompositeOperation="destination-over",g.fillStyle=e.bg,g.rect(0,0,a,s),g.fill())}return d};function b4(e,t){for(var r=atob(e),i=new ArrayBuffer(r.length),n=new Uint8Array(i),a=0;a<r.length;a++)n[a]=r.charCodeAt(a);return new Blob([i],{type:t})}function $v(e){var t=e.indexOf(",");return e.substr(t+1)}function zv(e,t,r){var i=function(){return t.toDataURL(r,e.quality)};switch(e.output){case"blob-promise":return new Qn(function(n,a){try{t.toBlob(function(s){s!=null?n(s):a(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,e.quality)}catch(s){a(s)}});case"blob":return b4($v(i()),r);case"base64":return $v(i());case"base64uri":default:return i()}}Bs.png=function(e){return zv(e,this.bufferCanvasImage(e),"image/png")},Bs.jpg=function(e){return zv(e,this.bufferCanvasImage(e),"image/jpeg")};var Vv={};Vv.nodeShapeImpl=function(e,t,r,i,n,a,s,o){switch(e){case"ellipse":return this.drawEllipsePath(t,r,i,n,a);case"polygon":return this.drawPolygonPath(t,r,i,n,a,s);case"round-polygon":return this.drawRoundPolygonPath(t,r,i,n,a,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,i,n,a,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,i,n,a,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,i,n,a,o);case"barrel":return this.drawBarrelPath(t,r,i,n,a)}};var x4=Uv,$e=Uv.prototype;$e.CANVAS_LAYERS=3,$e.SELECT_BOX=0,$e.DRAG=1,$e.NODE=2,$e.BUFFER_COUNT=3,$e.TEXTURE_BUFFER=0,$e.MOTIONBLUR_BUFFER_NODE=1,$e.MOTIONBLUR_BUFFER_DRAG=2;function Uv(e){var t=this,r=t.cy.window(),i=r.document;t.data={canvases:new Array($e.CANVAS_LAYERS),contexts:new Array($e.CANVAS_LAYERS),canvasNeedsRedraw:new Array($e.CANVAS_LAYERS),bufferCanvases:new Array($e.BUFFER_COUNT),bufferContexts:new Array($e.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=i.createElement("div");var s=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=a,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[n]=a;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};oO()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var c=0;c<$e.CANVAS_LAYERS;c++){var f=t.data.canvases[c]=i.createElement("canvas");t.data.contexts[c]=f.getContext("2d"),Object.keys(u).forEach(function(Y){f.style[Y]=u[Y]}),f.style.position="absolute",f.setAttribute("data-id","layer"+c),f.style.zIndex=String($e.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(f),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[$e.NODE].setAttribute("data-id","layer"+$e.NODE+"-node"),t.data.canvases[$e.SELECT_BOX].setAttribute("data-id","layer"+$e.SELECT_BOX+"-selectbox"),t.data.canvases[$e.DRAG].setAttribute("data-id","layer"+$e.DRAG+"-drag");for(var c=0;c<$e.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=i.createElement("canvas"),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext("2d"),t.data.bufferCanvases[c].style.position="absolute",t.data.bufferCanvases[c].setAttribute("data-id","buffer"+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility="hidden";t.pathsEnabled=!0;var p=Jt(),d=function(G){return{x:(G.x1+G.x2)/2,y:(G.y1+G.y2)/2}},g=function(G){return{x:-G.w/2,y:-G.h/2}},h=function(G){var te=G[0]._private,re=te.oldBackgroundTimestamp===te.backgroundTimestamp;return!re},v=function(G){return G[0]._private.nodeKey},b=function(G){return G[0]._private.labelStyleKey},y=function(G){return G[0]._private.sourceLabelStyleKey},x=function(G){return G[0]._private.targetLabelStyleKey},w=function(G,te,re,fe,ge){return t.drawElement(G,te,re,!1,!1,ge)},_=function(G,te,re,fe,ge){return t.drawElementText(G,te,re,fe,"main",ge)},k=function(G,te,re,fe,ge){return t.drawElementText(G,te,re,fe,"source",ge)},S=function(G,te,re,fe,ge){return t.drawElementText(G,te,re,fe,"target",ge)},A=function(G){return G.boundingBox(),G[0]._private.bodyBounds},C=function(G){return G.boundingBox(),G[0]._private.labelBounds.main||p},E=function(G){return G.boundingBox(),G[0]._private.labelBounds.source||p},I=function(G){return G.boundingBox(),G[0]._private.labelBounds.target||p},T=function(G,te){return te},D=function(G){return d(A(G))},P=function(G,te,re){var fe=G?G+"-":"";return{x:te.x+re.pstyle(fe+"text-margin-x").pfValue,y:te.y+re.pstyle(fe+"text-margin-y").pfValue}},B=function(G,te,re){var fe=G[0]._private.rscratch;return{x:fe[te],y:fe[re]}},V=function(G){return P("",B(G,"labelX","labelY"),G)},M=function(G){return P("source",B(G,"sourceLabelX","sourceLabelY"),G)},R=function(G){return P("target",B(G,"targetLabelX","targetLabelY"),G)},F=function(G){return g(A(G))},q=function(G){return g(E(G))},H=function(G){return g(I(G))},$=function(G){var te=C(G),re=g(C(G));if(G.isNode()){switch(G.pstyle("text-halign").value){case"left":re.x=-te.w;break;case"right":re.x=0;break}switch(G.pstyle("text-valign").value){case"top":re.y=-te.h;break;case"bottom":re.y=0;break}}return re},U=t.data.eleTxrCache=new Ns(t,{getKey:v,doesEleInvalidateKey:h,drawElement:w,getBoundingBox:A,getRotationPoint:D,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),K=t.data.lblTxrCache=new Ns(t,{getKey:b,drawElement:_,getBoundingBox:C,getRotationPoint:V,getRotationOffset:$,isVisible:T}),Q=t.data.slbTxrCache=new Ns(t,{getKey:y,drawElement:k,getBoundingBox:E,getRotationPoint:M,getRotationOffset:q,isVisible:T}),X=t.data.tlbTxrCache=new Ns(t,{getKey:x,drawElement:S,getBoundingBox:I,getRotationPoint:R,getRotationOffset:H,isVisible:T}),W=t.data.lyrTxrCache=new Ov(t);t.onUpdateEleCalcs(function(G,te){U.invalidateElements(te),K.invalidateElements(te),Q.invalidateElements(te),X.invalidateElements(te),W.invalidateElements(te);for(var re=0;re<te.length;re++){var fe=te[re]._private;fe.oldBackgroundTimestamp=fe.backgroundTimestamp}});var ee=function(G){for(var te=0;te<G.length;te++)W.enqueueElementRefinement(G[te].ele)};U.onDequeue(ee),K.onDequeue(ee),Q.onDequeue(ee),X.onDequeue(ee)}$e.redrawHint=function(e,t){var r=this;switch(e){case"eles":r.data.canvasNeedsRedraw[$e.NODE]=t;break;case"drag":r.data.canvasNeedsRedraw[$e.DRAG]=t;break;case"select":r.data.canvasNeedsRedraw[$e.SELECT_BOX]=t;break}};var w4=typeof Path2D<"u";$e.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},$e.usePaths=function(){return w4&&this.pathsEnabled},$e.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},$e.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},$e.makeOffscreenCanvas=function(e,t){var r;if((typeof OffscreenCanvas>"u"?"undefined":mt(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(e,t);else{var i=this.cy.window(),n=i.document;r=n.createElement("canvas"),r.width=e,r.height=t}return r},[Dv,Fr,ii,Yc,hn,ma,ir,Di,Bs,Vv].forEach(function(e){Ne($e,e)});var _4=[{name:"null",impl:sv},{name:"base",impl:kv},{name:"canvas",impl:x4}],E4=[{type:"layout",extensions:OP},{type:"renderer",extensions:_4}],jv={},qv={};function Hv(e,t,r){var i=r,n=function(C){Ve("Can not register `"+t+"` for `"+e+"` since `"+C+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(Ts.prototype[t])return n(t);Ts.prototype[t]=r}else if(e==="collection"){if(Rt.prototype[t])return n(t);Rt.prototype[t]=r}else if(e==="layout"){for(var a=function(C){this.options=C,r.call(this,C),Fe(this._private)||(this._private={}),this._private.cy=C.cy,this._private.listeners=[],this.createEmitter()},s=a.prototype=Object.create(r.prototype),o=[],u=0;u<o.length;u++){var c=o[u];s[c]=s[c]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var f=r.prototype.stop;s.stop=function(){var A=this.options;if(A&&A.animate){var C=this.animations;if(C)for(var E=0;E<C.length;E++)C[E].stop()}return f?f.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var p=function(C){return C._private.cy},d={addEventFields:function(C,E){E.layout=C,E.cy=p(C),E.target=C},bubble:function(){return!0},parent:function(C){return p(C)}};Ne(s,{createEmitter:function(){return this._private.emitter=new ul(d,this),this},emitter:function(){return this._private.emitter},on:function(C,E){return this.emitter().on(C,E),this},one:function(C,E){return this.emitter().one(C,E),this},once:function(C,E){return this.emitter().one(C,E),this},removeListener:function(C,E){return this.emitter().removeListener(C,E),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(C,E){return this.emitter().emit(C,E),this}}),Ue.eventAliasesOn(s),i=a}else if(e==="renderer"&&t!=="null"&&t!=="base"){var g=Gv("renderer","base"),h=g.prototype,v=r,b=r.prototype,y=function(){g.apply(this,arguments),v.apply(this,arguments)},x=y.prototype;for(var w in h){var _=h[w],k=b[w]!=null;if(k)return n(w);x[w]=_}for(var S in b)x[S]=b[S];h.clientFunctions.forEach(function(A){x[A]=x[A]||function(){st("Renderer does not implement `renderer."+A+"()` on its prototype")}}),i=y}else if(e==="__proto__"||e==="constructor"||e==="prototype")return st(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return om({map:jv,keys:[e,t],value:i})}function Gv(e,t){return lm({map:jv,keys:[e,t]})}function C4(e,t,r,i,n){return om({map:qv,keys:[e,t,r,i],value:n})}function k4(e,t,r,i){return lm({map:qv,keys:[e,t,r,i]})}var ef=function(){if(arguments.length===2)return Gv.apply(null,arguments);if(arguments.length===3)return Hv.apply(null,arguments);if(arguments.length===4)return k4.apply(null,arguments);if(arguments.length===5)return C4.apply(null,arguments);st("Invalid extension access syntax")};Ts.prototype.extension=ef,E4.forEach(function(e){e.extensions.forEach(function(t){Hv(e.type,t.name,t.impl)})});var Kv=function e(){if(!(this instanceof e))return new e;this.length=0},mn=Kv.prototype;mn.instanceString=function(){return"stylesheet"},mn.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},mn.css=function(e,t){var r=this.length-1;if(Se(e))this[r].properties.push({name:e,value:t});else if(Fe(e))for(var i=e,n=Object.keys(i),a=0;a<n.length;a++){var s=n[a],o=i[s];if(o!=null){var u=zt.properties[s]||zt.properties[Lo(s)];if(u!=null){var c=u.name,f=o;this[r].properties.push({name:c,value:f})}}}return this},mn.style=mn.css,mn.generateStyle=function(e){var t=new zt(e);return this.appendToStyle(t)},mn.appendToStyle=function(e){for(var t=0;t<this.length;t++){var r=this[t],i=r.selector,n=r.properties;e.selector(i);for(var a=0;a<n.length;a++){var s=n[a];e.css(s.name,s.value)}}return e};var S4="3.30.2",gn=function(t){if(t===void 0&&(t={}),Fe(t))return new Ts(t);if(Se(t))return ef.apply(ef,arguments)};gn.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(gn),e.apply(null,t),this},gn.warnings=function(e){return wm(e)},gn.version=S4,gn.stylesheet=gn.Stylesheet=Kv;let T4=class extends EventTarget{constructor(r,i){super();kr(this,"cyg",null);kr(this,"nodes",[]);kr(this,"edges",[]);kr(this,"axons",[]);kr(this,"dendrites",[]);kr(this,"somas",[]);kr(this,"labelCache",new Map);kr(this,"graphCanvas",null);this.labelCache=r,this.graphCanvas=i}async addConnectivity(r){var i;if(this.axons=r.axons.map(n=>JSON.stringify(n)),this.dendrites=r.dendrites.map(n=>JSON.stringify(n)),(i=r.somas)!=null&&i.length&&(this.somas=r.somas.map(n=>JSON.stringify(n))),r.connectivity.length)for(const n of r.connectivity){const a=await this.graphNode(n[0]),s=await this.graphNode(n[1]);this.nodes.push(a),this.nodes.push(s),this.edges.push({id:`${a.id}_${s.id}`,source:a.id,target:s.id})}else this.nodes.push({id:"MISSING",label:"NO PATHS"})}showConnectivity(r){this.cyg=new D4(this,r),this.cyg.on("tap-node",i=>{const n=new CustomEvent("tap-node",{detail:i.detail});this.dispatchEvent(n)})}selectConnectivity(r){var i;if((i=this.cyg)!=null&&i.cy){let n="";this.cyg.cy.elements().forEach(a=>{const s=a.data("label"),o=tf(s);N4(r,o)&&(n=a.id())}),n&&this.cyg.cy.$id(n).select()}}clearConnectivity(){var r;(r=this.cyg)!=null&&r.cy&&(this.cyg.cy.remove(),this.cyg.cy=null)}reset(){var r;(r=this.cyg)!=null&&r.cy&&this.cyg.cy.reset()}zoom(r){var i;if((i=this.cyg)!=null&&i.cy){const n=this.cyg.cy.zoom(),a=this.cyg.cy.width(),s=this.cyg.cy.height(),o={x:a/2,y:s/2};this.cyg.cy.zoom({level:n+r,renderedPosition:o})}}enableZoom(r){var i;(i=this.cyg)!=null&&i.cy&&this.cyg.cy.userZoomingEnabled(r)}get elements(){return[...this.nodes.map(r=>({data:r})),...this.edges.map(r=>({data:r}))]}get roots(){return[...this.dendrites,...this.somas]}async graphNode(r){const i=JSON.stringify(r),n=[r[0],...r[1]],a=[];for(const o of n){const u=this.labelCache.has(o)?this.labelCache.get(o):"";a.push(u)}n.push(...a);const s={id:i,label:n.join(`
|
|
45
|
-
`)};return this.axons.includes(i)?this.dendrites.includes(i)||this.somas.includes(i)?s["both-a-d"]=!0:s.axon=!0:(this.dendrites.includes(i)||this.somas.includes(i))&&(s.dendrite=!0),s}on(r,i){this.addEventListener(r,i)}};const A4=[{selector:"node",style:{label:function(e){return O4(e.data("label"))},"background-color":"transparent","background-opacity":"0","text-valign":"center","text-wrap":"wrap",width:"80px",height:"80px","text-max-width":"80px","font-size":"6px",shape:"round-rectangle","border-width":1,"border-style":"solid","border-color":"gray"}},{selector:"node[axon]",style:{shape:"round-diamond",width:"100px",height:"100px"}},{selector:"node[dendrite]",style:{shape:"ellipse"}},{selector:"node[both-a-d]",style:{shape:"round-rectangle"}},{selector:"edge",style:{width:1,"line-color":"dimgray","
|
|
45
|
+
`)};return this.axons.includes(i)?this.dendrites.includes(i)||this.somas.includes(i)?s["both-a-d"]=!0:s.axon=!0:(this.dendrites.includes(i)||this.somas.includes(i))&&(s.dendrite=!0),s}on(r,i){this.addEventListener(r,i)}};const A4=[{selector:"node",style:{label:function(e){return O4(e.data("label"))},"background-color":"transparent","background-opacity":"0","text-valign":"center","text-wrap":"wrap",width:"80px",height:"80px","text-max-width":"80px","font-size":"6px",shape:"round-rectangle","border-width":1,"border-style":"solid","border-color":"gray"}},{selector:"node[axon]",style:{shape:"round-diamond",width:"100px",height:"100px"}},{selector:"node[dendrite]",style:{shape:"ellipse"}},{selector:"node[both-a-d]",style:{shape:"round-rectangle"}},{selector:"edge",style:{width:1,"line-color":"dimgray","curve-style":"bezier"}},{selector:"node.active",style:{"border-color":"#8300bf","background-color":"#f3ecf6","background-opacity":.75}}];function O4(e){const t=e.split(`
|
|
46
46
|
`),r=t.length/2,i=t.slice(r);return Wv(i.join(`
|
|
47
47
|
`))}function Wv(e){return e.split(`
|
|
48
48
|
`).map(t=>t&&t[0]>="a"&&t[0]<="z"?t.charAt(0).toUpperCase()+t.slice(1):t).join(`
|
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -42,6 +42,7 @@ const showConnectivityGraph = ref(false);
|
|
|
42
42
|
const connectivityGraphEntry = "ilxtr:neuron-type-aacar-13";
|
|
43
43
|
// const connectivityGraphEntry = "ilxtr:sparc-nlp/kidney/134";
|
|
44
44
|
const mapServer = "https://mapcore-demo.org/curation/flatmap/";
|
|
45
|
+
const sckanVersion = "sckan-2024-09-21-npo";
|
|
45
46
|
|
|
46
47
|
onMounted(() => {
|
|
47
48
|
console.log("🚀 ~ onMounted ~ appRef:", appRef.value);
|
|
@@ -548,6 +549,7 @@ function confirmCreate(value) {
|
|
|
548
549
|
v-if="showConnectivityGraph"
|
|
549
550
|
:entry="connectivityGraphEntry"
|
|
550
551
|
:map-server="mapServer"
|
|
552
|
+
:sckanVersion="sckanVersion"
|
|
551
553
|
/>
|
|
552
554
|
</div>
|
|
553
555
|
</template>
|