@pickaxeproject/react 3.21.0 → 3.22.1
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/cjs/common/documents.js +1 -1
- package/dist/cjs/common/utils.js +1 -1
- package/dist/cjs/components/Core/Textarea.js +1 -1
- package/dist/cjs/components/Icons/chevron-up.svg.js +1 -0
- package/dist/cjs/components/Pickaxe/Addons/Document/List.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeCopyButton.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Others/Think.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMessageActions.js +1 -1
- package/dist/cjs/hooks/pickaxe/useThumbSelection.js +1 -1
- package/dist/cjs/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
- package/dist/cjs/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
- package/dist/cjs/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
- package/dist/cjs/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
- package/dist/cjs/src/common/utils.d.ts +2 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/Others/Think.d.ts +2 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.d.ts +0 -2
- package/dist/cjs/src/hooks/pickaxe/useThumbSelection.d.ts +2 -3
- package/dist/cjs/src/types/pickaxe.d.ts +1 -1
- package/dist/esm/common/documents.js +1 -1
- package/dist/esm/common/utils.js +1 -1
- package/dist/esm/components/Core/Textarea.js +1 -1
- package/dist/esm/components/Icons/chevron-up.svg.js +1 -0
- package/dist/esm/components/Pickaxe/Addons/Document/List.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeCopyButton.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Others/Think.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMessageActions.js +1 -1
- package/dist/esm/hooks/pickaxe/useThumbSelection.js +1 -1
- package/dist/esm/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
- package/dist/esm/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
- package/dist/esm/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
- package/dist/esm/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
- package/dist/esm/src/common/utils.d.ts +2 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/Others/Think.d.ts +2 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.d.ts +0 -2
- package/dist/esm/src/hooks/pickaxe/useThumbSelection.d.ts +2 -3
- package/dist/esm/src/types/pickaxe.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s,Fragment as i}from"react/jsx-runtime";import{useStyleFontSize as t}from"../../../hooks/studio/useStyleFontSize.js";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitFeedback as a}from"../../../hooks/pickaxe/useSubmitFeedback.js";import{useThumbSelection as n}from"../../../hooks/pickaxe/useThumbSelection.js";import{AnimatePresence as l,motion as c}from"framer-motion";import r from"../../Icons/message-square-notes.svg.js";import m from"../../Icons/thumbs-down.svg.js";import p from"../../Icons/thumbs-up.svg.js";import u from"./PickaxeSimpleButton.js";import d from"./PickaxeCopyButton.js";import b from"./PickaxeFeedbackThumbsDownReasons.js";import h from"../../../common/cn.js";const f=({content:f,index:x=0,chatCount:k,responseId:g,isForm:y,isHideFeedback:v,onOpenChat:j})=>{var w,O,N,T;const{mutateAsync:
|
|
1
|
+
import{jsxs as e,jsx as s,Fragment as i}from"react/jsx-runtime";import{useStyleFontSize as t}from"../../../hooks/studio/useStyleFontSize.js";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitFeedback as a}from"../../../hooks/pickaxe/useSubmitFeedback.js";import{useThumbSelection as n}from"../../../hooks/pickaxe/useThumbSelection.js";import{AnimatePresence as l,motion as c}from"framer-motion";import r from"../../Icons/message-square-notes.svg.js";import m from"../../Icons/thumbs-down.svg.js";import p from"../../Icons/thumbs-up.svg.js";import u from"./PickaxeSimpleButton.js";import d from"./PickaxeCopyButton.js";import b from"./PickaxeFeedbackThumbsDownReasons.js";import h from"../../../common/cn.js";const f=({content:f,index:x=0,chatCount:k,responseId:g,isForm:y,isHideFeedback:v,onOpenChat:j})=>{var w,O,N,T;const{mutateAsync:S}=a(),{colors:C,translations:D,pickaxe:F,setIsShowFeedbackMessage:I}=o(),U=t(),{toggleThumb:P,submitThumbsDown:R,submitThumbsUp:z,isThumbsUpSelected:B,isThumbsDownSelected:H,showThumbsDownOptions:W,showThumbsUpOptions:q,showSuccess:A}=n({content:f,index:x,responseId:g,successDuration:2e3,promptRate:1,onThumbsDownReasonOpen:()=>I(!0),onThumbsDownReasonClose:()=>I(!1),submit:S}),M="function"==typeof j&&!!(null==F?void 0:F.enablechatresponses)&&void 0!==g&&void 0!==k,E=Boolean((null==F?void 0:F.enablechatresponses)&&!j||!(null==F?void 0:F.enablechatresponses)&&y)&&!v;return e("div",Object.assign({className:"flex w-full flex-col gap-4"},{children:[e("div",Object.assign({className:"flex h-4 items-center gap-3"},{children:[M&&e(u,Object.assign({color:C.accent,onClick:j},{children:[s(r,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:h(U.b3,"font-semibold")},{children:k}))]})),s(d,{color:C.accent,text:f}),E&&e(i,{children:[s(u,Object.assign({color:C.accent,onClick:()=>P("like"),className:"transition-all active:rotate-12 active:scale-90"},{children:s(p,{className:"size-4",style:{fill:C.text,fillOpacity:B?.3:0}})})),s(u,Object.assign({color:C.accent,onClick:()=>P("dislike"),className:"transition-all active:-rotate-12 active:scale-90"},{children:s(m,{className:"size-4",style:{fill:C.text,fillOpacity:H?.3:0}})})),s(l,{children:A&&s(c.div,Object.assign({initial:{opacity:0,x:-8,filter:"blur(4px)"},animate:{opacity:1,x:0,filter:"blur(0px)"},exit:{opacity:0,x:8,filter:"blur(4px)"},transition:{type:"spring",bounce:0,duration:.6}},{children:s("p",Object.assign({className:h(U.b4,C.secondary,"opacity-75")},{children:null!==(w=null==D?void 0:D["feedback-thanks"])&&void 0!==w?w:"Thanks for the feedback!"}))}))})]})]})),s(l,{children:(W||q)&&e(c.div,Object.assign({initial:{opacity:0,y:-4,filter:"blur(4px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},exit:{opacity:0,y:-2,filter:"blur(4px)"},transition:{type:"spring",bounce:0,duration:.25},className:"flex flex-col gap-4"},{children:[e("div",Object.assign({className:"space-y-0.5"},{children:[s("p",Object.assign({className:h(U.b3,C.text)},{children:q?null!==(O=null==D?void 0:D["feedback-like-title"])&&void 0!==O?O:"What went right?":null!==(N=null==D?void 0:D["feedback-dislike-title"])&&void 0!==N?N:"What went wrong?"})),s("p",Object.assign({className:h(U.b3,C.secondary,"opacity-75")},{children:null!==(T=null==D?void 0:D["feedback-dislike-message"])&&void 0!==T?T:"Help us improve our answers"}))]})),s(c.div,Object.assign({initial:{opacity:0,y:-8,filter:"blur(4px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},transition:{type:"spring",bounce:0,duration:.5,delay:.175},className:"flex flex-wrap items-center gap-2"},{children:s(b,{isUp:q,submitThumbsDown:R,submitThumbsUp:z})}))]}))})]}))};export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as e}from"react";import{useCreateFeedbackPayload as s}from"./useCreateFeedbackPayload.js";const n=({content:n,index:
|
|
1
|
+
import{useState as e}from"react";import{useCreateFeedbackPayload as s}from"./useCreateFeedbackPayload.js";const n=({content:n,index:i,responseId:o,submit:t,onThumbsDownReasonOpen:l,onThumbsDownReasonClose:c,onThumbsUpReasonOpen:a,onThumbsUpReasonClose:u,successDuration:b=3e3,promptRate:d=1})=>{const m=s({content:n,index:i,responseId:o}),[k,r]=e(null),[p,h]=e(!1),[T,f]=e(!1),[g,O]=e(!1),j=()=>{O(!0),setTimeout((()=>O(!1)),b)},w=()=>{p&&(h(!1),null==c||c()),T&&(f(!1),null==u||u())};return{selectedThumb:k,showThumbsDownOptions:p,showThumbsUpOptions:T,toggleThumb:e=>{if("like"===e){const e="like"===k&&T,s=!e&&Math.random()<d;return w(),s?(r("like"),f(!0),void(null==a||a())):e?void r(null):(r("like"),t(Object.assign(Object.assign({},m),{feedbackType:"like",content:n})),void j())}if("dislike"===e){const e="dislike"===k&&p,s=!e&&Math.random()<d;if(w(),s)return r("dislike"),h(!0),void(null==l||l());if(e)return void r(null);r("dislike"),t(Object.assign(Object.assign({},m),{feedbackType:"dislike",content:n})),j()}},submitThumbsDown:e=>{t(Object.assign(Object.assign({},m),{feedbackType:"dislike",content:n,feedbackMessage:e})),w(),j()},submitThumbsUp:e=>{t(Object.assign(Object.assign({},m),{feedbackType:"like",content:n,feedbackMessage:e})),w(),j()},isThumbsUpSelected:"like"===k,isThumbsDownSelected:"dislike"===k,showSuccess:g}};export{n as useThumbSelection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{commonjsGlobal as t}from"../../../../../_virtual/_commonjsHelpers.js";import{__module as e}from"../../../../../_virtual/cose-base2.js";import{__require as r}from"../../../layout-base@1.0.2/node_modules/layout-base/layout-base.js";var i;function o(){return i||(i=1,t=e,e.exports,o=function(t){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(e,r){e.exports=t},function(t,e,r){var i=r(0).FDLayoutConstants;function o(){}for(var n in i)o[n]=i[n];o.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,o.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,o.DEFAULT_COMPONENT_SEPERATION=60,o.TILE=!0,o.TILING_PADDING_VERTICAL=10,o.TILING_PADDING_HORIZONTAL=10,o.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=o},function(t,e,r){var i=r(0).FDLayoutEdge;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraph;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraphManager;function o(t){i.call(this,t)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).FDLayoutNode,o=r(0).IMath;function n(t,e,r,o){i.call(this,t,e,r,o)}for(var a in n.prototype=Object.create(i.prototype),i)n[a]=i[a];n.prototype.move=function(){var t=this.graphManager.getLayout();this.displacementX=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},n.prototype.propogateDisplacementToChildren=function(t,e){for(var r,i=this.getChild().getNodes(),o=0;o<i.length;o++)null==(r=i[o]).getChild()?(r.moveBy(t,e),r.displacementX+=t,r.displacementY+=e):r.propogateDisplacementToChildren(t,e)},n.prototype.setPred1=function(t){this.pred1=t},n.prototype.getPred1=function(){return pred1},n.prototype.getPred2=function(){return pred2},n.prototype.setNext=function(t){this.next=t},n.prototype.getNext=function(){return next},n.prototype.setProcessed=function(t){this.processed=t},n.prototype.isProcessed=function(){return processed},t.exports=n},function(t,e,r){var i=r(0).FDLayout,o=r(4),n=r(3),a=r(5),s=r(2),h=r(1),d=r(0).FDLayoutConstants,g=r(0).LayoutConstants,l=r(0).Point,p=r(0).PointD,c=r(0).Layout,u=r(0).Integer,f=r(0).IGeometry,v=r(0).LGraph,T=r(0).Transform;function E(){i.call(this),this.toBeTiled={}}for(var m in E.prototype=Object.create(i.prototype),i)E[m]=i[m];E.prototype.newGraphManager=function(){var t=new o(this);return this.graphManager=t,t},E.prototype.newGraph=function(t){return new n(null,this.graphManager,t)},E.prototype.newNode=function(t){return new a(this.graphManager,t)},E.prototype.newEdge=function(t){return new s(null,null,t)},E.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=d.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=d.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=d.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},E.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},E.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(r));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(r),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},E.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var r=!this.isTreeGrowing&&!this.isGrowthFinished,i=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(r,i),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},E.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},r=0;r<t.length;r++){var i=t[r].rect,o=t[r].id;e[o]={id:o,x:i.getCenterX(),y:i.getCenterY(),w:i.width,h:i.height}}return e},E.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},E.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,r=[],i=this.graphManager.getGraphs(),o=i.length;for(e=0;e<o;e++)(t=i[e]).updateConnected(),t.isConnected||(r=r.concat(t.getNodes()));return r},E.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,r=new Set;for(e=0;e<t.length;e++){var i=t[e];if(!r.has(i)){var o=i.getSource(),n=i.getTarget();if(o==n)i.getBendpoints().push(new p),i.getBendpoints().push(new p),this.createDummyNodesForBendpoints(i),r.add(i);else{var a=[];if(a=(a=a.concat(o.getEdgeListToNode(n))).concat(n.getEdgeListToNode(o)),!r.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){r.add(t)}))}}}if(r.size==t.length)break}},E.prototype.positionNodesRadially=function(t){for(var e=new l(0,0),r=Math.ceil(Math.sqrt(t.length)),i=0,o=0,n=0,a=new p(0,0),s=0;s<t.length;s++){s%r==0&&(n=0,o=i,0!=s&&(o+=h.DEFAULT_COMPONENT_SEPERATION),i=0);var d=t[s],u=c.findCenterOfTree(d);e.x=n,e.y=o,(a=E.radialLayout(d,u,e)).y>i&&(i=Math.floor(a.y)),n=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},E.radialLayout=function(t,e,r){var i=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);E.branchRadialLayout(e,null,0,359,0,i);var o=v.calculateBounds(t),n=new T;n.setDeviceOrgX(o.getMinX()),n.setDeviceOrgY(o.getMinY()),n.setWorldOrgX(r.x),n.setWorldOrgY(r.y);for(var a=0;a<t.length;a++)t[a].transform(n);var s=new p(o.getMaxX(),o.getMaxY());return n.inverseTransformPoint(s)},E.branchRadialLayout=function(t,e,r,i,o,n){var a=(i-r+1)/2;a<0&&(a+=180);var s=(a+r)%360*f.TWO_PI/360,h=o*Math.cos(s),d=o*Math.sin(s);t.setCenter(h,d);var g=[],l=(g=g.concat(t.getEdges())).length;null!=e&&l--;for(var p,c=0,u=g.length,v=t.getEdgesBetween(e);v.length>1;){var T=v[0];v.splice(0,1);var m=g.indexOf(T);m>=0&&g.splice(m,1),u--,l--}p=null!=e?(g.indexOf(v[0])+1)%u:0;for(var y=Math.abs(i-r)/l,N=p;c!=l;N=++N%u){var w=g[N].getOtherEnd(t);if(w!=e){var A=(r+c*y)%360,C=(A+y)%360;E.branchRadialLayout(w,t,A,C,o+n,n),c++}}},E.maxDiagonalInTree=function(t){for(var e=u.MIN_VALUE,r=0;r<t.length;r++){var i=t[r].getDiagonal();i>e&&(e=i)}return e},E.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},E.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var r=[],i=this.graphManager.getAllNodes(),o=0;o<i.length;o++){var n=(s=i[o]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=n.id&&this.getToBeTiled(n)||r.push(s)}for(o=0;o<r.length;o++){var s,h=(s=r[o]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(r){if(e[r].length>1){var i="DummyCompound_"+r;t.memberGroups[i]=e[r];var o=e[r][0].getParent(),n=new a(t.graphManager);n.id=i,n.paddingLeft=o.paddingLeft||0,n.paddingRight=o.paddingRight||0,n.paddingBottom=o.paddingBottom||0,n.paddingTop=o.paddingTop||0,t.idToDummyNode[i]=n;var s=t.getGraphManager().add(t.newGraph(),n),h=o.getChild();h.add(n);for(var d=0;d<e[r].length;d++){var g=e[r][d];h.remove(g),s.add(g)}}}))},E.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var r=0;r<this.compoundOrder.length;r++)e[this.compoundOrder[r].id]=this.compoundOrder[r],t[this.compoundOrder[r].id]=[].concat(this.compoundOrder[r].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[r].getChild()),this.compoundOrder[r].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},E.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(r){var i=t.idToDummyNode[r];e[r]=t.tileNodes(t.memberGroups[r],i.paddingLeft+i.paddingRight),i.rect.width=e[r].width,i.rect.height=e[r].height}))},E.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],r=e.id,i=e.paddingLeft,o=e.paddingTop;this.adjustLocations(this.tiledMemberPack[r],e.rect.x,e.rect.y,i,o)}},E.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(r){var i=t.idToDummyNode[r],o=i.paddingLeft,n=i.paddingTop;t.adjustLocations(e[r],i.rect.x,i.rect.y,o,n)}))},E.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var r=t.getChild();if(null==r)return this.toBeTiled[e]=!1,!1;for(var i=r.getNodes(),o=0;o<i.length;o++){var n=i[o];if(this.getNodeDegree(n)>0)return this.toBeTiled[e]=!1,!1;if(null!=n.getChild()){if(!this.getToBeTiled(n))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[n.id]=!1}return this.toBeTiled[e]=!0,!0},E.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),r=0,i=0;i<e.length;i++){var o=e[i];o.getSource().id!==o.getTarget().id&&(r+=1)}return r},E.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var r=t.getChild().getNodes(),i=0;i<r.length;i++){var o=r[i];e+=this.getNodeDegreeWithChildren(o)}return e},E.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},E.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var r=t[e];null!=r.getChild()&&this.fillCompexOrderByDFS(r.getChild().getNodes()),this.getToBeTiled(r)&&this.compoundOrder.push(r)}},E.prototype.adjustLocations=function(t,e,r,i,o){r+=o;for(var n=e+=i,a=0;a<t.rows.length;a++){var s=t.rows[a];e=n;for(var h=0,d=0;d<s.length;d++){var g=s[d];g.rect.x=e,g.rect.y=r,e+=g.rect.width+t.horizontalPadding,g.rect.height>h&&(h=g.rect.height)}r+=h+t.verticalPadding}},E.prototype.tileCompoundMembers=function(t,e){var r=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(i){var o=e[i];r.tiledMemberPack[i]=r.tileNodes(t[i],o.paddingLeft+o.paddingRight),o.rect.width=r.tiledMemberPack[i].width,o.rect.height=r.tiledMemberPack[i].height}))},E.prototype.tileNodes=function(t,e){var r={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:h.TILING_PADDING_VERTICAL,horizontalPadding:h.TILING_PADDING_HORIZONTAL};t.sort((function(t,e){return t.rect.width*t.rect.height>e.rect.width*e.rect.height?-1:t.rect.width*t.rect.height<e.rect.width*e.rect.height?1:0}));for(var i=0;i<t.length;i++){var o=t[i];0==r.rows.length?this.insertNodeToRow(r,o,0,e):this.canAddHorizontal(r,o.rect.width,o.rect.height)?this.insertNodeToRow(r,o,this.getShortestRowIndex(r),e):this.insertNodeToRow(r,o,r.rows.length,e),this.shiftToLastRow(r)}return r},E.prototype.insertNodeToRow=function(t,e,r,i){var o=i;r==t.rows.length&&(t.rows.push([]),t.rowWidth.push(o),t.rowHeight.push(0));var n=t.rowWidth[r]+e.rect.width;t.rows[r].length>0&&(n+=t.horizontalPadding),t.rowWidth[r]=n,t.width<n&&(t.width=n);var a=e.rect.height;r>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[r]&&(s=t.rowHeight[r],t.rowHeight[r]=a,s=t.rowHeight[r]-s),t.height+=s,t.rows[r].push(e)},E.prototype.getShortestRowIndex=function(t){for(var e=-1,r=Number.MAX_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]<r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.getLongestRowIndex=function(t){for(var e=-1,r=Number.MIN_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]>r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.canAddHorizontal=function(t,e,r){var i=this.getShortestRowIndex(t);if(i<0)return!0;var o=t.rowWidth[i];if(o+t.horizontalPadding+e<=t.width)return!0;var n,a,s=0;return t.rowHeight[i]<r&&i>0&&(s=r+t.verticalPadding-t.rowHeight[i]),n=t.width-o>=e+t.horizontalPadding?(t.height+s)/(o+e+t.horizontalPadding):(t.height+s)/t.width,s=r+t.verticalPadding,(a=t.width<e?(t.height+s)/e:(t.height+s)/t.width)<1&&(a=1/a),n<1&&(n=1/n),n<a},E.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),r=t.rowWidth.length-1,i=t.rows[e],o=i[i.length-1],n=o.width+t.horizontalPadding;if(t.width-t.rowWidth[r]>n&&e!=r){i.splice(-1,1),t.rows[r].push(o),t.rowWidth[e]=t.rowWidth[e]-n,t.rowWidth[r]=t.rowWidth[r]+n,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<i.length;s++)i[s].height>a&&(a=i[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[r];t.rowHeight[e]=a,t.rowHeight[r]<o.height+t.verticalPadding&&(t.rowHeight[r]=o.height+t.verticalPadding);var d=t.rowHeight[e]+t.rowHeight[r];t.height+=d-h,this.shiftToLastRow(t)}},E.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},E.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},E.prototype.reduceTrees=function(){for(var t,e=[],r=!0;r;){var i=this.graphManager.getAllNodes(),o=[];r=!1;for(var n=0;n<i.length;n++)1!=(t=i[n]).getEdges().length||t.getEdges()[0].isInterGraph||null!=t.getChild()||(o.push([t,t.getEdges()[0],t.getOwner()]),r=!0);if(1==r){for(var a=[],s=0;s<o.length;s++)1==o[s][0].getEdges().length&&(a.push(o[s]),o[s][0].getOwner().remove(o[s][0]));e.push(a),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},E.prototype.growTree=function(t){for(var e,r=t[t.length-1],i=0;i<r.length;i++)e=r[i],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},E.prototype.findPlaceforPrunedNode=function(t){var e,r,i=t[0],o=(r=i==t[1].source?t[1].target:t[1].source).startX,n=r.finishX,a=r.startY,s=r.finishY,h=[0,0,0,0];if(a>0)for(var g=o;g<=n;g++)h[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(n<this.grid.length-1)for(g=a;g<=s;g++)h[1]+=this.grid[n+1][g].length+this.grid[n][g].length-1;if(s<this.grid[0].length-1)for(g=o;g<=n;g++)h[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(o>0)for(g=a;g<=s;g++)h[3]+=this.grid[o-1][g].length+this.grid[o][g].length-1;for(var l,p,c=u.MAX_VALUE,f=0;f<h.length;f++)h[f]<c?(c=h[f],l=1,p=f):h[f]==c&&l++;if(3==l&&0==c)0==h[0]&&0==h[1]&&0==h[2]?e=1:0==h[0]&&0==h[1]&&0==h[3]?e=0:0==h[0]&&0==h[2]&&0==h[3]?e=3:0==h[1]&&0==h[2]&&0==h[3]&&(e=2);else if(2==l&&0==c){var v=Math.floor(2*Math.random());e=0==h[0]&&0==h[1]?0==v?0:1:0==h[0]&&0==h[2]?0==v?0:2:0==h[0]&&0==h[3]?0==v?0:3:0==h[1]&&0==h[2]?0==v?1:2:0==h[1]&&0==h[3]?0==v?1:3:0==v?2:3}else e=4==l&&0==c?v=Math.floor(4*Math.random()):p;0==e?i.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-d.DEFAULT_EDGE_LENGTH-i.getHeight()/2):1==e?i.setCenter(r.getCenterX()+r.getWidth()/2+d.DEFAULT_EDGE_LENGTH+i.getWidth()/2,r.getCenterY()):2==e?i.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+d.DEFAULT_EDGE_LENGTH+i.getHeight()/2):i.setCenter(r.getCenterX()-r.getWidth()/2-d.DEFAULT_EDGE_LENGTH-i.getWidth()/2,r.getCenterY())},t.exports=E},function(t,e,r){var i={};i.layoutBase=r(0),i.CoSEConstants=r(1),i.CoSEEdge=r(2),i.CoSEGraph=r(3),i.CoSEGraphManager=r(4),i.CoSELayout=r(6),i.CoSENode=r(5),t.exports=i}])},t.exports=o(r())),e.exports;var t,o}e.exports;export{o as __require};
|
|
1
|
+
import{commonjsGlobal as t}from"../../../../../_virtual/_commonjsHelpers.js";import{__module as e}from"../../../../../_virtual/cose-base.js";import{__require as r}from"../../../layout-base@1.0.2/node_modules/layout-base/layout-base.js";var i;function o(){return i||(i=1,t=e,e.exports,o=function(t){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(e,r){e.exports=t},function(t,e,r){var i=r(0).FDLayoutConstants;function o(){}for(var n in i)o[n]=i[n];o.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,o.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,o.DEFAULT_COMPONENT_SEPERATION=60,o.TILE=!0,o.TILING_PADDING_VERTICAL=10,o.TILING_PADDING_HORIZONTAL=10,o.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=o},function(t,e,r){var i=r(0).FDLayoutEdge;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraph;function o(t,e,r){i.call(this,t,e,r)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).LGraphManager;function o(t){i.call(this,t)}for(var n in o.prototype=Object.create(i.prototype),i)o[n]=i[n];t.exports=o},function(t,e,r){var i=r(0).FDLayoutNode,o=r(0).IMath;function n(t,e,r,o){i.call(this,t,e,r,o)}for(var a in n.prototype=Object.create(i.prototype),i)n[a]=i[a];n.prototype.move=function(){var t=this.graphManager.getLayout();this.displacementX=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},n.prototype.propogateDisplacementToChildren=function(t,e){for(var r,i=this.getChild().getNodes(),o=0;o<i.length;o++)null==(r=i[o]).getChild()?(r.moveBy(t,e),r.displacementX+=t,r.displacementY+=e):r.propogateDisplacementToChildren(t,e)},n.prototype.setPred1=function(t){this.pred1=t},n.prototype.getPred1=function(){return pred1},n.prototype.getPred2=function(){return pred2},n.prototype.setNext=function(t){this.next=t},n.prototype.getNext=function(){return next},n.prototype.setProcessed=function(t){this.processed=t},n.prototype.isProcessed=function(){return processed},t.exports=n},function(t,e,r){var i=r(0).FDLayout,o=r(4),n=r(3),a=r(5),s=r(2),h=r(1),d=r(0).FDLayoutConstants,g=r(0).LayoutConstants,l=r(0).Point,p=r(0).PointD,c=r(0).Layout,u=r(0).Integer,f=r(0).IGeometry,v=r(0).LGraph,T=r(0).Transform;function E(){i.call(this),this.toBeTiled={}}for(var m in E.prototype=Object.create(i.prototype),i)E[m]=i[m];E.prototype.newGraphManager=function(){var t=new o(this);return this.graphManager=t,t},E.prototype.newGraph=function(t){return new n(null,this.graphManager,t)},E.prototype.newNode=function(t){return new a(this.graphManager,t)},E.prototype.newEdge=function(t){return new s(null,null,t)},E.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=d.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=d.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=d.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},E.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},E.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(r));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(r),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},E.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var r=!this.isTreeGrowing&&!this.isGrowthFinished,i=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(r,i),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},E.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},r=0;r<t.length;r++){var i=t[r].rect,o=t[r].id;e[o]={id:o,x:i.getCenterX(),y:i.getCenterY(),w:i.width,h:i.height}}return e},E.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},E.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,r=[],i=this.graphManager.getGraphs(),o=i.length;for(e=0;e<o;e++)(t=i[e]).updateConnected(),t.isConnected||(r=r.concat(t.getNodes()));return r},E.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,r=new Set;for(e=0;e<t.length;e++){var i=t[e];if(!r.has(i)){var o=i.getSource(),n=i.getTarget();if(o==n)i.getBendpoints().push(new p),i.getBendpoints().push(new p),this.createDummyNodesForBendpoints(i),r.add(i);else{var a=[];if(a=(a=a.concat(o.getEdgeListToNode(n))).concat(n.getEdgeListToNode(o)),!r.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){r.add(t)}))}}}if(r.size==t.length)break}},E.prototype.positionNodesRadially=function(t){for(var e=new l(0,0),r=Math.ceil(Math.sqrt(t.length)),i=0,o=0,n=0,a=new p(0,0),s=0;s<t.length;s++){s%r==0&&(n=0,o=i,0!=s&&(o+=h.DEFAULT_COMPONENT_SEPERATION),i=0);var d=t[s],u=c.findCenterOfTree(d);e.x=n,e.y=o,(a=E.radialLayout(d,u,e)).y>i&&(i=Math.floor(a.y)),n=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},E.radialLayout=function(t,e,r){var i=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);E.branchRadialLayout(e,null,0,359,0,i);var o=v.calculateBounds(t),n=new T;n.setDeviceOrgX(o.getMinX()),n.setDeviceOrgY(o.getMinY()),n.setWorldOrgX(r.x),n.setWorldOrgY(r.y);for(var a=0;a<t.length;a++)t[a].transform(n);var s=new p(o.getMaxX(),o.getMaxY());return n.inverseTransformPoint(s)},E.branchRadialLayout=function(t,e,r,i,o,n){var a=(i-r+1)/2;a<0&&(a+=180);var s=(a+r)%360*f.TWO_PI/360,h=o*Math.cos(s),d=o*Math.sin(s);t.setCenter(h,d);var g=[],l=(g=g.concat(t.getEdges())).length;null!=e&&l--;for(var p,c=0,u=g.length,v=t.getEdgesBetween(e);v.length>1;){var T=v[0];v.splice(0,1);var m=g.indexOf(T);m>=0&&g.splice(m,1),u--,l--}p=null!=e?(g.indexOf(v[0])+1)%u:0;for(var y=Math.abs(i-r)/l,N=p;c!=l;N=++N%u){var w=g[N].getOtherEnd(t);if(w!=e){var A=(r+c*y)%360,C=(A+y)%360;E.branchRadialLayout(w,t,A,C,o+n,n),c++}}},E.maxDiagonalInTree=function(t){for(var e=u.MIN_VALUE,r=0;r<t.length;r++){var i=t[r].getDiagonal();i>e&&(e=i)}return e},E.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},E.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var r=[],i=this.graphManager.getAllNodes(),o=0;o<i.length;o++){var n=(s=i[o]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=n.id&&this.getToBeTiled(n)||r.push(s)}for(o=0;o<r.length;o++){var s,h=(s=r[o]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(r){if(e[r].length>1){var i="DummyCompound_"+r;t.memberGroups[i]=e[r];var o=e[r][0].getParent(),n=new a(t.graphManager);n.id=i,n.paddingLeft=o.paddingLeft||0,n.paddingRight=o.paddingRight||0,n.paddingBottom=o.paddingBottom||0,n.paddingTop=o.paddingTop||0,t.idToDummyNode[i]=n;var s=t.getGraphManager().add(t.newGraph(),n),h=o.getChild();h.add(n);for(var d=0;d<e[r].length;d++){var g=e[r][d];h.remove(g),s.add(g)}}}))},E.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var r=0;r<this.compoundOrder.length;r++)e[this.compoundOrder[r].id]=this.compoundOrder[r],t[this.compoundOrder[r].id]=[].concat(this.compoundOrder[r].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[r].getChild()),this.compoundOrder[r].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},E.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(r){var i=t.idToDummyNode[r];e[r]=t.tileNodes(t.memberGroups[r],i.paddingLeft+i.paddingRight),i.rect.width=e[r].width,i.rect.height=e[r].height}))},E.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],r=e.id,i=e.paddingLeft,o=e.paddingTop;this.adjustLocations(this.tiledMemberPack[r],e.rect.x,e.rect.y,i,o)}},E.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(r){var i=t.idToDummyNode[r],o=i.paddingLeft,n=i.paddingTop;t.adjustLocations(e[r],i.rect.x,i.rect.y,o,n)}))},E.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var r=t.getChild();if(null==r)return this.toBeTiled[e]=!1,!1;for(var i=r.getNodes(),o=0;o<i.length;o++){var n=i[o];if(this.getNodeDegree(n)>0)return this.toBeTiled[e]=!1,!1;if(null!=n.getChild()){if(!this.getToBeTiled(n))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[n.id]=!1}return this.toBeTiled[e]=!0,!0},E.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),r=0,i=0;i<e.length;i++){var o=e[i];o.getSource().id!==o.getTarget().id&&(r+=1)}return r},E.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var r=t.getChild().getNodes(),i=0;i<r.length;i++){var o=r[i];e+=this.getNodeDegreeWithChildren(o)}return e},E.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},E.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var r=t[e];null!=r.getChild()&&this.fillCompexOrderByDFS(r.getChild().getNodes()),this.getToBeTiled(r)&&this.compoundOrder.push(r)}},E.prototype.adjustLocations=function(t,e,r,i,o){r+=o;for(var n=e+=i,a=0;a<t.rows.length;a++){var s=t.rows[a];e=n;for(var h=0,d=0;d<s.length;d++){var g=s[d];g.rect.x=e,g.rect.y=r,e+=g.rect.width+t.horizontalPadding,g.rect.height>h&&(h=g.rect.height)}r+=h+t.verticalPadding}},E.prototype.tileCompoundMembers=function(t,e){var r=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(i){var o=e[i];r.tiledMemberPack[i]=r.tileNodes(t[i],o.paddingLeft+o.paddingRight),o.rect.width=r.tiledMemberPack[i].width,o.rect.height=r.tiledMemberPack[i].height}))},E.prototype.tileNodes=function(t,e){var r={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:h.TILING_PADDING_VERTICAL,horizontalPadding:h.TILING_PADDING_HORIZONTAL};t.sort((function(t,e){return t.rect.width*t.rect.height>e.rect.width*e.rect.height?-1:t.rect.width*t.rect.height<e.rect.width*e.rect.height?1:0}));for(var i=0;i<t.length;i++){var o=t[i];0==r.rows.length?this.insertNodeToRow(r,o,0,e):this.canAddHorizontal(r,o.rect.width,o.rect.height)?this.insertNodeToRow(r,o,this.getShortestRowIndex(r),e):this.insertNodeToRow(r,o,r.rows.length,e),this.shiftToLastRow(r)}return r},E.prototype.insertNodeToRow=function(t,e,r,i){var o=i;r==t.rows.length&&(t.rows.push([]),t.rowWidth.push(o),t.rowHeight.push(0));var n=t.rowWidth[r]+e.rect.width;t.rows[r].length>0&&(n+=t.horizontalPadding),t.rowWidth[r]=n,t.width<n&&(t.width=n);var a=e.rect.height;r>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[r]&&(s=t.rowHeight[r],t.rowHeight[r]=a,s=t.rowHeight[r]-s),t.height+=s,t.rows[r].push(e)},E.prototype.getShortestRowIndex=function(t){for(var e=-1,r=Number.MAX_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]<r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.getLongestRowIndex=function(t){for(var e=-1,r=Number.MIN_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]>r&&(e=i,r=t.rowWidth[i]);return e},E.prototype.canAddHorizontal=function(t,e,r){var i=this.getShortestRowIndex(t);if(i<0)return!0;var o=t.rowWidth[i];if(o+t.horizontalPadding+e<=t.width)return!0;var n,a,s=0;return t.rowHeight[i]<r&&i>0&&(s=r+t.verticalPadding-t.rowHeight[i]),n=t.width-o>=e+t.horizontalPadding?(t.height+s)/(o+e+t.horizontalPadding):(t.height+s)/t.width,s=r+t.verticalPadding,(a=t.width<e?(t.height+s)/e:(t.height+s)/t.width)<1&&(a=1/a),n<1&&(n=1/n),n<a},E.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),r=t.rowWidth.length-1,i=t.rows[e],o=i[i.length-1],n=o.width+t.horizontalPadding;if(t.width-t.rowWidth[r]>n&&e!=r){i.splice(-1,1),t.rows[r].push(o),t.rowWidth[e]=t.rowWidth[e]-n,t.rowWidth[r]=t.rowWidth[r]+n,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<i.length;s++)i[s].height>a&&(a=i[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[r];t.rowHeight[e]=a,t.rowHeight[r]<o.height+t.verticalPadding&&(t.rowHeight[r]=o.height+t.verticalPadding);var d=t.rowHeight[e]+t.rowHeight[r];t.height+=d-h,this.shiftToLastRow(t)}},E.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},E.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},E.prototype.reduceTrees=function(){for(var t,e=[],r=!0;r;){var i=this.graphManager.getAllNodes(),o=[];r=!1;for(var n=0;n<i.length;n++)1!=(t=i[n]).getEdges().length||t.getEdges()[0].isInterGraph||null!=t.getChild()||(o.push([t,t.getEdges()[0],t.getOwner()]),r=!0);if(1==r){for(var a=[],s=0;s<o.length;s++)1==o[s][0].getEdges().length&&(a.push(o[s]),o[s][0].getOwner().remove(o[s][0]));e.push(a),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},E.prototype.growTree=function(t){for(var e,r=t[t.length-1],i=0;i<r.length;i++)e=r[i],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},E.prototype.findPlaceforPrunedNode=function(t){var e,r,i=t[0],o=(r=i==t[1].source?t[1].target:t[1].source).startX,n=r.finishX,a=r.startY,s=r.finishY,h=[0,0,0,0];if(a>0)for(var g=o;g<=n;g++)h[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(n<this.grid.length-1)for(g=a;g<=s;g++)h[1]+=this.grid[n+1][g].length+this.grid[n][g].length-1;if(s<this.grid[0].length-1)for(g=o;g<=n;g++)h[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(o>0)for(g=a;g<=s;g++)h[3]+=this.grid[o-1][g].length+this.grid[o][g].length-1;for(var l,p,c=u.MAX_VALUE,f=0;f<h.length;f++)h[f]<c?(c=h[f],l=1,p=f):h[f]==c&&l++;if(3==l&&0==c)0==h[0]&&0==h[1]&&0==h[2]?e=1:0==h[0]&&0==h[1]&&0==h[3]?e=0:0==h[0]&&0==h[2]&&0==h[3]?e=3:0==h[1]&&0==h[2]&&0==h[3]&&(e=2);else if(2==l&&0==c){var v=Math.floor(2*Math.random());e=0==h[0]&&0==h[1]?0==v?0:1:0==h[0]&&0==h[2]?0==v?0:2:0==h[0]&&0==h[3]?0==v?0:3:0==h[1]&&0==h[2]?0==v?1:2:0==h[1]&&0==h[3]?0==v?1:3:0==v?2:3}else e=4==l&&0==c?v=Math.floor(4*Math.random()):p;0==e?i.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-d.DEFAULT_EDGE_LENGTH-i.getHeight()/2):1==e?i.setCenter(r.getCenterX()+r.getWidth()/2+d.DEFAULT_EDGE_LENGTH+i.getWidth()/2,r.getCenterY()):2==e?i.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+d.DEFAULT_EDGE_LENGTH+i.getHeight()/2):i.setCenter(r.getCenterX()-r.getWidth()/2-d.DEFAULT_EDGE_LENGTH-i.getWidth()/2,r.getCenterY())},t.exports=E},function(t,e,r){var i={};i.layoutBase=r(0),i.CoSEConstants=r(1),i.CoSEEdge=r(2),i.CoSEGraph=r(3),i.CoSEGraphManager=r(4),i.CoSELayout=r(6),i.CoSENode=r(5),t.exports=i}])},t.exports=o(r())),e.exports;var t,o}e.exports;export{o as __require};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{commonjsGlobal as t}from"../../../../../_virtual/_commonjsHelpers.js";import{__module as e}from"../../../../../_virtual/cose-base.js";import{__require as i}from"../../../layout-base@2.0.1/node_modules/layout-base/layout-base.js";var o;function n(){return o||(o=1,t=e,e.exports,n=function(t){return e={45:(t,e,i)=>{var o={};o.layoutBase=i(551),o.CoSEConstants=i(806),o.CoSEEdge=i(767),o.CoSEGraph=i(880),o.CoSEGraphManager=i(578),o.CoSELayout=i(765),o.CoSENode=i(991),o.ConstraintHandler=i(902),t.exports=o},806:(t,e,i)=>{var o=i(551).FDLayoutConstants;function n(){}for(var r in o)n[r]=o[r];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=o.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,n.ENFORCE_CONSTRAINTS=!0,n.APPLY_LAYOUT=!0,n.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,n.TREE_REDUCTION_ON_INCREMENTAL=!0,n.PURE_INCREMENTAL=n.DEFAULT_INCREMENTAL,t.exports=n},767:(t,e,i)=>{var o=i(551).FDLayoutEdge;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},880:(t,e,i)=>{var o=i(551).LGraph;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},578:(t,e,i)=>{var o=i(551).LGraphManager;function n(t){o.call(this,t)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},765:(t,e,i)=>{var o=i(551).FDLayout,n=i(578),r=i(880),a=i(991),s=i(767),h=i(806),l=i(902),d=i(551).FDLayoutConstants,g=i(551).LayoutConstants,c=i(551).Point,p=i(551).PointD,f=i(551).DimensionD,u=i(551).Layout,m=i(551).Integer,v=i(551).IGeometry,T=i(551).LGraph,N=i(551).Transform,E=i(551).LinkedList;function y(){o.call(this),this.toBeTiled={},this.constraints={}}for(var C in y.prototype=Object.create(o.prototype),o)y[C]=o[C];y.prototype.newGraphManager=function(){var t=new n(this);return this.graphManager=t,t},y.prototype.newGraph=function(t){return new r(null,this.graphManager,t)},y.prototype.newNode=function(t){return new a(this.graphManager,t)},y.prototype.newEdge=function(t){return new s(null,null,t)},y.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},y.prototype.initSpringEmbedder=function(){o.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},y.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},y.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(i));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(i),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(l.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,o=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,o),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i<t.length;i++){var o=t[i].rect,n=t[i].id;e[n]={id:n,x:o.getCenterX(),y:o.getCenterY(),w:o.width,h:o.height}}return e},y.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},y.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].calculateDisplacement();for(Object.keys(this.constraints).length>0&&this.updateDisplacements(),e=0;e<t.length;e++)t[e].move()},y.prototype.initConstraintVariables=function(){var t=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var e=this.graphManager.getAllNodes(),i=0;i<e.length;i++){var o=e[i];this.idToNodeMap.set(o.id,o)}var n=function e(i){for(var o,n=i.getChild().getNodes(),r=0,a=0;a<n.length;a++)null==(o=n[a]).getChild()?t.fixedNodeSet.has(o.id)&&(r+=100):r+=e(o);return r};if(this.constraints.fixedNodeConstraint)for(this.constraints.fixedNodeConstraint.forEach((function(e){t.fixedNodeSet.add(e.nodeId)})),e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)if(null!=(o=e[i]).getChild()){var r=n(o);r>0&&(o.fixedNodeWeight=r)}if(this.constraints.relativePlacementConstraint){var a=new Map,s=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach((function(e){t.fixedNodesOnHorizontal.add(e),t.fixedNodesOnVertical.add(e)})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var l=this.constraints.alignmentConstraint.vertical;for(i=0;i<l.length;i++)this.dummyToNodeForVerticalAlignment.set("dummy"+i,[]),l[i].forEach((function(e){a.set(e,"dummy"+i),t.dummyToNodeForVerticalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnHorizontal.add("dummy"+i)}))}if(this.constraints.alignmentConstraint.horizontal){var d=this.constraints.alignmentConstraint.horizontal;for(i=0;i<d.length;i++)this.dummyToNodeForHorizontalAlignment.set("dummy"+i,[]),d[i].forEach((function(e){s.set(e,"dummy"+i),t.dummyToNodeForHorizontalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnVertical.add("dummy"+i)}))}}if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(t){var e,i,o;for(o=t.length-1;o>=2*t.length/3;o--)e=Math.floor(Math.random()*(o+1)),i=t[o],t[o]=t[e],t[e]=i;return t},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach((function(e){if(e.left){var i=a.has(e.left)?a.get(e.left):e.left,o=a.has(e.right)?a.get(e.right):e.right;t.nodesInRelativeHorizontal.includes(i)||(t.nodesInRelativeHorizontal.push(i),t.nodeToRelativeConstraintMapHorizontal.set(i,[]),t.dummyToNodeForVerticalAlignment.has(i)?t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(i)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(i).getCenterX())),t.nodesInRelativeHorizontal.includes(o)||(t.nodesInRelativeHorizontal.push(o),t.nodeToRelativeConstraintMapHorizontal.set(o,[]),t.dummyToNodeForVerticalAlignment.has(o)?t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(o)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(o).getCenterX())),t.nodeToRelativeConstraintMapHorizontal.get(i).push({right:o,gap:e.gap}),t.nodeToRelativeConstraintMapHorizontal.get(o).push({left:i,gap:e.gap})}else{var n=s.has(e.top)?s.get(e.top):e.top,r=s.has(e.bottom)?s.get(e.bottom):e.bottom;t.nodesInRelativeVertical.includes(n)||(t.nodesInRelativeVertical.push(n),t.nodeToRelativeConstraintMapVertical.set(n,[]),t.dummyToNodeForHorizontalAlignment.has(n)?t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(n)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(n).getCenterY())),t.nodesInRelativeVertical.includes(r)||(t.nodesInRelativeVertical.push(r),t.nodeToRelativeConstraintMapVertical.set(r,[]),t.dummyToNodeForHorizontalAlignment.has(r)?t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(r)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(r).getCenterY())),t.nodeToRelativeConstraintMapVertical.get(n).push({bottom:r,gap:e.gap}),t.nodeToRelativeConstraintMapVertical.get(r).push({top:n,gap:e.gap})}}));else{var g=new Map,c=new Map;this.constraints.relativePlacementConstraint.forEach((function(t){if(t.left){var e=a.has(t.left)?a.get(t.left):t.left,i=a.has(t.right)?a.get(t.right):t.right;g.has(e)?g.get(e).push(i):g.set(e,[i]),g.has(i)?g.get(i).push(e):g.set(i,[e])}else{var o=s.has(t.top)?s.get(t.top):t.top,n=s.has(t.bottom)?s.get(t.bottom):t.bottom;c.has(o)?c.get(o).push(n):c.set(o,[n]),c.has(n)?c.get(n).push(o):c.set(n,[o])}}));var p=function(t,e){var i=[],o=[],n=new E,r=new Set,a=0;return t.forEach((function(s,h){if(!r.has(h)){i[a]=[],o[a]=!1;var l=h;for(n.push(l),r.add(l),i[a].push(l);0!=n.length;)l=n.shift(),e.has(l)&&(o[a]=!0),t.get(l).forEach((function(t){r.has(t)||(n.push(t),r.add(t),i[a].push(t))}));a++}})),{components:i,isFixed:o}},f=p(g,t.fixedNodesOnHorizontal);this.componentsOnHorizontal=f.components,this.fixedComponentsOnHorizontal=f.isFixed;var u=p(c,t.fixedNodesOnVertical);this.componentsOnVertical=u.components,this.fixedComponentsOnVertical=u.isFixed}}},y.prototype.updateDisplacements=function(){var t=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach((function(e){var i=t.idToNodeMap.get(e.nodeId);i.displacementX=0,i.displacementY=0})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var e=this.constraints.alignmentConstraint.vertical,i=0;i<e.length;i++){for(var o=0,n=0;n<e[i].length;n++){if(this.fixedNodeSet.has(e[i][n])){o=0;break}o+=this.idToNodeMap.get(e[i][n]).displacementX}var r=o/e[i].length;for(n=0;n<e[i].length;n++)this.idToNodeMap.get(e[i][n]).displacementX=r}if(this.constraints.alignmentConstraint.horizontal){var a=this.constraints.alignmentConstraint.horizontal;for(i=0;i<a.length;i++){var s=0;for(n=0;n<a[i].length;n++){if(this.fixedNodeSet.has(a[i][n])){s=0;break}s+=this.idToNodeMap.get(a[i][n]).displacementY}var l=s/a[i].length;for(n=0;n<a[i].length;n++)this.idToNodeMap.get(a[i][n]).displacementY=l}}}if(this.constraints.relativePlacementConstraint)if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForVerticalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(e)[0]).displacementX:t.idToNodeMap.get(e).displacementX,t.nodeToRelativeConstraintMapHorizontal.get(e).forEach((function(o){var n;o.right?(n=t.nodeToTempPositionMapHorizontal.get(o.right)-t.nodeToTempPositionMapHorizontal.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapHorizontal.get(e)-t.nodeToTempPositionMapHorizontal.get(o.left)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapHorizontal.set(e,t.nodeToTempPositionMapHorizontal.get(e)+i),t.dummyToNodeForVerticalAlignment.has(e)?t.dummyToNodeForVerticalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementX=i})):t.idToNodeMap.get(e).displacementX=i}})),this.nodesInRelativeVertical.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForHorizontalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(e)[0]).displacementY:t.idToNodeMap.get(e).displacementY,t.nodeToRelativeConstraintMapVertical.get(e).forEach((function(o){var n;o.bottom?(n=t.nodeToTempPositionMapVertical.get(o.bottom)-t.nodeToTempPositionMapVertical.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapVertical.get(e)-t.nodeToTempPositionMapVertical.get(o.top)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapVertical.set(e,t.nodeToTempPositionMapVertical.get(e)+i),t.dummyToNodeForHorizontalAlignment.has(e)?t.dummyToNodeForHorizontalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementY=i})):t.idToNodeMap.get(e).displacementY=i}}));else{for(i=0;i<this.componentsOnHorizontal.length;i++){var d=this.componentsOnHorizontal[i];if(this.fixedComponentsOnHorizontal[i])for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=0})):this.idToNodeMap.get(d[n]).displacementX=0;else{var g=0,c=0;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForVerticalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementX,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementX,c++);var p=g/c;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=p})):this.idToNodeMap.get(d[n]).displacementX=p}}for(i=0;i<this.componentsOnVertical.length;i++)if(d=this.componentsOnVertical[i],this.fixedComponentsOnVertical[i])for(n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=0})):this.idToNodeMap.get(d[n]).displacementY=0;else{for(g=0,c=0,n=0;n<d.length;n++){var f;this.dummyToNodeForHorizontalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForHorizontalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementY,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementY,c++)}for(p=g/c,n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=p})):this.idToNodeMap.get(d[n]).displacementY=p}}},y.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,i=[],o=this.graphManager.getGraphs(),n=o.length;for(e=0;e<n;e++)(t=o[e]).updateConnected(),t.isConnected||(i=i.concat(t.getNodes()));return i},y.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,i=new Set;for(e=0;e<t.length;e++){var o=t[e];if(!i.has(o)){var n=o.getSource(),r=o.getTarget();if(n==r)o.getBendpoints().push(new p),o.getBendpoints().push(new p),this.createDummyNodesForBendpoints(o),i.add(o);else{var a=[];if(a=(a=a.concat(n.getEdgeListToNode(r))).concat(r.getEdgeListToNode(n)),!i.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){i.add(t)}))}}}if(i.size==t.length)break}},y.prototype.positionNodesRadially=function(t){for(var e=new c(0,0),i=Math.ceil(Math.sqrt(t.length)),o=0,n=0,r=0,a=new p(0,0),s=0;s<t.length;s++){s%i==0&&(r=0,n=o,0!=s&&(n+=h.DEFAULT_COMPONENT_SEPERATION),o=0);var l=t[s],d=u.findCenterOfTree(l);e.x=r,e.y=n,(a=y.radialLayout(l,d,e)).y>o&&(o=Math.floor(a.y)),r=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},y.radialLayout=function(t,e,i){var o=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(e,null,0,359,0,o);var n=T.calculateBounds(t),r=new N;r.setDeviceOrgX(n.getMinX()),r.setDeviceOrgY(n.getMinY()),r.setWorldOrgX(i.x),r.setWorldOrgY(i.y);for(var a=0;a<t.length;a++)t[a].transform(r);var s=new p(n.getMaxX(),n.getMaxY());return r.inverseTransformPoint(s)},y.branchRadialLayout=function(t,e,i,o,n,r){var a=(o-i+1)/2;a<0&&(a+=180);var s=(a+i)%360*v.TWO_PI/360,h=n*Math.cos(s),l=n*Math.sin(s);t.setCenter(h,l);var d=[],g=(d=d.concat(t.getEdges())).length;null!=e&&g--;for(var c,p=0,f=d.length,u=t.getEdgesBetween(e);u.length>1;){var m=u[0];u.splice(0,1);var T=d.indexOf(m);T>=0&&d.splice(T,1),f--,g--}c=null!=e?(d.indexOf(u[0])+1)%f:0;for(var N=Math.abs(o-i)/g,E=c;p!=g;E=++E%f){var C=d[E].getOtherEnd(t);if(C!=e){var M=(i+p*N)%360,w=(M+N)%360;y.branchRadialLayout(C,t,M,w,n+r,r),p++}}},y.maxDiagonalInTree=function(t){for(var e=m.MIN_VALUE,i=0;i<t.length;i++){var o=t[i].getDiagonal();o>e&&(e=o)}return e},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],o=this.graphManager.getAllNodes(),n=0;n<o.length;n++){var r=(s=o[n]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=r.id&&this.getToBeTiled(r)||i.push(s)}for(n=0;n<i.length;n++){var s,h=(s=i[n]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(i){if(e[i].length>1){var o="DummyCompound_"+i;t.memberGroups[o]=e[i];var n=e[i][0].getParent(),r=new a(t.graphManager);r.id=o,r.paddingLeft=n.paddingLeft||0,r.paddingRight=n.paddingRight||0,r.paddingBottom=n.paddingBottom||0,r.paddingTop=n.paddingTop||0,t.idToDummyNode[o]=r;var s=t.getGraphManager().add(t.newGraph(),r),h=n.getChild();h.add(r);for(var l=0;l<e[i].length;l++){var d=e[i][l];h.remove(d),s.add(d)}}}))},y.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var i=0;i<this.compoundOrder.length;i++)e[this.compoundOrder[i].id]=this.compoundOrder[i],t[this.compoundOrder[i].id]=[].concat(this.compoundOrder[i].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[i].getChild()),this.compoundOrder[i].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},y.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(i){var o=t.idToDummyNode[i];if(e[i]=t.tileNodes(t.memberGroups[i],o.paddingLeft+o.paddingRight),o.rect.width=e[i].width,o.rect.height=e[i].height,o.setCenter(e[i].centerX,e[i].centerY),o.labelMarginLeft=0,o.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var n=o.rect.width,r=o.rect.height;o.labelWidth&&("left"==o.labelPosHorizontal?(o.rect.x-=o.labelWidth,o.setWidth(n+o.labelWidth),o.labelMarginLeft=o.labelWidth):"center"==o.labelPosHorizontal&&o.labelWidth>n?(o.rect.x-=(o.labelWidth-n)/2,o.setWidth(o.labelWidth),o.labelMarginLeft=(o.labelWidth-n)/2):"right"==o.labelPosHorizontal&&o.setWidth(n+o.labelWidth)),o.labelHeight&&("top"==o.labelPosVertical?(o.rect.y-=o.labelHeight,o.setHeight(r+o.labelHeight),o.labelMarginTop=o.labelHeight):"center"==o.labelPosVertical&&o.labelHeight>r?(o.rect.y-=(o.labelHeight-r)/2,o.setHeight(o.labelHeight),o.labelMarginTop=(o.labelHeight-r)/2):"bottom"==o.labelPosVertical&&o.setHeight(r+o.labelHeight))}}))},y.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,o=e.paddingLeft,n=e.paddingTop,r=e.labelMarginLeft,a=e.labelMarginTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,o,n,r,a)}},y.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(i){var o=t.idToDummyNode[i],n=o.paddingLeft,r=o.paddingTop,a=o.labelMarginLeft,s=o.labelMarginTop;t.adjustLocations(e[i],o.rect.x,o.rect.y,n,r,a,s)}))},y.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var o=i.getNodes(),n=0;n<o.length;n++){var r=o[n];if(this.getNodeDegree(r)>0)return this.toBeTiled[e]=!1,!1;if(null!=r.getChild()){if(!this.getToBeTiled(r))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[r.id]=!1}return this.toBeTiled[e]=!0,!0},y.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,o=0;o<e.length;o++){var n=e[o];n.getSource().id!==n.getTarget().id&&(i+=1)}return i},y.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var i=t.getChild().getNodes(),o=0;o<i.length;o++){var n=i[o];e+=this.getNodeDegreeWithChildren(n)}return e},y.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},y.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var i=t[e];null!=i.getChild()&&this.fillCompexOrderByDFS(i.getChild().getNodes()),this.getToBeTiled(i)&&this.compoundOrder.push(i)}},y.prototype.adjustLocations=function(t,e,i,o,n,r,a){i+=n+a;for(var s=e+=o+r,h=0;h<t.rows.length;h++){var l=t.rows[h];e=s;for(var d=0,g=0;g<l.length;g++){var c=l[g];c.rect.x=e,c.rect.y=i,e+=c.rect.width+t.horizontalPadding,c.rect.height>d&&(d=c.rect.height)}i+=d+t.verticalPadding}},y.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(o){var n=e[o];if(i.tiledMemberPack[o]=i.tileNodes(t[o],n.paddingLeft+n.paddingRight),n.rect.width=i.tiledMemberPack[o].width,n.rect.height=i.tiledMemberPack[o].height,n.setCenter(i.tiledMemberPack[o].centerX,i.tiledMemberPack[o].centerY),n.labelMarginLeft=0,n.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var r=n.rect.width,a=n.rect.height;n.labelWidth&&("left"==n.labelPosHorizontal?(n.rect.x-=n.labelWidth,n.setWidth(r+n.labelWidth),n.labelMarginLeft=n.labelWidth):"center"==n.labelPosHorizontal&&n.labelWidth>r?(n.rect.x-=(n.labelWidth-r)/2,n.setWidth(n.labelWidth),n.labelMarginLeft=(n.labelWidth-r)/2):"right"==n.labelPosHorizontal&&n.setWidth(r+n.labelWidth)),n.labelHeight&&("top"==n.labelPosVertical?(n.rect.y-=n.labelHeight,n.setHeight(a+n.labelHeight),n.labelMarginTop=n.labelHeight):"center"==n.labelPosVertical&&n.labelHeight>a?(n.rect.y-=(n.labelHeight-a)/2,n.setHeight(n.labelHeight),n.labelMarginTop=(n.labelHeight-a)/2):"bottom"==n.labelPosVertical&&n.setHeight(a+n.labelHeight))}}))},y.prototype.tileNodes=function(t,e){var i=this.tileNodesByFavoringDim(t,e,!0),o=this.tileNodesByFavoringDim(t,e,!1),n=this.getOrgRatio(i);return this.getOrgRatio(o)<n?o:i},y.prototype.getOrgRatio=function(t){var e=t.width/t.height;return e<1&&(e=1/e),e},y.prototype.calcIdealRowWidth=function(t,e){var i=h.TILING_PADDING_VERTICAL,o=h.TILING_PADDING_HORIZONTAL,n=t.length,r=0,a=0,s=0;t.forEach((function(t){r+=t.getWidth(),a+=t.getHeight(),t.getWidth()>s&&(s=t.getWidth())}));var l,d=r/n,g=a/n,c=Math.pow(i-o,2)+4*(d+o)*(g+i)*n,p=(o-i+Math.sqrt(c))/(2*(d+o));e?(l=Math.ceil(p))==p&&l++:l=Math.floor(p);var f=l*(d+o)-o;return s>f&&(f=s),f+=2*o},y.prototype.tileNodesByFavoringDim=function(t,e,i){var o=h.TILING_PADDING_VERTICAL,n=h.TILING_PADDING_HORIZONTAL,r=h.TILING_COMPARE_BY,a={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:o,horizontalPadding:n,centerX:0,centerY:0};r&&(a.idealRowWidth=this.calcIdealRowWidth(t,i));var s=function(t){return t.rect.width*t.rect.height},l=function(t,e){return s(e)-s(t)};t.sort((function(t,e){var i=l;return a.idealRowWidth?(i=r)(t.id,e.id):i(t,e)}));for(var d=0,g=0,c=0;c<t.length;c++)d+=(p=t[c]).getCenterX(),g+=p.getCenterY();for(a.centerX=d/t.length,a.centerY=g/t.length,c=0;c<t.length;c++){var p=t[c];if(0==a.rows.length)this.insertNodeToRow(a,p,0,e);else if(this.canAddHorizontal(a,p.rect.width,p.rect.height)){var f=a.rows.length-1;a.idealRowWidth||(f=this.getShortestRowIndex(a)),this.insertNodeToRow(a,p,f,e)}else this.insertNodeToRow(a,p,a.rows.length,e);this.shiftToLastRow(a)}return a},y.prototype.insertNodeToRow=function(t,e,i,o){var n=o;i==t.rows.length&&(t.rows.push([]),t.rowWidth.push(n),t.rowHeight.push(0));var r=t.rowWidth[i]+e.rect.width;t.rows[i].length>0&&(r+=t.horizontalPadding),t.rowWidth[i]=r,t.width<r&&(t.width=r);var a=e.rect.height;i>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[i]&&(s=t.rowHeight[i],t.rowHeight[i]=a,s=t.rowHeight[i]-s),t.height+=s,t.rows[i].push(e)},y.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]<i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.getLongestRowIndex=function(t){for(var e=-1,i=Number.MIN_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]>i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.canAddHorizontal=function(t,e,i){if(t.idealRowWidth){var o=t.rows.length-1;return t.rowWidth[o]+e+t.horizontalPadding<=t.idealRowWidth}var n=this.getShortestRowIndex(t);if(n<0)return!0;var r=t.rowWidth[n];if(r+t.horizontalPadding+e<=t.width)return!0;var a,s,h=0;return t.rowHeight[n]<i&&n>0&&(h=i+t.verticalPadding-t.rowHeight[n]),a=t.width-r>=e+t.horizontalPadding?(t.height+h)/(r+e+t.horizontalPadding):(t.height+h)/t.width,h=i+t.verticalPadding,(s=t.width<e?(t.height+h)/e:(t.height+h)/t.width)<1&&(s=1/s),a<1&&(a=1/a),a<s},y.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),i=t.rowWidth.length-1,o=t.rows[e],n=o[o.length-1],r=n.width+t.horizontalPadding;if(t.width-t.rowWidth[i]>r&&e!=i){o.splice(-1,1),t.rows[i].push(n),t.rowWidth[e]=t.rowWidth[e]-r,t.rowWidth[i]=t.rowWidth[i]+r,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<o.length;s++)o[s].height>a&&(a=o[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=a,t.rowHeight[i]<n.height+t.verticalPadding&&(t.rowHeight[i]=n.height+t.verticalPadding);var l=t.rowHeight[e]+t.rowHeight[i];t.height+=l-h,this.shiftToLastRow(t)}},y.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},y.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},y.prototype.reduceTrees=function(){for(var t,e=[],i=!0;i;){var o=this.graphManager.getAllNodes(),n=[];i=!1;for(var r=0;r<o.length;r++)if(1==(t=o[r]).getEdges().length&&!t.getEdges()[0].isInterGraph&&null==t.getChild()){if(h.PURE_INCREMENTAL){var a=t.getEdges()[0].getOtherEnd(t),s=new f(t.getCenterX()-a.getCenterX(),t.getCenterY()-a.getCenterY());n.push([t,t.getEdges()[0],t.getOwner(),s])}else n.push([t,t.getEdges()[0],t.getOwner()]);i=!0}if(1==i){for(var l=[],d=0;d<n.length;d++)1==n[d][0].getEdges().length&&(l.push(n[d]),n[d][0].getOwner().remove(n[d][0]));e.push(l),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},y.prototype.growTree=function(t){for(var e,i=t[t.length-1],o=0;o<i.length;o++)e=i[o],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},y.prototype.findPlaceforPrunedNode=function(t){var e,i,o=t[0];if(i=o==t[1].source?t[1].target:t[1].source,h.PURE_INCREMENTAL)o.setCenter(i.getCenterX()+t[3].getWidth(),i.getCenterY()+t[3].getHeight());else{var n=i.startX,r=i.finishX,a=i.startY,s=i.finishY,l=[0,0,0,0];if(a>0)for(var g=n;g<=r;g++)l[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(r<this.grid.length-1)for(g=a;g<=s;g++)l[1]+=this.grid[r+1][g].length+this.grid[r][g].length-1;if(s<this.grid[0].length-1)for(g=n;g<=r;g++)l[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(n>0)for(g=a;g<=s;g++)l[3]+=this.grid[n-1][g].length+this.grid[n][g].length-1;for(var c,p,f=m.MAX_VALUE,u=0;u<l.length;u++)l[u]<f?(f=l[u],c=1,p=u):l[u]==f&&c++;if(3==c&&0==f)0==l[0]&&0==l[1]&&0==l[2]?e=1:0==l[0]&&0==l[1]&&0==l[3]?e=0:0==l[0]&&0==l[2]&&0==l[3]?e=3:0==l[1]&&0==l[2]&&0==l[3]&&(e=2);else if(2==c&&0==f){var v=Math.floor(2*Math.random());e=0==l[0]&&0==l[1]?0==v?0:1:0==l[0]&&0==l[2]?0==v?0:2:0==l[0]&&0==l[3]?0==v?0:3:0==l[1]&&0==l[2]?0==v?1:2:0==l[1]&&0==l[3]?0==v?1:3:0==v?2:3}else e=4==c&&0==f?v=Math.floor(4*Math.random()):p;0==e?o.setCenter(i.getCenterX(),i.getCenterY()-i.getHeight()/2-d.DEFAULT_EDGE_LENGTH-o.getHeight()/2):1==e?o.setCenter(i.getCenterX()+i.getWidth()/2+d.DEFAULT_EDGE_LENGTH+o.getWidth()/2,i.getCenterY()):2==e?o.setCenter(i.getCenterX(),i.getCenterY()+i.getHeight()/2+d.DEFAULT_EDGE_LENGTH+o.getHeight()/2):o.setCenter(i.getCenterX()-i.getWidth()/2-d.DEFAULT_EDGE_LENGTH-o.getWidth()/2,i.getCenterY())}},t.exports=y},991:(t,e,i)=>{var o=i(551).FDLayoutNode,n=i(551).IMath;function r(t,e,i,n){o.call(this,t,e,i,n)}for(var a in r.prototype=Object.create(o.prototype),o)r[a]=o[a];r.prototype.calculateDisplacement=function(){var t=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},r.prototype.propogateDisplacementToChildren=function(t,e){for(var i,o=this.getChild().getNodes(),n=0;n<o.length;n++)null==(i=o[n]).getChild()?(i.displacementX+=t,i.displacementY+=e):i.propogateDisplacementToChildren(t,e)},r.prototype.move=function(){var t=this.graphManager.getLayout();null!=this.child&&0!=this.child.getNodes().length||(this.moveBy(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},r.prototype.setPred1=function(t){this.pred1=t},r.prototype.getPred1=function(){return pred1},r.prototype.getPred2=function(){return pred2},r.prototype.setNext=function(t){this.next=t},r.prototype.getNext=function(){return next},r.prototype.setProcessed=function(t){this.processed=t},r.prototype.isProcessed=function(){return processed},t.exports=r},902:(t,e,i)=>{function o(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}var n=i(806),r=i(551).LinkedList,a=i(551).Matrix,s=i(551).SVD;function h(){}h.handleConstraints=function(t){var e={};e.fixedNodeConstraint=t.constraints.fixedNodeConstraint,e.alignmentConstraint=t.constraints.alignmentConstraint,e.relativePlacementConstraint=t.constraints.relativePlacementConstraint;for(var i=new Map,h=new Map,l=[],d=[],g=t.getAllNodes(),c=0,p=0;p<g.length;p++){var f=g[p];null==f.getChild()&&(h.set(f.id,c++),l.push(f.getCenterX()),d.push(f.getCenterY()),i.set(f.id,f))}e.relativePlacementConstraint&&e.relativePlacementConstraint.forEach((function(t){t.gap||0==t.gap||(t.left?t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.left).getWidth()/2+i.get(t.right).getWidth()/2:t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.top).getHeight()/2+i.get(t.bottom).getHeight()/2)}));var u=function(t){var e=0,i=0;return t.forEach((function(t){e+=l[h.get(t)],i+=d[h.get(t)]})),{x:e/t.size,y:i/t.size}},m=function(t,e,i,n,a){var s=new Map;t.forEach((function(t,e){s.set(e,0)})),t.forEach((function(t,e){t.forEach((function(t){s.set(t.id,s.get(t.id)+1)}))}));var g=new Map,c=new Map,p=new r;s.forEach((function(t,o){0==t?(p.push(o),i||("horizontal"==e?g.set(o,h.has(o)?l[h.get(o)]:n.get(o)):g.set(o,h.has(o)?d[h.get(o)]:n.get(o)))):g.set(o,Number.NEGATIVE_INFINITY),i&&c.set(o,new Set([o]))})),i&&a.forEach((function(t){var o=[];if(t.forEach((function(t){i.has(t)&&o.push(t)})),o.length>0){var r=0;o.forEach((function(t){"horizontal"==e?(g.set(t,h.has(t)?l[h.get(t)]:n.get(t)),r+=g.get(t)):(g.set(t,h.has(t)?d[h.get(t)]:n.get(t)),r+=g.get(t))})),r/=o.length,t.forEach((function(t){i.has(t)||g.set(t,r)}))}else{var a=0;t.forEach((function(t){a+="horizontal"==e?h.has(t)?l[h.get(t)]:n.get(t):h.has(t)?d[h.get(t)]:n.get(t)})),a/=t.length,t.forEach((function(t){g.set(t,a)}))}}));for(var f=function(){var o=p.shift();t.get(o).forEach((function(t){if(g.get(t.id)<g.get(o)+t.gap)if(i&&i.has(t.id)){var r=void 0;if(r="horizontal"==e?h.has(t.id)?l[h.get(t.id)]:n.get(t.id):h.has(t.id)?d[h.get(t.id)]:n.get(t.id),g.set(t.id,r),r<g.get(o)+t.gap){var a=g.get(o)+t.gap-r;c.get(o).forEach((function(t){g.set(t,g.get(t)-a)}))}}else g.set(t.id,g.get(o)+t.gap);s.set(t.id,s.get(t.id)-1),0==s.get(t.id)&&p.push(t.id),i&&c.set(t.id,function(t,e){var i=new Set(t),o=!0,n=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done);o=!0){var h=a.value;i.add(h)}}catch(t){n=!0,r=t}finally{try{!o&&s.return&&s.return()}finally{if(n)throw r}}return i}(c.get(o),c.get(t.id)))}))};0!=p.length;)f();if(i){var u=new Set;t.forEach((function(t,e){0==t.length&&u.add(e)}));var m=[];c.forEach((function(t,e){if(u.has(e)){var n=!1,r=!0,a=!1,s=void 0;try{for(var h,l=t[Symbol.iterator]();!(r=(h=l.next()).done);r=!0){var d=h.value;i.has(d)&&(n=!0)}}catch(t){a=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(a)throw s}}if(!n){var g=!1,c=void 0;m.forEach((function(e,i){e.has([].concat(o(t))[0])&&(g=!0,c=i)})),g?t.forEach((function(t){m[c].add(t)})):m.push(new Set(t))}}})),m.forEach((function(t,i){var o=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,c=!0,p=!1,f=void 0;try{for(var u,m=t[Symbol.iterator]();!(c=(u=m.next()).done);c=!0){var v=u.value,T=void 0;T="horizontal"==e?h.has(v)?l[h.get(v)]:n.get(v):h.has(v)?d[h.get(v)]:n.get(v);var N=g.get(v);T<o&&(o=T),T>a&&(a=T),N<r&&(r=N),N>s&&(s=N)}}catch(t){p=!0,f=t}finally{try{!c&&m.return&&m.return()}finally{if(p)throw f}}var E=(o+a)/2-(r+s)/2,y=!0,C=!1,M=void 0;try{for(var w,A=t[Symbol.iterator]();!(y=(w=A.next()).done);y=!0){var I=w.value;g.set(I,g.get(I)+E)}}catch(t){C=!0,M=t}finally{try{!y&&A.return&&A.return()}finally{if(C)throw M}}}))}return g},v=function(t){var e=0,i=0,o=0,n=0;if(t.forEach((function(t){t.left?l[h.get(t.left)]-l[h.get(t.right)]>=0?e++:i++:d[h.get(t.top)]-d[h.get(t.bottom)]>=0?o++:n++})),e>i&&o>n)for(var r=0;r<h.size;r++)l[r]=-1*l[r],d[r]=-1*d[r];else if(e>i)for(var a=0;a<h.size;a++)l[a]=-1*l[a];else if(o>n)for(var s=0;s<h.size;s++)d[s]=-1*d[s]},T=function(t){var e=[],i=new r,o=new Set,n=0;return t.forEach((function(r,a){if(!o.has(a)){e[n]=[];var s=a;for(i.push(s),o.add(s),e[n].push(s);0!=i.length;)s=i.shift(),t.get(s).forEach((function(t){o.has(t.id)||(i.push(t.id),o.add(t.id),e[n].push(t.id))}));n++}})),e},N=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(i).push(t),e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},E=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},y=[],C=[],M=!1,w=!1,A=new Set,I=new Map,L=new Map,b=[];if(e.fixedNodeConstraint&&e.fixedNodeConstraint.forEach((function(t){A.add(t.nodeId)})),e.relativePlacementConstraint&&(e.relativePlacementConstraint.forEach((function(t){t.left?(I.has(t.left)?I.get(t.left).push({id:t.right,gap:t.gap,direction:"horizontal"}):I.set(t.left,[{id:t.right,gap:t.gap,direction:"horizontal"}]),I.has(t.right)||I.set(t.right,[])):(I.has(t.top)?I.get(t.top).push({id:t.bottom,gap:t.gap,direction:"vertical"}):I.set(t.top,[{id:t.bottom,gap:t.gap,direction:"vertical"}]),I.has(t.bottom)||I.set(t.bottom,[]))})),L=N(I),b=T(L)),n.TRANSFORM_ON_CONSTRAINT_HANDLING){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>1)e.fixedNodeConstraint.forEach((function(t,e){y[e]=[t.position.x,t.position.y],C[e]=[l[h.get(t.nodeId)],d[h.get(t.nodeId)]]})),M=!0;else if(e.alignmentConstraint)!function(){var t=0;if(e.alignmentConstraint.vertical){for(var i=e.alignmentConstraint.vertical,n=function(e){var n=new Set;i[e].forEach((function(t){n.add(t)}));var r=new Set([].concat(o(n)).filter((function(t){return A.has(t)}))),a=void 0;a=r.size>0?l[h.get(r.values().next().value)]:u(n).x,i[e].forEach((function(e){y[t]=[a,d[h.get(e)]],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},r=0;r<i.length;r++)n(r);M=!0}if(e.alignmentConstraint.horizontal){for(var a=e.alignmentConstraint.horizontal,s=function(e){var i=new Set;a[e].forEach((function(t){i.add(t)}));var n=new Set([].concat(o(i)).filter((function(t){return A.has(t)}))),r=void 0;r=n.size>0?l[h.get(n.values().next().value)]:u(i).y,a[e].forEach((function(e){y[t]=[l[h.get(e)],r],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},g=0;g<a.length;g++)s(g);M=!0}e.relativePlacementConstraint&&(w=!0)}();else if(e.relativePlacementConstraint){for(var _=0,F=0,R=0;R<b.length;R++)b[R].length>_&&(_=b[R].length,F=R);if(_<L.size/2)v(e.relativePlacementConstraint),M=!1,w=!1;else{var O=new Map,P=new Map,x=[];b[F].forEach((function(t){I.get(t).forEach((function(e){"horizontal"==e.direction?(O.has(t)?O.get(t).push(e):O.set(t,[e]),O.has(e.id)||O.set(e.id,[]),x.push({left:t,right:e.id})):(P.has(t)?P.get(t).push(e):P.set(t,[e]),P.has(e.id)||P.set(e.id,[]),x.push({top:t,bottom:e.id}))}))})),v(x),w=!1;var D=m(O,"horizontal"),H=m(P,"vertical");b[F].forEach((function(t,e){C[e]=[l[h.get(t)],d[h.get(t)]],y[e]=[],D.has(t)?y[e][0]=D.get(t):y[e][0]=l[h.get(t)],H.has(t)?y[e][1]=H.get(t):y[e][1]=d[h.get(t)]})),M=!0}}if(M){for(var G,z=a.transpose(y),S=a.transpose(C),V=0;V<z.length;V++)z[V]=a.multGamma(z[V]),S[V]=a.multGamma(S[V]);var W=a.multMat(z,a.transpose(S)),Y=s.svd(W);G=a.multMat(Y.V,a.transpose(Y.U));for(var X=0;X<h.size;X++){var U=[l[X],d[X]],B=[G[0][0],G[1][0]],k=[G[0][1],G[1][1]];l[X]=a.dotProduct(U,B),d[X]=a.dotProduct(U,k)}w&&v(e.relativePlacementConstraint)}}if(n.ENFORCE_CONSTRAINTS){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>0){var j={x:0,y:0};e.fixedNodeConstraint.forEach((function(t,e){var i,o,n={x:l[h.get(t.nodeId)],y:d[h.get(t.nodeId)]},r=t.position,a=(o=n,{x:(i=r).x-o.x,y:i.y-o.y});j.x+=a.x,j.y+=a.y})),j.x/=e.fixedNodeConstraint.length,j.y/=e.fixedNodeConstraint.length,l.forEach((function(t,e){l[e]+=j.x})),d.forEach((function(t,e){d[e]+=j.y})),e.fixedNodeConstraint.forEach((function(t){l[h.get(t.nodeId)]=t.position.x,d[h.get(t.nodeId)]=t.position.y}))}if(e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var Z=e.alignmentConstraint.vertical,q=function(t){var e=new Set;Z[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?l[h.get(i.values().next().value)]:u(e).x,e.forEach((function(t){A.has(t)||(l[h.get(t)]=n)}))},K=0;K<Z.length;K++)q(K);if(e.alignmentConstraint.horizontal)for(var Q=e.alignmentConstraint.horizontal,J=function(t){var e=new Set;Q[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?d[h.get(i.values().next().value)]:u(e).y,e.forEach((function(t){A.has(t)||(d[h.get(t)]=n)}))},$=0;$<Q.length;$++)J($)}e.relativePlacementConstraint&&function(){var t=new Map,i=new Map,o=new Map,n=new Map,r=new Map,a=new Map,s=new Set,g=new Set;if(A.forEach((function(t){s.add(t),g.add(t)})),e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var c=e.alignmentConstraint.vertical,p=function(e){o.set("dummy"+e,[]),c[e].forEach((function(i){t.set(i,"dummy"+e),o.get("dummy"+e).push(i),A.has(i)&&s.add("dummy"+e)})),r.set("dummy"+e,l[h.get(c[e][0])])},f=0;f<c.length;f++)p(f);if(e.alignmentConstraint.horizontal)for(var u=e.alignmentConstraint.horizontal,v=function(t){n.set("dummy"+t,[]),u[t].forEach((function(e){i.set(e,"dummy"+t),n.get("dummy"+t).push(e),A.has(e)&&g.add("dummy"+t)})),a.set("dummy"+t,d[h.get(u[t][0])])},y=0;y<u.length;y++)v(y)}var C=new Map,M=new Map,w=function(e){I.get(e).forEach((function(o){var n=void 0,r=void 0;"horizontal"==o.direction?(n=t.get(e)?t.get(e):e,r=t.get(o.id)?{id:t.get(o.id),gap:o.gap,direction:o.direction}:o,C.has(n)?C.get(n).push(r):C.set(n,[r]),C.has(r.id)||C.set(r.id,[])):(n=i.get(e)?i.get(e):e,r=i.get(o.id)?{id:i.get(o.id),gap:o.gap,direction:o.direction}:o,M.has(n)?M.get(n).push(r):M.set(n,[r]),M.has(r.id)||M.set(r.id,[]))}))},L=!0,b=!1,_=void 0;try{for(var F,R=I.keys()[Symbol.iterator]();!(L=(F=R.next()).done);L=!0)w(F.value)}catch(t){b=!0,_=t}finally{try{!L&&R.return&&R.return()}finally{if(b)throw _}}var O=N(C),P=N(M),x=T(O),D=T(P),H=E(C),G=E(M),z=[],S=[];x.forEach((function(t,e){z[e]=[],t.forEach((function(t){0==H.get(t).length&&z[e].push(t)}))})),D.forEach((function(t,e){S[e]=[],t.forEach((function(t){0==G.get(t).length&&S[e].push(t)}))}));var V=m(C,"horizontal",s,r,z),W=m(M,"vertical",g,a,S),Y=function(t){o.get(t)?o.get(t).forEach((function(e){l[h.get(e)]=V.get(t)})):l[h.get(t)]=V.get(t)},X=!0,U=!1,B=void 0;try{for(var k,j=V.keys()[Symbol.iterator]();!(X=(k=j.next()).done);X=!0)Y(k.value)}catch(t){U=!0,B=t}finally{try{!X&&j.return&&j.return()}finally{if(U)throw B}}var Z=function(t){n.get(t)?n.get(t).forEach((function(e){d[h.get(e)]=W.get(t)})):d[h.get(t)]=W.get(t)},q=!0,K=!1,Q=void 0;try{for(var J,$=W.keys()[Symbol.iterator]();!(q=(J=$.next()).done);q=!0)Z(J.value)}catch(t){K=!0,Q=t}finally{try{!q&&$.return&&$.return()}finally{if(K)throw Q}}}()}for(var tt=0;tt<g.length;tt++){var et=g[tt];null==et.getChild()&&et.setCenter(l[h.get(et.id)],d[h.get(et.id)])}},t.exports=h},551:e=>{e.exports=t}},i={},o=function t(o){var n=i[o];if(void 0!==n)return n.exports;var r=i[o]={exports:{}};return e[o](r,r.exports,t),r.exports}(45),o;var e,i,o},t.exports=n(i())),e.exports;var t,n}e.exports;export{n as __require};
|
|
1
|
+
import{commonjsGlobal as t}from"../../../../../_virtual/_commonjsHelpers.js";import{__module as e}from"../../../../../_virtual/cose-base2.js";import{__require as i}from"../../../layout-base@2.0.1/node_modules/layout-base/layout-base.js";var o;function n(){return o||(o=1,t=e,e.exports,n=function(t){return e={45:(t,e,i)=>{var o={};o.layoutBase=i(551),o.CoSEConstants=i(806),o.CoSEEdge=i(767),o.CoSEGraph=i(880),o.CoSEGraphManager=i(578),o.CoSELayout=i(765),o.CoSENode=i(991),o.ConstraintHandler=i(902),t.exports=o},806:(t,e,i)=>{var o=i(551).FDLayoutConstants;function n(){}for(var r in o)n[r]=o[r];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=o.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,n.ENFORCE_CONSTRAINTS=!0,n.APPLY_LAYOUT=!0,n.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,n.TREE_REDUCTION_ON_INCREMENTAL=!0,n.PURE_INCREMENTAL=n.DEFAULT_INCREMENTAL,t.exports=n},767:(t,e,i)=>{var o=i(551).FDLayoutEdge;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},880:(t,e,i)=>{var o=i(551).LGraph;function n(t,e,i){o.call(this,t,e,i)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},578:(t,e,i)=>{var o=i(551).LGraphManager;function n(t){o.call(this,t)}for(var r in n.prototype=Object.create(o.prototype),o)n[r]=o[r];t.exports=n},765:(t,e,i)=>{var o=i(551).FDLayout,n=i(578),r=i(880),a=i(991),s=i(767),h=i(806),l=i(902),d=i(551).FDLayoutConstants,g=i(551).LayoutConstants,c=i(551).Point,p=i(551).PointD,f=i(551).DimensionD,u=i(551).Layout,m=i(551).Integer,v=i(551).IGeometry,T=i(551).LGraph,N=i(551).Transform,E=i(551).LinkedList;function y(){o.call(this),this.toBeTiled={},this.constraints={}}for(var C in y.prototype=Object.create(o.prototype),o)y[C]=o[C];y.prototype.newGraphManager=function(){var t=new n(this);return this.graphManager=t,t},y.prototype.newGraph=function(t){return new r(null,this.graphManager,t)},y.prototype.newNode=function(t){return new a(this.graphManager,t)},y.prototype.newEdge=function(t){return new s(null,null,t)},y.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},y.prototype.initSpringEmbedder=function(){o.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},y.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},y.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)})),this.graphManager.setAllNodesToApplyGravitation(i));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(i),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(l.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,o=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,o),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i<t.length;i++){var o=t[i].rect,n=t[i].id;e[n]={id:n,x:o.getCenterX(),y:o.getCenterY(),w:o.width,h:o.height}}return e},y.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},y.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].calculateDisplacement();for(Object.keys(this.constraints).length>0&&this.updateDisplacements(),e=0;e<t.length;e++)t[e].move()},y.prototype.initConstraintVariables=function(){var t=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var e=this.graphManager.getAllNodes(),i=0;i<e.length;i++){var o=e[i];this.idToNodeMap.set(o.id,o)}var n=function e(i){for(var o,n=i.getChild().getNodes(),r=0,a=0;a<n.length;a++)null==(o=n[a]).getChild()?t.fixedNodeSet.has(o.id)&&(r+=100):r+=e(o);return r};if(this.constraints.fixedNodeConstraint)for(this.constraints.fixedNodeConstraint.forEach((function(e){t.fixedNodeSet.add(e.nodeId)})),e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)if(null!=(o=e[i]).getChild()){var r=n(o);r>0&&(o.fixedNodeWeight=r)}if(this.constraints.relativePlacementConstraint){var a=new Map,s=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach((function(e){t.fixedNodesOnHorizontal.add(e),t.fixedNodesOnVertical.add(e)})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var l=this.constraints.alignmentConstraint.vertical;for(i=0;i<l.length;i++)this.dummyToNodeForVerticalAlignment.set("dummy"+i,[]),l[i].forEach((function(e){a.set(e,"dummy"+i),t.dummyToNodeForVerticalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnHorizontal.add("dummy"+i)}))}if(this.constraints.alignmentConstraint.horizontal){var d=this.constraints.alignmentConstraint.horizontal;for(i=0;i<d.length;i++)this.dummyToNodeForHorizontalAlignment.set("dummy"+i,[]),d[i].forEach((function(e){s.set(e,"dummy"+i),t.dummyToNodeForHorizontalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnVertical.add("dummy"+i)}))}}if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(t){var e,i,o;for(o=t.length-1;o>=2*t.length/3;o--)e=Math.floor(Math.random()*(o+1)),i=t[o],t[o]=t[e],t[e]=i;return t},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach((function(e){if(e.left){var i=a.has(e.left)?a.get(e.left):e.left,o=a.has(e.right)?a.get(e.right):e.right;t.nodesInRelativeHorizontal.includes(i)||(t.nodesInRelativeHorizontal.push(i),t.nodeToRelativeConstraintMapHorizontal.set(i,[]),t.dummyToNodeForVerticalAlignment.has(i)?t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(i)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(i).getCenterX())),t.nodesInRelativeHorizontal.includes(o)||(t.nodesInRelativeHorizontal.push(o),t.nodeToRelativeConstraintMapHorizontal.set(o,[]),t.dummyToNodeForVerticalAlignment.has(o)?t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(o)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(o,t.idToNodeMap.get(o).getCenterX())),t.nodeToRelativeConstraintMapHorizontal.get(i).push({right:o,gap:e.gap}),t.nodeToRelativeConstraintMapHorizontal.get(o).push({left:i,gap:e.gap})}else{var n=s.has(e.top)?s.get(e.top):e.top,r=s.has(e.bottom)?s.get(e.bottom):e.bottom;t.nodesInRelativeVertical.includes(n)||(t.nodesInRelativeVertical.push(n),t.nodeToRelativeConstraintMapVertical.set(n,[]),t.dummyToNodeForHorizontalAlignment.has(n)?t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(n)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(n).getCenterY())),t.nodesInRelativeVertical.includes(r)||(t.nodesInRelativeVertical.push(r),t.nodeToRelativeConstraintMapVertical.set(r,[]),t.dummyToNodeForHorizontalAlignment.has(r)?t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(r)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(r,t.idToNodeMap.get(r).getCenterY())),t.nodeToRelativeConstraintMapVertical.get(n).push({bottom:r,gap:e.gap}),t.nodeToRelativeConstraintMapVertical.get(r).push({top:n,gap:e.gap})}}));else{var g=new Map,c=new Map;this.constraints.relativePlacementConstraint.forEach((function(t){if(t.left){var e=a.has(t.left)?a.get(t.left):t.left,i=a.has(t.right)?a.get(t.right):t.right;g.has(e)?g.get(e).push(i):g.set(e,[i]),g.has(i)?g.get(i).push(e):g.set(i,[e])}else{var o=s.has(t.top)?s.get(t.top):t.top,n=s.has(t.bottom)?s.get(t.bottom):t.bottom;c.has(o)?c.get(o).push(n):c.set(o,[n]),c.has(n)?c.get(n).push(o):c.set(n,[o])}}));var p=function(t,e){var i=[],o=[],n=new E,r=new Set,a=0;return t.forEach((function(s,h){if(!r.has(h)){i[a]=[],o[a]=!1;var l=h;for(n.push(l),r.add(l),i[a].push(l);0!=n.length;)l=n.shift(),e.has(l)&&(o[a]=!0),t.get(l).forEach((function(t){r.has(t)||(n.push(t),r.add(t),i[a].push(t))}));a++}})),{components:i,isFixed:o}},f=p(g,t.fixedNodesOnHorizontal);this.componentsOnHorizontal=f.components,this.fixedComponentsOnHorizontal=f.isFixed;var u=p(c,t.fixedNodesOnVertical);this.componentsOnVertical=u.components,this.fixedComponentsOnVertical=u.isFixed}}},y.prototype.updateDisplacements=function(){var t=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach((function(e){var i=t.idToNodeMap.get(e.nodeId);i.displacementX=0,i.displacementY=0})),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var e=this.constraints.alignmentConstraint.vertical,i=0;i<e.length;i++){for(var o=0,n=0;n<e[i].length;n++){if(this.fixedNodeSet.has(e[i][n])){o=0;break}o+=this.idToNodeMap.get(e[i][n]).displacementX}var r=o/e[i].length;for(n=0;n<e[i].length;n++)this.idToNodeMap.get(e[i][n]).displacementX=r}if(this.constraints.alignmentConstraint.horizontal){var a=this.constraints.alignmentConstraint.horizontal;for(i=0;i<a.length;i++){var s=0;for(n=0;n<a[i].length;n++){if(this.fixedNodeSet.has(a[i][n])){s=0;break}s+=this.idToNodeMap.get(a[i][n]).displacementY}var l=s/a[i].length;for(n=0;n<a[i].length;n++)this.idToNodeMap.get(a[i][n]).displacementY=l}}}if(this.constraints.relativePlacementConstraint)if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForVerticalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(e)[0]).displacementX:t.idToNodeMap.get(e).displacementX,t.nodeToRelativeConstraintMapHorizontal.get(e).forEach((function(o){var n;o.right?(n=t.nodeToTempPositionMapHorizontal.get(o.right)-t.nodeToTempPositionMapHorizontal.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapHorizontal.get(e)-t.nodeToTempPositionMapHorizontal.get(o.left)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapHorizontal.set(e,t.nodeToTempPositionMapHorizontal.get(e)+i),t.dummyToNodeForVerticalAlignment.has(e)?t.dummyToNodeForVerticalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementX=i})):t.idToNodeMap.get(e).displacementX=i}})),this.nodesInRelativeVertical.forEach((function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForHorizontalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(e)[0]).displacementY:t.idToNodeMap.get(e).displacementY,t.nodeToRelativeConstraintMapVertical.get(e).forEach((function(o){var n;o.bottom?(n=t.nodeToTempPositionMapVertical.get(o.bottom)-t.nodeToTempPositionMapVertical.get(e)-i)<o.gap&&(i-=o.gap-n):(n=t.nodeToTempPositionMapVertical.get(e)-t.nodeToTempPositionMapVertical.get(o.top)+i)<o.gap&&(i+=o.gap-n)})),t.nodeToTempPositionMapVertical.set(e,t.nodeToTempPositionMapVertical.get(e)+i),t.dummyToNodeForHorizontalAlignment.has(e)?t.dummyToNodeForHorizontalAlignment.get(e).forEach((function(e){t.idToNodeMap.get(e).displacementY=i})):t.idToNodeMap.get(e).displacementY=i}}));else{for(i=0;i<this.componentsOnHorizontal.length;i++){var d=this.componentsOnHorizontal[i];if(this.fixedComponentsOnHorizontal[i])for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=0})):this.idToNodeMap.get(d[n]).displacementX=0;else{var g=0,c=0;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForVerticalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementX,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementX,c++);var p=g/c;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementX=p})):this.idToNodeMap.get(d[n]).displacementX=p}}for(i=0;i<this.componentsOnVertical.length;i++)if(d=this.componentsOnVertical[i],this.fixedComponentsOnVertical[i])for(n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=0})):this.idToNodeMap.get(d[n]).displacementY=0;else{for(g=0,c=0,n=0;n<d.length;n++){var f;this.dummyToNodeForHorizontalAlignment.has(d[n])?(g+=(f=this.dummyToNodeForHorizontalAlignment.get(d[n])).length*this.idToNodeMap.get(f[0]).displacementY,c+=f.length):(g+=this.idToNodeMap.get(d[n]).displacementY,c++)}for(p=g/c,n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach((function(e){t.idToNodeMap.get(e).displacementY=p})):this.idToNodeMap.get(d[n]).displacementY=p}}},y.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,i=[],o=this.graphManager.getGraphs(),n=o.length;for(e=0;e<n;e++)(t=o[e]).updateConnected(),t.isConnected||(i=i.concat(t.getNodes()));return i},y.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,i=new Set;for(e=0;e<t.length;e++){var o=t[e];if(!i.has(o)){var n=o.getSource(),r=o.getTarget();if(n==r)o.getBendpoints().push(new p),o.getBendpoints().push(new p),this.createDummyNodesForBendpoints(o),i.add(o);else{var a=[];if(a=(a=a.concat(n.getEdgeListToNode(r))).concat(r.getEdgeListToNode(n)),!i.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach((function(t){i.add(t)}))}}}if(i.size==t.length)break}},y.prototype.positionNodesRadially=function(t){for(var e=new c(0,0),i=Math.ceil(Math.sqrt(t.length)),o=0,n=0,r=0,a=new p(0,0),s=0;s<t.length;s++){s%i==0&&(r=0,n=o,0!=s&&(n+=h.DEFAULT_COMPONENT_SEPERATION),o=0);var l=t[s],d=u.findCenterOfTree(l);e.x=r,e.y=n,(a=y.radialLayout(l,d,e)).y>o&&(o=Math.floor(a.y)),r=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},y.radialLayout=function(t,e,i){var o=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(e,null,0,359,0,o);var n=T.calculateBounds(t),r=new N;r.setDeviceOrgX(n.getMinX()),r.setDeviceOrgY(n.getMinY()),r.setWorldOrgX(i.x),r.setWorldOrgY(i.y);for(var a=0;a<t.length;a++)t[a].transform(r);var s=new p(n.getMaxX(),n.getMaxY());return r.inverseTransformPoint(s)},y.branchRadialLayout=function(t,e,i,o,n,r){var a=(o-i+1)/2;a<0&&(a+=180);var s=(a+i)%360*v.TWO_PI/360,h=n*Math.cos(s),l=n*Math.sin(s);t.setCenter(h,l);var d=[],g=(d=d.concat(t.getEdges())).length;null!=e&&g--;for(var c,p=0,f=d.length,u=t.getEdgesBetween(e);u.length>1;){var m=u[0];u.splice(0,1);var T=d.indexOf(m);T>=0&&d.splice(T,1),f--,g--}c=null!=e?(d.indexOf(u[0])+1)%f:0;for(var N=Math.abs(o-i)/g,E=c;p!=g;E=++E%f){var C=d[E].getOtherEnd(t);if(C!=e){var M=(i+p*N)%360,w=(M+N)%360;y.branchRadialLayout(C,t,M,w,n+r,r),p++}}},y.maxDiagonalInTree=function(t){for(var e=m.MIN_VALUE,i=0;i<t.length;i++){var o=t[i].getDiagonal();o>e&&(e=o)}return e},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],o=this.graphManager.getAllNodes(),n=0;n<o.length;n++){var r=(s=o[n]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=r.id&&this.getToBeTiled(r)||i.push(s)}for(n=0;n<i.length;n++){var s,h=(s=i[n]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(s)}Object.keys(e).forEach((function(i){if(e[i].length>1){var o="DummyCompound_"+i;t.memberGroups[o]=e[i];var n=e[i][0].getParent(),r=new a(t.graphManager);r.id=o,r.paddingLeft=n.paddingLeft||0,r.paddingRight=n.paddingRight||0,r.paddingBottom=n.paddingBottom||0,r.paddingTop=n.paddingTop||0,t.idToDummyNode[o]=r;var s=t.getGraphManager().add(t.newGraph(),r),h=n.getChild();h.add(r);for(var l=0;l<e[i].length;l++){var d=e[i][l];h.remove(d),s.add(d)}}}))},y.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var i=0;i<this.compoundOrder.length;i++)e[this.compoundOrder[i].id]=this.compoundOrder[i],t[this.compoundOrder[i].id]=[].concat(this.compoundOrder[i].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[i].getChild()),this.compoundOrder[i].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},y.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(i){var o=t.idToDummyNode[i];if(e[i]=t.tileNodes(t.memberGroups[i],o.paddingLeft+o.paddingRight),o.rect.width=e[i].width,o.rect.height=e[i].height,o.setCenter(e[i].centerX,e[i].centerY),o.labelMarginLeft=0,o.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var n=o.rect.width,r=o.rect.height;o.labelWidth&&("left"==o.labelPosHorizontal?(o.rect.x-=o.labelWidth,o.setWidth(n+o.labelWidth),o.labelMarginLeft=o.labelWidth):"center"==o.labelPosHorizontal&&o.labelWidth>n?(o.rect.x-=(o.labelWidth-n)/2,o.setWidth(o.labelWidth),o.labelMarginLeft=(o.labelWidth-n)/2):"right"==o.labelPosHorizontal&&o.setWidth(n+o.labelWidth)),o.labelHeight&&("top"==o.labelPosVertical?(o.rect.y-=o.labelHeight,o.setHeight(r+o.labelHeight),o.labelMarginTop=o.labelHeight):"center"==o.labelPosVertical&&o.labelHeight>r?(o.rect.y-=(o.labelHeight-r)/2,o.setHeight(o.labelHeight),o.labelMarginTop=(o.labelHeight-r)/2):"bottom"==o.labelPosVertical&&o.setHeight(r+o.labelHeight))}}))},y.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,o=e.paddingLeft,n=e.paddingTop,r=e.labelMarginLeft,a=e.labelMarginTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,o,n,r,a)}},y.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(i){var o=t.idToDummyNode[i],n=o.paddingLeft,r=o.paddingTop,a=o.labelMarginLeft,s=o.labelMarginTop;t.adjustLocations(e[i],o.rect.x,o.rect.y,n,r,a,s)}))},y.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var o=i.getNodes(),n=0;n<o.length;n++){var r=o[n];if(this.getNodeDegree(r)>0)return this.toBeTiled[e]=!1,!1;if(null!=r.getChild()){if(!this.getToBeTiled(r))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[r.id]=!1}return this.toBeTiled[e]=!0,!0},y.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,o=0;o<e.length;o++){var n=e[o];n.getSource().id!==n.getTarget().id&&(i+=1)}return i},y.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var i=t.getChild().getNodes(),o=0;o<i.length;o++){var n=i[o];e+=this.getNodeDegreeWithChildren(n)}return e},y.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},y.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var i=t[e];null!=i.getChild()&&this.fillCompexOrderByDFS(i.getChild().getNodes()),this.getToBeTiled(i)&&this.compoundOrder.push(i)}},y.prototype.adjustLocations=function(t,e,i,o,n,r,a){i+=n+a;for(var s=e+=o+r,h=0;h<t.rows.length;h++){var l=t.rows[h];e=s;for(var d=0,g=0;g<l.length;g++){var c=l[g];c.rect.x=e,c.rect.y=i,e+=c.rect.width+t.horizontalPadding,c.rect.height>d&&(d=c.rect.height)}i+=d+t.verticalPadding}},y.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(o){var n=e[o];if(i.tiledMemberPack[o]=i.tileNodes(t[o],n.paddingLeft+n.paddingRight),n.rect.width=i.tiledMemberPack[o].width,n.rect.height=i.tiledMemberPack[o].height,n.setCenter(i.tiledMemberPack[o].centerX,i.tiledMemberPack[o].centerY),n.labelMarginLeft=0,n.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var r=n.rect.width,a=n.rect.height;n.labelWidth&&("left"==n.labelPosHorizontal?(n.rect.x-=n.labelWidth,n.setWidth(r+n.labelWidth),n.labelMarginLeft=n.labelWidth):"center"==n.labelPosHorizontal&&n.labelWidth>r?(n.rect.x-=(n.labelWidth-r)/2,n.setWidth(n.labelWidth),n.labelMarginLeft=(n.labelWidth-r)/2):"right"==n.labelPosHorizontal&&n.setWidth(r+n.labelWidth)),n.labelHeight&&("top"==n.labelPosVertical?(n.rect.y-=n.labelHeight,n.setHeight(a+n.labelHeight),n.labelMarginTop=n.labelHeight):"center"==n.labelPosVertical&&n.labelHeight>a?(n.rect.y-=(n.labelHeight-a)/2,n.setHeight(n.labelHeight),n.labelMarginTop=(n.labelHeight-a)/2):"bottom"==n.labelPosVertical&&n.setHeight(a+n.labelHeight))}}))},y.prototype.tileNodes=function(t,e){var i=this.tileNodesByFavoringDim(t,e,!0),o=this.tileNodesByFavoringDim(t,e,!1),n=this.getOrgRatio(i);return this.getOrgRatio(o)<n?o:i},y.prototype.getOrgRatio=function(t){var e=t.width/t.height;return e<1&&(e=1/e),e},y.prototype.calcIdealRowWidth=function(t,e){var i=h.TILING_PADDING_VERTICAL,o=h.TILING_PADDING_HORIZONTAL,n=t.length,r=0,a=0,s=0;t.forEach((function(t){r+=t.getWidth(),a+=t.getHeight(),t.getWidth()>s&&(s=t.getWidth())}));var l,d=r/n,g=a/n,c=Math.pow(i-o,2)+4*(d+o)*(g+i)*n,p=(o-i+Math.sqrt(c))/(2*(d+o));e?(l=Math.ceil(p))==p&&l++:l=Math.floor(p);var f=l*(d+o)-o;return s>f&&(f=s),f+=2*o},y.prototype.tileNodesByFavoringDim=function(t,e,i){var o=h.TILING_PADDING_VERTICAL,n=h.TILING_PADDING_HORIZONTAL,r=h.TILING_COMPARE_BY,a={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:o,horizontalPadding:n,centerX:0,centerY:0};r&&(a.idealRowWidth=this.calcIdealRowWidth(t,i));var s=function(t){return t.rect.width*t.rect.height},l=function(t,e){return s(e)-s(t)};t.sort((function(t,e){var i=l;return a.idealRowWidth?(i=r)(t.id,e.id):i(t,e)}));for(var d=0,g=0,c=0;c<t.length;c++)d+=(p=t[c]).getCenterX(),g+=p.getCenterY();for(a.centerX=d/t.length,a.centerY=g/t.length,c=0;c<t.length;c++){var p=t[c];if(0==a.rows.length)this.insertNodeToRow(a,p,0,e);else if(this.canAddHorizontal(a,p.rect.width,p.rect.height)){var f=a.rows.length-1;a.idealRowWidth||(f=this.getShortestRowIndex(a)),this.insertNodeToRow(a,p,f,e)}else this.insertNodeToRow(a,p,a.rows.length,e);this.shiftToLastRow(a)}return a},y.prototype.insertNodeToRow=function(t,e,i,o){var n=o;i==t.rows.length&&(t.rows.push([]),t.rowWidth.push(n),t.rowHeight.push(0));var r=t.rowWidth[i]+e.rect.width;t.rows[i].length>0&&(r+=t.horizontalPadding),t.rowWidth[i]=r,t.width<r&&(t.width=r);var a=e.rect.height;i>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[i]&&(s=t.rowHeight[i],t.rowHeight[i]=a,s=t.rowHeight[i]-s),t.height+=s,t.rows[i].push(e)},y.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]<i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.getLongestRowIndex=function(t){for(var e=-1,i=Number.MIN_VALUE,o=0;o<t.rows.length;o++)t.rowWidth[o]>i&&(e=o,i=t.rowWidth[o]);return e},y.prototype.canAddHorizontal=function(t,e,i){if(t.idealRowWidth){var o=t.rows.length-1;return t.rowWidth[o]+e+t.horizontalPadding<=t.idealRowWidth}var n=this.getShortestRowIndex(t);if(n<0)return!0;var r=t.rowWidth[n];if(r+t.horizontalPadding+e<=t.width)return!0;var a,s,h=0;return t.rowHeight[n]<i&&n>0&&(h=i+t.verticalPadding-t.rowHeight[n]),a=t.width-r>=e+t.horizontalPadding?(t.height+h)/(r+e+t.horizontalPadding):(t.height+h)/t.width,h=i+t.verticalPadding,(s=t.width<e?(t.height+h)/e:(t.height+h)/t.width)<1&&(s=1/s),a<1&&(a=1/a),a<s},y.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),i=t.rowWidth.length-1,o=t.rows[e],n=o[o.length-1],r=n.width+t.horizontalPadding;if(t.width-t.rowWidth[i]>r&&e!=i){o.splice(-1,1),t.rows[i].push(n),t.rowWidth[e]=t.rowWidth[e]-r,t.rowWidth[i]=t.rowWidth[i]+r,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<o.length;s++)o[s].height>a&&(a=o[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=a,t.rowHeight[i]<n.height+t.verticalPadding&&(t.rowHeight[i]=n.height+t.verticalPadding);var l=t.rowHeight[e]+t.rowHeight[i];t.height+=l-h,this.shiftToLastRow(t)}},y.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},y.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},y.prototype.reduceTrees=function(){for(var t,e=[],i=!0;i;){var o=this.graphManager.getAllNodes(),n=[];i=!1;for(var r=0;r<o.length;r++)if(1==(t=o[r]).getEdges().length&&!t.getEdges()[0].isInterGraph&&null==t.getChild()){if(h.PURE_INCREMENTAL){var a=t.getEdges()[0].getOtherEnd(t),s=new f(t.getCenterX()-a.getCenterX(),t.getCenterY()-a.getCenterY());n.push([t,t.getEdges()[0],t.getOwner(),s])}else n.push([t,t.getEdges()[0],t.getOwner()]);i=!0}if(1==i){for(var l=[],d=0;d<n.length;d++)1==n[d][0].getEdges().length&&(l.push(n[d]),n[d][0].getOwner().remove(n[d][0]));e.push(l),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},y.prototype.growTree=function(t){for(var e,i=t[t.length-1],o=0;o<i.length;o++)e=i[o],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},y.prototype.findPlaceforPrunedNode=function(t){var e,i,o=t[0];if(i=o==t[1].source?t[1].target:t[1].source,h.PURE_INCREMENTAL)o.setCenter(i.getCenterX()+t[3].getWidth(),i.getCenterY()+t[3].getHeight());else{var n=i.startX,r=i.finishX,a=i.startY,s=i.finishY,l=[0,0,0,0];if(a>0)for(var g=n;g<=r;g++)l[0]+=this.grid[g][a-1].length+this.grid[g][a].length-1;if(r<this.grid.length-1)for(g=a;g<=s;g++)l[1]+=this.grid[r+1][g].length+this.grid[r][g].length-1;if(s<this.grid[0].length-1)for(g=n;g<=r;g++)l[2]+=this.grid[g][s+1].length+this.grid[g][s].length-1;if(n>0)for(g=a;g<=s;g++)l[3]+=this.grid[n-1][g].length+this.grid[n][g].length-1;for(var c,p,f=m.MAX_VALUE,u=0;u<l.length;u++)l[u]<f?(f=l[u],c=1,p=u):l[u]==f&&c++;if(3==c&&0==f)0==l[0]&&0==l[1]&&0==l[2]?e=1:0==l[0]&&0==l[1]&&0==l[3]?e=0:0==l[0]&&0==l[2]&&0==l[3]?e=3:0==l[1]&&0==l[2]&&0==l[3]&&(e=2);else if(2==c&&0==f){var v=Math.floor(2*Math.random());e=0==l[0]&&0==l[1]?0==v?0:1:0==l[0]&&0==l[2]?0==v?0:2:0==l[0]&&0==l[3]?0==v?0:3:0==l[1]&&0==l[2]?0==v?1:2:0==l[1]&&0==l[3]?0==v?1:3:0==v?2:3}else e=4==c&&0==f?v=Math.floor(4*Math.random()):p;0==e?o.setCenter(i.getCenterX(),i.getCenterY()-i.getHeight()/2-d.DEFAULT_EDGE_LENGTH-o.getHeight()/2):1==e?o.setCenter(i.getCenterX()+i.getWidth()/2+d.DEFAULT_EDGE_LENGTH+o.getWidth()/2,i.getCenterY()):2==e?o.setCenter(i.getCenterX(),i.getCenterY()+i.getHeight()/2+d.DEFAULT_EDGE_LENGTH+o.getHeight()/2):o.setCenter(i.getCenterX()-i.getWidth()/2-d.DEFAULT_EDGE_LENGTH-o.getWidth()/2,i.getCenterY())}},t.exports=y},991:(t,e,i)=>{var o=i(551).FDLayoutNode,n=i(551).IMath;function r(t,e,i,n){o.call(this,t,e,i,n)}for(var a in r.prototype=Object.create(o.prototype),o)r[a]=o[a];r.prototype.calculateDisplacement=function(){var t=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},r.prototype.propogateDisplacementToChildren=function(t,e){for(var i,o=this.getChild().getNodes(),n=0;n<o.length;n++)null==(i=o[n]).getChild()?(i.displacementX+=t,i.displacementY+=e):i.propogateDisplacementToChildren(t,e)},r.prototype.move=function(){var t=this.graphManager.getLayout();null!=this.child&&0!=this.child.getNodes().length||(this.moveBy(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},r.prototype.setPred1=function(t){this.pred1=t},r.prototype.getPred1=function(){return pred1},r.prototype.getPred2=function(){return pred2},r.prototype.setNext=function(t){this.next=t},r.prototype.getNext=function(){return next},r.prototype.setProcessed=function(t){this.processed=t},r.prototype.isProcessed=function(){return processed},t.exports=r},902:(t,e,i)=>{function o(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}var n=i(806),r=i(551).LinkedList,a=i(551).Matrix,s=i(551).SVD;function h(){}h.handleConstraints=function(t){var e={};e.fixedNodeConstraint=t.constraints.fixedNodeConstraint,e.alignmentConstraint=t.constraints.alignmentConstraint,e.relativePlacementConstraint=t.constraints.relativePlacementConstraint;for(var i=new Map,h=new Map,l=[],d=[],g=t.getAllNodes(),c=0,p=0;p<g.length;p++){var f=g[p];null==f.getChild()&&(h.set(f.id,c++),l.push(f.getCenterX()),d.push(f.getCenterY()),i.set(f.id,f))}e.relativePlacementConstraint&&e.relativePlacementConstraint.forEach((function(t){t.gap||0==t.gap||(t.left?t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.left).getWidth()/2+i.get(t.right).getWidth()/2:t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.top).getHeight()/2+i.get(t.bottom).getHeight()/2)}));var u=function(t){var e=0,i=0;return t.forEach((function(t){e+=l[h.get(t)],i+=d[h.get(t)]})),{x:e/t.size,y:i/t.size}},m=function(t,e,i,n,a){var s=new Map;t.forEach((function(t,e){s.set(e,0)})),t.forEach((function(t,e){t.forEach((function(t){s.set(t.id,s.get(t.id)+1)}))}));var g=new Map,c=new Map,p=new r;s.forEach((function(t,o){0==t?(p.push(o),i||("horizontal"==e?g.set(o,h.has(o)?l[h.get(o)]:n.get(o)):g.set(o,h.has(o)?d[h.get(o)]:n.get(o)))):g.set(o,Number.NEGATIVE_INFINITY),i&&c.set(o,new Set([o]))})),i&&a.forEach((function(t){var o=[];if(t.forEach((function(t){i.has(t)&&o.push(t)})),o.length>0){var r=0;o.forEach((function(t){"horizontal"==e?(g.set(t,h.has(t)?l[h.get(t)]:n.get(t)),r+=g.get(t)):(g.set(t,h.has(t)?d[h.get(t)]:n.get(t)),r+=g.get(t))})),r/=o.length,t.forEach((function(t){i.has(t)||g.set(t,r)}))}else{var a=0;t.forEach((function(t){a+="horizontal"==e?h.has(t)?l[h.get(t)]:n.get(t):h.has(t)?d[h.get(t)]:n.get(t)})),a/=t.length,t.forEach((function(t){g.set(t,a)}))}}));for(var f=function(){var o=p.shift();t.get(o).forEach((function(t){if(g.get(t.id)<g.get(o)+t.gap)if(i&&i.has(t.id)){var r=void 0;if(r="horizontal"==e?h.has(t.id)?l[h.get(t.id)]:n.get(t.id):h.has(t.id)?d[h.get(t.id)]:n.get(t.id),g.set(t.id,r),r<g.get(o)+t.gap){var a=g.get(o)+t.gap-r;c.get(o).forEach((function(t){g.set(t,g.get(t)-a)}))}}else g.set(t.id,g.get(o)+t.gap);s.set(t.id,s.get(t.id)-1),0==s.get(t.id)&&p.push(t.id),i&&c.set(t.id,function(t,e){var i=new Set(t),o=!0,n=!1,r=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done);o=!0){var h=a.value;i.add(h)}}catch(t){n=!0,r=t}finally{try{!o&&s.return&&s.return()}finally{if(n)throw r}}return i}(c.get(o),c.get(t.id)))}))};0!=p.length;)f();if(i){var u=new Set;t.forEach((function(t,e){0==t.length&&u.add(e)}));var m=[];c.forEach((function(t,e){if(u.has(e)){var n=!1,r=!0,a=!1,s=void 0;try{for(var h,l=t[Symbol.iterator]();!(r=(h=l.next()).done);r=!0){var d=h.value;i.has(d)&&(n=!0)}}catch(t){a=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(a)throw s}}if(!n){var g=!1,c=void 0;m.forEach((function(e,i){e.has([].concat(o(t))[0])&&(g=!0,c=i)})),g?t.forEach((function(t){m[c].add(t)})):m.push(new Set(t))}}})),m.forEach((function(t,i){var o=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,c=!0,p=!1,f=void 0;try{for(var u,m=t[Symbol.iterator]();!(c=(u=m.next()).done);c=!0){var v=u.value,T=void 0;T="horizontal"==e?h.has(v)?l[h.get(v)]:n.get(v):h.has(v)?d[h.get(v)]:n.get(v);var N=g.get(v);T<o&&(o=T),T>a&&(a=T),N<r&&(r=N),N>s&&(s=N)}}catch(t){p=!0,f=t}finally{try{!c&&m.return&&m.return()}finally{if(p)throw f}}var E=(o+a)/2-(r+s)/2,y=!0,C=!1,M=void 0;try{for(var w,A=t[Symbol.iterator]();!(y=(w=A.next()).done);y=!0){var I=w.value;g.set(I,g.get(I)+E)}}catch(t){C=!0,M=t}finally{try{!y&&A.return&&A.return()}finally{if(C)throw M}}}))}return g},v=function(t){var e=0,i=0,o=0,n=0;if(t.forEach((function(t){t.left?l[h.get(t.left)]-l[h.get(t.right)]>=0?e++:i++:d[h.get(t.top)]-d[h.get(t.bottom)]>=0?o++:n++})),e>i&&o>n)for(var r=0;r<h.size;r++)l[r]=-1*l[r],d[r]=-1*d[r];else if(e>i)for(var a=0;a<h.size;a++)l[a]=-1*l[a];else if(o>n)for(var s=0;s<h.size;s++)d[s]=-1*d[s]},T=function(t){var e=[],i=new r,o=new Set,n=0;return t.forEach((function(r,a){if(!o.has(a)){e[n]=[];var s=a;for(i.push(s),o.add(s),e[n].push(s);0!=i.length;)s=i.shift(),t.get(s).forEach((function(t){o.has(t.id)||(i.push(t.id),o.add(t.id),e[n].push(t.id))}));n++}})),e},N=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(i).push(t),e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},E=function(t){var e=new Map;return t.forEach((function(t,i){e.set(i,[])})),t.forEach((function(t,i){t.forEach((function(t){e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})}))})),e},y=[],C=[],M=!1,w=!1,A=new Set,I=new Map,L=new Map,b=[];if(e.fixedNodeConstraint&&e.fixedNodeConstraint.forEach((function(t){A.add(t.nodeId)})),e.relativePlacementConstraint&&(e.relativePlacementConstraint.forEach((function(t){t.left?(I.has(t.left)?I.get(t.left).push({id:t.right,gap:t.gap,direction:"horizontal"}):I.set(t.left,[{id:t.right,gap:t.gap,direction:"horizontal"}]),I.has(t.right)||I.set(t.right,[])):(I.has(t.top)?I.get(t.top).push({id:t.bottom,gap:t.gap,direction:"vertical"}):I.set(t.top,[{id:t.bottom,gap:t.gap,direction:"vertical"}]),I.has(t.bottom)||I.set(t.bottom,[]))})),L=N(I),b=T(L)),n.TRANSFORM_ON_CONSTRAINT_HANDLING){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>1)e.fixedNodeConstraint.forEach((function(t,e){y[e]=[t.position.x,t.position.y],C[e]=[l[h.get(t.nodeId)],d[h.get(t.nodeId)]]})),M=!0;else if(e.alignmentConstraint)!function(){var t=0;if(e.alignmentConstraint.vertical){for(var i=e.alignmentConstraint.vertical,n=function(e){var n=new Set;i[e].forEach((function(t){n.add(t)}));var r=new Set([].concat(o(n)).filter((function(t){return A.has(t)}))),a=void 0;a=r.size>0?l[h.get(r.values().next().value)]:u(n).x,i[e].forEach((function(e){y[t]=[a,d[h.get(e)]],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},r=0;r<i.length;r++)n(r);M=!0}if(e.alignmentConstraint.horizontal){for(var a=e.alignmentConstraint.horizontal,s=function(e){var i=new Set;a[e].forEach((function(t){i.add(t)}));var n=new Set([].concat(o(i)).filter((function(t){return A.has(t)}))),r=void 0;r=n.size>0?l[h.get(n.values().next().value)]:u(i).y,a[e].forEach((function(e){y[t]=[l[h.get(e)],r],C[t]=[l[h.get(e)],d[h.get(e)]],t++}))},g=0;g<a.length;g++)s(g);M=!0}e.relativePlacementConstraint&&(w=!0)}();else if(e.relativePlacementConstraint){for(var _=0,F=0,R=0;R<b.length;R++)b[R].length>_&&(_=b[R].length,F=R);if(_<L.size/2)v(e.relativePlacementConstraint),M=!1,w=!1;else{var O=new Map,P=new Map,x=[];b[F].forEach((function(t){I.get(t).forEach((function(e){"horizontal"==e.direction?(O.has(t)?O.get(t).push(e):O.set(t,[e]),O.has(e.id)||O.set(e.id,[]),x.push({left:t,right:e.id})):(P.has(t)?P.get(t).push(e):P.set(t,[e]),P.has(e.id)||P.set(e.id,[]),x.push({top:t,bottom:e.id}))}))})),v(x),w=!1;var D=m(O,"horizontal"),H=m(P,"vertical");b[F].forEach((function(t,e){C[e]=[l[h.get(t)],d[h.get(t)]],y[e]=[],D.has(t)?y[e][0]=D.get(t):y[e][0]=l[h.get(t)],H.has(t)?y[e][1]=H.get(t):y[e][1]=d[h.get(t)]})),M=!0}}if(M){for(var G,z=a.transpose(y),S=a.transpose(C),V=0;V<z.length;V++)z[V]=a.multGamma(z[V]),S[V]=a.multGamma(S[V]);var W=a.multMat(z,a.transpose(S)),Y=s.svd(W);G=a.multMat(Y.V,a.transpose(Y.U));for(var X=0;X<h.size;X++){var U=[l[X],d[X]],B=[G[0][0],G[1][0]],k=[G[0][1],G[1][1]];l[X]=a.dotProduct(U,B),d[X]=a.dotProduct(U,k)}w&&v(e.relativePlacementConstraint)}}if(n.ENFORCE_CONSTRAINTS){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>0){var j={x:0,y:0};e.fixedNodeConstraint.forEach((function(t,e){var i,o,n={x:l[h.get(t.nodeId)],y:d[h.get(t.nodeId)]},r=t.position,a=(o=n,{x:(i=r).x-o.x,y:i.y-o.y});j.x+=a.x,j.y+=a.y})),j.x/=e.fixedNodeConstraint.length,j.y/=e.fixedNodeConstraint.length,l.forEach((function(t,e){l[e]+=j.x})),d.forEach((function(t,e){d[e]+=j.y})),e.fixedNodeConstraint.forEach((function(t){l[h.get(t.nodeId)]=t.position.x,d[h.get(t.nodeId)]=t.position.y}))}if(e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var Z=e.alignmentConstraint.vertical,q=function(t){var e=new Set;Z[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?l[h.get(i.values().next().value)]:u(e).x,e.forEach((function(t){A.has(t)||(l[h.get(t)]=n)}))},K=0;K<Z.length;K++)q(K);if(e.alignmentConstraint.horizontal)for(var Q=e.alignmentConstraint.horizontal,J=function(t){var e=new Set;Q[t].forEach((function(t){e.add(t)}));var i=new Set([].concat(o(e)).filter((function(t){return A.has(t)}))),n=void 0;n=i.size>0?d[h.get(i.values().next().value)]:u(e).y,e.forEach((function(t){A.has(t)||(d[h.get(t)]=n)}))},$=0;$<Q.length;$++)J($)}e.relativePlacementConstraint&&function(){var t=new Map,i=new Map,o=new Map,n=new Map,r=new Map,a=new Map,s=new Set,g=new Set;if(A.forEach((function(t){s.add(t),g.add(t)})),e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var c=e.alignmentConstraint.vertical,p=function(e){o.set("dummy"+e,[]),c[e].forEach((function(i){t.set(i,"dummy"+e),o.get("dummy"+e).push(i),A.has(i)&&s.add("dummy"+e)})),r.set("dummy"+e,l[h.get(c[e][0])])},f=0;f<c.length;f++)p(f);if(e.alignmentConstraint.horizontal)for(var u=e.alignmentConstraint.horizontal,v=function(t){n.set("dummy"+t,[]),u[t].forEach((function(e){i.set(e,"dummy"+t),n.get("dummy"+t).push(e),A.has(e)&&g.add("dummy"+t)})),a.set("dummy"+t,d[h.get(u[t][0])])},y=0;y<u.length;y++)v(y)}var C=new Map,M=new Map,w=function(e){I.get(e).forEach((function(o){var n=void 0,r=void 0;"horizontal"==o.direction?(n=t.get(e)?t.get(e):e,r=t.get(o.id)?{id:t.get(o.id),gap:o.gap,direction:o.direction}:o,C.has(n)?C.get(n).push(r):C.set(n,[r]),C.has(r.id)||C.set(r.id,[])):(n=i.get(e)?i.get(e):e,r=i.get(o.id)?{id:i.get(o.id),gap:o.gap,direction:o.direction}:o,M.has(n)?M.get(n).push(r):M.set(n,[r]),M.has(r.id)||M.set(r.id,[]))}))},L=!0,b=!1,_=void 0;try{for(var F,R=I.keys()[Symbol.iterator]();!(L=(F=R.next()).done);L=!0)w(F.value)}catch(t){b=!0,_=t}finally{try{!L&&R.return&&R.return()}finally{if(b)throw _}}var O=N(C),P=N(M),x=T(O),D=T(P),H=E(C),G=E(M),z=[],S=[];x.forEach((function(t,e){z[e]=[],t.forEach((function(t){0==H.get(t).length&&z[e].push(t)}))})),D.forEach((function(t,e){S[e]=[],t.forEach((function(t){0==G.get(t).length&&S[e].push(t)}))}));var V=m(C,"horizontal",s,r,z),W=m(M,"vertical",g,a,S),Y=function(t){o.get(t)?o.get(t).forEach((function(e){l[h.get(e)]=V.get(t)})):l[h.get(t)]=V.get(t)},X=!0,U=!1,B=void 0;try{for(var k,j=V.keys()[Symbol.iterator]();!(X=(k=j.next()).done);X=!0)Y(k.value)}catch(t){U=!0,B=t}finally{try{!X&&j.return&&j.return()}finally{if(U)throw B}}var Z=function(t){n.get(t)?n.get(t).forEach((function(e){d[h.get(e)]=W.get(t)})):d[h.get(t)]=W.get(t)},q=!0,K=!1,Q=void 0;try{for(var J,$=W.keys()[Symbol.iterator]();!(q=(J=$.next()).done);q=!0)Z(J.value)}catch(t){K=!0,Q=t}finally{try{!q&&$.return&&$.return()}finally{if(K)throw Q}}}()}for(var tt=0;tt<g.length;tt++){var et=g[tt];null==et.getChild()&&et.setCenter(l[h.get(et.id)],d[h.get(et.id)])}},t.exports=h},551:e=>{e.exports=t}},i={},o=function t(o){var n=i[o];if(void 0!==n)return n.exports;var r=i[o]={exports:{}};return e[o](r,r.exports,t),r.exports}(45),o;var e,i,o},t.exports=n(i())),e.exports;var t,n}e.exports;export{n as __require};
|