pmx-canvas 0.9.3 → 0.11.0

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.
Files changed (237) hide show
  1. package/.github/extensions/pmx-canvas/runtime.json +1 -1
  2. package/.github/extensions/pmx-canvas/tools.json +9418 -2016
  3. package/CHANGELOG.md +54 -1
  4. package/dist/canvas/chunks/abnfDiagram-N423BO3Z-p8dtp6va.js +1 -0
  5. package/dist/canvas/chunks/architecture-TIHT7OUA-9tffvpsv.js +1 -0
  6. package/dist/canvas/chunks/architectureDiagram-T3A2C74G-5jhmxrzf.js +36 -0
  7. package/dist/canvas/chunks/blockDiagram-VBNYF7ZC-pw1fa9yb.js +132 -0
  8. package/dist/canvas/chunks/c4Diagram-5PPSVZJV-x07nq0tt.js +10 -0
  9. package/dist/canvas/chunks/classDiagram-JCYQIIEL-nc6g5x1r.js +1 -0
  10. package/dist/canvas/chunks/classDiagram-v2-OCEON4UE-0qnbpwvh.js +1 -0
  11. package/dist/canvas/chunks/cose-bilkent-JH36ORCC-nm39npq0.js +1 -0
  12. package/dist/canvas/chunks/cynefin-VYW2F7L2-ys8p46ts.js +1 -0
  13. package/dist/canvas/chunks/cynefinDiagram-MW4NZA55-vdxrwahz.js +62 -0
  14. package/dist/canvas/chunks/dagre-VZM6K2ZE-bqdm7wpd.js +4 -0
  15. package/dist/canvas/chunks/diagram-7IWD3JNH-gs5gpr93.js +30 -0
  16. package/dist/canvas/chunks/diagram-B4RE2ZJO-cgwjg47s.js +3 -0
  17. package/dist/canvas/chunks/diagram-LBJQPF4R-w3vahpav.js +24 -0
  18. package/dist/canvas/chunks/diagram-Q27KOJAE-42837z6h.js +24 -0
  19. package/dist/canvas/chunks/diagram-UB23O5K3-4fz83q59.js +41 -0
  20. package/dist/canvas/chunks/ebnfDiagram-BXEA7PRR-zphtgegj.js +1 -0
  21. package/dist/canvas/chunks/erDiagram-JOGREHBK-zvbbdxp4.js +85 -0
  22. package/dist/canvas/chunks/eventmodeling-45OFAUF4-v9q6dn4c.js +1 -0
  23. package/dist/canvas/chunks/flowDiagram-UKHOOZJN-yrr5z8tc.js +1 -0
  24. package/dist/canvas/chunks/ganttDiagram-PKOTCBZU-282jzycm.js +292 -0
  25. package/dist/canvas/chunks/gitGraph-TEB2WS4Q-kdwb8m0a.js +1 -0
  26. package/dist/canvas/chunks/gitGraphDiagram-DS77QQ5N-vqqy6p1b.js +106 -0
  27. package/dist/canvas/chunks/index-0rk4gp1g.js +2 -0
  28. package/dist/canvas/chunks/index-194m3hc3.js +2 -0
  29. package/dist/canvas/chunks/index-1r72hdzb.js +301 -0
  30. package/dist/canvas/chunks/index-353m7b0p.js +2 -0
  31. package/dist/canvas/chunks/index-3cy1bzwh.js +2 -0
  32. package/dist/canvas/chunks/index-5tv8v1hk.js +1 -0
  33. package/dist/canvas/chunks/index-6ceya556.js +332 -0
  34. package/dist/canvas/chunks/index-6qmsnxwy.js +4 -0
  35. package/dist/canvas/chunks/index-d3b3gqe9.js +2 -0
  36. package/dist/canvas/chunks/index-fjtdggjn.js +2 -0
  37. package/dist/canvas/chunks/index-g3pwnqeb.js +2 -0
  38. package/dist/canvas/chunks/index-gf4e0et4.js +2 -0
  39. package/dist/canvas/chunks/index-hj99nz1f.js +1 -0
  40. package/dist/canvas/chunks/index-nprm96xp.js +16 -0
  41. package/dist/canvas/chunks/index-qj8fxwsf.js +2 -0
  42. package/dist/canvas/chunks/index-r2fyc9w1.js +89 -0
  43. package/dist/canvas/chunks/index-rft2hcz5.js +2 -0
  44. package/dist/canvas/chunks/index-rh7nv68n.js +2 -0
  45. package/dist/canvas/chunks/index-s4j678gj.js +2 -0
  46. package/dist/canvas/chunks/index-tb1wf525.js +179 -0
  47. package/dist/canvas/chunks/index-vv56h019.js +2 -0
  48. package/dist/canvas/chunks/index-w2mra17t.js +207 -0
  49. package/dist/canvas/chunks/index-wgv7en21.js +232 -0
  50. package/dist/canvas/chunks/index-yw8h9vha.js +157 -0
  51. package/dist/canvas/chunks/info-DKCQHKI2-wpzs6sz3.js +1 -0
  52. package/dist/canvas/chunks/infoDiagram-6WML65LV-v1yvggqj.js +2 -0
  53. package/dist/canvas/chunks/ishikawaDiagram-WSZJBQD7-5hnq1a9p.js +70 -0
  54. package/dist/canvas/chunks/journeyDiagram-NVQOT4AX-zjcffveh.js +139 -0
  55. package/dist/canvas/chunks/kanban-definition-27J2QSJJ-dakqtfp1.js +89 -0
  56. package/dist/canvas/chunks/katex-dmg8k4zm.js +257 -0
  57. package/dist/canvas/chunks/mermaid.core-j2geswrd.js +12 -0
  58. package/dist/canvas/chunks/mindmap-definition-FAOFIHXS-142xhr3k.js +96 -0
  59. package/dist/canvas/chunks/packet-7NZHBO7P-xn439f0s.js +1 -0
  60. package/dist/canvas/chunks/pegDiagram-VL7TDLO6-5wvk7vsd.js +1 -0
  61. package/dist/canvas/chunks/pie-RZYD4A2V-0kf16rwh.js +1 -0
  62. package/dist/canvas/chunks/pieDiagram-7S7Q4E2Y-ztdhwycc.js +39 -0
  63. package/dist/canvas/chunks/quadrantDiagram-CIZ2JOQS-c5p9gmg6.js +7 -0
  64. package/dist/canvas/chunks/radar-I7S5WNFK-0g2pz36t.js +1 -0
  65. package/dist/canvas/chunks/railroad-3IZDKUUU-fcaran6j.js +1 -0
  66. package/dist/canvas/chunks/railroad-abnf-AHOZXSZD-wgdya41q.js +1 -0
  67. package/dist/canvas/chunks/railroad-ebnf-EBAXGLYW-gy07a4ka.js +1 -0
  68. package/dist/canvas/chunks/railroad-peg-LSFZ7HO6-ewk6wtkh.js +1 -0
  69. package/dist/canvas/chunks/railroadDiagram-AXF67PYL-xkmqkjwf.js +1 -0
  70. package/dist/canvas/chunks/requirementDiagram-LRYGKXZP-9wm2dyaw.js +84 -0
  71. package/dist/canvas/chunks/sankeyDiagram-W5VNT64P-2w19etgb.js +40 -0
  72. package/dist/canvas/chunks/sequenceDiagram-SI44F4Z6-0jn0vwmz.js +162 -0
  73. package/dist/canvas/chunks/sizeCapture-X5ZJPWSS-x75epwdq.js +1 -0
  74. package/dist/canvas/chunks/stateDiagram-OKZ733FA-schjpy6d.js +1 -0
  75. package/dist/canvas/chunks/stateDiagram-v2-UEYNNEHI-k8sfp2e7.js +1 -0
  76. package/dist/canvas/chunks/swimlanes-SLNWSIFB-gkw4xce3.js +1 -0
  77. package/dist/canvas/chunks/swimlanesDiagram-ULZ7WXOC-nqysw67j.js +8 -0
  78. package/dist/canvas/chunks/timeline-definition-Z64GVDOM-x7nkcy01.js +120 -0
  79. package/dist/canvas/chunks/treeView-QDETBFTQ-cesw6gp0.js +1 -0
  80. package/dist/canvas/chunks/treemap-6X3UGDF4-zdv4knp9.js +1 -0
  81. package/dist/canvas/chunks/vennDiagram-T6HMQDX7-x8dqn9yf.js +34 -0
  82. package/dist/canvas/chunks/wardley-OPB4EBWU-44pdddez.js +1 -0
  83. package/dist/canvas/chunks/wardleyDiagram-T6FBY63Y-t1j52t9r.js +78 -0
  84. package/dist/canvas/chunks/xychartDiagram-ELKLHX3M-38t16pme.js +7 -0
  85. package/dist/canvas/global.css +389 -229
  86. package/dist/canvas/index.js +141 -211
  87. package/dist/canvas/mcp-app.html +4205 -554
  88. package/dist/canvas/mermaid-entry.js +338 -338
  89. package/dist/canvas/surface-theme.css +6 -6
  90. package/dist/json-render/index.css +1 -1
  91. package/dist/json-render/index.js +49 -49
  92. package/dist/types/client/canvas/BarHint.d.ts +5 -3
  93. package/dist/types/client/canvas/CanvasNode.d.ts +0 -11
  94. package/dist/types/client/canvas/EdgeLayer.d.ts +1 -2
  95. package/dist/types/client/canvas/auto-fit.d.ts +4 -5
  96. package/dist/types/client/mermaid-entry.d.ts +1 -2
  97. package/dist/types/client/mermaid-render.d.ts +1 -0
  98. package/dist/types/client/nodes/BoardNode.d.ts +1 -1
  99. package/dist/types/client/nodes/ExtAppFrame.d.ts +7 -90
  100. package/dist/types/client/nodes/McpAppNode.d.ts +1 -25
  101. package/dist/types/client/nodes/MermaidNode.d.ts +1 -8
  102. package/dist/types/client/nodes/ViewerFrame.d.ts +29 -0
  103. package/dist/types/client/nodes/ViewerHost.d.ts +6 -0
  104. package/dist/types/client/nodes/iframe-document-url.d.ts +3 -9
  105. package/dist/types/client/nodes/primitive-copy.d.ts +5 -0
  106. package/dist/types/client/nodes/use-iframe-content-height.d.ts +1 -1
  107. package/dist/types/client/nodes/use-surface-frame.d.ts +4 -6
  108. package/dist/types/client/nodes/viewer-runtime-state.d.ts +2 -1
  109. package/dist/types/client/state/canvas-store.d.ts +3 -1
  110. package/dist/types/client/state/intent-bridge.d.ts +1 -0
  111. package/dist/types/client/state/presentation.d.ts +17 -6
  112. package/dist/types/json-render/server.d.ts +2 -1
  113. package/dist/types/mcp/canvas-access.d.ts +1 -12
  114. package/dist/types/mcp/resource-subscriptions.d.ts +7 -0
  115. package/dist/types/mcp/server.d.ts +2 -0
  116. package/dist/types/server/ax-wait.d.ts +1 -0
  117. package/dist/types/server/canvas-operations.d.ts +1 -0
  118. package/dist/types/server/canvas-state.d.ts +2 -0
  119. package/dist/types/server/index.d.ts +11 -6
  120. package/dist/types/server/operations/http.d.ts +10 -0
  121. package/dist/types/server/operations/index.d.ts +2 -2
  122. package/dist/types/server/operations/invoker.d.ts +4 -3
  123. package/dist/types/server/operations/mcp-contracts.d.ts +20 -0
  124. package/dist/types/server/operations/mcp.d.ts +2 -0
  125. package/dist/types/server/operations/ops/batch.d.ts +1 -0
  126. package/dist/types/server/operations/ops/boards.d.ts +0 -1
  127. package/dist/types/server/operations/registry.d.ts +2 -2
  128. package/dist/types/server/operations/types.d.ts +12 -2
  129. package/dist/types/server/server.d.ts +2 -0
  130. package/dist/types/server/tour-control.d.ts +13 -3
  131. package/dist/types/server/webpage-node.d.ts +1 -0
  132. package/dist/types/shared/ax-surface-protocol.d.ts +0 -9
  133. package/dist/types/shared/tour.d.ts +8 -0
  134. package/docs/api-reference.md +2 -2
  135. package/docs/cli.md +1 -1
  136. package/docs/design/Chrome.dc.html +32 -6
  137. package/docs/design/Types1.dc.html +3 -2
  138. package/docs/design/Types2.dc.html +1 -1
  139. package/docs/design/Types3.dc.html +1 -1
  140. package/docs/design/Zoom.dc.html +37 -60
  141. package/docs/design/canvas.json +1 -1
  142. package/docs/design.md +169 -4
  143. package/docs/http-api.md +82 -1
  144. package/docs/mcp.md +101 -21
  145. package/docs/node-types.md +38 -3
  146. package/docs/plans/plan-009-tech-debt-backlog.md +2 -2
  147. package/docs/plans/plan-019-post-0.9-roadmap.md +402 -13
  148. package/docs/product-vision-2026-09.md +9 -0
  149. package/docs/sdk.md +5 -2
  150. package/package.json +2 -2
  151. package/plugins/pmx-canvas/com.github.copilot/extensions/pmx-canvas/runtime.json +1 -1
  152. package/plugins/pmx-canvas/plugin.json +1 -1
  153. package/plugins/pmx-canvas/runtime.json +1 -1
  154. package/plugins/pmx-canvas/tools.json +9418 -2016
  155. package/skills/pmx-canvas/SKILL.md +19 -21
  156. package/skills/pmx-canvas/references/full-reference.md +44 -6
  157. package/skills/pmx-canvas/references/installing-pmx-canvas.md +7 -7
  158. package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +3 -5
  159. package/src/client/canvas/BarHint.tsx +6 -3
  160. package/src/client/canvas/CanvasNode.tsx +34 -47
  161. package/src/client/canvas/CanvasViewport.tsx +6 -7
  162. package/src/client/canvas/ContextMenu.tsx +63 -3
  163. package/src/client/canvas/EdgeLayer.tsx +365 -169
  164. package/src/client/canvas/ExpandedNodeOverlay.tsx +1 -2
  165. package/src/client/canvas/Presentation.tsx +53 -3
  166. package/src/client/canvas/ToolRail.tsx +2 -0
  167. package/src/client/canvas/TopBar.tsx +24 -9
  168. package/src/client/canvas/auto-fit.ts +9 -11
  169. package/src/client/canvas/canvas-area.ts +1 -1
  170. package/src/client/canvas/use-focus-trap.ts +6 -1
  171. package/src/client/mermaid-entry.ts +6 -20
  172. package/src/client/mermaid-render.ts +39 -0
  173. package/src/client/nodes/AxStepControls.tsx +45 -69
  174. package/src/client/nodes/BoardNode.tsx +65 -9
  175. package/src/client/nodes/ContextNode.tsx +88 -396
  176. package/src/client/nodes/ExtAppFrame.tsx +283 -1462
  177. package/src/client/nodes/FileNode.tsx +92 -81
  178. package/src/client/nodes/HtmlNode.tsx +8 -36
  179. package/src/client/nodes/LedgerNode.tsx +31 -17
  180. package/src/client/nodes/MarkdownNode.tsx +8 -17
  181. package/src/client/nodes/McpAppNode.tsx +48 -154
  182. package/src/client/nodes/MermaidNode.tsx +80 -69
  183. package/src/client/nodes/PromptNode.tsx +12 -14
  184. package/src/client/nodes/ResponseNode.tsx +8 -6
  185. package/src/client/nodes/StatusNode.tsx +22 -7
  186. package/src/client/nodes/StatusSummary.tsx +5 -3
  187. package/src/client/nodes/TraceNode.tsx +8 -8
  188. package/src/client/nodes/ViewerFrame.tsx +262 -0
  189. package/src/client/nodes/ViewerHost.tsx +41 -0
  190. package/src/client/nodes/WebpageNode.tsx +22 -24
  191. package/src/client/nodes/iframe-document-url.ts +20 -27
  192. package/src/client/nodes/primitive-copy.ts +97 -0
  193. package/src/client/nodes/use-iframe-content-height.ts +34 -10
  194. package/src/client/nodes/use-surface-frame.ts +22 -11
  195. package/src/client/nodes/viewer-runtime-state.ts +41 -35
  196. package/src/client/state/canvas-store.ts +18 -12
  197. package/src/client/state/intent-bridge.ts +1 -0
  198. package/src/client/state/presentation.ts +135 -15
  199. package/src/client/state/sse-bridge.ts +18 -19
  200. package/src/client/theme/global.css +389 -229
  201. package/src/client/theme/surface-theme.css +6 -6
  202. package/src/json-render/charts/tufte-components.tsx +44 -2
  203. package/src/json-render/renderer/index.css +62 -2
  204. package/src/json-render/renderer/index.tsx +31 -7
  205. package/src/json-render/server.ts +3 -2
  206. package/src/mcp/canvas-access.ts +6 -47
  207. package/src/mcp/resource-subscriptions.ts +181 -0
  208. package/src/mcp/server.ts +185 -219
  209. package/src/server/ax-wait.ts +21 -6
  210. package/src/server/board-export.ts +35 -24
  211. package/src/server/canvas-geometry.ts +1 -0
  212. package/src/server/canvas-operations.ts +6 -2
  213. package/src/server/canvas-state.ts +5 -0
  214. package/src/server/demo-state.json +106 -100
  215. package/src/server/html-primitives.ts +3 -9
  216. package/src/server/html-surface.ts +8 -0
  217. package/src/server/index.ts +30 -12
  218. package/src/server/operations/http.ts +69 -21
  219. package/src/server/operations/index.ts +8 -1
  220. package/src/server/operations/invoker.ts +53 -5
  221. package/src/server/operations/mcp-contracts.ts +354 -0
  222. package/src/server/operations/mcp.ts +153 -18
  223. package/src/server/operations/ops/ax-await.ts +18 -10
  224. package/src/server/operations/ops/ax-read.ts +2 -0
  225. package/src/server/operations/ops/ax-timeline.ts +2 -2
  226. package/src/server/operations/ops/batch.ts +27 -8
  227. package/src/server/operations/ops/boards.ts +1 -3
  228. package/src/server/operations/ops/nodes.ts +18 -3
  229. package/src/server/operations/ops/viewport.ts +11 -9
  230. package/src/server/operations/registry.ts +24 -4
  231. package/src/server/operations/types.ts +16 -2
  232. package/src/server/server.ts +17 -59
  233. package/src/server/tour-control.ts +66 -6
  234. package/src/server/webpage-node.ts +9 -4
  235. package/src/shared/ax-surface-protocol.ts +0 -11
  236. package/src/shared/content-height-reporter.ts +4 -3
  237. package/src/shared/tour.ts +8 -0
