-
Notifications
You must be signed in to change notification settings - Fork 36
/
cytoscape-expand-collapse.js
1 lines (1 loc) · 30.6 KB
/
cytoscape-expand-collapse.js
1
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.cytoscapeExpandCollapse=o():e.cytoscapeExpandCollapse=o()}(this,(()=>{return e={78:e=>{var o={equalBoundingBoxes:function(e,o){return e.x1==o.x1&&e.x2==o.x2&&e.y1==o.y1&&e.y2==o.y2},getUnion:function(e,o){var n={x1:Math.min(e.x1,o.x1),x2:Math.max(e.x2,o.x2),y1:Math.min(e.y1,o.y1),y2:Math.max(e.y2,o.y2)};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n}};e.exports=o},540:(e,o,n)=>{var t=n(630),a=n(438);e.exports=function(e,o,d){var i,s,l=e;const r=function(){var e=o.scratch("_cyExpandCollapse");return e&&e.cueUtilities};var c={init:function(){var e=document.createElement("canvas");e.classList.add("expand-collapse-canvas");var l=o.container(),r=e.getContext("2d");l.append(e),i=n(537)(o);var c=function(e){var o=e.getBoundingClientRect();return{top:o.top+document.documentElement.scrollTop,left:o.left+document.documentElement.scrollLeft}},p=t((function(){e.height=o.container().offsetHeight,e.width=o.container().offsetWidth,e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=f().zIndex,setTimeout((function(){var n=c(e),t=c(l);e.style.top=-(n.top-t.top),e.style.left=-(n.left-t.left),o&&h()}),0)}),250);function u(){p()}u();var g={};function f(){return o.scratch("_cyExpandCollapse").options}function h(){var e=o.width(),n=o.height();r.clearRect(0,0,e,n),s=null}function v(e,o,n,t,a){var d=new Image(t,a);d.src=e,d.onload=()=>{r.drawImage(d,o,n,t,a)}}o.on("resize",g.eCyResize=function(){u()}),o.on("expandcollapse.clearvisualcue",(function(){s&&h()}));var y,x=null,E=null;o.on("mousedown",g.eMouseDown=function(e){x=e.renderedPosition||e.cyRenderedPosition}),o.on("mouseup",g.eMouseUp=function(e){E=e.renderedPosition||e.cyRenderedPosition}),o.on("remove","node",g.eRemove=function(e){e.target==s&&h()}),o.on("select unselect",g.eSelect=function(){s&&h();var e=o.nodes(":selected");if(1===e.length){var n=e[0];(n.isParent()||n.hasClass("cy-expand-collapse-collapsed-node"))&&function(e){var n=e.children(),t=e.data("collapsedChildren");if(null!=n&&null!=n&&n.length>0||t){var a,d=e.hasClass("cy-expand-collapse-collapsed-node"),l=f().expandCollapseCueSize,c=f().expandCollapseCueLineSize;if("top-left"===f().expandCollapseCuePosition){var p=o.zoom()<1?l/(2*o.zoom()):l/2,u=parseFloat(e.css("border-width"));a={x:e.position("x")-e.width()/2-parseFloat(e.css("padding-left"))+u+p+1,y:e.position("y")-e.height()/2-parseFloat(e.css("padding-top"))+u+p+1}}else{var g=f().expandCollapseCuePosition;a="function"==typeof g?g.call(this,e):g}var h=i.convertToRenderedPosition(a),y=((l=Math.max(l,l*o.zoom()))-(c=Math.max(c,c*o.zoom())))/2,x=h.x,E=h.y,m=x-l/2,C=E-l/2,b=l;if(d&&f().expandCueImage)v(f().expandCueImage,m,C,l,l);else if(!d&&f().collapseCueImage)v(f().collapseCueImage,m,C,l,l);else{var w=r.fillStyle,T=r.lineWidth,N=r.strokeStyle;r.fillStyle="black",r.strokeStyle="black",r.ellipse(x,E,l/2,l/2,0,0,2*Math.PI),r.fill(),r.beginPath(),r.strokeStyle="white",r.lineWidth=Math.max(2.6,2.6*o.zoom()),r.moveTo(m+y,C+l/2),r.lineTo(m+c+y,C+l/2),d&&(r.moveTo(m+l/2,C+y),r.lineTo(m+l/2,C+c+y)),r.closePath(),r.stroke(),r.strokeStyle=N,r.fillStyle=w,r.lineWidth=T}e._private.data.expandcollapseRenderedStartX=m,e._private.data.expandcollapseRenderedStartY=C,e._private.data.expandcollapseRenderedCueSize=b,s=e}}(n)}}),o.on("tap",g.eTap=function(e){var n=s;if(n){var t=n.data("expandcollapseRenderedStartX"),a=n.data("expandcollapseRenderedStartY"),i=n.data("expandcollapseRenderedCueSize"),l=t+i,r=a+i,c=e.renderedPosition||e.cyRenderedPosition,p=c.x,u=c.y,g=f(),v=(g.expandCollapseCueSensitivity-1)/2;Math.abs(x.x-E.x)<5&&Math.abs(x.y-E.y)<5&&p>=t-i*v&&p<=l+i*v&&u>=a-i*v&&u<=r+i*v&&(g.undoable&&!y&&(y=o.undoRedo({defaultActions:!1})),d.isCollapsible(n)?(h(),g.undoable?y.do("collapse",{nodes:n,options:g}):d.collapse(n,g)):d.isExpandable(n)&&(h(),g.undoable?y.do("expand",{nodes:n,options:g}):d.expand(n,g)),n.selectable()&&(n.unselectify(),o.scratch("_cyExpandCollapse").selectableChanged=!0))}}),o.on("afterUndo afterRedo",g.eUndoRedo=g.eSelect),o.on("position","node",g.ePosition=a(g.eSelect,100,h)),o.on("pan zoom",g.ePosition),g.hasEventFields=!0,function(e){var n=o.scratch("_cyExpandCollapse");null==n&&(n={}),n.cueUtilities=e,o.scratch("_cyExpandCollapse",n)}(g)},unbind:function(){var e=r();e.hasEventFields?(o.trigger("expandcollapse.clearvisualcue"),o.off("mousedown","node",e.eMouseDown).off("mouseup","node",e.eMouseUp).off("remove","node",e.eRemove).off("tap","node",e.eTap).off("add","node",e.eAdd).off("position","node",e.ePosition).off("pan zoom",e.ePosition).off("select unselect",e.eSelect).off("free","node",e.eFree).off("resize",e.eCyResize).off("afterUndo afterRedo",e.eUndoRedo)):console.log("events to unbind does not exist")},rebind:function(){var e=r();e.hasEventFields?o.on("mousedown","node",e.eMouseDown).on("mouseup","node",e.eMouseUp).on("remove","node",e.eRemove).on("tap","node",e.eTap).on("add","node",e.eAdd).on("position","node",e.ePosition).on("pan zoom",e.ePosition).on("select unselect",e.eSelect).on("free","node",e.eFree).on("resize",e.eCyResize).on("afterUndo afterRedo",e.eUndoRedo):console.log("events to rebind does not exist")}};if(c[l])return c[l].apply(o.container(),Array.prototype.slice.call(arguments,1));if("object"==typeof l||!l)return c.init.apply(o.container(),arguments);throw new Error("No such function `"+l+"` for cytoscape.js-expand-collapse")}},630:e=>{var o,n,t=(o=Math.max,n=Date.now||function(){return(new Date).getTime()},function(e,t,a){var d,i,s,l,r,c,p,u,g,f=0,h=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");if(t=t<0?0:+t||0,!0===a){var y=!0;v=!1}else g=typeof(u=a),!u||"object"!=g&&"function"!=g||(y=!!a.leading,h="maxWait"in a&&o(+a.maxWait||0,t),v="trailing"in a?!!a.trailing:v);function x(o,t){t&&clearTimeout(t),i=c=p=void 0,o&&(f=n(),s=e.apply(r,d),c||i||(d=r=void 0))}function E(){var e=t-(n()-l);e<=0||e>t?x(p,i):c=setTimeout(E,e)}function m(){x(v,c)}function C(){if(d=arguments,l=n(),r=this,p=v&&(c||!y),!1===h)var o=y&&!c;else{i||y||(f=l);var a=h-(l-f),u=a<=0||a>h;u?(i&&(i=clearTimeout(i)),f=l,s=e.apply(r,d)):i||(i=setTimeout(m,a))}return u&&c?c=clearTimeout(c):c||t===h||(c=setTimeout(E,t)),o&&(u=!0,s=e.apply(r,d)),!u||c||i||(d=r=void 0),s}return C.cancel=function(){c&&clearTimeout(c),i&&clearTimeout(i),f=0,i=c=p=void 0},C});e.exports=t},438:e=>{e.exports=function(e,o,n){let t,a=!0;return function(){const d=this,i=arguments;clearTimeout(t),t=setTimeout((function(){t=null,e.apply(d,i),a=!0}),o),a&&(n.apply(d,i),a=!1)}}},537:e=>{e.exports=function(e){return{moveNodes:function(e,o,n){var t=n?o:this.getTopMostNodes(o),a=t.not(":parent");a.positions((function(o,n){return{x:a[n].position("x")+e.x,y:a[n].position("y")+e.y}}));for(var d=0;d<t.length;d++){var i=t[d].children();this.moveNodes(e,i,!0)}},getTopMostNodes:function(e){for(var o={},n=0;n<e.length;n++)o[e[n].id()]=!0;var t=e.filter((function(e,n){"number"==typeof e&&(e=n);for(var t=e.parent()[0];null!=t;){if(o[t.id()])return!1;t=t.parent()[0]}return!0}));return t},rearrange:function(o){if("function"==typeof o)o();else if(null!=o){var n=e.layout(o);n&&n.run&&n.run()}},convertToRenderedPosition:function(o){var n=e.pan(),t=e.zoom();return{x:o.x*t+n.x,y:o.y*t+n.y}}}}},272:(e,o,n)=>{var t=n(78);e.exports=function(e){var o=n(537)(e);return{animatedlyMovingNodeCount:0,expandNodeBaseFunction:function(n,t,a){if(n._private.data.collapsedChildren){var d={x:n._private.position.x-n._private.data["position-before-collapse"].x,y:n._private.position.y-n._private.data["position-before-collapse"].y};n.removeData("infoLabel"),n.removeClass("cy-expand-collapse-collapsed-node"),n.trigger("expandcollapse.beforeexpand");var i=n._private.data.collapsedChildren;i.restore();for(var s=e.scratch("_cyExpandCollapse").parentData,l=0;l<i.length;l++)delete s[i[l].id()];e.scratch("_cyExpandCollapse").parentData=s,this.repairEdges(n),n._private.data.collapsedChildren=null,o.moveNodes(d,n.children()),n.removeData("position-before-collapse"),n.trigger("position"),n.trigger("expandcollapse.afterexpand"),t&&this.endOperation(a,n)}},simpleCollapseGivenNodes:function(e){e.data("collapse",!0);for(var n=o.getTopMostNodes(e),t=0;t<n.length;t++){var a=n[t];this.collapseBottomUp(a)}return e},simpleExpandGivenNodes:function(e,n){e.data("expand",!0);for(var t=o.getTopMostNodes(e),a=0;a<t.length;a++){var d=t[a];this.expandTopDown(d,n)}return e},simpleExpandAllNodes:function(n,t){var a;void 0===n&&(n=e.nodes()),a=o.getTopMostNodes(n);for(var d=[],i=0;i<a.length;i++){var s=a[i];this.expandAllTopDown(s,d,t)}return d},endOperation:function(n,t){e.ready((function(){setTimeout((function(){o.rearrange(n),e.scratch("_cyExpandCollapse").selectableChanged&&(t.selectify(),e.scratch("_cyExpandCollapse").selectableChanged=!1)}),0)}))},expandAllNodes:function(e,o){var n=this.simpleExpandAllNodes(e,o.fisheye);return this.endOperation(o.layoutBy,e),n},expandAllTopDown:function(e,o,n){null!=e._private.data.collapsedChildren&&(o.push(e),this.expandNode(e,n));for(var t=e.children(),a=0;a<t.length;a++){var d=t[a];this.expandAllTopDown(d,o,n)}},expandGivenNodes:function(e,o){if(1===e.length){var n=e[0];null!=n._private.data.collapsedChildren&&this.expandNode(n,o.fisheye,!0,o.animate,o.layoutBy,o.animationDuration)}else this.simpleExpandGivenNodes(e,o.fisheye),this.endOperation(o.layoutBy,e);return e},collapseGivenNodes:function(o,n){return e.startBatch(),this.simpleCollapseGivenNodes(o),e.endBatch(),o.trigger("position"),this.endOperation(n.layoutBy,o),e.style().update(),o},collapseBottomUp:function(e){for(var o=e.children(),n=0;n<o.length;n++){var t=o[n];this.collapseBottomUp(t)}e.data("collapse")&&e.children().length>0&&(this.collapseNode(e),e.removeData("collapse"))},expandTopDown:function(e,o){e.data("expand")&&null!=e._private.data.collapsedChildren&&(this.expandNode(e,o),e.removeData("expand"));for(var n=e.children(),t=0;t<n.length;t++){var a=n[t];this.expandTopDown(a)}},convertToModelPosition:function(o){var n=e.pan(),t=e.zoom();return{x:(o.x-n.x)/t,y:(o.y-n.y)/t}},expandNode:function(o,n,a,d,i,s){var l=this,r=function(e,o,n,t,a,d){o&&(e._private.data["width-before-fisheye"]=e._private.data["size-before-collapse"].w,e._private.data["height-before-fisheye"]=e._private.data["size-before-collapse"].h,l.fishEyeViewExpandGivenNode(e,n,e,t,a,d)),n&&o&&t||l.expandNodeBaseFunction(e,n,a)};if(null!=o._private.data.collapsedChildren){this.storeWidthHeight(o);var c=!1;if(n&&a){var p=this.convertToModelPosition({x:0,y:0}),u=this.convertToModelPosition({x:e.width(),y:e.height()}),g={x1:p.x,x2:u.x,y1:p.y,y2:u.y},f={x1:o._private.position.x-o._private.data["size-before-collapse"].w/2-80,x2:o._private.position.x+o._private.data["size-before-collapse"].w/2+80,y1:o._private.position.y-o._private.data["size-before-collapse"].h/2-80,y2:o._private.position.y+o._private.data["size-before-collapse"].h/2+80},h=t.getUnion(f,g);if(!t.equalBoundingBoxes(h,g)){var v=e.getFitViewport(h,10);l=this,c=d,d?e.animate({pan:v.pan,zoom:v.zoom,complete:function(){r(o,n,a,d,i,s)}},{duration:s||1e3}):(e.zoom(v.zoom),e.pan(v.pan))}}return c||r(o,n,a,d,i,s),o}},collapseNode:function(e){if(null==e._private.data.collapsedChildren){e.data("position-before-collapse",{x:e.position().x,y:e.position().y}),e.data("size-before-collapse",{w:e.outerWidth(),h:e.outerHeight()});var o=e.children();return o.unselect(),o.connectedEdges().unselect(),e.trigger("expandcollapse.beforecollapse"),this.barrowEdgesOfcollapsedChildren(e),this.removeChildren(e,e),e.addClass("cy-expand-collapse-collapsed-node"),e.trigger("expandcollapse.aftercollapse"),e.position(e.data("position-before-collapse")),e}},storeWidthHeight:function(e){null!=e&&(e._private.data["x-before-fisheye"]=this.xPositionInParent(e),e._private.data["y-before-fisheye"]=this.yPositionInParent(e),e._private.data["width-before-fisheye"]=e.outerWidth(),e._private.data["height-before-fisheye"]=e.outerHeight(),null!=e.parent()[0]&&this.storeWidthHeight(e.parent()[0]))},fishEyeViewExpandGivenNode:function(e,o,n,t,a,d){var i=this.getSiblings(e),s=this.xPositionInParent(e),l=this.yPositionInParent(e),r=Math.abs((e._private.data["width-before-fisheye"]-e.outerWidth())/2),c=Math.abs((e._private.data["width-before-fisheye"]-e.outerWidth())/2),p=Math.abs((e._private.data["height-before-fisheye"]-e.outerHeight())/2),u=Math.abs((e._private.data["height-before-fisheye"]-e.outerHeight())/2),g=Math.abs(e._private.data["x-before-fisheye"]-s),f=Math.abs(e._private.data["y-before-fisheye"]-l);e._private.data["x-before-fisheye"]>s?(r+=g,c-=g):(r-=g,c+=g),e._private.data["y-before-fisheye"]>l?(p+=f,u-=f):(p-=f,u+=f);for(var h=[],v=[],y=0;y<i.length;y++)h.push(this.xPositionInParent(i[y])),v.push(this.yPositionInParent(i[y]));for(y=0;y<i.length;y++){var x,E,m=i[y],C=h[y],b=v[y],w=(b-l)/(C-s),T=0,N=0;x=s>C?r:c,E=l>b?p:u,isFinite(w)&&(T=Math.min(x,E/Math.abs(w))),0!==w&&(N=Math.min(E,x*Math.abs(w))),s>C&&(T*=-1),l>b&&(N*=-1),this.fishEyeViewMoveNode(m,T,N,n,o,t,a,d)}return 0==i.length&&e.same(n)&&this.expandNodeBaseFunction(n,o,a),null!=e.parent()[0]&&this.fishEyeViewExpandGivenNode(e.parent()[0],o,n,t,a,d),e},getSiblings:function(o){return null==o.parent()[0]?e.nodes(":visible").orphans().difference(o):o.siblings(":visible")},fishEyeViewMoveNode:function(o,n,t,a,d,i,s,l){var r=e.collection();o.isParent()&&(r=o.children(":visible"));var c=this;if(0==r.length){var p={x:o._private.position.x+n,y:o._private.position.y+t};d&&i?(this.animatedlyMovingNodeCount++,o.animate({position:p,complete:function(){c.animatedlyMovingNodeCount--,c.animatedlyMovingNodeCount>0||!a.hasClass("cy-expand-collapse-collapsed-node")||c.expandNodeBaseFunction(a,d,s)}},{duration:l||1e3})):o.position(p)}else for(var u=0;u<r.length;u++)this.fishEyeViewMoveNode(r[u],n,t,a,d,i,s,l)},xPositionInParent:function(e){var o=e.parent()[0];return null!=o?e.relativePosition("x")+o.width()/2:e.position("x")},yPositionInParent:function(e){var o=e.parent()[0];return null!=o?e.relativePosition("y")+o.height()/2:e.position("y")},removeChildren:function(o,n){for(var t=o.children(),a=0;a<t.length;a++){var d=t[a];this.removeChildren(d,n);var i=e.scratch("_cyExpandCollapse").parentData;i[d.id()]=d.parent(),e.scratch("_cyExpandCollapse").parentData=i;var s=d.remove();null==n._private.data.collapsedChildren?n._private.data.collapsedChildren=s:n._private.data.collapsedChildren=n._private.data.collapsedChildren.union(s)}},isMetaEdge:function(e){return e.hasClass("cy-expand-collapse-meta-edge")},barrowEdgesOfcollapsedChildren:function(o){var n=o.descendants(),t=n.edgesWith(e.nodes().not(n.union(o))),a={};n.each((function(e,o){"number"==typeof e&&(e=o),a[e.id()]=!0}));for(var d=0;d<t.length;d++){var i=t[d],s=i.source(),l=i.target();if(!this.isMetaEdge(i)){var r={source:s,target:l};i.addClass("cy-expand-collapse-meta-edge"),i.data("originalEnds",r)}i.move({target:a[l.id()]?o.id():l.id(),source:a[s.id()]?o.id():s.id()})}},findNewEnd:function(o){for(var n=o,t=e.scratch("_cyExpandCollapse").parentData,a=t[n.id()];!n.inside();)n=a,a=t[a.id()];return n},repairEdges:function(e){for(var o=e.connectedEdges(".cy-expand-collapse-meta-edge"),n=0;n<o.length;n++){var t=o[n],a=t.data("originalEnds"),d=t.data("source");t.data("target"),(t=d===e.id()?t.move({source:this.findNewEnd(a.source).id()}):t.move({target:this.findNewEnd(a.target).id()})).data("source")===a.source.id()&&t.data("target")===a.target.id()&&(t.removeClass("cy-expand-collapse-meta-edge"),t.removeData("originalEnds"))}},isOuterNode:function(e,o){for(var n=e;null!=n;){if(n==o)return!1;n=n.parent()[0]}return!0},getCollapsedChildrenRecursively:function(e,o){var n,t=e.data("collapsedChildren")||[];for(n=0;n<t.length;n++)t[n].data("collapsedChildren")&&(o=o.union(this.getCollapsedChildrenRecursively(t[n],o))),o=o.union(t[n]);return o},collapseGivenEdges:function(o,n){o.unselect();var t=o.connectedNodes(),a={};if(n.groupEdgesOfSameTypeOnCollapse)o.forEach((function(o){var t="unknown";if(void 0!==n.edgeTypeInfo&&(t=n.edgeTypeInfo instanceof Function?n.edgeTypeInfo.call(o):o.data()[n.edgeTypeInfo]),a.hasOwnProperty(t))a[t].edges=a[t].edges.add(o),"unidirection"!=a[t].directionType||a[t].source==o.source().id()&&a[t].target==o.target().id()||(a[t].directionType="bidirection");else{var d=e.collection();d=d.add(o),a[t]={edges:d,directionType:"unidirection",source:o.source().id(),target:o.target().id()}}}));else{a.unknown={edges:o,directionType:"unidirection",source:o[0].source().id(),target:o[0].target().id()};for(var d=0;d<o.length;d++)if("unidirection"==a.unknown.directionType&&(a.unknown.source!=o[d].source().id()||a.unknown.target!=o[d].target().id())){a.unknown.directionType="bidirection";break}}var i={edges:e.collection(),oldEdges:e.collection()},s=[];for(const d in a)if(!(a[d].edges.length<2)){o.trigger("expandcollapse.beforecollapseedge"),i.oldEdges=i.oldEdges.add(a[d].edges);var l={group:"edges",data:{}};l.data.source=a[d].source,l.data.target=a[d].target;var r=t[0].id(),c=r;t[1]&&(c=t[1].id()),l.data.id="collapsedEdge_"+r+"_"+c+"_"+d+"_"+Math.floor(Math.random()*Date.now()),l.data.collapsedEdges=e.collection(),a[d].edges.forEach((function(e){l.data.collapsedEdges=l.data.collapsedEdges.add(e)})),l.data.collapsedEdges=this.check4nestedCollapse(l.data.collapsedEdges,n);var p="edgeType";void 0!==n.edgeTypeInfo&&(p=n.edgeTypeInfo instanceof Function?p:n.edgeTypeInfo),l.data[p]=d,l.data.directionType=a[d].directionType,l.classes="cy-expand-collapse-collapsed-edge",s.push(l),e.remove(a[d].edges),o.trigger("expandcollapse.aftercollapseedge")}return i.edges=e.add(s),i},check4nestedCollapse:function(o,n){if(n.allowNestedEdgeCollapse)return o;let t=e.collection();for(let e=0;e<o.length;e++){let n=o[e],a=n.data("collapsedEdges");t=a&&a.length>0?t.add(a):t.add(n)}return t},expandEdge:function(o){o.unselect();var n={edges:e.collection(),oldEdges:e.collection()},t=o.data("collapsedEdges");return void 0!==t&&t.length>0&&(o.trigger("expandcollapse.beforeexpandedge"),n.oldEdges=n.oldEdges.add(o),e.remove(o),n.edges=e.add(t),o.trigger("expandcollapse.afterexpandedge")),n},isValidEdgesForCollapse:function(e){var o=this.getEdgesDistinctEndPoints(e);return 2==o.length&&o},getEdgesDistinctEndPoints:function(e){var o=[];return e.forEach(function(e){this.containsElement(o,e.source())||o.push(e.source()),this.containsElement(o,e.target())||o.push(e.target())}.bind(this)),o},containsElement:function(e,o){for(var n=!1,t=0;t<e.length;t++)if(e[t].id()==o.id()){n=!0;break}return n}}}},497:(e,o,n)=>{var t;!function(){"use strict";var a=function(e){if(e){var o=n(699),t=n(540),a=null;e("core","expandCollapse",(function(e){var r=this,c=s(r,"options")||{layoutBy:null,fisheye:!0,animate:!0,animationDuration:1e3,ready:function(){},undoable:!0,cueEnabled:!0,expandCollapseCuePosition:"top-left",expandCollapseCueSize:12,expandCollapseCueLineSize:8,expandCueImage:void 0,collapseCueImage:void 0,expandCollapseCueSensitivity:1,edgeTypeInfo:"edgeType",groupEdgesOfSameTypeOnCollapse:!1,allowNestedEdgeCollapse:!0,zIndex:999};if("get"!==e){c=d(c,e);var p=function(e,o){var n={};function r(o){var t=s(e,"options");o.cueEnabled&&!t.cueEnabled?n.enableCue():!o.cueEnabled&&t.cueEnabled&&n.disableCue()}return n.setOptions=function(o){r(o),l(e,"options",o)},n.extendOptions=function(o){var n=d(s(e,"options"),o);r(n),l(e,"options",n)},n.setOption=function(o,n){var t={};t[o]=n;var a=d(s(e,"options"),t);r(a),l(e,"options",a)},n.collapse=function(n,t){var a=this.collapsibleNodes(n),l=d(s(e,"options"),t);return i(l),o.collapseGivenNodes(a,l)},n.collapseRecursively=function(o,n){var t=this.collapsibleNodes(o),a=d(s(e,"options"),n);return i(a),this.collapse(t.union(t.descendants()),a)},n.expand=function(n,t){var a=this.expandableNodes(n),l=d(s(e,"options"),t);return i(l),o.expandGivenNodes(a,l)},n.expandRecursively=function(n,t){var a=this.expandableNodes(n),l=d(s(e,"options"),t);return i(l),o.expandAllNodes(a,l)},n.collapseAll=function(o){var n=d(s(e,"options"),o);return i(n),this.collapseRecursively(this.collapsibleNodes(),n)},n.expandAll=function(o){var n=d(s(e,"options"),o);return i(n),this.expandRecursively(this.expandableNodes(),n)},n.isExpandable=function(e){return e.hasClass("cy-expand-collapse-collapsed-node")},n.isCollapsible=function(e){return!this.isExpandable(e)&&e.isParent()},n.collapsibleNodes=function(o){var n=this;return(o||e.nodes()).filter((function(e,o){return"number"==typeof e&&(e=o),n.isCollapsible(e)}))},n.expandableNodes=function(o){var n=this;return(o||e.nodes()).filter((function(e,o){return"number"==typeof e&&(e=o),n.isExpandable(e)}))},n.getCollapsedChildren=function(e){return e.data("collapsedChildren")},n.getCollapsedChildrenRecursively=function(n){var t=e.collection();return o.getCollapsedChildrenRecursively(n,t)},n.getAllCollapsedChildrenRecursively=function(){var o,n=e.collection(),t=e.nodes(".cy-expand-collapse-collapsed-node");for(o=0;o<t.length;o++)n=n.union(this.getCollapsedChildrenRecursively(t[o]));return n},n.clearVisualCue=function(o){e.trigger("expandcollapse.clearvisualcue")},n.disableCue=function(){var o=s(e,"options");o.cueEnabled&&(t("unbind",e,n),o.cueEnabled=!1)},n.enableCue=function(){var o=s(e,"options");o.cueEnabled||(t("rebind",e,n),o.cueEnabled=!0)},n.getParent=function(o){return void 0===e.getElementById(o)[0]?s(e,"parentData")[o]:e.getElementById(o).parent()},n.collapseEdges=function(n,t){var a={edges:e.collection(),oldEdges:e.collection()};if(n.length<2)return a;if(!function(e){let o=[];for(let n=0;n<e.length;n++){const t=e[n].source().id(),a=e[n].target().id(),d={};d[t]=!0,d[a]=!0,o.push(d)}for(let e=0;e<o.length;e++)for(let n=e+1;n<o.length;n++){const t=Object.keys(o[e]),a=Object.keys(o[n]),d=new Set(t.concat(a));if(d.size!=t.length||d.size!=a.length)return!1}return!0}(n))return a;var i=d(s(e,"options"),t);return o.collapseGivenEdges(n,i)},n.expandEdges=function(n){var t={edges:e.collection(),oldEdges:e.collection()};return void 0===n||n.forEach((function(e){var n=o.expandEdge(e);t.edges=t.edges.add(n.edges),t.oldEdges=t.oldEdges.add(n.oldEdges)})),t},n.collapseEdgesBetweenNodes=function(n,t){var a,i,l=d(s(e,"options"),t),r=(i=[],(a=n).slice(0,a.length-1).forEach((function(e,o){a.slice(o+1,a.length).forEach((function(o){i.push([e,o])}))})),i);r.push(...n.map((e=>[e,e])));var c={edges:e.collection(),oldEdges:e.collection()};return r.forEach(function(e){const n=e[1].id();var t=e[0].connectedEdges('[source = "'+n+'"],[target = "'+n+'"]');if(e[0].id()===n&&(t=e[0].connectedEdges('[source = "'+n+'"][target = "'+n+'"]')),t.length>=2){var a=o.collapseGivenEdges(t,l);c.oldEdges=c.oldEdges.add(a.oldEdges),c.edges=c.edges.add(a.edges)}}.bind(this)),c},n.expandEdgesBetweenNodes=function(o){var n,t,a=e.collection(),d=(t=[],(n=o).slice(0,n.length-1).forEach((function(e,o){n.slice(o+1,n.length).forEach((function(o){t.push([e,o])}))})),t);return d.push(...o.map((e=>[e,e]))),d.forEach(function(e){const o=e[1].id();var n=e[0].connectedEdges('.cy-expand-collapse-collapsed-edge[source = "'+o+'"],[target = "'+o+'"]');e[0].id()===o&&(n=e[0].connectedEdges('[source = "'+o+'"][target = "'+o+'"]')),a=a.union(n)}.bind(this)),this.expandEdges(a)},n.collapseAllEdges=function(o){return this.collapseEdgesBetweenNodes(e.edges().connectedNodes(),o)},n.expandAllEdges=function(){var o=e.edges(".cy-expand-collapse-collapsed-edge"),n={edges:e.collection(),oldEdges:e.collection()},t=this.expandEdges(o);return n.oldEdges=n.oldEdges.add(t.oldEdges),n.edges=n.edges.add(t.edges),n},n.loadJson=function(e){a.loadJson(e)},n.saveJson=function(e,o){return a.saveJson(e,o)},n}(r,n(272)(r));a=n(554)(r,p),l(r,"api",p),o(r,p),t(c,r,p),c.cueEnabled||t("unbind",r,p),c.ready&&c.ready(),l(r,"options",c),l(r,"parentData",{})}return s(r,"api")}))}function d(e,o){var n={};for(var t in e)n[t]=e[t];for(var t in o)n.hasOwnProperty(t)&&(n[t]=o[t]);return n}function i(e){var o="function"==typeof e.animate?e.animate.call():e.animate,n="function"==typeof e.fisheye?e.fisheye.call():e.fisheye;e.animate=o,e.fisheye=n}function s(e,o){void 0===e.scratch("_cyExpandCollapse")&&e.scratch("_cyExpandCollapse",{});var n=e.scratch("_cyExpandCollapse");return void 0===o?n:n[o]}function l(e,o,n){s(e)[o]=n}};e.exports&&(e.exports=a),void 0===(t=function(){return a}.call(o,n,o,e))||(e.exports=t),"undefined"!=typeof cytoscape&&a(cytoscape)}()},554:e=>{e.exports=function(e,o){function n(o,a,d,i){o.sort((e=>"edges"===e.group?1:-1));let s=e.collection();for(let l=0;l<o.length;l++){const r=o[l],c=r.data;c.parent&&(i[c.id]=c.parent);const p={x:r.position.x,y:r.position.y},u=e.add(r);if(u.isNode()&&a.merge(u),c.originalEnds){let e=a.$id(c.originalEnds.source.data.id);c.originalEnds.source.data.parent&&(i[c.originalEnds.source.data.id]=c.originalEnds.source.data.parent);let o=a.$id(c.originalEnds.target.data.id);c.originalEnds.target.data.parent&&(i[c.originalEnds.target.data.id]=c.originalEnds.target.data.parent),u.data("originalEnds",{source:e,target:o})}c.collapsedChildren?(d.merge(u),n(c.collapsedChildren,a,d,i),t(u)):c.collapsedEdges&&(u.data("collapsedEdges",n(c.collapsedEdges,a,d,i)),e.remove(u.data("collapsedEdges"))),u.position(p),s.merge(u)}return s}function t(e){e.data("collapsedChildren",null),e.removeClass("cy-expand-collapse-collapsed-node"),e.data("position-before-collapse",null),e.data("size-before-collapse",null),e.data("expandcollapseRenderedStartX",null),e.data("expandcollapseRenderedStartY",null),e.data("expandcollapseRenderedCueSize",null)}function a(e){let o=[];for(let n=0;n<e.length;n++){const t=e[n];let i=null;if(t.collapsedChildren||t.collapsedEdges?t.collapsedChildren?(t.collapsedChildren=a(d(t.collapsedChildren)),i=t.cy.json(),i.data.collapsedChildren=t.collapsedChildren):t.collapsedEdges&&(t.collapsedEdges=a(d(t.collapsedEdges)),i=t.cy.json(),i.data.collapsedEdges=t.collapsedEdges):i=t.cy.json(),t.originalEnds){const e=t.originalEnds.source.json(),o=t.originalEnds.target.json();e.data.collapsedChildren&&(e.data.collapsedChildren=a(d(e.data.collapsedChildren))),o.data.collapsedChildren&&(o.data.collapsedChildren=a(d(o.data.collapsedChildren))),i.data.originalEnds={source:e,target:o}}o.push(i)}return o}function d(e){let o=[];for(let n=0;n<e.length;n++)o.push({cy:e[n],collapsedEdges:e[n].data("collapsedEdges"),collapsedChildren:e[n].data("collapsedChildren"),originalEnds:e[n].data("originalEnds")});return o}return{loadJson:function(a){const d=JSON.parse(a),i={},s=e.collection(),l=e.collection(),r={};for(const o of d.nodes){i[o.data.id]={x:o.position.x,y:o.position.y},o.data.parent&&(r[o.data.id]=o.data.parent);const a=e.add(o);s.merge(a),a.data("collapsedChildren")&&(n(a.data("collapsedChildren"),s,l,r),l.merge(a),t(a))}for(const o of d.edges){const t=e.add(o);if(t.data("collapsedEdges")&&(t.data("collapsedEdges",n(o.data.collapsedEdges,s,l,r)),e.remove(t.data("collapsedEdges"))),t.data("originalEnds")){const e=o.data.originalEnds.source.data.id,n=o.data.originalEnds.target.data.id;o.data.originalEnds={source:s.filter("#"+e),target:s.filter("#"+n)}}}for(let e in r){const o=s.$id(e);1===o.length&&o.move({parent:r[e]})}o.collapse(l,{layoutBy:null,fisheye:!1,animate:!1});for(const o of d.nodes)e.$id(o.data.id).isChildless()&&e.$id(o.data.id).position(i[o.data.id]);e.fit()},saveJson:function(o,n){o||(o=e.$());const t=d(o.nodes()),i=d(o.edges());if(i.length+t.length<1)return;const s={nodes:[],edges:[]};for(const e of i){if(e.collapsedEdges&&(e.collapsedEdges=a(d(e.collapsedEdges))),e.originalEnds){const o=e.originalEnds.source.json(),n=e.originalEnds.target.json();o.data.collapsedChildren&&(o.data.collapsedChildren=a(d(o.data.collapsedChildren))),n.data.collapsedChildren&&(n.data.collapsedChildren=a(d(n.data.collapsedChildren))),e.originalEnds={source:o,target:n}}const o=e.cy.json();o.data.collapsedEdges=e.collapsedEdges,o.data.originalEnds=e.originalEnds,s.edges.push(o)}for(const e of t){e.collapsedChildren&&(e.collapsedChildren=a(d(e.collapsedChildren)));const o=e.cy.json();o.data.collapsedChildren=e.collapsedChildren,s.nodes.push(o)}let l=JSON.stringify(s);return n&&function(e,o){const n=new Blob([e],{type:"text/plain"}),t=document.createElement("a");t.download=o,t.href=window.URL.createObjectURL(n),t.dataset.downloadurl=["text/plain",t.download,t.href].join(":"),t.click()}(l,n),l}}}},699:e=>{e.exports=function(e,o){if(null!=e.undoRedo){for(var n=e.undoRedo({},!0),t={layoutBy:null,animate:!1,fisheye:!1},a=["collapse","collapseRecursively","collapseAll","expand","expandRecursively","expandAll"],d=0;d<a.length;d++)2==d?n.action("collapseAll",s("collapseAll"),s("expandRecursively")):5==d?n.action("expandAll",s("expandAll"),s("collapseRecursively")):n.action(a[d],s(a[d]),s(a[(d+3)%6]));n.action("collapseEdges",l,p),n.action("expandEdges",p,l),n.action("collapseEdgesBetweenNodes",r,u),n.action("expandEdgesBetweenNodes",u,r),n.action("collapseAllEdges",c,g),n.action("expandAllEdges",g,c)}function i(){for(var o={},n=e.nodes(),t=0;t<n.length;t++){var a=n[t];o[a.id()]={x:a.position("x"),y:a.position("y")}}return o}function s(n){return function(a){var d,s,l,r={},c="string"==typeof(d=a.nodes)?e.$(d):d;return a.firstTime?(r.oldData=i(),r.nodes=n.indexOf("All")>0?o[n](a.options):o[n](c,a.options)):(r.oldData=i(),r.nodes=n.indexOf("All")>0?o[n](t):o[n](e.collection(c),t),s=a.oldData,l={},e.nodes().not(":parent").positions((function(e,o){"number"==typeof e&&(e=o),l[e.id()]={x:e.position("x"),y:e.position("y")};var n=s[e.id()];return{x:n.x,y:n.y}}))),r}}function l(n){var t=n.options,a=n.edges,d={};if(d.options=t,n.firstTime){var i=o.collapseEdges(a,t);d.edges=i.edges,d.oldEdges=i.oldEdges,d.firstTime=!1}else d.oldEdges=a,d.edges=n.oldEdges,n.edges.length>0&&n.oldEdges.length>0&&(e.remove(n.edges),e.add(n.oldEdges));return d}function r(n){var t=n.options,a={};if(a.options=t,n.firstTime){var d=o.collapseEdgesBetweenNodes(n.nodes,t);a.edges=d.edges,a.oldEdges=d.oldEdges,a.firstTime=!1}else a.edges=n.oldEdges,a.oldEdges=n.edges,n.edges.length>0&&n.oldEdges.length>0&&(e.remove(n.edges),e.add(n.oldEdges));return a}function c(n){var t=n.options,a={};if(a.options=t,n.firstTime){var d=o.collapseAllEdges(t);a.edges=d.edges,a.oldEdges=d.oldEdges,a.firstTime=!1}else a.edges=n.oldEdges,a.oldEdges=n.edges,n.edges.length>0&&n.oldEdges.length>0&&(e.remove(n.edges),e.add(n.oldEdges));return a}function p(n){var t=n.options,a={};if(a.options=t,n.firstTime){var d=o.expandEdges(n.edges);a.edges=d.edges,a.oldEdges=d.oldEdges,a.firstTime=!1}else a.oldEdges=n.edges,a.edges=n.oldEdges,n.edges.length>0&&n.oldEdges.length>0&&(e.remove(n.edges),e.add(n.oldEdges));return a}function u(n){var t=n.options,a={};if(a.options=t,n.firstTime){var d=o.expandEdgesBetweenNodes(n.nodes,t);a.edges=d.edges,a.oldEdges=d.oldEdges,a.firstTime=!1}else a.edges=n.oldEdges,a.oldEdges=n.edges,n.edges.length>0&&n.oldEdges.length>0&&(e.remove(n.edges),e.add(n.oldEdges));return a}function g(n){var t=n.options,a={};if(a.options=t,n.firstTime){var d=o.expandAllEdges(t);a.edges=d.edges,a.oldEdges=d.oldEdges,a.firstTime=!1}else a.edges=n.oldEdges,a.oldEdges=n.edges,n.edges.length>0&&n.oldEdges.length>0&&(e.remove(n.edges),e.add(n.oldEdges));return a}}}},o={},function n(t){var a=o[t];if(void 0!==a)return a.exports;var d=o[t]={exports:{}};return e[t](d,d.exports,n),d.exports}(497);var e,o}));