khoj 2.0.0b16.dev0__py3-none-any.whl → 2.0.0b16.dev8__py3-none-any.whl

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 (132) hide show
  1. khoj/interface/compiled/404/index.html +2 -2
  2. khoj/interface/compiled/_next/static/chunks/02b2f66c-c89cf69943479389.js +53 -0
  3. khoj/interface/compiled/_next/static/chunks/1423.7b1e8bf760d28078.js +1 -0
  4. khoj/interface/compiled/_next/static/chunks/1585.3de407cd92842aed.js +55 -0
  5. khoj/interface/compiled/_next/static/chunks/1822.0cc2f58edae71bbb.js +56 -0
  6. khoj/interface/compiled/_next/static/chunks/1915-cf7bfb14d1d7c694.js +1 -0
  7. khoj/interface/compiled/_next/static/chunks/{2117-080746c8e170c81a.js → 2117-9da935e257b6d677.js} +1 -1
  8. khoj/interface/compiled/_next/static/chunks/2327-115eb57f8f41544b.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/2526.8ac62b527c9ab703.js +43 -0
  10. khoj/interface/compiled/_next/static/chunks/2626.2125083a1ff3b80a.js +29 -0
  11. khoj/interface/compiled/_next/static/chunks/2684-981c00094da80a42.js +20 -0
  12. khoj/interface/compiled/_next/static/chunks/273.c2bdf48df1dfc5ef.js +93 -0
  13. khoj/interface/compiled/_next/static/chunks/3.87fb50c162c65241.js +59 -0
  14. khoj/interface/compiled/_next/static/chunks/3192.d7a2786f846fe872.js +148 -0
  15. khoj/interface/compiled/_next/static/chunks/{3260-82d2521fab032ff1.js → 3260-babf79aa1083e03a.js} +18 -63
  16. khoj/interface/compiled/_next/static/chunks/3574.7a94c27e6a496a56.js +63 -0
  17. khoj/interface/compiled/_next/static/chunks/{3595-ac8e81e04ecb89cb.js → 3595-a015df928dccf883.js} +1 -1
  18. khoj/interface/compiled/_next/static/chunks/3599.53651e350d023038.js +131 -0
  19. khoj/interface/compiled/_next/static/chunks/3852.822389f445c9b427.js +1 -0
  20. khoj/interface/compiled/_next/static/chunks/3933.a3b09abdf19b7458.js +1 -0
  21. khoj/interface/compiled/_next/static/chunks/4323.3b06bc313e4946af.js +215 -0
  22. khoj/interface/compiled/_next/static/chunks/4447-111dcc7ac33e42ae.js +1 -0
  23. khoj/interface/compiled/_next/static/chunks/453.f8a05823b9d15c24.js +1 -0
  24. khoj/interface/compiled/_next/static/chunks/490.91b737ff35d6fbc1.js +1 -0
  25. khoj/interface/compiled/_next/static/chunks/5097.1129f707069b361f.js +1 -0
  26. khoj/interface/compiled/_next/static/chunks/5111.c8d55e95447d7609.js +5 -0
  27. khoj/interface/compiled/_next/static/chunks/5689.a323537972b343b4.js +1 -0
  28. khoj/interface/compiled/_next/static/chunks/572.3357cc94e3adfcba.js +262 -0
  29. khoj/interface/compiled/_next/static/chunks/62.53fa01be73dcb16e.js +62 -0
  30. khoj/interface/compiled/_next/static/chunks/7079-9cdc83e5ad213e0b.js +1 -0
  31. khoj/interface/compiled/_next/static/chunks/7200-9f1d584275259536.js +1 -0
  32. khoj/interface/compiled/_next/static/chunks/7626-551c62355b7b1b4a.js +1 -0
  33. khoj/interface/compiled/_next/static/chunks/7811.c32bdc47a9144a63.js +1 -0
  34. khoj/interface/compiled/_next/static/chunks/7986.4901bc54aadf59c3.js +1 -0
  35. khoj/interface/compiled/_next/static/chunks/8288.4883743fa40672e2.js +24 -0
  36. khoj/interface/compiled/_next/static/chunks/8382.335eadce6afb5d4a.js +1 -0
  37. khoj/interface/compiled/_next/static/chunks/8501.771e24303bd21479.js +24 -0
  38. khoj/interface/compiled/_next/static/chunks/8623.525c35f02a86ca25.js +174 -0
  39. khoj/interface/compiled/_next/static/chunks/8927.ba4a68dd6424b88c.js +166 -0
  40. khoj/interface/compiled/_next/static/chunks/{8072-e1440cb482a0940e.js → 9002-bd3304de324360eb.js} +1 -1
  41. khoj/interface/compiled/_next/static/chunks/9316-b53a7fb1be7889f3.js +1 -0
  42. khoj/interface/compiled/_next/static/chunks/9498.df45618893b18531.js +4 -0
  43. khoj/interface/compiled/_next/static/chunks/959.aa25ba53e976d0c1.js +36 -0
  44. khoj/interface/compiled/_next/static/chunks/9808-c95c38946322e899.js +1 -0
  45. khoj/interface/compiled/_next/static/chunks/a764ac56.e65af2f7b1ecdaaa.js +136 -0
  46. khoj/interface/compiled/_next/static/chunks/app/agents/{page-e291b49977f43880.js → page-aa86693ebe6a688f.js} +1 -1
  47. khoj/interface/compiled/_next/static/chunks/app/automations/{layout-8639ff99d6c2fec6.js → layout-554744a3bb43b2f1.js} +1 -1
  48. khoj/interface/compiled/_next/static/chunks/app/automations/{page-1047097af99d31c7.js → page-224de8b2f24cd5a8.js} +1 -1
  49. khoj/interface/compiled/_next/static/chunks/app/chat/{layout-2ff3e18a6feae92a.js → layout-63ef3be8435d1c99.js} +1 -1
  50. khoj/interface/compiled/_next/static/chunks/app/chat/{page-ac7ed0a1aff1b145.js → page-60083b8e6276e6ad.js} +1 -1
  51. khoj/interface/compiled/_next/static/chunks/app/{layout-c2de87a25fededbb.js → layout-a7ad6fe9355ea57a.js} +1 -1
  52. khoj/interface/compiled/_next/static/chunks/app/{page-1567cac7b79a7c59.js → page-3699a0ef95d4a5ce.js} +1 -1
  53. khoj/interface/compiled/_next/static/chunks/app/search/{page-3639e50ec3e9acfd.js → page-6ff3715005bdbb48.js} +1 -1
  54. khoj/interface/compiled/_next/static/chunks/app/settings/{layout-f88cedfe9ad4df7c.js → layout-30fa7eff8e7e01d5.js} +1 -1
  55. khoj/interface/compiled/_next/static/chunks/app/settings/{page-6081362437c82470.js → page-464010b2b4389d0d.js} +1 -1
  56. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-819c6536c15e3d31.js → page-5b98a0ed1e0835bf.js} +1 -1
  57. khoj/interface/compiled/_next/static/chunks/{main-fc8e0fefa2ef3d8c.js → main-0daa33fca37d54d4.js} +1 -1
  58. khoj/interface/compiled/_next/static/chunks/webpack-6912ca6b054cee28.js +1 -0
  59. khoj/interface/compiled/_next/static/css/{821d0d60b0b6871d.css → c34713c98384ee87.css} +1 -1
  60. khoj/interface/compiled/_next/static/css/{7889a30fe9c83846.css → d8ec94d00b6bf837.css} +1 -1
  61. khoj/interface/compiled/_next/static/media/140e5638e63f96c7-s.woff2 +0 -0
  62. khoj/interface/compiled/_next/static/media/1755441e3a2fa970-s.p.woff2 +0 -0
  63. khoj/interface/compiled/_next/static/media/4b23ab4cc10b07bc-s.woff2 +0 -0
  64. khoj/interface/compiled/_next/static/media/b8c807255d58fc43-s.woff2 +0 -0
  65. khoj/interface/compiled/agents/index.html +2 -2
  66. khoj/interface/compiled/agents/index.txt +3 -3
  67. khoj/interface/compiled/automations/index.html +2 -2
  68. khoj/interface/compiled/automations/index.txt +4 -4
  69. khoj/interface/compiled/chat/index.html +2 -2
  70. khoj/interface/compiled/chat/index.txt +4 -4
  71. khoj/interface/compiled/index.html +2 -2
  72. khoj/interface/compiled/index.txt +3 -3
  73. khoj/interface/compiled/search/index.html +2 -2
  74. khoj/interface/compiled/search/index.txt +3 -3
  75. khoj/interface/compiled/settings/index.html +2 -2
  76. khoj/interface/compiled/settings/index.txt +5 -5
  77. khoj/interface/compiled/share/chat/index.html +2 -2
  78. khoj/interface/compiled/share/chat/index.txt +3 -3
  79. khoj/processor/conversation/openai/gpt.py +3 -5
  80. khoj/processor/conversation/openai/utils.py +12 -9
  81. khoj/routers/research.py +1 -1
  82. khoj/utils/helpers.py +2 -2
  83. {khoj-2.0.0b16.dev0.dist-info → khoj-2.0.0b16.dev8.dist-info}/METADATA +4 -4
  84. {khoj-2.0.0b16.dev0.dist-info → khoj-2.0.0b16.dev8.dist-info}/RECORD +89 -87
  85. khoj/interface/compiled/_next/static/chunks/1225.ecac11e7421504c4.js +0 -36
  86. khoj/interface/compiled/_next/static/chunks/1320.ae930ad00affe685.js +0 -5
  87. khoj/interface/compiled/_next/static/chunks/1327-e254819a9172cfa7.js +0 -20
  88. khoj/interface/compiled/_next/static/chunks/1915-5c6508f6ebb62a30.js +0 -1
  89. khoj/interface/compiled/_next/static/chunks/1940.d082758bd04e08ae.js +0 -4
  90. khoj/interface/compiled/_next/static/chunks/2327-438aaec1657c5ada.js +0 -1
  91. khoj/interface/compiled/_next/static/chunks/2475.57a0d0fd93d07af0.js +0 -93
  92. khoj/interface/compiled/_next/static/chunks/2481.5ce6524ba0a73f90.js +0 -55
  93. khoj/interface/compiled/_next/static/chunks/2939-4af3fd24b8ffc9ad.js +0 -1
  94. khoj/interface/compiled/_next/static/chunks/297.4c4c823ff6e3255b.js +0 -174
  95. khoj/interface/compiled/_next/static/chunks/3973.dc54a39586ab48be.js +0 -1
  96. khoj/interface/compiled/_next/static/chunks/4241.c1cd170f7f37ac59.js +0 -24
  97. khoj/interface/compiled/_next/static/chunks/4447-cd95608f8e93e711.js +0 -1
  98. khoj/interface/compiled/_next/static/chunks/4505.f09454a346269c3f.js +0 -117
  99. khoj/interface/compiled/_next/static/chunks/549.2bd27f59a91a9668.js +0 -148
  100. khoj/interface/compiled/_next/static/chunks/584.d7ce3505f169b706.js +0 -1
  101. khoj/interface/compiled/_next/static/chunks/6240.34f7c1fa692edd61.js +0 -24
  102. khoj/interface/compiled/_next/static/chunks/6d3fe5a5-f9f3c16e0bc0cdf9.js +0 -10
  103. khoj/interface/compiled/_next/static/chunks/7200-93ab0072359b8028.js +0 -1
  104. khoj/interface/compiled/_next/static/chunks/7553.f5ad54b1f6e92c49.js +0 -131
  105. khoj/interface/compiled/_next/static/chunks/7626-1b630f1654172341.js +0 -1
  106. khoj/interface/compiled/_next/static/chunks/764.dadd316e8e16d191.js +0 -63
  107. khoj/interface/compiled/_next/static/chunks/78.08169ab541abab4f.js +0 -43
  108. khoj/interface/compiled/_next/static/chunks/784.e03acf460df213d1.js +0 -1
  109. khoj/interface/compiled/_next/static/chunks/8086.8d39887215807fcd.js +0 -1
  110. khoj/interface/compiled/_next/static/chunks/8168.f074ab8c7c16d82d.js +0 -59
  111. khoj/interface/compiled/_next/static/chunks/8223.1705878fa7a09292.js +0 -1
  112. khoj/interface/compiled/_next/static/chunks/8483.94f6c9e2bee86f50.js +0 -215
  113. khoj/interface/compiled/_next/static/chunks/8810.fc0e479de78c7c61.js +0 -29
  114. khoj/interface/compiled/_next/static/chunks/8909.14ac3f43d0070cf1.js +0 -88
  115. khoj/interface/compiled/_next/static/chunks/9139-8ac4d9feb10f8869.js +0 -1
  116. khoj/interface/compiled/_next/static/chunks/9167.098534184f03fe92.js +0 -56
  117. khoj/interface/compiled/_next/static/chunks/9537.e934ce37bf314509.js +0 -166
  118. khoj/interface/compiled/_next/static/chunks/9574.3fe8e26e95bf1c34.js +0 -1
  119. khoj/interface/compiled/_next/static/chunks/9643.b34248df52ffc77c.js +0 -262
  120. khoj/interface/compiled/_next/static/chunks/9747.2fd9065b1435abb1.js +0 -1
  121. khoj/interface/compiled/_next/static/chunks/9808-bd5d7361ad026094.js +0 -1
  122. khoj/interface/compiled/_next/static/chunks/9922.98f2b2a9959b4ebe.js +0 -1
  123. khoj/interface/compiled/_next/static/chunks/webpack-820bd66958a5e279.js +0 -1
  124. khoj/interface/compiled/_next/static/media/2aa11a72f7f24b58-s.woff2 +0 -0
  125. khoj/interface/compiled/_next/static/media/383a65b63658737d-s.woff2 +0 -0
  126. khoj/interface/compiled/_next/static/media/85fe2766c5e6072a-s.woff2 +0 -0
  127. khoj/interface/compiled/_next/static/media/c4250770ab8708b6-s.p.woff2 +0 -0
  128. /khoj/interface/compiled/_next/static/{-vo0F0aVQi0xvwp3-9CX- → uYxzoECdaO5T7Rd_Wa44U}/_buildManifest.js +0 -0
  129. /khoj/interface/compiled/_next/static/{-vo0F0aVQi0xvwp3-9CX- → uYxzoECdaO5T7Rd_Wa44U}/_ssgManifest.js +0 -0
  130. {khoj-2.0.0b16.dev0.dist-info → khoj-2.0.0b16.dev8.dist-info}/WHEEL +0 -0
  131. {khoj-2.0.0b16.dev0.dist-info → khoj-2.0.0b16.dev8.dist-info}/entry_points.txt +0 -0
  132. {khoj-2.0.0b16.dev0.dist-info → khoj-2.0.0b16.dev8.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,36 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[959],{65512:function(t,e,i){var r;r=function(t){var e,i;return e={658:t=>{t.exports=null!=Object.assign?Object.assign.bind(Object):function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return i.forEach(function(e){Object.keys(e).forEach(function(i){return t[i]=e[i]})}),t}},548:(t,e,i)=>{var r=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var i=[],r=!0,n=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(i.push(a.value),!e||i.length!==e);r=!0);}catch(t){n=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return i}(t,e);throw TypeError("Invalid attempt to destructure non-iterable instance")},n=i(140).layoutBase.LinkedList,o={};o.getTopMostNodes=function(t){for(var e={},i=0;i<t.length;i++)e[t[i].id()]=!0;return t.filter(function(t,i){"number"==typeof t&&(t=i);for(var r=t.parent()[0];null!=r;){if(e[r.id()])return!1;r=r.parent()[0]}return!0})},o.connectComponents=function(t,e,i,r){var o=new n,a=new Set,s=[],h=void 0,l=void 0,d=void 0,c=!1,g=1,u=[],f=[];do!function(){var r=t.collection();f.push(r);var n=i[0],p=t.collection();for(p.merge(n).merge(n.descendants().intersection(e)),s.push(n),p.forEach(function(t){o.push(t),a.add(t),r.merge(t)});0!=o.length;)!function(){n=o.shift();var l=t.collection();n.neighborhood().nodes().forEach(function(t){e.intersection(n.edgesWith(t)).length>0&&l.merge(t)});for(var d=0;d<l.length;d++){var c=l[d];null==(h=i.intersection(c.union(c.ancestors())))||a.has(h[0])||h.union(h.descendants()).forEach(function(t){o.push(t),a.add(t),r.merge(t),i.has(t)&&s.push(t)})}}();if(r.forEach(function(t){e.intersection(t.connectedEdges()).forEach(function(t){r.has(t.source())&&r.has(t.target())&&r.merge(t)})}),s.length==i.length&&(c=!0),!c||c&&g>1){d=(l=s[0]).connectedEdges().length,s.forEach(function(t){t.connectedEdges().length<d&&(d=t.connectedEdges().length,l=t)}),u.push(l.id());var v=t.collection();v.merge(s[0]),s.forEach(function(t){v.merge(t)}),s=[],i=i.difference(v),g++}}();while(!c);return r&&u.length>0&&r.set("dummy"+(r.size+1),u),f},o.relocateComponent=function(t,e,i){if(!i.fixedNodeConstraint){var n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;if("draft"==i.quality){var h=!0,l=!1,d=void 0;try{for(var c,g=e.nodeIndexes[Symbol.iterator]();!(h=(c=g.next()).done);h=!0){var u=c.value,f=r(u,2),p=f[0],v=f[1],y=i.cy.getElementById(p);if(y){var m=y.boundingBox(),E=e.xCoords[v]-m.w/2,N=e.xCoords[v]+m.w/2,T=e.yCoords[v]-m.h/2,A=e.yCoords[v]+m.h/2;E<n&&(n=E),N>o&&(o=N),T<a&&(a=T),A>s&&(s=A)}}}catch(t){l=!0,d=t}finally{try{!h&&g.return&&g.return()}finally{if(l)throw d}}var L=t.x-(o+n)/2,C=t.y-(s+a)/2;e.xCoords=e.xCoords.map(function(t){return t+L}),e.yCoords=e.yCoords.map(function(t){return t+C})}else{Object.keys(e).forEach(function(t){var i=e[t],r=i.getRect().x,h=i.getRect().x+i.getRect().width,l=i.getRect().y,d=i.getRect().y+i.getRect().height;r<n&&(n=r),h>o&&(o=h),l<a&&(a=l),d>s&&(s=d)});var w=t.x-(o+n)/2,_=t.y-(s+a)/2;Object.keys(e).forEach(function(t){var i=e[t];i.setCenter(i.getCenterX()+w,i.getCenterY()+_)})}}},o.calcBoundingBox=function(t,e,i,r){for(var n=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER,h=void 0,l=void 0,d=void 0,c=void 0,g=t.descendants().not(":parent"),u=g.length,f=0;f<u;f++){var p=g[f];h=e[r.get(p.id())]-p.width()/2,l=e[r.get(p.id())]+p.width()/2,d=i[r.get(p.id())]-p.height()/2,c=i[r.get(p.id())]+p.height()/2,n>h&&(n=h),o<l&&(o=l),a>d&&(a=d),s<c&&(s=c)}var v={};return v.topLeftX=n,v.topLeftY=a,v.width=o-n,v.height=s-a,v},o.calcParentsWithoutChildren=function(t,e){var i=t.collection();return e.nodes(":parent").forEach(function(t){var e=!1;t.children().forEach(function(t){"none"!=t.css("display")&&(e=!0)}),e||i.merge(t)}),i},t.exports=o},816:(t,e,i)=>{var r=i(548),n=i(140).CoSELayout,o=i(140).CoSENode,a=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,h=i(140).layoutBase.LayoutConstants,l=i(140).layoutBase.FDLayoutConstants,d=i(140).CoSEConstants;t.exports={coseLayout:function(t,e){var i=t.cy,c=t.eles,g=c.nodes(),u=c.edges(),f=void 0,p=void 0,v=void 0,y={};t.randomize&&(f=e.nodeIndexes,p=e.xCoords,v=e.yCoords);var m=function(t){return"function"==typeof t},E=function(t,e){return m(t)?t(e):t},N=r.calcParentsWithoutChildren(i,c);null!=t.nestingFactor&&(d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor),null!=t.gravity&&(d.DEFAULT_GRAVITY_STRENGTH=l.DEFAULT_GRAVITY_STRENGTH=t.gravity),null!=t.numIter&&(d.MAX_ITERATIONS=l.MAX_ITERATIONS=t.numIter),null!=t.gravityRange&&(d.DEFAULT_GRAVITY_RANGE_FACTOR=l.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange),null!=t.gravityCompound&&(d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound),null!=t.gravityRangeCompound&&(d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound),null!=t.initialEnergyOnIncremental&&(d.DEFAULT_COOLING_FACTOR_INCREMENTAL=l.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental),null!=t.tilingCompareBy&&(d.TILING_COMPARE_BY=t.tilingCompareBy),"proof"==t.quality?h.QUALITY=2:h.QUALITY=0,d.NODE_DIMENSIONS_INCLUDE_LABELS=l.NODE_DIMENSIONS_INCLUDE_LABELS=h.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,d.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!t.randomize,d.ANIMATE=l.ANIMATE=h.ANIMATE=t.animate,d.TILE=t.tile,d.TILING_PADDING_VERTICAL="function"==typeof t.tilingPaddingVertical?t.tilingPaddingVertical.call():t.tilingPaddingVertical,d.TILING_PADDING_HORIZONTAL="function"==typeof t.tilingPaddingHorizontal?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal,d.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!0,d.PURE_INCREMENTAL=!t.randomize,h.DEFAULT_UNIFORM_LEAF_NODE_SIZES=t.uniformNodeDimensions,"transformed"==t.step&&(d.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,d.ENFORCE_CONSTRAINTS=!1,d.APPLY_LAYOUT=!1),"enforced"==t.step&&(d.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,d.ENFORCE_CONSTRAINTS=!0,d.APPLY_LAYOUT=!1),"cose"==t.step&&(d.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,d.ENFORCE_CONSTRAINTS=!1,d.APPLY_LAYOUT=!0),"all"==t.step&&(t.randomize?d.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:d.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,d.ENFORCE_CONSTRAINTS=!0,d.APPLY_LAYOUT=!0),t.fixedNodeConstraint||t.alignmentConstraint||t.relativePlacementConstraint?d.TREE_REDUCTION_ON_INCREMENTAL=!1:d.TREE_REDUCTION_ON_INCREMENTAL=!0;var T=new n,A=T.newGraphManager();return function t(e,i,n,h){for(var l=i.length,d=0;d<l;d++){var c=i[d],g=null;0==c.intersection(N).length&&(g=c.children());var u=void 0,m=c.layoutDimensions({nodeDimensionsIncludeLabels:h.nodeDimensionsIncludeLabels});if(null!=c.outerWidth()&&null!=c.outerHeight()){if(h.randomize){if(c.isParent()){var T=r.calcBoundingBox(c,p,v,f);u=0==c.intersection(N).length?e.add(new o(n.graphManager,new a(T.topLeftX,T.topLeftY),new s(T.width,T.height))):e.add(new o(n.graphManager,new a(T.topLeftX,T.topLeftY),new s(parseFloat(m.w),parseFloat(m.h))))}else u=e.add(new o(n.graphManager,new a(p[f.get(c.id())]-m.w/2,v[f.get(c.id())]-m.h/2),new s(parseFloat(m.w),parseFloat(m.h))))}else u=e.add(new o(n.graphManager,new a(c.position("x")-m.w/2,c.position("y")-m.h/2),new s(parseFloat(m.w),parseFloat(m.h))))}else u=e.add(new o(this.graphManager));u.id=c.data("id"),u.nodeRepulsion=E(h.nodeRepulsion,c),u.paddingLeft=parseInt(c.css("padding")),u.paddingTop=parseInt(c.css("padding")),u.paddingRight=parseInt(c.css("padding")),u.paddingBottom=parseInt(c.css("padding")),h.nodeDimensionsIncludeLabels&&(u.labelWidth=c.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,u.labelHeight=c.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,u.labelPosVertical=c.css("text-valign"),u.labelPosHorizontal=c.css("text-halign")),y[c.data("id")]=u,isNaN(u.rect.x)&&(u.rect.x=0),isNaN(u.rect.y)&&(u.rect.y=0),null!=g&&g.length>0&&t(n.getGraphManager().add(n.newGraph(),u),g,n,h)}}(A.addRoot(),r.getTopMostNodes(g),T,t),function(e,i,r){for(var n=0,o=0,a=0;a<r.length;a++){var s=r[a],h=y[s.data("source")],c=y[s.data("target")];if(h&&c&&h!==c&&0==h.getEdgesBetween(c).length){var g=i.add(e.newEdge(),h,c);g.id=s.id(),g.idealLength=E(t.idealEdgeLength,s),g.edgeElasticity=E(t.edgeElasticity,s),n+=g.idealLength,o++}}null!=t.idealEdgeLength&&(o>0?d.DEFAULT_EDGE_LENGTH=l.DEFAULT_EDGE_LENGTH=n/o:m(t.idealEdgeLength)?d.DEFAULT_EDGE_LENGTH=l.DEFAULT_EDGE_LENGTH=50:d.DEFAULT_EDGE_LENGTH=l.DEFAULT_EDGE_LENGTH=t.idealEdgeLength,d.MIN_REPULSION_DIST=l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,d.DEFAULT_RADIAL_SEPARATION=l.DEFAULT_EDGE_LENGTH)}(T,A,u),t.fixedNodeConstraint&&(T.constraints.fixedNodeConstraint=t.fixedNodeConstraint),t.alignmentConstraint&&(T.constraints.alignmentConstraint=t.alignmentConstraint),t.relativePlacementConstraint&&(T.constraints.relativePlacementConstraint=t.relativePlacementConstraint),T.runLayout(),y}}},212:(t,e,i)=>{var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),n=i(658),o=i(548),a=i(657).spectralLayout,s=i(816).coseLayout,h=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(t){return 4500},idealEdgeLength:function(t){return 50},edgeElasticity:function(t){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),l=function(){function t(e){(function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")})(this,t),this.options=n({},h,e)}return r(t,[{key:"run",value:function(){var t=this.options,e=t.cy,i=t.eles,r=[],n=[],h=void 0,l=[];t.fixedNodeConstraint&&(!Array.isArray(t.fixedNodeConstraint)||0==t.fixedNodeConstraint.length)&&(t.fixedNodeConstraint=void 0),t.alignmentConstraint&&(t.alignmentConstraint.vertical&&(!Array.isArray(t.alignmentConstraint.vertical)||0==t.alignmentConstraint.vertical.length)&&(t.alignmentConstraint.vertical=void 0),t.alignmentConstraint.horizontal&&(!Array.isArray(t.alignmentConstraint.horizontal)||0==t.alignmentConstraint.horizontal.length)&&(t.alignmentConstraint.horizontal=void 0)),t.relativePlacementConstraint&&(!Array.isArray(t.relativePlacementConstraint)||0==t.relativePlacementConstraint.length)&&(t.relativePlacementConstraint=void 0),(t.fixedNodeConstraint||t.alignmentConstraint||t.relativePlacementConstraint)&&(t.tile=!1,t.packComponents=!1);var d=void 0,c=!1;if(e.layoutUtilities&&t.packComponents&&((d=e.layoutUtilities("get"))||(d=e.layoutUtilities()),c=!0),i.nodes().length>0){if(c){var g=o.getTopMostNodes(t.eles.nodes());if((h=o.connectComponents(e,t.eles,g)).forEach(function(t){var e=t.boundingBox();l.push({x:e.x1+e.w/2,y:e.y1+e.h/2})}),t.randomize&&h.forEach(function(e){t.eles=e,r.push(a(t))}),"default"==t.quality||"proof"==t.quality){var u=e.collection();if(t.tile){var f=new Map,p=0,v={nodeIndexes:f,xCoords:[],yCoords:[]},y=[];if(h.forEach(function(t,e){0==t.edges().length&&(t.nodes().forEach(function(e,i){u.merge(t.nodes()[i]),e.isParent()||(v.nodeIndexes.set(t.nodes()[i].id(),p++),v.xCoords.push(t.nodes()[0].position().x),v.yCoords.push(t.nodes()[0].position().y))}),y.push(e))}),u.length>1){var m=u.boundingBox();l.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),h.push(u),r.push(v);for(var E=y.length-1;E>=0;E--)h.splice(y[E],1),r.splice(y[E],1),l.splice(y[E],1)}}h.forEach(function(e,i){t.eles=e,n.push(s(t,r[i])),o.relocateComponent(l[i],n[i],t)})}else h.forEach(function(e,i){o.relocateComponent(l[i],r[i],t)});var N=new Set;if(h.length>1){var T=[],A=i.filter(function(t){return"none"==t.css("display")});h.forEach(function(e,i){var a=void 0;if("draft"==t.quality&&(a=r[i].nodeIndexes),e.nodes().not(A).length>0){var s={};s.edges=[],s.nodes=[];var h=void 0;e.nodes().not(A).forEach(function(e){if("draft"==t.quality){if(e.isParent()){var l=o.calcBoundingBox(e,r[i].xCoords,r[i].yCoords,a);s.nodes.push({x:l.topLeftX,y:l.topLeftY,width:l.width,height:l.height})}else h=a.get(e.id()),s.nodes.push({x:r[i].xCoords[h]-e.boundingbox().w/2,y:r[i].yCoords[h]-e.boundingbox().h/2,width:e.boundingbox().w,height:e.boundingbox().h})}else n[i][e.id()]&&s.nodes.push({x:n[i][e.id()].getLeft(),y:n[i][e.id()].getTop(),width:n[i][e.id()].getWidth(),height:n[i][e.id()].getHeight()})}),e.edges().forEach(function(e){var h=e.source(),l=e.target();if("none"!=h.css("display")&&"none"!=l.css("display")){if("draft"==t.quality){var d=a.get(h.id()),c=a.get(l.id()),g=[],u=[];if(h.isParent()){var f=o.calcBoundingBox(h,r[i].xCoords,r[i].yCoords,a);g.push(f.topLeftX+f.width/2),g.push(f.topLeftY+f.height/2)}else g.push(r[i].xCoords[d]),g.push(r[i].yCoords[d]);if(l.isParent()){var p=o.calcBoundingBox(l,r[i].xCoords,r[i].yCoords,a);u.push(p.topLeftX+p.width/2),u.push(p.topLeftY+p.height/2)}else u.push(r[i].xCoords[c]),u.push(r[i].yCoords[c]);s.edges.push({startX:g[0],startY:g[1],endX:u[0],endY:u[1]})}else n[i][h.id()]&&n[i][l.id()]&&s.edges.push({startX:n[i][h.id()].getCenterX(),startY:n[i][h.id()].getCenterY(),endX:n[i][l.id()].getCenterX(),endY:n[i][l.id()].getCenterY()})}}),s.nodes.length>0&&(T.push(s),N.add(i))}});var L=d.packComponents(T,t.randomize).shifts;if("draft"==t.quality)r.forEach(function(t,e){var i=t.xCoords.map(function(t){return t+L[e].dx}),r=t.yCoords.map(function(t){return t+L[e].dy});t.xCoords=i,t.yCoords=r});else{var C=0;N.forEach(function(t){Object.keys(n[t]).forEach(function(e){var i=n[t][e];i.setCenter(i.getCenterX()+L[C].dx,i.getCenterY()+L[C].dy)}),C++})}}}else{var w=t.eles.boundingBox();if(l.push({x:w.x1+w.w/2,y:w.y1+w.h/2}),t.randomize){var _=a(t);r.push(_)}"default"==t.quality||"proof"==t.quality?(n.push(s(t,r[0])),o.relocateComponent(l[0],n[0],t)):o.relocateComponent(l[0],r[0],t)}}var I=function(e,i){if("default"==t.quality||"proof"==t.quality){"number"==typeof e&&(e=i);var o=void 0,a=void 0,s=e.data("id");return n.forEach(function(t){s in t&&(o={x:t[s].getRect().getCenterX(),y:t[s].getRect().getCenterY()},a=t[s])}),t.nodeDimensionsIncludeLabels&&(a.labelWidth&&("left"==a.labelPosHorizontal?o.x+=a.labelWidth/2:"right"==a.labelPosHorizontal&&(o.x-=a.labelWidth/2)),a.labelHeight&&("top"==a.labelPosVertical?o.y+=a.labelHeight/2:"bottom"==a.labelPosVertical&&(o.y-=a.labelHeight/2))),void 0==o&&(o={x:e.position("x"),y:e.position("y")}),{x:o.x,y:o.y}}var h=void 0;return r.forEach(function(t){var i=t.nodeIndexes.get(e.id());void 0!=i&&(h={x:t.xCoords[i],y:t.yCoords[i]})}),void 0==h&&(h={x:e.position("x"),y:e.position("y")}),{x:h.x,y:h.y}};if("default"==t.quality||"proof"==t.quality||t.randomize){var M=o.calcParentsWithoutChildren(e,i),x=i.filter(function(t){return"none"==t.css("display")});t.eles=i.not(x),i.nodes().not(":parent").not(x).layoutPositions(this,t,I),M.length>0&&M.forEach(function(t){t.position(I(t))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),t}();t.exports=l},657:(t,e,i)=>{var r=i(548),n=i(140).layoutBase.Matrix,o=i(140).layoutBase.SVD;t.exports={spectralLayout:function(t){var e=t.cy,i=t.eles,a=i.nodes(),s=i.nodes(":parent"),h=new Map,l=new Map,d=new Map,c=[],g=[],u=[],f=[],p=[],v=[],y=[],m=[],E=void 0,N=t.piTol,T=t.samplingType,A=t.nodeSeparation,L=void 0,C=function(){for(var t=0,e=0,i=!1;e<L;){t=Math.floor(Math.random()*E),i=!1;for(var r=0;r<e;r++)if(f[r]==t){i=!0;break}!i&&(f[e]=t,e++)}},w=function(t,e,i){for(var r=[],n=0,o=0,a=0,s=void 0,h=[],d=0,g=1,u=0;u<E;u++)h[u]=1e8;for(r[o]=t,h[t]=0;o>=n;){for(var f=c[a=r[n++]],y=0;y<f.length;y++)1e8==h[s=l.get(f[y])]&&(h[s]=h[a]+1,r[++o]=s);v[a][e]=h[a]*A}if(i){for(var m=0;m<E;m++)v[m][e]<p[m]&&(p[m]=v[m][e]);for(var N=0;N<E;N++)p[N]>d&&(d=p[N],g=N)}return g};r.connectComponents(e,i,r.getTopMostNodes(a),h),s.forEach(function(t){r.connectComponents(e,i,r.getTopMostNodes(t.descendants().intersection(i)),h)});for(var _=0,I=0;I<a.length;I++)a[I].isParent()||l.set(a[I].id(),_++);var M=!0,x=!1,O=void 0;try{for(var D,R=h.keys()[Symbol.iterator]();!(M=(D=R.next()).done);M=!0){var b=D.value;l.set(b,_++)}}catch(t){x=!0,O=t}finally{try{!M&&R.return&&R.return()}finally{if(x)throw O}}for(var F=0;F<l.size;F++)c[F]=[];s.forEach(function(t){for(var e=t.children().intersection(i);0==e.nodes(":childless").length;)e=e.nodes()[0].children().intersection(i);var r=0,n=e.nodes(":childless")[0].connectedEdges().length;e.nodes(":childless").forEach(function(t,e){t.connectedEdges().length<n&&(n=t.connectedEdges().length,r=e)}),d.set(t.id(),e.nodes(":childless")[r].id())}),a.forEach(function(t){var e=void 0;e=t.isParent()?l.get(d.get(t.id())):l.get(t.id()),t.neighborhood().nodes().forEach(function(r){i.intersection(t.edgesWith(r)).length>0&&(r.isParent()?c[e].push(d.get(r.id())):c[e].push(r.id()))})});var G=function(t){var i=l.get(t),r=void 0;h.get(t).forEach(function(n){r=e.getElementById(n).isParent()?d.get(n):n,c[i].push(r),c[l.get(r)].push(t)})},S=!0,P=!1,U=void 0;try{for(var Y,k=h.keys()[Symbol.iterator]();!(S=(Y=k.next()).done);S=!0){var H=Y.value;G(H)}}catch(t){P=!0,U=t}finally{try{!S&&k.return&&k.return()}finally{if(P)throw U}}E=l.size;if(E>2){L=E<t.sampleSize?E:t.sampleSize;for(var X=0;X<E;X++)v[X]=[];for(var W=0;W<L;W++)m[W]=[];return"draft"==t.quality||"all"==t.step?(function(t){var e=void 0;if(t){e=Math.floor(Math.random()*E);for(var i=0;i<E;i++)p[i]=1e8;for(var r=0;r<L;r++)f[r]=e,e=w(e,r,t)}else{C();for(var n=0;n<L;n++)w(f[n],n,t,!1)}for(var o=0;o<E;o++)for(var a=0;a<L;a++)v[o][a]*=v[o][a];for(var s=0;s<L;s++)y[s]=[];for(var h=0;h<L;h++)for(var l=0;l<L;l++)y[h][l]=v[f[l]][h]}(T),function(){for(var t=o.svd(y),e=t.S,i=t.U,r=t.V,a=e[0]*e[0]*e[0],s=[],h=0;h<L;h++){s[h]=[];for(var l=0;l<L;l++)s[h][l]=0,h==l&&(s[h][l]=e[h]/(e[h]*e[h]+a/(e[h]*e[h])))}m=n.multMat(n.multMat(r,s),n.transpose(i))}(),function(){for(var t=void 0,e=void 0,i=[],r=[],o=[],a=[],s=0;s<E;s++)i[s]=Math.random(),r[s]=Math.random();i=n.normalize(i),r=n.normalize(r);for(var h=0,l=1e-9,d=1e-9,c=void 0;;){h++;for(var f=0;f<E;f++)o[f]=i[f];if(i=n.multGamma(n.multL(n.multGamma(o),v,m)),t=n.dotProduct(o,i),i=n.normalize(i),(c=Math.abs((l=n.dotProduct(o,i))/d))<=1+N&&c>=1)break;d=l}for(var p=0;p<E;p++)o[p]=i[p];for(h=0,d=1e-9;;){h++;for(var y=0;y<E;y++)a[y]=r[y];if(a=n.minusOp(a,n.multCons(o,n.dotProduct(o,a))),r=n.multGamma(n.multL(n.multGamma(a),v,m)),e=n.dotProduct(a,r),r=n.normalize(r),(c=Math.abs((l=n.dotProduct(a,r))/d))<=1+N&&c>=1)break;d=l}for(var T=0;T<E;T++)a[T]=r[T];g=n.multCons(o,Math.sqrt(Math.abs(t))),u=n.multCons(a,Math.sqrt(Math.abs(e)))}()):l.forEach(function(t,i){g.push(e.getElementById(i).position("x")),u.push(e.getElementById(i).position("y"))}),{nodeIndexes:l,xCoords:g,yCoords:u}}var z=l.keys(),V=e.getElementById(z.next().value),B=V.position(),j=V.outerWidth();if(g.push(B.x),u.push(B.y),2==E){var $=e.getElementById(z.next().value).outerWidth();g.push(B.x+j/2+$/2+t.idealEdgeLength),u.push(B.y)}return{nodeIndexes:l,xCoords:g,yCoords:u}}}},579:(t,e,i)=>{var r=i(212),n=function(t){t&&t("layout","fcose",r)};"undefined"!=typeof cytoscape&&n(cytoscape),t.exports=n},140:e=>{e.exports=t}},i={},function t(r){var n=i[r];if(void 0!==n)return n.exports;var o=i[r]={exports:{}};return e[r](o,o.exports,t),o.exports}(579)},t.exports=r(i(42121))},42121:function(t,e,i){var r;r=function(t){var e,i;return e={45:(t,e,i)=>{var r={};r.layoutBase=i(551),r.CoSEConstants=i(806),r.CoSEEdge=i(767),r.CoSEGraph=i(880),r.CoSEGraphManager=i(578),r.CoSELayout=i(765),r.CoSENode=i(991),r.ConstraintHandler=i(902),t.exports=r},806:(t,e,i)=>{var r=i(551).FDLayoutConstants;function n(){}for(var o in r)n[o]=r[o];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,n.ENFORCE_CONSTRAINTS=!0,n.APPLY_LAYOUT=!0,n.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,n.TREE_REDUCTION_ON_INCREMENTAL=!0,n.PURE_INCREMENTAL=n.DEFAULT_INCREMENTAL,t.exports=n},767:(t,e,i)=>{var r=i(551).FDLayoutEdge;function n(t,e,i){r.call(this,t,e,i)}for(var o in n.prototype=Object.create(r.prototype),r)n[o]=r[o];t.exports=n},880:(t,e,i)=>{var r=i(551).LGraph;function n(t,e,i){r.call(this,t,e,i)}for(var o in n.prototype=Object.create(r.prototype),r)n[o]=r[o];t.exports=n},578:(t,e,i)=>{var r=i(551).LGraphManager;function n(t){r.call(this,t)}for(var o in n.prototype=Object.create(r.prototype),r)n[o]=r[o];t.exports=n},765:(t,e,i)=>{var r=i(551).FDLayout,n=i(578),o=i(880),a=i(991),s=i(767),h=i(806),l=i(902),d=i(551).FDLayoutConstants,c=i(551).LayoutConstants,g=i(551).Point,u=i(551).PointD,f=i(551).DimensionD,p=i(551).Layout,v=i(551).Integer,y=i(551).IGeometry,m=i(551).LGraph,E=i(551).Transform,N=i(551).LinkedList;function T(){r.call(this),this.toBeTiled={},this.constraints={}}for(var A in T.prototype=Object.create(r.prototype),r)T[A]=r[A];T.prototype.newGraphManager=function(){var t=new n(this);return this.graphManager=t,t},T.prototype.newGraph=function(t){return new o(null,this.graphManager,t)},T.prototype.newNode=function(t){return new a(this.graphManager,t)},T.prototype.newEdge=function(t){return new s(null,null,t)},T.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},T.prototype.initSpringEmbedder=function(){r.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},T.prototype.layout=function(){return c.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},T.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){if(h.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(e)}}else{var i=this.getFlatForest();if(i.length>0)this.positionNodesRadially(i);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(e),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(l.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},T.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0){if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0}this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),h.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},T.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i<t.length;i++){var r=t[i].rect,n=t[i].id;e[n]={id:n,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return e},T.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===d.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},T.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)(0,t[e]).calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var e=0;e<t.length;e++)(0,t[e]).move()},T.prototype.initConstraintVariables=function(){var t=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var e=this.graphManager.getAllNodes(),i=0;i<e.length;i++){var r=e[i];this.idToNodeMap.set(r.id,r)}if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(e){t.fixedNodeSet.add(e.nodeId)});for(var r,e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)if(null!=(r=e[i]).getChild()){var n=function e(i){for(var r,n=i.getChild().getNodes(),o=0,a=0;a<n.length;a++)null==(r=n[a]).getChild()?t.fixedNodeSet.has(r.id)&&(o+=100):o+=e(r);return o}(r);n>0&&(r.fixedNodeWeight=n)}}if(this.constraints.relativePlacementConstraint){var o=new Map,a=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(e){t.fixedNodesOnHorizontal.add(e),t.fixedNodesOnVertical.add(e)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var s=this.constraints.alignmentConstraint.vertical,i=0;i<s.length;i++)this.dummyToNodeForVerticalAlignment.set("dummy"+i,[]),s[i].forEach(function(e){o.set(e,"dummy"+i),t.dummyToNodeForVerticalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnHorizontal.add("dummy"+i)});if(this.constraints.alignmentConstraint.horizontal)for(var l=this.constraints.alignmentConstraint.horizontal,i=0;i<l.length;i++)this.dummyToNodeForHorizontalAlignment.set("dummy"+i,[]),l[i].forEach(function(e){a.set(e,"dummy"+i),t.dummyToNodeForHorizontalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnVertical.add("dummy"+i)})}if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(t){var e,i,r;for(r=t.length-1;r>=2*t.length/3;r--)e=Math.floor(Math.random()*(r+1)),i=t[r],t[r]=t[e],t[e]=i;return t},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(e){if(e.left){var i=o.has(e.left)?o.get(e.left):e.left,r=o.has(e.right)?o.get(e.right):e.right;t.nodesInRelativeHorizontal.includes(i)||(t.nodesInRelativeHorizontal.push(i),t.nodeToRelativeConstraintMapHorizontal.set(i,[]),t.dummyToNodeForVerticalAlignment.has(i)?t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(i)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(i).getCenterX())),t.nodesInRelativeHorizontal.includes(r)||(t.nodesInRelativeHorizontal.push(r),t.nodeToRelativeConstraintMapHorizontal.set(r,[]),t.dummyToNodeForVerticalAlignment.has(r)?t.nodeToTempPositionMapHorizontal.set(r,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(r)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(r,t.idToNodeMap.get(r).getCenterX())),t.nodeToRelativeConstraintMapHorizontal.get(i).push({right:r,gap:e.gap}),t.nodeToRelativeConstraintMapHorizontal.get(r).push({left:i,gap:e.gap})}else{var n=a.has(e.top)?a.get(e.top):e.top,s=a.has(e.bottom)?a.get(e.bottom):e.bottom;t.nodesInRelativeVertical.includes(n)||(t.nodesInRelativeVertical.push(n),t.nodeToRelativeConstraintMapVertical.set(n,[]),t.dummyToNodeForHorizontalAlignment.has(n)?t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(n)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(n).getCenterY())),t.nodesInRelativeVertical.includes(s)||(t.nodesInRelativeVertical.push(s),t.nodeToRelativeConstraintMapVertical.set(s,[]),t.dummyToNodeForHorizontalAlignment.has(s)?t.nodeToTempPositionMapVertical.set(s,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(s)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(s,t.idToNodeMap.get(s).getCenterY())),t.nodeToRelativeConstraintMapVertical.get(n).push({bottom:s,gap:e.gap}),t.nodeToRelativeConstraintMapVertical.get(s).push({top:n,gap:e.gap})}});else{var d=new Map,c=new Map;this.constraints.relativePlacementConstraint.forEach(function(t){if(t.left){var e=o.has(t.left)?o.get(t.left):t.left,i=o.has(t.right)?o.get(t.right):t.right;d.has(e)?d.get(e).push(i):d.set(e,[i]),d.has(i)?d.get(i).push(e):d.set(i,[e])}else{var r=a.has(t.top)?a.get(t.top):t.top,n=a.has(t.bottom)?a.get(t.bottom):t.bottom;c.has(r)?c.get(r).push(n):c.set(r,[n]),c.has(n)?c.get(n).push(r):c.set(n,[r])}});var g=function(t,e){var i=[],r=[],n=new N,o=new Set,a=0;return t.forEach(function(s,h){if(!o.has(h)){i[a]=[],r[a]=!1;var l=h;for(n.push(l),o.add(l),i[a].push(l);0!=n.length;)l=n.shift(),e.has(l)&&(r[a]=!0),t.get(l).forEach(function(t){o.has(t)||(n.push(t),o.add(t),i[a].push(t))});a++}}),{components:i,isFixed:r}},u=g(d,t.fixedNodesOnHorizontal);this.componentsOnHorizontal=u.components,this.fixedComponentsOnHorizontal=u.isFixed;var f=g(c,t.fixedNodesOnVertical);this.componentsOnVertical=f.components,this.fixedComponentsOnVertical=f.isFixed}}},T.prototype.updateDisplacements=function(){var t=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(e){var i=t.idToNodeMap.get(e.nodeId);i.displacementX=0,i.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var e=this.constraints.alignmentConstraint.vertical,i=0;i<e.length;i++){for(var r=0,n=0;n<e[i].length;n++){if(this.fixedNodeSet.has(e[i][n])){r=0;break}r+=this.idToNodeMap.get(e[i][n]).displacementX}for(var o=r/e[i].length,n=0;n<e[i].length;n++)this.idToNodeMap.get(e[i][n]).displacementX=o}if(this.constraints.alignmentConstraint.horizontal)for(var a=this.constraints.alignmentConstraint.horizontal,i=0;i<a.length;i++){for(var s=0,n=0;n<a[i].length;n++){if(this.fixedNodeSet.has(a[i][n])){s=0;break}s+=this.idToNodeMap.get(a[i][n]).displacementY}for(var l=s/a[i].length,n=0;n<a[i].length;n++)this.idToNodeMap.get(a[i][n]).displacementY=l}}if(this.constraints.relativePlacementConstraint){if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForVerticalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(e)[0]).displacementX:t.idToNodeMap.get(e).displacementX,t.nodeToRelativeConstraintMapHorizontal.get(e).forEach(function(r){if(r.right){var n=t.nodeToTempPositionMapHorizontal.get(r.right)-t.nodeToTempPositionMapHorizontal.get(e)-i;n<r.gap&&(i-=r.gap-n)}else{var n=t.nodeToTempPositionMapHorizontal.get(e)-t.nodeToTempPositionMapHorizontal.get(r.left)+i;n<r.gap&&(i+=r.gap-n)}}),t.nodeToTempPositionMapHorizontal.set(e,t.nodeToTempPositionMapHorizontal.get(e)+i),t.dummyToNodeForVerticalAlignment.has(e)?t.dummyToNodeForVerticalAlignment.get(e).forEach(function(e){t.idToNodeMap.get(e).displacementX=i}):t.idToNodeMap.get(e).displacementX=i}}),this.nodesInRelativeVertical.forEach(function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForHorizontalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(e)[0]).displacementY:t.idToNodeMap.get(e).displacementY,t.nodeToRelativeConstraintMapVertical.get(e).forEach(function(r){if(r.bottom){var n=t.nodeToTempPositionMapVertical.get(r.bottom)-t.nodeToTempPositionMapVertical.get(e)-i;n<r.gap&&(i-=r.gap-n)}else{var n=t.nodeToTempPositionMapVertical.get(e)-t.nodeToTempPositionMapVertical.get(r.top)+i;n<r.gap&&(i+=r.gap-n)}}),t.nodeToTempPositionMapVertical.set(e,t.nodeToTempPositionMapVertical.get(e)+i),t.dummyToNodeForHorizontalAlignment.has(e)?t.dummyToNodeForHorizontalAlignment.get(e).forEach(function(e){t.idToNodeMap.get(e).displacementY=i}):t.idToNodeMap.get(e).displacementY=i}});else{for(var i=0;i<this.componentsOnHorizontal.length;i++){var d=this.componentsOnHorizontal[i];if(this.fixedComponentsOnHorizontal[i])for(var n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementX=0}):this.idToNodeMap.get(d[n]).displacementX=0;else{for(var c=0,g=0,n=0;n<d.length;n++)if(this.dummyToNodeForVerticalAlignment.has(d[n])){var u=this.dummyToNodeForVerticalAlignment.get(d[n]);c+=u.length*this.idToNodeMap.get(u[0]).displacementX,g+=u.length}else c+=this.idToNodeMap.get(d[n]).displacementX,g++;for(var f=c/g,n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementX=f}):this.idToNodeMap.get(d[n]).displacementX=f}}for(var i=0;i<this.componentsOnVertical.length;i++){var d=this.componentsOnVertical[i];if(this.fixedComponentsOnVertical[i])for(var n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementY=0}):this.idToNodeMap.get(d[n]).displacementY=0;else{for(var c=0,g=0,n=0;n<d.length;n++)if(this.dummyToNodeForHorizontalAlignment.has(d[n])){var u=this.dummyToNodeForHorizontalAlignment.get(d[n]);c+=u.length*this.idToNodeMap.get(u[0]).displacementY,g+=u.length}else c+=this.idToNodeMap.get(d[n]).displacementY,g++;for(var f=c/g,n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementY=f}):this.idToNodeMap.get(d[n]).displacementY=f}}}}},T.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,i=[],r=this.graphManager.getGraphs(),n=r.length;for(e=0;e<n;e++)(t=r[e]).updateConnected(),t.isConnected||(i=i.concat(t.getNodes()));return i},T.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e=new Set;for(o=0;o<t.length;o++){var i=t[o];if(!e.has(i)){var r=i.getSource(),n=i.getTarget();if(r==n)i.getBendpoints().push(new u),i.getBendpoints().push(new u),this.createDummyNodesForBendpoints(i),e.add(i);else{var o,a,s=[];if(s=(s=s.concat(r.getEdgeListToNode(n))).concat(n.getEdgeListToNode(r)),!e.has(s[0])){if(s.length>1)for(a=0;a<s.length;a++){var h=s[a];h.getBendpoints().push(new u),this.createDummyNodesForBendpoints(h)}s.forEach(function(t){e.add(t)})}}}if(e.size==t.length)break}},T.prototype.positionNodesRadially=function(t){for(var e=new g(0,0),i=Math.ceil(Math.sqrt(t.length)),r=0,n=0,o=0,a=new u(0,0),s=0;s<t.length;s++){s%i==0&&(o=0,n=r,0!=s&&(n+=h.DEFAULT_COMPONENT_SEPERATION),r=0);var l=t[s],d=p.findCenterOfTree(l);e.x=o,e.y=n,(a=T.radialLayout(l,d,e)).y>r&&(r=Math.floor(a.y)),o=Math.floor(a.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new u(c.WORLD_CENTER_X-a.x/2,c.WORLD_CENTER_Y-a.y/2))},T.radialLayout=function(t,e,i){var r=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);T.branchRadialLayout(e,null,0,359,0,r);var n=m.calculateBounds(t),o=new E;o.setDeviceOrgX(n.getMinX()),o.setDeviceOrgY(n.getMinY()),o.setWorldOrgX(i.x),o.setWorldOrgY(i.y);for(var a=0;a<t.length;a++)t[a].transform(o);var s=new u(n.getMaxX(),n.getMaxY());return o.inverseTransformPoint(s)},T.branchRadialLayout=function(t,e,i,r,n,o){var a,s=(r-i+1)/2;s<0&&(s+=180);var h=(s+i)%360*y.TWO_PI/360,l=n*Math.cos(h),d=n*Math.sin(h);t.setCenter(l,d);var c=[],g=(c=c.concat(t.getEdges())).length;null!=e&&g--;for(var u=0,f=c.length,p=t.getEdgesBetween(e);p.length>1;){var v=p[0];p.splice(0,1);var m=c.indexOf(v);m>=0&&c.splice(m,1),f--,g--}a=null!=e?(c.indexOf(p[0])+1)%f:0;for(var E=Math.abs(r-i)/g,N=a;u!=g;N=++N%f){var A=c[N].getOtherEnd(t);if(A!=e){var L=(i+u*E)%360,C=(L+E)%360;T.branchRadialLayout(A,t,L,C,n+o,o),u++}}},T.maxDiagonalInTree=function(t){for(var e=v.MIN_VALUE,i=0;i<t.length;i++){var r=t[i].getDiagonal();r>e&&(e=r)}return e},T.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},T.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],r=this.graphManager.getAllNodes(),n=0;n<r.length;n++){var o=r[n],s=o.getParent();0!==this.getNodeDegreeWithChildren(o)||void 0!=s.id&&this.getToBeTiled(s)||i.push(o)}for(var n=0;n<i.length;n++){var o=i[n],h=o.getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(o)}Object.keys(e).forEach(function(i){if(e[i].length>1){var r="DummyCompound_"+i;t.memberGroups[r]=e[i];var n=e[i][0].getParent(),o=new a(t.graphManager);o.id=r,o.paddingLeft=n.paddingLeft||0,o.paddingRight=n.paddingRight||0,o.paddingBottom=n.paddingBottom||0,o.paddingTop=n.paddingTop||0,t.idToDummyNode[r]=o;var s=t.getGraphManager().add(t.newGraph(),o),h=n.getChild();h.add(o);for(var l=0;l<e[i].length;l++){var d=e[i][l];h.remove(d),s.add(d)}}})},T.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var i=0;i<this.compoundOrder.length;i++)e[this.compoundOrder[i].id]=this.compoundOrder[i],t[this.compoundOrder[i].id]=[].concat(this.compoundOrder[i].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[i].getChild()),this.compoundOrder[i].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},T.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(i){var r=t.idToDummyNode[i];if(e[i]=t.tileNodes(t.memberGroups[i],r.paddingLeft+r.paddingRight),r.rect.width=e[i].width,r.rect.height=e[i].height,r.setCenter(e[i].centerX,e[i].centerY),r.labelMarginLeft=0,r.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var n=r.rect.width,o=r.rect.height;r.labelWidth&&("left"==r.labelPosHorizontal?(r.rect.x-=r.labelWidth,r.setWidth(n+r.labelWidth),r.labelMarginLeft=r.labelWidth):"center"==r.labelPosHorizontal&&r.labelWidth>n?(r.rect.x-=(r.labelWidth-n)/2,r.setWidth(r.labelWidth),r.labelMarginLeft=(r.labelWidth-n)/2):"right"==r.labelPosHorizontal&&r.setWidth(n+r.labelWidth)),r.labelHeight&&("top"==r.labelPosVertical?(r.rect.y-=r.labelHeight,r.setHeight(o+r.labelHeight),r.labelMarginTop=r.labelHeight):"center"==r.labelPosVertical&&r.labelHeight>o?(r.rect.y-=(r.labelHeight-o)/2,r.setHeight(r.labelHeight),r.labelMarginTop=(r.labelHeight-o)/2):"bottom"==r.labelPosVertical&&r.setHeight(o+r.labelHeight))}})},T.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,r=e.paddingLeft,n=e.paddingTop,o=e.labelMarginLeft,a=e.labelMarginTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,r,n,o,a)}},T.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach(function(i){var r=t.idToDummyNode[i],n=r.paddingLeft,o=r.paddingTop,a=r.labelMarginLeft,s=r.labelMarginTop;t.adjustLocations(e[i],r.rect.x,r.rect.y,n,o,a,s)})},T.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var r=i.getNodes(),n=0;n<r.length;n++){var o=r[n];if(this.getNodeDegree(o)>0)return this.toBeTiled[e]=!1,!1;if(null==o.getChild()){this.toBeTiled[o.id]=!1;continue}if(!this.getToBeTiled(o))return this.toBeTiled[e]=!1,!1}return this.toBeTiled[e]=!0,!0},T.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,r=0;r<e.length;r++){var n=e[r];n.getSource().id!==n.getTarget().id&&(i+=1)}return i},T.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var i=t.getChild().getNodes(),r=0;r<i.length;r++){var n=i[r];e+=this.getNodeDegreeWithChildren(n)}return e},T.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},T.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var i=t[e];null!=i.getChild()&&this.fillCompexOrderByDFS(i.getChild().getNodes()),this.getToBeTiled(i)&&this.compoundOrder.push(i)}},T.prototype.adjustLocations=function(t,e,i,r,n,o,a){e+=r+o,i+=n+a;for(var s=e,h=0;h<t.rows.length;h++){var l=t.rows[h];e=s;for(var d=0,c=0;c<l.length;c++){var g=l[c];g.rect.x=e,g.rect.y=i,e+=g.rect.width+t.horizontalPadding,g.rect.height>d&&(d=g.rect.height)}i+=d+t.verticalPadding}},T.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach(function(r){var n=e[r];if(i.tiledMemberPack[r]=i.tileNodes(t[r],n.paddingLeft+n.paddingRight),n.rect.width=i.tiledMemberPack[r].width,n.rect.height=i.tiledMemberPack[r].height,n.setCenter(i.tiledMemberPack[r].centerX,i.tiledMemberPack[r].centerY),n.labelMarginLeft=0,n.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var o=n.rect.width,a=n.rect.height;n.labelWidth&&("left"==n.labelPosHorizontal?(n.rect.x-=n.labelWidth,n.setWidth(o+n.labelWidth),n.labelMarginLeft=n.labelWidth):"center"==n.labelPosHorizontal&&n.labelWidth>o?(n.rect.x-=(n.labelWidth-o)/2,n.setWidth(n.labelWidth),n.labelMarginLeft=(n.labelWidth-o)/2):"right"==n.labelPosHorizontal&&n.setWidth(o+n.labelWidth)),n.labelHeight&&("top"==n.labelPosVertical?(n.rect.y-=n.labelHeight,n.setHeight(a+n.labelHeight),n.labelMarginTop=n.labelHeight):"center"==n.labelPosVertical&&n.labelHeight>a?(n.rect.y-=(n.labelHeight-a)/2,n.setHeight(n.labelHeight),n.labelMarginTop=(n.labelHeight-a)/2):"bottom"==n.labelPosVertical&&n.setHeight(a+n.labelHeight))}})},T.prototype.tileNodes=function(t,e){var i=this.tileNodesByFavoringDim(t,e,!0),r=this.tileNodesByFavoringDim(t,e,!1),n=this.getOrgRatio(i);return this.getOrgRatio(r)<n?r:i},T.prototype.getOrgRatio=function(t){var e=t.width/t.height;return e<1&&(e=1/e),e},T.prototype.calcIdealRowWidth=function(t,e){var i,r=h.TILING_PADDING_VERTICAL,n=h.TILING_PADDING_HORIZONTAL,o=t.length,a=0,s=0,l=0;t.forEach(function(t){a+=t.getWidth(),s+=t.getHeight(),t.getWidth()>l&&(l=t.getWidth())});var d=a/o,c=(n-r+Math.sqrt(Math.pow(r-n,2)+4*(d+n)*(s/o+r)*o))/(2*(d+n));e?(i=Math.ceil(c))==c&&i++:i=Math.floor(c);var g=i*(d+n)-n;return l>g&&(g=l),g+=2*n},T.prototype.tileNodesByFavoringDim=function(t,e,i){var r=h.TILING_PADDING_VERTICAL,n=h.TILING_PADDING_HORIZONTAL,o=h.TILING_COMPARE_BY,a={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:r,horizontalPadding:n,centerX:0,centerY:0};o&&(a.idealRowWidth=this.calcIdealRowWidth(t,i));var s=function(t){return t.rect.width*t.rect.height},l=function(t,e){return s(e)-s(t)};t.sort(function(t,e){var i=l;return a.idealRowWidth?(i=o)(t.id,e.id):i(t,e)});for(var d=0,c=0,g=0;g<t.length;g++){var u=t[g];d+=u.getCenterX(),c+=u.getCenterY()}a.centerX=d/t.length,a.centerY=c/t.length;for(var g=0;g<t.length;g++){var u=t[g];if(0==a.rows.length)this.insertNodeToRow(a,u,0,e);else if(this.canAddHorizontal(a,u.rect.width,u.rect.height)){var f=a.rows.length-1;a.idealRowWidth||(f=this.getShortestRowIndex(a)),this.insertNodeToRow(a,u,f,e)}else this.insertNodeToRow(a,u,a.rows.length,e);this.shiftToLastRow(a)}return a},T.prototype.insertNodeToRow=function(t,e,i,r){i==t.rows.length&&(t.rows.push([]),t.rowWidth.push(r),t.rowHeight.push(0));var n=t.rowWidth[i]+e.rect.width;t.rows[i].length>0&&(n+=t.horizontalPadding),t.rowWidth[i]=n,t.width<n&&(t.width=n);var o=e.rect.height;i>0&&(o+=t.verticalPadding);var a=0;o>t.rowHeight[i]&&(a=t.rowHeight[i],t.rowHeight[i]=o,a=t.rowHeight[i]-a),t.height+=a,t.rows[i].push(e)},T.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,r=0;r<t.rows.length;r++)t.rowWidth[r]<i&&(e=r,i=t.rowWidth[r]);return e},T.prototype.getLongestRowIndex=function(t){for(var e=-1,i=Number.MIN_VALUE,r=0;r<t.rows.length;r++)t.rowWidth[r]>i&&(e=r,i=t.rowWidth[r]);return e},T.prototype.canAddHorizontal=function(t,e,i){if(t.idealRowWidth){var r,n,o=t.rows.length-1;return t.rowWidth[o]+e+t.horizontalPadding<=t.idealRowWidth}var a=this.getShortestRowIndex(t);if(a<0)return!0;var s=t.rowWidth[a];if(s+t.horizontalPadding+e<=t.width)return!0;var h=0;return t.rowHeight[a]<i&&a>0&&(h=i+t.verticalPadding-t.rowHeight[a]),r=t.width-s>=e+t.horizontalPadding?(t.height+h)/(s+e+t.horizontalPadding):(t.height+h)/t.width,h=i+t.verticalPadding,(n=t.width<e?(t.height+h)/e:(t.height+h)/t.width)<1&&(n=1/n),r<1&&(r=1/r),r<n},T.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),i=t.rowWidth.length-1,r=t.rows[e],n=r[r.length-1],o=n.width+t.horizontalPadding;if(t.width-t.rowWidth[i]>o&&e!=i){r.splice(-1,1),t.rows[i].push(n),t.rowWidth[e]=t.rowWidth[e]-o,t.rowWidth[i]=t.rowWidth[i]+o,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>a&&(a=r[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=a,t.rowHeight[i]<n.height+t.verticalPadding&&(t.rowHeight[i]=n.height+t.verticalPadding);var l=t.rowHeight[e]+t.rowHeight[i];t.height+=l-h,this.shiftToLastRow(t)}},T.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},T.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},T.prototype.reduceTrees=function(){for(var t,e=[],i=!0;i;){var r=this.graphManager.getAllNodes(),n=[];i=!1;for(var o=0;o<r.length;o++)if(1==(t=r[o]).getEdges().length&&!t.getEdges()[0].isInterGraph&&null==t.getChild()){if(h.PURE_INCREMENTAL){var a=t.getEdges()[0].getOtherEnd(t),s=new f(t.getCenterX()-a.getCenterX(),t.getCenterY()-a.getCenterY());n.push([t,t.getEdges()[0],t.getOwner(),s])}else n.push([t,t.getEdges()[0],t.getOwner()]);i=!0}if(!0==i){for(var l=[],d=0;d<n.length;d++)1==n[d][0].getEdges().length&&(l.push(n[d]),n[d][0].getOwner().remove(n[d][0]));e.push(l),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},T.prototype.growTree=function(t){for(var e,i=t.length,r=t[i-1],n=0;n<r.length;n++)e=r[n],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},T.prototype.findPlaceforPrunedNode=function(t){var e=t[0];if(r=e==t[1].source?t[1].target:t[1].source,h.PURE_INCREMENTAL)e.setCenter(r.getCenterX()+t[3].getWidth(),r.getCenterY()+t[3].getHeight());else{var i,r,n,o,a=r.startX,s=r.finishX,l=r.startY,c=r.finishY,g=[0,0,0,0];if(l>0)for(var u=a;u<=s;u++)g[0]+=this.grid[u][l-1].length+this.grid[u][l].length-1;if(s<this.grid.length-1)for(var u=l;u<=c;u++)g[1]+=this.grid[s+1][u].length+this.grid[s][u].length-1;if(c<this.grid[0].length-1)for(var u=a;u<=s;u++)g[2]+=this.grid[u][c+1].length+this.grid[u][c].length-1;if(a>0)for(var u=l;u<=c;u++)g[3]+=this.grid[a-1][u].length+this.grid[a][u].length-1;for(var f=v.MAX_VALUE,p=0;p<g.length;p++)g[p]<f?(f=g[p],n=1,o=p):g[p]==f&&n++;if(3==n&&0==f)0==g[0]&&0==g[1]&&0==g[2]?i=1:0==g[0]&&0==g[1]&&0==g[3]?i=0:0==g[0]&&0==g[2]&&0==g[3]?i=3:0==g[1]&&0==g[2]&&0==g[3]&&(i=2);else if(2==n&&0==f){var y=Math.floor(2*Math.random());i=0==g[0]&&0==g[1]?0==y?0:1:0==g[0]&&0==g[2]?0==y?0:2:0==g[0]&&0==g[3]?0==y?0:3:0==g[1]&&0==g[2]?0==y?1:2:0==g[1]&&0==g[3]?0==y?1:3:0==y?2:3}else if(4==n&&0==f){var y=Math.floor(4*Math.random());i=y}else i=o;0==i?e.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-d.DEFAULT_EDGE_LENGTH-e.getHeight()/2):1==i?e.setCenter(r.getCenterX()+r.getWidth()/2+d.DEFAULT_EDGE_LENGTH+e.getWidth()/2,r.getCenterY()):2==i?e.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+d.DEFAULT_EDGE_LENGTH+e.getHeight()/2):e.setCenter(r.getCenterX()-r.getWidth()/2-d.DEFAULT_EDGE_LENGTH-e.getWidth()/2,r.getCenterY())}},t.exports=T},991:(t,e,i)=>{var r=i(551).FDLayoutNode,n=i(551).IMath;function o(t,e,i,n){r.call(this,t,e,i,n)}for(var a in o.prototype=Object.create(r.prototype),r)o[a]=r[a];o.prototype.calculateDisplacement=function(){var t=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},o.prototype.propogateDisplacementToChildren=function(t,e){for(var i,r=this.getChild().getNodes(),n=0;n<r.length;n++)null==(i=r[n]).getChild()?(i.displacementX+=t,i.displacementY+=e):i.propogateDisplacementToChildren(t,e)},o.prototype.move=function(){var t=this.graphManager.getLayout();(null==this.child||0==this.child.getNodes().length)&&(this.moveBy(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},o.prototype.setPred1=function(t){this.pred1=t},o.prototype.getPred1=function(){return pred1},o.prototype.getPred2=function(){return pred2},o.prototype.setNext=function(t){this.next=t},o.prototype.getNext=function(){return next},o.prototype.setProcessed=function(t){this.processed=t},o.prototype.isProcessed=function(){return processed},t.exports=o},902:(t,e,i)=>{function r(t){if(!Array.isArray(t))return Array.from(t);for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}var n=i(806),o=i(551).LinkedList,a=i(551).Matrix,s=i(551).SVD;function h(){}h.handleConstraints=function(t){var e={};e.fixedNodeConstraint=t.constraints.fixedNodeConstraint,e.alignmentConstraint=t.constraints.alignmentConstraint,e.relativePlacementConstraint=t.constraints.relativePlacementConstraint;for(var i=new Map,h=new Map,l=[],d=[],c=t.getAllNodes(),g=0,u=0;u<c.length;u++){var f=c[u];null==f.getChild()&&(h.set(f.id,g++),l.push(f.getCenterX()),d.push(f.getCenterY()),i.set(f.id,f))}e.relativePlacementConstraint&&e.relativePlacementConstraint.forEach(function(t){t.gap||0==t.gap||(t.left?t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.left).getWidth()/2+i.get(t.right).getWidth()/2:t.gap=n.DEFAULT_EDGE_LENGTH+i.get(t.top).getHeight()/2+i.get(t.bottom).getHeight()/2)});var p=function(t){var e=0,i=0;return t.forEach(function(t){e+=l[h.get(t)],i+=d[h.get(t)]}),{x:e/t.size,y:i/t.size}},v=function(t,e,i,n,a){var s=new Map;t.forEach(function(t,e){s.set(e,0)}),t.forEach(function(t,e){t.forEach(function(t){s.set(t.id,s.get(t.id)+1)})});var c=new Map,g=new Map,u=new o;for(s.forEach(function(t,r){0==t?(u.push(r),i||("horizontal"==e?c.set(r,h.has(r)?l[h.get(r)]:n.get(r)):c.set(r,h.has(r)?d[h.get(r)]:n.get(r)))):c.set(r,Number.NEGATIVE_INFINITY),i&&g.set(r,new Set([r]))}),i&&a.forEach(function(t){var r=[];if(t.forEach(function(t){i.has(t)&&r.push(t)}),r.length>0){var o=0;r.forEach(function(t){"horizontal"==e?c.set(t,h.has(t)?l[h.get(t)]:n.get(t)):c.set(t,h.has(t)?d[h.get(t)]:n.get(t)),o+=c.get(t)}),o/=r.length,t.forEach(function(t){i.has(t)||c.set(t,o)})}else{var a=0;t.forEach(function(t){"horizontal"==e?a+=h.has(t)?l[h.get(t)]:n.get(t):a+=h.has(t)?d[h.get(t)]:n.get(t)}),a/=t.length,t.forEach(function(t){c.set(t,a)})}});0!=u.length;)!function(){var r=u.shift();t.get(r).forEach(function(t){if(c.get(t.id)<c.get(r)+t.gap){if(i&&i.has(t.id)){var o=void 0;if(o="horizontal"==e?h.has(t.id)?l[h.get(t.id)]:n.get(t.id):h.has(t.id)?d[h.get(t.id)]:n.get(t.id),c.set(t.id,o),o<c.get(r)+t.gap){var a=c.get(r)+t.gap-o;g.get(r).forEach(function(t){c.set(t,c.get(t)-a)})}}else c.set(t.id,c.get(r)+t.gap)}s.set(t.id,s.get(t.id)-1),0==s.get(t.id)&&u.push(t.id),i&&g.set(t.id,function(t,e){var i=new Set(t),r=!0,n=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var h=a.value;i.add(h)}}catch(t){n=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return i}(g.get(r),g.get(t.id)))})}();if(i){var f=new Set;t.forEach(function(t,e){0==t.length&&f.add(e)});var p=[];g.forEach(function(t,e){if(f.has(e)){var n=!1,o=!0,a=!1,s=void 0;try{for(var h,l=t[Symbol.iterator]();!(o=(h=l.next()).done);o=!0){var d=h.value;i.has(d)&&(n=!0)}}catch(t){a=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}if(!n){var c=!1,g=void 0;p.forEach(function(e,i){e.has([].concat(r(t))[0])&&(c=!0,g=i)}),c?t.forEach(function(t){p[g].add(t)}):p.push(new Set(t))}}}),p.forEach(function(t,i){var r=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,g=!0,u=!1,f=void 0;try{for(var p,v=t[Symbol.iterator]();!(g=(p=v.next()).done);g=!0){var y=p.value,m=void 0;m="horizontal"==e?h.has(y)?l[h.get(y)]:n.get(y):h.has(y)?d[h.get(y)]:n.get(y);var E=c.get(y);m<r&&(r=m),m>a&&(a=m),E<o&&(o=E),E>s&&(s=E)}}catch(t){u=!0,f=t}finally{try{!g&&v.return&&v.return()}finally{if(u)throw f}}var N=(r+a)/2-(o+s)/2,T=!0,A=!1,L=void 0;try{for(var C,w=t[Symbol.iterator]();!(T=(C=w.next()).done);T=!0){var _=C.value;c.set(_,c.get(_)+N)}}catch(t){A=!0,L=t}finally{try{!T&&w.return&&w.return()}finally{if(A)throw L}}})}return c},y=function(t){var e=0,i=0,r=0,n=0;if(t.forEach(function(t){t.left?l[h.get(t.left)]-l[h.get(t.right)]>=0?e++:i++:d[h.get(t.top)]-d[h.get(t.bottom)]>=0?r++:n++}),e>i&&r>n)for(var o=0;o<h.size;o++)l[o]=-1*l[o],d[o]=-1*d[o];else if(e>i)for(var a=0;a<h.size;a++)l[a]=-1*l[a];else if(r>n)for(var s=0;s<h.size;s++)d[s]=-1*d[s]},m=function(t){var e=[],i=new o,r=new Set,n=0;return t.forEach(function(o,a){if(!r.has(a)){e[n]=[];var s=a;for(i.push(s),r.add(s),e[n].push(s);0!=i.length;)s=i.shift(),t.get(s).forEach(function(t){r.has(t.id)||(i.push(t.id),r.add(t.id),e[n].push(t.id))});n++}}),e},E=function(t){var e=new Map;return t.forEach(function(t,i){e.set(i,[])}),t.forEach(function(t,i){t.forEach(function(t){e.get(i).push(t),e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})})}),e},N=function(t){var e=new Map;return t.forEach(function(t,i){e.set(i,[])}),t.forEach(function(t,i){t.forEach(function(t){e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})})}),e},T=[],A=[],L=!1,C=!1,w=new Set,_=new Map,I=new Map,M=[];if(e.fixedNodeConstraint&&e.fixedNodeConstraint.forEach(function(t){w.add(t.nodeId)}),e.relativePlacementConstraint&&(e.relativePlacementConstraint.forEach(function(t){t.left?(_.has(t.left)?_.get(t.left).push({id:t.right,gap:t.gap,direction:"horizontal"}):_.set(t.left,[{id:t.right,gap:t.gap,direction:"horizontal"}]),_.has(t.right)||_.set(t.right,[])):(_.has(t.top)?_.get(t.top).push({id:t.bottom,gap:t.gap,direction:"vertical"}):_.set(t.top,[{id:t.bottom,gap:t.gap,direction:"vertical"}]),_.has(t.bottom)||_.set(t.bottom,[]))}),M=m(I=E(_))),n.TRANSFORM_ON_CONSTRAINT_HANDLING){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>1)e.fixedNodeConstraint.forEach(function(t,e){T[e]=[t.position.x,t.position.y],A[e]=[l[h.get(t.nodeId)],d[h.get(t.nodeId)]]}),L=!0;else if(e.alignmentConstraint)!function(){var t=0;if(e.alignmentConstraint.vertical){for(var i=e.alignmentConstraint.vertical,n=0;n<i.length;n++)!function(e){var n=new Set;i[e].forEach(function(t){n.add(t)});var o=new Set([].concat(r(n)).filter(function(t){return w.has(t)})),a=void 0;a=o.size>0?l[h.get(o.values().next().value)]:p(n).x,i[e].forEach(function(e){T[t]=[a,d[h.get(e)]],A[t]=[l[h.get(e)],d[h.get(e)]],t++})}(n);L=!0}if(e.alignmentConstraint.horizontal){for(var o=e.alignmentConstraint.horizontal,a=0;a<o.length;a++)!function(e){var i=new Set;o[e].forEach(function(t){i.add(t)});var n=new Set([].concat(r(i)).filter(function(t){return w.has(t)})),a=void 0;a=n.size>0?l[h.get(n.values().next().value)]:p(i).y,o[e].forEach(function(e){T[t]=[l[h.get(e)],a],A[t]=[l[h.get(e)],d[h.get(e)]],t++})}(a);L=!0}e.relativePlacementConstraint&&(C=!0)}();else if(e.relativePlacementConstraint){for(var x=0,O=0,D=0;D<M.length;D++)M[D].length>x&&(x=M[D].length,O=D);if(x<I.size/2)y(e.relativePlacementConstraint),L=!1,C=!1;else{var R=new Map,b=new Map,F=[];M[O].forEach(function(t){_.get(t).forEach(function(e){"horizontal"==e.direction?(R.has(t)?R.get(t).push(e):R.set(t,[e]),R.has(e.id)||R.set(e.id,[]),F.push({left:t,right:e.id})):(b.has(t)?b.get(t).push(e):b.set(t,[e]),b.has(e.id)||b.set(e.id,[]),F.push({top:t,bottom:e.id}))})}),y(F),C=!1;var G=v(R,"horizontal"),S=v(b,"vertical");M[O].forEach(function(t,e){A[e]=[l[h.get(t)],d[h.get(t)]],T[e]=[],G.has(t)?T[e][0]=G.get(t):T[e][0]=l[h.get(t)],S.has(t)?T[e][1]=S.get(t):T[e][1]=d[h.get(t)]}),L=!0}}if(L){for(var P=void 0,U=a.transpose(T),Y=a.transpose(A),k=0;k<U.length;k++)U[k]=a.multGamma(U[k]),Y[k]=a.multGamma(Y[k]);var H=a.multMat(U,a.transpose(Y)),X=s.svd(H);P=a.multMat(X.V,a.transpose(X.U));for(var W=0;W<h.size;W++){var z=[l[W],d[W]],V=[P[0][0],P[1][0]],B=[P[0][1],P[1][1]];l[W]=a.dotProduct(z,V),d[W]=a.dotProduct(z,B)}C&&y(e.relativePlacementConstraint)}}if(n.ENFORCE_CONSTRAINTS){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>0){var j={x:0,y:0};e.fixedNodeConstraint.forEach(function(t,e){var i,r={x:l[h.get(t.nodeId)],y:d[h.get(t.nodeId)]},n={x:(i=t.position).x-r.x,y:i.y-r.y};j.x+=n.x,j.y+=n.y}),j.x/=e.fixedNodeConstraint.length,j.y/=e.fixedNodeConstraint.length,l.forEach(function(t,e){l[e]+=j.x}),d.forEach(function(t,e){d[e]+=j.y}),e.fixedNodeConstraint.forEach(function(t){l[h.get(t.nodeId)]=t.position.x,d[h.get(t.nodeId)]=t.position.y})}if(e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var $=e.alignmentConstraint.vertical,q=0;q<$.length;q++)!function(t){var e=new Set;$[t].forEach(function(t){e.add(t)});var i=new Set([].concat(r(e)).filter(function(t){return w.has(t)})),n=void 0;n=i.size>0?l[h.get(i.values().next().value)]:p(e).x,e.forEach(function(t){w.has(t)||(l[h.get(t)]=n)})}(q);if(e.alignmentConstraint.horizontal)for(var Z=e.alignmentConstraint.horizontal,Q=0;Q<Z.length;Q++)!function(t){var e=new Set;Z[t].forEach(function(t){e.add(t)});var i=new Set([].concat(r(e)).filter(function(t){return w.has(t)})),n=void 0;n=i.size>0?d[h.get(i.values().next().value)]:p(e).y,e.forEach(function(t){w.has(t)||(d[h.get(t)]=n)})}(Q)}e.relativePlacementConstraint&&function(){var t=new Map,i=new Map,r=new Map,n=new Map,o=new Map,a=new Map,s=new Set,c=new Set;if(w.forEach(function(t){s.add(t),c.add(t)}),e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var g=e.alignmentConstraint.vertical,u=function(e){r.set("dummy"+e,[]),g[e].forEach(function(i){t.set(i,"dummy"+e),r.get("dummy"+e).push(i),w.has(i)&&s.add("dummy"+e)}),o.set("dummy"+e,l[h.get(g[e][0])])},f=0;f<g.length;f++)u(f);if(e.alignmentConstraint.horizontal)for(var p=e.alignmentConstraint.horizontal,y=function(t){n.set("dummy"+t,[]),p[t].forEach(function(e){i.set(e,"dummy"+t),n.get("dummy"+t).push(e),w.has(e)&&c.add("dummy"+t)}),a.set("dummy"+t,d[h.get(p[t][0])])},T=0;T<p.length;T++)y(T)}var A=new Map,L=new Map,C=function(e){_.get(e).forEach(function(r){var n=void 0,o=void 0;"horizontal"==r.direction?(n=t.get(e)?t.get(e):e,o=t.get(r.id)?{id:t.get(r.id),gap:r.gap,direction:r.direction}:r,A.has(n)?A.get(n).push(o):A.set(n,[o]),A.has(o.id)||A.set(o.id,[])):(n=i.get(e)?i.get(e):e,o=i.get(r.id)?{id:i.get(r.id),gap:r.gap,direction:r.direction}:r,L.has(n)?L.get(n).push(o):L.set(n,[o]),L.has(o.id)||L.set(o.id,[]))})},I=!0,M=!1,x=void 0;try{for(var O,D=_.keys()[Symbol.iterator]();!(I=(O=D.next()).done);I=!0){var R=O.value;C(R)}}catch(t){M=!0,x=t}finally{try{!I&&D.return&&D.return()}finally{if(M)throw x}}var b=E(A),F=E(L),G=m(b),S=m(F),P=N(A),U=N(L),Y=[],k=[];G.forEach(function(t,e){Y[e]=[],t.forEach(function(t){0==P.get(t).length&&Y[e].push(t)})}),S.forEach(function(t,e){k[e]=[],t.forEach(function(t){0==U.get(t).length&&k[e].push(t)})});var H=v(A,"horizontal",s,o,Y),X=v(L,"vertical",c,a,k),W=function(t){r.get(t)?r.get(t).forEach(function(e){l[h.get(e)]=H.get(t)}):l[h.get(t)]=H.get(t)},z=!0,V=!1,B=void 0;try{for(var j,$=H.keys()[Symbol.iterator]();!(z=(j=$.next()).done);z=!0){var q=j.value;W(q)}}catch(t){V=!0,B=t}finally{try{!z&&$.return&&$.return()}finally{if(V)throw B}}var Z=function(t){n.get(t)?n.get(t).forEach(function(e){d[h.get(e)]=X.get(t)}):d[h.get(t)]=X.get(t)},Q=!0,J=!1,K=void 0;try{for(var tt,te=X.keys()[Symbol.iterator]();!(Q=(tt=te.next()).done);Q=!0){var q=tt.value;Z(q)}}catch(t){J=!0,K=t}finally{try{!Q&&te.return&&te.return()}finally{if(J)throw K}}}()}for(var J=0;J<c.length;J++){var K=c[J];null==K.getChild()&&K.setCenter(l[h.get(K.id)],d[h.get(K.id)])}},t.exports=h},551:e=>{e.exports=t}},i={},function t(r){var n=i[r];if(void 0!==n)return n.exports;var o=i[r]={exports:{}};return e[r](o,o.exports,t),o.exports}(45)},t.exports=r(i(55802))},55802:function(t){var e;e=function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=28)}([function(t,e,i){"use strict";function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,t.exports=r},function(t,e,i){"use strict";var r=i(2),n=i(8),o=i(9);function a(t,e,i){r.call(this,i),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=i,this.bendpoints=[],this.source=t,this.target=e}for(var s in a.prototype=Object.create(r.prototype),r)a[s]=r[s];a.prototype.getSource=function(){return this.source},a.prototype.getTarget=function(){return this.target},a.prototype.isInterGraph=function(){return this.isInterGraph},a.prototype.getLength=function(){return this.length},a.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},a.prototype.getBendpoints=function(){return this.bendpoints},a.prototype.getLca=function(){return this.lca},a.prototype.getSourceInLca=function(){return this.sourceInLca},a.prototype.getTargetInLca=function(){return this.targetInLca},a.prototype.getOtherEnd=function(t){if(this.source===t)return this.target;if(this.target===t)return this.source;throw"Node is not incident with this edge"},a.prototype.getOtherEndInGraph=function(t,e){for(var i=this.getOtherEnd(t),r=e.getGraphManager().getRoot();;){if(i.getOwner()==e)return i;if(i.getOwner()==r)break;i=i.getOwner().getParent()}return null},a.prototype.updateLength=function(){var t=[,,,,];this.isOverlapingSourceAndTarget=n.getIntersection(this.target.getRect(),this.source.getRect(),t),this.isOverlapingSourceAndTarget||(this.lengthX=t[0]-t[2],this.lengthY=t[1]-t[3],1>Math.abs(this.lengthX)&&(this.lengthX=o.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},a.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),1>Math.abs(this.lengthX)&&(this.lengthX=o.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=a},function(t,e,i){"use strict";t.exports=function(t){this.vGraphObject=t}},function(t,e,i){"use strict";var r=i(2),n=i(10),o=i(13),a=i(0),s=i(16),h=i(5);function l(t,e,i,a){null==i&&null==a&&(a=e),r.call(this,a),null!=t.graphManager&&(t=t.graphManager),this.estimatedSize=n.MIN_VALUE,this.inclusionTreeDepth=n.MAX_VALUE,this.vGraphObject=a,this.edges=[],this.graphManager=t,null!=i&&null!=e?this.rect=new o(e.x,e.y,i.width,i.height):this.rect=new o}for(var d in l.prototype=Object.create(r.prototype),r)l[d]=r[d];l.prototype.getEdges=function(){return this.edges},l.prototype.getChild=function(){return this.child},l.prototype.getOwner=function(){return this.owner},l.prototype.getWidth=function(){return this.rect.width},l.prototype.setWidth=function(t){this.rect.width=t},l.prototype.getHeight=function(){return this.rect.height},l.prototype.setHeight=function(t){this.rect.height=t},l.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},l.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},l.prototype.getCenter=function(){return new h(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},l.prototype.getLocation=function(){return new h(this.rect.x,this.rect.y)},l.prototype.getRect=function(){return this.rect},l.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},l.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},l.prototype.setRect=function(t,e){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=e.width,this.rect.height=e.height},l.prototype.setCenter=function(t,e){this.rect.x=t-this.rect.width/2,this.rect.y=e-this.rect.height/2},l.prototype.setLocation=function(t,e){this.rect.x=t,this.rect.y=e},l.prototype.moveBy=function(t,e){this.rect.x+=t,this.rect.y+=e},l.prototype.getEdgeListToNode=function(t){var e=[],i=this;return i.edges.forEach(function(r){if(r.target==t){if(r.source!=i)throw"Incorrect edge source!";e.push(r)}}),e},l.prototype.getEdgesBetween=function(t){var e=[],i=this;return i.edges.forEach(function(r){if(!(r.source==i||r.target==i))throw"Incorrect edge source and/or target";(r.target==t||r.source==t)&&e.push(r)}),e},l.prototype.getNeighborsList=function(){var t=new Set,e=this;return e.edges.forEach(function(i){if(i.source==e)t.add(i.target);else{if(i.target!=e)throw"Incorrect incidency!";t.add(i.source)}}),t},l.prototype.withChildren=function(){var t=new Set;if(t.add(this),null!=this.child)for(var e=this.child.getNodes(),i=0;i<e.length;i++)e[i].withChildren().forEach(function(e){t.add(e)});return t},l.prototype.getNoOfChildren=function(){var t=0;if(null==this.child)t=1;else for(var e=this.child.getNodes(),i=0;i<e.length;i++)t+=e[i].getNoOfChildren();return 0==t&&(t=1),t},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},l.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},l.prototype.scatter=function(){var t,e,i=-a.INITIAL_WORLD_BOUNDARY,r=a.INITIAL_WORLD_BOUNDARY;t=a.WORLD_CENTER_X+s.nextDouble()*(r-i)+i;var n=-a.INITIAL_WORLD_BOUNDARY,o=a.INITIAL_WORLD_BOUNDARY;e=a.WORLD_CENTER_Y+s.nextDouble()*(o-n)+n,this.rect.x=t,this.rect.y=e},l.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var t=this.getChild();if(t.updateBounds(!0),this.rect.x=t.getLeft(),this.rect.y=t.getTop(),this.setWidth(t.getRight()-t.getLeft()),this.setHeight(t.getBottom()-t.getTop()),a.NODE_DIMENSIONS_INCLUDE_LABELS){var e=t.getRight()-t.getLeft(),i=t.getBottom()-t.getTop();this.labelWidth&&("left"==this.labelPosHorizontal?(this.rect.x-=this.labelWidth,this.setWidth(e+this.labelWidth)):"center"==this.labelPosHorizontal&&this.labelWidth>e?(this.rect.x-=(this.labelWidth-e)/2,this.setWidth(this.labelWidth)):"right"==this.labelPosHorizontal&&this.setWidth(e+this.labelWidth)),this.labelHeight&&("top"==this.labelPosVertical?(this.rect.y-=this.labelHeight,this.setHeight(i+this.labelHeight)):"center"==this.labelPosVertical&&this.labelHeight>i?(this.rect.y-=(this.labelHeight-i)/2,this.setHeight(this.labelHeight)):"bottom"==this.labelPosVertical&&this.setHeight(i+this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==n.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},l.prototype.transform=function(t){var e=this.rect.x;e>a.WORLD_BOUNDARY?e=a.WORLD_BOUNDARY:e<-a.WORLD_BOUNDARY&&(e=-a.WORLD_BOUNDARY);var i=this.rect.y;i>a.WORLD_BOUNDARY?i=a.WORLD_BOUNDARY:i<-a.WORLD_BOUNDARY&&(i=-a.WORLD_BOUNDARY);var r=new h(e,i),n=t.inverseTransformPoint(r);this.setLocation(n.x,n.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},t.exports=l},function(t,e,i){"use strict";var r=i(0);function n(){}for(var o in r)n[o]=r[o];n.MAX_ITERATIONS=2500,n.DEFAULT_EDGE_LENGTH=50,n.DEFAULT_SPRING_STRENGTH=.45,n.DEFAULT_REPULSION_STRENGTH=4500,n.DEFAULT_GRAVITY_STRENGTH=.4,n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,n.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,n.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,n.COOLING_ADAPTATION_FACTOR=.33,n.ADAPTATION_LOWER_NODE_LIMIT=1e3,n.ADAPTATION_UPPER_NODE_LIMIT=5e3,n.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,n.MAX_NODE_DISPLACEMENT=3*n.MAX_NODE_DISPLACEMENT_INCREMENTAL,n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,n.CONVERGENCE_CHECK_PERIOD=100,n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,n.MIN_EDGE_LENGTH=1,n.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=n},function(t,e,i){"use strict";function r(t,e){null==t&&null==e?(this.x=0,this.y=0):(this.x=t,this.y=e)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(t){this.x=t},r.prototype.setY=function(t){this.y=t},r.prototype.getDifference=function(t){return new DimensionD(this.x-t.x,this.y-t.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(t){return this.x+=t.width,this.y+=t.height,this},t.exports=r},function(t,e,i){"use strict";var r=i(2),n=i(10),o=i(0),a=i(7),s=i(3),h=i(1),l=i(13),d=i(12),c=i(11);function g(t,e,i){r.call(this,i),this.estimatedSize=n.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=t,null!=e&&e instanceof a?this.graphManager=e:null!=e&&e instanceof Layout&&(this.graphManager=e.graphManager)}for(var u in g.prototype=Object.create(r.prototype),r)g[u]=r[u];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(t,e,i){if(null==e&&null==i){if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(t)>-1)throw"Node already in graph!";return t.owner=this,this.getNodes().push(t),t}if(!(this.getNodes().indexOf(e)>-1&&this.getNodes().indexOf(i)>-1))throw"Source or target not in graph!";if(!(e.owner==i.owner&&e.owner==this))throw"Both owners must be this graph!";return e.owner!=i.owner?null:(t.source=e,t.target=i,t.isInterGraph=!1,this.getEdges().push(t),e.edges.push(t),i!=e&&i.edges.push(t),t)},g.prototype.remove=function(t){if(t instanceof s){if(null==t)throw"Node is null!";if(!(null!=t.owner&&t.owner==this))throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var e,i=t.edges.slice(),r=i.length,n=0;n<r;n++)(e=i[n]).isInterGraph?this.graphManager.remove(e):e.source.owner.remove(e);var o=this.nodes.indexOf(t);if(-1==o)throw"Node not in owner node list!";this.nodes.splice(o,1)}else if(t instanceof h){var e=t;if(null==e)throw"Edge is null!";if(!(null!=e.source&&null!=e.target))throw"Source and/or target is null!";if(!(null!=e.source.owner&&null!=e.target.owner&&e.source.owner==this&&e.target.owner==this))throw"Source and/or target owner is invalid!";var a=e.source.edges.indexOf(e),l=e.target.edges.indexOf(e);if(!(a>-1&&l>-1))throw"Source and/or target doesn't know this edge!";e.source.edges.splice(a,1),e.target!=e.source&&e.target.edges.splice(l,1);var o=e.source.owner.getEdges().indexOf(e);if(-1==o)throw"Not in owner's edge list!";e.source.owner.getEdges().splice(o,1)}},g.prototype.updateLeftTop=function(){for(var t,e,i,r=n.MAX_VALUE,o=n.MAX_VALUE,a=this.getNodes(),s=a.length,h=0;h<s;h++){var l=a[h];t=l.getTop(),e=l.getLeft(),r>t&&(r=t),o>e&&(o=e)}return r==n.MAX_VALUE?null:(i=void 0!=a[0].getParent().paddingLeft?a[0].getParent().paddingLeft:this.margin,this.left=o-i,this.top=r-i,new d(this.left,this.top))},g.prototype.updateBounds=function(t){for(var e,i,r,o,a,s=n.MAX_VALUE,h=-n.MAX_VALUE,d=n.MAX_VALUE,c=-n.MAX_VALUE,g=this.nodes,u=g.length,f=0;f<u;f++){var p=g[f];t&&null!=p.child&&p.updateBounds(),e=p.getLeft(),i=p.getRight(),r=p.getTop(),o=p.getBottom(),s>e&&(s=e),h<i&&(h=i),d>r&&(d=r),c<o&&(c=o)}var v=new l(s,d,h-s,c-d);s==n.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),a=void 0!=g[0].getParent().paddingLeft?g[0].getParent().paddingLeft:this.margin,this.left=v.x-a,this.right=v.x+v.width+a,this.top=v.y-a,this.bottom=v.y+v.height+a},g.calculateBounds=function(t){for(var e,i,r,o,a=n.MAX_VALUE,s=-n.MAX_VALUE,h=n.MAX_VALUE,d=-n.MAX_VALUE,c=t.length,g=0;g<c;g++){var u=t[g];e=u.getLeft(),i=u.getRight(),r=u.getTop(),o=u.getBottom(),a>e&&(a=e),s<i&&(s=i),h>r&&(h=r),d<o&&(d=o)}return new l(a,h,s-a,d-h)},g.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},g.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},g.prototype.calcEstimatedSize=function(){for(var t=0,e=this.nodes,i=e.length,r=0;r<i;r++)t+=e[r].calcEstimatedSize();return 0==t?this.estimatedSize=o.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=t/Math.sqrt(this.nodes.length),this.estimatedSize},g.prototype.updateConnected=function(){var t,e,i=this;if(0==this.nodes.length){this.isConnected=!0;return}var r=new c,n=new Set,o=this.nodes[0];for(o.withChildren().forEach(function(t){r.push(t),n.add(t)});0!==r.length;)for(var a=(t=(o=r.shift()).getEdges()).length,s=0;s<a;s++)null==(e=t[s].getOtherEndInGraph(o,this))||n.has(e)||e.withChildren().forEach(function(t){r.push(t),n.add(t)});if(this.isConnected=!1,n.size>=this.nodes.length){var h=0;n.forEach(function(t){t.owner==i&&h++}),h==this.nodes.length&&(this.isConnected=!0)}},t.exports=g},function(t,e,i){"use strict";var r,n=i(1);function o(t){r=i(6),this.layout=t,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var t=this.layout.newGraph(),e=this.layout.newNode(null),i=this.add(t,e);return this.setRootGraph(i),this.rootGraph},o.prototype.add=function(t,e,i,r,n){if(null==i&&null==r&&null==n){if(null==t)throw"Graph is null!";if(null==e)throw"Parent node is null!";if(this.graphs.indexOf(t)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(t),null!=t.parent)throw"Already has a parent!";if(null!=e.child)throw"Already has a child!";return t.parent=e,e.child=t,t}n=i,r=e,i=t;var o=r.getOwner(),a=n.getOwner();if(!(null!=o&&o.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(null!=a&&a.getGraphManager()==this))throw"Target not in this graph mgr!";if(o==a)return i.isInterGraph=!1,o.add(i,r,n);if(i.isInterGraph=!0,i.source=r,i.target=n,this.edges.indexOf(i)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(i),!(null!=i.source&&null!=i.target))throw"Edge source and/or target is null!";if(!(-1==i.source.edges.indexOf(i)&&-1==i.target.edges.indexOf(i)))throw"Edge already in source and/or target incidency list!";return i.source.edges.push(i),i.target.edges.push(i),i},o.prototype.remove=function(t){if(t instanceof r){if(t.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(t==this.rootGraph||null!=t.parent&&t.parent.graphManager==this))throw"Invalid parent node!";for(var e,i,o=[],a=(o=o.concat(t.getEdges())).length,s=0;s<a;s++)e=o[s],t.remove(e);var h=[];a=(h=h.concat(t.getNodes())).length;for(var s=0;s<a;s++)i=h[s],t.remove(i);t==this.rootGraph&&this.setRootGraph(null);var l=this.graphs.indexOf(t);this.graphs.splice(l,1),t.parent=null}else if(t instanceof n){if(null==(e=t))throw"Edge is null!";if(!e.isInterGraph)throw"Not an inter-graph edge!";if(!(null!=e.source&&null!=e.target))throw"Source and/or target is null!";if(!(-1!=e.source.edges.indexOf(e)&&-1!=e.target.edges.indexOf(e)))throw"Source and/or target doesn't know this edge!";var l=e.source.edges.indexOf(e);if(e.source.edges.splice(l,1),l=e.target.edges.indexOf(e),e.target.edges.splice(l,1),!(null!=e.source.owner&&null!=e.source.owner.getGraphManager()))throw"Edge owner graph or owner graph manager is null!";if(-1==e.source.owner.getGraphManager().edges.indexOf(e))throw"Not in owner graph manager's edge list!";var l=e.source.owner.getGraphManager().edges.indexOf(e);e.source.owner.getGraphManager().edges.splice(l,1)}},o.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},o.prototype.getGraphs=function(){return this.graphs},o.prototype.getAllNodes=function(){if(null==this.allNodes){for(var t=[],e=this.getGraphs(),i=e.length,r=0;r<i;r++)t=t.concat(e[r].getNodes());this.allNodes=t}return this.allNodes},o.prototype.resetAllNodes=function(){this.allNodes=null},o.prototype.resetAllEdges=function(){this.allEdges=null},o.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},o.prototype.getAllEdges=function(){if(null==this.allEdges){var t=[],e=this.getGraphs();e.length;for(var i=0;i<e.length;i++)t=t.concat(e[i].getEdges());t=t.concat(this.edges),this.allEdges=t}return this.allEdges},o.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},o.prototype.setAllNodesToApplyGravitation=function(t){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=t},o.prototype.getRoot=function(){return this.rootGraph},o.prototype.setRootGraph=function(t){if(t.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=t,null==t.parent&&(t.parent=this.layout.newNode("Root node"))},o.prototype.getLayout=function(){return this.layout},o.prototype.isOneAncestorOfOther=function(t,e){if(!(null!=t&&null!=e))throw"assert failed";if(t==e)return!0;for(var i,r=t.getOwner();null!=(i=r.getParent());){if(i==e)return!0;if(null==(r=i.getOwner()))break}for(r=e.getOwner();null!=(i=r.getParent());){if(i==t)return!0;if(null==(r=i.getOwner()))break}return!1},o.prototype.calcLowestCommonAncestors=function(){for(var t,e,i,r,n,o=this.getAllEdges(),a=o.length,s=0;s<a;s++){if(e=(t=o[s]).source,i=t.target,t.lca=null,t.sourceInLca=e,t.targetInLca=i,e==i){t.lca=e.getOwner();continue}for(r=e.getOwner();null==t.lca;){for(t.targetInLca=i,n=i.getOwner();null==t.lca;){if(n==r){t.lca=n;break}if(n==this.rootGraph)break;if(null!=t.lca)throw"assert failed";t.targetInLca=n.getParent(),n=t.targetInLca.getOwner()}if(r==this.rootGraph)break;null==t.lca&&(t.sourceInLca=r.getParent(),r=t.sourceInLca.getOwner())}if(null==t.lca)throw"assert failed"}},o.prototype.calcLowestCommonAncestor=function(t,e){if(t==e)return t.getOwner();for(var i=t.getOwner();null!=i;){for(var r=e.getOwner();null!=r;){if(r==i)return r;r=r.getParent().getOwner()}i=i.getParent().getOwner()}return i},o.prototype.calcInclusionTreeDepths=function(t,e){null==t&&null==e&&(t=this.rootGraph,e=1);for(var i,r=t.getNodes(),n=r.length,o=0;o<n;o++)(i=r[o]).inclusionTreeDepth=e,null!=i.child&&this.calcInclusionTreeDepths(i.child,e+1)},o.prototype.includesInvalidEdge=function(){for(var t,e=[],i=this.edges.length,r=0;r<i;r++)t=this.edges[r],this.isOneAncestorOfOther(t.source,t.target)&&e.push(t);for(var r=0;r<e.length;r++)this.remove(e[r]);return!1},t.exports=o},function(t,e,i){"use strict";var r=i(12);function n(){}n.calcSeparationAmount=function(t,e,i,r){if(!t.intersects(e))throw"assert failed";var n=[,,];this.decideDirectionsForOverlappingNodes(t,e,n),i[0]=Math.min(t.getRight(),e.getRight())-Math.max(t.x,e.x),i[1]=Math.min(t.getBottom(),e.getBottom())-Math.max(t.y,e.y),t.getX()<=e.getX()&&t.getRight()>=e.getRight()?i[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight()):e.getX()<=t.getX()&&e.getRight()>=t.getRight()&&(i[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight())),t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()?i[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()):e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()&&(i[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()));var o=Math.abs((e.getCenterY()-t.getCenterY())/(e.getCenterX()-t.getCenterX()));e.getCenterY()===t.getCenterY()&&e.getCenterX()===t.getCenterX()&&(o=1);var a=o*i[0],s=i[1]/o;i[0]<s?s=i[0]:a=i[1],i[0]=-1*n[0]*(s/2+r),i[1]=-1*n[1]*(a/2+r)},n.decideDirectionsForOverlappingNodes=function(t,e,i){t.getCenterX()<e.getCenterX()?i[0]=-1:i[0]=1,t.getCenterY()<e.getCenterY()?i[1]=-1:i[1]=1},n.getIntersection2=function(t,e,i){var r=t.getCenterX(),n=t.getCenterY(),o=e.getCenterX(),a=e.getCenterY();if(t.intersects(e))return i[0]=r,i[1]=n,i[2]=o,i[3]=a,!0;var s=t.getX(),h=t.getY(),l=t.getRight(),d=t.getX(),c=t.getBottom(),g=t.getRight(),u=t.getWidthHalf(),f=t.getHeightHalf(),p=e.getX(),v=e.getY(),y=e.getRight(),m=e.getX(),E=e.getBottom(),N=e.getRight(),T=e.getWidthHalf(),A=e.getHeightHalf(),L=!1,C=!1;if(r===o)n>a?(i[0]=r,i[1]=h,i[2]=o,i[3]=E):n<a&&(i[0]=r,i[1]=c,i[2]=o,i[3]=v);else if(n===a)r>o?(i[0]=s,i[1]=n,i[2]=y,i[3]=a):r<o&&(i[0]=l,i[1]=n,i[2]=p,i[3]=a);else{var w=t.height/t.width,_=e.height/e.width,I=(a-n)/(o-r),M=void 0,x=void 0,O=void 0,D=void 0,R=void 0,b=void 0;if(-w===I?(r>o?(i[0]=d,i[1]=c):(i[0]=l,i[1]=h),L=!0):w===I&&(r>o?(i[0]=s,i[1]=h):(i[0]=g,i[1]=c),L=!0),-_===I?(o>r?(i[2]=m,i[3]=E):(i[2]=y,i[3]=v),C=!0):_===I&&(o>r?(i[2]=p,i[3]=v):(i[2]=N,i[3]=E),C=!0),L&&C)return!1;if(r>o?n>a?(M=this.getCardinalDirection(w,I,4),x=this.getCardinalDirection(_,I,2)):(M=this.getCardinalDirection(-w,I,3),x=this.getCardinalDirection(-_,I,1)):n>a?(M=this.getCardinalDirection(-w,I,1),x=this.getCardinalDirection(-_,I,3)):(M=this.getCardinalDirection(w,I,2),x=this.getCardinalDirection(_,I,4)),!L)switch(M){case 1:D=h,O=r+-f/I,i[0]=O,i[1]=D;break;case 2:O=g,D=n+u*I,i[0]=O,i[1]=D;break;case 3:D=c,O=r+f/I,i[0]=O,i[1]=D;break;case 4:O=d,D=n+-u*I,i[0]=O,i[1]=D}if(!C)switch(x){case 1:b=v,R=o+-A/I,i[2]=R,i[3]=b;break;case 2:R=N,b=a+T*I,i[2]=R,i[3]=b;break;case 3:b=E,R=o+A/I,i[2]=R,i[3]=b;break;case 4:R=m,b=a+-T*I,i[2]=R,i[3]=b}}return!1},n.getCardinalDirection=function(t,e,i){return t>e?i:1+i%4},n.getIntersection=function(t,e,i,n){if(null==n)return this.getIntersection2(t,e,i);var o=t.x,a=t.y,s=e.x,h=e.y,l=i.x,d=i.y,c=n.x,g=n.y,u=void 0,f=void 0,p=void 0,v=void 0,y=void 0,m=void 0,E=void 0;return(u=h-a,p=o-s,y=s*a-o*h,f=g-d,v=l-c,m=c*d-l*g,0==(E=u*v-f*p))?null:new r((p*m-v*y)/E,(f*y-u*m)/E)},n.angleOfVector=function(t,e,i,r){var n=void 0;return t!==i?(n=Math.atan((r-e)/(i-t)),i<t?n+=Math.PI:r<e&&(n+=this.TWO_PI)):n=r<e?this.ONE_AND_HALF_PI:this.HALF_PI,n},n.doIntersect=function(t,e,i,r){var n=t.x,o=t.y,a=e.x,s=e.y,h=i.x,l=i.y,d=r.x,c=r.y,g=(a-n)*(c-l)-(d-h)*(s-o);if(0===g)return!1;var u=((c-l)*(d-n)+(h-d)*(c-o))/g,f=((o-s)*(d-n)+(a-n)*(c-o))/g;return 0<u&&u<1&&0<f&&f<1},n.findCircleLineIntersections=function(t,e,i,r,n,o,a){var s=(i-t)*(i-t)+(r-e)*(r-e),h=2*((t-n)*(i-t)+(e-o)*(r-e)),l=(t-n)*(t-n)+(e-o)*(e-o)-a*a;if(!(h*h-4*s*l>=0))return null;var d=(-h+Math.sqrt(h*h-4*s*l))/(2*s),c=(-h-Math.sqrt(h*h-4*s*l))/(2*s);return d>=0&&d<=1?[d]:c>=0&&c<=1?[c]:null},n.HALF_PI=.5*Math.PI,n.ONE_AND_HALF_PI=1.5*Math.PI,n.TWO_PI=2*Math.PI,n.THREE_PI=3*Math.PI,t.exports=n},function(t,e,i){"use strict";function r(){}r.sign=function(t){return t>0?1:t<0?-1:0},r.floor=function(t){return t<0?Math.ceil(t):Math.floor(t)},r.ceil=function(t){return t<0?Math.floor(t):Math.ceil(t)},t.exports=r},function(t,e,i){"use strict";function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,t.exports=r},function(t,e,i){"use strict";var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),n=function(t){return{value:t,next:null,prev:null}},o=function(t,e,i,r){return null!==t?t.next=e:r.head=e,null!==i?i.prev=e:r.tail=e,e.prev=t,e.next=i,r.length++,e},a=function(t,e){var i=t.prev,r=t.next;return null!==i?i.next=r:e.head=r,null!==r?r.prev=i:e.tail=i,t.prev=t.next=null,e.length--,t},s=function(){function t(e){var i=this;(function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")})(this,t),this.length=0,this.head=null,this.tail=null,null!=e&&e.forEach(function(t){return i.push(t)})}return r(t,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(t,e){return o(e.prev,n(t),e,this)}},{key:"insertAfter",value:function(t,e){return o(e,n(t),e.next,this)}},{key:"insertNodeBefore",value:function(t,e){return o(e.prev,t,e,this)}},{key:"insertNodeAfter",value:function(t,e){return o(e,t,e.next,this)}},{key:"push",value:function(t){return o(this.tail,n(t),null,this)}},{key:"unshift",value:function(t){return o(null,n(t),this.head,this)}},{key:"remove",value:function(t){return a(t,this)}},{key:"pop",value:function(){return a(this.tail,this).value}},{key:"popNode",value:function(){return a(this.tail,this)}},{key:"shift",value:function(){return a(this.head,this).value}},{key:"shiftNode",value:function(){return a(this.head,this)}},{key:"get_object_at",value:function(t){if(t<=this.length()){for(var e=1,i=this.head;e<t;)i=i.next,e++;return i.value}}},{key:"set_object_at",value:function(t,e){if(t<=this.length()){for(var i=1,r=this.head;i<t;)r=r.next,i++;r.value=e}}}]),t}();t.exports=s},function(t,e,i){"use strict";function r(t,e,i){this.x=null,this.y=null,null==t&&null==e&&null==i?(this.x=0,this.y=0):"number"==typeof t&&"number"==typeof e&&null==i?(this.x=t,this.y=e):"Point"==t.constructor.name&&null==e&&null==i&&(i=t,this.x=i.x,this.y=i.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(t,e,i){"Point"==t.constructor.name&&null==e&&null==i?(i=t,this.setLocation(i.x,i.y)):"number"==typeof t&&"number"==typeof e&&null==i&&(parseInt(t)==t&&parseInt(e)==e?this.move(t,e):(this.x=Math.floor(t+.5),this.y=Math.floor(e+.5)))},r.prototype.move=function(t,e){this.x=t,this.y=e},r.prototype.translate=function(t,e){this.x+=t,this.y+=e},r.prototype.equals=function(t){return"Point"==t.constructor.name?this.x==t.x&&this.y==t.y:this==t},r.prototype.toString=function(){return new r().constructor.name+"[x="+this.x+",y="+this.y+"]"},t.exports=r},function(t,e,i){"use strict";function r(t,e,i,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=t&&null!=e&&null!=i&&null!=r&&(this.x=t,this.y=e,this.width=i,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(t){this.x=t},r.prototype.getY=function(){return this.y},r.prototype.setY=function(t){this.y=t},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(t){this.width=t},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(t){this.height=t},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(t){return!(this.getRight()<t.x||this.getBottom()<t.y||t.getRight()<this.x||t.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},t.exports=r},function(t,e,i){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function n(){}n.lastID=0,n.createID=function(t){return n.isPrimitive(t)?t:(null!=t.uniqueID||(t.uniqueID=n.getString(),n.lastID++),t.uniqueID)},n.getString=function(t){return null==t&&(t=n.lastID),"Object#"+t},n.isPrimitive=function(t){var e=void 0===t?"undefined":r(t);return null==t||"object"!=e&&"function"!=e},t.exports=n},function(t,e,i){"use strict";function r(t){if(!Array.isArray(t))return Array.from(t);for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}var n=i(0),o=i(7),a=i(3),s=i(1),h=i(6),l=i(5),d=i(17),c=i(29);function g(t){c.call(this),this.layoutQuality=n.QUALITY,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=n.DEFAULT_INCREMENTAL,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new o(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=t&&(this.isRemoteUse=t)}g.RANDOM_SEED=1,g.prototype=Object.create(c.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 t=new o(this);return this.graphManager=t,t},g.prototype.newGraph=function(t){return new h(null,this.graphManager,t)},g.prototype.newNode=function(t){return new a(this.graphManager,t)},g.prototype.newEdge=function(t){return new s(null,null,t)},g.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},g.prototype.runLayout=function(){var t;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),t=!this.checkLayoutSuccess()&&this.layout(),"during"!==n.ANIMATE&&(t&&!this.isSubLayout&&this.doPostLayout(),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,t)},g.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},g.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var t=this.graphManager.getAllEdges(),e=0;e<t.length;e++)t[e];for(var i=this.graphManager.getRoot().getNodes(),e=0;e<i.length;e++)i[e];this.update(this.graphManager.getRoot())}},g.prototype.update=function(t){if(null==t)this.update2();else if(t instanceof a){if(null!=t.getChild())for(var e=t.getChild().getNodes(),i=0;i<e.length;i++)update(e[i]);null!=t.vGraphObject&&t.vGraphObject.update(t)}else t instanceof s?null!=t.vGraphObject&&t.vGraphObject.update(t):t instanceof h&&null!=t.vGraphObject&&t.vGraphObject.update(t)},g.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=n.QUALITY,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=n.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},g.prototype.transform=function(t){if(void 0==t)this.transform(new l(0,0));else{var e=new d,i=this.graphManager.getRoot().updateLeftTop();if(null!=i){e.setWorldOrgX(t.x),e.setWorldOrgY(t.y),e.setDeviceOrgX(i.x),e.setDeviceOrgY(i.y);for(var r=this.getAllNodes(),n=0;n<r.length;n++)r[n].transform(e)}}},g.prototype.positionNodesRandomly=function(t){if(void 0==t)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var e,i,r=t.getNodes(),n=0;n<r.length;n++)null==(i=(e=r[n]).getChild())?e.scatter():0==i.getNodes().length?e.scatter():(this.positionNodesRandomly(i),e.updateBounds())},g.prototype.getFlatForest=function(){for(var t=[],e=!0,i=this.graphManager.getRoot().getNodes(),n=!0,o=0;o<i.length;o++)null!=i[o].getChild()&&(n=!1);if(!n)return t;var a=new Set,s=[],h=new Map,l=[];for(l=l.concat(i);l.length>0&&e;){for(s.push(l[0]);s.length>0&&e;){var d=s[0];s.splice(0,1),a.add(d);for(var c=d.getEdges(),o=0;o<c.length;o++){var g=c[o].getOtherEnd(d);if(h.get(d)!=g){if(a.has(g)){e=!1;break}s.push(g),h.set(g,d)}}}if(e){var u=[].concat(r(a));t.push(u);for(var o=0;o<u.length;o++){var f=u[o],p=l.indexOf(f);p>-1&&l.splice(p,1)}a=new Set,h=new Map}else t=[]}return t},g.prototype.createDummyNodesForBendpoints=function(t){for(var e=[],i=t.source,r=this.graphManager.calcLowestCommonAncestor(t.source,t.target),n=0;n<t.bendpoints.length;n++){var o=this.newNode(null);o.setRect(new Point(0,0),new Dimension(1,1)),r.add(o);var a=this.newEdge(null);this.graphManager.add(a,i,o),e.add(o),i=o}var a=this.newEdge(null);return this.graphManager.add(a,i,t.target),this.edgeToDummyNodes.set(t,e),t.isInterGraph()?this.graphManager.remove(t):r.remove(t),e},g.prototype.createBendpointsFromDummyNodes=function(){var t=[];t=t.concat(this.graphManager.getAllEdges()),t=[].concat(r(this.edgeToDummyNodes.keys())).concat(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.bendpoints.length>0){for(var n=this.edgeToDummyNodes.get(i),o=0;o<n.length;o++){var a=n[o],s=new l(a.getCenterX(),a.getCenterY()),h=i.bendpoints.get(o);h.x=s.x,h.y=s.y,a.getOwner().remove(a)}this.graphManager.add(i,i.source,i.target)}}},g.transform=function(t,e,i,r){if(void 0==i||void 0==r)return t<=50?(n=9*e/500,o=e/10):(n=9*e/50,o=-8*e),n*t+o;var n,o,a=e;return t<=50?a-=(e-e/i)/50*(50-t):a+=(e*r-e)/50*(t-50),a},g.findCenterOfTree=function(t){var e=[];e=e.concat(t);var i=[],r=new Map,n=!1,o=null;(1==e.length||2==e.length)&&(n=!0,o=e[0]);for(var a=0;a<e.length;a++){var s=e[a],h=s.getNeighborsList().size;r.set(s,s.getNeighborsList().size),1==h&&i.push(s)}var l=[];for(l=l.concat(i);!n;){var d=[];d=d.concat(l),l=[];for(var a=0;a<e.length;a++){var s=e[a],c=e.indexOf(s);c>=0&&e.splice(c,1),s.getNeighborsList().forEach(function(t){if(0>i.indexOf(t)){var e=r.get(t)-1;1==e&&l.push(t),r.set(t,e)}})}i=i.concat(l),(1==e.length||2==e.length)&&(n=!0,o=e[0])}return o},g.prototype.setGraphManager=function(t){this.graphManager=t},t.exports=g},function(t,e,i){"use strict";function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},t.exports=r},function(t,e,i){"use strict";var r=i(5);function n(t,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}n.prototype.getWorldOrgX=function(){return this.lworldOrgX},n.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},n.prototype.getWorldOrgY=function(){return this.lworldOrgY},n.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},n.prototype.getWorldExtX=function(){return this.lworldExtX},n.prototype.setWorldExtX=function(t){this.lworldExtX=t},n.prototype.getWorldExtY=function(){return this.lworldExtY},n.prototype.setWorldExtY=function(t){this.lworldExtY=t},n.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},n.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},n.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},n.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},n.prototype.getDeviceExtX=function(){return this.ldeviceExtX},n.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},n.prototype.getDeviceExtY=function(){return this.ldeviceExtY},n.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},n.prototype.transformX=function(t){var e=0,i=this.lworldExtX;return 0!=i&&(e=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/i),e},n.prototype.transformY=function(t){var e=0,i=this.lworldExtY;return 0!=i&&(e=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/i),e},n.prototype.inverseTransformX=function(t){var e=0,i=this.ldeviceExtX;return 0!=i&&(e=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/i),e},n.prototype.inverseTransformY=function(t){var e=0,i=this.ldeviceExtY;return 0!=i&&(e=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/i),e},n.prototype.inverseTransformPoint=function(t){return new r(this.inverseTransformX(t.x),this.inverseTransformY(t.y))},t.exports=n},function(t,e,i){"use strict";var r=i(15),n=i(4),o=i(0),a=i(8),s=i(9);function h(){r.call(this),this.useSmartIdealEdgeLengthCalculation=n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=n.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=n.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=n.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=n.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=n.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=n.MAX_ITERATIONS}for(var l in h.prototype=Object.create(r.prototype),r)h[l]=r[l];h.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var t,e,i,r,a,s,h,l=this.getGraphManager().getAllEdges(),d=0;d<l.length;d++)e=(t=l[d]).idealLength,t.isInterGraph&&(r=t.getSource(),a=t.getTarget(),s=t.getSourceInLca().getEstimatedSize(),h=t.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(t.idealLength+=s+h-2*o.SIMPLE_NODE_SIZE),i=t.getLca().getInclusionTreeDepth(),t.idealLength+=e*n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(r.getInclusionTreeDepth()+a.getInclusionTreeDepth()-2*i))},h.prototype.initSpringEmbedder=function(){var t=this.getAllNodes().length;this.incremental?(t>n.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var t,e=this.getAllEdges(),i=0;i<e.length;i++)t=e[i],this.calcSpringForce(t,t.idealLength)},h.prototype.calcRepulsionForces=function(){var t,e,i,r,o,a=!(arguments.length>0)||void 0===arguments[0]||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],h=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&a&&this.updateGrid(),o=new Set,t=0;t<h.length;t++)i=h[t],this.calculateRepulsionForceOfANode(i,o,a,s),o.add(i);else for(t=0;t<h.length;t++)for(i=h[t],e=t+1;e<h.length;e++)r=h[e],i.getOwner()==r.getOwner()&&this.calcRepulsionForce(i,r)},h.prototype.calcGravitationalForces=function(){for(var t,e=this.getAllNodesToApplyGravitation(),i=0;i<e.length;i++)t=e[i],this.calcGravitationalForce(t)},h.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].move()},h.prototype.calcSpringForce=function(t,e){var i,r,n,o,a=t.getSource(),s=t.getTarget();if(this.uniformLeafNodeSizes&&null==a.getChild()&&null==s.getChild())t.updateLengthSimple();else if(t.updateLength(),t.isOverlapingSourceAndTarget)return;0!=(i=t.getLength())&&(r=t.edgeElasticity*(i-e),n=t.lengthX/i*r,o=t.lengthY/i*r,a.springForceX+=n,a.springForceY+=o,s.springForceX-=n,s.springForceY-=o)},h.prototype.calcRepulsionForce=function(t,e){var i,r,o,h,l,d,c,g=t.getRect(),u=e.getRect(),f=[,,],p=[,,,,];if(g.intersects(u)){a.calcSeparationAmount(g,u,f,n.DEFAULT_EDGE_LENGTH/2),d=2*f[0],c=2*f[1];var v=t.noOfChildren*e.noOfChildren/(t.noOfChildren+e.noOfChildren);t.repulsionForceX-=v*d,t.repulsionForceY-=v*c,e.repulsionForceX+=v*d,e.repulsionForceY+=v*c}else this.uniformLeafNodeSizes&&null==t.getChild()&&null==e.getChild()?(i=u.getCenterX()-g.getCenterX(),r=u.getCenterY()-g.getCenterY()):(a.getIntersection(g,u,p),i=p[2]-p[0],r=p[3]-p[1]),Math.abs(i)<n.MIN_REPULSION_DIST&&(i=s.sign(i)*n.MIN_REPULSION_DIST),Math.abs(r)<n.MIN_REPULSION_DIST&&(r=s.sign(r)*n.MIN_REPULSION_DIST),h=Math.sqrt(o=i*i+r*r),d=(l=(t.nodeRepulsion/2+e.nodeRepulsion/2)*t.noOfChildren*e.noOfChildren/o)*i/h,c=l*r/h,t.repulsionForceX-=d,t.repulsionForceY-=c,e.repulsionForceX+=d,e.repulsionForceY+=c},h.prototype.calcGravitationalForce=function(t){var e,i,r,n,o,a,s,h;i=((e=t.getOwner()).getRight()+e.getLeft())/2,r=(e.getTop()+e.getBottom())/2,n=t.getCenterX()-i,o=t.getCenterY()-r,a=Math.abs(n)+t.getWidth()/2,s=Math.abs(o)+t.getHeight()/2,t.getOwner()==this.graphManager.getRoot()?(a>(h=e.getEstimatedSize()*this.gravityRangeFactor)||s>h)&&(t.gravitationForceX=-this.gravityConstant*n,t.gravitationForceY=-this.gravityConstant*o):(a>(h=e.getEstimatedSize()*this.compoundGravityRangeFactor)||s>h)&&(t.gravitationForceX=-this.gravityConstant*n*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*o*this.compoundGravityConstant)},h.prototype.isConverged=function(){var t,e=!1;return this.totalIterations>this.maxIterations/3&&(e=2>Math.abs(this.totalDisplacement-this.oldTotalDisplacement)),t=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,t||e},h.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},h.prototype.calcNoOfChildrenForAllNodes=function(){for(var t,e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)(t=e[i]).noOfChildren=t.getNoOfChildren()},h.prototype.calcGrid=function(t){var e=0,i=0;e=parseInt(Math.ceil((t.getRight()-t.getLeft())/this.repulsionRange)),i=parseInt(Math.ceil((t.getBottom()-t.getTop())/this.repulsionRange));for(var r=Array(e),n=0;n<e;n++)r[n]=Array(i);for(var n=0;n<e;n++)for(var o=0;o<i;o++)r[n][o]=[];return r},h.prototype.addNodeToGrid=function(t,e,i){var r=0,n=0,o=0,a=0;r=parseInt(Math.floor((t.getRect().x-e)/this.repulsionRange)),n=parseInt(Math.floor((t.getRect().width+t.getRect().x-e)/this.repulsionRange)),o=parseInt(Math.floor((t.getRect().y-i)/this.repulsionRange)),a=parseInt(Math.floor((t.getRect().height+t.getRect().y-i)/this.repulsionRange));for(var s=r;s<=n;s++)for(var h=o;h<=a;h++)this.grid[s][h].push(t),t.setGridCoordinates(r,n,o,a)},h.prototype.updateGrid=function(){var t,e,i=this.getAllNodes();for(t=0,this.grid=this.calcGrid(this.graphManager.getRoot());t<i.length;t++)e=i[t],this.addNodeToGrid(e,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},h.prototype.calculateRepulsionForceOfANode=function(t,e,i,r){if(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&i||r){var o,a=new Set;t.surrounding=[];for(var s=this.grid,h=t.startX-1;h<t.finishX+2;h++)for(var l=t.startY-1;l<t.finishY+2;l++)if(!(h<0||l<0||h>=s.length||l>=s[0].length)){for(var d=0;d<s[h][l].length;d++)if(o=s[h][l][d],t.getOwner()==o.getOwner()&&t!=o&&!e.has(o)&&!a.has(o)){var c=Math.abs(t.getCenterX()-o.getCenterX())-(t.getWidth()/2+o.getWidth()/2),g=Math.abs(t.getCenterY()-o.getCenterY())-(t.getHeight()/2+o.getHeight()/2);c<=this.repulsionRange&&g<=this.repulsionRange&&a.add(o)}}t.surrounding=[].concat(function(t){if(!Array.isArray(t))return Array.from(t);for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}(a))}for(h=0;h<t.surrounding.length;h++)this.calcRepulsionForce(t,t.surrounding[h])},h.prototype.calcRepulsionRange=function(){return 0},t.exports=h},function(t,e,i){"use strict";var r=i(1),n=i(4);function o(t,e,i){r.call(this,t,e,i),this.idealLength=n.DEFAULT_EDGE_LENGTH,this.edgeElasticity=n.DEFAULT_SPRING_STRENGTH}for(var a in o.prototype=Object.create(r.prototype),r)o[a]=r[a];t.exports=o},function(t,e,i){"use strict";var r=i(3),n=i(4);function o(t,e,i,o){r.call(this,t,e,i,o),this.nodeRepulsion=n.DEFAULT_REPULSION_STRENGTH,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=[]}for(var a in o.prototype=Object.create(r.prototype),r)o[a]=r[a];o.prototype.setGridCoordinates=function(t,e,i,r){this.startX=t,this.finishX=e,this.startY=i,this.finishY=r},t.exports=o},function(t,e,i){"use strict";function r(t,e){this.width=0,this.height=0,null!==t&&null!==e&&(this.height=e,this.width=t)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(t){this.width=t},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(t){this.height=t},t.exports=r},function(t,e,i){"use strict";var r=i(14);function n(){this.map={},this.keys=[]}n.prototype.put=function(t,e){var i=r.createID(t);this.contains(i)||(this.map[i]=e,this.keys.push(t))},n.prototype.contains=function(t){return r.createID(t),null!=this.map[t]},n.prototype.get=function(t){var e=r.createID(t);return this.map[e]},n.prototype.keySet=function(){return this.keys},t.exports=n},function(t,e,i){"use strict";var r=i(14);function n(){this.set={}}n.prototype.add=function(t){var e=r.createID(t);this.contains(e)||(this.set[e]=t)},n.prototype.remove=function(t){delete this.set[r.createID(t)]},n.prototype.clear=function(){this.set={}},n.prototype.contains=function(t){return this.set[r.createID(t)]==t},n.prototype.isEmpty=function(){return 0===this.size()},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAllTo=function(t){for(var e=Object.keys(this.set),i=e.length,r=0;r<i;r++)t.push(this.set[e[r]])},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAll=function(t){for(var e=t.length,i=0;i<e;i++){var r=t[i];this.add(r)}},t.exports=n},function(t,e,i){"use strict";function r(){}r.multMat=function(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<e[0].length;n++){i[r][n]=0;for(var o=0;o<t[0].length;o++)i[r][n]+=t[r][o]*e[o][n]}}return i},r.transpose=function(t){for(var e=[],i=0;i<t[0].length;i++){e[i]=[];for(var r=0;r<t.length;r++)e[i][r]=t[r][i]}return e},r.multCons=function(t,e){for(var i=[],r=0;r<t.length;r++)i[r]=t[r]*e;return i},r.minusOp=function(t,e){for(var i=[],r=0;r<t.length;r++)i[r]=t[r]-e[r];return i},r.dotProduct=function(t,e){for(var i=0,r=0;r<t.length;r++)i+=t[r]*e[r];return i},r.mag=function(t){return Math.sqrt(this.dotProduct(t,t))},r.normalize=function(t){for(var e=[],i=this.mag(t),r=0;r<t.length;r++)e[r]=t[r]/i;return e},r.multGamma=function(t){for(var e=[],i=0,r=0;r<t.length;r++)i+=t[r];i*=-1/t.length;for(var n=0;n<t.length;n++)e[n]=i+t[n];return e},r.multL=function(t,e,i){for(var r=[],n=[],o=[],a=0;a<e[0].length;a++){for(var s=0,h=0;h<e.length;h++)s+=-.5*e[h][a]*t[h];n[a]=s}for(var l=0;l<i.length;l++){for(var d=0,c=0;c<i.length;c++)d+=i[l][c]*n[c];o[l]=d}for(var g=0;g<e.length;g++){for(var u=0,f=0;f<e[0].length;f++)u+=e[g][f]*o[f];r[g]=u}return r},t.exports=r},function(t,e,i){"use strict";var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),n=i(11),o=function(){function t(e,i){(function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")})(this,t),(null!==i||void 0!==i)&&(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=e instanceof n?e.size():e.length,this._quicksort(e,0,r-1)}return r(t,[{key:"_quicksort",value:function(t,e,i){if(e<i){var r=this._partition(t,e,i);this._quicksort(t,e,r),this._quicksort(t,r+1,i)}}},{key:"_partition",value:function(t,e,i){for(var r=this._get(t,e),n=e,o=i;;){for(;this.compareFunction(r,this._get(t,o));)o--;for(;this.compareFunction(this._get(t,n),r);)n++;if(!(n<o))return o;this._swap(t,n,o),n++,o--}}},{key:"_get",value:function(t,e){return t instanceof n?t.get_object_at(e):t[e]}},{key:"_set",value:function(t,e,i){t instanceof n?t.set_object_at(e,i):t[e]=i}},{key:"_swap",value:function(t,e,i){var r=this._get(t,e);this._set(t,e,this._get(t,i)),this._set(t,i,r)}},{key:"_defaultCompareFunction",value:function(t,e){return e>t}}]),t}();t.exports=o},function(t,e,i){"use strict";function r(){}r.svd=function(t){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=t.length,this.n=t[0].length;var e=Math.min(this.m,this.n);this.s=function(t){for(var e=[];t-- >0;)e.push(0);return e}(Math.min(this.m+1,this.n)),this.U=function t(e){if(0==e.length)return 0;for(var i=[],r=0;r<e[0];r++)i.push(t(e.slice(1)));return i}([this.m,e]),this.V=function t(e){if(0==e.length)return 0;for(var i=[],r=0;r<e[0];r++)i.push(t(e.slice(1)));return i}([this.n,this.n]);for(var i=function(t){for(var e=[];t-- >0;)e.push(0);return e}(this.n),n=function(t){for(var e=[];t-- >0;)e.push(0);return e}(this.m),o=Math.min(this.m-1,this.n),a=Math.max(0,Math.min(this.n-2,this.m)),s=0;s<Math.max(o,a);s++){if(s<o){this.s[s]=0;for(var h=s;h<this.m;h++)this.s[s]=r.hypot(this.s[s],t[h][s]);if(0!==this.s[s]){t[s][s]<0&&(this.s[s]=-this.s[s]);for(var l=s;l<this.m;l++)t[l][s]/=this.s[s];t[s][s]+=1}this.s[s]=-this.s[s]}for(var d=s+1;d<this.n;d++){if(p=s<o,v=0!==this.s[s],p&&v){for(var c=0,g=s;g<this.m;g++)c+=t[g][s]*t[g][d];c=-c/t[s][s];for(var u=s;u<this.m;u++)t[u][d]+=c*t[u][s]}i[d]=t[s][d]}if(y=s<o)for(var f=s;f<this.m;f++)this.U[f][s]=t[f][s];if(s<a){i[s]=0;for(var p,v,y,m,E,N=s+1;N<this.n;N++)i[s]=r.hypot(i[s],i[N]);if(0!==i[s]){i[s+1]<0&&(i[s]=-i[s]);for(var T=s+1;T<this.n;T++)i[T]/=i[s];i[s+1]+=1}if(i[s]=-i[s],m=s+1<this.m,E=0!==i[s],m&&E){for(var A=s+1;A<this.m;A++)n[A]=0;for(var L=s+1;L<this.n;L++)for(var C=s+1;C<this.m;C++)n[C]+=i[L]*t[C][L];for(var w=s+1;w<this.n;w++)for(var _=-i[w]/i[s+1],I=s+1;I<this.m;I++)t[I][w]+=_*n[I]}for(var M=s+1;M<this.n;M++)this.V[M][s]=i[M]}}var x=Math.min(this.n,this.m+1);o<this.n&&(this.s[o]=t[o][o]),this.m<x&&(this.s[x-1]=0),a+1<x&&(i[a]=t[a][x-1]),i[x-1]=0;for(var O=o;O<e;O++){for(var D=0;D<this.m;D++)this.U[D][O]=0;this.U[O][O]=1}for(var R=o-1;R>=0;R--)if(0!==this.s[R]){for(var b=R+1;b<e;b++){for(var F=0,G=R;G<this.m;G++)F+=this.U[G][R]*this.U[G][b];F=-F/this.U[R][R];for(var S=R;S<this.m;S++)this.U[S][b]+=F*this.U[S][R]}for(var P=R;P<this.m;P++)this.U[P][R]=-this.U[P][R];this.U[R][R]=1+this.U[R][R];for(var U=0;U<R-1;U++)this.U[U][R]=0}else{for(var Y=0;Y<this.m;Y++)this.U[Y][R]=0;this.U[R][R]=1}for(var k=this.n-1;k>=0;k--){if(tl=k<a,td=0!==i[k],tl&&td)for(var H=k+1;H<e;H++){for(var X=0,W=k+1;W<this.n;W++)X+=this.V[W][k]*this.V[W][H];X=-X/this.V[k+1][k];for(var z=k+1;z<this.n;z++)this.V[z][H]+=X*this.V[z][k]}for(var V=0;V<this.n;V++)this.V[V][k]=0;this.V[k][k]=1}for(var B=x-1;x>0;){var j=void 0,$=void 0;for(j=x-2;j>=-1&&-1!==j;j--)if(Math.abs(i[j])<=16033346880071782e-307+2220446049250313e-31*(Math.abs(this.s[j])+Math.abs(this.s[j+1]))){i[j]=0;break}if(j===x-2)$=4;else{var q=void 0;for(q=x-1;q>=j&&q!==j;q--){var Z=(q!==x?Math.abs(i[q]):0)+(q!==j+1?Math.abs(i[q-1]):0);if(Math.abs(this.s[q])<=16033346880071782e-307+2220446049250313e-31*Z){this.s[q]=0;break}}q===j?$=3:q===x-1?$=1:($=2,j=q)}switch(j++,$){case 1:var Q=i[x-2];i[x-2]=0;for(var J=x-2;J>=j;J--){var K=r.hypot(this.s[J],Q),tt=this.s[J]/K,te=Q/K;this.s[J]=K,J!==j&&(Q=-te*i[J-1],i[J-1]=tt*i[J-1]);for(var ti=0;ti<this.n;ti++)K=tt*this.V[ti][J]+te*this.V[ti][x-1],this.V[ti][x-1]=-te*this.V[ti][J]+tt*this.V[ti][x-1],this.V[ti][J]=K}break;case 2:var tr=i[j-1];i[j-1]=0;for(var tn=j;tn<x;tn++){var to=r.hypot(this.s[tn],tr),ta=this.s[tn]/to,ts=tr/to;this.s[tn]=to,tr=-ts*i[tn],i[tn]=ta*i[tn];for(var th=0;th<this.m;th++)to=ta*this.U[th][tn]+ts*this.U[th][j-1],this.U[th][j-1]=-ts*this.U[th][tn]+ta*this.U[th][j-1],this.U[th][tn]=to}break;case 3:var tl,td,tc,tg,tu=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[x-1]),Math.abs(this.s[x-2])),Math.abs(i[x-2])),Math.abs(this.s[j])),Math.abs(i[j])),tf=this.s[x-1]/tu,tp=this.s[x-2]/tu,tv=i[x-2]/tu,ty=this.s[j]/tu,tm=i[j]/tu,tE=((tp+tf)*(tp-tf)+tv*tv)/2,tN=tf*tv*(tf*tv),tT=0;tc=0!==tE,tg=0!==tN,(tc||tg)&&(tT=Math.sqrt(tE*tE+tN),tE<0&&(tT=-tT),tT=tN/(tE+tT));for(var tA=(ty+tf)*(ty-tf)+tT,tL=ty*tm,tC=j;tC<x-1;tC++){var tw=r.hypot(tA,tL),t_=tA/tw,tI=tL/tw;tC!==j&&(i[tC-1]=tw),tA=t_*this.s[tC]+tI*i[tC],i[tC]=t_*i[tC]-tI*this.s[tC],tL=tI*this.s[tC+1],this.s[tC+1]=t_*this.s[tC+1];for(var tM=0;tM<this.n;tM++)tw=t_*this.V[tM][tC]+tI*this.V[tM][tC+1],this.V[tM][tC+1]=-tI*this.V[tM][tC]+t_*this.V[tM][tC+1],this.V[tM][tC]=tw;if(tw=r.hypot(tA,tL),t_=tA/tw,tI=tL/tw,this.s[tC]=tw,tA=t_*i[tC]+tI*this.s[tC+1],this.s[tC+1]=-tI*i[tC]+t_*this.s[tC+1],tL=tI*i[tC+1],i[tC+1]=t_*i[tC+1],tC<this.m-1)for(var tx=0;tx<this.m;tx++)tw=t_*this.U[tx][tC]+tI*this.U[tx][tC+1],this.U[tx][tC+1]=-tI*this.U[tx][tC]+t_*this.U[tx][tC+1],this.U[tx][tC]=tw}i[x-2]=tA;break;case 4:if(this.s[j]<=0&&(this.s[j]=this.s[j]<0?-this.s[j]:0,1))for(var tO=0;tO<=B;tO++)this.V[tO][j]=-this.V[tO][j];for(;j<B&&!(this.s[j]>=this.s[j+1]);){var tD=this.s[j];if(this.s[j]=this.s[j+1],this.s[j+1]=tD,j<this.n-1)for(var tR=0;tR<this.n;tR++)tD=this.V[tR][j+1],this.V[tR][j+1]=this.V[tR][j],this.V[tR][j]=tD;if(j<this.m-1)for(var tb=0;tb<this.m;tb++)tD=this.U[tb][j+1],this.U[tb][j+1]=this.U[tb][j],this.U[tb][j]=tD;j++}x--}}return{U:this.U,V:this.V,S:this.s}},r.hypot=function(t,e){var i=void 0;return Math.abs(t)>Math.abs(e)?(i=e/t,i=Math.abs(t)*Math.sqrt(1+i*i)):0!=e?(i=t/e,i=Math.abs(e)*Math.sqrt(1+i*i)):i=0,i},t.exports=r},function(t,e,i){"use strict";var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),n=function(){function t(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;(function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")})(this,t),this.sequence1=e,this.sequence2=i,this.match_score=r,this.mismatch_penalty=n,this.gap_penalty=o,this.iMax=e.length+1,this.jMax=i.length+1,this.grid=Array(this.iMax);for(var a=0;a<this.iMax;a++){this.grid[a]=Array(this.jMax);for(var s=0;s<this.jMax;s++)this.grid[a][s]=0}this.tracebackGrid=Array(this.iMax);for(var h=0;h<this.iMax;h++){this.tracebackGrid[h]=Array(this.jMax);for(var l=0;l<this.jMax;l++)this.tracebackGrid[h][l]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(t,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var t=1;t<this.jMax;t++)this.grid[0][t]=this.grid[0][t-1]+this.gap_penalty,this.tracebackGrid[0][t]=[!1,!1,!0];for(var e=1;e<this.iMax;e++)this.grid[e][0]=this.grid[e-1][0]+this.gap_penalty,this.tracebackGrid[e][0]=[!1,!0,!1];for(var i=1;i<this.iMax;i++)for(var r=1;r<this.jMax;r++){var n=[this.sequence1[i-1]===this.sequence2[r-1]?this.grid[i-1][r-1]+this.match_score:this.grid[i-1][r-1]+this.mismatch_penalty,this.grid[i-1][r]+this.gap_penalty,this.grid[i][r-1]+this.gap_penalty],o=this.arrayAllMaxIndexes(n);this.grid[i][r]=n[o[0]],this.tracebackGrid[i][r]=[o.includes(0),o.includes(1),o.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var t=[];for(t.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});t[0];){var e=t[0],i=this.tracebackGrid[e.pos[0]][e.pos[1]];i[0]&&t.push({pos:[e.pos[0]-1,e.pos[1]-1],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),i[1]&&t.push({pos:[e.pos[0]-1,e.pos[1]],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:"-"+e.seq2}),i[2]&&t.push({pos:[e.pos[0],e.pos[1]-1],seq1:"-"+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),0===e.pos[0]&&0===e.pos[1]&&this.alignments.push({sequence1:e.seq1,sequence2:e.seq2}),t.shift()}return this.alignments}},{key:"getAllIndexes",value:function(t,e){for(var i=[],r=-1;-1!==(r=t.indexOf(e,r+1));)i.push(r);return i}},{key:"arrayAllMaxIndexes",value:function(t){return this.getAllIndexes(t,Math.max.apply(null,t))}}]),t}();t.exports=n},function(t,e,i){"use strict";var r=function(){};r.FDLayout=i(18),r.FDLayoutConstants=i(4),r.FDLayoutEdge=i(19),r.FDLayoutNode=i(20),r.DimensionD=i(21),r.HashMap=i(22),r.HashSet=i(23),r.IGeometry=i(8),r.IMath=i(9),r.Integer=i(10),r.Point=i(12),r.PointD=i(5),r.RandomSeed=i(16),r.RectangleD=i(13),r.Transform=i(17),r.UniqueIDGeneretor=i(14),r.Quicksort=i(25),r.LinkedList=i(11),r.LGraphObject=i(2),r.LGraph=i(6),r.LEdge=i(1),r.LGraphManager=i(7),r.LNode=i(3),r.Layout=i(15),r.LayoutConstants=i(0),r.NeedlemanWunsch=i(27),r.Matrix=i(24),r.SVD=i(26),t.exports=r},function(t,e,i){"use strict";function r(){this.listeners=[]}var n=r.prototype;n.addListener=function(t,e){this.listeners.push({event:t,callback:e})},n.removeListener=function(t,e){for(var i=this.listeners.length;i>=0;i--){var r=this.listeners[i];r.event===t&&r.callback===e&&this.listeners.splice(i,1)}},n.emit=function(t,e){for(var i=0;i<this.listeners.length;i++){var r=this.listeners[i];t===r.event&&r.callback(e)}},t.exports=r}])},t.exports=e()},959:function(t,e,i){"use strict";i.d(e,{diagram:function(){return Z}});var r=i(34960),n=i(66691),o=i(29891),a=i(94705),s=i(55166),h=i(31954),l=i(54327),d=i(59516),c=i(65512),g=i(84370),u={L:"left",R:"right",T:"top",B:"bottom"},f={L:(0,h.eW)(t=>`${t},${t/2} 0,${t} 0,0`,"L"),R:(0,h.eW)(t=>`0,${t/2} ${t},0 ${t},${t}`,"R"),T:(0,h.eW)(t=>`0,0 ${t},0 ${t/2},${t}`,"T"),B:(0,h.eW)(t=>`${t/2},0 ${t},${t} 0,${t}`,"B")},p={L:(0,h.eW)((t,e)=>t-e+2,"L"),R:(0,h.eW)((t,e)=>t-2,"R"),T:(0,h.eW)((t,e)=>t-e+2,"T"),B:(0,h.eW)((t,e)=>t-2,"B")},v=(0,h.eW)(function(t){return m(t)?"L"===t?"R":"L":"T"===t?"B":"T"},"getOppositeArchitectureDirection"),y=(0,h.eW)(function(t){return"L"===t||"R"===t||"T"===t||"B"===t},"isArchitectureDirection"),m=(0,h.eW)(function(t){return"L"===t||"R"===t},"isArchitectureDirectionX"),E=(0,h.eW)(function(t){return"T"===t||"B"===t},"isArchitectureDirectionY"),N=(0,h.eW)(function(t,e){let i=m(t)&&E(e),r=E(t)&&m(e);return i||r},"isArchitectureDirectionXY"),T=(0,h.eW)(function(t){let e=t[0],i=t[1],r=m(e)&&E(i),n=E(e)&&m(i);return r||n},"isArchitecturePairXY"),A=(0,h.eW)(function(t){return"LL"!==t&&"RR"!==t&&"TT"!==t&&"BB"!==t},"isValidArchitectureDirectionPair"),L=(0,h.eW)(function(t,e){let i=`${t}${e}`;return A(i)?i:void 0},"getArchitectureDirectionPair"),C=(0,h.eW)(function([t,e],i){let r=i[0],n=i[1];return m(r)?E(n)?[t+("L"===r?-1:1),e+("T"===n?1:-1)]:[t+("L"===r?-1:1),e]:m(n)?[t+("L"===n?1:-1),e+("T"===r?1:-1)]:[t,e+("T"===r?1:-1)]},"shiftPositionByArchitectureDirectionPair"),w=(0,h.eW)(function(t){return"LT"===t||"TL"===t?[1,1]:"BL"===t||"LB"===t?[1,-1]:"BR"===t||"RB"===t?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),_=(0,h.eW)(function(t,e){return N(t,e)?"bend":m(t)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),I=(0,h.eW)(function(t){return"service"===t.type},"isArchitectureService"),M=(0,h.eW)(function(t){return"junction"===t.type},"isArchitectureJunction"),x=(0,h.eW)(t=>t.data(),"edgeData"),O=(0,h.eW)(t=>t.data(),"nodeData"),D=s.vZ.architecture,R=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.setAccTitle=s.GN,this.getAccTitle=s.eu,this.setDiagramTitle=s.g2,this.getDiagramTitle=s.Kr,this.getAccDescription=s.Mx,this.setAccDescription=s.U$,this.clear()}static{(0,h.eW)(this,"ArchitectureDB")}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},(0,s.ZH)()}addService({id:t,icon:e,in:i,title:r,iconText:n}){if(void 0!==this.registeredIds[t])throw Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(void 0!==i){if(t===i)throw Error(`The service [${t}] cannot be placed within itself`);if(void 0===this.registeredIds[i])throw Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if("node"===this.registeredIds[i])throw Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:e,iconText:n,title:r,edges:[],in:i}}getServices(){return Object.values(this.nodes).filter(I)}addJunction({id:t,in:e}){this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:e}}getJunctions(){return Object.values(this.nodes).filter(M)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:e,in:i,title:r}){if(this.registeredIds?.[t]!==void 0)throw Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(void 0!==i){if(t===i)throw Error(`The group [${t}] cannot be placed within itself`);if(this.registeredIds?.[i]===void 0)throw Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[i]==="node")throw Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:e,title:r,in:i}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:e,lhsDir:i,rhsDir:r,lhsInto:n,rhsInto:o,lhsGroup:a,rhsGroup:s,title:h}){if(!y(i))throw Error(`Invalid direction given for left hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${String(i)}`);if(!y(r))throw Error(`Invalid direction given for right hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${String(r)}`);if(void 0===this.nodes[t]&&void 0===this.groups[t])throw Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(void 0===this.nodes[e]&&void 0===this.groups[e])throw Error(`The right-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);let l=this.nodes[t].in,d=this.nodes[e].in;if(a&&l&&d&&l==d)throw Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(s&&l&&d&&l==d)throw Error(`The right-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);this.edges.push({lhsId:t,lhsDir:i,lhsInto:n,lhsGroup:a,rhsId:e,rhsDir:r,rhsInto:o,rhsGroup:s,title:h}),this.nodes[t]&&this.nodes[e]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[e].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(void 0===this.dataStructures){let t={},e=Object.entries(this.nodes).reduce((e,[i,r])=>(e[i]=r.edges.reduce((e,r)=>{let n=this.getNode(r.lhsId)?.in,o=this.getNode(r.rhsId)?.in;if(n&&o&&n!==o){let e=_(r.lhsDir,r.rhsDir);"bend"!==e&&(t[n]??={},t[n][o]=e,t[o]??={},t[o][n]=e)}if(r.lhsId===i){let t=L(r.lhsDir,r.rhsDir);t&&(e[t]=r.rhsId)}else{let t=L(r.rhsDir,r.lhsDir);t&&(e[t]=r.lhsId)}return e},{}),e),{}),i=Object.keys(e)[0],r={[i]:1},n=Object.keys(e).reduce((t,e)=>e===i?t:{...t,[e]:1},{}),o=(0,h.eW)(t=>{let i={[t]:[0,0]},o=[t];for(;o.length>0;){let t=o.shift();if(t){r[t]=1,delete n[t];let a=e[t],[s,h]=i[t];Object.entries(a).forEach(([t,e])=>{r[e]||(i[e]=C([s,h],t),o.push(e))})}}return i},"BFS"),a=[o(i)];for(;Object.keys(n).length>0;)a.push(o(Object.keys(n)[0]));this.dataStructures={adjList:e,spatialMaps:a,groupAlignments:t}}return this.dataStructures}setElementForId(t,e){this.elements[t]=e}getElementById(t){return this.elements[t]}getConfig(){return(0,a.Rb)({...D,...(0,s.iE)().architecture})}getConfigField(t){return this.getConfig()[t]}},b=(0,h.eW)((t,e)=>{(0,o.A)(t,e),t.groups.map(t=>e.addGroup(t)),t.services.map(t=>e.addService({...t,type:"service"})),t.junctions.map(t=>e.addJunction({...t,type:"junction"})),t.edges.map(t=>e.addEdge(t))},"populateDb"),F={parser:{yy:void 0},parse:(0,h.eW)(async t=>{let e=await (0,l.Qc)("architecture",t);h.cM.debug(e);let i=F.parser?.yy;if(!(i instanceof R))throw Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");b(e,i)},"parse")},G=(0,h.eW)(t=>`
2
+ .edge {
3
+ stroke-width: ${t.archEdgeWidth};
4
+ stroke: ${t.archEdgeColor};
5
+ fill: none;
6
+ }
7
+
8
+ .arrow {
9
+ fill: ${t.archEdgeArrowColor};
10
+ }
11
+
12
+ .node-bkg {
13
+ fill: none;
14
+ stroke: ${t.archGroupBorderColor};
15
+ stroke-width: ${t.archGroupBorderWidth};
16
+ stroke-dasharray: 8;
17
+ }
18
+ .node-icon-text {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+
23
+ .node-icon-text > div {
24
+ color: #fff;
25
+ margin: 1px;
26
+ height: fit-content;
27
+ text-align: center;
28
+ overflow: hidden;
29
+ display: -webkit-box;
30
+ -webkit-box-orient: vertical;
31
+ }
32
+ `,"getStyles"),S=(0,h.eW)(t=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${t}</g>`,"wrapIcon"),P={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:S('<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},server:{body:S('<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>')},disk:{body:S('<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>')},internet:{body:S('<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},cloud:{body:S('<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},unknown:n.cN,blank:{body:S("")}}},U=(0,h.eW)(async function(t,e,i){let r=i.getConfigField("padding"),o=i.getConfigField("iconSize"),a=o/2,h=o/6,l=h/2;await Promise.all(e.edges().map(async e=>{let{source:o,sourceDir:d,sourceArrow:c,sourceGroup:g,target:u,targetDir:v,targetArrow:y,targetGroup:A,label:C}=x(e),{x:_,y:I}=e[0].sourceEndpoint(),{x:M,y:O}=e[0].midpoint(),{x:D,y:R}=e[0].targetEndpoint(),b=r+4;if(g&&(m(d)?_+="L"===d?-b:b:I+="T"===d?-b:b+18),A&&(m(v)?D+="L"===v?-b:b:R+="T"===v?-b:b+18),g||i.getNode(o)?.type!=="junction"||(m(d)?_+="L"===d?a:-a:I+="T"===d?a:-a),A||i.getNode(u)?.type!=="junction"||(m(v)?D+="L"===v?a:-a:R+="T"===v?a:-a),e[0]._private.rscratch){let e=t.insert("g");if(e.insert("path").attr("d",`M ${_},${I} L ${M},${O} L${D},${R} `).attr("class","edge"),c){let t=m(d)?p[d](_,h):_-l,i=E(d)?p[d](I,h):I-l;e.insert("polygon").attr("points",f[d](h)).attr("transform",`translate(${t},${i})`).attr("class","arrow")}if(y){let t=m(v)?p[v](D,h):D-l,i=E(v)?p[v](R,h):R-l;e.insert("polygon").attr("points",f[v](h)).attr("transform",`translate(${t},${i})`).attr("class","arrow")}if(C){let t=N(d,v)?"XY":m(d)?"X":"Y",i=0;i="X"===t?Math.abs(_-D):"Y"===t?Math.abs(I-R)/1.5:Math.abs(_-D)/2;let r=e.append("g");if(await (0,n.rw)(r,C,{useHtmlLabels:!1,width:i,classes:"architecture-service-label"},(0,s.nV)()),r.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),"X"===t)r.attr("transform","translate("+M+", "+O+")");else if("Y"===t)r.attr("transform","translate("+M+", "+O+") rotate(-90)");else if("XY"===t){let t=L(d,v);if(t&&T(t)){let e=r.node().getBoundingClientRect(),[i,n]=w(t);r.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*i*n*45})`);let o=r.node().getBoundingClientRect();r.attr("transform",`
33
+ translate(${M}, ${O-e.height/2})
34
+ translate(${i*o.width/2}, ${n*o.height/2})
35
+ rotate(${-1*i*n*45}, 0, ${e.height/2})
36
+ `)}}}}}))},"drawEdges"),Y=(0,h.eW)(async function(t,e,i){let r=.75*i.getConfigField("padding"),o=i.getConfigField("fontSize"),a=i.getConfigField("iconSize")/2;await Promise.all(e.nodes().map(async e=>{let i=O(e);if("group"===i.type){let{h,w:l,x1:d,y1:c}=e.boundingBox();t.append("rect").attr("x",d+a).attr("y",c+a).attr("width",l).attr("height",h).attr("class","node-bkg");let g=t.append("g"),u=d,f=c;if(i.icon){let t=g.append("g");t.html(`<g>${await (0,n.s4)(i.icon,{height:r,width:r,fallbackPrefix:P.prefix})}</g>`),t.attr("transform","translate("+(u+a+1)+", "+(f+a+1)+")"),u+=r,f+=o/2-1-2}if(i.label){let t=g.append("g");await (0,n.rw)(t,i.label,{useHtmlLabels:!1,width:l,classes:"architecture-service-label"},(0,s.nV)()),t.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),t.attr("transform","translate("+(u+a+4)+", "+(f+a+2)+")")}}}))},"drawGroups"),k=(0,h.eW)(async function(t,e,i){let r=(0,s.nV)();for(let o of i){let i=e.append("g"),a=t.getConfigField("iconSize");if(o.title){let t=i.append("g");await (0,n.rw)(t,o.title,{useHtmlLabels:!1,width:1.5*a,classes:"architecture-service-label"},r),t.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),t.attr("transform","translate("+a/2+", "+a+")")}let h=i.append("g");if(o.icon)h.html(`<g>${await (0,n.s4)(o.icon,{height:a,width:a,fallbackPrefix:P.prefix})}</g>`);else if(o.iconText){h.html(`<g>${await (0,n.s4)("blank",{height:a,width:a,fallbackPrefix:P.prefix})}</g>`);let t=h.append("g").append("foreignObject").attr("width",a).attr("height",a).append("div").attr("class","node-icon-text").attr("style",`height: ${a}px;`).append("div").html((0,s.oO)(o.iconText,r)),e=parseInt(window.getComputedStyle(t.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;t.attr("style",`-webkit-line-clamp: ${Math.floor((a-2)/e)};`)}else h.append("path").attr("class","node-bkg").attr("id","node-"+o.id).attr("d",`M0 ${a} v${-a} q0,-5 5,-5 h${a} q5,0 5,5 v${a} H0 Z`);i.attr("class","architecture-service");let{width:l,height:d}=i._groups[0][0].getBBox();o.width=l,o.height=d,t.setElementForId(o.id,i)}return 0},"drawServices"),H=(0,h.eW)(function(t,e,i){i.forEach(i=>{let r=e.append("g"),n=t.getConfigField("iconSize");r.append("g").append("rect").attr("id","node-"+i.id).attr("fill-opacity","0").attr("width",n).attr("height",n),r.attr("class","architecture-junction");let{width:o,height:a}=r._groups[0][0].getBBox();r.width=o,r.height=a,t.setElementForId(i.id,r)})},"drawJunctions");function X(t,e,i){t.forEach(t=>{e.add({group:"nodes",data:{type:"service",id:t.id,icon:t.icon,label:t.title,parent:t.in,width:i.getConfigField("iconSize"),height:i.getConfigField("iconSize")},classes:"node-service"})})}function W(t,e,i){t.forEach(t=>{e.add({group:"nodes",data:{type:"junction",id:t.id,parent:t.in,width:i.getConfigField("iconSize"),height:i.getConfigField("iconSize")},classes:"node-junction"})})}function z(t,e){e.nodes().map(e=>{let i=O(e);"group"!==i.type&&(i.x=e.position().x,i.y=e.position().y,t.getElementById(i.id).attr("transform","translate("+(i.x||0)+","+(i.y||0)+")"))})}function V(t,e){t.forEach(t=>{e.add({group:"nodes",data:{type:"group",id:t.id,icon:t.icon,label:t.title,parent:t.in},classes:"node-group"})})}function B(t,e){t.forEach(t=>{let{lhsId:i,rhsId:r,lhsInto:n,lhsGroup:o,rhsInto:a,lhsDir:s,rhsDir:h,rhsGroup:l,title:d}=t,c=N(t.lhsDir,t.rhsDir)?"segments":"straight",g={id:`${i}-${r}`,label:d,source:i,sourceDir:s,sourceArrow:n,sourceGroup:o,sourceEndpoint:"L"===s?"0 50%":"R"===s?"100% 50%":"T"===s?"50% 0":"50% 100%",target:r,targetDir:h,targetArrow:a,targetGroup:l,targetEndpoint:"L"===h?"0 50%":"R"===h?"100% 50%":"T"===h?"50% 0":"50% 100%"};e.add({group:"edges",data:g,classes:c})})}function j(t,e,i){let r=(0,h.eW)((t,e)=>Object.entries(t).reduce((t,[r,n])=>{let o=0,a=Object.entries(n);if(1===a.length)return t[r]=a[0][1],t;for(let n=0;n<a.length-1;n++)for(let s=n+1;s<a.length;s++){let[h,l]=a[n],[d,c]=a[s];i[h]?.[d]===e?(t[r]??=[],t[r]=[...t[r],...l,...c]):"default"===h||"default"===d?(t[r]??=[],t[r]=[...t[r],...l,...c]):(t[`${r}-${o++}`]=l,t[`${r}-${o++}`]=c)}return t},{}),"flattenAlignments"),[n,o]=e.map(e=>{let i={},n={};return Object.entries(e).forEach(([e,[r,o]])=>{let a=t.getNode(e)?.in??"default";i[o]??={},i[o][a]??=[],i[o][a].push(e),n[r]??={},n[r][a]??=[],n[r][a].push(e)}),{horiz:Object.values(r(i,"horizontal")).filter(t=>t.length>1),vert:Object.values(r(n,"vertical")).filter(t=>t.length>1)}}).reduce(([t,e],{horiz:i,vert:r})=>[[...t,...i],[...e,...r]],[[],[]]);return{horizontal:n,vertical:o}}function $(t,e){let i=[],r=(0,h.eW)(t=>`${t[0]},${t[1]}`,"posToStr"),n=(0,h.eW)(t=>t.split(",").map(t=>parseInt(t)),"strToPos");return t.forEach(t=>{let o=Object.fromEntries(Object.entries(t).map(([t,e])=>[r(e),t])),a=[r([0,0])],s={},h={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;a.length>0;){let t=a.shift();if(t){s[t]=1;let l=o[t];if(l){let d=n(t);Object.entries(h).forEach(([t,n])=>{let h=r([d[0]+n[0],d[1]+n[1]]),c=o[h];c&&!s[h]&&(a.push(h),i.push({[u[t]]:c,[u[v(t)]]:l,gap:1.5*e.getConfigField("iconSize")}))})}}}}),i}function q(t,e,i,r,n,{spatialMaps:o,groupAlignments:a}){return new Promise(s=>{let l=(0,g.Ys)("body").append("div").attr("id","cy").attr("style","display:none"),c=(0,d.Z)({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${n.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${n.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});l.remove(),V(i,c),X(t,c,n),W(e,c,n),B(r,c);let u=j(n,o,a),f=$(o,n),p=c.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(t){let[e,i]=t.connectedNodes(),{parent:r}=O(e),{parent:o}=O(i);return r===o?1.5*n.getConfigField("iconSize"):.5*n.getConfigField("iconSize")},edgeElasticity(t){let[e,i]=t.connectedNodes(),{parent:r}=O(e),{parent:n}=O(i);return r===n?.45:.001},alignmentConstraint:u,relativePlacementConstraint:f});p.one("layoutstop",()=>{function t(t,e,i,r){let n,o;let{x:a,y:s}=t,{x:h,y:l}=e;o=(r-s+(a-i)*(s-l)/(a-h))/Math.sqrt(1+Math.pow((s-l)/(a-h),2)),n=Math.sqrt(Math.pow(r-s,2)+Math.pow(i-a,2)-Math.pow(o,2))/Math.sqrt(Math.pow(h-a,2)+Math.pow(l-s,2));let d=(h-a)*(r-s)-(l-s)*(i-a);switch(!0){case d>=0:d=1;break;case d<0:d=-1}let c=(h-a)*(i-a)+(l-s)*(r-s);switch(!0){case c>=0:c=1;break;case c<0:c=-1}return{distances:o=Math.abs(o)*d,weights:n*=c}}for(let e of((0,h.eW)(t,"getSegmentWeights"),c.startBatch(),Object.values(c.edges())))if(e.data?.()){let{x:i,y:r}=e.source().position(),{x:n,y:o}=e.target().position();if(i!==n&&r!==o){let i=e.sourceEndpoint(),r=e.targetEndpoint(),{sourceDir:n}=x(e),[o,a]=E(n)?[i.x,r.y]:[r.x,i.y],{weights:s,distances:h}=t(i,r,o,a);e.style("segment-distances",h),e.style("segment-weights",s)}}c.endBatch(),p.run()}),p.run(),c.ready(t=>{h.cM.info("Ready",t),s(c)})})}(0,n.ef)([{name:P.prefix,icons:P}]),d.Z.use(c),(0,h.eW)(X,"addServices"),(0,h.eW)(W,"addJunctions"),(0,h.eW)(z,"positionNodes"),(0,h.eW)(V,"addGroups"),(0,h.eW)(B,"addEdges"),(0,h.eW)(j,"getAlignments"),(0,h.eW)($,"getRelativeConstraints"),(0,h.eW)(q,"layoutArchitecture");var Z={parser:F,get db(){return new R},renderer:{draw:(0,h.eW)(async(t,e,i,n)=>{let o=n.db,a=o.getServices(),h=o.getJunctions(),l=o.getGroups(),d=o.getEdges(),c=o.getDataStructures(),g=(0,r.P)(e),u=g.append("g");u.attr("class","architecture-edges");let f=g.append("g");f.attr("class","architecture-services");let p=g.append("g");p.attr("class","architecture-groups"),await k(o,f,a),H(o,f,h);let v=await q(a,h,l,d,o,c);await U(u,v,o),await Y(p,v,o),z(o,v),(0,s.j7)(void 0,g,o.getConfigField("padding"),o.getConfigField("useMaxWidth"))},"draw")},styles:G}},29891:function(t,e,i){"use strict";function r(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}i.d(e,{A:function(){return r}}),(0,i(31954).eW)(r,"populateCommonDb")}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9808],{29808:function(e,t,n){"use strict";n.d(t,{Z:function(){return eL}});var a=n(57437),s=n(42501),r=n.n(s),l=n(2265),o=n(48614),i=n(98239),c=n(91499),d=n.n(c),u=n(19983),h=n(13506),m=n.n(h),g=n(34040),f=n(54887);n(2446);var x=n(37052),p=n(19273),v=n(3244),j=n(4235),w=n(66070),y=n(69304),b=n(57054),N=n(18848),M=n(42225),k=n(27648);let C=new u.Z({html:!0,linkify:!0,typographer:!0});function _(e){let t=(0,M.Le)(e.title||".txt","w-6 h-6 text-muted-foreground inline-flex mr-2"),n=e.title.split("/").pop()||e.title,s=function(e){let t=["org","md","markdown"].includes(e.title.split(".").pop()||"")?e.content.split("\n").slice(1).join("\n"):e.content;return e.showFullContent?N.Z.sanitize(C.render(t)):N.Z.sanitize(t)}(e),[r,o]=(0,l.useState)(!1);return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(b.J2,{open:r&&!e.showFullContent,onOpenChange:o,children:[(0,a.jsx)(b.xo,{asChild:!0,children:(0,a.jsx)(w.Zb,{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"".concat(e.showFullContent?"w-auto bg-muted":"w-auto"," overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none"),children:e.showFullContent?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("h3",{className:"".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground}"),children:[t,e.showFullContent?e.title:n]}),(0,a.jsx)("p",{className:"text-sm overflow-x-auto block",dangerouslySetInnerHTML:{__html:s}})]}):(0,a.jsx)(T,{type:"notes"},"".concat(e.title))})}),(0,a.jsx)(b.yk,{className:"w-[400px] mx-2",children:(0,a.jsxs)(w.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none p-2",children:[(0,a.jsxs)("h3",{className:"line-clamp-2 text-muted-foreground}",children:[t,e.title]}),(0,a.jsx)("p",{className:"border-t mt-1 pt-1 text-sm overflow-hidden line-clamp-5",dangerouslySetInnerHTML:{__html:s}})]})})]})})}function S(e){var t,n,s,r,o,i;let c=(0,M.Le)(".py","!w-4 h-4 text-muted-foreground flex-shrink-0"),d=N.Z.sanitize(e.code),[u,h]=(0,l.useState)(!1),[m,g]=(0,l.useState)(!1),f=e=>{let t="text/plain",n=e.b64_data;e.filename.match(/\.(png|jpg|jpeg|webp)$/)?(t="image/".concat(e.filename.split(".").pop()),n=atob(e.b64_data)):e.filename.endsWith(".json")?t="application/json":e.filename.endsWith(".csv")&&(t="text/csv");let a=new ArrayBuffer(n.length),s=new Uint8Array(a);for(let e=0;e<n.length;e++)s[e]=n.charCodeAt(e);let r=new Blob([a],{type:t}),l=URL.createObjectURL(r),o=document.createElement("a");o.href=l,o.download=e.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(l)},p=(t,n)=>(null==t?void 0:t.length)==0?null:(0,a.jsx)("div",{className:"".concat(n||e.showFullContent?"border-t mt-1 pt-1":void 0),children:t.slice(0,e.showFullContent?void 0:1).map((t,s)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("h4",{className:"text-sm text-muted-foreground flex items-center",children:[(0,a.jsx)("span",{className:"overflow-hidden mr-2 font-bold ".concat(e.showFullContent?void 0:"line-clamp-1"),children:t.filename}),(0,a.jsx)("button",{className:"".concat(n?"hidden":void 0),onClick:e=>{e.preventDefault(),f(t)},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),title:"Download file: ".concat(t.filename),children:(0,a.jsx)(x.b,{className:"w-4 h-4",weight:m?"fill":"regular"})})]}),t.filename.match(/\.(txt|org|md|csv|json)$/)?(0,a.jsx)("pre",{className:"".concat(e.showFullContent?"block":"line-clamp-2"," text-sm mt-1 p-1 bg-background rounded overflow-x-auto"),children:t.b64_data}):t.filename.match(/\.(png|jpg|jpeg|webp)$/)?(0,a.jsx)("img",{src:"data:image/".concat(t.filename.split(".").pop(),";base64,").concat(t.b64_data),alt:t.filename,className:"mt-1 max-h-32 rounded"}):null]},"".concat(t.filename,"-").concat(s)))});return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(b.J2,{open:u&&!e.showFullContent,onOpenChange:h,children:[(0,a.jsx)(b.xo,{asChild:!0,children:(0,a.jsx)(w.Zb,{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:"".concat(e.showFullContent?"w-auto bg-muted":"w-auto"," overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none"),children:e.showFullContent?(0,a.jsxs)("div",{className:"flex flex-col px-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[c,(0,a.jsxs)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:["code ",(null===(t=e.output_files)||void 0===t?void 0:t.length)>0?"artifacts":""]})]}),(0,a.jsx)("pre",{className:"text-xs pb-2 ".concat(e.showFullContent?"block overflow-x-auto":(null===(n=e.output_files)||void 0===n?void 0:n.length)>0?"hidden":"overflow-hidden line-clamp-3"),children:d}),(null===(s=e.output_files)||void 0===s?void 0:s.length)>0&&p(e.output_files,!1)]}):(0,a.jsx)(T,{type:"code"},"code-".concat(e.code))})}),(0,a.jsx)(b.yk,{className:"w-[400px] mx-2",children:(0,a.jsxs)(w.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none p-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[c,(0,a.jsxs)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:["code ",(null===(r=e.output_files)||void 0===r?void 0:r.length)>0?"artifact":""]})]}),(null===(o=e.output_files)||void 0===o?void 0:o.length)>0&&p(null===(i=e.output_files)||void 0===i?void 0:i.slice(0,1),!0)||(0,a.jsx)("pre",{className:"text-xs border-t mt-1 pt-1 overflow-hidden line-clamp-10",children:d})]})})]})})}function E(e){let[t,n]=(0,l.useState)(!1);if(!e.link||e.link.split(" ").length>1)return null;let s="https://www.google.com/s2/favicons?domain=globe",r="unknown";try{r=new URL(e.link).hostname,s="https://www.google.com/s2/favicons?domain=".concat(r)}catch(t){return console.warn("Error parsing domain from link: ".concat(e.link)),null}return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(b.J2,{open:t&&!e.showFullContent,onOpenChange:n,children:[(0,a.jsx)(b.xo,{asChild:!0,children:(0,a.jsx)(w.Zb,{onMouseEnter:()=>{n(!0)},onMouseLeave:()=>{n(!1)},className:"".concat(e.showFullContent?"w-auto bg-muted":"w-auto"," overflow-hidden break-words text-balance rounded-lg border-none p-2 shadow-none"),children:e.showFullContent?(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(k.default,{href:e.link,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 flex-shrink-0"}),(0,a.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," text-muted-foreground flex-grow"),children:r})]})}),(0,a.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-1"," font-bold"),children:e.title}),(0,a.jsx)("p",{className:"overflow-hidden text-sm ".concat(e.showFullContent?"block":"line-clamp-2"),children:e.description})]}):(0,a.jsx)(T,{type:"online",link:e.link},e.title)})}),(0,a.jsx)(b.yk,{className:"w-[400px] mx-2",children:(0,a.jsx)(w.Zb,{className:"w-auto overflow-hidden break-words text-balance rounded-lg border-none",children:(0,a.jsx)("div",{className:"flex flex-col",children:(0,a.jsxs)("a",{href:e.link,target:"_blank",rel:"noreferrer",className:"!no-underline px-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("img",{src:s,alt:"",className:"!w-4 h-4 flex-shrink-0"}),(0,a.jsx)("h3",{className:"overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," text-muted-foreground flex-grow"),children:r})]}),(0,a.jsx)("h3",{className:"border-t mt-1 pt-1 overflow-hidden ".concat(e.showFullContent?"block":"line-clamp-2"," font-bold"),children:e.title}),(0,a.jsx)("p",{className:"overflow-hidden text-sm ".concat(e.showFullContent?"block":"line-clamp-5"),children:e.description})]})})})})]})})}function T(e){let t="",n="unknown";if(e.link)try{n=new URL(e.link).hostname,t="https://www.google.com/s2/favicons?domain=".concat(n)}catch(t){return console.warn("Error parsing domain from link: ".concat(e.link)),null}let s=null,r="!w-4 !h-4 text-muted-foreground inline-flex mr-2 rounded-lg";switch(e.type){case"code":s=(0,a.jsx)(p.E,{className:"".concat(r)});break;case"online":s=(0,a.jsx)("img",{src:t,alt:"",className:"".concat(r)});break;case"notes":s=(0,a.jsx)(v.j,{className:"".concat(r)});break;default:s=null}return s?(0,a.jsx)("div",{className:"flex items-center gap-2",children:s}):null}function R(e){let t=e.notesReferenceCardData.length>0||e.codeReferenceCardData.length>0||e.onlineReferenceCardData.length>0,n=e.notesReferenceCardData.length+e.codeReferenceCardData.length+e.onlineReferenceCardData.length;return 0===n?null:(0,a.jsx)("div",{className:"pt-0 px-4 pb-4",children:(0,a.jsxs)("h3",{className:"inline-flex items-center",children:[(0,a.jsxs)("div",{className:"text-gray-400 m-2",children:[n," sources"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 w-auto m-2",children:t&&(0,a.jsx)(I,{notesReferenceCardData:e.notesReferenceCardData,onlineReferenceCardData:e.onlineReferenceCardData,codeReferenceCardData:e.codeReferenceCardData,isMobileWidth:e.isMobileWidth})})]})})}function I(e){let[t,n]=(0,l.useState)(3);if((0,l.useEffect)(()=>{n(e.isMobileWidth?3:5)},[e.isMobileWidth]),!e.notesReferenceCardData&&!e.onlineReferenceCardData)return null;let s=e.codeReferenceCardData.slice(0,t),r=e.notesReferenceCardData.slice(0,t-s.length),o=r.length+s.length<t?e.onlineReferenceCardData.filter(e=>e.link).slice(0,t-s.length-r.length):[];return(0,a.jsxs)(y.yo,{children:[(0,a.jsxs)(y.aM,{className:"text-balance w-auto justify-start overflow-hidden break-words p-0 bg-transparent border-none text-gray-400 align-middle items-center m-0 inline-flex",children:[s.map((e,t)=>(0,l.createElement)(S,{showFullContent:!1,...e,key:"code-".concat(t)})),r.map((e,t)=>(0,l.createElement)(_,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),o.map((e,t)=>(0,l.createElement)(E,{showFullContent:!1,...e,key:"".concat(e.title,"-").concat(t)})),(0,a.jsx)(j.o,{className:"m-0"})]}),(0,a.jsxs)(y.ue,{className:"overflow-y-scroll",children:[(0,a.jsxs)(y.Tu,{children:[(0,a.jsx)(y.bC,{children:"References"}),(0,a.jsx)(y.Ei,{children:"View all references for this response"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 w-auto mt-2",children:[e.codeReferenceCardData.map((e,t)=>(0,l.createElement)(S,{showFullContent:!0,...e,key:"code-".concat(t)})),e.notesReferenceCardData.map((e,t)=>(0,l.createElement)(_,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)})),e.onlineReferenceCardData.map((e,t)=>(0,l.createElement)(E,{showFullContent:!0,...e,key:"".concat(e.title,"-").concat(t)}))]})]})]})}var O=n(59199);function L(e){let{content:t,targetLine:n,maxLines:s=20}=e,r=(t||"").split("\n");if(n&&n>0&&n<=r.length){let e=Math.max(1,n-2),t=Math.min(r.length,n+5),s=r.slice(e-1,t);return(0,a.jsx)("pre",{className:"whitespace-pre-wrap text-xs",children:s.map((t,s)=>{let r=e+s,l=r===n;return(0,a.jsxs)("div",{className:l?"bg-green-100 dark:bg-green-900":"",children:[(0,a.jsxs)("span",{className:"text-gray-400 select-none mr-2",children:[r.toString().padStart(3," "),":"]}),t]},r)})})}let l=r.slice(0,s);return(0,a.jsxs)("pre",{className:"whitespace-pre-wrap text-xs",children:[l.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"text-gray-400 select-none mr-2",children:[(t+1).toString().padStart(3," "),":"]}),e]},t)),r.length>s&&(0,a.jsxs)("div",{className:"text-gray-500 italic",children:["... and ",r.length-s," more lines"]})]})}function F(e,t){let[n,a]=(0,l.useState)(""),[s,r]=(0,l.useState)(!1),[o,i]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let n=!1;return async function(){if(t&&e){r(!0),i(null),a("");try{let t=await fetch("/api/content/file?file_name=".concat(encodeURIComponent(e)));if(!t.ok)throw Error("Failed to fetch file content (".concat(t.status,")"));let s=await t.json();n||a(s.raw_text||"")}catch(e){n||i(e instanceof Error?e.message:"Failed to load file content")}finally{n||r(!1)}}}(),()=>{n=!0}},[e,t]),{content:n,loading:s,error:o}}var D=n(24379),B=n(58441),P=n(49807),A=n(74541),z=n(52874),q=n(5033),U=n(30655),H=n(80382),Z=n(7143),W=n(2585),V=n(58905),G=n(39966),$=n(71640),J=n(24148),Q=n(68382),K=n(78582),Y=n(96620),X=n(77276),ee=n(39957),et=n(14308),en=n(84671),ea=n(36663);let es=(0,n(30166).default)(()=>Promise.all([n.e(6555),n.e(7293),n.e(4609),n.e(2242)]).then(n.bind(n,92242)).then(e=>e.default),{loadableGenerated:{webpack:()=>[92242]},ssr:!1});function er(e){return(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(et.Z,{}),children:(0,a.jsx)(es,{data:e.data})})}var el=n(26110),eo=n(49027),ei=n(7436),ec=n(19378),ed=n(50656),eu=n(45199),eh=n(25778),em=n(62869),eg=e=>{let{chart:t}=e,[n,s]=(0,l.useState)(null),[r]=(0,l.useState)("mermaid-chart-".concat(Math.random().toString(12).substring(7))),o=(0,l.useRef)(null);(0,l.useEffect)(()=>{ed.Z.initialize({startOnLoad:!1}),ed.Z.parseError=e=>{let t;console.error("Mermaid errors:",e);try{t="string"==typeof e?JSON.parse(e):e}catch(n){t=(null==e?void 0:e.toString())||"Unknown error"}console.log("Mermaid error message:",t),"element is null"!==t.str?s("Something went wrong while rendering the diagram. Please try again later or downvote the message if the issue persists."):s(null)},ed.Z.contentLoaded()},[]);let i=async()=>{if(o.current)try{var e;let t=o.current.querySelector("svg");if(!t)throw Error("No SVG found");let[,,n,a]=(null===(e=t.getAttribute("viewBox"))||void 0===e?void 0:e.split(" ").map(Number))||[0,0,0,0],s=document.createElement("canvas");s.width=2*n,s.height=2*a;let r=s.getContext("2d");if(!r)throw Error("Failed to get canvas context");let l=new XMLSerializer().serializeToString(t),i=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(i),d=new Image;d.src=c,await new Promise((e,t)=>{d.onload=()=>{r.scale(2,2),r.drawImage(d,0,0,n,a),s.toBlob(n=>{if(!n){t(Error("Failed to create blob"));return}let a=URL.createObjectURL(n),s=document.createElement("a");s.href=a,s.download="mermaid-diagram-".concat(Date.now(),".png"),s.click(),URL.revokeObjectURL(a),URL.revokeObjectURL(c),e(!0)},"image/png")},d.onerror=()=>t(Error("Failed to load SVG"))})}catch(e){console.error("Error exporting diagram:",e),s("Failed to export diagram")}};return(0,l.useEffect)(()=>{o.current&&(o.current.removeAttribute("data-processed"),ed.Z.run({nodes:[o.current]}).then(()=>{s(null)}).catch(e=>{let t;try{t="string"==typeof e?JSON.parse(e):e}catch(n){t=(null==e?void 0:e.toString())||"Unknown error"}console.log("Mermaid error message:",t),"element is null"!==t.str?s("Something went wrong while rendering the diagram. Please try again later or downvote the message if the issue persists."):s(null)}))},[t]),(0,a.jsxs)("div",{children:[n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 bg-red-100 border border-red-500 rounded-md p-1 mt-3 text-red-900 text-sm",children:[(0,a.jsx)(eu.k,{className:"w-12 h-12"}),(0,a.jsx)("span",{children:n})]}),(0,a.jsx)("code",{className:"block bg-secondary text-secondary-foreground p-4 mt-3 rounded-lg font-mono text-sm whitespace-pre-wrap overflow-x-auto max-h-[400px] border border-gray-200",children:t})]}):(0,a.jsx)("div",{id:r,ref:o,className:"mermaid",style:{width:"auto",height:"auto",boxSizing:"border-box",overflow:"auto"},children:t}),!n&&(0,a.jsxs)(em.z,{onClick:i,variant:"secondary",className:"mt-3",children:[(0,a.jsx)(eh.U,{className:"w-5 h-5"}),"Export as PNG"]})]})};let ef=new u.Z({html:!0,linkify:!0,typographer:!0});function ex(e,t,n){fetch("/api/chat/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uquery:e,kquery:t,sentiment:n})})}function ep(e){let{uquery:t,kquery:n}=e,[s,r]=(0,l.useState)(null);return(0,l.useEffect)(()=>{null!==s&&setTimeout(()=>{r(null)},2e3)},[s]),(0,a.jsxs)("div",{className:"".concat(d().feedbackButtons," flex align-middle justify-center items-center"),children:[(0,a.jsx)("button",{title:"Like",className:d().thumbsUpButton,disabled:null!==s,onClick:()=>{ex(t,n,"positive"),r(!0)},children:!0===s?(0,a.jsx)(D.V,{alt:"Liked Message",className:"text-green-500",weight:"fill"}):(0,a.jsx)(D.V,{alt:"Like Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),(0,a.jsx)("button",{title:"Dislike",className:d().thumbsDownButton,disabled:null!==s,onClick:()=>{ex(t,n,"negative"),r(!1)},children:!1===s?(0,a.jsx)(B.L,{alt:"Disliked Message",className:"text-red-500",weight:"fill"}):(0,a.jsx)(B.L,{alt:"Dislike Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})})]})}function ev(e){let t=e.message.match(/\*\*(.*)\*\*/),n=function(e,t){let n=e.toLowerCase(),s="inline mt-1 mr-2 ".concat(t," h-4 w-4");return n.includes("understanding")?(0,a.jsx)(P.a,{className:"".concat(s)}):n.includes("generating")?(0,a.jsx)(A.Z,{className:"".concat(s)}):n.includes("tools")?(0,a.jsx)(z.v,{className:"".concat(s)}):n.includes("notes")?(0,a.jsx)(q.gt,{className:"".concat(s)}):n.includes("read")?(0,a.jsx)(U.f,{className:"".concat(s)}):n.includes("search")?(0,a.jsx)(H.Y,{className:"".concat(s)}):n.includes("summary")||n.includes("summarize")||n.includes("enhanc")?(0,a.jsx)(Z.u,{className:"".concat(s)}):n.includes("diagram")?(0,a.jsx)(W.j,{className:"".concat(s)}):n.includes("paint")?(0,a.jsx)(V.Y,{className:"".concat(s)}):n.includes("code")?(0,a.jsx)(p.E,{className:"".concat(s)}):n.includes("operating")?(0,a.jsx)(G.A,{className:"".concat(s)}):(0,a.jsx)(P.a,{className:"".concat(s)})}(t?t[1]:"",e.primary?(0,en.oz)(e.agentColor):"text-gray-500"),s=e.message,r=null;try{let e=s.match(/\{.*("action": "screenshot"|"type": "screenshot"|"image": "data:image\/.*").*\}/);if(e){r=JSON.parse(e[0]);let t='<img src="'.concat(r.image,'" alt="State of environment" class="max-w-full" />');s=s.replace(":\n**Action**: ".concat(e[0]),"\n\n- ".concat(r.text,"\n").concat(t))}}catch(e){console.error("Failed to parse screenshot data",e)}let l=N.Z.sanitize(ef.render(s));return l=l.replace(/<h[1-6].*?<\/h[1-6]>/g,""),(0,a.jsxs)("div",{className:"".concat(d().trainOfThoughtElement," break-words items-center ").concat(e.primary?"text-gray-400":"text-gray-300"," ").concat(d().trainOfThought," ").concat(e.primary?d().primary:""),children:[n,(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:l},className:"break-words"})]})}ef.use(m(),{inline:!0,code:!0}),ef.use(function(e){let t=e.renderer.rules.link_open||function(e,t,n,a,s){return s.renderToken(e,t,n)};e.renderer.rules.link_open=function(e,n,a,s,r){let l=e[n],o=l.attrIndex("href");if(o>=0){let e=l.attrs[o][1];if(e.startsWith("filelink://")){let t=e.replace("filelink://","").match(/^(.+?)(?:#line=(\d+))?$/);if(t){let e=t[1],n=t[2];l.attrSet("data-file-path",e),n&&l.attrSet("data-line-number",n);let a=l.attrIndex("class");a>=0&&l.attrs?l.attrs[a][1]="".concat(l.attrs[a][1]," file-link"):l.attrSet("class","file-link"),l.attrSet("href","#"),l.attrSet("role","button"),l.attrSet("tabindex","0")}}}return t(e,n,a,s,r)}});let ej=(0,l.forwardRef)((e,t)=>{var n,s;let r,o;let[i,c]=(0,l.useState)(!1),[u,h]=(0,l.useState)(!1),[m,x]=(0,l.useState)(""),[p,v]=(0,l.useState)(""),[j,w]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),[k,C]=(0,l.useState)(""),[_,S]=(0,l.useState)(""),[E,T]=(0,l.useState)(!1),[I,D]=(0,l.useState)(""),[B,P]=(0,l.useState)(void 0),[A,z]=(0,l.useState)(!1),[q,U]=(0,l.useState)(null),[H,Z]=(0,l.useState)(""),[W,V]=(0,l.useState)(!1),[G,en]=(0,l.useState)(""),[es,ed]=(0,l.useState)(void 0),[eu,eh]=(0,l.useState)(!1),[em,ex]=(0,l.useState)(null),[ev,ej]=(0,l.useState)(""),[ew,ey]=(0,l.useState)({x:0,y:0}),eb=(0,l.useRef)(null),eN=(0,l.useRef)(!1),eM=(0,l.useRef)(null);(0,l.useEffect)(()=>{eN.current=y},[y]),(0,l.useEffect)(()=>{let e=new MutationObserver((e,t)=>{if(eM.current)for(let t of e)"childList"===t.type&&t.addedNodes.length>0&&(0,ea.Z)(eM.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]})});return eM.current&&e.observe(eM.current,{childList:!0}),()=>e.disconnect()},[eM.current]),(0,l.useEffect)(()=>{let t=e.chatMessage.message;e.chatMessage.excalidrawDiagram&&C(e.chatMessage.excalidrawDiagram),e.chatMessage.mermaidjsDiagram&&S(e.chatMessage.mermaidjsDiagram),t=(0,O.AQ)(t,e.chatMessage.codeContext),e.chatMessage.codeContext&&Object.entries(e.chatMessage.codeContext).forEach(e=>{var n,a;let[s,r]=e;null===(a=r.results)||void 0===a||null===(n=a.output_files)||void 0===n||n.forEach(e=>{(e.filename.endsWith(".png")||e.filename.endsWith(".jpg"))&&!t.includes("![".concat(e.filename,"]("))&&(t+="\n\n![".concat(e.filename,"](data:image/png;base64,").concat(e.b64_data,")"))})});let n=t,a=t;if(e.chatMessage.images&&e.chatMessage.images.length>0){let t=e.chatMessage.images.map(e=>{let t=e.startsWith("data%3Aimage")?decodeURIComponent(e):e;return N.Z.sanitize(t)}),s=t.map((e,t)=>"![rendered image ".concat(t+1,"](").concat(e,")")).join("\n"),r=t.map((e,t)=>'<div class="'.concat(d().imageWrapper,'"><img src="').concat(e,'" alt="rendered image ').concat(t+1,'" /></div>')).join(""),l='<div class="'.concat(d().imagesContainer,'">').concat(r,"</div>");n="".concat(s,"\n\n").concat(n),a="".concat(l).concat(a)}x(n),a=(a=a.replace(/\\\(/g,"LEFTPAREN").replace(/\\\)/g,"RIGHTPAREN").replace(/\\\[/g,"LEFTBRACKET").replace(/\\\]/g,"RIGHTBRACKET")).replace(/\[([^\]]+)\]\(file:\/\/([^)]+)\)/g,(e,t,n)=>"[".concat(t,"](filelink://").concat(n,")"));let s=ef.render(a);s=s.replace(/LEFTPAREN/g,"\\(").replace(/RIGHTPAREN/g,"\\)").replace(/LEFTBRACKET/g,"\\[").replace(/RIGHTBRACKET/g,"\\]"),v(N.Z.sanitize(s,{ADD_ATTR:["data-file-path","data-line-number"]}))},[e.chatMessage.message,e.chatMessage.images,e.chatMessage.intent]),(0,l.useEffect)(()=>{i&&setTimeout(()=>{c(!1)},2e3)},[i]),(0,l.useEffect)(()=>{if(eM.current){eM.current.querySelectorAll("pre > .hljs").forEach(e=>{if(!e.querySelector("".concat(d().codeCopyButton))){let t=document.createElement("button"),n=(0,a.jsx)($.w,{size:24});(0,g.createRoot)(t).render(n),t.className="hljs ".concat(d().codeCopyButton),t.addEventListener("click",()=>{let n=e.textContent||"";n=(n=(n=n.replace(/^\$+/,"")).replace(/^Copy/,"")).trim(),navigator.clipboard.writeText(n);let s=(0,a.jsx)(J.J,{size:24});(0,g.createRoot)(t).render(s)}),e.prepend(t)}});let e=eM.current,t=e=>{var t;let n=e.target,a=null==n?void 0:null===(t=n.closest)||void 0===t?void 0:t.call(n,"a.file-link");if(!a)return;e.preventDefault(),e.stopPropagation();let s=a.getAttribute("data-file-path")||"",r=a.getAttribute("data-line-number")||void 0;s&&(V(!1),D(s),P(r?parseInt(r):void 0),T(!0))},n=null,s=e=>{var t;let a=e.target,s=null==a?void 0:null===(t=a.closest)||void 0===t?void 0:t.call(a,"a.file-link");if(!s||n===s)return;n=s;let r=s.getBoundingClientRect(),l=s.getAttribute("data-file-path")||"",o=s.getAttribute("data-line-number")||void 0;l&&(ey({x:Math.max(8,r.left),y:r.bottom+6}),en(l),ed(o?parseInt(o):void 0),eb.current&&(window.clearTimeout(eb.current),eb.current=null),V(!0))},r=e=>{var t;let a=e.target,s=e.relatedTarget,r=null==a?void 0:null===(t=a.closest)||void 0===t?void 0:t.call(a,"a.file-link");s&&r&&r.contains(s)||(eb.current&&window.clearTimeout(eb.current),eb.current=window.setTimeout(()=>{V(!1),n=null,eb.current=null},200))},l=e=>{var t;let n=e.target,a=null==n?void 0:null===(t=n.closest)||void 0===t?void 0:t.call(n,"a.file-link");if(!a||"Enter"!==e.key&&" "!==e.key)return;e.preventDefault(),e.stopPropagation();let s=a.getAttribute("data-file-path")||"",r=a.getAttribute("data-line-number")||void 0;s&&(V(!1),D(s),P(r?parseInt(r):void 0),T(!0))};return e.addEventListener("pointerdown",t),e.addEventListener("keydown",l),e.addEventListener("mouseover",s),e.addEventListener("mouseout",r),(0,ea.Z)(eM.current,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]}),()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("keydown",l),e.removeEventListener("mouseover",s),e.removeEventListener("mouseout",r),eb.current&&(window.clearTimeout(eb.current),eb.current=null)}}},[p,eM]);let{content:ek,loading:eC,error:e_}=F(I,E),{content:eS,loading:eE,error:eT}=F(G,W);function eR(e){let t;if(isNaN((t=new Date(e.includes(" ")&&!e.includes("T")?e.replace(" ","T")+"Z":e.endsWith("Z")?e:e+"Z")).getTime()))return"Invalid Date";let n=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).toUpperCase(),a=t.toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"}).replaceAll("-"," ");return"".concat(n," on ").concat(a)}async function eI(){let t=e.chatMessage.message.match(/[^.!?]+[.!?]*/g)||[];if(!t||0===t.length||!t[0])return;w(!0);let n=eO(t[0]);for(let e=0;e<t.length&&!eN.current;e++){let a=n;e<t.length-1&&(n=eO(t[e+1]));try{let e=await a,t=URL.createObjectURL(e);await function(e){return new Promise((t,n)=>{let a=new Audio(e);a.onended=t,a.onerror=n,a.play()})}(t)}catch(e){console.error("Error:",e);break}}w(!1),b(!1)}async function eO(e){let t=await fetch("/api/chat/speech?text=".concat(encodeURIComponent(e)),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("Network response was not ok");return await t.blob()}(0,l.useEffect)(()=>{Z(ek)},[ek]),(0,l.useEffect)(()=>{z(eC)},[eC]),(0,l.useEffect)(()=>{U(e_)},[e_]),(0,l.useEffect)(()=>{ej(eS)},[eS]),(0,l.useEffect)(()=>{eh(eE)},[eE]),(0,l.useEffect)(()=>{ex(eT)},[eT]);let eL=async t=>{let n=t.turnId||e.turnId;(await fetch("/api/chat/conversation/message",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:e.conversationId,turn_id:n})})).ok?e.onDeleteMessage(n):console.error("Failed to delete message")},eF=function(e,t,n){let a=[],s=[],r=[];if(n)for(let[e,t]of Object.entries(n))t.results&&r.push({code:t.code,output:t.results.std_out,output_files:t.results.output_files,error:t.results.std_err});if(t){let e=[];for(let[n,a]of Object.entries(t)){if(a.answerBox&&e.push({title:a.answerBox.title,description:a.answerBox.answer,link:a.answerBox.source}),a.knowledgeGraph&&e.push({title:a.knowledgeGraph.title,description:a.knowledgeGraph.description,link:a.knowledgeGraph.descriptionLink}),a.webpages){if(a.webpages instanceof Array){let t=a.webpages.map(e=>({title:e.query,description:e.snippet,link:e.link}));e.push(...t)}else{let t=a.webpages;e.push({title:t.query,description:t.snippet,link:t.link})}}if(a.organic){let t=a.organic.map(e=>({title:e.title,description:e.snippet,link:e.link}));e.push(...t)}}a.push(...e)}if(e){let t=e.map(e=>{if(!e.compiled&&""!==e.compiled){let t=("string"==typeof e?e:null==e?"":String(e)).split("\n");return{title:t[0]&&t[0].trim()?t[0]:"(untitled)",content:t.slice(1).join("\n")}}return{title:e.file,content:e.compiled}});s.push(...t)}return{notesReferenceCardData:s,onlineReferenceCardData:a,codeReferenceCardData:r}}(e.chatMessage.context,e.chatMessage.onlineContext,e.chatMessage.codeContext);return(0,a.jsxs)("div",{ref:t,className:(n=e.chatMessage,r=[d().chatMessageContainer],"khoj"===n.by&&r.push("shadow-md"),r.push(d()[n.by]),n.message||r.push(d().emptyChatMessage),e.customClassName&&r.push(d()["".concat(n.by).concat(e.customClassName)]),r.join(" ")),onMouseLeave:e=>h(!1),onMouseEnter:e=>h(!0),"data-created":eR(e.chatMessage.created),children:[(0,a.jsxs)("div",{className:(s=e.chatMessage,(o=[d().chatMessageWrapper]).push(d()[s.by]),"khoj"===s.by&&o.push("border-l-4 border-opacity-50 ".concat("border-l-"+e.borderLeftColor)),o.join(" ")),children:[e.chatMessage.queryFiles&&e.chatMessage.queryFiles.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap flex-col mb-2 max-w-full",children:e.chatMessage.queryFiles.map((e,t)=>(0,a.jsxs)(el.Vq,{children:[(0,a.jsx)(el.hg,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer bg-gray-500 bg-opacity-25 rounded-lg p-2 w-full ",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,M.Le)(e.file_type)}),(0,a.jsx)("span",{className:"truncate flex-1 min-w-0 max-w-[200px]",children:e.name}),e.size&&(0,a.jsxs)("span",{className:"text-gray-400 flex-shrink-0",children:["(",(0,ei.xq)(e.size),")"]})]})}),(0,a.jsxs)(el.cZ,{children:[(0,a.jsx)(el.fK,{children:(0,a.jsx)(eo.$N,{children:(0,a.jsx)("div",{className:"truncate min-w-0 break-words break-all text-wrap max-w-full whitespace-normal",children:e.name})})}),(0,a.jsx)(el.Be,{children:(0,a.jsx)(ec.x,{className:"h-72 w-full rounded-md break-words break-all text-wrap",children:e.content})})]})]},t))}),(0,a.jsx)("div",{ref:eM,className:d().chatMessage,dangerouslySetInnerHTML:{__html:p}}),W&&(0,f.createPortal)((0,a.jsx)("div",{onMouseEnter:()=>{eb.current&&(window.clearTimeout(eb.current),eb.current=null),V(!0)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),V(!1),G&&(D(G),P(es),T(!0))},onMouseLeave:()=>{eb.current&&window.clearTimeout(eb.current),eb.current=window.setTimeout(()=>{V(!1),eb.current=null},200)},style:{position:"fixed",left:ew.x,top:ew.y,zIndex:9999},className:"w-96 max-h-80 rounded-md border bg-popover p-4 text-popover-foreground shadow-md",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center text-sm font-medium",children:[(0,a.jsx)("span",{className:"truncate",children:G.split("/").pop()||G}),es&&(0,a.jsxs)("span",{className:"text-gray-500 ml-2",children:["- Line ",es]})]}),(0,a.jsxs)(ec.x,{className:"max-h-60",children:[eu&&(0,a.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,a.jsx)(et.l,{})}),!eu&&em&&(0,a.jsxs)("div",{className:"p-3 text-red-500 text-sm",children:["Error: ",em]}),!eu&&!em&&(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(L,{content:ev,targetLine:es,maxLines:8})})]})]})}),document.body),(0,a.jsx)(el.Vq,{open:E,onOpenChange:T,children:(0,a.jsxs)(el.cZ,{className:"max-w-2xl",children:[(0,a.jsx)(el.fK,{children:(0,a.jsx)(eo.$N,{children:(0,a.jsxs)("div",{className:"truncate min-w-0 break-words break-all text-wrap max-w-full whitespace-normal",children:[I.split("/").pop()||I,(0,a.jsx)("span",{className:"text-gray-500 ml-2",children:B?"- Line ".concat(B):""})]})})}),(0,a.jsx)("div",{className:"text-left",children:(0,a.jsxs)(ec.x,{className:"h-80 w-full rounded-md",children:[A&&(0,a.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,a.jsx)(et.l,{})}),!A&&q&&(0,a.jsxs)("div",{className:"p-3 text-red-500 text-sm",children:["Error: ",q]}),!A&&!q&&(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(L,{content:H,targetLine:B,maxLines:20})})]})})]})}),k&&(0,a.jsx)(er,{data:k}),_&&(0,a.jsx)(eg,{chart:_})]}),(0,a.jsx)("div",{className:d().teaserReferencesContainer,children:(0,a.jsx)(R,{isMobileWidth:e.isMobileWidth,notesReferenceCardData:eF.notesReferenceCardData,onlineReferenceCardData:eF.onlineReferenceCardData,codeReferenceCardData:eF.codeReferenceCardData})}),(0,a.jsx)("div",{className:d().chatFooter,children:(u||e.isMobileWidth||e.isLastMessage||j)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{title:eR(e.chatMessage.created),className:"text-gray-400 relative top-0 left-4",children:function(e){e.endsWith("Z")||(e+="Z");let t=new Date(e),n=new Date().getTime()-t.getTime();return n<6e4?"Just now":n<36e5?"".concat(Math.round(n/6e4),"m ago"):n<864e5?"".concat(Math.round(n/36e5),"h ago"):"".concat(Math.round(n/864e5),"d ago")}(e.chatMessage.created)}),(0,a.jsxs)("div",{className:"".concat(d().chatButtons," shadow-sm"),children:["khoj"===e.chatMessage.by&&(j?y?(0,a.jsx)(et.l,{iconClassName:"p-0",className:"m-0"}):(0,a.jsx)("button",{title:"Pause Speech",onClick:e=>b(!0),children:(0,a.jsx)(Q.d,{alt:"Pause Message",className:"hsl(var(--muted-foreground))"})}):(0,a.jsx)("button",{title:"Speak",onClick:e=>eI(),children:(0,a.jsx)(K.j,{alt:"Speak Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})})),e.chatMessage.turnId&&(0,a.jsx)("button",{title:"Delete",className:"".concat(d().deleteButton),onClick:()=>eL(e.chatMessage),children:(0,a.jsx)(Y.r,{alt:"Delete Message",className:"hsl(var(--muted-foreground)) hover:text-red-500"})}),"khoj"===e.chatMessage.by&&e.onRetryMessage&&e.isLastMessage&&(0,a.jsx)("button",{title:"Retry",className:"".concat(d().retryButton),onClick:()=>{var t,n,a;let s=e.chatMessage.turnId||e.turnId,r=e.chatMessage.rawQuery||(null===(t=e.chatMessage.intent)||void 0===t?void 0:t.query);if(console.log("Retry button clicked for turnId:",s),console.log("ChatMessage data:",{rawQuery:e.chatMessage.rawQuery,intent:e.chatMessage.intent,message:e.chatMessage.message}),console.log("Extracted query:",r),r)null===(n=e.onRetryMessage)||void 0===n||n.call(e,r,s);else{console.error("No original query found for retry");let t=prompt("Enter the original query to retry:");t&&(null===(a=e.onRetryMessage)||void 0===a||a.call(e,t,s))}},children:(0,a.jsx)(X._,{alt:"Retry Message",className:"hsl(var(--muted-foreground)) hover:text-blue-500"})}),(0,a.jsx)("button",{title:"Copy",className:"".concat(d().copyButton),onClick:()=>{navigator.clipboard.writeText(m),c(!0)},children:i?(0,a.jsx)(ee.C,{alt:"Copied Message",weight:"fill",className:"text-green-500"}):(0,a.jsx)(ee.C,{alt:"Copy Message",className:"hsl(var(--muted-foreground)) hover:text-green-500"})}),"khoj"===e.chatMessage.by&&(e.chatMessage.intent?(0,a.jsx)(ep,{uquery:e.chatMessage.intent.query,kquery:e.chatMessage.message}):(0,a.jsx)(ep,{uquery:e.chatMessage.rawQuery||e.chatMessage.message,kquery:e.chatMessage.message}))]})]})})]})});ej.displayName="ChatMessage";var ew=n(17104),ey=n(66142),eb=n(25397),eN=n(44849),eM=n.n(eN);function ek(e){let{frames:t,autoPlay:n=!0,playbackSpeed:s=1e3}=e,[r,o]=(0,l.useState)(0),[i,c]=(0,l.useState)(n),[d,u]=(0,l.useState)(!0),h=(0,l.useRef)(null);(0,l.useEffect)(()=>{d&&t.length>0&&o(t.length-1)},[t.length,d]),(0,l.useEffect)(()=>(i&&t.length>1?h.current=setInterval(()=>{o(e=>{let n=e+1;return n>=t.length?(c(!1),e):n})},s):h.current&&(clearInterval(h.current),h.current=null),()=>{h.current&&clearInterval(h.current)}),[i,t.length,s]);let m=t[r],g=e=>{o(e),u(!1),c(!1)};return t.length?(0,a.jsxs)("div",{className:eM().videoPlayer,children:[(0,a.jsxs)("div",{className:eM().screen,children:[(null==m?void 0:m.image)&&(0,a.jsx)("img",{src:m.image,alt:"Train of thought frame ".concat(r+1),className:eM().screenImage}),(0,a.jsx)("div",{className:eM().textOverlay,children:(0,a.jsx)("div",{className:eM().thoughtText,children:null==m?void 0:m.text})})]}),(0,a.jsxs)("div",{className:eM().controls,children:[(0,a.jsxs)("div",{className:eM().timeline,children:[(0,a.jsx)("input",{type:"range",min:0,max:Math.max(0,t.length-1),value:r,onChange:e=>g(parseInt(e.target.value)),className:eM().timelineSlider}),(0,a.jsx)("div",{className:eM().frameMarkers,children:t.map((e,t)=>(0,a.jsx)("div",{className:"".concat(eM().frameMarker," ").concat(e.image?eM().hasImage:eM().textOnly," ").concat(t===r?eM().active:""),onClick:()=>g(t),title:"Frame ".concat(t+1,": ").concat(e.text.slice(0,50),"...")},t))})]}),(0,a.jsxs)("div",{className:eM().controlButtons,children:[(0,a.jsx)("button",{onClick:()=>{r>0&&(o(r-1),u(!1),c(!1))},disabled:0===r,title:"Previous frame",className:eM().controlButton,children:(0,a.jsx)(ew.F,{size:16})}),(0,a.jsx)("button",{onClick:()=>{c(!i),u(!1)},disabled:t.length<=1,title:i?"Pause":"Play",className:eM().controlButton,children:i?(0,a.jsx)(Q.d,{size:16}):(0,a.jsx)(ey.s,{size:16})}),(0,a.jsx)("button",{onClick:()=>{r<t.length-1&&(o(r+1),u(!1),c(!1))},disabled:r===t.length-1,title:"Next frame",className:eM().controlButton,children:(0,a.jsx)(eb.N,{size:16})}),(0,a.jsx)("button",{onClick:()=>{u(!0),o(t.length-1),c(!1)},className:"".concat(eM().controlButton," ").concat(d?eM().active:""),title:"Auto-track latest",children:"Live"})]}),(0,a.jsx)("div",{className:eM().frameInfo,children:(0,a.jsxs)("span",{children:[r+1," / ",t.length]})})]})]}):null}var eC=n(72102),e_=n(23713),eS=n(795),eE=n(935),eT=n(81103),eR=e=>{let{name:t,avatar:n,link:s,description:r}=e;return(0,a.jsx)("div",{className:"relative group flex",children:(0,a.jsx)(eT.pn,{children:(0,a.jsxs)(eT.u,{delayDuration:0,children:[(0,a.jsx)(eT.aJ,{asChild:!0,children:(0,a.jsxs)(em.z,{variant:"ghost",className:"flex items-center justify-center",children:[n,(0,a.jsx)("div",{children:t})]})}),(0,a.jsx)(eT._v,{children:(0,a.jsxs)("div",{className:"w-80 h-30",children:[(0,a.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",className:"mt-1 ml-2 block no-underline",children:(0,a.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[n,(0,a.jsxs)("div",{className:"mr-2 mt-1 flex justify-center items-center text-sm font-semibold text-gray-800",children:[t,(0,a.jsx)(j.o,{weight:"bold",className:"ml-1"})]})]})}),r&&(0,a.jsx)("p",{className:"mt-2 ml-6 text-sm text-gray-600 line-clamp-2",children:r||"A Khoj agent"})]})})]})})})},eI=n(37104);function eO(e){let[t,n]=(0,l.useState)(e.completed),[s,c]=(0,l.useState)([]);return(0,l.useEffect)(()=>{e.completed&&n(!0)},[e.completed]),(0,l.useEffect)(()=>{if(!e.trainOfThought||0===e.trainOfThought.length){c([]);return}c(function(e){if(!e)return[];let t=[],n=[],a=[];return e.forEach((e,s)=>{let r=e.data,l=!1;try{let e=r.match(/\{.*(\"action\": \"screenshot\"|\"type\": \"screenshot\"|\"image\": \"data:image\/.*\").*\}/);if(e){let o=JSON.parse(e[0]);o.image&&(l=!0,r=r.replace(":\n**Action**: ".concat(e[0]),""),o.text&&(r+="\n\n".concat(o.text)),a.length>0&&(t.push({type:"text",textEntries:[...a]}),a=[]),n.push({text:r,image:o.image,timestamp:s}))}}catch(e){console.error("Failed to parse screenshot data",e)}l||(n.length>0&&(t.push({type:"video",frames:[...n]}),n=[]),a.push(e))}),n.length>0&&t.push({type:"video",frames:n}),a.length>0&&t.push({type:"text",textEntries:a}),t}("string"==typeof e.trainOfThought[0]?e.trainOfThought.map((e,t)=>({type:"text",data:e})):e.trainOfThought))},[e.trainOfThought]),(0,a.jsxs)("div",{className:"".concat(t?"":r().trainOfThought+" border"," rounded-lg"),children:[!e.completed&&(0,a.jsx)(et.l,{className:"float-right"}),e.completed&&(t?(0,a.jsxs)(em.z,{className:"w-fit text-left justify-start content-start text-xs",onClick:()=>n(!1),variant:"ghost",size:"sm",children:["Thought Process ",(0,a.jsx)(eC.p,{size:16,className:"ml-1"})]}):(0,a.jsxs)(em.z,{className:"w-fit text-left justify-start content-start text-xs p-0 h-fit",onClick:()=>n(!0),variant:"ghost",size:"sm",children:["Close ",(0,a.jsx)(e_.U,{size:16,className:"ml-1"})]})),(0,a.jsx)(o.M,{initial:!1,children:!t&&(0,a.jsx)(i.E.div,{initial:"closed",animate:"open",exit:"closed",variants:{open:{height:"auto",opacity:1,transition:{duration:.3,ease:"easeOut"}},closed:{height:0,opacity:0,transition:{duration:.3,ease:"easeIn"}}},children:s.map((t,n)=>(0,a.jsxs)("div",{children:["video"===t.type&&t.frames&&t.frames.length>0&&(0,a.jsx)(ek,{frames:t.frames,autoPlay:!1,playbackSpeed:1500}),"text"===t.type&&t.textEntries&&t.textEntries.map((r,l)=>{let o=s.length-1,i=l===t.textEntries.length-1,c=n===o&&i&&e.lastMessage&&!e.completed;return(0,a.jsx)(ev,{message:r.data,primary:c,agentColor:e.agentColor},"train-text-".concat(n,"-").concat(l,"-").concat(r.data.length))})]},"train-group-".concat(n)))})})]},e.keyId)}function eL(e){var t,n,s,o,i,c,d;let[u,h]=(0,l.useState)(null),[m,g]=(0,l.useState)(0),[f,x]=(0,l.useState)(!0),[p,v]=(0,l.useState)(null),j=(0,l.useRef)(null),w=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(null),N=(0,l.useRef)(null),[k,C]=(0,l.useState)(null),[_,S]=(0,l.useState)(!1),[E,T]=(0,l.useState)(!0),R=(0,ei.IC)(),I="[data-radix-scroll-area-viewport]",O=localStorage.getItem("message");(0,l.useEffect)(()=>{var e;let t=null===(e=w.current)||void 0===e?void 0:e.querySelector(I);if(!t)return;let n=()=>{let{scrollTop:e,scrollHeight:n,clientHeight:a}=t;T(n-(e+a)<=50)};return t.addEventListener("scroll",n),n(),()=>t.removeEventListener("scroll",n)},[w]),(0,l.useEffect)(()=>{e.incomingMessages&&e.incomingMessages.length>0&&E&&F(!0)},[e.incomingMessages,E]),(0,l.useEffect)(()=>{var t;let n=y.current,a=null===(t=w.current)||void 0===t?void 0:t.querySelector(I);if(!n||!a)return;let s=new ResizeObserver(()=>{let{scrollTop:t,scrollHeight:n,clientHeight:s}=a;if(n-(t+s)<=50&&e.incomingMessages&&e.incomingMessages.length>0){let t=e.incomingMessages[e.incomingMessages.length-1];(!t.completed||t.completed&&null!==k)&&F(!0)}});return s.observe(n),()=>s.disconnect()},[e.incomingMessages,k,w]),(0,l.useEffect)(()=>{u&&u.chat&&u.chat.length>0&&m<2&&requestAnimationFrame(()=>{var e;null===(e=b.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"})})},[u,m]),(0,l.useEffect)(()=>{if(!f||_)return;let t=new IntersectionObserver(t=>{t[0].isIntersecting&&f&&(S(!0),function(t){if(!f||_)return;let n=(t+1)*10,a="";if(e.conversationId)a="/api/chat/history?client=web&conversation_id=".concat(encodeURIComponent(e.conversationId),"&n=").concat(n);else{if(!e.publicConversationSlug)return;a="/api/chat/share/history?client=web&public_conversation_slug=".concat(e.publicConversationSlug,"&n=").concat(n)}fetch(a).then(e=>e.json()).then(n=>{var a;if(e.setTitle(n.response.slug),e.setIsOwner&&e.setIsOwner(null==n?void 0:null===(a=n.response)||void 0===a?void 0:a.is_owner),n&&n.response&&n.response.chat&&n.response.chat.length>0){if(g(Math.ceil(n.response.chat.length/10)),n.response.chat.length===(null==u?void 0:u.chat.length)){x(!1),S(!1);return}e.setAgent(n.response.agent),h(n.response),S(!1),0===t?F(!0):L()}else{if(n.response.agent&&n.response.conversation_id){let t={chat:[],agent:n.response.agent,conversation_id:n.response.conversation_id,slug:n.response.slug,is_owner:n.response.is_owner};e.setAgent(n.response.agent),h(t),e.setIsChatSideBarOpen&&!O&&e.setIsChatSideBarOpen(!0)}x(!1),S(!1)}}).catch(e=>{console.error(e),window.location.href="/"})}(m))},{threshold:1});return j.current&&t.observe(j.current),()=>t.disconnect()},[f,m,_]),(0,l.useEffect)(()=>{x(!0),S(!1),g(0),h(null)},[e.conversationId]),(0,l.useEffect)(()=>{if(e.incomingMessages){let t=e.incomingMessages[e.incomingMessages.length-1];t&&!t.completed&&(C(e.incomingMessages.length-1),e.setTitle(t.rawQuery),t.turnId&&v(t.turnId))}},[e.incomingMessages]);let L=()=>{var e;let t=null===(e=w.current)||void 0===e?void 0:e.querySelector(I);requestAnimationFrame(()=>{var e;null===(e=N.current)||void 0===e||e.scrollIntoView({behavior:"auto",block:"start"}),null==t||t.scrollBy({behavior:"smooth",top:-150})})},F=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=null===(e=w.current)||void 0===e?void 0:e.querySelector(I);requestAnimationFrame(()=>{null==n||n.scrollTo({top:n.scrollHeight,behavior:t?"auto":"smooth"})}),(t||n&&n.scrollHeight-(n.scrollTop+n.clientHeight)<5)&&T(!0)};function D(){var e,t;return u&&u.agent&&(null===(e=u.agent)||void 0===e?void 0:e.name)?u.agent.is_hidden?"Khoj":null===(t=u.agent)||void 0===t?void 0:t.name:"Agent"}let B=t=>{t&&(h(e=>e&&t?{...e,chat:e.chat.filter(e=>e.turnId!==t)}:e),e.incomingMessages&&e.setIncomingMessages&&e.setIncomingMessages(e.incomingMessages.filter(e=>e.turnId!==t)))},P=(t,n)=>{var a;t&&(n&&B(n),null===(a=e.onRetryMessage)||void 0===a||a.call(e,t,n))};return e.conversationId||e.publicConversationSlug?(0,a.jsx)(ec.x,{className:"\n h-[calc(100svh-theme(spacing.44))]\n sm:h-[calc(100svh-theme(spacing.44))]\n md:h-[calc(100svh-theme(spacing.44))]\n lg:h-[calc(100svh-theme(spacing.44))]\n ",ref:w,children:(0,a.jsxs)("div",{ref:y,children:[(0,a.jsxs)("div",{className:"print-only-header",children:[(0,a.jsxs)("div",{className:"print-header-content",children:[(0,a.jsx)("div",{className:"print-header-left",children:(0,a.jsx)(eI.S6,{className:"print-logo"})}),(0,a.jsxs)("div",{className:"print-header-right",children:[(0,a.jsx)("h1",{children:(null==u?void 0:u.slug)||"Conversation with Khoj"}),(0,a.jsx)("div",{className:"conversation-meta",children:(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:"Agent:"})," ",D()]})})]})]}),(0,a.jsx)("hr",{})]}),(0,a.jsxs)("div",{className:"".concat(r().chatHistory," ").concat(e.customClassName),children:[(0,a.jsx)("div",{ref:j,style:{height:"1px"},children:_&&(0,a.jsx)(et.l,{className:"opacity-50"})}),u&&u.chat&&u.chat.map((t,n)=>{var s,r;return(0,a.jsxs)(l.Fragment,{children:[t.trainOfThought&&"khoj"===t.by&&(0,a.jsx)(eO,{trainOfThought:t.trainOfThought,lastMessage:!1,agentColor:(null==u?void 0:null===(s=u.agent)||void 0===s?void 0:s.color)||"orange",keyId:"".concat(n,"trainOfThought"),completed:!0},"".concat(n,"trainOfThought")),(0,a.jsx)(ej,{ref:n===u.chat.length-2?b:n===u.chat.length-(m-1)*10?N:null,isMobileWidth:R,chatMessage:t,customClassName:"fullHistory",borderLeftColor:"".concat(null==u?void 0:null===(r=u.agent)||void 0===r?void 0:r.color,"-500"),isLastMessage:n===u.chat.length-1,onDeleteMessage:B,onRetryMessage:P,conversationId:e.conversationId},"".concat(n,"fullHistory"))]},"chatMessage-".concat(n))}),e.incomingMessages&&e.incomingMessages.map((t,n)=>{var s,r,o,i,c;let d=null!==(c=null!==(i=t.turnId)&&void 0!==i?i:p)&&void 0!==c?c:void 0;return(0,a.jsxs)(l.Fragment,{children:[(0,a.jsx)(ej,{isMobileWidth:R,chatMessage:{message:t.rawQuery,context:[],onlineContext:{},codeContext:{},created:t.timestamp,by:"you",automationId:"",images:t.images,conversationId:e.conversationId,turnId:d,queryFiles:t.queryFiles},customClassName:"fullHistory",borderLeftColor:"".concat(null==u?void 0:null===(s=u.agent)||void 0===s?void 0:s.color,"-500"),onDeleteMessage:B,onRetryMessage:P,conversationId:e.conversationId,turnId:d},"".concat(n,"outgoing")),t.trainOfThought&&t.trainOfThought.length>0&&(0,a.jsx)(eO,{trainOfThought:t.trainOfThought,lastMessage:n===k,agentColor:(null==u?void 0:null===(r=u.agent)||void 0===r?void 0:r.color)||"orange",keyId:"".concat(n,"trainOfThought"),completed:t.completed},"".concat(n,"trainOfThought-").concat(t.trainOfThought.length,"-").concat(t.trainOfThought.map(e=>e.length).join("-"))),(0,a.jsx)(ej,{isMobileWidth:R,chatMessage:{message:t.rawResponse,context:t.context,onlineContext:t.onlineContext,codeContext:t.codeContext,created:t.timestamp,by:"khoj",automationId:"",rawQuery:t.rawQuery,intent:{type:t.intentType||"",query:t.rawQuery,"memory-type":"","inferred-queries":t.inferredQueries||[]},conversationId:e.conversationId,images:t.generatedImages,queryFiles:t.generatedFiles,mermaidjsDiagram:t.generatedMermaidjsDiagram,turnId:d},conversationId:e.conversationId,turnId:d,onDeleteMessage:B,onRetryMessage:P,customClassName:"fullHistory",borderLeftColor:"".concat(null==u?void 0:null===(o=u.agent)||void 0===o?void 0:o.color,"-500"),isLastMessage:n===e.incomingMessages.length-1},"".concat(n,"incoming"))]},"incomingMessage".concat(n))}),e.pendingMessage&&(0,a.jsx)(ej,{isMobileWidth:R,chatMessage:{message:e.pendingMessage,context:[],onlineContext:{},codeContext:{},created:new Date().getTime().toString(),by:"you",automationId:"",conversationId:e.conversationId,turnId:void 0},conversationId:e.conversationId,onDeleteMessage:B,onRetryMessage:P,customClassName:"fullHistory",borderLeftColor:"".concat(null==u?void 0:null===(t=u.agent)||void 0===t?void 0:t.color,"-500"),isLastMessage:!0},"pendingMessage-".concat(e.pendingMessage.length)),u&&(0,a.jsx)("div",{className:"".concat(r().agentIndicator," pb-4"),children:(0,a.jsx)("div",{className:"relative group mx-2 cursor-pointer",children:(0,a.jsx)(eR,{name:D(),link:u&&u.agent&&(null===(o=u.agent)||void 0===o?void 0:o.slug)?"/agents?agent=".concat(null===(i=u.agent)||void 0===i?void 0:i.slug):"/agents",avatar:(0,M.TI)(null===(n=u.agent)||void 0===n?void 0:n.icon,null===(s=u.agent)||void 0===s?void 0:s.color)||(0,a.jsx)(eS.v,{}),description:u&&u.agent?(null===(c=u.agent)||void 0===c?void 0:c.persona)?null===(d=u.agent)||void 0===d?void 0:d.persona:"You can set a persona for your agent in the Chat Options side panel.":"Your agent is no longer available. You will be reset to the default agent."})})})]}),(0,a.jsx)("div",{className:"".concat(e.customClassName," fixed bottom-[20%] z-10"),children:!E&&(0,a.jsx)("button",{title:"Scroll to bottom",className:"absolute bottom-0 right-0 bg-white dark:bg-[hsl(var(--background))] text-neutral-500 dark:text-white p-2 rounded-full shadow-xl",onClick:()=>{F()},children:(0,a.jsx)(eE.K,{size:24})})})]})}):null}},42501:function(e){e.exports={chatHistory:"chatHistory_chatHistory__CoaVT",agentIndicator:"chatHistory_agentIndicator__wOU1f",trainOfThought:"chatHistory_trainOfThought__mMWSR"}},91499:function(e){e.exports={chatMessageContainer:"chatMessage_chatMessageContainer__sAivf",chatMessageWrapper:"chatMessage_chatMessageWrapper__u5m8A","file-link":"chatMessage_file-link__PL84f",khojfullHistory:"chatMessage_khojfullHistory__NPu2l",youfullHistory:"chatMessage_youfullHistory__ioyfH",you:"chatMessage_you__6GUC4",khoj:"chatMessage_khoj__cjWON",khojChatMessage:"chatMessage_khojChatMessage__BabQz",emptyChatMessage:"chatMessage_emptyChatMessage__J9JRn",imagesContainer:"chatMessage_imagesContainer__HTRjT",imageWrapper:"chatMessage_imageWrapper__DF92M",author:"chatMessage_author__muRtC",chatFooter:"chatMessage_chatFooter__0vR8s",chatButtons:"chatMessage_chatButtons__Lbk8T",codeCopyButton:"chatMessage_codeCopyButton__Y_Ujv",feedbackButtons:"chatMessage_feedbackButtons___Brdy",copyButton:"chatMessage_copyButton__jd7q7",retryButton:"chatMessage_retryButton__Z7Pzk",trainOfThought:"chatMessage_trainOfThought__mR2Gg",primary:"chatMessage_primary__WYPEb",trainOfThoughtElement:"chatMessage_trainOfThoughtElement__le_bC"}},44849:function(e){e.exports={videoPlayer:"trainOfThoughtVideoPlayer_videoPlayer__Dz3mA",screen:"trainOfThoughtVideoPlayer_screen__dvEVh",screenImage:"trainOfThoughtVideoPlayer_screenImage__3SgOQ",textOverlay:"trainOfThoughtVideoPlayer_textOverlay__BGbhO",thoughtText:"trainOfThoughtVideoPlayer_thoughtText__zn_vT",controls:"trainOfThoughtVideoPlayer_controls__HDkO_",timeline:"trainOfThoughtVideoPlayer_timeline__hSpWu",timelineSlider:"trainOfThoughtVideoPlayer_timelineSlider__GQ8dx",frameMarkers:"trainOfThoughtVideoPlayer_frameMarkers__5y3He",frameMarker:"trainOfThoughtVideoPlayer_frameMarker__DBO9Y",hasImage:"trainOfThoughtVideoPlayer_hasImage__GFGAk",textOnly:"trainOfThoughtVideoPlayer_textOnly__okufk",active:"trainOfThoughtVideoPlayer_active__zp6u9",controlButtons:"trainOfThoughtVideoPlayer_controlButtons__rqfIH",controlButton:"trainOfThoughtVideoPlayer_controlButton___RdE_",frameInfo:"trainOfThoughtVideoPlayer_frameInfo__u5nwA"}}}]);