@@ -0,0 +1 @@
1
+ import{e,t,n}from"./index-1r72hdzb.js";import{Re}from"./index-6ceya556.js";import{K,se}from"./index-6qmsnxwy.js";var z=se(function(Z,q){(function(w,L){if(typeof Z==="object"&&typeof q==="object")q.exports=L();else if(typeof define==="function"&&define.amd)define([],L);else if(typeof Z==="object")Z.layoutBase=L();else w.layoutBase=L()})(Z,function(){return function(m){var w={};function L(a){if(w[a])return w[a].exports;var i=w[a]={i:a,l:!1,exports:{}};return m[a].call(i.exports,i,i.exports,L),i.l=!0,i.exports}return L.m=m,L.c=w,L.i=function(a){return a},L.d=function(a,i,r){if(!L.o(a,i))Object.defineProperty(a,i,{configurable:!1,enumerable:!0,get:r})},L.n=function(a){var i=a&&a.__esModule?function(){return a.default}:function(){return a};return L.d(i,"a",i),i},L.o=function(a,i){return Object.prototype.hasOwnProperty.call(a,i)},L.p="",L(L.s=26)}([function(m,w,L){function a(){}a.QUALITY=1,a.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,a.DEFAULT_INCREMENTAL=!1,a.DEFAULT_ANIMATION_ON_LAYOUT=!0,a.DEFAULT_ANIMATION_DURING_LAYOUT=!1,a.DEFAULT_ANIMATION_PERIOD=50,a.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,a.DEFAULT_GRAPH_MARGIN=15,a.NODE_DIMENSIONS_INCLUDE_LABELS=!1,a.SIMPLE_NODE_SIZE=40,a.SIMPLE_NODE_HALF_SIZE=a.SIMPLE_NODE_SIZE/2,a.EMPTY_COMPOUND_NODE_SIZE=40,a.MIN_EDGE_LENGTH=1,a.WORLD_BOUNDARY=1e6,a.INITIAL_WORLD_BOUNDARY=a.WORLD_BOUNDARY/1000,a.WORLD_CENTER_X=1200,a.WORLD_CENTER_Y=900,m.exports=a},function(m,w,L){var a=L(2),i=L(8),r=L(9);function s(c,h,y){a.call(this,y),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=y,this.bendpoints=[],this.source=c,this.target=h}s.prototype=Object.create(a.prototype);for(var u in a)s[u]=a[u];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;else if(this.target===c)return this.source;else throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(c,h){var y=this.getOtherEnd(c),o=h.getGraphManager().getRoot();while(!0){if(y.getOwner()==h)return y;if(y.getOwner()==o)break;y=y.getOwner().getParent()}return null},s.prototype.updateLength=function(){var c=[,,,,];if(this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),c),!this.isOverlapingSourceAndTarget){if(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[3],Math.abs(this.lengthX)<1)this.lengthX=r.sign(this.lengthX);if(Math.abs(this.lengthY)<1)this.lengthY=r.sign(this.lengthY);this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)}},s.prototype.updateLengthSimple=function(){if(this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1)this.lengthX=r.sign(this.lengthX);if(Math.abs(this.lengthY)<1)this.lengthY=r.sign(this.lengthY);this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},m.exports=s},function(m,w,L){function a(i){this.vGraphObject=i}m.exports=a},function(m,w,L){var a=L(2),i=L(10),r=L(13),s=L(0),u=L(16),c=L(4);function h(o,g,f,E){if(f==null&&E==null)E=g;if(a.call(this,E),o.graphManager!=null)o=o.graphManager;if(this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=E,this.edges=[],this.graphManager=o,f!=null&&g!=null)this.rect=new r(g.x,g.y,f.width,f.height);else this.rect=new r}h.prototype=Object.create(a.prototype);for(var y in a)h[y]=a[y];h.prototype.getEdges=function(){return this.edges},h.prototype.getChild=function(){return this.child},h.prototype.getOwner=function(){return this.owner},h.prototype.getWidth=function(){return this.rect.width},h.prototype.setWidth=function(o){this.rect.width=o},h.prototype.getHeight=function(){return this.rect.height},h.prototype.setHeight=function(o){this.rect.height=o},h.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},h.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},h.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},h.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},h.prototype.getRect=function(){return this.rect},h.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},h.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},h.prototype.setRect=function(o,g){this.rect.x=o.x,this.rect.y=o.y,this.rect.width=g.width,this.rect.height=g.height},h.prototype.setCenter=function(o,g){this.rect.x=o-this.rect.width/2,this.rect.y=g-this.rect.height/2},h.prototype.setLocation=function(o,g){this.rect.x=o,this.rect.y=g},h.prototype.moveBy=function(o,g){this.rect.x+=o,this.rect.y+=g},h.prototype.getEdgeListToNode=function(o){var g=[],f,E=this;return E.edges.forEach(function(T){if(T.target==o){if(T.source!=E)throw"Incorrect edge source!";g.push(T)}}),g},h.prototype.getEdgesBetween=function(o){var g=[],f,E=this;return E.edges.forEach(function(T){if(!(T.source==E||T.target==E))throw"Incorrect edge source and/or target";if(T.target==o||T.source==o)g.push(T)}),g},h.prototype.getNeighborsList=function(){var o=new Set,g=this;return g.edges.forEach(function(f){if(f.source==g)o.add(f.target);else{if(f.target!=g)throw"Incorrect incidency!";o.add(f.source)}}),o},h.prototype.withChildren=function(){var o=new Set,g,f;if(o.add(this),this.child!=null){var E=this.child.getNodes();for(var T=0;T<E.length;T++)g=E[T],f=g.withChildren(),f.forEach(function(N){o.add(N)})}return o},h.prototype.getNoOfChildren=function(){var o=0,g;if(this.child==null)o=1;else{var f=this.child.getNodes();for(var E=0;E<f.length;E++)g=f[E],o+=g.getNoOfChildren()}if(o==0)o=1;return o},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){if(this.child==null)return this.estimatedSize=(this.rect.width+this.rect.height)/2;else return this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize},h.prototype.scatter=function(){var o,g,f=-s.INITIAL_WORLD_BOUNDARY,E=s.INITIAL_WORLD_BOUNDARY;o=s.WORLD_CENTER_X+u.nextDouble()*(E-f)+f;var T=-s.INITIAL_WORLD_BOUNDARY,N=s.INITIAL_WORLD_BOUNDARY;g=s.WORLD_CENTER_Y+u.nextDouble()*(N-T)+T,this.rect.x=o,this.rect.y=g},h.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var o=this.getChild();if(o.updateBounds(!0),this.rect.x=o.getLeft(),this.rect.y=o.getTop(),this.setWidth(o.getRight()-o.getLeft()),this.setHeight(o.getBottom()-o.getTop()),s.NODE_DIMENSIONS_INCLUDE_LABELS){var g=o.getRight()-o.getLeft(),f=o.getBottom()-o.getTop();if(this.labelWidth>g)this.rect.x-=(this.labelWidth-g)/2,this.setWidth(this.labelWidth);if(this.labelHeight>f){if(this.labelPos=="center")this.rect.y-=(this.labelHeight-f)/2;else if(this.labelPos=="top")this.rect.y-=this.labelHeight-f;this.setHeight(this.labelHeight)}}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(o){var g=this.rect.x;if(g>s.WORLD_BOUNDARY)g=s.WORLD_BOUNDARY;else if(g<-s.WORLD_BOUNDARY)g=-s.WORLD_BOUNDARY;var f=this.rect.y;if(f>s.WORLD_BOUNDARY)f=s.WORLD_BOUNDARY;else if(f<-s.WORLD_BOUNDARY)f=-s.WORLD_BOUNDARY;var E=new c(g,f),T=o.inverseTransformPoint(E);this.setLocation(T.x,T.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){if(this.owner==null)return null;return this.owner.getParent()},m.exports=h},function(m,w,L){function a(i,r){if(i==null&&r==null)this.x=0,this.y=0;else this.x=i,this.y=r}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.setX=function(i){this.x=i},a.prototype.setY=function(i){this.y=i},a.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},a.prototype.getCopy=function(){return new a(this.x,this.y)},a.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},m.exports=a},function(m,w,L){var a=L(2),i=L(10),r=L(0),s=L(6),u=L(3),c=L(1),h=L(13),y=L(12),o=L(11);function g(E,T,N){if(a.call(this,N),this.estimatedSize=i.MIN_VALUE,this.margin=r.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=E,T!=null&&T instanceof s)this.graphManager=T;else if(T!=null&&T instanceof Layout)this.graphManager=T.graphManager}g.prototype=Object.create(a.prototype);for(var f in a)g[f]=a[f];g.prototype.getNodes=function(){return this.nodes},g.prototype.getEdges=function(){return this.edges},g.prototype.getGraphManager=function(){return this.graphManager},g.prototype.getParent=function(){return this.parent},g.prototype.getLeft=function(){return this.left},g.prototype.getRight=function(){return this.right},g.prototype.getTop=function(){return this.top},g.prototype.getBottom=function(){return this.bottom},g.prototype.isConnected=function(){return this.isConnected},g.prototype.add=function(E,T,N){if(T==null&&N==null){var v=E;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(v)>-1)throw"Node already in graph!";return v.owner=this,this.getNodes().push(v),v}else{var O=E;if(!(this.getNodes().indexOf(T)>-1&&this.getNodes().indexOf(N)>-1))throw"Source or target not in graph!";if(!(T.owner==N.owner&&T.owner==this))throw"Both owners must be this graph!";if(T.owner!=N.owner)return null;if(O.source=T,O.target=N,O.isInterGraph=!1,this.getEdges().push(O),T.edges.push(O),N!=T)N.edges.push(O);return O}},g.prototype.remove=function(E){var T=E;if(E instanceof u){if(T==null)throw"Node is null!";if(!(T.owner!=null&&T.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";var N=T.edges.slice(),v,O=N.length;for(var D=0;D<O;D++)if(v=N[D],v.isInterGraph)this.graphManager.remove(v);else v.source.owner.remove(v);var R=this.nodes.indexOf(T);if(R==-1)throw"Node not in owner node list!";this.nodes.splice(R,1)}else if(E instanceof c){var v=E;if(v==null)throw"Edge is null!";if(!(v.source!=null&&v.target!=null))throw"Source and/or target is null!";if(!(v.source.owner!=null&&v.target.owner!=null&&v.source.owner==this&&v.target.owner==this))throw"Source and/or target owner is invalid!";var l=v.source.edges.indexOf(v),p=v.target.edges.indexOf(v);if(!(l>-1&&p>-1))throw"Source and/or target doesn't know this edge!";if(v.source.edges.splice(l,1),v.target!=v.source)v.target.edges.splice(p,1);var R=v.source.owner.getEdges().indexOf(v);if(R==-1)throw"Not in owner's edge list!";v.source.owner.getEdges().splice(R,1)}},g.prototype.updateLeftTop=function(){var{MAX_VALUE:E,MAX_VALUE:T}=i,N,v,O,D=this.getNodes(),R=D.length;for(var l=0;l<R;l++){var p=D[l];if(N=p.getTop(),v=p.getLeft(),E>N)E=N;if(T>v)T=v}if(E==i.MAX_VALUE)return null;if(D[0].getParent().paddingLeft!=null)O=D[0].getParent().paddingLeft;else O=this.margin;return this.left=T-O,this.top=E-O,new y(this.left,this.top)},g.prototype.updateBounds=function(E){var T=i.MAX_VALUE,N=-i.MAX_VALUE,v=i.MAX_VALUE,O=-i.MAX_VALUE,D,R,l,p,d,A=this.nodes,I=A.length;for(var C=0;C<I;C++){var M=A[C];if(E&&M.child!=null)M.updateBounds();if(D=M.getLeft(),R=M.getRight(),l=M.getTop(),p=M.getBottom(),T>D)T=D;if(N<R)N=R;if(v>l)v=l;if(O<p)O=p}var G=new h(T,v,N-T,O-v);if(T==i.MAX_VALUE)this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom();if(A[0].getParent().paddingLeft!=null)d=A[0].getParent().paddingLeft;else d=this.margin;this.left=G.x-d,this.right=G.x+G.width+d,this.top=G.y-d,this.bottom=G.y+G.height+d},g.calculateBounds=function(E){var T=i.MAX_VALUE,N=-i.MAX_VALUE,v=i.MAX_VALUE,O=-i.MAX_VALUE,D,R,l,p,d=E.length;for(var A=0;A<d;A++){var I=E[A];if(D=I.getLeft(),R=I.getRight(),l=I.getTop(),p=I.getBottom(),T>D)T=D;if(N<R)N=R;if(v>l)v=l;if(O<p)O=p}var C=new h(T,v,N-T,O-v);return C},g.prototype.getInclusionTreeDepth=function(){if(this==this.graphManager.getRoot())return 1;else return this.parent.getInclusionTreeDepth()},g.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},g.prototype.calcEstimatedSize=function(){var E=0,T=this.nodes,N=T.length;for(var v=0;v<N;v++){var O=T[v];E+=O.calcEstimatedSize()}if(E==0)this.estimatedSize=r.EMPTY_COMPOUND_NODE_SIZE;else this.estimatedSize=E/Math.sqrt(this.nodes.length);return this.estimatedSize},g.prototype.updateConnected=function(){var E=this;if(this.nodes.length==0){this.isConnected=!0;return}var T=new o,N=new Set,v=this.nodes[0],O,D,R=v.withChildren();R.forEach(function(C){T.push(C),N.add(C)});while(T.length!==0){v=T.shift(),O=v.getEdges();var l=O.length;for(var p=0;p<l;p++){var d=O[p];if(D=d.getOtherEndInGraph(v,this),D!=null&&!N.has(D)){var A=D.withChildren();A.forEach(function(C){T.push(C),N.add(C)})}}}if(this.isConnected=!1,N.size>=this.nodes.length){var I=0;if(N.forEach(function(C){if(C.owner==E)I++}),I==this.nodes.length)this.isConnected=!0}},m.exports=g},function(m,w,L){var a,i=L(1);function r(s){a=L(5),this.layout=s,this.graphs=[],this.edges=[]}r.prototype.addRoot=function(){var s=this.layout.newGraph(),u=this.layout.newNode(null),c=this.add(s,u);return this.setRootGraph(c),this.rootGraph},r.prototype.add=function(s,u,c,h,y){if(c==null&&h==null&&y==null){if(s==null)throw"Graph is null!";if(u==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(u.child!=null)throw"Already has a child!";return s.parent=u,u.child=s,s}else{y=c,h=u,c=s;var o=h.getOwner(),g=y.getOwner();if(!(o!=null&&o.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(g!=null&&g.getGraphManager()==this))throw"Target not in this graph mgr!";if(o==g)return c.isInterGraph=!1,o.add(c,h,y);else{if(c.isInterGraph=!0,c.source=h,c.target=y,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}}},r.prototype.remove=function(s){if(s instanceof a){var u=s;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(u.getEdges());var h,y=c.length;for(var o=0;o<y;o++)h=c[o],u.remove(h);var g=[];g=g.concat(u.getNodes());var f;y=g.length;for(var o=0;o<y;o++)f=g[o],u.remove(f);if(u==this.rootGraph)this.setRootGraph(null);var E=this.graphs.indexOf(u);this.graphs.splice(E,1),u.parent=null}else if(s instanceof i){if(h=s,h==null)throw"Edge is null!";if(!h.isInterGraph)throw"Not an inter-graph edge!";if(!(h.source!=null&&h.target!=null))throw"Source and/or target is null!";if(!(h.source.edges.indexOf(h)!=-1&&h.target.edges.indexOf(h)!=-1))throw"Source and/or target doesn't know this edge!";var E=h.source.edges.indexOf(h);if(h.source.edges.splice(E,1),E=h.target.edges.indexOf(h),h.target.edges.splice(E,1),!(h.source.owner!=null&&h.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(h.source.owner.getGraphManager().edges.indexOf(h)==-1)throw"Not in owner graph manager's edge list!";var E=h.source.owner.getGraphManager().edges.indexOf(h);h.source.owner.getGraphManager().edges.splice(E,1)}},r.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},r.prototype.getGraphs=function(){return this.graphs},r.prototype.getAllNodes=function(){if(this.allNodes==null){var s=[],u=this.getGraphs(),c=u.length;for(var h=0;h<c;h++)s=s.concat(u[h].getNodes());this.allNodes=s}return this.allNodes},r.prototype.resetAllNodes=function(){this.allNodes=null},r.prototype.resetAllEdges=function(){this.allEdges=null},r.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},r.prototype.getAllEdges=function(){if(this.allEdges==null){var s=[],u=this.getGraphs(),c=u.length;for(var h=0;h<u.length;h++)s=s.concat(u[h].getEdges());s=s.concat(this.edges),this.allEdges=s}return this.allEdges},r.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},r.prototype.setAllNodesToApplyGravitation=function(s){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=s},r.prototype.getRoot=function(){return this.rootGraph},r.prototype.setRootGraph=function(s){if(s.getGraphManager()!=this)throw"Root not in this graph mgr!";if(this.rootGraph=s,s.parent==null)s.parent=this.layout.newNode("Root node")},r.prototype.getLayout=function(){return this.layout},r.prototype.isOneAncestorOfOther=function(s,u){if(!(s!=null&&u!=null))throw"assert failed";if(s==u)return!0;var c=s.getOwner(),h;do{if(h=c.getParent(),h==null)break;if(h==u)return!0;if(c=h.getOwner(),c==null)break}while(!0);c=u.getOwner();do{if(h=c.getParent(),h==null)break;if(h==s)return!0;if(c=h.getOwner(),c==null)break}while(!0);return!1},r.prototype.calcLowestCommonAncestors=function(){var s,u,c,h,y,o=this.getAllEdges(),g=o.length;for(var f=0;f<g;f++){if(s=o[f],u=s.source,c=s.target,s.lca=null,s.sourceInLca=u,s.targetInLca=c,u==c){s.lca=u.getOwner();continue}h=u.getOwner();while(s.lca==null){s.targetInLca=c,y=c.getOwner();while(s.lca==null){if(y==h){s.lca=y;break}if(y==this.rootGraph)break;if(s.lca!=null)throw"assert failed";s.targetInLca=y.getParent(),y=s.targetInLca.getOwner()}if(h==this.rootGraph)break;if(s.lca==null)s.sourceInLca=h.getParent(),h=s.sourceInLca.getOwner()}if(s.lca==null)throw"assert failed"}},r.prototype.calcLowestCommonAncestor=function(s,u){if(s==u)return s.getOwner();var c=s.getOwner();do{if(c==null)break;var h=u.getOwner();do{if(h==null)break;if(h==c)return h;h=h.getParent().getOwner()}while(!0);c=c.getParent().getOwner()}while(!0);return c},r.prototype.calcInclusionTreeDepths=function(s,u){if(s==null&&u==null)s=this.rootGraph,u=1;var c,h=s.getNodes(),y=h.length;for(var o=0;o<y;o++)if(c=h[o],c.inclusionTreeDepth=u,c.child!=null)this.calcInclusionTreeDepths(c.child,u+1)},r.prototype.includesInvalidEdge=function(){var s,u=this.edges.length;for(var c=0;c<u;c++)if(s=this.edges[c],this.isOneAncestorOfOther(s.source,s.target))return!0;return!1},m.exports=r},function(m,w,L){var a=L(0);function i(){}for(var r in a)i[r]=a[r];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=0.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=0.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=0.3,i.COOLING_ADAPTATION_FACTOR=0.33,i.ADAPTATION_LOWER_NODE_LIMIT=1000,i.ADAPTATION_UPPER_NODE_LIMIT=5000,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=i.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=0.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,m.exports=i},function(m,w,L){var a=L(12);function i(){}i.calcSeparationAmount=function(r,s,u,c){if(!r.intersects(s))throw"assert failed";var h=[,,];if(this.decideDirectionsForOverlappingNodes(r,s,h),u[0]=Math.min(r.getRight(),s.getRight())-Math.max(r.x,s.x),u[1]=Math.min(r.getBottom(),s.getBottom())-Math.max(r.y,s.y),r.getX()<=s.getX()&&r.getRight()>=s.getRight())u[0]+=Math.min(s.getX()-r.getX(),r.getRight()-s.getRight());else if(s.getX()<=r.getX()&&s.getRight()>=r.getRight())u[0]+=Math.min(r.getX()-s.getX(),s.getRight()-r.getRight());if(r.getY()<=s.getY()&&r.getBottom()>=s.getBottom())u[1]+=Math.min(s.getY()-r.getY(),r.getBottom()-s.getBottom());else if(s.getY()<=r.getY()&&s.getBottom()>=r.getBottom())u[1]+=Math.min(r.getY()-s.getY(),s.getBottom()-r.getBottom());var y=Math.abs((s.getCenterY()-r.getCenterY())/(s.getCenterX()-r.getCenterX()));if(s.getCenterY()===r.getCenterY()&&s.getCenterX()===r.getCenterX())y=1;var o=y*u[0],g=u[1]/y;if(u[0]<g)g=u[0];else o=u[1];u[0]=-1*h[0]*(g/2+c),u[1]=-1*h[1]*(o/2+c)},i.decideDirectionsForOverlappingNodes=function(r,s,u){if(r.getCenterX()<s.getCenterX())u[0]=-1;else u[0]=1;if(r.getCenterY()<s.getCenterY())u[1]=-1;else u[1]=1},i.getIntersection2=function(r,s,u){var c=r.getCenterX(),h=r.getCenterY(),y=s.getCenterX(),o=s.getCenterY();if(r.intersects(s))return u[0]=c,u[1]=h,u[2]=y,u[3]=o,!0;var g=r.getX(),f=r.getY(),E=r.getRight(),T=r.getX(),N=r.getBottom(),v=r.getRight(),O=r.getWidthHalf(),D=r.getHeightHalf(),R=s.getX(),l=s.getY(),p=s.getRight(),d=s.getX(),A=s.getBottom(),I=s.getRight(),C=s.getWidthHalf(),M=s.getHeightHalf(),G=!1,F=!1;if(c===y){if(h>o)return u[0]=c,u[1]=f,u[2]=y,u[3]=A,!1;else if(h<o)return u[0]=c,u[1]=N,u[2]=y,u[3]=l,!1}else if(h===o){if(c>y)return u[0]=g,u[1]=h,u[2]=p,u[3]=o,!1;else if(c<y)return u[0]=E,u[1]=h,u[2]=R,u[3]=o,!1}else{var P=r.height/r.width,b=s.height/s.width,U=(o-h)/(y-c),x=void 0,S=void 0,Y=void 0,X=void 0,H=void 0,_=void 0;if(-P===U)if(c>y)u[0]=T,u[1]=N,G=!0;else u[0]=E,u[1]=f,G=!0;else if(P===U)if(c>y)u[0]=g,u[1]=f,G=!0;else u[0]=v,u[1]=N,G=!0;if(-b===U)if(y>c)u[2]=d,u[3]=A,F=!0;else u[2]=p,u[3]=l,F=!0;else if(b===U)if(y>c)u[2]=R,u[3]=l,F=!0;else u[2]=I,u[3]=A,F=!0;if(G&&F)return!1;if(c>y)if(h>o)x=this.getCardinalDirection(P,U,4),S=this.getCardinalDirection(b,U,2);else x=this.getCardinalDirection(-P,U,3),S=this.getCardinalDirection(-b,U,1);else if(h>o)x=this.getCardinalDirection(-P,U,1),S=this.getCardinalDirection(-b,U,3);else x=this.getCardinalDirection(P,U,2),S=this.getCardinalDirection(b,U,4);if(!G)switch(x){case 1:X=f,Y=c+-D/U,u[0]=Y,u[1]=X;break;case 2:Y=v,X=h+O*U,u[0]=Y,u[1]=X;break;case 3:X=N,Y=c+D/U,u[0]=Y,u[1]=X;break;case 4:Y=T,X=h+-O*U,u[0]=Y,u[1]=X;break}if(!F)switch(S){case 1:_=l,H=y+-M/U,u[2]=H,u[3]=_;break;case 2:H=I,_=o+C*U,u[2]=H,u[3]=_;break;case 3:_=A,H=y+M/U,u[2]=H,u[3]=_;break;case 4:H=d,_=o+-C*U,u[2]=H,u[3]=_;break}}return!1},i.getCardinalDirection=function(r,s,u){if(r>s)return u;else return 1+u%4},i.getIntersection=function(r,s,u,c){if(c==null)return this.getIntersection2(r,s,u);var{x:h,y}=r,{x:o,y:g}=s,{x:f,y:E}=u,{x:T,y:N}=c,v=void 0,O=void 0,D=void 0,R=void 0,l=void 0,p=void 0,d=void 0,A=void 0,I=void 0;if(D=g-y,l=h-o,d=o*y-h*g,R=N-E,p=f-T,A=T*E-f*N,I=D*p-R*l,I===0)return null;return v=(l*A-p*d)/I,O=(R*d-D*A)/I,new a(v,O)},i.angleOfVector=function(r,s,u,c){var h=void 0;if(r!==u){if(h=Math.atan((c-s)/(u-r)),u<r)h+=Math.PI;else if(c<s)h+=this.TWO_PI}else if(c<s)h=this.ONE_AND_HALF_PI;else h=this.HALF_PI;return h},i.doIntersect=function(r,s,u,c){var{x:h,y}=r,{x:o,y:g}=s,{x:f,y:E}=u,{x:T,y:N}=c,v=(o-h)*(N-E)-(T-f)*(g-y);if(v===0)return!1;else{var O=((N-E)*(T-h)+(f-T)*(N-y))/v,D=((y-g)*(T-h)+(o-h)*(N-y))/v;return 0<O&&O<1&&0<D&&D<1}},i.HALF_PI=0.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,m.exports=i},function(m,w,L){function a(){}a.sign=function(i){if(i>0)return 1;else if(i<0)return-1;else return 0},a.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},a.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},m.exports=a},function(m,w,L){function a(){}a.MAX_VALUE=2147483647,a.MIN_VALUE=-2147483648,m.exports=a},function(m,w,L){var a=function(){function h(y,o){for(var g=0;g<o.length;g++){var f=o[g];if(f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f)f.writable=!0;Object.defineProperty(y,f.key,f)}}return function(y,o,g){if(o)h(y.prototype,o);if(g)h(y,g);return y}}();function i(h,y){if(!(h instanceof y))throw TypeError("Cannot call a class as a function")}var r=function(y){return{value:y,next:null,prev:null}},s=function(y,o,g,f){if(y!==null)y.next=o;else f.head=o;if(g!==null)g.prev=o;else f.tail=o;return o.prev=y,o.next=g,f.length++,o},u=function(y,o){var{prev:g,next:f}=y;if(g!==null)g.next=f;else o.head=f;if(f!==null)f.prev=g;else o.tail=g;return y.prev=y.next=null,o.length--,y},c=function(){function h(y){var o=this;if(i(this,h),this.length=0,this.head=null,this.tail=null,y!=null)y.forEach(function(g){return o.push(g)})}return a(h,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(o,g){return s(g.prev,r(o),g,this)}},{key:"insertAfter",value:function(o,g){return s(g,r(o),g.next,this)}},{key:"insertNodeBefore",value:function(o,g){return s(g.prev,o,g,this)}},{key:"insertNodeAfter",value:function(o,g){return s(g,o,g.next,this)}},{key:"push",value:function(o){return s(this.tail,r(o),null,this)}},{key:"unshift",value:function(o){return s(null,r(o),this.head,this)}},{key:"remove",value:function(o){return u(o,this)}},{key:"pop",value:function(){return u(this.tail,this).value}},{key:"popNode",value:function(){return u(this.tail,this)}},{key:"shift",value:function(){return u(this.head,this).value}},{key:"shiftNode",value:function(){return u(this.head,this)}},{key:"get_object_at",value:function(o){if(o<=this.length()){var g=1,f=this.head;while(g<o)f=f.next,g++;return f.value}}},{key:"set_object_at",value:function(o,g){if(o<=this.length()){var f=1,E=this.head;while(f<o)E=E.next,f++;E.value=g}}}]),h}();m.exports=c},function(m,w,L){function a(i,r,s){if(this.x=null,this.y=null,i==null&&r==null&&s==null)this.x=0,this.y=0;else if(typeof i=="number"&&typeof r=="number"&&s==null)this.x=i,this.y=r;else if(i.constructor.name=="Point"&&r==null&&s==null)s=i,this.x=s.x,this.y=s.y}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.getLocation=function(){return new a(this.x,this.y)},a.prototype.setLocation=function(i,r,s){if(i.constructor.name=="Point"&&r==null&&s==null)s=i,this.setLocation(s.x,s.y);else if(typeof i=="number"&&typeof r=="number"&&s==null)if(parseInt(i)==i&&parseInt(r)==r)this.move(i,r);else this.x=Math.floor(i+0.5),this.y=Math.floor(r+0.5)},a.prototype.move=function(i,r){this.x=i,this.y=r},a.prototype.translate=function(i,r){this.x+=i,this.y+=r},a.prototype.equals=function(i){if(i.constructor.name=="Point"){var r=i;return this.x==r.x&&this.y==r.y}return this==i},a.prototype.toString=function(){return new a().constructor.name+"[x="+this.x+",y="+this.y+"]"},m.exports=a},function(m,w,L){function a(i,r,s,u){if(this.x=0,this.y=0,this.width=0,this.height=0,i!=null&&r!=null&&s!=null&&u!=null)this.x=i,this.y=r,this.width=s,this.height=u}a.prototype.getX=function(){return this.x},a.prototype.setX=function(i){this.x=i},a.prototype.getY=function(){return this.y},a.prototype.setY=function(i){this.y=i},a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(i){this.width=i},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(i){this.height=i},a.prototype.getRight=function(){return this.x+this.width},a.prototype.getBottom=function(){return this.y+this.height},a.prototype.intersects=function(i){if(this.getRight()<i.x)return!1;if(this.getBottom()<i.y)return!1;if(i.getRight()<this.x)return!1;if(i.getBottom()<this.y)return!1;return!0},a.prototype.getCenterX=function(){return this.x+this.width/2},a.prototype.getMinX=function(){return this.getX()},a.prototype.getMaxX=function(){return this.getX()+this.width},a.prototype.getCenterY=function(){return this.y+this.height/2},a.prototype.getMinY=function(){return this.getY()},a.prototype.getMaxY=function(){return this.getY()+this.height},a.prototype.getWidthHalf=function(){return this.width/2},a.prototype.getHeightHalf=function(){return this.height/2},m.exports=a},function(m,w,L){var a=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol==="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r};function i(){}i.lastID=0,i.createID=function(r){if(i.isPrimitive(r))return r;if(r.uniqueID!=null)return r.uniqueID;return r.uniqueID=i.getString(),i.lastID++,r.uniqueID},i.getString=function(r){if(r==null)r=i.lastID;return"Object#"+r},i.isPrimitive=function(r){var s=typeof r>"u"?"undefined":a(r);return r==null||s!="object"&&s!="function"},m.exports=i},function(m,w,L){function a(f){if(Array.isArray(f)){for(var E=0,T=Array(f.length);E<f.length;E++)T[E]=f[E];return T}else return Array.from(f)}var i=L(0),r=L(6),s=L(3),u=L(1),c=L(5),h=L(4),y=L(17),o=L(27);function g(f){if(o.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new r(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,f!=null)this.isRemoteUse=f}g.RANDOM_SEED=1,g.prototype=Object.create(o.prototype),g.prototype.getGraphManager=function(){return this.graphManager},g.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},g.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},g.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},g.prototype.newGraphManager=function(){var f=new r(this);return this.graphManager=f,f},g.prototype.newGraph=function(f){return new c(null,this.graphManager,f)},g.prototype.newNode=function(f){return new s(this.graphManager,f)},g.prototype.newEdge=function(f){return new u(null,null,f)},g.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},g.prototype.runLayout=function(){if(this.isLayoutFinished=!1,this.tilingPreLayout)this.tilingPreLayout();this.initParameters();var f;if(this.checkLayoutSuccess())f=!1;else f=this.layout();if(i.ANIMATE==="during")return!1;if(f){if(!this.isSubLayout)this.doPostLayout()}if(this.tilingPostLayout)this.tilingPostLayout();return this.isLayoutFinished=!0,f},g.prototype.doPostLayout=function(){if(!this.incremental)this.transform();this.update()},g.prototype.update2=function(){if(this.createBendsAsNeeded)this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges();if(!this.isRemoteUse){var f,E=this.graphManager.getAllEdges();for(var T=0;T<E.length;T++)f=E[T];var N,v=this.graphManager.getRoot().getNodes();for(var T=0;T<v.length;T++)N=v[T];this.update(this.graphManager.getRoot())}},g.prototype.update=function(f){if(f==null)this.update2();else if(f instanceof s){var E=f;if(E.getChild()!=null){var T=E.getChild().getNodes();for(var N=0;N<T.length;N++)update(T[N])}if(E.vGraphObject!=null){var v=E.vGraphObject;v.update(E)}}else if(f instanceof u){var O=f;if(O.vGraphObject!=null){var D=O.vGraphObject;D.update(O)}}else if(f instanceof c){var R=f;if(R.vGraphObject!=null){var l=R.vGraphObject;l.update(R)}}},g.prototype.initParameters=function(){if(!this.isSubLayout)this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES;if(this.animationDuringLayout)this.animationOnLayout=!1},g.prototype.transform=function(f){if(f==null)this.transform(new h(0,0));else{var E=new y,T=this.graphManager.getRoot().updateLeftTop();if(T!=null){E.setWorldOrgX(f.x),E.setWorldOrgY(f.y),E.setDeviceOrgX(T.x),E.setDeviceOrgY(T.y);var N=this.getAllNodes(),v;for(var O=0;O<N.length;O++)v=N[O],v.transform(E)}}},g.prototype.positionNodesRandomly=function(f){if(f==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else{var E,T,N=f.getNodes();for(var v=0;v<N.length;v++)if(E=N[v],T=E.getChild(),T==null)E.scatter();else if(T.getNodes().length==0)E.scatter();else this.positionNodesRandomly(T),E.updateBounds()}},g.prototype.getFlatForest=function(){var f=[],E=!0,T=this.graphManager.getRoot().getNodes(),N=!0;for(var v=0;v<T.length;v++)if(T[v].getChild()!=null)N=!1;if(!N)return f;var O=new Set,D=[],R=new Map,l=[];l=l.concat(T);while(l.length>0&&E){D.push(l[0]);while(D.length>0&&E){var p=D[0];D.splice(0,1),O.add(p);var d=p.getEdges();for(var v=0;v<d.length;v++){var A=d[v].getOtherEnd(p);if(R.get(p)!=A)if(!O.has(A))D.push(A),R.set(A,p);else{E=!1;break}}}if(!E)f=[];else{var I=[].concat(a(O));f.push(I);for(var v=0;v<I.length;v++){var C=I[v],M=l.indexOf(C);if(M>-1)l.splice(M,1)}O=new Set,R=new Map}}return f},g.prototype.createDummyNodesForBendpoints=function(f){var E=[],T=f.source,N=this.graphManager.calcLowestCommonAncestor(f.source,f.target);for(var v=0;v<f.bendpoints.length;v++){var O=this.newNode(null);O.setRect(new Point(0,0),new Dimension(1,1)),N.add(O);var D=this.newEdge(null);this.graphManager.add(D,T,O),E.add(O),T=O}var D=this.newEdge(null);if(this.graphManager.add(D,T,f.target),this.edgeToDummyNodes.set(f,E),f.isInterGraph())this.graphManager.remove(f);else N.remove(f);return E},g.prototype.createBendpointsFromDummyNodes=function(){var f=[];f=f.concat(this.graphManager.getAllEdges()),f=[].concat(a(this.edgeToDummyNodes.keys())).concat(f);for(var E=0;E<f.length;E++){var T=f[E];if(T.bendpoints.length>0){var N=this.edgeToDummyNodes.get(T);for(var v=0;v<N.length;v++){var O=N[v],D=new h(O.getCenterX(),O.getCenterY()),R=T.bendpoints.get(v);R.x=D.x,R.y=D.y,O.getOwner().remove(O)}this.graphManager.add(T,T.source,T.target)}}},g.transform=function(f,E,T,N){if(T!=null&&N!=null){var v=E;if(f<=50){var O=E/T;v-=(E-O)/50*(50-f)}else{var D=E*N;v+=(D-E)/50*(f-50)}return v}else{var R,l;if(f<=50)R=9*E/500,l=E/10;else R=9*E/50,l=-8*E;return R*f+l}},g.findCenterOfTree=function(f){var E=[];E=E.concat(f);var T=[],N=new Map,v=!1,O=null;if(E.length==1||E.length==2)v=!0,O=E[0];for(var D=0;D<E.length;D++){var R=E[D],l=R.getNeighborsList().size;if(N.set(R,R.getNeighborsList().size),l==1)T.push(R)}var p=[];p=p.concat(T);while(!v){var d=[];d=d.concat(p),p=[];for(var D=0;D<E.length;D++){var R=E[D],A=E.indexOf(R);if(A>=0)E.splice(A,1);var I=R.getNeighborsList();I.forEach(function(G){if(T.indexOf(G)<0){var F=N.get(G),P=F-1;if(P==1)p.push(G);N.set(G,P)}})}if(T=T.concat(p),E.length==1||E.length==2)v=!0,O=E[0]}return O},g.prototype.setGraphManager=function(f){this.graphManager=f},m.exports=g},function(m,w,L){function a(){}a.seed=1,a.x=0,a.nextDouble=function(){return a.x=Math.sin(a.seed++)*1e4,a.x-Math.floor(a.x)},m.exports=a},function(m,w,L){var a=L(4);function i(r,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(r){this.lworldOrgX=r},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(r){this.lworldOrgY=r},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(r){this.lworldExtX=r},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(r){this.lworldExtY=r},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(r){this.ldeviceOrgX=r},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(r){this.ldeviceOrgY=r},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(r){this.ldeviceExtX=r},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(r){this.ldeviceExtY=r},i.prototype.transformX=function(r){var s=0,u=this.lworldExtX;if(u!=0)s=this.ldeviceOrgX+(r-this.lworldOrgX)*this.ldeviceExtX/u;return s},i.prototype.transformY=function(r){var s=0,u=this.lworldExtY;if(u!=0)s=this.ldeviceOrgY+(r-this.lworldOrgY)*this.ldeviceExtY/u;return s},i.prototype.inverseTransformX=function(r){var s=0,u=this.ldeviceExtX;if(u!=0)s=this.lworldOrgX+(r-this.ldeviceOrgX)*this.lworldExtX/u;return s},i.prototype.inverseTransformY=function(r){var s=0,u=this.ldeviceExtY;if(u!=0)s=this.lworldOrgY+(r-this.ldeviceOrgY)*this.lworldExtY/u;return s},i.prototype.inverseTransformPoint=function(r){var s=new a(this.inverseTransformX(r.x),this.inverseTransformY(r.y));return s},m.exports=i},function(m,w,L){function a(o){if(Array.isArray(o)){for(var g=0,f=Array(o.length);g<o.length;g++)f[g]=o[g];return f}else return Array.from(o)}var i=L(15),r=L(7),s=L(0),u=L(8),c=L(9);function h(){i.call(this),this.useSmartIdealEdgeLengthCalculation=r.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=r.DEFAULT_EDGE_LENGTH,this.springConstant=r.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=r.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=r.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=r.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=r.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=r.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*r.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=r.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=r.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=r.MAX_ITERATIONS}h.prototype=Object.create(i.prototype);for(var y in i)h[y]=i[y];h.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=r.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){var o,g,f,E,T,N,v=this.getGraphManager().getAllEdges();for(var O=0;O<v.length;O++)if(o=v[O],o.idealLength=this.idealEdgeLength,o.isInterGraph){if(f=o.getSource(),E=o.getTarget(),T=o.getSourceInLca().getEstimatedSize(),N=o.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation)o.idealLength+=T+N-2*s.SIMPLE_NODE_SIZE;g=o.getLca().getInclusionTreeDepth(),o.idealLength+=r.DEFAULT_EDGE_LENGTH*r.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(f.getInclusionTreeDepth()+E.getInclusionTreeDepth()-2*g)}},h.prototype.initSpringEmbedder=function(){var o=this.getAllNodes().length;if(this.incremental){if(o>r.ADAPTATION_LOWER_NODE_LIMIT)this.coolingFactor=Math.max(this.coolingFactor*r.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(o-r.ADAPTATION_LOWER_NODE_LIMIT)/(r.ADAPTATION_UPPER_NODE_LIMIT-r.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-r.COOLING_ADAPTATION_FACTOR));this.maxNodeDisplacement=r.MAX_NODE_DISPLACEMENT_INCREMENTAL}else{if(o>r.ADAPTATION_LOWER_NODE_LIMIT)this.coolingFactor=Math.max(r.COOLING_ADAPTATION_FACTOR,1-(o-r.ADAPTATION_LOWER_NODE_LIMIT)/(r.ADAPTATION_UPPER_NODE_LIMIT-r.ADAPTATION_LOWER_NODE_LIMIT)*(1-r.COOLING_ADAPTATION_FACTOR));else this.coolingFactor=1;this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=r.MAX_NODE_DISPLACEMENT}this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){var o=this.getAllEdges(),g;for(var f=0;f<o.length;f++)g=o[f],this.calcSpringForce(g,g.idealLength)},h.prototype.calcRepulsionForces=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,f,E,T,N,v=this.getAllNodes(),O;if(this.useFRGridVariant){if(this.totalIterations%r.GRID_CALCULATION_CHECK_PERIOD==1&&o)this.updateGrid();O=new Set;for(f=0;f<v.length;f++)T=v[f],this.calculateRepulsionForceOfANode(T,O,o,g),O.add(T)}else for(f=0;f<v.length;f++){T=v[f];for(E=f+1;E<v.length;E++){if(N=v[E],T.getOwner()!=N.getOwner())continue;this.calcRepulsionForce(T,N)}}},h.prototype.calcGravitationalForces=function(){var o,g=this.getAllNodesToApplyGravitation();for(var f=0;f<g.length;f++)o=g[f],this.calcGravitationalForce(o)},h.prototype.moveNodes=function(){var o=this.getAllNodes(),g;for(var f=0;f<o.length;f++)g=o[f],g.move()},h.prototype.calcSpringForce=function(o,g){var f=o.getSource(),E=o.getTarget(),T,N,v,O;if(this.uniformLeafNodeSizes&&f.getChild()==null&&E.getChild()==null)o.updateLengthSimple();else if(o.updateLength(),o.isOverlapingSourceAndTarget)return;if(T=o.getLength(),T==0)return;N=this.springConstant*(T-g),v=N*(o.lengthX/T),O=N*(o.lengthY/T),f.springForceX+=v,f.springForceY+=O,E.springForceX-=v,E.springForceY-=O},h.prototype.calcRepulsionForce=function(o,g){var f=o.getRect(),E=g.getRect(),T=[,,],N=[,,,,],v,O,D,R,l,p,d;if(f.intersects(E)){u.calcSeparationAmount(f,E,T,r.DEFAULT_EDGE_LENGTH/2),p=2*T[0],d=2*T[1];var A=o.noOfChildren*g.noOfChildren/(o.noOfChildren+g.noOfChildren);o.repulsionForceX-=A*p,o.repulsionForceY-=A*d,g.repulsionForceX+=A*p,g.repulsionForceY+=A*d}else{if(this.uniformLeafNodeSizes&&o.getChild()==null&&g.getChild()==null)v=E.getCenterX()-f.getCenterX(),O=E.getCenterY()-f.getCenterY();else u.getIntersection(f,E,N),v=N[2]-N[0],O=N[3]-N[1];if(Math.abs(v)<r.MIN_REPULSION_DIST)v=c.sign(v)*r.MIN_REPULSION_DIST;if(Math.abs(O)<r.MIN_REPULSION_DIST)O=c.sign(O)*r.MIN_REPULSION_DIST;D=v*v+O*O,R=Math.sqrt(D),l=this.repulsionConstant*o.noOfChildren*g.noOfChildren/D,p=l*v/R,d=l*O/R,o.repulsionForceX-=p,o.repulsionForceY-=d,g.repulsionForceX+=p,g.repulsionForceY+=d}},h.prototype.calcGravitationalForce=function(o){var g,f,E,T,N,v,O,D;if(g=o.getOwner(),f=(g.getRight()+g.getLeft())/2,E=(g.getTop()+g.getBottom())/2,T=o.getCenterX()-f,N=o.getCenterY()-E,v=Math.abs(T)+o.getWidth()/2,O=Math.abs(N)+o.getHeight()/2,o.getOwner()==this.graphManager.getRoot()){if(D=g.getEstimatedSize()*this.gravityRangeFactor,v>D||O>D)o.gravitationForceX=-this.gravityConstant*T,o.gravitationForceY=-this.gravityConstant*N}else if(D=g.getEstimatedSize()*this.compoundGravityRangeFactor,v>D||O>D)o.gravitationForceX=-this.gravityConstant*T*this.compoundGravityConstant,o.gravitationForceY=-this.gravityConstant*N*this.compoundGravityConstant},h.prototype.isConverged=function(){var o,g=!1;if(this.totalIterations>this.maxIterations/3)g=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2;return o=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,o||g},h.prototype.animate=function(){if(this.animationDuringLayout&&!this.isSubLayout)if(this.notAnimatedIterations==this.animationPeriod)this.update(),this.notAnimatedIterations=0;else this.notAnimatedIterations++},h.prototype.calcNoOfChildrenForAllNodes=function(){var o,g=this.graphManager.getAllNodes();for(var f=0;f<g.length;f++)o=g[f],o.noOfChildren=o.getNoOfChildren()},h.prototype.calcGrid=function(o){var g=0,f=0;g=parseInt(Math.ceil((o.getRight()-o.getLeft())/this.repulsionRange)),f=parseInt(Math.ceil((o.getBottom()-o.getTop())/this.repulsionRange));var E=Array(g);for(var T=0;T<g;T++)E[T]=Array(f);for(var T=0;T<g;T++)for(var N=0;N<f;N++)E[T][N]=[];return E},h.prototype.addNodeToGrid=function(o,g,f){var E=0,T=0,N=0,v=0;E=parseInt(Math.floor((o.getRect().x-g)/this.repulsionRange)),T=parseInt(Math.floor((o.getRect().width+o.getRect().x-g)/this.repulsionRange)),N=parseInt(Math.floor((o.getRect().y-f)/this.repulsionRange)),v=parseInt(Math.floor((o.getRect().height+o.getRect().y-f)/this.repulsionRange));for(var O=E;O<=T;O++)for(var D=N;D<=v;D++)this.grid[O][D].push(o),o.setGridCoordinates(E,T,N,v)},h.prototype.updateGrid=function(){var o,g,f=this.getAllNodes();this.grid=this.calcGrid(this.graphManager.getRoot());for(o=0;o<f.length;o++)g=f[o],this.addNodeToGrid(g,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},h.prototype.calculateRepulsionForceOfANode=function(o,g,f,E){if(this.totalIterations%r.GRID_CALCULATION_CHECK_PERIOD==1&&f||E){var T=new Set;o.surrounding=[];var N,v=this.grid;for(var O=o.startX-1;O<o.finishX+2;O++)for(var D=o.startY-1;D<o.finishY+2;D++)if(!(O<0||D<0||O>=v.length||D>=v[0].length))for(var R=0;R<v[O][D].length;R++){if(N=v[O][D][R],o.getOwner()!=N.getOwner()||o==N)continue;if(!g.has(N)&&!T.has(N)){var l=Math.abs(o.getCenterX()-N.getCenterX())-(o.getWidth()/2+N.getWidth()/2),p=Math.abs(o.getCenterY()-N.getCenterY())-(o.getHeight()/2+N.getHeight()/2);if(l<=this.repulsionRange&&p<=this.repulsionRange)T.add(N)}}o.surrounding=[].concat(a(T))}for(O=0;O<o.surrounding.length;O++)this.calcRepulsionForce(o,o.surrounding[O])},h.prototype.calcRepulsionRange=function(){return 0},m.exports=h},function(m,w,L){var a=L(1),i=L(7);function r(u,c,h){a.call(this,u,c,h),this.idealLength=i.DEFAULT_EDGE_LENGTH}r.prototype=Object.create(a.prototype);for(var s in a)r[s]=a[s];m.exports=r},function(m,w,L){var a=L(3);function i(s,u,c,h){a.call(this,s,u,c,h),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}i.prototype=Object.create(a.prototype);for(var r in a)i[r]=a[r];i.prototype.setGridCoordinates=function(s,u,c,h){this.startX=s,this.finishX=u,this.startY=c,this.finishY=h},m.exports=i},function(m,w,L){function a(i,r){if(this.width=0,this.height=0,i!==null&&r!==null)this.height=r,this.width=i}a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(i){this.width=i},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(i){this.height=i},m.exports=a},function(m,w,L){var a=L(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(r,s){var u=a.createID(r);if(!this.contains(u))this.map[u]=s,this.keys.push(r)},i.prototype.contains=function(r){var s=a.createID(r);return this.map[r]!=null},i.prototype.get=function(r){var s=a.createID(r);return this.map[s]},i.prototype.keySet=function(){return this.keys},m.exports=i},function(m,w,L){var a=L(14);function i(){this.set={}}i.prototype.add=function(r){var s=a.createID(r);if(!this.contains(s))this.set[s]=r},i.prototype.remove=function(r){delete this.set[a.createID(r)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(r){return this.set[a.createID(r)]==r},i.prototype.isEmpty=function(){return this.size()===0},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(r){var s=Object.keys(this.set),u=s.length;for(var c=0;c<u;c++)r.push(this.set[s[c]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(r){var s=r.length;for(var u=0;u<s;u++){var c=r[u];this.add(c)}},m.exports=i},function(m,w,L){var a=function(){function u(c,h){for(var y=0;y<h.length;y++){var o=h[y];if(o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o)o.writable=!0;Object.defineProperty(c,o.key,o)}}return function(c,h,y){if(h)u(c.prototype,h);if(y)u(c,y);return c}}();function i(u,c){if(!(u instanceof c))throw TypeError("Cannot call a class as a function")}var r=L(11),s=function(){function u(c,h){if(i(this,u),h!==null||h!==void 0)this.compareFunction=this._defaultCompareFunction;var y=void 0;if(c instanceof r)y=c.size();else y=c.length;this._quicksort(c,0,y-1)}return a(u,[{key:"_quicksort",value:function(h,y,o){if(y<o){var g=this._partition(h,y,o);this._quicksort(h,y,g),this._quicksort(h,g+1,o)}}},{key:"_partition",value:function(h,y,o){var g=this._get(h,y),f=y,E=o;while(!0){while(this.compareFunction(g,this._get(h,E)))E--;while(this.compareFunction(this._get(h,f),g))f++;if(f<E)this._swap(h,f,E),f++,E--;else return E}}},{key:"_get",value:function(h,y){if(h instanceof r)return h.get_object_at(y);else return h[y]}},{key:"_set",value:function(h,y,o){if(h instanceof r)h.set_object_at(y,o);else h[y]=o}},{key:"_swap",value:function(h,y,o){var g=this._get(h,y);this._set(h,y,this._get(h,o)),this._set(h,o,g)}},{key:"_defaultCompareFunction",value:function(h,y){return y>h}}]),u}();m.exports=s},function(m,w,L){var a=function(){function s(u,c){for(var h=0;h<c.length;h++){var y=c[h];if(y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y)y.writable=!0;Object.defineProperty(u,y.key,y)}}return function(u,c,h){if(c)s(u.prototype,c);if(h)s(u,h);return u}}();function i(s,u){if(!(s instanceof u))throw TypeError("Cannot call a class as a function")}var r=function(){function s(u,c){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,s),this.sequence1=u,this.sequence2=c,this.match_score=h,this.mismatch_penalty=y,this.gap_penalty=o,this.iMax=u.length+1,this.jMax=c.length+1,this.grid=Array(this.iMax);for(var g=0;g<this.iMax;g++){this.grid[g]=Array(this.jMax);for(var f=0;f<this.jMax;f++)this.grid[g][f]=0}this.tracebackGrid=Array(this.iMax);for(var E=0;E<this.iMax;E++){this.tracebackGrid[E]=Array(this.jMax);for(var T=0;T<this.jMax;T++)this.tracebackGrid[E][T]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return a(s,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var c=1;c<this.jMax;c++)this.grid[0][c]=this.grid[0][c-1]+this.gap_penalty,this.tracebackGrid[0][c]=[!1,!1,!0];for(var h=1;h<this.iMax;h++)this.grid[h][0]=this.grid[h-1][0]+this.gap_penalty,this.tracebackGrid[h][0]=[!1,!0,!1];for(var y=1;y<this.iMax;y++)for(var o=1;o<this.jMax;o++){var g=void 0;if(this.sequence1[y-1]===this.sequence2[o-1])g=this.grid[y-1][o-1]+this.match_score;else g=this.grid[y-1][o-1]+this.mismatch_penalty;var f=this.grid[y-1][o]+this.gap_penalty,E=this.grid[y][o-1]+this.gap_penalty,T=[g,f,E],N=this.arrayAllMaxIndexes(T);this.grid[y][o]=T[N[0]],this.tracebackGrid[y][o]=[N.includes(0),N.includes(1),N.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var c=[];c.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});while(c[0]){var h=c[0],y=this.tracebackGrid[h.pos[0]][h.pos[1]];if(y[0])c.push({pos:[h.pos[0]-1,h.pos[1]-1],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2});if(y[1])c.push({pos:[h.pos[0]-1,h.pos[1]],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:"-"+h.seq2});if(y[2])c.push({pos:[h.pos[0],h.pos[1]-1],seq1:"-"+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2});if(h.pos[0]===0&&h.pos[1]===0)this.alignments.push({sequence1:h.seq1,sequence2:h.seq2});c.shift()}return this.alignments}},{key:"getAllIndexes",value:function(c,h){var y=[],o=-1;while((o=c.indexOf(h,o+1))!==-1)y.push(o);return y}},{key:"arrayAllMaxIndexes",value:function(c){return this.getAllIndexes(c,Math.max.apply(null,c))}}]),s}();m.exports=r},function(m,w,L){var a=function(){return};a.FDLayout=L(18),a.FDLayoutConstants=L(7),a.FDLayoutEdge=L(19),a.FDLayoutNode=L(20),a.DimensionD=L(21),a.HashMap=L(22),a.HashSet=L(23),a.IGeometry=L(8),a.IMath=L(9),a.Integer=L(10),a.Point=L(12),a.PointD=L(4),a.RandomSeed=L(16),a.RectangleD=L(13),a.Transform=L(17),a.UniqueIDGeneretor=L(14),a.Quicksort=L(24),a.LinkedList=L(11),a.LGraphObject=L(2),a.LGraph=L(5),a.LEdge=L(1),a.LGraphManager=L(6),a.LNode=L(3),a.Layout=L(15),a.LayoutConstants=L(0),a.NeedlemanWunsch=L(25),m.exports=a},function(m,w,L){function a(){this.listeners=[]}var i=a.prototype;i.addListener=function(r,s){this.listeners.push({event:r,callback:s})},i.removeListener=function(r,s){for(var u=this.listeners.length;u>=0;u--){var c=this.listeners[u];if(c.event===r&&c.callback===s)this.listeners.splice(u,1)}},i.emit=function(r,s){for(var u=0;u<this.listeners.length;u++){var c=this.listeners[u];if(r===c.event)c.callback(s)}},m.exports=a}])})});var tt=se(function(Q,J){(function(w,L){if(typeof Q==="object"&&typeof J==="object")J.exports=L(z());else if(typeof define==="function"&&define.amd)define(["layout-base"],L);else if(typeof Q==="object")Q.coseBase=L(z());else w.coseBase=L(w.layoutBase)})(Q,function(m){return function(w){var L={};function a(i){if(L[i])return L[i].exports;var r=L[i]={i,l:!1,exports:{}};return w[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=w,a.c=L,a.i=function(i){return i},a.d=function(i,r,s){if(!a.o(i,r))Object.defineProperty(i,r,{configurable:!1,enumerable:!0,get:s})},a.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(r,"a",r),r},a.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},a.p="",a(a.s=7)}([function(w,L){w.exports=m},function(w,L,a){var i=a(0).FDLayoutConstants;function r(){}for(var s in i)r[s]=i[s];r.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,r.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,r.DEFAULT_COMPONENT_SEPERATION=60,r.TILE=!0,r.TILING_PADDING_VERTICAL=10,r.TILING_PADDING_HORIZONTAL=10,r.TREE_REDUCTION_ON_INCREMENTAL=!1,w.exports=r},function(w,L,a){var i=a(0).FDLayoutEdge;function r(u,c,h){i.call(this,u,c,h)}r.prototype=Object.create(i.prototype);for(var s in i)r[s]=i[s];w.exports=r},function(w,L,a){var i=a(0).LGraph;function r(u,c,h){i.call(this,u,c,h)}r.prototype=Object.create(i.prototype);for(var s in i)r[s]=i[s];w.exports=r},function(w,L,a){var i=a(0).LGraphManager;function r(u){i.call(this,u)}r.prototype=Object.create(i.prototype);for(var s in i)r[s]=i[s];w.exports=r},function(w,L,a){var i=a(0).FDLayoutNode,r=a(0).IMath;function s(c,h,y,o){i.call(this,c,h,y,o)}s.prototype=Object.create(i.prototype);for(var u in i)s[u]=i[u];s.prototype.move=function(){var c=this.graphManager.getLayout();if(this.displacementX=c.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=c.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>c.coolingFactor*c.maxNodeDisplacement)this.displacementX=c.coolingFactor*c.maxNodeDisplacement*r.sign(this.displacementX);if(Math.abs(this.displacementY)>c.coolingFactor*c.maxNodeDisplacement)this.displacementY=c.coolingFactor*c.maxNodeDisplacement*r.sign(this.displacementY);if(this.child==null)this.moveBy(this.displacementX,this.displacementY);else if(this.child.getNodes().length==0)this.moveBy(this.displacementX,this.displacementY);else this.propogateDisplacementToChildren(this.displacementX,this.displacementY);c.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},s.prototype.propogateDisplacementToChildren=function(c,h){var y=this.getChild().getNodes(),o;for(var g=0;g<y.length;g++)if(o=y[g],o.getChild()==null)o.moveBy(c,h),o.displacementX+=c,o.displacementY+=h;else o.propogateDisplacementToChildren(c,h)},s.prototype.setPred1=function(c){this.pred1=c},s.prototype.getPred1=function(){return pred1},s.prototype.getPred2=function(){return pred2},s.prototype.setNext=function(c){this.next=c},s.prototype.getNext=function(){return next},s.prototype.setProcessed=function(c){this.processed=c},s.prototype.isProcessed=function(){return processed},w.exports=s},function(w,L,a){var i=a(0).FDLayout,r=a(4),s=a(3),u=a(5),c=a(2),h=a(1),y=a(0).FDLayoutConstants,o=a(0).LayoutConstants,g=a(0).Point,f=a(0).PointD,E=a(0).Layout,T=a(0).Integer,N=a(0).IGeometry,v=a(0).LGraph,O=a(0).Transform;function D(){i.call(this),this.toBeTiled={}}D.prototype=Object.create(i.prototype);for(var R in i)D[R]=i[R];D.prototype.newGraphManager=function(){var l=new r(this);return this.graphManager=l,l},D.prototype.newGraph=function(l){return new s(null,this.graphManager,l)},D.prototype.newNode=function(l){return new u(this.graphManager,l)},D.prototype.newEdge=function(l){return new c(null,null,l)},D.prototype.initParameters=function(){if(i.prototype.initParameters.call(this,arguments),!this.isSubLayout){if(h.DEFAULT_EDGE_LENGTH<10)this.idealEdgeLength=10;else this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH;this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=y.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=y.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=y.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=y.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=y.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=y.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/y.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=y.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1}},D.prototype.layout=function(){var l=o.DEFAULT_CREATE_BENDS_AS_NEEDED;if(l)this.createBendpoints(),this.graphManager.resetAllEdges();return this.level=0,this.classicLayout()},D.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){var l=this.getFlatForest();if(l.length>0)this.positionNodesRadially(l);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var p=new Set(this.getAllNodes()),d=this.nodesWithGravity.filter(function(A){return p.has(A)});this.graphManager.setAllNodesToApplyGravitation(d),this.positionNodesRandomly()}}else if(h.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var p=new Set(this.getAllNodes()),d=this.nodesWithGravity.filter(function(C){return p.has(C)});this.graphManager.setAllNodesToApplyGravitation(d)}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},D.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%y.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.coolingCycle++,this.layoutQuality==0)this.coolingAdjuster=this.coolingCycle;else if(this.layoutQuality==1)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 l=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return l.has(I)});this.graphManager.setAllNodesToApplyGravitation(p),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;if(this.afterGrowthIterations%10==0)this.graphManager.updateBounds(),this.updateGrid();this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var d=!this.isTreeGrowing&&!this.isGrowthFinished,A=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(d,A),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},D.prototype.getPositionsData=function(){var l=this.graphManager.getAllNodes(),p={};for(var d=0;d<l.length;d++){var A=l[d].rect,I=l[d].id;p[I]={id:I,x:A.getCenterX(),y:A.getCenterY(),w:A.width,h:A.height}}return p},D.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var l=!1;if(y.ANIMATE==="during")this.emit("layoutstarted");else{while(!l)l=this.tick();this.graphManager.updateBounds()}},D.prototype.calculateNodesToApplyGravitationTo=function(){var l=[],p,d=this.graphManager.getGraphs(),A=d.length,I;for(I=0;I<A;I++)if(p=d[I],p.updateConnected(),!p.isConnected)l=l.concat(p.getNodes());return l},D.prototype.createBendpoints=function(){var l=[];l=l.concat(this.graphManager.getAllEdges());var p=new Set,d;for(d=0;d<l.length;d++){var A=l[d];if(!p.has(A)){var I=A.getSource(),C=A.getTarget();if(I==C)A.getBendpoints().push(new f),A.getBendpoints().push(new f),this.createDummyNodesForBendpoints(A),p.add(A);else{var M=[];if(M=M.concat(I.getEdgeListToNode(C)),M=M.concat(C.getEdgeListToNode(I)),!p.has(M[0])){if(M.length>1){var G;for(G=0;G<M.length;G++){var F=M[G];F.getBendpoints().push(new f),this.createDummyNodesForBendpoints(F)}}M.forEach(function(P){p.add(P)})}}}if(p.size==l.length)break}},D.prototype.positionNodesRadially=function(l){var p=new g(0,0),d=Math.ceil(Math.sqrt(l.length)),A=0,I=0,C=0,M=new f(0,0);for(var G=0;G<l.length;G++){if(G%d==0){if(C=0,I=A,G!=0)I+=h.DEFAULT_COMPONENT_SEPERATION;A=0}var F=l[G],P=E.findCenterOfTree(F);if(p.x=C,p.y=I,M=D.radialLayout(F,P,p),M.y>A)A=Math.floor(M.y);C=Math.floor(M.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(o.WORLD_CENTER_X-M.x/2,o.WORLD_CENTER_Y-M.y/2))},D.radialLayout=function(l,p,d){var A=Math.max(this.maxDiagonalInTree(l),h.DEFAULT_RADIAL_SEPARATION);D.branchRadialLayout(p,null,0,359,0,A);var I=v.calculateBounds(l),C=new O;C.setDeviceOrgX(I.getMinX()),C.setDeviceOrgY(I.getMinY()),C.setWorldOrgX(d.x),C.setWorldOrgY(d.y);for(var M=0;M<l.length;M++){var G=l[M];G.transform(C)}var F=new f(I.getMaxX(),I.getMaxY());return C.inverseTransformPoint(F)},D.branchRadialLayout=function(l,p,d,A,I,C){var M=(A-d+1)/2;if(M<0)M+=180;var G=(M+d)%360,F=G*N.TWO_PI/360,P=Math.cos(F),b=I*Math.cos(F),U=I*Math.sin(F);l.setCenter(b,U);var x=[];x=x.concat(l.getEdges());var S=x.length;if(p!=null)S--;var Y=0,X=x.length,H,_=l.getEdgesBetween(p);while(_.length>1){var W=_[0];_.splice(0,1);var k=x.indexOf(W);if(k>=0)x.splice(k,1);X--,S--}if(p!=null)H=(x.indexOf(_[0])+1)%X;else H=0;var B=Math.abs(A-d)/S;for(var V=H;Y!=S;V=++V%X){var rt=x[V].getOtherEnd(l);if(rt==p)continue;var it=(d+Y*B)%360,ct=(it+B)%360;D.branchRadialLayout(rt,l,it,ct,I+C,C),Y++}},D.maxDiagonalInTree=function(l){var p=T.MIN_VALUE;for(var d=0;d<l.length;d++){var A=l[d],I=A.getDiagonal();if(I>p)p=I}return p},D.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},D.prototype.groupZeroDegreeMembers=function(){var l=this,p={};this.memberGroups={},this.idToDummyNode={};var d=[],A=this.graphManager.getAllNodes();for(var I=0;I<A.length;I++){var C=A[I],M=C.getParent();if(this.getNodeDegreeWithChildren(C)===0&&(M.id==null||!this.getToBeTiled(M)))d.push(C)}for(var I=0;I<d.length;I++){var C=d[I],G=C.getParent().id;if(typeof p[G]>"u")p[G]=[];p[G]=p[G].concat(C)}Object.keys(p).forEach(function(F){if(p[F].length>1){var P="DummyCompound_"+F;l.memberGroups[P]=p[F];var b=p[F][0].getParent(),U=new u(l.graphManager);U.id=P,U.paddingLeft=b.paddingLeft||0,U.paddingRight=b.paddingRight||0,U.paddingBottom=b.paddingBottom||0,U.paddingTop=b.paddingTop||0,l.idToDummyNode[P]=U;var x=l.getGraphManager().add(l.newGraph(),U),S=b.getChild();S.add(U);for(var Y=0;Y<p[F].length;Y++){var X=p[F][Y];S.remove(X),x.add(X)}}})},D.prototype.clearCompounds=function(){var l={},p={};this.performDFSOnCompounds();for(var d=0;d<this.compoundOrder.length;d++)p[this.compoundOrder[d].id]=this.compoundOrder[d],l[this.compoundOrder[d].id]=[].concat(this.compoundOrder[d].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[d].getChild()),this.compoundOrder[d].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(l,p)},D.prototype.clearZeroDegreeMembers=function(){var l=this,p=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(d){var A=l.idToDummyNode[d];p[d]=l.tileNodes(l.memberGroups[d],A.paddingLeft+A.paddingRight),A.rect.width=p[d].width,A.rect.height=p[d].height})},D.prototype.repopulateCompounds=function(){for(var l=this.compoundOrder.length-1;l>=0;l--){var p=this.compoundOrder[l],{id:d,paddingLeft:A,paddingTop:I}=p;this.adjustLocations(this.tiledMemberPack[d],p.rect.x,p.rect.y,A,I)}},D.prototype.repopulateZeroDegreeMembers=function(){var l=this,p=this.tiledZeroDegreePack;Object.keys(p).forEach(function(d){var A=l.idToDummyNode[d],{paddingLeft:I,paddingTop:C}=A;l.adjustLocations(p[d],A.rect.x,A.rect.y,I,C)})},D.prototype.getToBeTiled=function(l){var p=l.id;if(this.toBeTiled[p]!=null)return this.toBeTiled[p];var d=l.getChild();if(d==null)return this.toBeTiled[p]=!1,!1;var A=d.getNodes();for(var I=0;I<A.length;I++){var C=A[I];if(this.getNodeDegree(C)>0)return this.toBeTiled[p]=!1,!1;if(C.getChild()==null){this.toBeTiled[C.id]=!1;continue}if(!this.getToBeTiled(C))return this.toBeTiled[p]=!1,!1}return this.toBeTiled[p]=!0,!0},D.prototype.getNodeDegree=function(l){var p=l.id,d=l.getEdges(),A=0;for(var I=0;I<d.length;I++){var C=d[I];if(C.getSource().id!==C.getTarget().id)A=A+1}return A},D.prototype.getNodeDegreeWithChildren=function(l){var p=this.getNodeDegree(l);if(l.getChild()==null)return p;var d=l.getChild().getNodes();for(var A=0;A<d.length;A++){var I=d[A];p+=this.getNodeDegreeWithChildren(I)}return p},D.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},D.prototype.fillCompexOrderByDFS=function(l){for(var p=0;p<l.length;p++){var d=l[p];if(d.getChild()!=null)this.fillCompexOrderByDFS(d.getChild().getNodes());if(this.getToBeTiled(d))this.compoundOrder.push(d)}},D.prototype.adjustLocations=function(l,p,d,A,I){p+=A,d+=I;var C=p;for(var M=0;M<l.rows.length;M++){var G=l.rows[M];p=C;var F=0;for(var P=0;P<G.length;P++){var b=G[P];if(b.rect.x=p,b.rect.y=d,p+=b.rect.width+l.horizontalPadding,b.rect.height>F)F=b.rect.height}d+=F+l.verticalPadding}},D.prototype.tileCompoundMembers=function(l,p){var d=this;this.tiledMemberPack=[],Object.keys(l).forEach(function(A){var I=p[A];d.tiledMemberPack[A]=d.tileNodes(l[A],I.paddingLeft+I.paddingRight),I.rect.width=d.tiledMemberPack[A].width,I.rect.height=d.tiledMemberPack[A].height})},D.prototype.tileNodes=function(l,p){var{TILING_PADDING_VERTICAL:d,TILING_PADDING_HORIZONTAL:A}=h,I={rows:[],rowWidth:[],rowHeight:[],width:0,height:p,verticalPadding:d,horizontalPadding:A};l.sort(function(G,F){if(G.rect.width*G.rect.height>F.rect.width*F.rect.height)return-1;if(G.rect.width*G.rect.height<F.rect.width*F.rect.height)return 1;return 0});for(var C=0;C<l.length;C++){var M=l[C];if(I.rows.length==0)this.insertNodeToRow(I,M,0,p);else if(this.canAddHorizontal(I,M.rect.width,M.rect.height))this.insertNodeToRow(I,M,this.getShortestRowIndex(I),p);else this.insertNodeToRow(I,M,I.rows.length,p);this.shiftToLastRow(I)}return I},D.prototype.insertNodeToRow=function(l,p,d,A){var I=A;if(d==l.rows.length){var C=[];l.rows.push(C),l.rowWidth.push(I),l.rowHeight.push(0)}var M=l.rowWidth[d]+p.rect.width;if(l.rows[d].length>0)M+=l.horizontalPadding;if(l.rowWidth[d]=M,l.width<M)l.width=M;var G=p.rect.height;if(d>0)G+=l.verticalPadding;var F=0;if(G>l.rowHeight[d])F=l.rowHeight[d],l.rowHeight[d]=G,F=l.rowHeight[d]-F;l.height+=F,l.rows[d].push(p)},D.prototype.getShortestRowIndex=function(l){var p=-1,d=Number.MAX_VALUE;for(var A=0;A<l.rows.length;A++)if(l.rowWidth[A]<d)p=A,d=l.rowWidth[A];return p},D.prototype.getLongestRowIndex=function(l){var p=-1,d=Number.MIN_VALUE;for(var A=0;A<l.rows.length;A++)if(l.rowWidth[A]>d)p=A,d=l.rowWidth[A];return p},D.prototype.canAddHorizontal=function(l,p,d){var A=this.getShortestRowIndex(l);if(A<0)return!0;var I=l.rowWidth[A];if(I+l.horizontalPadding+p<=l.width)return!0;var C=0;if(l.rowHeight[A]<d){if(A>0)C=d+l.verticalPadding-l.rowHeight[A]}var M;if(l.width-I>=p+l.horizontalPadding)M=(l.height+C)/(I+p+l.horizontalPadding);else M=(l.height+C)/l.width;C=d+l.verticalPadding;var G;if(l.width<p)G=(l.height+C)/p;else G=(l.height+C)/l.width;if(G<1)G=1/G;if(M<1)M=1/M;return M<G},D.prototype.shiftToLastRow=function(l){var p=this.getLongestRowIndex(l),d=l.rowWidth.length-1,A=l.rows[p],I=A[A.length-1],C=I.width+l.horizontalPadding;if(l.width-l.rowWidth[d]>C&&p!=d){A.splice(-1,1),l.rows[d].push(I),l.rowWidth[p]=l.rowWidth[p]-C,l.rowWidth[d]=l.rowWidth[d]+C,l.width=l.rowWidth[instance.getLongestRowIndex(l)];var M=Number.MIN_VALUE;for(var G=0;G<A.length;G++)if(A[G].height>M)M=A[G].height;if(p>0)M+=l.verticalPadding;var F=l.rowHeight[p]+l.rowHeight[d];if(l.rowHeight[p]=M,l.rowHeight[d]<I.height+l.verticalPadding)l.rowHeight[d]=I.height+l.verticalPadding;var P=l.rowHeight[p]+l.rowHeight[d];l.height+=P-F,this.shiftToLastRow(l)}},D.prototype.tilingPreLayout=function(){if(h.TILE)this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers()},D.prototype.tilingPostLayout=function(){if(h.TILE)this.repopulateZeroDegreeMembers(),this.repopulateCompounds()},D.prototype.reduceTrees=function(){var l=[],p=!0,d;while(p){var A=this.graphManager.getAllNodes(),I=[];p=!1;for(var C=0;C<A.length;C++)if(d=A[C],d.getEdges().length==1&&!d.getEdges()[0].isInterGraph&&d.getChild()==null)I.push([d,d.getEdges()[0],d.getOwner()]),p=!0;if(p==!0){var M=[];for(var G=0;G<I.length;G++)if(I[G][0].getEdges().length==1)M.push(I[G]),I[G][0].getOwner().remove(I[G][0]);l.push(M),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=l},D.prototype.growTree=function(l){var p=l.length,d=l[p-1],A;for(var I=0;I<d.length;I++)A=d[I],this.findPlaceforPrunedNode(A),A[2].add(A[0]),A[2].add(A[1],A[1].source,A[1].target);l.splice(l.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},D.prototype.findPlaceforPrunedNode=function(l){var p,d,A=l[0];if(A==l[1].source)d=l[1].target;else d=l[1].source;var I=d.startX,C=d.finishX,M=d.startY,G=d.finishY,F=0,P=0,b=0,U=0,x=[F,b,P,U];if(M>0)for(var S=I;S<=C;S++)x[0]+=this.grid[S][M-1].length+this.grid[S][M].length-1;if(C<this.grid.length-1)for(var S=M;S<=G;S++)x[1]+=this.grid[C+1][S].length+this.grid[C][S].length-1;if(G<this.grid[0].length-1)for(var S=I;S<=C;S++)x[2]+=this.grid[S][G+1].length+this.grid[S][G].length-1;if(I>0)for(var S=M;S<=G;S++)x[3]+=this.grid[I-1][S].length+this.grid[I][S].length-1;var Y=T.MAX_VALUE,X,H;for(var _=0;_<x.length;_++)if(x[_]<Y)Y=x[_],X=1,H=_;else if(x[_]==Y)X++;if(X==3&&Y==0){if(x[0]==0&&x[1]==0&&x[2]==0)p=1;else if(x[0]==0&&x[1]==0&&x[3]==0)p=0;else if(x[0]==0&&x[2]==0&&x[3]==0)p=3;else if(x[1]==0&&x[2]==0&&x[3]==0)p=2}else if(X==2&&Y==0){var W=Math.floor(Math.random()*2);if(x[0]==0&&x[1]==0)if(W==0)p=0;else p=1;else if(x[0]==0&&x[2]==0)if(W==0)p=0;else p=2;else if(x[0]==0&&x[3]==0)if(W==0)p=0;else p=3;else if(x[1]==0&&x[2]==0)if(W==0)p=1;else p=2;else if(x[1]==0&&x[3]==0)if(W==0)p=1;else p=3;else if(W==0)p=2;else p=3}else if(X==4&&Y==0){var W=Math.floor(Math.random()*4);p=W}else p=H;if(p==0)A.setCenter(d.getCenterX(),d.getCenterY()-d.getHeight()/2-y.DEFAULT_EDGE_LENGTH-A.getHeight()/2);else if(p==1)A.setCenter(d.getCenterX()+d.getWidth()/2+y.DEFAULT_EDGE_LENGTH+A.getWidth()/2,d.getCenterY());else if(p==2)A.setCenter(d.getCenterX(),d.getCenterY()+d.getHeight()/2+y.DEFAULT_EDGE_LENGTH+A.getHeight()/2);else A.setCenter(d.getCenterX()-d.getWidth()/2-y.DEFAULT_EDGE_LENGTH-A.getWidth()/2,d.getCenterY())},w.exports=D},function(w,L,a){var i={};i.layoutBase=a(0),i.CoSEConstants=a(1),i.CoSEEdge=a(2),i.CoSEGraph=a(3),i.CoSEGraphManager=a(4),i.CoSELayout=a(6),i.CoSENode=a(5),w.exports=i}])})});var nt=se(function(j,et){(function(w,L){if(typeof j==="object"&&typeof et==="object")et.exports=L(tt());else if(typeof define==="function"&&define.amd)define(["cose-base"],L);else if(typeof j==="object")j.cytoscapeCoseBilkent=L(tt());else w.cytoscapeCoseBilkent=L(w.coseBase)})(j,function(m){return function(w){var L={};function a(i){if(L[i])return L[i].exports;var r=L[i]={i,l:!1,exports:{}};return w[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=w,a.c=L,a.i=function(i){return i},a.d=function(i,r,s){if(!a.o(i,r))Object.defineProperty(i,r,{configurable:!1,enumerable:!0,get:s})},a.n=function(i){var r=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(r,"a",r),r},a.o=function(i,r){return Object.prototype.hasOwnProperty.call(i,r)},a.p="",a(a.s=1)}([function(w,L){w.exports=m},function(w,L,a){var i=a(0).layoutBase.LayoutConstants,r=a(0).layoutBase.FDLayoutConstants,s=a(0).CoSEConstants,u=a(0).CoSELayout,c=a(0).CoSENode,h=a(0).layoutBase.PointD,y=a(0).layoutBase.DimensionD,o={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:0.45,nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.5};function g(N,v){var O={};for(var D in N)O[D]=N[D];for(var D in v)O[D]=v[D];return O}function f(N){this.options=g(o,N),E(this.options)}var E=function(v){if(v.nodeRepulsion!=null)s.DEFAULT_REPULSION_STRENGTH=r.DEFAULT_REPULSION_STRENGTH=v.nodeRepulsion;if(v.idealEdgeLength!=null)s.DEFAULT_EDGE_LENGTH=r.DEFAULT_EDGE_LENGTH=v.idealEdgeLength;if(v.edgeElasticity!=null)s.DEFAULT_SPRING_STRENGTH=r.DEFAULT_SPRING_STRENGTH=v.edgeElasticity;if(v.nestingFactor!=null)s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=r.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor;if(v.gravity!=null)s.DEFAULT_GRAVITY_STRENGTH=r.DEFAULT_GRAVITY_STRENGTH=v.gravity;if(v.numIter!=null)s.MAX_ITERATIONS=r.MAX_ITERATIONS=v.numIter;if(v.gravityRange!=null)s.DEFAULT_GRAVITY_RANGE_FACTOR=r.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange;if(v.gravityCompound!=null)s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=r.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound;if(v.gravityRangeCompound!=null)s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=r.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound;if(v.initialEnergyOnIncremental!=null)s.DEFAULT_COOLING_FACTOR_INCREMENTAL=r.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental;if(v.quality=="draft")i.QUALITY=0;else if(v.quality=="proof")i.QUALITY=2;else i.QUALITY=1;s.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,s.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=!v.randomize,s.ANIMATE=r.ANIMATE=i.ANIMATE=v.animate,s.TILE=v.tile,s.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical==="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,s.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal==="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal};f.prototype.run=function(){var N,v,O=this.options,D=this.idToLNode={},R=this.layout=new u,l=this;l.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var p=R.newGraphManager();this.gm=p;var d=this.options.eles.nodes(),A=this.options.eles.edges();this.root=p.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(d),R);for(var I=0;I<A.length;I++){var C=A[I],M=this.idToLNode[C.data("source")],G=this.idToLNode[C.data("target")];if(M!==G&&M.getEdgesBetween(G).length==0){var F=p.add(R.newEdge(),M,G);F.id=C.id()}}var P=function(x,S){if(typeof x==="number")x=S;var Y=x.data("id"),X=l.idToLNode[Y];return{x:X.getRect().getCenterX(),y:X.getRect().getCenterY()}},b=function U(){var x=function(){if(O.fit)O.cy.fit(O.eles,O.padding);if(!N)N=!0,l.cy.one("layoutready",O.ready),l.cy.trigger({type:"layoutready",layout:l})},S=l.options.refresh,Y;for(var X=0;X<S&&!Y;X++)Y=l.stopped||l.layout.tick();if(Y){if(R.checkLayoutSuccess()&&!R.isSubLayout)R.doPostLayout();if(R.tilingPostLayout)R.tilingPostLayout();if(R.isLayoutFinished=!0,l.options.eles.nodes().positions(P),x(),l.cy.one("layoutstop",l.options.stop),l.cy.trigger({type:"layoutstop",layout:l}),v)cancelAnimationFrame(v);N=!1;return}var H=l.layout.getPositionsData();O.eles.nodes().positions(function(_,W){if(typeof _==="number")_=W;if(!_.isParent()){var k=_.id(),B=H[k],V=_;while(B==null)if(B=H[V.data("parent")]||H["DummyCompound_"+V.data("parent")],H[k]=B,V=V.parent()[0],V==null)break;if(B!=null)return{x:B.x,y:B.y};else return{x:_.position("x"),y:_.position("y")}}}),x(),v=requestAnimationFrame(U)};if(R.addListener("layoutstarted",function(){if(l.options.animate==="during")v=requestAnimationFrame(b)}),R.runLayout(),this.options.animate!=="during")l.options.eles.nodes().not(":parent").layoutPositions(l,l.options,P),N=!1;return this},f.prototype.getTopMostNodes=function(N){var v={};for(var O=0;O<N.length;O++)v[N[O].id()]=!0;var D=N.filter(function(R,l){if(typeof R==="number")R=l;var p=R.parent()[0];while(p!=null){if(v[p.id()])return!1;p=p.parent()[0]}return!0});return D},f.prototype.processChildrenList=function(N,v,O){var D=v.length;for(var R=0;R<D;R++){var l=v[R],p=l.children(),d,A=l.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(l.outerWidth()!=null&&l.outerHeight()!=null)d=N.add(new c(O.graphManager,new h(l.position("x")-A.w/2,l.position("y")-A.h/2),new y(parseFloat(A.w),parseFloat(A.h))));else d=N.add(new c(this.graphManager));if(d.id=l.data("id"),d.paddingLeft=parseInt(l.css("padding")),d.paddingTop=parseInt(l.css("padding")),d.paddingRight=parseInt(l.css("padding")),d.paddingBottom=parseInt(l.css("padding")),this.options.nodeDimensionsIncludeLabels){if(l.isParent()){var I=l.boundingBox({includeLabels:!0,includeNodes:!1}).w,C=l.boundingBox({includeLabels:!0,includeNodes:!1}).h,M=l.css("text-halign");d.labelWidth=I,d.labelHeight=C,d.labelPos=M}}if(this.idToLNode[l.data("id")]=d,isNaN(d.rect.x))d.rect.x=0;if(isNaN(d.rect.y))d.rect.y=0;if(p!=null&&p.length>0){var G=O.getGraphManager().add(O.newGraph(),d);this.processChildrenList(G,p,O)}}},f.prototype.stop=function(){return this.stopped=!0,this};var T=function(v){v("layout","cose-bilkent",f)};if(typeof cytoscape<"u")T(cytoscape);w.exports=T}])})});var st=K(nt(),1);Re.use(st.default);function ot(m,w){m.forEach((L)=>{let a={id:L.id,labelText:L.label,height:L.height,width:L.width,padding:L.padding??0};Object.keys(L).forEach((i)=>{if(!["id","label","height","width","padding","x","y"].includes(i))a[i]=L[i]}),w.add({group:"nodes",data:a,position:{x:L.x??0,y:L.y??0}})})}e(ot,"addNodes");function at(m,w){m.forEach((L)=>{let a={id:L.id,source:L.start,target:L.end};Object.keys(L).forEach((i)=>{if(!["id","start","end"].includes(i))a[i]=L[i]}),w.add({group:"edges",data:a})})}e(at,"addEdges");function ht(m){return new Promise((w)=>{let L=n("body").append("div").attr("id","cy").attr("style","display:none"),a=Re({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});L.remove(),ot(m.nodes,a),at(m.edges,a),a.nodes().forEach(function(r){r.layoutDimensions=()=>{let s=r.data();return{w:s.width,h:s.height}}});let i={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};a.layout(i).run(),a.ready((r)=>{t.info("Cytoscape ready",r),w(a)})})}e(ht,"createCytoscapeInstance");function lt(m){return m.nodes().map((w)=>{let L=w.data(),a=w.position(),i={id:L.id,x:a.x,y:a.y};return Object.keys(L).forEach((r)=>{if(r!=="id")i[r]=L[r]}),i})}e(lt,"extractPositionedNodes");function ut(m){return m.edges().map((w)=>{let L=w.data(),a=w._private.rscratch,i={id:L.id,source:L.source,target:L.target,startX:a.startX,startY:a.startY,midX:a.midX,midY:a.midY,endX:a.endX,endY:a.endY};return Object.keys(L).forEach((r)=>{if(!["id","source","target"].includes(r))i[r]=L[r]}),i})}e(ut,"extractPositionedEdges");async function gt(m,w){t.debug("Starting cose-bilkent layout algorithm");try{ft(m);let L=await ht(m),a=lt(L),i=ut(L);return t.debug(`Layout completed: ${a.length} nodes, ${i.length} edges`),{nodes:a,edges:i}}catch(L){throw t.error("Error in cose-bilkent layout algorithm:",L),L}}e(gt,"executeCoseBilkentLayout");function ft(m){if(!m)throw Error("Layout data is required");if(!m.config)throw Error("Configuration is required in layout data");if(!m.rootNode)throw Error("Root node is required");if(!m.nodes||!Array.isArray(m.nodes))throw Error("No nodes found in layout data");if(!Array.isArray(m.edges))throw Error("Edges array is required in layout data");return!0}e(ft,"validateLayoutData");var pt=e(async(m,w,{insertCluster:L,insertEdge:a,insertEdgeLabel:i,insertMarkers:r,insertNode:s,log:u,positionEdgeLabel:c},{algorithm:h})=>{let y={},o={},g=w.select("g");r(g,m.markers,m.type,m.diagramId);let f=g.insert("g").attr("class","subgraphs"),E=g.insert("g").attr("class","edgePaths"),T=g.insert("g").attr("class","edgeLabels"),N=g.insert("g").attr("class","nodes");u.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(m.nodes.map(async(D)=>{if(D.isGroup){let R={...D};o[D.id]=R,y[D.id]=R,await L(f,D)}else{let R={...D};y[D.id]=R;let l=await s(N,D,{config:m.config,dir:m.direction||"TB"}),p=l.node().getBBox();R.width=p.width,R.height=p.height,R.domId=l,u.debug(`Node ${D.id} dimensions: ${p.width}x${p.height}`)}})),u.debug("Running cose-bilkent layout algorithm");let v={...m,nodes:m.nodes.map((D)=>{let R=y[D.id];return{...D,width:R.width,height:R.height}})},O=await gt(v,m.config);u.debug("Positioning nodes based on layout results"),O.nodes.forEach((D)=>{let R=y[D.id];if(R?.domId)R.domId.attr("transform",`translate(${D.x}, ${D.y})`),R.x=D.x,R.y=D.y,u.debug(`Positioned node ${R.id} at center (${D.x}, ${D.y})`)}),O.edges.forEach((D)=>{let R=m.edges.find((l)=>l.id===D.id);if(R)R.points=[{x:D.startX,y:D.startY},{x:D.midX,y:D.midY},{x:D.endX,y:D.endY}]}),u.debug("Inserting and positioning edges"),await Promise.all(m.edges.map(async(D)=>{let R=await i(T,D),l=y[D.start??""],p=y[D.end??""];if(l&&p){let d=O.edges.find((A)=>A.id===D.id);if(d){u.debug("APA01 positionedEdge",d);let A={...D},I=a(E,A,o,m.type,l,p,m.diagramId);c(A,I)}else{let A={...D,points:[{x:l.x||0,y:l.y||0},{x:p.x||0,y:p.y||0}]},I=a(E,A,o,m.type,l,p,m.diagramId);c(A,I)}}})),u.debug("Cose-bilkent rendering completed")},"render"),Lt=pt;export{Lt as render};
@@ -0,0 +1 @@
1
+ import{ni}from"./index-tb1wf525.js";export{ni as createCynefinServices};
@@ -0,0 +1,62 @@
1
+ import{R}from"./index-353m7b0p.js";import{e,t,j,x,u,k,d,f,p,m,g,b,v,A,E}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{D}from"./index-tb1wf525.js";var xt=e(()=>({domains:new Map,transitions:[]}),"createDefaultData"),at=xt(),Mt=e(()=>at.domains,"getDomains"),zt=e(()=>at.transitions,"getTransitions"),Lt=e((n)=>{if(!n)return;for(let o of n){let a=o.domain,r=(o.items??[]).map((l)=>({label:l.label}));at.domains.set(a,{name:a,items:r})}},"setDomains"),Nt=e((n)=>{if(!n)return;at.transitions=n.filter((o)=>{if(o.from===o.to)return t.warn(`Cynefin: self-loop transition on domain "${o.from}" is not meaningful and will be skipped.`),!1;return!0}).map((o)=>({from:o.from,to:o.to,label:o.label||void 0}))},"setTransitions"),Pt=e(()=>E({...x.cynefin,...u().cynefin}),"getConfig"),It=e(()=>{d(),at=xt()},"clear"),st={getDomains:Mt,getTransitions:zt,setDomains:Lt,setTransitions:Nt,getConfig:Pt,clear:It,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m},Wt=e((n)=>{R(n,st),st.setDomains(n.domains),st.setTransitions(n.transitions)},"populate"),Rt={parse:e(async(n)=>{let o=await D("cynefin",n);t.debug(o),Wt(o)},"parse")};function ot(n){let o=n+1831565813|0;return o=Math.imul(o^o>>>15,o|1),o^=o+Math.imul(o^o>>>7,o|61),((o^o>>>14)>>>0)/4294967296}e(ot,"seededRandom");function $t(n){let o=0;for(let a=0;a<n.length;a++){let r=n.charCodeAt(a);o=(o<<5)-o+r,o|=0}return o}e($t,"hashString");function bt(n,o){if(typeof n==="number"&&Number.isFinite(n)&&n!==0)return n;return $t(o)}e(bt,"resolveSeed");function wt(n,o,a,r){let l=n/2,C=r??n*0.015,rt=7,J=o/7,h=[];for(let i=0;i<=7;i++){let T=ot(a+i*17)*C*2-C;h.push({x:l+T,y:i*J})}let F=`M${h[0].x},${h[0].y}`;for(let i=0;i<h.length-1;i++){let T=h[i],c=h[i+1],w=(T.y+c.y)/2,P=i%2===0?1:-1,M=C*1.5*P*ot(a+i*31+7),K=T.x+M,tt=w,et=c.x-M;F+=` C${K},${tt} ${et},${w} ${c.x},${c.y}`}return F}e(wt,"generateFoldPath");function Ct(n,o,a,r){let l=o/2,C=r??o*0.015,rt=7,J=n/7,h=[];for(let i=0;i<=7;i++){let T=ot(a+i*23)*C*2-C;h.push({x:i*J,y:l+T})}let F=`M${h[0].x},${h[0].y}`;for(let i=0;i<h.length-1;i++){let T=h[i],c=h[i+1],w=(T.x+c.x)/2,P=i%2===0?1:-1,M=C*1.5*P*ot(a+i*37+11),K=w,tt=T.y+M,et=w,X=c.y-M;F+=` C${K},${tt} ${et},${X} ${c.x},${c.y}`}return F}e(Ct,"generateHorizontalBoundary");function vt(n,o){let a=n/2,r=o*0.5,l=o,C=n*0.03;return[`M${a},${r}`,`C${a+C},${r+(l-r)*0.2}`,`${a-C*1.5},${r+(l-r)*0.55}`,`${a+C*0.5},${r+(l-r)*0.75}`,`C${a-C},${r+(l-r)*0.85}`,`${a+C*0.3},${r+(l-r)*0.95}`,`${a},${l}`].join(" ")}e(vt,"generateCliffPath");function Dt(n,o,a,r){return[`M${n-a},${o}`,`A${a},${r} 0 1,1 ${n+a},${o}`,`A${a},${r} 0 1,1 ${n-a},${o}`,"Z"].join(" ")}e(Dt,"generateConfusionPath");var ht={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Ft=e((n,o)=>{let a=n/2,r=o/2;return{complex:{cx:a/2,cy:r/2,x:0,y:0,w:a,h:r},complicated:{cx:a+a/2,cy:r/2,x:a,y:0,w:a,h:r},chaotic:{cx:a/2,cy:r+r/2,x:0,y:r,w:a,h:r},clear:{cx:a+a/2,cy:r+r/2,x:a,y:r,w:a,h:r},confusion:{cx:a,cy:r,x:a*0.7,y:r*0.7,w:a*0.6,h:r*0.6}}},"getDomainLayouts"),Vt=e(()=>{let n=j(),o=u();return E(n,o.themeVariables).cynefin},"getCynefinDomainColors"),dt=3,_t=e((n,o,a,r)=>{let l=r.db,C=l.getDomains(),rt=l.getTransitions(),J=l.getDiagramTitle(),h=l.getAccTitle(),F=l.getAccDescription(),i=l.getConfig(),T=Vt();t.debug("Rendering Cynefin diagram");let{width:c,height:w,padding:P,showDomainDescriptions:M,boundaryAmplitude:K}=i,tt=c+P*2,et=w+P*2,X={complex:T.complexBg,complicated:T.complicatedBg,clear:T.clearBg,chaotic:T.chaoticBg,confusion:T.confusionBg},V=A(o);if(k(V,et,tt,i.useMaxWidth??!0),V.attr("viewBox",`0 0 ${tt} ${et}`),h)V.append("title").text(h);if(F)V.append("desc").text(F);let _=V.append("g").attr("transform",`translate(${P}, ${P})`),nt=Ft(c,w),ft=bt(i.seed,o),kt=_.append("g").attr("class","cynefin-backgrounds"),ct=["complex","complicated","chaotic","clear"];for(let y of ct){let s=nt[y];kt.append("rect").attr("class","cynefinDomain").attr("x",s.x).attr("y",s.y).attr("width",s.w).attr("height",s.h).attr("fill",X[y]).attr("fill-opacity",0.4).attr("stroke","none")}let lt=_.append("g").attr("class","cynefin-boundaries");lt.append("path").attr("class","cynefinBoundary").attr("d",wt(c,w,ft,K)).attr("fill","none"),lt.append("path").attr("class","cynefinBoundary").attr("d",Ct(c,w,ft+100,K)).attr("fill","none"),lt.append("path").attr("class","cynefinCliff").attr("d",vt(c,w)).attr("fill","none");let Tt=c*0.15,At=w*0.15;_.append("path").attr("class","cynefinConfusion").attr("d",Dt(c/2,w/2,Tt,At)).attr("fill",X.confusion).attr("fill-opacity",0.5);let mt=_.append("g").attr("class","cynefin-labels");for(let y of ct){let s=nt[y];mt.append("text").attr("class","cynefinDomainLabel").attr("x",s.cx).attr("y",M?s.cy-30:s.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.charAt(0).toUpperCase()+y.slice(1))}if(mt.append("text").attr("class","cynefinDomainLabel").attr("x",c/2).attr("y",M?w/2-10:w/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),M){let y=_.append("g").attr("class","cynefin-subtitles");for(let s of ct){let S=nt[s],B=ht[s];y.append("text").attr("class","cynefinSubtitle").attr("x",S.cx).attr("y",S.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(B.model),y.append("text").attr("class","cynefinSubtitle").attr("x",S.cx).attr("y",S.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(B.practice)}y.append("text").attr("class","cynefinSubtitle").attr("x",c/2).attr("y",w/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(ht.confusion.practice)}let pt=_.append("g").attr("class","cynefin-items"),H=26,yt=10,Bt=["complex","complicated","chaotic","clear","confusion"];for(let y of Bt){let s=C.get(y);if(!s||s.items.length===0)continue;let S=nt[y],B=y==="confusion",q=s.items,U=0;if(B&&s.items.length>dt)U=s.items.length-dt,q=s.items.slice(0,dt);let G;if(B){let L=M?22:14;G=S.cy+L}else G=S.cy+(M?25:15);if([...q].forEach((L,Y)=>{let I=G+Y*(H+4),O=pt.append("g"),Q=O.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",H/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(L.label),N=L.label.length*7,z=Q.node();if(z&&typeof z.getBBox==="function"){let it=z.getBBox();if(it.width>0)N=it.width}let W=N+yt*2,Z=S.cx-W/2;O.attr("transform",`translate(${Z}, ${I})`),O.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",W).attr("height",H).attr("rx",4).attr("ry",4).attr("fill",X[y]).attr("fill-opacity",0.95),Q.attr("x",W/2).attr("y",H/2)}),U>0){let L=G+q.length*(H+4),Y=`+${U} more`,I=pt.append("g"),O=I.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",H/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(Y),Q=Y.length*7,N=O.node();if(N&&typeof N.getBBox==="function"){let Z=N.getBBox();if(Z.width>0)Q=Z.width}let z=Q+yt*2,W=S.cx-z/2;I.attr("transform",`translate(${W}, ${L})`),I.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",z).attr("height",H).attr("rx",4).attr("ry",4).attr("fill",X[y]).attr("fill-opacity",0.6),O.attr("x",z/2).attr("y",H/2)}}if(rt.length>0){let y=V.select("defs").empty()?V.append("defs"):V.select("defs"),s=`cynefin-arrow-${o}`;y.append("marker").attr("id",s).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");let S=_.append("g").attr("class","cynefin-arrows");rt.forEach((B)=>{let q=nt[B.from],U=nt[B.to];if(!q||!U)return;if(B.from===B.to){t.warn(`Cynefin renderer: skipping self-loop on domain "${B.from}"`);return}let{cx:G,cy:L}=q,{cx:Y,cy:I}=U,O=(G+Y)/2,Q=(L+I)/2,N=Y-G,z=I-L,W=Math.sqrt(N*N+z*z),Z=W*0.15,it=-z/W,St=N/W,ut=O+it*Z,gt=Q+St*Z;if(S.append("path").attr("class","cynefinArrowLine").attr("d",`M${G},${L} Q${ut},${gt} ${Y},${I}`).attr("fill","none").attr("marker-end",`url(#${s})`),B.label)S.append("text").attr("class","cynefinArrowLabel").attr("x",ut).attr("y",gt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(B.label)})}if(J)_.append("text").attr("class","cynefinTitle").attr("x",c/2).attr("y",-P/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(J)},"draw"),Et={draw:_t},Ht=e(()=>{let n=j(),o=u();return E(n,o.themeVariables).cynefin},"getCynefinTheme"),Gt=e(()=>{let n=Ht();return`
2
+ .cynefinDomain {
3
+ stroke: none;
4
+ }
5
+ .cynefinDomainLabel {
6
+ font-size: ${n.domainFontSize}px;
7
+ font-weight: bold;
8
+ fill: ${n.labelColor};
9
+ }
10
+ .cynefinSubtitle {
11
+ font-size: ${n.itemFontSize-1}px;
12
+ fill: ${n.textColor};
13
+ font-style: italic;
14
+ }
15
+ .cynefinItem {
16
+ fill-opacity: 0.95;
17
+ stroke: ${n.boundaryColor};
18
+ stroke-width: 1;
19
+ }
20
+ .cynefinItemText {
21
+ font-size: ${n.itemFontSize}px;
22
+ fill: ${n.textColor};
23
+ }
24
+ .cynefinItemOverflow {
25
+ fill-opacity: 0.6;
26
+ stroke: ${n.boundaryColor};
27
+ stroke-width: 1;
28
+ stroke-dasharray: 3 2;
29
+ }
30
+ .cynefinBoundary {
31
+ stroke: ${n.boundaryColor};
32
+ stroke-width: ${n.boundaryWidth};
33
+ stroke-dasharray: 6 3;
34
+ }
35
+ .cynefinCliff {
36
+ stroke: ${n.cliffColor};
37
+ stroke-width: ${n.cliffWidth};
38
+ }
39
+ .cynefinConfusion {
40
+ stroke: ${n.boundaryColor};
41
+ stroke-width: 1.5;
42
+ stroke-dasharray: 4 2;
43
+ }
44
+ .cynefinArrowLine {
45
+ stroke: ${n.arrowColor};
46
+ stroke-width: ${n.arrowWidth};
47
+ fill: none;
48
+ }
49
+ .cynefinArrowHead {
50
+ fill: ${n.arrowColor};
51
+ stroke: none;
52
+ }
53
+ .cynefinArrowLabel {
54
+ font-size: ${n.itemFontSize-1}px;
55
+ fill: ${n.textColor};
56
+ }
57
+ .cynefinTitle {
58
+ font-size: ${n.domainFontSize+2}px;
59
+ font-weight: bold;
60
+ fill: ${n.labelColor};
61
+ }
62
+ `},"styles"),Yt=Gt,Jt={parser:Rt,db:st,renderer:Et,styles:Yt};export{Jt as diagram};
@@ -0,0 +1,4 @@
1
+ import{e,t,r,Ne,C,ct,sn,Qe,Ui,on,yt,ln,Ft,Qn,Xt,Kt}from"./index-1r72hdzb.js";import{L}from"./index-fjtdggjn.js";import"./index-6qmsnxwy.js";import{rr}from"./index-rft2hcz5.js";import{qe,_,Dr,zt,Ii,Li}from"./index-0rk4gp1g.js";import"./index-d3b3gqe9.js";var P=e((s,n,p)=>Math.max(n,Math.min(p,s)),"clamp"),R=e((s="TB")=>{switch(s){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),B=e((s)=>s==="flowchart"||s==="flowchart-v2"||s==="stateDiagram","shouldMergeSelfLoopSegments"),T=e((s,n,p,w,g)=>{let d=[],l=new Set;if(p.forEach(({start:a,end:i})=>{if(a!==w)l.add(a);if(i!==w)l.add(i)}),l.forEach((a)=>{let i=s.node(a);if(typeof i?.x==="number"&&typeof i?.y==="number")d.push(i)}),d.length===0)p.forEach(({edge:a})=>{(a.points??[]).forEach((i)=>{if(typeof i?.x==="number"&&typeof i?.y==="number")d.push(i)})});if(d.length===0)return R(g);let h=d.reduce((a,i)=>({x:a.x+i.x/d.length,y:a.y+i.y/d.length}),{x:0,y:0}),u=h.x-n.x,f=h.y-n.y;if(Math.abs(u)>Math.abs(f))return u>0?"right":"left";if(Math.abs(f)>0)return f>0?"bottom":"top";return R(g)},"getSelfLoopSide"),k=e((s,n="top",p=0,w=0)=>{let g=s.x,d=s.y-p,l=s.width/2,h=s.height/2,u=Math.max(36,Math.min(100,s.width*0.8)),f=P(Math.max(w,s.width*0.35),36,u),a=P(Math.min(s.width,s.height)*0.45,24,48);switch(n){case"bottom":{let i=d+h;return[{x:g-f/2,y:i},{x:g-f/2,y:i+a},{x:g+f/2,y:i+a},{x:g+f/2,y:i}]}case"right":{let i=g+l;return[{x:i,y:d-f/2},{x:i+a,y:d-f/2},{x:i+a,y:d+f/2},{x:i,y:d+f/2}]}case"left":{let i=g-l;return[{x:i,y:d-f/2},{x:i-a,y:d-f/2},{x:i-a,y:d+f/2},{x:i,y:d+f/2}]}case"top":default:{let i=d-h;return[{x:g-f/2,y:i},{x:g-f/2,y:i-a},{x:g+f/2,y:i-a},{x:g+f/2,y:i}]}}},"getSelfLoopPoints"),O=e((s,n,p="top",w=0,g={})=>{let l=s.x,h=s.y-w,u=g.width??0,f=g.height??0;switch(p){case"bottom":return{x:l,y:Math.max(...n.map((a)=>a.y))+f/2+4};case"right":return{x:Math.max(...n.map((a)=>a.x))+u/2+4,y:h};case"left":return{x:Math.min(...n.map((a)=>a.x))-u/2-4,y:h};case"top":default:return{x:l,y:Math.min(...n.map((a)=>a.y))-f/2-4}}},"getSelfLoopLabelPosition"),A=e((s,n=0,{mergeSelfLoops:p=!0}={})=>{let w=new Map,g=[],d=s.graph()?.rankdir;return s.edges().forEach((l)=>{let h=s.edge(l);if(p&&h.selfLoop){let u=h.selfLoop.id;if(!w.has(u))w.set(u,[]);w.get(u).push({edge:h,start:l.v,end:l.w})}else g.push({edge:h,start:l.v,end:l.w})}),w.forEach((l)=>{if(l.length!==3){l.forEach((N)=>g.push(N));return}l.sort((N,c)=>N.edge.selfLoop.order-c.edge.selfLoop.order);let[h,u,f]=l,a=h.edge.originalEdge??u.edge.originalEdge??f.edge.originalEdge??u.edge,i=s.node(a.start);if(!i){l.forEach((N)=>g.push(N));return}let y={width:u.edge.width,height:u.edge.height},b=T(s,i,l,a.start,d),X=k(i,b,n,y.width??0),E=O(i,X,b,n,y),x={...u.edge,...a,id:a.id,points:X,start:a.start,end:a.end,x:E.x,y:E.y,width:y.width,height:y.height,labelStyle:u.edge.labelStyle,fromCluster:h.edge.fromCluster??u.edge.fromCluster??f.edge.fromCluster,toCluster:h.edge.toCluster??u.edge.toCluster??f.edge.toCluster};delete x.selfLoop,delete x.originalEdge,g.push({edge:x,start:x.start,end:x.end})}),g},"getEdgesToRender"),J=e(async(s,n,p,w,g,d)=>{t.warn("Graph in recursive render:XAX",qe(n),g);let l=n.graph().rankdir;t.trace("Dir in recursive render - dir:",l);let h=s.insert("g").attr("class","root");if(!n.nodes())t.info("No nodes found for",n);else t.info("Recursive render XXX",n.nodes());if(n.edges().length>0)t.info("Recursive edges",n.edge(n.edges()[0]));let u=h.insert("g").attr("class","clusters"),f=h.insert("g").attr("class","edgePaths"),a=h.insert("g").attr("class","edgeLabels"),i=h.insert("g").attr("class","nodes"),y=B(p);await Promise.all(n.nodes().map(async function(c){let o=n.node(c);if(g!==void 0){let m=JSON.parse(JSON.stringify(g.clusterData));if(t.trace(`Setting data for parent cluster XXX
2
+ Node.id = `,c,`
3
+ data=`,m.height,`
4
+ Parent cluster`,g.height),n.setNode(g.id,m),!n.parent(c))t.trace("Setting parent",c,g.id),n.setParent(c,g.id,m)}if(t.info("(Insert) Node XXX"+c+": "+JSON.stringify(n.node(c))),o?.clusterNode){t.info("Cluster identified XBX",c,o.width,n.node(c));let{ranksep:m,nodesep:S}=n.graph();o.graph.setGraph({...o.graph.graph(),ranksep:m+25,nodesep:S});let I=await J(i,o.graph,p,w,n.node(c),d),M=I.elem;C(o,M),o.diff=I.diff||0,t.info("New compound node after recursive render XAX",c,"width",o.width,"height",o.height),Ui(M,o)}else if(n.children(c).length>0)t.trace("Cluster - the non recursive path XBX",c,o.id,o,o.width,"Graph:",n),t.trace(zt(o.id,n)),_.set(o.id,{id:zt(o.id,n),node:o});else t.trace("Node - the non recursive path XAX",c,i,n.node(c),l),await Qe(i,n.node(c),{config:d,dir:l})})),await e(async()=>{let c=n.edges().map(async function(o){let m=n.edge(o.v,o.w,o.name);if(t.info("Edge "+o.v+" -> "+o.w+": "+JSON.stringify(o)),t.info("Edge "+o.v+" -> "+o.w+": ",o," ",JSON.stringify(n.edge(o))),t.info("Fix",_,"ids:",o.v,o.w,"Translating: ",_.get(o.v),_.get(o.w)),y&&m.selfLoop){if(m.selfLoop.order!==1)return;let S=m.id;m.id=m.selfLoop.id,await Ft(a,m),m.id=S;return}await Ft(a,m)});await Promise.all(c)},"processEdges")(),t.info("Graph before layout:",JSON.stringify(qe(n))),t.info("############################################# XXX"),t.info("### Layout ### XXX"),t.info("############################################# XXX"),rr(n),t.info("Graph after layout:",JSON.stringify(qe(n)));let X=0,{subGraphTitleTotalMargin:E}=Ne(d);await Promise.all(Li(n).map(async function(c){let o=n.node(c);if(t.info("Position XBX => "+c+": ("+o.x,","+o.y,") width: ",o.width," height: ",o.height),o?.clusterNode)o.y+=E,t.info("A tainted cluster node XBX1",c,o.id,o.width,o.height,o.x,o.y,n.parent(c)),_.get(o.id).node=o,yt(o);else if(n.children(c).length>0){t.info("A pure cluster node XBX1",c,o.id,o.x,o.y,o.width,o.height,n.parent(c)),o.height+=E,n.node(o.parentId);let m=o?.padding/2||0,S=o?.labelBBox?.height||0,I=S-m||0;t.debug("OffsetY",I,"labelHeight",S,"halfPadding",m),await ct(u,o),_.get(o.id).node=o}else{let m=n.node(o.parentId);o.y+=E/2,t.info("A regular node XBX1 - using the padding",o.id,"parent",o.parentId,o.width,o.height,o.x,o.y,"offsetY",o.offsetY,"parent",m,m?.offsetY,o),yt(o)}}));let x=E/2;return A(n,x,{mergeSelfLoops:y}).forEach(function({edge:c,start:o,end:m}){t.info("Edge "+o+" -> "+m+": "+JSON.stringify(c),c),c.points.forEach((G)=>G.y+=x);let S=n.node(o),I=n.node(m),M=Xt(f,c,_,p,S,I,w);Qn(c,M)}),n.nodes().forEach(function(c){let o=n.node(c);if(t.info(c,o.type,o.diff),o.isGroup)X=o.diff}),t.warn("Returning from recursive render XAX",h,X),{elem:h,diff:X}},"recursiveRender"),te=e(async(s,n)=>{let p=new L({multigraph:!0,compound:!0}).setGraph({rankdir:s.direction,nodesep:s.config?.nodeSpacing||s.config?.flowchart?.nodeSpacing||s.nodeSpacing,ranksep:s.config?.rankSpacing||s.config?.flowchart?.rankSpacing||s.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),w=n.select("g");Kt(w,s.markers,s.type,s.diagramId),on(),ln(),sn(),Dr(),s.nodes.forEach((d)=>{if(p.setNode(d.id,{...d}),d.parentId)p.setParent(d.id,d.parentId)}),t.debug("Edges:",s.edges),s.edges.forEach((d)=>{if(d.start===d.end){let l=d.start,h=l+"---"+l+"---1",u=l+"---"+l+"---2",f=p.node(l);p.setNode(h,{domId:h,id:h,parentId:f.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),p.setParent(h,f.parentId),p.setNode(u,{domId:u,id:u,parentId:f.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),p.setParent(u,f.parentId);let a=structuredClone(d),i=structuredClone(d),y=structuredClone(d),b=structuredClone(d);if(i.originalEdge=a,i.selfLoop={id:a.id,order:0},y.originalEdge=a,y.selfLoop={id:a.id,order:1},b.originalEdge=a,b.selfLoop={id:a.id,order:2},i.label="",i.arrowTypeEnd="none",i.endLabelLeft="",i.endLabelRight="",i.startLabelLeft="",i.id=l+"-cyclic-special-1",y.startLabelRight="",y.startLabelLeft="",y.endLabelLeft="",y.endLabelRight="",y.arrowTypeStart="none",y.arrowTypeEnd="none",y.id=l+"-cyclic-special-mid",b.label="",b.startLabelRight="",b.startLabelLeft="",b.arrowTypeStart="none",f.isGroup)i.fromCluster=l,b.toCluster=l;b.id=l+"-cyclic-special-2",b.arrowTypeStart="none",p.setEdge(l,h,i,l+"-cyclic-special-0"),p.setEdge(h,u,y,l+"-cyclic-special-1"),p.setEdge(u,l,b,l+"-cyclic-special-2")}else p.setEdge(d.start,d.end,{...d},d.id)}),t.warn("Graph at first:",JSON.stringify(qe(p))),Ii(p),t.warn("Graph after XAX:",JSON.stringify(qe(p)));let g=r();await J(w,p,s.type,s.diagramId,void 0,g)},"render");export{A as getEdgesToRender,te as render};
@@ -0,0 +1,30 @@
1
+ import{vt}from"./index-vv56h019.js";import{R}from"./index-353m7b0p.js";import{e,t,x,u,w,k,d,f,p,m,g,b,v,A,E,Bt,ke}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{D}from"./index-tb1wf525.js";var F=/[─━│┃└┗├┣]/,j=/[└┗├┣]/,te=/[─━]/,O=/^[\s│┃]+$/,G=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,Y=/^\s*%%/,ne=" ";function Z(i){return i.some((n)=>F.test(n))}e(Z,"isBoxDrawingFormat");function q(i){for(let n of i){let r=j.exec(n);if(r?.index&&r.index>0)return r.index}return 4}e(q,"inferSegmentWidth");function U(i,n){return i.replace(/\bline\s+(\d+)\b/gi,(r,o)=>{let s=parseInt(o,10),l=n.get(s);return l?`line ${l}`:r})}e(U,"remapErrorLines");function J(i){let n=i.split(`
2
+ `),r=new Map,o=-1;for(let[c,a]of n.entries())if(a.trim()==="treeView-beta"){o=c;break}if(o===-1)return{text:i,lineMap:r};let s=[];for(let c=o+1;c<n.length;c++){let a=n[c];if(a.trim()===""||Y.test(a)||G.test(a))continue;if(O.test(a))continue;s.push(a.replace(/\t/g," "))}if(!Z(s))return{text:i,lineMap:r};let l=q(s),h=[],I=0;for(let c=0;c<=o;c++)h.push(n[c]),I++,r.set(I,c+1);for(let c=o+1;c<n.length;c++){let a=n[c],y=a.trim(),B=c+1;if(y===""){h.push(a),I++,r.set(I,B);continue}if(Y.test(a)){h.push(a),I++,r.set(I,B);continue}if(G.test(a)){h.push(a),I++,r.set(I,B);continue}if(O.test(a))continue;let C=a.replace(/\t/g," "),N=j.exec(C);if(N?.index!==void 0){let V=N.index,S=Math.round(V/l)+1,T=V+1;while(T<C.length&&te.test(C[T]))T++;while(T<C.length&&C[T]===" ")T++;let _=C.slice(T).trimEnd();if(!_)throw Error(`Line ${B}: Empty node — expected a filename or directory name after the box-drawing prefix`);let ee=ne.repeat(S);h.push(ee+_),I++,r.set(I,B)}else if(/^[\s─━│┃└┗├┣]+$/.test(C))continue;else if(F.test(C))h.push(a),I++,r.set(I,B);else if(/^\s+/.test(C))throw Error(`Line ${B}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`);else h.push(a),I++,r.set(I,B)}return{text:h.join(`
3
+ `),lineMap:r}}e(J,"preprocessBoxDrawing");var L=new vt(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),re=e(()=>{L.reset(),d()},"clear"),ie=e(()=>L.records.stack[0],"getRoot"),oe=e(()=>L.records.cnt,"getCount"),se=x.treeView,ae=e(()=>E(se,u().treeView),"getConfig"),ce=e((i,n,r,o,s,l)=>{while(i<=L.records.stack[L.records.stack.length-1].level)L.records.stack.pop();let h={id:L.records.cnt++,level:i,name:n,nodeType:r,icon:s,cssClass:o,description:l,children:[]};L.records.stack[L.records.stack.length-1].children.push(h),L.records.stack.push(h)},"addNode"),le={clear:re,addNode:ce,getRoot:ie,getCount:oe,getConfig:ae,getAccTitle:p,getAccDescription:g,getDiagramTitle:v,setAccDescription:m,setAccTitle:f,setDiagramTitle:b},H=le,de=e((i)=>{R(i,H);for(let n of i.nodes){let r=typeof n.indent==="number"?n.indent:0,o=n.name,s=o.endsWith("/");if(s)o=o.slice(0,-1);let l=s?"directory":"file",h=n.classAnnotation||void 0,I=n.iconAnnotation,c=I!==void 0?I||"none":void 0,a=n.descAnnotation||void 0,y=a?w(a,u()):void 0;H.addNode(r,o,l,h,c,y)}},"populate"),he={parse:e(async(i)=>{let{text:n,lineMap:r}=J(i);try{let o=await D("treeView",n);t.debug(o),de(o)}catch(o){if(r.size>0&&o instanceof Error)o.message=U(o.message,r);throw o}},"parse")},M={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function K(i,n){let r=n?.filenameIcons?.[i];if(r)return r;let o=i.lastIndexOf(".");if(o>0){let s=i.substring(o).toLowerCase(),l=n?.extensionIcons;return l?.[s]??l?.[s.slice(1)]}return}e(K,"detectIcon");function z(i,n){if(i.includes(":"))return i;if(i in M.icons||!n)return`${M.prefix}:${i}`;return`${n}:${i}`}e(z,"qualifyIcon");function X(i,n){if(i.icon==="none")return;if(i.icon)return z(i.icon,n.defaultIconPack);if(!n.showIcons)return;if(i.nodeType==="file"){let r=K(i.name,n);if(r==="none")return;if(r)return z(r,n.defaultIconPack)}return`${M.prefix}:${i.nodeType==="directory"?"folder":"file"}`}e(X,"getNodeIcon");Bt([{name:M.prefix,icons:M}]);var W=14,pe=4,fe=16,Q=e((i,n)=>`tv-icon-${i}-${n.replace(/[^\w-]/g,"-")}`,"iconSymbolId"),ge=e(async(i,n,r,o)=>{let s=new Set,l=e((c)=>{let a=X(c,r);if(a)s.add(a);c.children.forEach(l)},"collect");if(l(n),s.size===0)return;let h=await Promise.all([...s].map(async(c)=>({icon:c,svg:await ke(c,{height:W,width:W})}))),I=i.append("defs");for(let{icon:c,svg:a}of h)I.append("g").attr("id",Q(o,c)).html(a)},"injectIconDefs"),ue=e((i,n,r,o,s,l)=>{let h=o.append("g"),I="treeView-node-label";if(r.nodeType==="directory")I+=" treeView-node-dir";if(r.cssClass)I+=` ${r.cssClass}`;let c=W+pe,a=X(r,s),y=a!==void 0;if(a)h.append("use").attr("xlink:href",`#${Q(l,a)}`).attr("x",i+s.paddingX).attr("y",n+s.paddingY).attr("class","treeView-node-icon");let B=h.append("text").text(r.name).attr("dominant-baseline","middle").attr("class",I),{height:C,width:N}=B.node().getBBox(),V=C+s.paddingY*2,S=i+s.paddingX+(y?c:0);B.attr("x",S),B.attr("y",n+V/2);let T=S+N,_=N+s.paddingX*2+(y?c:0);if(r.BBox={x:i,y:n,width:_,height:V},r.cssClass?.split(/\s+/).includes("highlight"))h.insert("rect",":first-child").attr("x",i).attr("y",n+1).attr("width",0).attr("height",V-2).attr("rx",3).attr("class","treeView-highlight-bg");return{node:r,nodeGroup:h,labelRightEdge:T,centerY:n+V/2}},"positionLabel"),P=e((i,n,r,o,s,l)=>i.append("line").attr("x1",n).attr("y1",r).attr("x2",o).attr("y2",s).attr("stroke-width",l).attr("class","treeView-node-line"),"positionLine"),me=e((i,n,r,o)=>{let s=0,l=0,h=[],I=e((y,B,C,N)=>{let V=N*(C.rowIndent+C.paddingX),S=ue(V,s,B,y,C,o);h.push(S);let{height:T,width:_}=B.BBox;P(y,V-C.rowIndent,s+T/2,V,s+T/2,C.lineThickness),l=Math.max(l,V+_),s+=T},"drawNode"),c=e((y,B=0)=>{I(i,y,r,B),y.children.forEach((S)=>{c(S,B+1)});let{x:C,y:N,height:V}=y.BBox;if(y.children.length){let{y:S,height:T}=y.children[y.children.length-1].BBox;P(i,C+r.paddingX,N+V,C+r.paddingX,S+T/2+r.lineThickness/2,r.lineThickness)}},"processNode");c(n);let a=h.filter((y)=>y.node.description);if(a.length>0){let B=Math.max(...h.map((C)=>C.labelRightEdge))+fe;for(let C of a){let V=C.nodeGroup.append("text").text(C.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",B).attr("y",C.centerY).node().getBBox();l=Math.max(l,B+V.width+r.paddingX)}}for(let y of h)if(y.node.cssClass?.split(/\s+/).includes("highlight")){let B=y.nodeGroup.select(".treeView-highlight-bg");if(!B.empty()){let C=l-y.node.BBox.x+8;B.attr("width",C),l=Math.max(l,y.node.BBox.x+C+2)}}return{totalHeight:s,totalWidth:l}},"drawTree"),we=e(async(i,n,r,o)=>{t.debug(`Rendering treeView diagram
4
+ `+i);let s=o.db,l=s.getRoot(),h=s.getConfig(),I=A(n);await ge(I,l,h,n);let c=I.append("g");c.attr("class","tree-view");let{totalHeight:a,totalWidth:y}=me(c,l,h,n);I.attr("viewBox",`-${h.lineThickness/2} 0 ${y} ${a}`),k(I,a,y,h.useMaxWidth)},"draw"),xe={draw:we},ve=xe,be={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ie=e(({treeView:i})=>{let{labelFontSize:n,labelColor:r,lineColor:o,iconColor:s,descriptionColor:l,highlightBg:h,highlightStroke:I}=E(be,i);return`
5
+ .treeView-node-label {
6
+ font-size: ${n};
7
+ fill: ${r};
8
+ white-space: pre;
9
+ }
10
+ .treeView-node-dir {
11
+ font-weight: bold;
12
+ }
13
+ .treeView-node-line {
14
+ stroke: ${o};
15
+ }
16
+ .treeView-node-icon {
17
+ color: ${s};
18
+ }
19
+ .treeView-node-description {
20
+ font-size: ${n};
21
+ fill: ${l};
22
+ font-style: italic;
23
+ white-space: pre;
24
+ }
25
+ .treeView-highlight-bg {
26
+ fill: ${h};
27
+ stroke: ${I};
28
+ stroke-width: 1;
29
+ }
30
+ `},"styles"),Ce=Ie,Se={db:H,renderer:ve,parser:he,styles:Ce};export{Se as diagram};
@@ -0,0 +1,3 @@
1
+ import{R}from"./index-353m7b0p.js";import{e,t,x,u,w,d,f,p,m,g,b,v,r,yr,n,$t,nn,E}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{Lr,D}from"./index-tb1wf525.js";var V="position frame",X="frame positioned",I="position relation",j="relation positioned",pe=e(function(i){t.debug("options str",i)},"setOptions"),be=e(function(){return{}},"getOptions"),ve=e(function(){Y(),d()},"clear");function Y(){U={}}e(Y,"reset");var we=x.eventmodeling,ye=e(()=>E({...we,...u().eventmodeling}),"getConfig"),U={};function z(){let i=Pe,{ast:o}=U,a=_();if(!o)throw Error("No data for EventModel");return o.frames.forEach((s,l)=>{let c=te(s,o.dataEntities,a);i=C(i,{$kind:V,index:l,frame:s,textProps:c});let y=void 0;if(se(s))t.debug("source frame",s.sourceFrames),y=o.frames.filter((P)=>s.sourceFrames.some((S)=>S.$refText===P.name)),y.forEach((P)=>{i=C(i,{$kind:I,index:l,frame:s,sourceFrame:P})});else i=C(i,{$kind:I,index:l,frame:s})}),i={...i,sortedSwimlanesArray:G(i.swimlanes)},i}e(z,"getState");function K(i){U.ast=i}e(K,"setAst");var h={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function _(){return h}e(_,"getDiagramProps");var Pe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function q(i){let o=i.split(".");if(o.length===2)return o[0];return}e(q,"extractNamespace");function J(i){let o=i.split(".");if(o.length===2)return o[1];return i}e(J,"extractName");function Q(i,o){if(!o||o.length===0)return;return Object.values(i).find((a)=>a.namespace===o)}e(Q,"findSwimlaneByNamespace");function N(i,o,a){return Math.max(o,...Object.keys(i).filter((s)=>{let l=Number.parseInt(s);return l>o&&l<a}).map((s)=>Number.parseInt(s)))+1}e(N,"findNextAvailableIndex");function Z(i,o){let a=q(i.entityIdentifier),s=Q(o,a);switch(i.modelEntityType){case"ui":case"pcr":case"processor":if(s)return{index:s.index,label:s.namespace||h.labelUiAutomation};else if(a)return{index:N(o,0,100),label:h.labelUiAutomationPrefix+a};return{index:0,label:h.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":if(s)return{index:s.index,label:s.namespace||h.labelCommandReadModel};else if(a)return{index:N(o,100,200),label:h.labelCommandReadModelPrefix+a};return{index:100,label:h.labelCommandReadModel};case"evt":case"event":default:if(s)return{index:s.index,label:s.namespace||h.labelEvents};else if(a)return{index:N(o,200,300),label:h.labelEventsPrefix+a};return{index:200,label:h.labelEvents}}}e(Z,"calculateSwimlaneProps");function ee(i){let{themeVariables:o}=u();switch(i.modelEntityType){case"ui":return{fill:o.emUiFill??"white",stroke:o.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:o.emProcessorFill??"#edb3f6",stroke:o.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:o.emReadModelFill??"#d3f1a2",stroke:o.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:o.emCommandFill??"#bcd6fe",stroke:o.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:o.emEventFill??"#ffb778",stroke:o.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}e(ee,"calculateEntityVisualProps");function te(i,o,a){let s=u(),l=w(J(i.entityIdentifier)??"",s),c,y={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"},S=`<b>${$t(l,a.textMaxWidth,y)}</b>`;if(i.dataInlineValue)c=i.dataInlineValue,c=c.substring(c.indexOf("{")+1),c=c.substring(0,c.lastIndexOf("}")-1),c=w(c,s),c=$t(c,a.textMaxWidth,y),c=c.replaceAll(" ","&nbsp;");if(i.dataReference){let T=o.find((O)=>O.name===i.dataReference?.$refText);if(T)c=T.dataBlockValue,c=c.substring(c.indexOf(`{
2
+ `)+2),c=c.substring(0,c.lastIndexOf("}")-1),c=w(c,s),c=$t(c,a.textMaxWidth,y),c=c.replaceAll(" ","&nbsp;"),c+="<br/>"}let M=c!==void 0;if(M)S+=`<br/><br/><code style="text-align: left; display: block;max-width:${a.textMaxWidth}px">${c}</code>`;let F={fontSize:y.fontSize,fontWeight:y.fontWeight,fontFamily:y.fontFamily},k=nn(S,F),A=M?k.width/3:k.width,B={content:S,width:A,height:k.height};return t.debug(`[${i.name}] ${i.entityIdentifier} text`,B),B}e(te,"calculateTextProps");function ne(i,o){let a=o,s=ee(a.frame),l={width:a.textProps.width+2*h.boxTextPadding,height:a.textProps.height+2*h.boxTextPadding};return[{$kind:X,frame:a.frame,index:a.index,visual:s,dimension:l,textProps:a.textProps}]}e(ne,"decidePositionFrame");function ie(i,o,a){if(o===void 0)return h.contentStartX;if(o.index===i.index&&i.r)return i.r+h.boxPadding;if(a===void 0)return h.contentStartX;return a.r-h.boxOverlap+h.boxPadding}e(ie,"calculateX");function re(i,o){let a=[...i.map((s)=>s.r),o];return Math.max(...a)}e(re,"calculateMaxRight");function G(i){return Object.values(i).sort((o,a)=>o.index-a.index)}e(G,"sortedSwimlanesArray");function ae(i,o){let a=o,s=Z(a.frame,i.swimlanes),l;if(s.index in i.swimlanes)l=i.swimlanes[s.index];else l={index:s.index,label:s.label,r:0,y:s.index*h.swimlaneMinHeight+h.swimlaneGap,height:h.swimlaneMinHeight,maxHeight:h.swimlaneMinHeight};let c=i.boxes.length>0?i.boxes[i.boxes.length-1]:void 0,y=i.previousSwimlaneNumber!==void 0?i.swimlanes[i.previousSwimlaneNumber]:void 0,P={width:Math.max(h.boxMinWidth,Math.min(h.boxMaxWidth,a.dimension.width))+2*h.boxPadding,height:Math.max(h.boxMinHeight,Math.min(h.boxMaxHeight,a.dimension.height))+2*h.boxPadding},S=ie(l,y,c),M=S+P.width+h.boxPadding,F=re(Object.values(i.swimlanes),M);l.r=S+P.width,l.maxHeight=Math.max(l.maxHeight,P.height),l.height=Math.max(h.swimlaneMinHeight,l.maxHeight)+2*h.swimlanePadding;let k={x:S,y:h.swimlanePadding+l.y,r:M,dimension:P,leftSibling:!1,swimlane:l,visual:a.visual,text:a.textProps.content,frame:a.frame,index:a.index},A={...i,boxes:[...i.boxes,k],swimlanes:{...i.swimlanes,[`${l.index}`]:l},previousSwimlaneNumber:s.index,previousFrame:a.frame,maxR:F},B=G(A.swimlanes);if(B.length>0)B[0].y=0;for(let T=1;T<B.length;T++){let O=B[T],L=B[T-1];O.y=L.y+L.height+h.swimlaneGap}return A}e(ae,"evolveFramePositioned");function oe(i,o){if(i===0&&o.sourceFrames.length===0)return!0;return!1}e(oe,"isFirstFrame");function se(i){return i.sourceFrames!==void 0&&i.sourceFrames!==null&&i.sourceFrames.length>0}e(se,"hasSourceFrame");function W(i,o){if(o===void 0||o===null)return;return i.find((a)=>a.frame.name===o.name)}e(W,"findBoxByFrame");function de(i,o,a){if(a<0)return;for(let s=a;s>=0;s--){let l=i[s];if(l.swimlane.index!==o)return l}return}e(de,"findBoxByLineIndex");function le(i,o){let a=o;if(Lr(a.frame)||oe(a.index,a.frame))return[];let s=W(i.boxes,a.frame);if(s===void 0)throw Error(`Target box not found for frame ${a.frame.name}`);let l;if(a.sourceFrame)l=W(i.boxes,a.sourceFrame);else l=de(i.boxes,s.swimlane.index,a.index-1);if(l===void 0)return[];return[{$kind:j,frame:a.frame,index:a.index,sourceBox:l,targetBox:s}]}e(le,"decidePositionRelation");function ce(i,o){let a=o,s={visual:{fill:"none",stroke:"#000"},source:{x:a.sourceBox.x,y:a.sourceBox.y},target:{x:a.targetBox.x,y:a.targetBox.y},sourceBox:a.sourceBox,targetBox:a.targetBox};return{...i,relations:[...i.relations,s]}}e(ce,"evolveRelationPositioned");var Se={[V]:ne,[I]:le},Me={[X]:ae,[j]:ce};function me(i,o){let a=Se[o.$kind];if(a===void 0||a===null)return[];let s=a(i,o);return t.debug("decided events",s),s}e(me,"decide");function ue(i,o){let a=o.reduce((s,l)=>{let c=Me[l.$kind];if(c===void 0||c===null)return s;return c(s,l)},i);return t.debug("evolve events",{state:i,newState:a,events:o}),a}e(ue,"evolve");function C(i,o){let a=me(i,o);return ue(i,a)}e(C,"dispatch");var H={getConfig:ye,setOptions:pe,getOptions:be,clear:ve,setAccTitle:f,getAccTitle:p,getAccDescription:g,setAccDescription:m,setDiagramTitle:b,getDiagramTitle:v,setAst:K,getDiagramProps:_,getState:z},ke={parse:e(async(i)=>{let o=await D("eventmodeling",i);t.debug(o),H.setAst(o),R(o,H)},"parse")},Fe=r(),Be=Fe?.eventmodeling;function xe(i,o){return(a)=>{let s=a.swimlane.y+o.swimlanePadding,l=i.append("g").attr("class","em-box");l.append("rect").attr("x",a.x).attr("y",s).attr("rx","3").attr("width",a.dimension.width).attr("height",a.dimension.height).attr("stroke",a.visual.stroke).attr("fill",a.visual.fill),l.append("foreignObject").attr("x",a.x+o.boxPadding).attr("y",s+10).attr("width",a.dimension.width-2*o.boxPadding).attr("height",a.dimension.height-2*o.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(a.text)}}e(xe,"renderD3Box");function fe(i,o){return i>o}e(fe,"dirUpwards");function ge(i,o,a,s){return(l)=>{let c=l.sourceBox.swimlane.y+o.swimlanePadding,y=l.targetBox.swimlane.y+o.swimlanePadding,P=fe(c,y),S=l.sourceBox.x+l.sourceBox.dimension.width*2/3,M=l.targetBox.x+l.targetBox.dimension.width/3,F,k;if(t.debug(`rendering relation up=${P} for `,{sourceBox:l.sourceBox,targetBox:l.targetBox}),P)F=c,k=y+l.targetBox.dimension.height;else F=c+l.sourceBox.dimension.height,k=y;let A=s.emRelationStroke??l.visual.stroke;i.append("path").attr("class","em-relation").attr("fill",l.visual.fill).attr("stroke",A).attr("stroke-width","1").attr("marker-end",`url(#${a})`).attr("d",`M${S} ${F} L${M} ${k}`)}}e(ge,"renderD3Relation");function he(i,o,a,s){return(l)=>{let c=i.append("g").attr("class","em-swimlane"),y=s.emSwimlaneBackgroundOdd??"rgb(250,250,250)",P=s.emSwimlaneBackgroundStroke??"rgb(240,240,240)";c.append("rect").attr("x",0).attr("y",l.y).attr("rx","3").attr("width",o+a.swimlanePadding).attr("height",l.height).attr("fill",y).attr("stroke",P),c.append("text").attr("font-weight",a.swimlaneTextFontWeight).attr("x",30).attr("y",l.y+30).text(l.label)}}e(he,"renderD3Swimlane");var Ee=e(function(i,o,a,s){if(t.debug("in eventmodeling renderer",i+`
3
+ `,"id:",o,a),!Be)throw Error("EventModeling config not found");let l=s.db,{themeVariables:c,eventmodeling:y}=r(),P=n(`[id="${o}"]`),S=l.getDiagramProps(),M=l.getState(),F=`em-arrowhead-${o}`,k=c.emArrowhead??"#000000";M.sortedSwimlanesArray.forEach(he(P,M.maxR,S,c)),M.boxes.forEach(xe(P,S)),M.relations.forEach(ge(P,S,F,c)),P.append("defs").append("marker").attr("id",F).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",k),yr(void 0,P,y?.padding??30,y?.useMaxWidth)},"draw"),Ae={draw:Ee},Re=e((i)=>"","getStyles"),Te=Re,Ue={parser:ke,db:H,renderer:Ae,styles:Te};export{Ue as diagram};
@@ -0,0 +1,24 @@
1
+ import{R}from"./index-353m7b0p.js";import{e,t,x,u,k,d,f,p,m,g,b,v,A,E}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{D}from"./index-tb1wf525.js";var N=x.packet,z=class{constructor(){this.packet=[],this.setAccTitle=f,this.getAccTitle=p,this.setDiagramTitle=b,this.getDiagramTitle=v,this.getAccDescription=g,this.setAccDescription=m}static{e(this,"PacketDB")}getConfig(){let r=E({...N,...u().packet});if(r.showBits)r.paddingY+=10;return r}getPacket(){return this.packet}pushWord(r){if(r.length>0)this.packet.push(r)}clear(){d(),this.packet=[]}},L=1e4,M=e((r,a)=>{R(r,a);let i=-1,s=[],c=1,{bitsPerRow:h}=a.getConfig();for(let{start:o,end:l,bits:y,label:w}of r.blocks){if(o!==void 0&&l!==void 0&&l<o)throw Error(`Packet block ${o} - ${l} is invalid. End must be greater than start.`);if(o??=i+1,o!==i+1)throw Error(`Packet block ${o} - ${l??o} is not contiguous. It should start from ${i+1}.`);if(y===0)throw Error(`Packet block ${o} is invalid. Cannot have a zero bit field.`);l??=o+(y??1)-1,y??=l-o+1,i=l,t.debug(`Packet block ${o} - ${i} with label ${w}`);while(s.length<=h+1&&a.getPacket().length<L){let[B,n]=Y({start:o,end:l,bits:y,label:w},c,h);if(s.push(B),B.end+1===c*h)a.pushWord(s),s=[],c++;if(!n)break;({start:o,end:l,bits:y,label:w}=n)}}a.pushWord(s)},"populate"),Y=e((r,a,i)=>{if(r.start===void 0)throw Error("start should have been set during first phase");if(r.end===void 0)throw Error("end should have been set during first phase");if(r.start>r.end)throw Error(`Block start ${r.start} is greater than block end ${r.end}.`);if(r.end+1<=a*i)return[r,void 0];let s=a*i-1,c=a*i;return[{start:r.start,end:s,label:r.label,bits:s-r.start},{start:c,end:r.end,label:r.label,bits:r.end-c}]},"getNextFittingBlock"),F={parser:{yy:void 0},parse:e(async(r)=>{let a=await D("packet",r),i=F.parser?.yy;if(!(i instanceof z))throw Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");t.debug(a),M(a,i)},"parse")},I=e((r,a,i,s)=>{let c=s.db,h=c.getConfig(),{rowHeight:o,paddingY:l,bitWidth:y,bitsPerRow:w}=h,B=c.getPacket(),n=c.getDiagramTitle(),S=o+l,C=S*(B.length+1)-(n?0:o),T=y*w+2,P=A(a);P.attr("viewBox",`0 0 ${T} ${C}`),k(P,C,T,h.useMaxWidth);for(let[W,_]of B.entries())O(P,_,W,h);P.append("text").text(n).attr("x",T/2).attr("y",C-S/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=e((r,a,i,{rowHeight:s,paddingX:c,paddingY:h,bitWidth:o,bitsPerRow:l,showBits:y})=>{let w=r.append("g"),B=i*(s+h)+h;for(let n of a){let S=n.start%l*o+1,C=(n.end-n.start+1)*o-c;if(w.append("rect").attr("x",S).attr("y",B).attr("width",C).attr("height",s).attr("class","packetBlock"),w.append("text").attr("x",S+C/2).attr("y",B+s/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(n.label),!y)continue;let T=n.end===n.start,P=B-2;if(w.append("text").attr("x",S+(T?C/2:0)).attr("y",P).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",T?"middle":"start").text(n.start),!T)w.append("text").attr("x",S+C).attr("y",P).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(n.end)}},"drawWord"),j={draw:I},G={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},H=e(({packet:r}={})=>{let a=E(G,r);return`
2
+ .packetByte {
3
+ font-size: ${a.byteFontSize};
4
+ }
5
+ .packetByte.start {
6
+ fill: ${a.startByteColor};
7
+ }
8
+ .packetByte.end {
9
+ fill: ${a.endByteColor};
10
+ }
11
+ .packetLabel {
12
+ fill: ${a.labelColor};
13
+ font-size: ${a.labelFontSize};
14
+ }
15
+ .packetTitle {
16
+ fill: ${a.titleColor};
17
+ font-size: ${a.titleFontSize};
18
+ }
19
+ .packetBlock {
20
+ stroke: ${a.blockStrokeColor};
21
+ stroke-width: ${a.blockStrokeWidth};
22
+ fill: ${a.blockFillColor};
23
+ }
24
+ `},"styles"),Z={parser:F,get db(){return new z},renderer:j,styles:H};export{Z as diagram};
@@ -0,0 +1,24 @@
1
+ import{R}from"./index-353m7b0p.js";import{e,t,j,x,u,k,d,f,p,m,g,b,v,n,A,Yr,y,E}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{We}from"./index-5tv8v1hk.js";import{D}from"./index-tb1wf525.js";import{pe}from"./index-gf4e0et4.js";import{J}from"./index-3cy1bzwh.js";function Ze(a){var l=0,o=a.children,s=o&&o.length;if(!s)l=1;else while(--s>=0)l+=o[s].value;a.value=l}function xe(){return this.eachAfter(Ze)}function Se(a,l){let o=-1;for(let s of this)a.call(l,s,++o,this);return this}function ve(a,l){var o=this,s=[o],i,S,C=-1;while(o=s.pop())if(a.call(l,o,++C,this),i=o.children)for(S=i.length-1;S>=0;--S)s.push(i[S]);return this}function be(a,l){var o=this,s=[o],i=[],S,C,T,_=-1;while(o=s.pop())if(i.push(o),S=o.children)for(C=0,T=S.length;C<T;++C)s.push(S[C]);while(o=i.pop())a.call(l,o,++_,this);return this}function we(a,l){let o=-1;for(let s of this)if(a.call(l,s,++o,this))return s}function Ce(a){return this.eachAfter(function(l){var o=+a(l.data)||0,s=l.children,i=s&&s.length;while(--i>=0)o+=s[i].value;l.value=o})}function Te(a){return this.eachBefore(function(l){if(l.children)l.children.sort(a)})}function Le(a){var l=this,o=Ue(l,a),s=[l];while(l!==o)l=l.parent,s.push(l);var i=s.length;while(a!==o)s.splice(i,0,a),a=a.parent;return s}function Ue(a,l){if(a===l)return a;var o=a.ancestors(),s=l.ancestors(),i=null;a=o.pop(),l=s.pop();while(a===l)i=a,a=o.pop(),l=s.pop();return i}function $e(){var a=this,l=[a];while(a=a.parent)l.push(a);return l}function Ae(){return Array.from(this)}function Fe(){var a=[];return this.eachBefore(function(l){if(!l.children)a.push(l)}),a}function Ne(){var a=this,l=[];return a.each(function(o){if(o!==a)l.push({source:o.parent,target:o})}),l}function*ke(){var a=this,l,o=[a],s,i,S;do{l=o.reverse(),o=[];while(a=l.pop())if(yield a,s=a.children)for(i=0,S=s.length;i<S;++i)o.push(s[i])}while(o.length)}function le(a,l){if(a instanceof Map){if(a=[void 0,a],l===void 0)l=Qe}else if(l===void 0)l=Ke;var o=new de(a),s,i=[o],S,C,T,_;while(s=i.pop())if((C=l(s.data))&&(_=(C=Array.from(C)).length)){s.children=C;for(T=_-1;T>=0;--T)i.push(S=C[T]=new de(C[T])),S.parent=s,S.depth=s.depth+1}return o.eachBefore(tt)}function Je(){return le(this).eachBefore(et)}function Ke(a){return a.children}function Qe(a){return Array.isArray(a)?a[1]:null}function et(a){if(a.data.value!==void 0)a.value=a.data.value;a.data=a.data.data}function tt(a){var l=0;do a.height=l;while((a=a.parent)&&a.height<++l)}function de(a){this.data=a,this.depth=this.height=0,this.parent=null}de.prototype=le.prototype={constructor:de,count:xe,each:Se,eachAfter:be,eachBefore:ve,find:we,sum:Ce,sort:Te,path:Le,ancestors:$e,descendants:Ae,leaves:Fe,links:Ne,copy:Je,[Symbol.iterator]:ke};function Ee(a){if(typeof a!=="function")throw Error();return a}function oe(){return 0}function te(a){return function(){return a}}function Me(a){a.x0=Math.round(a.x0),a.y0=Math.round(a.y0),a.x1=Math.round(a.x1),a.y1=Math.round(a.y1)}function _e(a,l,o,s,i){var S=a.children,C,T=-1,_=S.length,w=a.value&&(s-l)/a.value;while(++T<_)C=S[T],C.y0=o,C.y1=i,C.x0=l,C.x1=l+=C.value*w}function ze(a,l,o,s,i){var S=a.children,C,T=-1,_=S.length,w=a.value&&(i-o)/a.value;while(++T<_)C=S[T],C.x0=l,C.x1=s,C.y0=o,C.y1=o+=C.value*w}var at=(1+Math.sqrt(5))/2;function rt(a,l,o,s,i,S){var C=[],T=l.children,_,w,L=0,W=0,c=T.length,B,V,P=l.value,F,z,Z,X,ae,ie,U;while(L<c){B=i-o,V=S-s;do F=T[W++].value;while(!F&&W<c);z=Z=F,ie=Math.max(V/B,B/V)/(P*a),U=F*F*ie,ae=Math.max(Z/U,U/z);for(;W<c;++W){if(F+=w=T[W].value,w<z)z=w;if(w>Z)Z=w;if(U=F*F*ie,X=Math.max(Z/U,U/z),X>ae){F-=w;break}ae=X}if(C.push(_={value:F,dice:B<V,children:T.slice(L,W)}),_.dice)_e(_,o,s,i,P?s+=V*F/P:S);else ze(_,o,s,P?o+=B*F/P:i,S);P-=F,L=W}return C}var Re=function a(l){function o(s,i,S,C,T){rt(l,s,i,S,C,T)}return o.ratio=function(s){return a((s=+s)>1?s:1)},o}(at);function me(){var a=Re,l=!1,o=1,s=1,i=[0],S=oe,C=oe,T=oe,_=oe,w=oe;function L(c){if(c.x0=c.y0=0,c.x1=o,c.y1=s,c.eachBefore(W),i=[0],l)c.eachBefore(Me);return c}function W(c){var B=i[c.depth],V=c.x0+B,P=c.y0+B,F=c.x1-B,z=c.y1-B;if(F<V)V=F=(V+F)/2;if(z<P)P=z=(P+z)/2;if(c.x0=V,c.y0=P,c.x1=F,c.y1=z,c.children){if(B=i[c.depth+1]=S(c)/2,V+=w(c)-B,P+=C(c)-B,F-=T(c)-B,z-=_(c)-B,F<V)V=F=(V+F)/2;if(z<P)P=z=(P+z)/2;a(c,V,P,F,z)}}return L.round=function(c){return arguments.length?(l=!!c,L):l},L.size=function(c){return arguments.length?(o=+c[0],s=+c[1],L):[o,s]},L.tile=function(c){return arguments.length?(a=Ee(c),L):a},L.padding=function(c){return arguments.length?L.paddingInner(c).paddingOuter(c):L.paddingInner()},L.paddingInner=function(c){return arguments.length?(S=typeof c==="function"?c:te(+c),L):S},L.paddingOuter=function(c){return arguments.length?L.paddingTop(c).paddingRight(c).paddingBottom(c).paddingLeft(c):L.paddingTop()},L.paddingTop=function(c){return arguments.length?(C=typeof c==="function"?c:te(+c),L):C},L.paddingRight=function(c){return arguments.length?(T=typeof c==="function"?c:te(+c),L):T},L.paddingBottom=function(c){return arguments.length?(_=typeof c==="function"?c:te(+c),L):_},L.paddingLeft=function(c){return arguments.length?(w=typeof c==="function"?c:te(+c),L):w},L}var He=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=f,this.getAccTitle=p,this.setDiagramTitle=b,this.getDiagramTitle=v,this.getAccDescription=g,this.setAccDescription=m}static{e(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let a=x,l=u();return E({...a.treemap,...l.treemap??{}})}addNode(a,l){if(this.nodes.push(a),this.levels.set(a,l),l===0)this.outerNodes.push(a),this.root??=a}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,l){let o=this.classes.get(a)??{id:a,styles:[],textStyles:[]},s=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");if(s)s.forEach((i)=>{if(Yr(i))if(o?.textStyles)o.textStyles.push(i);else o.textStyles=[i];if(o?.styles)o.styles.push(i);else o.styles=[i]});this.classes.set(a,o)}getClasses(){return this.classes}getStylesForClass(a){return this.classes.get(a)?.styles??[]}clear(){d(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function Ie(a){if(!a.length)return[];let l=[],o=[];return a.forEach((s)=>{let i={name:s.name,children:s.type==="Leaf"?void 0:[]};if(i.classSelector=s?.classSelector,s?.cssCompiledStyles)i.cssCompiledStyles=s.cssCompiledStyles;if(s.type==="Leaf"&&s.value!==void 0)i.value=s.value;while(o.length>0&&o[o.length-1].level>=s.level)o.pop();if(o.length===0)l.push(i);else{let S=o[o.length-1].node;if(S.children)S.children.push(i);else S.children=[i]}if(s.type!=="Leaf")o.push({node:i,level:s.level})}),l}e(Ie,"buildHierarchy");var nt=e((a,l)=>{R(a,l);let o=[];for(let S of a.TreemapRows??[])if(S.$type==="ClassDefStatement")l.addClass(S.className??"",S.styleText??"");for(let S of a.TreemapRows??[]){let C=S.item;if(!C)continue;let T=S.indent?parseInt(S.indent):0,_=lt(C),w=C.classSelector?l.getStylesForClass(C.classSelector):[],L=w.length>0?w:void 0,W={level:T,name:_,type:C.$type,value:C.value,classSelector:C.classSelector,cssCompiledStyles:L};o.push(W)}let s=Ie(o),i=e((S,C)=>{for(let T of S)if(l.addNode(T,C),T.children&&T.children.length>0)i(T.children,C+1)},"addNodesRecursively");i(s,0)},"populate"),lt=e((a)=>a.name?String(a.name):"","getItemName"),Oe={parser:{yy:void 0},parse:e(async(a)=>{try{let o=await D("treemap",a);t.debug("Treemap AST:",o);let s=Oe.parser?.yy;if(!(s instanceof He))throw Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");nt(o,s)}catch(l){throw t.error("Error parsing treemap:",l),l}},"parse")},ot=10,se=10,ue=25,st=e((a,l,o,s)=>{let i=s.db,S=i.getConfig(),C=S.padding??ot,T=i.getDiagramTitle(),_=i.getRoot(),{themeVariables:w}=u();if(!_)return;let L=T?30:0,W=A(l),c=S.nodeWidth?S.nodeWidth*se:960,B=S.nodeHeight?S.nodeHeight*se:500,V=c,P=B+L;W.attr("viewBox",`0 0 ${V} ${P}`),k(W,P,V,S.useMaxWidth);let F;try{let r=S.valueFormat||",";if(r==="$0,0")F=e((h)=>"$"+We(",")(h),"valueFormat");else if(r.startsWith("$")&&r.includes(",")){let h=/\.\d+/.exec(r),N=h?h[0]:"";F=e((H)=>"$"+We(","+N)(H),"valueFormat")}else if(r.startsWith("$")){let h=r.substring(1);F=e((N)=>"$"+We(h||"")(N),"valueFormat")}else F=We(r)}catch(r){t.error("Error creating format function:",r),F=We(",")}let z=pe().range(["transparent",w.cScale0,w.cScale1,w.cScale2,w.cScale3,w.cScale4,w.cScale5,w.cScale6,w.cScale7,w.cScale8,w.cScale9,w.cScale10,w.cScale11]),Z=pe().range(["transparent",w.cScalePeer0,w.cScalePeer1,w.cScalePeer2,w.cScalePeer3,w.cScalePeer4,w.cScalePeer5,w.cScalePeer6,w.cScalePeer7,w.cScalePeer8,w.cScalePeer9,w.cScalePeer10,w.cScalePeer11]),X=pe().range([w.cScaleLabel0,w.cScaleLabel1,w.cScaleLabel2,w.cScaleLabel3,w.cScaleLabel4,w.cScaleLabel5,w.cScaleLabel6,w.cScaleLabel7,w.cScaleLabel8,w.cScaleLabel9,w.cScaleLabel10,w.cScaleLabel11]);if(T)W.append("text").attr("x",V/2).attr("y",L/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(T);let ae=W.append("g").attr("transform",`translate(0, ${L})`).attr("class","treemapContainer"),ie=le(_).sum((r)=>r.value??0).sort((r,h)=>(h.value??0)-(r.value??0)),De=me().size([c,B]).paddingTop((r)=>r.children&&r.children.length>0?ue+se:0).paddingInner(C).paddingLeft((r)=>r.children&&r.children.length>0?se:0).paddingRight((r)=>r.children&&r.children.length>0?se:0).paddingBottom((r)=>r.children&&r.children.length>0?se:0).round(!0)(ie),qe=De.descendants().filter((r)=>r.children&&r.children.length>0),ce=ae.selectAll(".treemapSection").data(qe).enter().append("g").attr("class","treemapSection").attr("transform",(r)=>`translate(${r.x0},${r.y0})`);if(ce.append("rect").attr("width",(r)=>r.x1-r.x0).attr("height",ue).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",0.6).attr("stroke-width",0.6).attr("style",(r)=>{if(r.depth===0)return"display: none;";return""}),ce.append("clipPath").attr("id",(r,h)=>`clip-section-${l}-${h}`).append("rect").attr("width",(r)=>Math.max(0,r.x1-r.x0-12)).attr("height",ue),ce.append("rect").attr("width",(r)=>r.x1-r.x0).attr("height",(r)=>r.y1-r.y0).attr("class",(r,h)=>`treemapSection section${h}`).attr("fill",(r)=>z(r.data.name)).attr("fill-opacity",0.6).attr("stroke",(r)=>Z(r.data.name)).attr("stroke-width",2).attr("stroke-opacity",0.4).attr("style",(r)=>{if(r.depth===0)return"display: none;";let h=y({cssCompiledStyles:r.data.cssCompiledStyles});return h.nodeStyles+";"+h.borderStyles.join(";")}),ce.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",ue/2).attr("dominant-baseline","middle").text((r)=>r.depth===0?"":r.data.name).attr("font-weight","bold").attr("clip-path",(r,h)=>`url(#clip-section-${l}-${h})`).attr("style",(r)=>{if(r.depth===0)return"display: none;";let h="dominant-baseline: middle; font-size: 12px; fill:"+X(r.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",N=y({cssCompiledStyles:r.data.cssCompiledStyles});return h+N.labelStyles.replace("color:","fill:")}).each(function(r){if(r.depth===0)return;let h=n(this),N=r.data.name;h.text(N);let H=r.x1-r.x0,O=6,I;if(S.showValues!==!1&&r.value){let G=H-10,ee=30,Ye=10;I=G-30-10-O}else I=H-O-6;let M=Math.max(15,I),Q=h.node();if(Q.getComputedTextLength()>M){let ee=N;while(ee.length>0){if(ee=N.substring(0,ee.length-1),ee.length===0){if(h.text("..."),Q.getComputedTextLength()>M)h.text("");break}if(h.text(ee+"..."),Q.getComputedTextLength()<=M)break}}}),S.showValues!==!1)ce.append("text").attr("class","treemapSectionValue").attr("x",(r)=>r.x1-r.x0-10).attr("y",ue/2).attr("text-anchor","end").attr("dominant-baseline","middle").text((r)=>r.value?F(r.value):"").attr("font-style","italic").attr("style",(r)=>{if(r.depth===0)return"display: none;";let h="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+X(r.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",N=y({cssCompiledStyles:r.data.cssCompiledStyles});return h+N.labelStyles.replace("color:","fill:")});let Ve=De.leaves(),Y=Ve.length>20,Ge=Y?16:38,fe=Y?14:28,re=Y?4:8,ne=Y?4:6,ge=Y?2:4,Pe=Y?8:10,ye=Y?1:2,he=ae.selectAll(".treemapLeafGroup").data(Ve).enter().append("g").attr("class",(r,h)=>`treemapNode treemapLeafGroup leaf${h}${r.data.classSelector?` ${r.data.classSelector}`:""}x`).attr("transform",(r)=>`translate(${r.x0},${r.y0})`);if(he.append("rect").attr("width",(r)=>r.x1-r.x0).attr("height",(r)=>r.y1-r.y0).attr("class","treemapLeaf").attr("fill",(r)=>r.parent?z(r.parent.data.name):z(r.data.name)).attr("style",(r)=>y({cssCompiledStyles:r.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",0.3).attr("stroke",(r)=>r.parent?z(r.parent.data.name):z(r.data.name)).attr("stroke-width",3),he.append("clipPath").attr("id",(r,h)=>`clip-${l}-${h}`).append("rect").attr("width",(r)=>Math.max(0,r.x1-r.x0-4)).attr("height",(r)=>Math.max(0,r.y1-r.y0-4)),he.append("text").attr("class","treemapLabel").attr("x",(r)=>(r.x1-r.x0)/2).attr("y",(r)=>(r.y1-r.y0)/2).attr("style",(r)=>{let h=`text-anchor: middle; dominant-baseline: middle; font-size: ${Ge}px;fill:`+X(r.data.name)+";",N=y({cssCompiledStyles:r.data.cssCompiledStyles});return h+N.labelStyles.replace("color:","fill:")}).attr("clip-path",(r,h)=>`url(#clip-${l}-${h})`).text((r)=>r.data.name).each(function(r){let h=n(this),N=r.x1-r.x0,H=r.y1-r.y0,O=h.node(),I=N-2*ge,K=H-2*ge;if(I<Pe||K<Pe){h.style("display","none");return}let M=parseInt(h.style("font-size"),10),Q=0.6;while(O.getComputedTextLength()>I&&M>re)M--,h.style("font-size",`${M}px`);let q=Math.max(ne,Math.min(fe,Math.round(M*Q))),G=M+ye+q;while(G>K&&M>re){if(M--,q=Math.max(ne,Math.min(fe,Math.round(M*Q))),q<ne&&M===re)break;if(h.style("font-size",`${M}px`),G=M+ye+q,q<=ne&&G>K);}if(h.style("font-size",`${M}px`),Y){if(M<re||K<re)h.style("display","none")}else if(O.getComputedTextLength()>I||M<re||K<M)h.style("display","none")}),S.showValues!==!1)he.append("text").attr("class","treemapValue").attr("x",(h)=>(h.x1-h.x0)/2).attr("y",function(h){return(h.y1-h.y0)/2}).attr("style",(h)=>{let N=`text-anchor: middle; dominant-baseline: hanging; font-size: ${fe}px;fill:`+X(h.data.name)+";",H=y({cssCompiledStyles:h.data.cssCompiledStyles});return N+H.labelStyles.replace("color:","fill:")}).attr("clip-path",(h,N)=>`url(#clip-${l}-${N})`).text((h)=>h.value?F(h.value):"").each(function(h){let N=n(this),H=this.parentNode;if(!H){N.style("display","none");return}let O=n(H).select(".treemapLabel");if(O.empty()||O.style("display")==="none"){N.style("display","none");return}let I=parseFloat(O.style("font-size")),M=Math.max(ne,Math.min(fe,Math.round(I*0.6)));N.style("font-size",`${M}px`);let q=(h.y1-h.y0)/2+I/2+ye;N.attr("y",q);let G=h.x1-h.x0,Be=h.y1-h.y0-4,je=G-2*ge;if(N.node().getComputedTextLength()>je||q+M>Be||M<ne)N.style("display","none");else N.style("display",null)});let Xe=S.diagramPadding??8;J(W,Xe,"flowchart",S?.useMaxWidth||!1)},"draw"),it=e(function(a,l){return l.db.getClasses()},"getClasses"),ct={draw:st,getClasses:it},pt={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},dt=e(({treemap:a}={})=>{let l=j(),o=u(),s=E(l,o.themeVariables),i=E(pt,a),S=i.titleColor??s.titleColor,C=i.labelColor??s.textColor,T=i.valueColor??s.textColor;return`
2
+ .treemapNode.section {
3
+ stroke: ${i.sectionStrokeColor};
4
+ stroke-width: ${i.sectionStrokeWidth};
5
+ fill: ${i.sectionFillColor};
6
+ }
7
+ .treemapNode.leaf {
8
+ stroke: ${i.leafStrokeColor};
9
+ stroke-width: ${i.leafStrokeWidth};
10
+ fill: ${i.leafFillColor};
11
+ }
12
+ .treemapLabel {
13
+ fill: ${C};
14
+ font-size: ${i.labelFontSize};
15
+ }
16
+ .treemapValue {
17
+ fill: ${T};
18
+ font-size: ${i.valueFontSize};
19
+ }
20
+ .treemapTitle {
21
+ fill: ${S};
22
+ font-size: ${i.titleFontSize};
23
+ }
24
+ `},"getStyles"),ut=dt,fa={parser:Oe,get db(){return new He},renderer:ct,styles:ut};export{fa as diagram};
@@ -0,0 +1,41 @@
1
+ import{R}from"./index-353m7b0p.js";import{e,t,j,x,u,k,d,f,p,m,g,b,v,A,E}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{D}from"./index-tb1wf525.js";var T={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},F=32,P={axes:[],curves:[],options:T},L=structuredClone(P),X=x.radar,K=e(()=>E({...X,...u().radar}),"getConfig"),z=e(()=>L.axes,"getAxes"),N=e(()=>L.curves,"getCurves"),Y=e(()=>L.options,"getOptions"),Z=e((n)=>{L.axes=n.map((a)=>({name:a.name,label:a.label??a.name}))},"setAxes"),q=e((n)=>{L.curves=n.map((a)=>({name:a.name,label:a.label??a.name,entries:J(a.entries)}))},"setCurves"),J=e((n)=>{if(n[0].axis==null)return n.map((r)=>r.value);let a=z();if(a.length===0)throw Error("Axes must be populated before curves for reference entries");return a.map((r)=>{let s=n.find((o)=>o.axis?.$refText===r.name);if(s===void 0)throw Error("Missing entry for axis "+r.label);return s.value})},"computeCurveEntries"),Q=e((n)=>{let a=n.reduce((r,s)=>(r[s.name]=s,r),{});if(L.options={showLegend:a.showLegend?.value??T.showLegend,ticks:a.ticks?.value??T.ticks,max:a.max?.value??T.max,min:a.min?.value??T.min,graticule:a.graticule?.value??T.graticule},L.options.ticks>F)t.warn(`Radar diagram ticks (${L.options.ticks}) exceeds maximum allowed (${F}). Using ${F} instead.`),L.options.ticks=F},"setOptions"),tt=e(()=>{d(),L=structuredClone(P)},"clear"),I={getAxes:z,getCurves:N,getOptions:Y,setAxes:Z,setCurves:q,setOptions:Q,getConfig:K,clear:tt,setAccTitle:f,getAccTitle:p,setDiagramTitle:b,getDiagramTitle:v,getAccDescription:g,setAccDescription:m},et=e((n)=>{R(n,I);let{axes:a,curves:r,options:s}=n;I.setAxes(a),I.setCurves(r),I.setOptions(s)},"populate"),at={parse:e(async(n)=>{let a=await D("radar",n);t.debug(a),et(a)},"parse")},rt=e((n,a,r,s)=>{let o=s.db,c=o.getAxes(),h=o.getCurves(),i=o.getOptions(),l=o.getConfig(),y=o.getDiagramTitle(),C=A(a),w=nt(C,l),M=i.max??Math.max(...h.map((_)=>Math.max(..._.entries))),S=i.min,O=Math.min(l.width,l.height)/2;st(w,c,O,i.ticks,i.graticule),ot(w,c,O,l),G(w,c,h,S,M,i.graticule,l),V(w,h,i.showLegend,l),w.append("text").attr("class","radarTitle").text(y).attr("x",0).attr("y",-l.height/2-l.marginTop)},"draw"),nt=e((n,a)=>{let r=a.width+a.marginLeft+a.marginRight,s=a.height+a.marginTop+a.marginBottom,o={x:a.marginLeft+a.width/2,y:a.marginTop+a.height/2};return k(n,s,r,a.useMaxWidth??!0),n.attr("viewBox",`0 0 ${r} ${s}`).attr("overflow","visible"),n.append("g").attr("transform",`translate(${o.x}, ${o.y})`)},"drawFrame"),st=e((n,a,r,s,o)=>{if(o==="circle")for(let c=0;c<s;c++){let h=r*(c+1)/s;n.append("circle").attr("r",h).attr("class","radarGraticule")}else if(o==="polygon"){let c=a.length;for(let h=0;h<s;h++){let i=r*(h+1)/s,l=a.map((y,C)=>{let w=2*C*Math.PI/c-Math.PI/2,M=i*Math.cos(w),S=i*Math.sin(w);return`${M},${S}`}).join(" ");n.append("polygon").attr("points",l).attr("class","radarGraticule")}}},"drawGraticule"),ot=e((n,a,r,s)=>{let o=a.length;for(let c=0;c<o;c++){let h=a[c].label,i=2*c*Math.PI/o-Math.PI/2,l=Math.cos(i),y=Math.sin(i);n.append("line").attr("x1",0).attr("y1",0).attr("x2",r*s.axisScaleFactor*l).attr("y2",r*s.axisScaleFactor*y).attr("class","radarAxisLine");let C=l>0.01?"start":l<-0.01?"end":"middle",w=y>0.01?"hanging":y<-0.01?"auto":"central",M=4;n.append("text").text(h).attr("x",r*s.axisLabelFactor*l+M*l).attr("y",r*s.axisLabelFactor*y+M*y).attr("text-anchor",C).attr("dominant-baseline",w).attr("class","radarAxisLabel")}},"drawAxes");function G(n,a,r,s,o,c,h){let i=a.length,l=Math.min(h.width,h.height)/2;r.forEach((y,C)=>{if(y.entries.length!==i)return;let w=y.entries.map((M,S)=>{let O=2*Math.PI*S/i-Math.PI/2,_=B(M,s,o,l),H=_*Math.cos(O),U=_*Math.sin(O);return{x:H,y:U}});if(c==="circle")n.append("path").attr("d",W(w,h.curveTension)).attr("class",`radarCurve-${C}`);else if(c==="polygon")n.append("polygon").attr("points",w.map((M)=>`${M.x},${M.y}`).join(" ")).attr("class",`radarCurve-${C}`)})}e(G,"drawCurves");function B(n,a,r,s){let o=Math.min(Math.max(n,a),r);return s*(o-a)/(r-a)}e(B,"relativeRadius");function W(n,a){let r=n.length,s=`M${n[0].x},${n[0].y}`;for(let o=0;o<r;o++){let c=n[(o-1+r)%r],h=n[o],i=n[(o+1)%r],l=n[(o+2)%r],y={x:h.x+(i.x-c.x)*a,y:h.y+(i.y-c.y)*a},C={x:i.x-(l.x-h.x)*a,y:i.y-(l.y-h.y)*a};s+=` C${y.x},${y.y} ${C.x},${C.y} ${i.x},${i.y}`}return`${s} Z`}e(W,"closedRoundCurve");function V(n,a,r,s){if(!r)return;let o=(s.width/2+s.marginRight)*3/4,c=-(s.height/2+s.marginTop)*3/4,h=20;a.forEach((i,l)=>{let y=n.append("g").attr("transform",`translate(${o}, ${c+l*h})`);y.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${l}`),y.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(i.label)})}e(V,"drawLegend");var it={draw:rt},lt=e((n,a)=>{let r="";for(let s=0;s<n.THEME_COLOR_LIMIT;s++){let o=n[`cScale${s}`];r+=`
2
+ .radarCurve-${s} {
3
+ color: ${o};
4
+ fill: ${o};
5
+ fill-opacity: ${a.curveOpacity};
6
+ stroke: ${o};
7
+ stroke-width: ${a.curveStrokeWidth};
8
+ }
9
+ .radarLegendBox-${s} {
10
+ fill: ${o};
11
+ fill-opacity: ${a.curveOpacity};
12
+ stroke: ${o};
13
+ }
14
+ `}return r},"genIndexStyles"),ct=e((n)=>{let a=j(),r=u(),s=E(a,r.themeVariables),o=E(s.radar,n);return{themeVariables:s,radarOptions:o}},"buildRadarStyleOptions"),dt=e(({radar:n}={})=>{let{themeVariables:a,radarOptions:r}=ct(n);return`
15
+ .radarTitle {
16
+ font-size: ${a.fontSize};
17
+ color: ${a.titleColor};
18
+ dominant-baseline: hanging;
19
+ text-anchor: middle;
20
+ }
21
+ .radarAxisLine {
22
+ stroke: ${r.axisColor};
23
+ stroke-width: ${r.axisStrokeWidth};
24
+ }
25
+ .radarAxisLabel {
26
+ font-size: ${r.axisLabelFontSize}px;
27
+ color: ${r.axisColor};
28
+ }
29
+ .radarGraticule {
30
+ fill: ${r.graticuleColor};
31
+ fill-opacity: ${r.graticuleOpacity};
32
+ stroke: ${r.graticuleColor};
33
+ stroke-width: ${r.graticuleStrokeWidth};
34
+ }
35
+ .radarLegendText {
36
+ text-anchor: start;
37
+ font-size: ${r.legendFontSize}px;
38
+ dominant-baseline: hanging;
39
+ }
40
+ ${lt(a,r)}
41
+ `},"styles"),$t={parser:at,db:I,renderer:it,styles:dt};export{$t as diagram};
@@ -0,0 +1 @@
1
+ import{e,t}from"./index-1r72hdzb.js";import"./index-6qmsnxwy.js";import{P,ze,Ge}from"./index-r2fyc9w1.js";import{R}from"./index-353m7b0p.js";import{Jt,Pe}from"./index-tb1wf525.js";var i=Jt().RailroadEbnf.parser.LangiumParser,o=e((r)=>{let n=r.alternatives.map(m);if(n.length===1)return n[0];return{type:"choice",alternatives:n}},"transformChoice"),m=e((r)=>{let n=r.elements.map(p);if(n.length===1)return n[0];return{type:"sequence",elements:n}},"transformSequence"),s=e((r)=>{switch(r.$type){case"EbnfTerminal":return{type:"terminal",value:r.value};case"EbnfNonTerminal":return{type:"nonterminal",name:r.name};case"EbnfSpecial":return{type:"special",text:r.text};case"EbnfGroup":return o(r.element);case"EbnfOptional":return{type:"optional",element:o(r.element)};case"EbnfRepetition":return{type:"repetition",element:o(r.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${r.$type}`)}},"transformPrimary"),l=e((r,n)=>{switch(n.$type){case"EbnfOptionalPostfix":return{type:"optional",element:r};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:r,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:r,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[r,{type:"terminal",value:"-"},s(n.except)]};default:throw Error(`Unsupported EBNF postfix node: ${n.$type}`)}},"transformPostfix"),p=e((r)=>r.postfixes.reduce((n,a)=>l(n,a),s(r.base)),"transformTerm"),f=e((r)=>({name:r.name,definition:o(r.definition)}),"transformRule"),u=e((r)=>{if(R(r,P),r.title)P.setTitle(r.title);r.rules.map((n)=>P.addRule(f(n)))},"populateDb"),c={parse:e((r)=>{P.clear(),t.debug("[EBNF Parser] Starting Langium parse");let n=i.parse(r);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new Pe(n);let a=n.value;t.debug("[EBNF Parser] Parsed rules:",a.rules.length),u(a),t.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:P}},h={parser:c,db:P,renderer:Ge,styles:ze};export{h as diagram};