@sanjibdevnath/mcp-excalidraw-local 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +458 -0
  3. package/dist/db.d.ts +58 -0
  4. package/dist/db.d.ts.map +1 -0
  5. package/dist/db.js +379 -0
  6. package/dist/db.js.map +1 -0
  7. package/dist/frontend/assets/Assistant-Bold-gm-uSS1B.woff2 +0 -0
  8. package/dist/frontend/assets/Assistant-Medium-DrcxCXg3.woff2 +0 -0
  9. package/dist/frontend/assets/Assistant-Regular-DVxZuzxb.woff2 +0 -0
  10. package/dist/frontend/assets/Assistant-SemiBold-SCI4bEL9.woff2 +0 -0
  11. package/dist/frontend/assets/Tableau10-B-NsZVaP.js +1 -0
  12. package/dist/frontend/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
  13. package/dist/frontend/assets/advancedFormat-BvOvfnfC.js +1 -0
  14. package/dist/frontend/assets/ar-SA-G6X2FPQ2-75HMOOy8.js +10 -0
  15. package/dist/frontend/assets/arc-D-322MQz.js +1 -0
  16. package/dist/frontend/assets/array-BKyUJesY.js +1 -0
  17. package/dist/frontend/assets/az-AZ-76LH7QW2-DPDwkDvh.js +1 -0
  18. package/dist/frontend/assets/band-dPffDWoQ.js +1 -0
  19. package/dist/frontend/assets/bg-BG-XCXSNQG7-DrFYc9eo.js +5 -0
  20. package/dist/frontend/assets/blockDiagram-38ab4fdb-Ch8bwO7g.js +118 -0
  21. package/dist/frontend/assets/blockDiagram-68f4deed-BVqzkDiu.js +118 -0
  22. package/dist/frontend/assets/bn-BD-2XOGV67Q-B1Y75Cvj.js +5 -0
  23. package/dist/frontend/assets/c4Diagram-15b5d702-D5U2mSdf.js +10 -0
  24. package/dist/frontend/assets/c4Diagram-3d4e48cf-eT2EEN_c.js +10 -0
  25. package/dist/frontend/assets/ca-ES-6MX7JW3Y-00BTiK3Z.js +8 -0
  26. package/dist/frontend/assets/channel-CudwHHli.js +1 -0
  27. package/dist/frontend/assets/classDiagram-70f12bd4-CcNOdQHv.js +2 -0
  28. package/dist/frontend/assets/classDiagram-d40c83e7-nRIgRTMT.js +2 -0
  29. package/dist/frontend/assets/classDiagram-v2-d5a6b087-Cfbvao44.js +2 -0
  30. package/dist/frontend/assets/classDiagram-v2-f2320105-1Sjp5Uqh.js +2 -0
  31. package/dist/frontend/assets/clone-D_tGm99B.js +1 -0
  32. package/dist/frontend/assets/createText-2e5e7dd3-Bpmkp1eZ.js +5 -0
  33. package/dist/frontend/assets/createText-d213de94-3MLB4fd8.js +5 -0
  34. package/dist/frontend/assets/cs-CZ-2BRQDIVT-R7SCWLLF.js +11 -0
  35. package/dist/frontend/assets/cytoscape-cose-bilkent-CoIxD6ON.js +331 -0
  36. package/dist/frontend/assets/da-DK-5WZEPLOC-Db1yebad.js +5 -0
  37. package/dist/frontend/assets/de-DE-XR44H4JA-HRE-6fuh.js +8 -0
  38. package/dist/frontend/assets/directory-open-01563666-DWU9wJ6I.js +1 -0
  39. package/dist/frontend/assets/directory-open-4ed118d0-BzWybGaI.js +1 -0
  40. package/dist/frontend/assets/edges-332bd1c7-DZAOA9uP.js +4 -0
  41. package/dist/frontend/assets/edges-e0da2a9e-CP-XTLb4.js +4 -0
  42. package/dist/frontend/assets/el-GR-BZB4AONW-CfNczSdx.js +10 -0
  43. package/dist/frontend/assets/elk.bundled-BZDcWavb.js +26 -0
  44. package/dist/frontend/assets/erDiagram-880f2ed8-Bk96tDga.js +51 -0
  45. package/dist/frontend/assets/erDiagram-9861fffd-BvkEkcRK.js +51 -0
  46. package/dist/frontend/assets/es-ES-U4NZUMDT-BBJZ1_wD.js +9 -0
  47. package/dist/frontend/assets/eu-ES-A7QVB2H4-CCLNmdnk.js +11 -0
  48. package/dist/frontend/assets/fa-IR-HGAKTJCU-BtKS5FOW.js +8 -0
  49. package/dist/frontend/assets/fi-FI-Z5N7JZ37-DEQi6vbL.js +6 -0
  50. package/dist/frontend/assets/file-open-002ab408-DIuFHtCF.js +1 -0
  51. package/dist/frontend/assets/file-open-7c801643-684qeFg4.js +1 -0
  52. package/dist/frontend/assets/file-save-3189631c-x92wctJd.js +1 -0
  53. package/dist/frontend/assets/file-save-745eba88-Bb9F9Kg7.js +1 -0
  54. package/dist/frontend/assets/flowDb-7c981674-JJMg1ttK.js +10 -0
  55. package/dist/frontend/assets/flowDb-956e92f1-CVVUllPW.js +10 -0
  56. package/dist/frontend/assets/flowDiagram-66a62f08-wGFuUp6y.js +4 -0
  57. package/dist/frontend/assets/flowDiagram-cbd28bf7-CXKT_tHC.js +4 -0
  58. package/dist/frontend/assets/flowDiagram-v2-96b9c2cf-CN4ht1EM.js +1 -0
  59. package/dist/frontend/assets/flowDiagram-v2-ffc7f31a-CFiBItzu.js +1 -0
  60. package/dist/frontend/assets/flowchart-elk-definition-36e2d292-Cam5JBwn.js +114 -0
  61. package/dist/frontend/assets/flowchart-elk-definition-4a651766-BoyD4myW.js +114 -0
  62. package/dist/frontend/assets/fr-FR-RHASNOE6-_AQjPuKS.js +9 -0
  63. package/dist/frontend/assets/ganttDiagram-04f9e578-DrDI9_oS.js +257 -0
  64. package/dist/frontend/assets/ganttDiagram-c361ad54-CKSyNc2k.js +257 -0
  65. package/dist/frontend/assets/gitGraphDiagram-21fc4d3e-BHBdnwSb.js +70 -0
  66. package/dist/frontend/assets/gitGraphDiagram-72cf32ee-BHN9qiXg.js +70 -0
  67. package/dist/frontend/assets/gl-ES-HMX3MZ6V-Bp2h6sBC.js +10 -0
  68. package/dist/frontend/assets/graph-CRb9j7zI.js +1 -0
  69. package/dist/frontend/assets/graph-EK5j_nPe.js +1 -0
  70. package/dist/frontend/assets/he-IL-6SHJWFNN-hsaAKZ5K.js +10 -0
  71. package/dist/frontend/assets/hi-IN-IWLTKZ5I-sgYSNzoz.js +4 -0
  72. package/dist/frontend/assets/hu-HU-A5ZG7DT2-DxYZr0yq.js +7 -0
  73. package/dist/frontend/assets/id-ID-SAP4L64H-z0RzSKPQ.js +10 -0
  74. package/dist/frontend/assets/image-blob-reduce.esm-B6b2_-a4.js +7 -0
  75. package/dist/frontend/assets/index-3862675e-CQPsxwvk.js +1 -0
  76. package/dist/frontend/assets/index-6079d271-pTR-OMc-.js +1 -0
  77. package/dist/frontend/assets/index-B9Rh8YyQ.css +1 -0
  78. package/dist/frontend/assets/index-BcHA28Dx.js +87 -0
  79. package/dist/frontend/assets/index-DGmpr33w.js +3 -0
  80. package/dist/frontend/assets/index-DPgZw9ew.js +349 -0
  81. package/dist/frontend/assets/infoDiagram-4a4f5b27-OIxyK2_N.js +7 -0
  82. package/dist/frontend/assets/infoDiagram-f8f76790-BTkoanKB.js +7 -0
  83. package/dist/frontend/assets/init-Gi6I4Gst.js +1 -0
  84. package/dist/frontend/assets/it-IT-JPQ66NNP-Cu6RM7DP.js +11 -0
  85. package/dist/frontend/assets/ja-JP-DBVTYXUO-lD7U4Zkf.js +8 -0
  86. package/dist/frontend/assets/journeyDiagram-29694f62-BS4Xl0A-.js +139 -0
  87. package/dist/frontend/assets/journeyDiagram-49397b02-BbBAwEfu.js +139 -0
  88. package/dist/frontend/assets/kaa-6HZHGXH3-DM9LwXUP.js +1 -0
  89. package/dist/frontend/assets/kab-KAB-ZGHBKWFO-BAojmp2_.js +8 -0
  90. package/dist/frontend/assets/katex-ChWnQ-fc.js +261 -0
  91. package/dist/frontend/assets/kk-KZ-P5N5QNE5-Dp0K1W81.js +1 -0
  92. package/dist/frontend/assets/km-KH-HSX4SM5Z-BzYGKbAg.js +11 -0
  93. package/dist/frontend/assets/ko-KR-MTYHY66A-DOvEMk4H.js +9 -0
  94. package/dist/frontend/assets/ku-TR-6OUDTVRD-B6l-ghqp.js +9 -0
  95. package/dist/frontend/assets/layout-CGydnLJa.js +1 -0
  96. package/dist/frontend/assets/layout-DbdMIGYe.js +1 -0
  97. package/dist/frontend/assets/line-CbImtxDK.js +1 -0
  98. package/dist/frontend/assets/linear-DvIsU3aM.js +1 -0
  99. package/dist/frontend/assets/lt-LT-XHIRWOB4-BYcRk8Uj.js +3 -0
  100. package/dist/frontend/assets/lv-LV-5QDEKY6T-DS3krNIe.js +7 -0
  101. package/dist/frontend/assets/mindmap-definition-ac74a2e8-C0Sp7ICZ.js +95 -0
  102. package/dist/frontend/assets/mindmap-definition-fc14e90a-BZrjRbkr.js +95 -0
  103. package/dist/frontend/assets/mr-IN-CRQNXWMA-BfxQL7Vh.js +13 -0
  104. package/dist/frontend/assets/my-MM-5M5IBNSE-C3EfnOvD.js +1 -0
  105. package/dist/frontend/assets/nb-NO-T6EIAALU-BIbPZokm.js +10 -0
  106. package/dist/frontend/assets/nl-NL-IS3SIHDZ-BqQloGBT.js +8 -0
  107. package/dist/frontend/assets/nn-NO-6E72VCQL-zGR8NYQf.js +8 -0
  108. package/dist/frontend/assets/oc-FR-POXYY2M6-B8-HsJFE.js +8 -0
  109. package/dist/frontend/assets/ordinal-Cboi1Yqb.js +1 -0
  110. package/dist/frontend/assets/pa-IN-N4M65BXN-B2Ta58Tu.js +4 -0
  111. package/dist/frontend/assets/path-CbwjOpE9.js +1 -0
  112. package/dist/frontend/assets/pica-DSD-O3at.js +7 -0
  113. package/dist/frontend/assets/pie-Dk_pQnuO.js +1 -0
  114. package/dist/frontend/assets/pieDiagram-421022e6-9oAq5fk_.js +35 -0
  115. package/dist/frontend/assets/pieDiagram-8a3498a8-B5SMrdDh.js +35 -0
  116. package/dist/frontend/assets/pl-PL-T2D74RX3-rZKvQ0zQ.js +9 -0
  117. package/dist/frontend/assets/pt-BR-5N22H2LF-ij6wtU6I.js +9 -0
  118. package/dist/frontend/assets/pt-PT-UZXXM6DQ-BIgtUnbW.js +9 -0
  119. package/dist/frontend/assets/quadrantDiagram-0957ecba-Cr3mj6c1.js +7 -0
  120. package/dist/frontend/assets/quadrantDiagram-120e2f19-CQnc4s0f.js +7 -0
  121. package/dist/frontend/assets/requirementDiagram-23d650b8-Bs7pP1vJ.js +52 -0
  122. package/dist/frontend/assets/requirementDiagram-deff3bca-G5e-Qxao.js +52 -0
  123. package/dist/frontend/assets/ro-RO-JPDTUUEW-DPj_79nt.js +11 -0
  124. package/dist/frontend/assets/roundRect-0PYZxl1G.js +1 -0
  125. package/dist/frontend/assets/ru-RU-B4JR7IUQ-fdYiaqbX.js +9 -0
  126. package/dist/frontend/assets/sankeyDiagram-04a897e0-CJogadkF.js +8 -0
  127. package/dist/frontend/assets/sankeyDiagram-23345273-DKUWMCrX.js +8 -0
  128. package/dist/frontend/assets/sankeyLinkHorizontal-DgqkLiUE.js +1 -0
  129. package/dist/frontend/assets/selectAll-tNeSnQY6.js +1 -0
  130. package/dist/frontend/assets/sequenceDiagram-17ac3bff-DCw9xUbw.js +122 -0
  131. package/dist/frontend/assets/sequenceDiagram-704730f1-BgClSrOI.js +122 -0
  132. package/dist/frontend/assets/si-LK-N5RQ5JYF-DfPBk-rU.js +1 -0
  133. package/dist/frontend/assets/sk-SK-C5VTKIMK-Cbj4yoD_.js +6 -0
  134. package/dist/frontend/assets/sl-SI-NN7IZMDC-C_rL7eDE.js +6 -0
  135. package/dist/frontend/assets/stateDiagram-587899a1-DuFGG-SI.js +1 -0
  136. package/dist/frontend/assets/stateDiagram-9c5f0230-Bwj38hfH.js +1 -0
  137. package/dist/frontend/assets/stateDiagram-v2-51a3dcff-3c0yKNdL.js +1 -0
  138. package/dist/frontend/assets/stateDiagram-v2-d93cdb3a-CAaqB4wm.js +1 -0
  139. package/dist/frontend/assets/styles-2ab5d517-Dxg7wKah.js +116 -0
  140. package/dist/frontend/assets/styles-5f03d8d2-DD32XMGL.js +160 -0
  141. package/dist/frontend/assets/styles-6aaf32cf-B5DxK_RW.js +207 -0
  142. package/dist/frontend/assets/styles-9a916d00-C6L6Mj2P.js +160 -0
  143. package/dist/frontend/assets/styles-c10674c1-BPM_bB3H.js +116 -0
  144. package/dist/frontend/assets/styles-edf9a4b0-CbQDxrwP.js +207 -0
  145. package/dist/frontend/assets/subset-shared.chunk-B_DQsaBC.js +84 -0
  146. package/dist/frontend/assets/subset-worker.chunk-DL6tLP7M.js +1 -0
  147. package/dist/frontend/assets/sv-SE-XGPEYMSR-BmmcOaVK.js +10 -0
  148. package/dist/frontend/assets/svgDrawCommon-08f97a94-aUx8qfJx.js +1 -0
  149. package/dist/frontend/assets/svgDrawCommon-3ba9043b-1JM8RiLc.js +1 -0
  150. package/dist/frontend/assets/ta-IN-2NMHFXQM-Kxnb_Mwk.js +9 -0
  151. package/dist/frontend/assets/th-TH-HPSO5L25-BqTLgxJz.js +2 -0
  152. package/dist/frontend/assets/timeline-definition-7e6b55e7-BbFhIPTl.js +61 -0
  153. package/dist/frontend/assets/timeline-definition-85554ec2-C1G9H6m5.js +61 -0
  154. package/dist/frontend/assets/tr-TR-DEFEU3FU-DhlYP6tL.js +7 -0
  155. package/dist/frontend/assets/uk-UA-QMV73CPH-pMrN1qBS.js +6 -0
  156. package/dist/frontend/assets/union-Cu1rbD_D.js +1 -0
  157. package/dist/frontend/assets/vi-VN-M7AON7JQ-BPMcH84R.js +5 -0
  158. package/dist/frontend/assets/xml-BOsq7VnW.js +1 -0
  159. package/dist/frontend/assets/xychartDiagram-b6496bcd-BDm9pYtk.js +7 -0
  160. package/dist/frontend/assets/xychartDiagram-e933f94c-BlrTBDHC.js +7 -0
  161. package/dist/frontend/assets/zh-CN-LNUGB5OW-B8kYYibM.js +10 -0
  162. package/dist/frontend/assets/zh-HK-E62DVLB3-CaI0gehP.js +1 -0
  163. package/dist/frontend/assets/zh-TW-RAJ6MFWO-DKCVg17j.js +9 -0
  164. package/dist/frontend/assets/zipObject-iRVIFf6r.js +1 -0
  165. package/dist/frontend/index.html +420 -0
  166. package/dist/index.d.ts +4 -0
  167. package/dist/index.d.ts.map +1 -0
  168. package/dist/index.js +2241 -0
  169. package/dist/index.js.map +1 -0
  170. package/dist/server.d.ts +6 -0
  171. package/dist/server.d.ts.map +1 -0
  172. package/dist/server.js +980 -0
  173. package/dist/server.js.map +1 -0
  174. package/dist/types.d.ts +225 -0
  175. package/dist/types.d.ts.map +1 -0
  176. package/dist/types.js +30 -0
  177. package/dist/types.js.map +1 -0
  178. package/dist/utils/logger.d.ts +4 -0
  179. package/dist/utils/logger.d.ts.map +1 -0
  180. package/dist/utils/logger.js +23 -0
  181. package/dist/utils/logger.js.map +1 -0
  182. package/package.json +108 -0
  183. package/skills/excalidraw-skill/SKILL.md +370 -0
  184. package/skills/excalidraw-skill/references/cheatsheet.md +195 -0
  185. package/skills/excalidraw-skill/scripts/clear-canvas.cjs +38 -0
  186. package/skills/excalidraw-skill/scripts/create-element.cjs +68 -0
  187. package/skills/excalidraw-skill/scripts/delete-element.cjs +48 -0
  188. package/skills/excalidraw-skill/scripts/export-elements.cjs +53 -0
  189. package/skills/excalidraw-skill/scripts/healthcheck.cjs +35 -0
  190. package/skills/excalidraw-skill/scripts/import-elements.cjs +81 -0
  191. package/skills/excalidraw-skill/scripts/update-element.cjs +70 -0
@@ -0,0 +1,331 @@
1
+ import{ah as ac}from"./index-DPgZw9ew.js";function Io(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function nc(t){if(Array.isArray(t))return t}function ic(t){if(Array.isArray(t))return Io(t)}function hr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oc(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,af(a.key),a)}}function dr(t,e,r){return e&&oc(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function St(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Jo(t))||e){r&&(t=r);var a=0,n=function(){};return{s:n,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw i}}}}function rf(t,e,r){return(e=af(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sc(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function uc(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,n,i,o,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=i.call(r)).done)&&(s.push(a.value),s.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}function lc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fc(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tt(t,e){return nc(t)||uc(t,e)||Jo(t,e)||lc()}function En(t){return ic(t)||sc(t)||Jo(t)||fc()}function vc(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function af(t){var e=vc(t,"string");return typeof e=="symbol"?e:e+""}function at(t){"@babel/helpers - typeof";return at=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(t)}function Jo(t,e){if(t){if(typeof t=="string")return Io(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Io(t,e):void 0}}var et=typeof window>"u"?null:window,As=et?et.navigator:null;et&&et.document;var cc=at(""),nf=at({}),hc=at(function(){}),dc=typeof HTMLElement>"u"?"undefined":at(HTMLElement),Oa=function(e){return e&&e.instanceString&&He(e.instanceString)?e.instanceString():null},he=function(e){return e!=null&&at(e)==cc},He=function(e){return e!=null&&at(e)===hc},Fe=function(e){return!At(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Pe=function(e){return e!=null&&at(e)===nf&&!Fe(e)&&e.constructor===Object},gc=function(e){return e!=null&&at(e)===nf},ae=function(e){return e!=null&&at(e)===at(1)&&!isNaN(e)},pc=function(e){return ae(e)&&Math.floor(e)===e},xn=function(e){if(dc!=="undefined")return e!=null&&e instanceof HTMLElement},At=function(e){return Na(e)||of(e)},Na=function(e){return Oa(e)==="collection"&&e._private.single},of=function(e){return Oa(e)==="collection"&&!e._private.single},jo=function(e){return Oa(e)==="core"},sf=function(e){return Oa(e)==="stylesheet"},yc=function(e){return Oa(e)==="event"},sr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},mc=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},bc=function(e){return Pe(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},wc=function(e){return gc(e)&&He(e.then)},Ec=function(){return As&&As.userAgent.match(/msie|trident|edge/i)},Zr=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function(){var i=this,o=arguments,s,u=r.apply(i,o),l=a.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return a.cache={},a},es=Zr(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Bn=Zr(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),uf=Zr(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Ls=function(e){return sr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ar=function(e,r){return e.slice(-1*r.length)===r},rt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",xc="rgb[a]?\\(("+rt+"[%]?)\\s*,\\s*("+rt+"[%]?)\\s*,\\s*("+rt+"[%]?)(?:\\s*,\\s*("+rt+"))?\\)",Tc="rgb[a]?\\((?:"+rt+"[%]?)\\s*,\\s*(?:"+rt+"[%]?)\\s*,\\s*(?:"+rt+"[%]?)(?:\\s*,\\s*(?:"+rt+"))?\\)",Cc="hsl[a]?\\(("+rt+")\\s*,\\s*("+rt+"[%])\\s*,\\s*("+rt+"[%])(?:\\s*,\\s*("+rt+"))?\\)",Dc="hsl[a]?\\((?:"+rt+")\\s*,\\s*(?:"+rt+"[%])\\s*,\\s*(?:"+rt+"[%])(?:\\s*,\\s*(?:"+rt+"))?\\)",Sc="\\#[0-9a-fA-F]{3}",Ac="\\#[0-9a-fA-F]{6}",lf=function(e,r){return e<r?-1:e>r?1:0},Lc=function(e,r){return-1*lf(e,r)},pe=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];t[o]=a[o]}}return t},Rc=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,o=16;return r?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},Mc=function(e){var r,a,n,i,o,s,u,l;function f(d,p,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?d+(p-d)*6*g:g<1/2?p:g<2/3?d+(p-d)*(2/3-g)*6:d}var v=new RegExp("^"+Cc+"$").exec(e);if(v){if(a=parseInt(v[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(v[2]),n<0||n>100||(n=n/100,i=parseFloat(v[3]),i<0||i>100)||(i=i/100,o=v[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;s=Math.round(255*f(h,c,a+1/3)),u=Math.round(255*f(h,c,a)),l=Math.round(255*f(h,c,a-1/3))}r=[s,u,l,o]}return r},Pc=function(e){var r,a=new RegExp("^"+xc+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var s=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(s&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},Ic=function(e){return Oc[e.toLowerCase()]},ff=function(e){return(Fe(e)?e:null)||Ic(e)||Rc(e)||Pc(e)||Mc(e)},Oc={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},vf=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Pe(o))throw Error("Tried to set map with object key");i<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},cf=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Pe(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},Wa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ba(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ti,Rs;function ka(){if(Rs)return ti;Rs=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return ti=t,ti}var ri,Ms;function Nc(){if(Ms)return ri;Ms=1;var t=typeof Wa=="object"&&Wa&&Wa.Object===Object&&Wa;return ri=t,ri}var ai,Ps;function kn(){if(Ps)return ai;Ps=1;var t=Nc(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return ai=r,ai}var ni,Is;function Bc(){if(Is)return ni;Is=1;var t=kn(),e=function(){return t.Date.now()};return ni=e,ni}var ii,Os;function kc(){if(Os)return ii;Os=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return ii=e,ii}var oi,Ns;function Fc(){if(Ns)return oi;Ns=1;var t=kc(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return oi=r,oi}var si,Bs;function ts(){if(Bs)return si;Bs=1;var t=kn(),e=t.Symbol;return si=e,si}var ui,ks;function Gc(){if(ks)return ui;ks=1;var t=ts(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,n=t?t.toStringTag:void 0;function i(o){var s=r.call(o,n),u=o[n];try{o[n]=void 0;var l=!0}catch{}var f=a.call(o);return l&&(s?o[n]=u:delete o[n]),f}return ui=i,ui}var li,Fs;function zc(){if(Fs)return li;Fs=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return li=r,li}var fi,Gs;function hf(){if(Gs)return fi;Gs=1;var t=ts(),e=Gc(),r=zc(),a="[object Null]",n="[object Undefined]",i=t?t.toStringTag:void 0;function o(s){return s==null?s===void 0?n:a:i&&i in Object(s)?e(s):r(s)}return fi=o,fi}var vi,zs;function _c(){if(zs)return vi;zs=1;function t(e){return e!=null&&typeof e=="object"}return vi=t,vi}var ci,_s;function Fa(){if(_s)return ci;_s=1;var t=hf(),e=_c(),r="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&t(n)==r}return ci=a,ci}var hi,Vs;function Vc(){if(Vs)return hi;Vs=1;var t=Fc(),e=ka(),r=Fa(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return a;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=t(l);var v=i.test(l);return v||o.test(l)?s(l.slice(2),v?2:8):n.test(l)?a:+l}return hi=u,hi}var di,Us;function Uc(){if(Us)return di;Us=1;var t=ka(),e=Bc(),r=Vc(),a="Expected a function",n=Math.max,i=Math.min;function o(s,u,l){var f,v,c,h,d,p,g=0,y=!1,m=!1,b=!0;if(typeof s!="function")throw new TypeError(a);u=r(u)||0,t(l)&&(y=!!l.leading,m="maxWait"in l,c=m?n(r(l.maxWait)||0,u):c,b="trailing"in l?!!l.trailing:b);function E(L){var M=f,I=v;return f=v=void 0,g=L,h=s.apply(I,M),h}function C(L){return g=L,d=setTimeout(x,u),y?E(L):h}function A(L){var M=L-p,I=L-g,N=u-M;return m?i(N,c-I):N}function w(L){var M=L-p,I=L-g;return p===void 0||M>=u||M<0||m&&I>=c}function x(){var L=e();if(w(L))return T(L);d=setTimeout(x,A(L))}function T(L){return d=void 0,b&&f?E(L):(f=v=void 0,h)}function D(){d!==void 0&&clearTimeout(d),g=0,f=p=v=d=void 0}function S(){return d===void 0?h:T(e())}function R(){var L=e(),M=w(L);if(f=arguments,v=this,p=L,M){if(d===void 0)return C(p);if(m)return clearTimeout(d),d=setTimeout(x,u),E(p)}return d===void 0&&(d=setTimeout(x,u)),h}return R.cancel=D,R.flush=S,R}return di=o,di}var qc=Uc(),Ga=Ba(qc),gi=et?et.performance:null,df=gi&&gi.now?function(){return gi.now()}:function(){return Date.now()},Yc=function(){if(et){if(et.requestAnimationFrame)return function(t){et.requestAnimationFrame(t)};if(et.mozRequestAnimationFrame)return function(t){et.mozRequestAnimationFrame(t)};if(et.webkitRequestAnimationFrame)return function(t){et.webkitRequestAnimationFrame(t)};if(et.msRequestAnimationFrame)return function(t){et.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(df())},1e3/60)}}(),Tn=function(e){return Yc(e)},Kt=df,Tr=9261,gf=65599,Ur=5381,pf=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tr,a=r,n;n=e.next(),!n.done;)a=a*gf+n.value|0;return a},Ta=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tr;return r*gf+e|0},Ca=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ur;return(r<<5)+r+e|0},Hc=function(e,r){return e*2097152+r},er=function(e){return e[0]*2097152+e[1]},$a=function(e,r){return[Ta(e[0],r[0]),Ca(e[1],r[1])]},qs=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return pf(o,r)},Sr=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return pf(o,r)},yf=function(){return Xc(arguments)},Xc=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=Sr(n):r=Sr(n,r)}return r},Ys=!0,Wc=console.warn!=null,$c=console.trace!=null,rs=Number.MAX_SAFE_INTEGER||9007199254740991,mf=function(){return!0},Cn=function(){return!1},Hs=function(){return 0},as=function(){},Ye=function(e){throw new Error(e)},bf=function(e){if(e!==void 0)Ys=!!e;else return Ys},Ne=function(e){bf()&&(Wc?console.warn(e):(console.log(e),$c&&console.trace()))},Kc=function(e){return pe({},e)},_t=function(e){return e==null?e:Fe(e)?e.slice():Pe(e)?Kc(e):e},Zc=function(e){return e.slice()},wf=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},Qc={},Ef=function(){return Qc},ct=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var o=r[i],s=a==null?void 0:a[o];n[o]=s===void 0?e[o]:s}return n}},ur=function(e,r,a){for(var n=e.length-1;n>=0;n--)e[n]===r&&e.splice(n,1)},ns=function(e){e.splice(0,e.length)},Jc=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},Ct=function(e,r,a){return a&&(r=uf(a,r)),e[r]},Wt=function(e,r,a,n){a&&(r=uf(a,r)),e[r]=n},jc=function(){function t(){hr(this,t),this._obj={}}return dr(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])}(),$t=typeof Map<"u"?Map:jc,eh="undefined",th=function(){function t(e){if(hr(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return dr(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])}(),ta=(typeof Set>"u"?"undefined":at(Set))!==eh?Set:th,Fn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!jo(e)){Ye("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Ye("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new ta,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var o=r.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];Fe(r.classes)?l=r.classes:he(r.classes)&&(l=r.classes.split(/\s+/));for(var f=0,v=l.length;f<v;f++){var c=l[f];!c||c===""||i.classes.add(c)}this.createEmitter(),(a===void 0||a)&&this.restore();var h=r.style||r.css;h&&(Ne("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},Xs=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;Pe(a)&&!At(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!He(n)?n:i,n=He(n)?n:function(){};for(var s=this._private.cy,u=a=he(a)?this.filter(a):a,l=[],f=[],v={},c={},h={},d=0,p,g=this.byGroup(),y=g.nodes,m=g.edges,b=0;b<u.length;b++){var E=u[b],C=E.id();E.isNode()&&(l.unshift(E),e.bfs&&(h[C]=!0,f.push(E)),c[C]=0)}for(var A=function(){var L=e.bfs?l.shift():l.pop(),M=L.id();if(e.dfs){if(h[M])return 0;h[M]=!0,f.push(L)}var I=c[M],N=v[M],B=N!=null?N.source():null,O=N!=null?N.target():null,F=N==null?void 0:L.same(B)?O[0]:B[0],G;if(G=n(L,N,F,d++,I),G===!0)return p=L,1;if(G===!1)return 1;for(var k=L.connectedEdges().filter(function(K){return(!i||K.source().same(L))&&m.has(K)}),z=0;z<k.length;z++){var U=k[z],H=U.connectedNodes().filter(function(K){return!K.same(L)&&y.has(K)}),$=H.id();H.length!==0&&!h[$]&&(H=H[0],l.push(H),e.bfs&&(h[$]=!0,f.push(H)),v[$]=U,c[$]=c[M]+1)}},w;l.length!==0&&(w=A(),!(w!==0&&w===1)););for(var x=s.collection(),T=0;T<f.length;T++){var D=f[T],S=v[D.id()];S!=null&&x.push(S),x.push(D)}return{path:s.collection(x),found:s.collection(p)}}},Da={breadthFirstSearch:Xs({bfs:!0}),depthFirstSearch:Xs({dfs:!0})};Da.bfs=Da.breadthFirstSearch;Da.dfs=Da.depthFirstSearch;var sn={exports:{}},rh=sn.exports,Ws;function ah(){return Ws||(Ws=1,function(t,e){(function(){var r,a,n,i,o,s,u,l,f,v,c,h,d,p,g;n=Math.floor,v=Math.min,a=function(y,m){return y<m?-1:y>m?1:0},f=function(y,m,b,E,C){var A;if(b==null&&(b=0),C==null&&(C=a),b<0)throw new Error("lo must be non-negative");for(E==null&&(E=y.length);b<E;)A=n((b+E)/2),C(m,y[A])<0?E=A:b=A+1;return[].splice.apply(y,[b,b-b].concat(m)),m},s=function(y,m,b){return b==null&&(b=a),y.push(m),p(y,0,y.length-1,b)},o=function(y,m){var b,E;return m==null&&(m=a),b=y.pop(),y.length?(E=y[0],y[0]=b,g(y,0,m)):E=b,E},l=function(y,m,b){var E;return b==null&&(b=a),E=y[0],y[0]=m,g(y,0,b),E},u=function(y,m,b){var E;return b==null&&(b=a),y.length&&b(y[0],m)<0&&(E=[y[0],m],m=E[0],y[0]=E[1],g(y,0,b)),m},i=function(y,m){var b,E,C,A,w,x;for(m==null&&(m=a),A=(function(){x=[];for(var T=0,D=n(y.length/2);0<=D?T<D:T>D;0<=D?T++:T--)x.push(T);return x}).apply(this).reverse(),w=[],E=0,C=A.length;E<C;E++)b=A[E],w.push(g(y,b,m));return w},d=function(y,m,b){var E;if(b==null&&(b=a),E=y.indexOf(m),E!==-1)return p(y,0,E,b),g(y,E,b)},c=function(y,m,b){var E,C,A,w,x;if(b==null&&(b=a),C=y.slice(0,m),!C.length)return C;for(i(C,b),x=y.slice(m),A=0,w=x.length;A<w;A++)E=x[A],u(C,E,b);return C.sort(b).reverse()},h=function(y,m,b){var E,C,A,w,x,T,D,S,R;if(b==null&&(b=a),m*10<=y.length){if(A=y.slice(0,m).sort(b),!A.length)return A;for(C=A[A.length-1],D=y.slice(m),w=0,T=D.length;w<T;w++)E=D[w],b(E,C)<0&&(f(A,E,0,null,b),A.pop(),C=A[A.length-1]);return A}for(i(y,b),R=[],x=0,S=v(m,y.length);0<=S?x<S:x>S;0<=S?++x:--x)R.push(o(y,b));return R},p=function(y,m,b,E){var C,A,w;for(E==null&&(E=a),C=y[b];b>m;){if(w=b-1>>1,A=y[w],E(C,A)<0){y[b]=A,b=w;continue}break}return y[b]=C},g=function(y,m,b){var E,C,A,w,x;for(b==null&&(b=a),C=y.length,x=m,A=y[m],E=2*m+1;E<C;)w=E+1,w<C&&!(b(y[E],y[w])<0)&&(E=w),y[m]=y[E],m=E,E=2*m+1;return y[m]=A,p(y,x,m,b)},r=function(){y.push=s,y.pop=o,y.replace=l,y.pushpop=u,y.heapify=i,y.updateItem=d,y.nlargest=c,y.nsmallest=h;function y(m){this.cmp=m??a,this.nodes=[]}return y.prototype.push=function(m){return s(this.nodes,m,this.cmp)},y.prototype.pop=function(){return o(this.nodes,this.cmp)},y.prototype.peek=function(){return this.nodes[0]},y.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},y.prototype.replace=function(m){return l(this.nodes,m,this.cmp)},y.prototype.pushpop=function(m){return u(this.nodes,m,this.cmp)},y.prototype.heapify=function(){return i(this.nodes,this.cmp)},y.prototype.updateItem=function(m){return d(this.nodes,m,this.cmp)},y.prototype.clear=function(){return this.nodes=[]},y.prototype.empty=function(){return this.nodes.length===0},y.prototype.size=function(){return this.nodes.length},y.prototype.clone=function(){var m;return m=new y,m.nodes=this.nodes.slice(0),m},y.prototype.toArray=function(){return this.nodes.slice(0)},y.prototype.insert=y.prototype.push,y.prototype.top=y.prototype.peek,y.prototype.front=y.prototype.peek,y.prototype.has=y.prototype.contains,y.prototype.copy=y.prototype.clone,y}(),function(y,m){return t.exports=m()}(this,function(){return r})}).call(rh)}(sn)),sn.exports}var pi,$s;function nh(){return $s||($s=1,pi=ah()),pi}var ih=nh(),za=Ba(ih),oh=ct({root:null,weight:function(e){return 1},directed:!1}),sh={dijkstra:function(e){if(!Pe(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=oh(e),n=a.root,i=a.weight,o=a.directed,s=this,u=i,l=he(n)?this.filter(n)[0]:n[0],f={},v={},c={},h=this.byGroup(),d=h.nodes,p=h.edges;p.unmergeBy(function(I){return I.isLoop()});for(var g=function(N){return f[N.id()]},y=function(N,B){f[N.id()]=B,m.updateItem(N)},m=new za(function(I,N){return g(I)-g(N)}),b=0;b<d.length;b++){var E=d[b];f[E.id()]=E.same(l)?0:1/0,m.push(E)}for(var C=function(N,B){for(var O=(o?N.edgesTo(B):N.edgesWith(B)).intersect(p),F=1/0,G,k=0;k<O.length;k++){var z=O[k],U=u(z);(U<F||!G)&&(F=U,G=z)}return{edge:G,dist:F}};m.size()>0;){var A=m.pop(),w=g(A),x=A.id();if(c[x]=w,w!==1/0)for(var T=A.neighborhood().intersect(d),D=0;D<T.length;D++){var S=T[D],R=S.id(),L=C(A,S),M=w+L.dist;M<g(S)&&(y(S,M),v[R]={node:A,edge:L.edge})}}return{distanceTo:function(N){var B=he(N)?d.filter(N)[0]:N[0];return c[B.id()]},pathTo:function(N){var B=he(N)?d.filter(N)[0]:N[0],O=[],F=B,G=F.id();if(B.length>0)for(O.unshift(B);v[G];){var k=v[G];O.unshift(k.edge),O.unshift(k.node),F=k.node,G=F.id()}return s.spawn(O)}}}},uh={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,o=new Array(i),s=a,u=function(E){for(var C=0;C<o.length;C++){var A=o[C];if(A.has(E))return C}},l=0;l<i;l++)o[l]=this.spawn(a[l]);for(var f=n.sort(function(b,E){return e(b)-e(E)}),v=0;v<f.length;v++){var c=f[v],h=c.source()[0],d=c.target()[0],p=u(h),g=u(d),y=o[p],m=o[g];p!==g&&(s.merge(c),y.merge(m),o.splice(g,1))}return s}},lh=ct({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),fh={aStar:function(e){var r=this.cy(),a=lh(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,u=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var l=n.id(),f=i.id(),v={},c={},h={},d=new za(function(G,k){return c[G.id()]-c[k.id()]}),p=new ta,g={},y={},m=function(k,z){d.push(k),p.add(z)},b,E,C=function(){b=d.pop(),E=b.id(),p.delete(E)},A=function(k){return p.has(k)};m(n,l),v[l]=0,c[l]=o(n);for(var w=0;d.size()>0;){if(C(),w++,E===f){for(var x=[],T=i,D=f,S=y[D];x.unshift(T),S!=null&&x.unshift(S),T=g[D],T!=null;)D=T.id(),S=y[D];return{found:!0,distance:v[E],path:this.spawn(x),steps:w}}h[E]=!0;for(var R=b._private.edges,L=0;L<R.length;L++){var M=R[L];if(this.hasElementWithId(M.id())&&!(s&&M.data("source")!==E)){var I=M.source(),N=M.target(),B=I.id()!==E?I:N,O=B.id();if(this.hasElementWithId(O)&&!h[O]){var F=v[E]+u(M);if(!A(O)){v[O]=F,c[O]=F+o(B),m(B,O),g[O]=b,y[O]=M;continue}F<v[O]&&(v[O]=F,c[O]=F+o(B),g[O]=b,y[O]=M)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},vh=ct({weight:function(e){return 1},directed:!1}),ch={floydWarshall:function(e){for(var r=this.cy(),a=vh(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),u=s.nodes,l=s.edges,f=u.length,v=f*f,c=function(U){return u.indexOf(U)},h=function(U){return u[U]},d=new Array(v),p=0;p<v;p++){var g=p%f,y=(p-g)/f;y===g?d[p]=0:d[p]=1/0}for(var m=new Array(v),b=new Array(v),E=0;E<l.length;E++){var C=l[E],A=C.source()[0],w=C.target()[0];if(A!==w){var x=c(A),T=c(w),D=x*f+T,S=o(C);if(d[D]>S&&(d[D]=S,m[D]=T,b[D]=C),!i){var R=T*f+x;!i&&d[R]>S&&(d[R]=S,m[R]=x,b[R]=C)}}}for(var L=0;L<f;L++)for(var M=0;M<f;M++)for(var I=M*f+L,N=0;N<f;N++){var B=M*f+N,O=L*f+N;d[I]+d[O]<d[B]&&(d[B]=d[I]+d[O],m[B]=m[I])}var F=function(U){return(he(U)?r.filter(U):U)[0]},G=function(U){return c(F(U))},k={distance:function(U,H){var $=G(U),K=G(H);return d[$*f+K]},path:function(U,H){var $=G(U),K=G(H),j=h($);if($===K)return j.collection();if(m[$*f+K]==null)return r.collection();var re=r.collection(),Q=$,_;for(re.merge(j);$!==K;)Q=$,$=m[$*f+K],_=b[Q*f+$],re.merge(_),re.merge(h($));return re}};return k}},hh=ct({weight:function(e){return 1},directed:!1,root:null}),dh={bellmanFord:function(e){var r=this,a=hh(e),n=a.weight,i=a.directed,o=a.root,s=n,u=this,l=this.cy(),f=this.byGroup(),v=f.edges,c=f.nodes,h=c.length,d=new $t,p=!1,g=[];o=l.collection(o)[0],v.unmergeBy(function(Le){return Le.isLoop()});for(var y=v.length,m=function(se){var fe=d.get(se.id());return fe||(fe={},d.set(se.id(),fe)),fe},b=function(se){return(he(se)?l.$(se):se)[0]},E=function(se){return m(b(se)).dist},C=function(se){for(var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,de=b(se),ye=[],me=de;;){if(me==null)return r.spawn();var we=m(me),Ee=we.edge,Re=we.pred;if(ye.unshift(me[0]),me.same(fe)&&ye.length>0)break;Ee!=null&&ye.unshift(Ee),me=Re}return u.spawn(ye)},A=0;A<h;A++){var w=c[A],x=m(w);w.same(o)?x.dist=0:x.dist=1/0,x.pred=null,x.edge=null}for(var T=!1,D=function(se,fe,de,ye,me,we){var Ee=ye.dist+we;Ee<me.dist&&!de.same(ye.edge)&&(me.dist=Ee,me.pred=se,me.edge=de,T=!0)},S=1;S<h;S++){T=!1;for(var R=0;R<y;R++){var L=v[R],M=L.source(),I=L.target(),N=s(L),B=m(M),O=m(I);D(M,I,L,B,O,N),i||D(I,M,L,O,B,N)}if(!T)break}if(T)for(var F=[],G=0;G<y;G++){var k=v[G],z=k.source(),U=k.target(),H=s(k),$=m(z).dist,K=m(U).dist;if($+H<K||!i&&K+H<$)if(p||(Ne("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),e.findNegativeWeightCycles!==!1){var j=[];$+H<K&&j.push(z),!i&&K+H<$&&j.push(U);for(var re=j.length,Q=0;Q<re;Q++){var _=j[Q],q=[_];q.push(m(_).edge);for(var Y=m(_).pred;q.indexOf(Y)===-1;)q.push(Y),q.push(m(Y).edge),Y=m(Y).pred;q=q.slice(q.indexOf(Y));for(var ee=q[0].id(),ne=0,be=2;be<q.length;be+=2)q[be].id()<ee&&(ee=q[be].id(),ne=be);q=q.slice(ne).concat(q.slice(0,ne)),q.push(q[0]);var Ge=q.map(function(Le){return Le.id()}).join(",");F.indexOf(Ge)===-1&&(g.push(u.spawn(q)),F.push(Ge))}}else break}return{distanceTo:E,pathTo:C,hasNegativeWeightCycle:p,negativeWeightCycles:g}}},gh=Math.sqrt(2),ph=function(e,r,a){a.length===0&&Ye("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=r[i],u=r[o],l=a,f=l.length-1;f>=0;f--){var v=l[f],c=v[1],h=v[2];(r[c]===s&&r[h]===u||r[c]===u&&r[h]===s)&&l.splice(f,1)}for(var d=0;d<l.length;d++){var p=l[d];p[1]===u?(l[d]=p.slice(),l[d][1]=s):p[2]===u&&(l[d]=p.slice(),l[d][2]=s)}for(var g=0;g<r.length;g++)r[g]===u&&(r[g]=s);return l},yi=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=ph(i,e,r),a--}return r},yh={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(O){return O.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/gh);if(i<2){Ye("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<o;f++){var v=n[f];l.push([f,a.indexOf(v.source()),a.indexOf(v.target())])}for(var c=1/0,h=[],d=new Array(i),p=new Array(i),g=new Array(i),y=function(F,G){for(var k=0;k<i;k++)G[k]=F[k]},m=0;m<=s;m++){for(var b=0;b<i;b++)p[b]=b;var E=yi(p,l.slice(),i,u),C=E.slice();y(p,g);var A=yi(p,E,u,2),w=yi(g,C,u,2);A.length<=w.length&&A.length<c?(c=A.length,h=A,y(p,d)):w.length<=A.length&&w.length<c&&(c=w.length,h=w,y(g,d))}for(var x=this.spawn(h.map(function(O){return n[O[0]]})),T=this.spawn(),D=this.spawn(),S=d[0],R=0;R<d.length;R++){var L=d[R],M=a[R];L===S?T.merge(M):D.merge(M)}var I=function(F){var G=e.spawn();return F.forEach(function(k){G.merge(k),k.connectedEdges().forEach(function(z){e.contains(z)&&!x.contains(z)&&G.merge(z)})}),G},N=[I(T),I(D)],B={cut:x,components:N,partition1:T,partition2:D};return B}},mi,mh=function(e){return{x:e.x,y:e.y}},Gn=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},xf=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},qr=function(e){return{x:e[0],y:e[1]}},bh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},wh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},Eh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=r;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},xh=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(c,h){return c-h});var f=e.length,v=Math.floor(f/2);return f%2!==0?e[v+1+s]:(e[v-1+s]+e[v+s])/2},Th=function(e){return Math.PI*e/180},Ka=function(e,r){return Math.atan2(r,e)-Math.PI/2},is=Math.log2||function(t){return Math.log(t)/Math.log(2)},os=function(e){return e>0?1:e<0?-1:0},Ar=function(e,r){return Math.sqrt(Er(e,r))},Er=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Ch=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},ot=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},Xr=function(e,r,a,n){return{x:ot(e.x,r.x,a.x,n),y:ot(e.y,r.y,a.y,n)}},Dh=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},o=Ar(e,r),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},Sa=function(e,r,a){return Math.max(e,Math.min(a,r))},wt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Sh=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Ah=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Lh=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},Tf=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},un=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ln=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(r.length===1)a=n=i=o=r[0];else if(r.length===2)a=i=r[0],o=n=r[1];else if(r.length===4){var s=tt(r,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ks=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ss=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},Qr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Rh=function(e,r){return Qr(e,r.x,r.y)},Mh=function(e,r){return Qr(e,r.x1,r.y1)&&Qr(e,r.x2,r.y2)},Ph=(mi=Math.hypot)!==null&&mi!==void 0?mi:function(t,e){return Math.sqrt(t*t+e*e)};function Ih(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(x,T){return{x:x.x+T.x,y:x.y+T.y}},a=function(x,T){return{x:x.x-T.x,y:x.y-T.y}},n=function(x,T){return{x:x.x*T,y:x.y*T}},i=function(x,T){return x.x*T.y-x.y*T.x},o=function(x){var T=Ph(x.x,x.y);return T===0?{x:0,y:0}:{x:x.x/T,y:x.y/T}},s=function(x){for(var T=0,D=0;D<x.length;D++){var S=x[D],R=x[(D+1)%x.length];T+=S.x*R.y-R.x*S.y}return T/2},u=function(x,T,D,S){var R=a(T,x),L=a(S,D),M=i(R,L);if(Math.abs(M)<1e-9)return r(x,n(R,.5));var I=i(a(D,x),L)/M;return r(x,n(R,I))},l=t.map(function(w){return{x:w.x,y:w.y}});s(l)<0&&l.reverse();for(var f=l.length,v=[],c=0;c<f;c++){var h=l[c],d=l[(c+1)%f],p=a(d,h),g=o({x:p.y,y:-p.x});v.push(g)}for(var y=v.map(function(w,x){var T=r(l[x],n(w,e)),D=r(l[(x+1)%f],n(w,e));return{p1:T,p2:D}}),m=[],b=0;b<f;b++){var E=y[(b-1+f)%f],C=y[b],A=u(E.p1,E.p2,C.p1,C.p2);m.push(A)}return m}function Oh(t,e,r,a,n,i){var o=Uh(t,e,r,a,n),s=Ih(o,i),u=wt();return s.forEach(function(l){return Tf(u,l.x,l.y)}),u}var Cf=function(e,r,a,n,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?lr(i,o):u,f=i/2,v=o/2;l=Math.min(l,f,v);var c=l!==f,h=l!==v,d;if(c){var p=a-f+l-s,g=n-v-s,y=a+f-l+s,m=g;if(d=nr(e,r,a,n,p,g,y,m,!1),d.length>0)return d}if(h){var b=a+f+s,E=n-v+l-s,C=b,A=n+v-l+s;if(d=nr(e,r,a,n,b,E,C,A,!1),d.length>0)return d}if(c){var w=a-f+l-s,x=n+v+s,T=a+f-l+s,D=x;if(d=nr(e,r,a,n,w,x,T,D,!1),d.length>0)return d}if(h){var S=a-f-s,R=n-v+l-s,L=S,M=n+v-l+s;if(d=nr(e,r,a,n,S,R,L,M,!1),d.length>0)return d}var I;{var N=a-f+l,B=n-v+l;if(I=ya(e,r,a,n,N,B,l+s),I.length>0&&I[0]<=N&&I[1]<=B)return[I[0],I[1]]}{var O=a+f-l,F=n-v+l;if(I=ya(e,r,a,n,O,F,l+s),I.length>0&&I[0]>=O&&I[1]<=F)return[I[0],I[1]]}{var G=a+f-l,k=n+v-l;if(I=ya(e,r,a,n,G,k,l+s),I.length>0&&I[0]>=G&&I[1]>=k)return[I[0],I[1]]}{var z=a-f+l,U=n+v-l;if(I=ya(e,r,a,n,z,U,l+s),I.length>0&&I[0]<=z&&I[1]>=U)return[I[0],I[1]]}return[]},Nh=function(e,r,a,n,i,o,s){var u=s,l=Math.min(a,i),f=Math.max(a,i),v=Math.min(n,o),c=Math.max(n,o);return l-u<=e&&e<=f+u&&v-u<=r&&r<=c+u},Bh=function(e,r,a,n,i,o,s,u,l){var f={x1:Math.min(a,s,i)-l,x2:Math.max(a,s,i)+l,y1:Math.min(n,u,o)-l,y2:Math.max(n,u,o)+l};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},kh=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-r+o)/s,l=(-r-o)/s;return[u,l]},Fh=function(e,r,a,n,i){var o=1e-5;e===0&&(e=o),r/=e,a/=e,n/=e;var s,u,l,f,v,c,h,d;if(u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),l/=54,s=u*u*u+l*l,i[1]=0,h=r/3,s>0){v=l+Math.sqrt(s),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),c=l-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+v+c,h+=(v+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+v)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),d=2*Math.sqrt(u),i[0]=-h+d*Math.cos(f/3),i[2]=-h+d*Math.cos((f+2*Math.PI)/3),i[4]=-h+d*Math.cos((f+4*Math.PI)/3)},Gh=function(e,r,a,n,i,o,s,u){var l=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*u+4*o*o-4*o*u+u*u,f=1*9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*u-6*o*o+3*o*u,v=1*3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*u-n*r+2*o*o+2*o*r-u*r,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*r-o*r,h=[];Fh(l,f,v,c,h);for(var d=1e-7,p=[],g=0;g<6;g+=2)Math.abs(h[g+1])<d&&h[g]>=0&&h[g]<=1&&p.push(h[g]);p.push(1),p.push(0);for(var y=-1,m,b,E,C=0;C<p.length;C++)m=Math.pow(1-p[C],2)*a+2*(1-p[C])*p[C]*i+p[C]*p[C]*s,b=Math.pow(1-p[C],2)*n+2*(1-p[C])*p[C]*o+p[C]*p[C]*u,E=Math.pow(m-e,2)+Math.pow(b-r,2),y>=0?E<y&&(y=E):y=E;return y},zh=function(e,r,a,n,i,o){var s=[e-a,r-n],u=[i-a,o-n],l=u[0]*u[0]+u[1]*u[1],f=s[0]*s[0]+s[1]*s[1],v=s[0]*u[0]+s[1]*u[1],c=v*v/l;return v<0?f:c>l?(e-i)*(e-i)+(r-o)*(r-o):f-c},Dt=function(e,r,a){for(var n,i,o,s,u,l=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(o=a[(f+1)*2],s=a[(f+1)*2+1]):(o=a[(f+1-a.length/2)*2],s=a[(f+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)u=(e-n)/(o-n)*(s-i)+i,u>r&&l++;else continue;return l%2!==0},Zt=function(e,r,a,n,i,o,s,u,l){var f=new Array(a.length),v;u[0]!=null?(v=Math.atan(u[1]/u[0]),u[0]<0?v=v+Math.PI/2:v=-v-Math.PI/2):v=u;for(var c=Math.cos(-v),h=Math.sin(-v),d=0;d<f.length/2;d++)f[d*2]=o/2*(a[d*2]*c-a[d*2+1]*h),f[d*2+1]=s/2*(a[d*2+1]*c+a[d*2]*h),f[d*2]+=n,f[d*2+1]+=i;var p;if(l>0){var g=Sn(f,-l);p=Dn(g)}else p=f;return Dt(e,r,p)},_h=function(e,r,a,n,i,o,s,u){for(var l=new Array(a.length*2),f=0;f<u.length;f++){var v=u[f];l[f*4+0]=v.startX,l[f*4+1]=v.startY,l[f*4+2]=v.stopX,l[f*4+3]=v.stopY;var c=Math.pow(v.cx-e,2)+Math.pow(v.cy-r,2);if(c<=Math.pow(v.radius,2))return!0}return Dt(e,r,l)},Dn=function(e){for(var r=new Array(e.length/2),a,n,i,o,s,u,l,f,v=0;v<e.length/4;v++){a=e[v*4],n=e[v*4+1],i=e[v*4+2],o=e[v*4+3],v<e.length/4-1?(s=e[(v+1)*4],u=e[(v+1)*4+1],l=e[(v+1)*4+2],f=e[(v+1)*4+3]):(s=e[0],u=e[1],l=e[2],f=e[3]);var c=nr(a,n,i,o,s,u,l,f,!0);r[v*2]=c[0],r[v*2+1]=c[1]}return r},Sn=function(e,r){for(var a=new Array(e.length*2),n,i,o,s,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,f=-(o-n),v=Math.sqrt(l*l+f*f),c=l/v,h=f/v;a[u*4]=n+c*r,a[u*4+1]=i+h*r,a[u*4+2]=o+c*r,a[u*4+3]=s+h*r}return a},Vh=function(e,r,a,n,i,o){var s=a-e,u=n-r;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),f=l-1;if(f<0)return[];var v=f/l;return[(a-e)*v+e,(n-r)*v+r]},Dr=function(e,r,a,n,i,o,s){return e-=i,r-=o,e/=a/2+s,r/=n/2+s,e*e+r*r<=1},ya=function(e,r,a,n,i,o,s){var u=[a-e,n-r],l=[e-i,r-o],f=u[0]*u[0]+u[1]*u[1],v=2*(l[0]*u[0]+l[1]*u[1]),c=l[0]*l[0]+l[1]*l[1]-s*s,h=v*v-4*f*c;if(h<0)return[];var d=(-v+Math.sqrt(h))/(2*f),p=(-v-Math.sqrt(h))/(2*f),g=Math.min(d,p),y=Math.max(d,p),m=[];if(g>=0&&g<=1&&m.push(g),y>=0&&y<=1&&m.push(y),m.length===0)return[];var b=m[0]*u[0]+e,E=m[0]*u[1]+r;if(m.length>1){if(m[0]==m[1])return[b,E];var C=m[1]*u[0]+e,A=m[1]*u[1]+r;return[b,E,C,A]}else return[b,E]},bi=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},nr=function(e,r,a,n,i,o,s,u,l){var f=e-i,v=a-e,c=s-i,h=r-o,d=n-r,p=u-o,g=c*h-p*f,y=v*h-d*f,m=p*v-c*d;if(m!==0){var b=g/m,E=y/m,C=.001,A=0-C,w=1+C;return A<=b&&b<=w&&A<=E&&E<=w?[e+b*v,r+b*d]:l?[e+b*v,r+b*d]:[]}else return g===0||y===0?bi(e,a,s)===s?[s,u]:bi(e,a,i)===i?[i,o]:bi(i,s,a)===a?[a,n]:[]:[]},Uh=function(e,r,a,n,i){var o=[],s=n/2,u=i/2,l=r,f=a;o.push({x:l+s*e[0],y:f+u*e[1]});for(var v=1;v<e.length/2;v++)o.push({x:l+s*e[v*2],y:f+u*e[v*2+1]});return o},Aa=function(e,r,a,n,i,o,s,u){var l=[],f,v=new Array(a.length),c=!0;o==null&&(c=!1);var h;if(c){for(var d=0;d<v.length/2;d++)v[d*2]=a[d*2]*o+n,v[d*2+1]=a[d*2+1]*s+i;if(u>0){var p=Sn(v,-u);h=Dn(p)}else h=v}else h=a;for(var g,y,m,b,E=0;E<h.length/2;E++)g=h[E*2],y=h[E*2+1],E<h.length/2-1?(m=h[(E+1)*2],b=h[(E+1)*2+1]):(m=h[0],b=h[1]),f=nr(e,r,n,i,g,y,m,b),f.length!==0&&l.push(f[0],f[1]);return l},qh=function(e,r,a,n,i,o,s,u,l){var f=[],v,c=new Array(a.length*2);l.forEach(function(m,b){b===0?(c[c.length-2]=m.startX,c[c.length-1]=m.startY):(c[b*4-2]=m.startX,c[b*4-1]=m.startY),c[b*4]=m.stopX,c[b*4+1]=m.stopY,v=ya(e,r,n,i,m.cx,m.cy,m.radius),v.length!==0&&f.push(v[0],v[1])});for(var h=0;h<c.length/4;h++)v=nr(e,r,n,i,c[h*4],c[h*4+1],c[h*4+2],c[h*4+3],!1),v.length!==0&&f.push(v[0],v[1]);if(f.length>2){for(var d=[f[0],f[1]],p=Math.pow(d[0]-e,2)+Math.pow(d[1]-r,2),g=1;g<f.length/2;g++){var y=Math.pow(f[g*2]-e,2)+Math.pow(f[g*2+1]-r,2);y<=p&&(d[0]=f[g*2],d[1]=f[g*2+1],p=y)}return d}return f},Za=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[r[0]+o*n[0],r[1]+o*n[1]]},bt=function(e,r){var a=Oo(e,r);return a=Df(a),a},Df=function(e){for(var r,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<n;l++)r=e[2*l],a=e[2*l+1],i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);for(var f=2/(s-i),v=2/(u-o),c=0;c<n;c++)r=e[2*c]=e[2*c]*f,a=e[2*c+1]=e[2*c+1]*v,i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);if(o<-1)for(var h=0;h<n;h++)a=e[2*h+1]=e[2*h+1]+(-1-o);return e},Oo=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},lr=function(e,r){return Math.min(e/4,r/4,8)},Sf=function(e,r){return Math.min(e/10,r/10,8)},us=function(){return 8},Yh=function(e,r,a){return[e-2*r+a,2*(r-e),e]},No=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Hh(t,e){function r(v){for(var c=[],h=0;h<v.length;h++){var d=v[h],p=v[(h+1)%v.length],g={x:p.x-d.x,y:p.y-d.y},y={x:-g.y,y:g.x},m=Math.sqrt(y.x*y.x+y.y*y.y);c.push({x:y.x/m,y:y.y/m})}return c}function a(v,c){var h=1/0,d=-1/0,p=St(v),g;try{for(p.s();!(g=p.n()).done;){var y=g.value,m=y.x*c.x+y.y*c.y;h=Math.min(h,m),d=Math.max(d,m)}}catch(b){p.e(b)}finally{p.f()}return{min:h,max:d}}function n(v,c){return!(v.max<c.min||c.max<v.min)}var i=[].concat(En(r(t)),En(r(e))),o=St(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=a(t,u),f=a(e,u);if(!n(l,f))return!1}}catch(v){o.e(v)}finally{o.f()}return!0}var Xh=ct({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Wh={pageRank:function(e){for(var r=Xh(e),a=r.dampingFactor,n=r.precision,i=r.iterations,o=r.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,v=l.length,c=v*v,h=f.length,d=new Array(c),p=new Array(v),g=(1-a)/v,y=0;y<v;y++){for(var m=0;m<v;m++){var b=y*v+m;d[b]=0}p[y]=0}for(var E=0;E<h;E++){var C=f[E],A=C.data("source"),w=C.data("target");if(A!==w){var x=l.indexOfId(A),T=l.indexOfId(w),D=o(C),S=T*v+x;d[S]+=D,p[x]+=D}}for(var R=1/v+g,L=0;L<v;L++)if(p[L]===0)for(var M=0;M<v;M++){var I=M*v+L;d[I]=R}else for(var N=0;N<v;N++){var B=N*v+L;d[B]=d[B]/p[L]+g}for(var O=new Array(v),F=new Array(v),G,k=0;k<v;k++)O[k]=1;for(var z=0;z<i;z++){for(var U=0;U<v;U++)F[U]=0;for(var H=0;H<v;H++)for(var $=0;$<v;$++){var K=H*v+$;F[H]+=d[K]*O[$]}Ch(F),G=O,O=F,F=G;for(var j=0,re=0;re<v;re++){var Q=G[re]-O[re];j+=Q*Q}if(j<n)break}var _={rank:function(Y){return Y=s.collection(Y)[0],O[l.indexOf(Y)]}};return _}},Zs=ct({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Wr={degreeCentralityNormalized:function(e){e=Zs(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},v={},c=0,h=0,d=0;d<n;d++){var p=a[d],g=p.id();e.root=p;var y=this.degreeCentrality(e);c<y.indegree&&(c=y.indegree),h<y.outdegree&&(h=y.outdegree),f[g]=y.indegree,v[g]=y.outdegree}return{indegree:function(b){return c==0?0:(he(b)&&(b=r.filter(b)),f[b.id()]/c)},outdegree:function(b){return h===0?0:(he(b)&&(b=r.filter(b)),v[b.id()]/h)}}}else{for(var i={},o=0,s=0;s<n;s++){var u=a[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(b){return o===0?0:(he(b)&&(b=r.filter(b)),i[b.id()]/o)}}}},degreeCentrality:function(e){e=Zs(e);var r=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,u=n.alpha;if(i=r.collection(i)[0],s){for(var h=i.connectedEdges(),d=h.filter(function(A){return A.target().same(i)&&a.has(A)}),p=h.filter(function(A){return A.source().same(i)&&a.has(A)}),g=d.length,y=p.length,m=0,b=0,E=0;E<d.length;E++)m+=o(d[E]);for(var C=0;C<p.length;C++)b+=o(p[C]);return{indegree:Math.pow(g,1-u)*Math.pow(m,u),outdegree:Math.pow(y,1-u)*Math.pow(b,u)}}else{for(var l=i.connectedEdges().intersection(a),f=l.length,v=0,c=0;c<l.length;c++)v+=o(l[c]);return{degree:Math.pow(f,1-u)*Math.pow(v,u)}}}};Wr.dc=Wr.degreeCentrality;Wr.dcn=Wr.degreeCentralityNormalised=Wr.degreeCentralityNormalized;var Qs=ct({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),$r={closenessCentralityNormalized:function(e){for(var r=Qs(e),a=r.harmonic,n=r.weight,i=r.directed,o=this.cy(),s={},u=0,l=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),v=0;v<l.length;v++){for(var c=0,h=l[v],d=0;d<l.length;d++)if(v!==d){var p=f.distance(h,l[d]);a?c+=1/p:c+=p}a||(c=1/c),u<c&&(u=c),s[h.id()]=c}return{closeness:function(y){return u==0?0:(he(y)?y=o.filter(y)[0].id():y=y.id(),s[y]/u)}}},closenessCentrality:function(e){var r=Qs(e),a=r.root,n=r.weight,i=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var v=l[f];if(!v.same(a)){var c=s.distanceTo(v);o?u+=1/c:u+=c}}return o?u:1/u}};$r.cc=$r.closenessCentrality;$r.ccn=$r.closenessCentralityNormalised=$r.closenessCentralityNormalized;var $h=ct({weight:null,directed:!1}),Bo={betweennessCentrality:function(e){for(var r=$h(e),a=r.directed,n=r.weight,i=n!=null,o=this.cy(),s=this.nodes(),u={},l={},f=0,v={set:function(b,E){l[b]=E,E>f&&(f=E)},get:function(b){return l[b]}},c=0;c<s.length;c++){var h=s[c],d=h.id();a?u[d]=h.outgoers().nodes():u[d]=h.openNeighborhood().nodes(),v.set(d,0)}for(var p=function(){for(var b=s[g].id(),E=[],C={},A={},w={},x=new za(function(H,$){return w[H]-w[$]}),T=0;T<s.length;T++){var D=s[T].id();C[D]=[],A[D]=0,w[D]=1/0}for(A[b]=1,w[b]=0,x.push(b);!x.empty();){var S=x.pop();if(E.push(S),i)for(var R=0;R<u[S].length;R++){var L=u[S][R],M=o.getElementById(S),I=void 0;M.edgesTo(L).length>0?I=M.edgesTo(L)[0]:I=L.edgesTo(M)[0];var N=n(I);L=L.id(),w[L]>w[S]+N&&(w[L]=w[S]+N,x.nodes.indexOf(L)<0?x.push(L):x.updateItem(L),A[L]=0,C[L]=[]),w[L]==w[S]+N&&(A[L]=A[L]+A[S],C[L].push(S))}else for(var B=0;B<u[S].length;B++){var O=u[S][B].id();w[O]==1/0&&(x.push(O),w[O]=w[S]+1),w[O]==w[S]+1&&(A[O]=A[O]+A[S],C[O].push(S))}}for(var F={},G=0;G<s.length;G++)F[s[G].id()]=0;for(;E.length>0;){for(var k=E.pop(),z=0;z<C[k].length;z++){var U=C[k][z];F[U]=F[U]+A[U]/A[k]*(1+F[k])}k!=s[g].id()&&v.set(k,v.get(k)+F[k])}},g=0;g<s.length;g++)p();var y={betweenness:function(b){var E=o.collection(b).id();return v.get(E)},betweennessNormalized:function(b){if(f==0)return 0;var E=o.collection(b).id();return v.get(E)/f}};return y.betweennessNormalised=y.betweennessNormalized,y}};Bo.bc=Bo.betweennessCentrality;var Kh=ct({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),Zh=function(e){return Kh(e)},Qh=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},Jh=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},Af=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var o=0;o<r;o++)e[o*r+n]=e[o*r+n]/a}},jh=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+s]*r[s*a+u]}return n},ed=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=jh(e,n,r);return e},td=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return Af(n,r),n},rd=function(e,r,a,n){for(var i=0;i<a;i++){var o=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),s=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(o!==s)return!1}return!0},ad=function(e,r,a,n){for(var i=[],o=0;o<r;o++){for(var s=[],u=0;u<r;u++)Math.round(e[o*r+u]*1e3)/1e3>0&&s.push(a[u]);s.length!==0&&i.push(n.collection(s))}return i},nd=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},id=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&nd(e[r],e[a])&&e.splice(a,1);return e},Js=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=Zh(e),o={},s=0;s<r.length;s++)o[r[s].id()]=s;for(var u=r.length,l=u*u,f=new Array(l),v,c=0;c<l;c++)f[c]=0;for(var h=0;h<a.length;h++){var d=a[h],p=o[d.source().id()],g=o[d.target().id()],y=Qh(d,i.attributes);f[p*u+g]+=y,f[g*u+p]+=y}Jh(f,u,i.multFactor),Af(f,u);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,v=ed(f,u,i.expandFactor),f=td(v,u,i.inflateFactor),rd(f,v,l,4)||(m=!0),b++;var E=ad(f,u,r,n);return E=id(E),E},od={markovClustering:Js,mcl:Js},sd=function(e){return e},Lf=function(e,r){return Math.abs(r-e)},js=function(e,r,a){return e+Lf(r,a)},eu=function(e,r,a){return e+Math.pow(a-r,2)},ud=function(e){return Math.sqrt(e)},ld=function(e,r,a){return Math.max(e,Lf(r,a))},fa=function(e,r,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:sd,s=n,u,l,f=0;f<e;f++)u=r(f),l=a(f),s=i(s,u,l);return o(s)},Jr={euclidean:function(e,r,a){return e>=2?fa(e,r,a,0,eu,ud):fa(e,r,a,0,js)},squaredEuclidean:function(e,r,a){return fa(e,r,a,0,eu)},manhattan:function(e,r,a){return fa(e,r,a,0,js)},max:function(e,r,a){return fa(e,r,a,-1/0,ld)}};Jr["squared-euclidean"]=Jr.squaredEuclidean;Jr.squaredeuclidean=Jr.squaredEuclidean;function zn(t,e,r,a,n,i){var o;return He(t)?o=t:o=Jr[t]||Jr.euclidean,e===0&&He(t)?o(n,i):o(e,r,a,n,i)}var fd=ct({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ls=function(e){return fd(e)},An=function(e,r,a,n,i){var o=i!=="kMedoids",s=o?function(v){return a[v]}:function(v){return n[v](a)},u=function(c){return n[c](r)},l=a,f=r;return zn(e,n.length,s,u,l,f)},wi=function(e,r,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(r),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,o[l]=e.max(a[l]).value;for(var f=0;f<r;f++){u=[];for(var v=0;v<n;v++)u[v]=Math.random()*(o[v]-i[v])+i[v];s[f]=u}return s},Rf=function(e,r,a,n,i){for(var o=1/0,s=0,u=0;u<r.length;u++){var l=An(a,e,r[u],n,i);l<o&&(o=l,s=u)}return s},Mf=function(e,r,a){for(var n=[],i=null,o=0;o<r.length;o++)i=r[o],a[i.id()]===e&&n.push(i);return n},vd=function(e,r,a){return Math.abs(r-e)<=a},cd=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var o=Math.abs(e[n][i]-r[n][i]);if(o>a)return!1}return!0},hd=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},tu=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];hd(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},ru=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=An("manhattan",r[i],e,a,"kMedoids");return n},dd=function(e){var r=this.cy(),a=this.nodes(),n=null,i=ls(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=wi(a,i.k,i.attributes)):at(i.testCentroids)==="object"?u=i.testCentroids:u=wi(a,i.k,i.attributes):u=wi(a,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var v=0;v<a.length;v++)n=a[v],s[n.id()]=Rf(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var c=0;c<i.k;c++){var h=Mf(c,a,s);if(h.length!==0){for(var d=i.attributes.length,p=u[c],g=new Array(d),y=new Array(d),m=0;m<d;m++){y[m]=0;for(var b=0;b<h.length;b++)n=h[b],y[m]+=i.attributes[m](n);g[m]=y[m]/h.length,vd(g[m],p[m],i.sensitivityThreshold)||(l=!0)}u[c]=g,o[c]=r.collection(h)}}f++}return o},gd=function(e){var r=this.cy(),a=this.nodes(),n=null,i=ls(e),o=new Array(i.k),s,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(at(i.testCentroids)==="object"?s=i.testCentroids:s=tu(a,i.k)):s=tu(a,i.k);for(var v=!0,c=0;v&&c<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],u[n.id()]=Rf(n,s,i.distance,i.attributes,"kMedoids");v=!1;for(var d=0;d<s.length;d++){var p=Mf(d,a,u);if(p.length!==0){f[d]=ru(s[d],p,i.attributes);for(var g=0;g<p.length;g++)l=ru(p[g],p,i.attributes),l<f[d]&&(f[d]=l,s[d]=p[g],v=!0);o[d]=r.collection(p)}}c++}return o},pd=function(e,r,a,n,i){for(var o,s,u=0;u<r.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var f=0;f<e.length;f++)for(var v=0;v<i.attributes.length;v++){o=0,s=0;for(var c=0;c<r.length;c++)o+=n[c][f]*i.attributes[v](r[c]),s+=n[c][f];e[f][v]=o/s}},yd=function(e,r,a,n,i){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var s,u,l,f=2/(i.m-1),v=0;v<a.length;v++)for(var c=0;c<n.length;c++){s=0;for(var h=0;h<a.length;h++)u=An(i.distance,n[c],a[v],i.attributes,"cmeans"),l=An(i.distance,n[c],a[h],i.attributes,"cmeans"),s+=Math.pow(u/l,f);e[c][v]=1/s}},md=function(e,r,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<r.length;l++){s=-1/0,u=-1;for(var f=0;f<r[0].length;f++)r[l][f]>s&&(s=r[l][f],u=f);i[u].push(e[l])}for(var v=0;v<i.length;v++)i[v]=n.collection(i[v]);return i},au=function(e){var r=this.cy(),a=this.nodes(),n=ls(e),i,o,s,u,l;u=new Array(a.length);for(var f=0;f<a.length;f++)u[f]=new Array(n.k);s=new Array(a.length);for(var v=0;v<a.length;v++)s[v]=new Array(n.k);for(var c=0;c<a.length;c++){for(var h=0,d=0;d<n.k;d++)s[c][d]=Math.random(),h+=s[c][d];for(var p=0;p<n.k;p++)s[c][p]=s[c][p]/h}o=new Array(n.k);for(var g=0;g<n.k;g++)o[g]=new Array(n.attributes.length);l=new Array(a.length);for(var y=0;y<a.length;y++)l[y]=new Array(n.k);for(var m=!0,b=0;m&&b<n.maxIterations;)m=!1,pd(o,a,s,l,n),yd(s,u,o,a,n),cd(s,u,n.sensitivityThreshold)||(m=!0),b++;return i=md(a,s,n,r),{clusters:i,degreeOfMembership:s}},bd={kMeans:dd,kMedoids:gd,fuzzyCMeans:au,fcm:au},wd=ct({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Ed={single:"min",complete:"max"},xd=function(e){var r=wd(e),a=Ed[r.linkage];return a!=null&&(r.linkage=a),r},nu=function(e,r,a,n,i){for(var o=0,s=1/0,u,l=i.attributes,f=function(T,D){return zn(i.distance,l.length,function(S){return l[S](T)},function(S){return l[S](D)},T,D)},v=0;v<e.length;v++){var c=e[v].key,h=a[c][n[c]];h<s&&(o=c,s=h)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[o],p=r[n[o]],g;i.mode==="dendrogram"?g={left:d,right:p,key:d.key}:g={value:d.value.concat(p.value),key:d.key},e[d.index]=g,e.splice(p.index,1),r[d.key]=g;for(var y=0;y<e.length;y++){var m=e[y];d.key===m.key?u=1/0:i.linkage==="min"?(u=a[d.key][m.key],a[d.key][m.key]>a[p.key][m.key]&&(u=a[p.key][m.key])):i.linkage==="max"?(u=a[d.key][m.key],a[d.key][m.key]<a[p.key][m.key]&&(u=a[p.key][m.key])):i.linkage==="mean"?u=(a[d.key][m.key]*d.size+a[p.key][m.key]*p.size)/(d.size+p.size):i.mode==="dendrogram"?u=f(m.value,d.value):u=f(m.value[0],d.value[0]),a[d.key][m.key]=a[m.key][d.key]=u}for(var b=0;b<e.length;b++){var E=e[b].key;if(n[E]===d.key||n[E]===p.key){for(var C=E,A=0;A<e.length;A++){var w=e[A].key;a[E][w]<a[E][C]&&(C=w)}n[E]=C}e[b].index=b}return d.key=p.key=d.index=p.index=null,!0},Yr=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&Yr(e.left,r),e.right&&Yr(e.right,r)))},ko=function(e,r){if(!e)return"";if(e.left&&e.right){var a=ko(e.left,r),n=ko(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Fo=function(e,r,a){if(!e)return[];var n=[],i=[],o=[];return r===0?(e.left&&Yr(e.left,n),e.right&&Yr(e.right,i),o=n.concat(i),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&Yr(e.left,n),e.right&&Yr(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Fo(e.left,r-1,a)),e.right&&(i=Fo(e.right,r-1,a)),n.concat(i))},iu=function(e){for(var r=this.cy(),a=this.nodes(),n=xd(e),i=n.attributes,o=function(b,E){return zn(n.distance,i.length,function(C){return i[C](b)},function(C){return i[C](E)},b,E)},s=[],u=[],l=[],f=[],v=0;v<a.length;v++){var c={value:n.mode==="dendrogram"?a[v]:[a[v]],key:v,index:v};s[v]=c,f[v]=c,u[v]=[],l[v]=0}for(var h=0;h<s.length;h++)for(var d=0;d<=h;d++){var p=void 0;n.mode==="dendrogram"?p=h===d?1/0:o(s[h].value,s[d].value):p=h===d?1/0:o(s[h].value[0],s[d].value[0]),u[h][d]=p,u[d][h]=p,p<u[h][l[h]]&&(l[h]=d)}for(var g=nu(s,f,u,l,n);g;)g=nu(s,f,u,l,n);var y;return n.mode==="dendrogram"?(y=Fo(s[0],n.dendrogramDepth,r),n.addDendrogram&&ko(s[0],r)):(y=new Array(s.length),s.forEach(function(m,b){m.key=m.index=null,y[b]=r.collection(m.value)})),y},Td={hierarchicalClustering:iu,hca:iu},Cd=ct({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Dd=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||Ye("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ae(a)||Ye("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Cd(e)},Sd=function(e,r,a,n){var i=function(s,u){return n[u](s)};return-zn(e,n.length,function(o){return i(r,o)},function(o){return i(a,o)},r,a)},Ad=function(e,r){var a=null;return r==="median"?a=xh(e):r==="mean"?a=Eh(e):r==="min"?a=bh(e):r==="max"?a=wh(e):a=r,a},Ld=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},ou=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<a.length;u++){var l=a[u];r[i*e+l]>s&&(o=l,s=r[i*e+l])}o>0&&n.push(o)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Rd=function(e,r,a){for(var n=ou(e,r,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var u=-1,l=-1/0,f=0;f<o.length;f++){for(var v=0,c=0;c<o.length;c++)v+=r[o[c]*e+o[f]];v>l&&(u=f,l=v)}a[i]=o[u]}return n=ou(e,r,a),n},su=function(e){for(var r=this.cy(),a=this.nodes(),n=Dd(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,u,l,f,v,c;s=a.length,u=s*s,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var d=0;d<s;d++)for(var p=0;p<s;p++)d!==p&&(l[d*s+p]=Sd(n.distance,a[d],a[p],n.attributes));f=Ad(l,n.preference);for(var g=0;g<s;g++)l[g*s+g]=f;v=new Array(u);for(var y=0;y<u;y++)v[y]=0;c=new Array(u);for(var m=0;m<u;m++)c[m]=0;for(var b=new Array(s),E=new Array(s),C=new Array(s),A=0;A<s;A++)b[A]=0,E[A]=0,C[A]=0;for(var w=new Array(s*n.minIterations),x=0;x<w.length;x++)w[x]=0;var T;for(T=0;T<n.maxIterations;T++){for(var D=0;D<s;D++){for(var S=-1/0,R=-1/0,L=-1,M=0,I=0;I<s;I++)b[I]=v[D*s+I],M=c[D*s+I]+l[D*s+I],M>=S?(R=S,S=M,L=I):M>R&&(R=M);for(var N=0;N<s;N++)v[D*s+N]=(1-n.damping)*(l[D*s+N]-S)+n.damping*b[N];v[D*s+L]=(1-n.damping)*(l[D*s+L]-R)+n.damping*b[L]}for(var B=0;B<s;B++){for(var O=0,F=0;F<s;F++)b[F]=c[F*s+B],E[F]=Math.max(0,v[F*s+B]),O+=E[F];O-=E[B],E[B]=v[B*s+B],O+=E[B];for(var G=0;G<s;G++)c[G*s+B]=(1-n.damping)*Math.min(0,O-E[G])+n.damping*b[G];c[B*s+B]=(1-n.damping)*(O-E[B])+n.damping*b[B]}for(var k=0,z=0;z<s;z++){var U=c[z*s+z]+v[z*s+z]>0?1:0;w[T%n.minIterations*s+z]=U,k+=U}if(k>0&&(T>=n.minIterations-1||T==n.maxIterations-1)){for(var H=0,$=0;$<s;$++){C[$]=0;for(var K=0;K<n.minIterations;K++)C[$]+=w[K*s+$];(C[$]===0||C[$]===n.minIterations)&&H++}if(H===s)break}}for(var j=Ld(s,v,c),re=Rd(s,l,j),Q={},_=0;_<j.length;_++)Q[j[_]]=[];for(var q=0;q<a.length;q++){var Y=i[a[q].id()],ee=re[Y];ee!=null&&Q[ee].push(a[q])}for(var ne=new Array(j.length),be=0;be<j.length;be++)ne[be]=r.collection(Q[j[be]]);return ne},Md={affinityPropagation:su,ap:su},Pd=ct({root:void 0,directed:!1}),Id={hierholzer:function(e){if(!Pe(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Pd(e),n=a.root,i=a.directed,o=this,s=!1,u,l,f;n&&(f=he(n)?this.filter(n)[0].id():n[0].id());var v={},c={};i?o.forEach(function(m){var b=m.id();if(m.isNode()){var E=m.indegree(!0),C=m.outdegree(!0),A=E-C,w=C-E;A==1?u?s=!0:u=b:w==1?l?s=!0:l=b:(w>1||A>1)&&(s=!0),v[b]=[],m.outgoers().forEach(function(x){x.isEdge()&&v[b].push(x.id())})}else c[b]=[void 0,m.target().id()]}):o.forEach(function(m){var b=m.id();if(m.isNode()){var E=m.degree(!0);E%2&&(u?l?s=!0:l=b:u=b),v[b]=[],m.connectedEdges().forEach(function(C){return v[b].push(C.id())})}else c[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(l&&u)if(i){if(f&&l!=f)return h;f=l}else{if(f&&l!=f&&u!=f)return h;f||(f=l)}else f||(f=o[0].id());var d=function(b){for(var E=b,C=[b],A,w,x;v[E].length;)A=v[E].shift(),w=c[A][0],x=c[A][1],E!=x?(v[x]=v[x].filter(function(T){return T!=A}),E=x):!i&&E!=w&&(v[w]=v[w].filter(function(T){return T!=A}),E=w),C.unshift(A),C.unshift(E);return C},p=[],g=[];for(g=d(f);g.length!=1;)v[g[0]].length==0?(p.unshift(o.getElementById(g.shift())),p.unshift(o.getElementById(g.shift()))):g=d(g.shift()).concat(g);p.unshift(o.getElementById(g.shift()));for(var y in v)if(v[y].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Qa=function(){var e=this,r={},a=0,n=0,i=[],o=[],s={},u=function(c,h){for(var d=o.length-1,p=[],g=e.spawn();o[d].x!=c||o[d].y!=h;)p.push(o.pop().edge),d--;p.push(o.pop().edge),p.forEach(function(y){var m=y.connectedNodes().intersection(e);g.merge(y),m.forEach(function(b){var E=b.id(),C=b.connectedEdges().intersection(e);g.merge(b),r[E].cutVertex?g.merge(C.filter(function(A){return A.isLoop()})):g.merge(C)})}),i.push(g)},l=function(c,h,d){c===d&&(n+=1),r[h]={id:a,low:a++,cutVertex:!1};var p=e.getElementById(h).connectedEdges().intersection(e);if(p.size()===0)i.push(e.spawn(e.getElementById(h)));else{var g,y,m,b;p.forEach(function(E){g=E.source().id(),y=E.target().id(),m=g===h?y:g,m!==d&&(b=E.id(),s[b]||(s[b]=!0,o.push({x:h,y:m,edge:E})),m in r?r[h].low=Math.min(r[h].low,r[m].id):(l(c,m,h),r[h].low=Math.min(r[h].low,r[m].low),r[h].id<=r[m].low&&(r[h].cutVertex=!0,u(h,m))))})}};e.forEach(function(v){if(v.isNode()){var c=v.id();c in r||(n=0,l(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(v){return r[v].cutVertex}).map(function(v){return e.getElementById(v)});return{cut:e.spawn(f),components:i}},Od={hopcroftTarjanBiconnected:Qa,htbc:Qa,htb:Qa,hopcroftTarjanBiconnectedComponents:Qa},Ja=function(){var e=this,r={},a=0,n=[],i=[],o=e.spawn(e),s=function(l){i.push(l),r[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(p){var g=p.target().id();g!==l&&(g in r||s(g),r[g].explored||(r[l].low=Math.min(r[l].low,r[g].low)))}),r[l].index===r[l].low){for(var v=e.spawn();;){var c=i.pop();if(v.merge(e.getElementById(c)),r[c].low=r[l].index,r[c].explored=!0,c===l)break}var h=v.edgesWith(v),d=v.merge(h);n.push(d),o=o.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||s(l)}}),{cut:o,components:n}},Nd={tarjanStronglyConnected:Ja,tsc:Ja,tscc:Ja,tarjanStronglyConnectedComponents:Ja},Pf={};[Da,sh,uh,fh,ch,dh,yh,Wh,Wr,$r,Bo,od,bd,Td,Md,Id,Od,Nd].forEach(function(t){pe(Pf,t)});/*!
5
+ Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
6
+ Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
7
+ Licensed under The MIT License (http://opensource.org/licenses/MIT)
8
+ */var If=0,Of=1,Nf=2,kt=function(e){if(!(this instanceof kt))return new kt(e);this.id="Thenable/1.0.7",this.state=If,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};kt.prototype={fulfill:function(e){return uu(this,Of,"fulfillValue",e)},reject:function(e){return uu(this,Nf,"rejectReason",e)},then:function(e,r){var a=this,n=new kt;return a.onFulfilled.push(fu(e,n,"fulfill")),a.onRejected.push(fu(r,n,"reject")),Bf(a),n.proxy}};var uu=function(e,r,a,n){return e.state===If&&(e.state=r,e[a]=n,Bf(e)),e},Bf=function(e){e.state===Of?lu(e,"onFulfilled",e.fulfillValue):e.state===Nf&&lu(e,"onRejected",e.rejectReason)},lu=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var s=0;s<n.length;s++)n[s](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},fu=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(o){r.reject(o);return}kf(r,i)}}},kf=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(at(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):kf(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};kt.all=function(t){return new kt(function(e,r){for(var a=new Array(t.length),n=0,i=function(u,l){a[u]=l,n++,n===t.length&&e(a)},o=0;o<t.length;o++)(function(s){var u=t[s],l=u!=null&&u.then!=null;if(l)u.then(function(v){i(s,v)},function(v){r(v)});else{var f=u;i(s,f)}})(o)})};kt.resolve=function(t){return new kt(function(e,r){e(t)})};kt.reject=function(t){return new kt(function(e,r){r(t)})};var ra=typeof Promise<"u"?Promise:kt,Go=function(e,r,a){var n=jo(e),i=!n,o=this._private=pe({duration:1e3},r,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&He(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(n){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},Lr=Go.prototype;pe(Lr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),At(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(l,f){var v=e[l];v!=null&&(e[l]=e[f],e[f]=v)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[n]=s}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new ra(function(n,i){a.push(function(){n()})})}});Lr.complete=Lr.completed;Lr.run=Lr.play;Lr.running=Lr.playing;var Bd={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=n[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<n.length;o++){var s=n[o];s._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var f=s.style();r=pe({},r,a);var v=Object.keys(r).length===0;if(v)return new Go(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(l&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),l&&r.renderedPosition!=null){var c=r.renderedPosition,h=s.pan(),d=s.zoom();r.position=xf(c,d,h)}if(u&&r.panBy!=null){var p=r.panBy,g=s.pan();r.pan={x:g.x+p.x,y:g.y+p.y}}var y=r.center||r.centre;if(u&&y!=null){var m=s.getCenterPan(y.eles,r.zoom);m!=null&&(r.pan=m)}if(u&&r.fit!=null){var b=r.fit,E=s.getFitViewport(b.eles||b.boundingBox,b.padding);E!=null&&(r.pan=E.pan,r.zoom=E.zoom)}if(u&&Pe(r.zoom)){var C=s.getZoomedViewport(r.zoom);C!=null?(C.zoomed&&(r.zoom=C.zoom),C.panned&&(r.pan=C.pan)):r.zoom=null}return new Go(o[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;a&&(r=pe({},r,a));for(var u=0;u<o.length;u++){var l=o[u],f=l.animated()&&(r.queue===void 0||r.queue),v=l.animation(r,f?{queue:!0}:void 0);v.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var l=o[u],f=l._private,v=f.animation.current,c=0;c<v.length;c++){var h=v[c],d=h._private;a&&(d.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return s.notify("draw"),this}}},Ei,vu;function _n(){if(vu)return Ei;vu=1;var t=Array.isArray;return Ei=t,Ei}var xi,cu;function kd(){if(cu)return xi;cu=1;var t=_n(),e=Fa(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,o){if(t(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:a.test(i)||!r.test(i)||o!=null&&i in Object(o)}return xi=n,xi}var Ti,hu;function Fd(){if(hu)return Ti;hu=1;var t=hf(),e=ka(),r="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=t(s);return u==a||u==n||u==r||u==i}return Ti=o,Ti}var Ci,du;function Gd(){if(du)return Ci;du=1;var t=kn(),e=t["__core-js_shared__"];return Ci=e,Ci}var Di,gu;function zd(){if(gu)return Di;gu=1;var t=Gd(),e=function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}();function r(a){return!!e&&e in a}return Di=r,Di}var Si,pu;function _d(){if(pu)return Si;pu=1;var t=Function.prototype,e=t.toString;function r(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return Si=r,Si}var Ai,yu;function Vd(){if(yu)return Ai;yu=1;var t=Fd(),e=zd(),r=ka(),a=_d(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,f=RegExp("^"+u.call(l).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v(c){if(!r(c)||e(c))return!1;var h=t(c)?f:i;return h.test(a(c))}return Ai=v,Ai}var Li,mu;function Ud(){if(mu)return Li;mu=1;function t(e,r){return e==null?void 0:e[r]}return Li=t,Li}var Ri,bu;function fs(){if(bu)return Ri;bu=1;var t=Vd(),e=Ud();function r(a,n){var i=e(a,n);return t(i)?i:void 0}return Ri=r,Ri}var Mi,wu;function Vn(){if(wu)return Mi;wu=1;var t=fs(),e=t(Object,"create");return Mi=e,Mi}var Pi,Eu;function qd(){if(Eu)return Pi;Eu=1;var t=Vn();function e(){this.__data__=t?t(null):{},this.size=0}return Pi=e,Pi}var Ii,xu;function Yd(){if(xu)return Ii;xu=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return Ii=t,Ii}var Oi,Tu;function Hd(){if(Tu)return Oi;Tu=1;var t=Vn(),e="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function n(i){var o=this.__data__;if(t){var s=o[i];return s===e?void 0:s}return a.call(o,i)?o[i]:void 0}return Oi=n,Oi}var Ni,Cu;function Xd(){if(Cu)return Ni;Cu=1;var t=Vn(),e=Object.prototype,r=e.hasOwnProperty;function a(n){var i=this.__data__;return t?i[n]!==void 0:r.call(i,n)}return Ni=a,Ni}var Bi,Du;function Wd(){if(Du)return Bi;Du=1;var t=Vn(),e="__lodash_hash_undefined__";function r(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=t&&n===void 0?e:n,this}return Bi=r,Bi}var ki,Su;function $d(){if(Su)return ki;Su=1;var t=qd(),e=Yd(),r=Hd(),a=Xd(),n=Wd();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,ki=i,ki}var Fi,Au;function Kd(){if(Au)return Fi;Au=1;function t(){this.__data__=[],this.size=0}return Fi=t,Fi}var Gi,Lu;function Ff(){if(Lu)return Gi;Lu=1;function t(e,r){return e===r||e!==e&&r!==r}return Gi=t,Gi}var zi,Ru;function Un(){if(Ru)return zi;Ru=1;var t=Ff();function e(r,a){for(var n=r.length;n--;)if(t(r[n][0],a))return n;return-1}return zi=e,zi}var _i,Mu;function Zd(){if(Mu)return _i;Mu=1;var t=Un(),e=Array.prototype,r=e.splice;function a(n){var i=this.__data__,o=t(i,n);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():r.call(i,o,1),--this.size,!0}return _i=a,_i}var Vi,Pu;function Qd(){if(Pu)return Vi;Pu=1;var t=Un();function e(r){var a=this.__data__,n=t(a,r);return n<0?void 0:a[n][1]}return Vi=e,Vi}var Ui,Iu;function Jd(){if(Iu)return Ui;Iu=1;var t=Un();function e(r){return t(this.__data__,r)>-1}return Ui=e,Ui}var qi,Ou;function jd(){if(Ou)return qi;Ou=1;var t=Un();function e(r,a){var n=this.__data__,i=t(n,r);return i<0?(++this.size,n.push([r,a])):n[i][1]=a,this}return qi=e,qi}var Yi,Nu;function eg(){if(Nu)return Yi;Nu=1;var t=Kd(),e=Zd(),r=Qd(),a=Jd(),n=jd();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Yi=i,Yi}var Hi,Bu;function tg(){if(Bu)return Hi;Bu=1;var t=fs(),e=kn(),r=t(e,"Map");return Hi=r,Hi}var Xi,ku;function rg(){if(ku)return Xi;ku=1;var t=$d(),e=eg(),r=tg();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Xi=a,Xi}var Wi,Fu;function ag(){if(Fu)return Wi;Fu=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Wi=t,Wi}var $i,Gu;function qn(){if(Gu)return $i;Gu=1;var t=ag();function e(r,a){var n=r.__data__;return t(a)?n[typeof a=="string"?"string":"hash"]:n.map}return $i=e,$i}var Ki,zu;function ng(){if(zu)return Ki;zu=1;var t=qn();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return Ki=e,Ki}var Zi,_u;function ig(){if(_u)return Zi;_u=1;var t=qn();function e(r){return t(this,r).get(r)}return Zi=e,Zi}var Qi,Vu;function og(){if(Vu)return Qi;Vu=1;var t=qn();function e(r){return t(this,r).has(r)}return Qi=e,Qi}var Ji,Uu;function sg(){if(Uu)return Ji;Uu=1;var t=qn();function e(r,a){var n=t(this,r),i=n.size;return n.set(r,a),this.size+=n.size==i?0:1,this}return Ji=e,Ji}var ji,qu;function ug(){if(qu)return ji;qu=1;var t=rg(),e=ng(),r=ig(),a=og(),n=sg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,ji=i,ji}var eo,Yu;function lg(){if(Yu)return eo;Yu=1;var t=ug(),e="Expected a function";function r(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=function(){var o=arguments,s=n?n.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=a.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(r.Cache||t),i}return r.Cache=t,eo=r,eo}var to,Hu;function fg(){if(Hu)return to;Hu=1;var t=lg(),e=500;function r(a){var n=t(a,function(o){return i.size===e&&i.clear(),o}),i=n.cache;return n}return to=r,to}var ro,Xu;function Gf(){if(Xu)return ro;Xu=1;var t=fg(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=t(function(n){var i=[];return n.charCodeAt(0)===46&&i.push(""),n.replace(e,function(o,s,u,l){i.push(u?l.replace(r,"$1"):s||o)}),i});return ro=a,ro}var ao,Wu;function zf(){if(Wu)return ao;Wu=1;function t(e,r){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=r(e[a],a,e);return i}return ao=t,ao}var no,$u;function vg(){if($u)return no;$u=1;var t=ts(),e=zf(),r=_n(),a=Fa(),n=t?t.prototype:void 0,i=n?n.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return e(s,o)+"";if(a(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return no=o,no}var io,Ku;function _f(){if(Ku)return io;Ku=1;var t=vg();function e(r){return r==null?"":t(r)}return io=e,io}var oo,Zu;function Vf(){if(Zu)return oo;Zu=1;var t=_n(),e=kd(),r=Gf(),a=_f();function n(i,o){return t(i)?i:e(i,o)?[i]:r(a(i))}return oo=n,oo}var so,Qu;function vs(){if(Qu)return so;Qu=1;var t=Fa();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return so=e,so}var uo,Ju;function cg(){if(Ju)return uo;Ju=1;var t=Vf(),e=vs();function r(a,n){n=t(n,a);for(var i=0,o=n.length;a!=null&&i<o;)a=a[e(n[i++])];return i&&i==o?a:void 0}return uo=r,uo}var lo,ju;function hg(){if(ju)return lo;ju=1;var t=cg();function e(r,a,n){var i=r==null?void 0:t(r,a);return i===void 0?n:i}return lo=e,lo}var dg=hg(),gg=Ba(dg),fo,el;function pg(){if(el)return fo;el=1;var t=fs(),e=function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}}();return fo=e,fo}var vo,tl;function yg(){if(tl)return vo;tl=1;var t=pg();function e(r,a,n){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):r[a]=n}return vo=e,vo}var co,rl;function mg(){if(rl)return co;rl=1;var t=yg(),e=Ff(),r=Object.prototype,a=r.hasOwnProperty;function n(i,o,s){var u=i[o];(!(a.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&t(i,o,s)}return co=n,co}var ho,al;function bg(){if(al)return ho;al=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,n){var i=typeof a;return n=n??t,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return ho=r,ho}var go,nl;function wg(){if(nl)return go;nl=1;var t=mg(),e=Vf(),r=bg(),a=ka(),n=vs();function i(o,s,u,l){if(!a(o))return o;s=e(s,o);for(var f=-1,v=s.length,c=v-1,h=o;h!=null&&++f<v;){var d=n(s[f]),p=u;if(d==="__proto__"||d==="constructor"||d==="prototype")return o;if(f!=c){var g=h[d];p=l?l(g,d,h):void 0,p===void 0&&(p=a(g)?g:r(s[f+1])?[]:{})}t(h,d,p),h=h[d]}return o}return go=i,go}var po,il;function Eg(){if(il)return po;il=1;var t=wg();function e(r,a,n){return r==null?r:t(r,a,n)}return po=e,po}var xg=Eg(),Tg=Ba(xg),yo,ol;function Cg(){if(ol)return yo;ol=1;function t(e,r){var a=-1,n=e.length;for(r||(r=Array(n));++a<n;)r[a]=e[a];return r}return yo=t,yo}var mo,sl;function Dg(){if(sl)return mo;sl=1;var t=zf(),e=Cg(),r=_n(),a=Fa(),n=Gf(),i=vs(),o=_f();function s(u){return r(u)?t(u,i):a(u)?[u]:e(n(o(u)))}return mo=s,mo}var Sg=Dg(),Ag=Ba(Sg),Lg={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=pe({},r,e),function(n,i){var o=e,s=this,u=s.length!==void 0,l=u?s:[s],f=u?s[0]:s;if(he(n)){var v=n.indexOf(".")!==-1,c=v&&Ag(n);if(o.allowGetting&&i===void 0){var h;return f&&(o.beforeGet(f),c&&f._private[o.field][n]===void 0?h=gg(f._private[o.field],c):h=f._private[o.field][n]),h}else if(o.allowSetting&&i!==void 0){var d=!o.immutableKeys[n];if(d){var p=rf({},n,i);o.beforeSet(s,p);for(var g=0,y=l.length;g<y;g++){var m=l[g];o.canSet(m)&&(c&&f._private[o.field][n]===void 0?Tg(m._private[o.field],c,i):m._private[o.field][n]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&Pe(n)){var b=n,E,C,A=Object.keys(b);o.beforeSet(s,b);for(var w=0;w<A.length;w++){E=A[w],C=b[E];var x=!o.immutableKeys[E];if(x)for(var T=0;T<l.length;T++){var D=l[T];o.canSet(D)&&(D._private[o.field][E]=C)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&He(n)){var S=n;s.on(o.bindingEvent,S)}else if(o.allowGetting&&n===void 0){var R;return f&&(o.beforeGet(f),R=f._private[o.field]),R}return s}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=pe({},r,e),function(n){var i=e,o=this,s=o.length!==void 0,u=s?o:[o];if(he(n)){for(var l=n.split(/\s+/),f=l.length,v=0;v<f;v++){var c=l[v];if(!sr(c)){var h=!i.immutableKeys[c];if(h)for(var d=0,p=u.length;d<p;d++)u[d]._private[i.field][c]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(n===void 0){for(var g=0,y=u.length;g<y;g++)for(var m=u[g]._private[i.field],b=Object.keys(m),E=0;E<b.length;E++){var C=b[E],A=!i.immutableKeys[C];A&&(m[C]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},Rg={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,o=Array.prototype.slice.call(arguments,0);return new ra(function(s,u){var l=function(h){i.off.apply(i,v),s(h)},f=o.concat([l]),v=f.concat([]);i.on.apply(i,f)})}}},Oe={};[Bd,Lg,Rg].forEach(function(t){pe(Oe,t)});var Mg={animate:Oe.animate(),animation:Oe.animation(),animated:Oe.animated(),clearQueue:Oe.clearQueue(),delay:Oe.delay(),delayAnimation:Oe.delayAnimation(),stop:Oe.stop()},fn={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(d){return a.push(d)}),a}else Fe(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new ta(e),o=0;o<r.length;o++){for(var s=r[o],u=s._private,l=u.classes,f=!1,v=0;v<e.length;v++){var c=e[v],h=l.has(c);if(!h){f=!0;break}}f||(f=l.size!==e.length),f&&(u.classes=i,n.push(s))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){Fe(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],o=0,s=a.length;o<s;o++)for(var u=a[o],l=u._private.classes,f=!1,v=0;v<e.length;v++){var c=e[v],h=l.has(c),d=!1;r||n&&!h?(l.add(c),d=!0):(!r||n&&h)&&(l.delete(c),d=!0),!f&&d&&(i.push(u),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};fn.className=fn.classNames=fn.classes;var Me={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:rt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Me.variable="(?:[\\w-.]|(?:\\\\"+Me.metaChar+"))+";Me.className="(?:[\\w-]|(?:\\\\"+Me.metaChar+"))+";Me.value=Me.string+"|"+Me.number;Me.id=Me.variable;(function(){var t,e,r;for(t=Me.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Me.comparatorOp+="|@"+e;for(t=Me.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Me.comparatorOp+="|\\!"+e)})();var ke=function(){return{checks:[]}},ie={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},zo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return Lc(t.selector,e.selector)}),Pg=function(){for(var t={},e,r=0;r<zo.length;r++)e=zo[r],t[e.selector]=e.matches;return t}(),Ig=function(e,r){return Pg[e](r)},Og="("+zo.map(function(t){return t.selector}).join("|")+")",Nr=function(e){return e.replace(new RegExp("\\\\("+Me.metaChar+")","g"),function(r,a){return a})},tr=function(e,r,a){e[e.length-1]=a},_o=[{name:"group",query:!0,regex:"("+Me.group+")",populate:function(e,r,a){var n=tt(a,1),i=n[0];r.checks.push({type:ie.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Og,populate:function(e,r,a){var n=tt(a,1),i=n[0];r.checks.push({type:ie.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Me.id+")",populate:function(e,r,a){var n=tt(a,1),i=n[0];r.checks.push({type:ie.ID,value:Nr(i)})}},{name:"className",query:!0,regex:"\\.("+Me.className+")",populate:function(e,r,a){var n=tt(a,1),i=n[0];r.checks.push({type:ie.CLASS,value:Nr(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Me.variable+")\\s*\\]",populate:function(e,r,a){var n=tt(a,1),i=n[0];r.checks.push({type:ie.DATA_EXIST,field:Nr(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Me.variable+")\\s*("+Me.comparatorOp+")\\s*("+Me.value+")\\s*\\]",populate:function(e,r,a){var n=tt(a,3),i=n[0],o=n[1],s=n[2],u=new RegExp("^"+Me.string+"$").exec(s)!=null;u?s=s.substring(1,s.length-1):s=parseFloat(s),r.checks.push({type:ie.DATA_COMPARE,field:Nr(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Me.boolOp+")\\s*("+Me.variable+")\\s*\\]",populate:function(e,r,a){var n=tt(a,2),i=n[0],o=n[1];r.checks.push({type:ie.DATA_BOOL,field:Nr(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Me.meta+")\\s*("+Me.comparatorOp+")\\s*("+Me.number+")\\s*\\]\\]",populate:function(e,r,a){var n=tt(a,3),i=n[0],o=n[1],s=n[2];r.checks.push({type:ie.META_COMPARE,field:Nr(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:Me.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=n,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=ke();return s}},{name:"directedEdge",separator:!0,regex:Me.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=ke(),n=r,i=ke();return a.checks.push({type:ie.DIRECTED_EDGE,source:n,target:i}),tr(e,r,a),e.edgeCount++,i}else{var o=ke(),s=r,u=ke();return o.checks.push({type:ie.NODE_SOURCE,source:s,target:u}),tr(e,r,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Me.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=ke(),n=r,i=ke();return a.checks.push({type:ie.UNDIRECTED_EDGE,nodes:[n,i]}),tr(e,r,a),e.edgeCount++,i}else{var o=ke(),s=r,u=ke();return o.checks.push({type:ie.NODE_NEIGHBOR,node:s,neighbor:u}),tr(e,r,o),u}}},{name:"child",separator:!0,regex:Me.child,populate:function(e,r){if(e.currentSubject==null){var a=ke(),n=ke(),i=e[e.length-1];return a.checks.push({type:ie.CHILD,parent:i,child:n}),tr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=ke(),s=e[e.length-1],u=ke(),l=ke(),f=ke(),v=ke();return o.checks.push({type:ie.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:ie.TRUE}],v.checks.push({type:ie.TRUE}),u.checks.push({type:ie.PARENT,parent:v,child:f}),tr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var c=ke(),h=ke(),d=[{type:ie.PARENT,parent:c,child:h}];return c.checks=r.checks,r.checks=d,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:Me.descendant,populate:function(e,r){if(e.currentSubject==null){var a=ke(),n=ke(),i=e[e.length-1];return a.checks.push({type:ie.DESCENDANT,ancestor:i,descendant:n}),tr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=ke(),s=e[e.length-1],u=ke(),l=ke(),f=ke(),v=ke();return o.checks.push({type:ie.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:ie.TRUE}],v.checks.push({type:ie.TRUE}),u.checks.push({type:ie.ANCESTOR,ancestor:v,descendant:f}),tr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var c=ke(),h=ke(),d=[{type:ie.ANCESTOR,ancestor:c,descendant:h}];return c.checks=r.checks,r.checks=d,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:Me.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Ne("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===ie.DIRECTED_EDGE?n.type=ie.NODE_TARGET:i===ie.UNDIRECTED_EDGE&&(n.type=ie.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];_o.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var Ng=function(e){for(var r,a,n,i=0;i<_o.length;i++){var o=_o[i],s=o.name,u=e.match(o.regexObj);if(u!=null){a=u,r=o,n=s;var l=u[0];e=e.substring(l.length);break}}return{expr:r,match:a,name:n,remaining:e}},Bg=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},kg=function(e){var r=this,a=r.inputText=e,n=r[0]=ke();for(r.length=1,a=Bg(a);;){var i=Ng(a);if(i.expr==null)return Ne("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(r,n,o);if(s===!1)return!1;if(s!=null&&(n=s),a=i.remaining,a.match(/^\s*$/))break}var u=r[r.length-1];r.currentSubject!=null&&(u.subject=r.currentSubject),u.edgeCount=r.edgeCount,u.compoundCount=r.compoundCount;for(var l=0;l<r.length;l++){var f=r[l];if(f.compoundCount>0&&f.edgeCount>0)return Ne("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Ne("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Ne("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Fg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return he(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,v){var c=f.type,h=f.value;switch(c){case ie.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case ie.DATA_COMPARE:{var p=f.field,g=f.operator;return"["+p+a(e(g))+r(h)+"]"}case ie.DATA_BOOL:{var y=f.operator,m=f.field;return"["+e(y)+m+"]"}case ie.DATA_EXIST:{var b=f.field;return"["+b+"]"}case ie.META_COMPARE:{var E=f.operator,C=f.field;return"[["+C+a(e(E))+r(h)+"]]"}case ie.STATE:return h;case ie.ID:return"#"+h;case ie.CLASS:return"."+h;case ie.PARENT:case ie.CHILD:return i(f.parent,v)+a(">")+i(f.child,v);case ie.ANCESTOR:case ie.DESCENDANT:return i(f.ancestor,v)+" "+i(f.descendant,v);case ie.COMPOUND_SPLIT:{var A=i(f.left,v),w=i(f.subject,v),x=i(f.right,v);return A+(A.length>0?" ":"")+w+x}case ie.TRUE:return""}},i=function(f,v){return f.checks.reduce(function(c,h,d){return c+(v===f&&d===0?"$":"")+n(h,v)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},Gg={parse:kg,toString:Fg},Uf=function(e,r,a){var n,i=he(e),o=ae(e),s=he(a),u,l,f=!1,v=!1,c=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),v=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||s||f)&&(u=!i&&!o?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),r){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return v&&(e!=null||!c)&&(n=!n),n},zg=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},_g=function(e){return e!==void 0},cs=function(e,r){return e.data(r)},Vg=function(e,r){return e[r]()},We=[],Ue=function(e,r){return e.checks.every(function(a){return We[a.type](a,r)})};We[ie.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};We[ie.STATE]=function(t,e){var r=t.value;return Ig(r,e)};We[ie.ID]=function(t,e){var r=t.value;return e.id()===r};We[ie.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};We[ie.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Uf(Vg(e,r),a,n)};We[ie.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Uf(cs(e,r),a,n)};We[ie.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return zg(cs(e,r),a)};We[ie.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,_g(cs(e,r))};We[ie.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return Ue(r,n)&&Ue(a,i)||Ue(a,n)&&Ue(r,i)};We[ie.NODE_NEIGHBOR]=function(t,e){return Ue(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Ue(t.neighbor,r)})};We[ie.DIRECTED_EDGE]=function(t,e){return Ue(t.source,e.source())&&Ue(t.target,e.target())};We[ie.NODE_SOURCE]=function(t,e){return Ue(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Ue(t.target,r)})};We[ie.NODE_TARGET]=function(t,e){return Ue(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Ue(t.source,r)})};We[ie.CHILD]=function(t,e){return Ue(t.child,e)&&Ue(t.parent,e.parent())};We[ie.PARENT]=function(t,e){return Ue(t.parent,e)&&e.children().some(function(r){return Ue(t.child,r)})};We[ie.DESCENDANT]=function(t,e){return Ue(t.descendant,e)&&e.ancestors().some(function(r){return Ue(t.ancestor,r)})};We[ie.ANCESTOR]=function(t,e){return Ue(t.ancestor,e)&&e.descendants().some(function(r){return Ue(t.descendant,r)})};We[ie.COMPOUND_SPLIT]=function(t,e){return Ue(t.subject,e)&&Ue(t.left,e)&&Ue(t.right,e)};We[ie.TRUE]=function(){return!0};We[ie.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};We[ie.FILTER]=function(t,e){var r=t.value;return r(e)};var Ug=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===ie.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var o=0;o<r.length;o++){var s=r[o];if(Ue(s,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},qg=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(Ue(n,e))return!0}return!1},Yg={matches:qg,filter:Ug},fr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||he(e)&&e.match(/^\s*$/)||(At(e)?this.addQuery({checks:[{type:ie.COLLECTION,value:e.collection()}]}):He(e)?this.addQuery({checks:[{type:ie.FILTER,value:e}]}):he(e)?this.parse(e)||(this.invalid=!0):Ye("A selector must be created from a string; found "))},vr=fr.prototype;[Gg,Yg].forEach(function(t){return pe(vr,t)});vr.text=function(){return this.inputText};vr.size=function(){return this.length};vr.eq=function(t){return this[t]};vr.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};vr.addQuery=function(t){this[this.length++]=t};vr.selector=vr.toString;var ir={allAre:function(e){var r=new fr(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new fr(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};ir.allAreNeighbours=ir.allAreNeighbors;ir.has=ir.contains;ir.equal=ir.equals=ir.same;var Pt=function(e,r){return function(n,i,o,s){var u=n,l=this,f;if(u==null?f="":At(u)&&u.length===1&&(f=u.id()),l.length===1&&f){var v=l[0]._private,c=v.traversalCache=v.traversalCache||{},h=c[r]=c[r]||[],d=Sr(f),p=h[d];return p||(h[d]=e.call(l,n,i,o,s))}else return e.call(l,n,i,o,s)}},jr={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],o=i._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a],i=n.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Pt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(n){for(var i=0;i<n.length;i++){var o=n[i];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function hs(t,e,r,a){for(var n=[],i=new ta,o=t.cy(),s=o.hasCompoundNodes(),u=0;u<t.length;u++){var l=t[u];r?n.push(l):s&&a(n,i,l)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),s&&a(n,i,f)}return t}function qf(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}jr.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return hs(this,t,e,qf)};function Yf(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}jr.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return hs(this,t,e,Yf)};function Hg(t,e,r){Yf(t,e,r),qf(t,e,r)}jr.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return hs(this,t,e,Hg)};jr.ancestors=jr.parents;var La,Hf;La=Hf={data:Oe.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Oe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Oe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Oe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Oe.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Oe.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};La.attr=La.data;La.removeAttr=La.removeData;var Xg=Hf,Yn={};function bo(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(a+=t(n,s))}return a}else return}}pe(Yn,{degree:bo(function(t,e){return e.source().same(e.target())?2:1}),indegree:bo(function(t,e){return e.target().same(t)?1:0}),outdegree:bo(function(t,e){return e.source().same(t)?1:0})});function Br(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i],s=o[t](r);s!==void 0&&(a===void 0||e(s,a))&&(a=s)}return a}}pe(Yn,{minDegree:Br("degree",function(t,e){return t<e}),maxDegree:Br("degree",function(t,e){return t>e}),minIndegree:Br("indegree",function(t,e){return t<e}),maxIndegree:Br("indegree",function(t,e){return t>e}),minOutdegree:Br("outdegree",function(t,e){return t<e}),maxOutdegree:Br("outdegree",function(t,e){return t>e})});pe(Yn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Bt,Xf,Wf=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var o=i._private.position,s={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,a),i.dirtyBoundingBoxCache()}}},ul={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){Wf(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Bt=Xf={position:Oe.data(ul),silentPosition:Oe.data(pe({},ul,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){Wf(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Pe(e))r?this.silentPosition(e):this.position(e);else if(He(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=a(o,i))&&(r?o.silentPosition(s):o.position(s))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(Pe(e)?(n={x:ae(e.x)?e.x:0,y:ae(e.y)?e.y:0},a=r):he(e)&&ae(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var u=s.position(),l={x:u.x+n.x,y:u.y+n.y};a?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,r){return Pe(e)?this.shift(e,!0):he(e)&&ae(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),o=n.pan(),s=Pe(e)?e:void 0,u=s!==void 0||r!==void 0&&he(e);if(a&&a.isNode())if(u)for(var l=0;l<this.length;l++){var f=this[l];r!==void 0?f.position(e,(r-o[e])/i):s!==void 0&&f.position(xf(s,i,o))}else{var v=a.position();return s=Gn(v,i,o),e===void 0?s:s[e]}else if(!u)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=Pe(e)?e:void 0,o=i!==void 0||r!==void 0&&he(e),s=n.hasCompoundNodes();if(a&&a.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],f=s?l.parent():null,v=f&&f.length>0,c=v;v&&(f=f[0]);var h=c?f.position():{x:0,y:0};r!==void 0?l.position(e,r+h[e]):i!==void 0&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),p=s?a.parent():null,g=p&&p.length>0,y=g;g&&(p=p[0]);var m=y?p.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!o)return;return this}};Bt.modelPosition=Bt.point=Bt.position;Bt.modelPositions=Bt.points=Bt.positions;Bt.renderedPoint=Bt.renderedPosition;Bt.relativePoint=Bt.relativePosition;var Wg=Xf,Kr,gr;Kr=gr={};gr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}};gr.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};gr.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},v=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=s.position;(v.w===0||v.h===0)&&(v={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},v.x1=c.x-v.w/2,v.x2=c.x+v.w/2,v.y1=c.y-v.h/2,v.y2=c.y+v.h/2);function h(T,D,S){var R=0,L=0,M=D+S;return T>0&&M>0&&(R=D/M*T,L=S/M*T),{biasDiff:R,biasComplementDiff:L}}function d(T,D,S,R){if(S.units==="%")switch(R){case"width":return T>0?S.pfValue*T:0;case"height":return D>0?S.pfValue*D:0;case"average":return T>0&&D>0?S.pfValue*(T+D)/2:0;case"min":return T>0&&D>0?T>D?S.pfValue*D:S.pfValue*T:0;case"max":return T>0&&D>0?T>D?S.pfValue*T:S.pfValue*D:0;default:return 0}else return S.units==="px"?S.pfValue:0}var p=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var g=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var y=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(y=y*100/f.height.val);var m=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(m=m*100/f.height.val);var b=h(f.width.val-v.w,p,g),E=b.biasDiff,C=b.biasComplementDiff,A=h(f.height.val-v.h,y,m),w=A.biasDiff,x=A.biasComplementDiff;s.autoPadding=d(v.w,v.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(v.w,f.width.val),c.x=(-E+v.x1+v.x2+C)/2,s.autoHeight=Math.max(v.h,f.height.val),c.y=(-w+v.y1+v.y2+x)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var Mt=function(e){return e===1/0||e===-1/0?0:e},Nt=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},rr=function(e,r){return r==null?e:Nt(e,r.x1,r.y1,r.x2,r.y2)},va=function(e,r,a){return Ct(e,r,a)},ja=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,o=i.arrowWidth/2,s=r.pstyle(a+"-arrow-shape").value,u,l;if(s!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},v=f[a]=f[a]||{};v.x1=u-o,v.y1=l-o,v.x2=u+o,v.y2=l+o,v.w=v.x2-v.x1,v.h=v.y2-v.y1,un(v,1),Nt(e,v.x1,v.y1,v.x2,v.y2)}}},wo=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,o=i.rstyle,s=r.pstyle(n+"label").strValue;if(s){var u=r.pstyle("text-halign"),l=r.pstyle("text-valign"),f=va(o,"labelWidth",a),v=va(o,"labelHeight",a),c=va(o,"labelX",a),h=va(o,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,p=r.pstyle(n+"text-margin-y").pfValue,g=r.isEdge(),y=r.pstyle(n+"text-rotation"),m=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,E=b/2,C=r.pstyle("text-background-padding").pfValue,A=2,w=v,x=f,T=x/2,D=w/2,S,R,L,M;if(g)S=c-T,R=c+T,L=h-D,M=h+D;else{switch(u.value){case"left":S=c-x,R=c;break;case"center":S=c-T,R=c+T;break;case"right":S=c,R=c+x;break}switch(l.value){case"top":L=h-w,M=h;break;case"center":L=h-D,M=h+D;break;case"bottom":L=h,M=h+w;break}}var I=d-Math.max(m,E)-C-A,N=d+Math.max(m,E)+C+A,B=p-Math.max(m,E)-C-A,O=p+Math.max(m,E)+C+A;S+=I,R+=N,L+=B,M+=O;var F=a||"main",G=i.labelBounds,k=G[F]=G[F]||{};k.x1=S,k.y1=L,k.x2=R,k.y2=M,k.w=R-S,k.h=M-L,k.leftPad=I,k.rightPad=N,k.topPad=B,k.botPad=O;var z=g&&y.strValue==="autorotate",U=y.pfValue!=null&&y.pfValue!==0;if(z||U){var H=z?va(i.rstyle,"labelAngle",a):y.pfValue,$=Math.cos(H),K=Math.sin(H),j=(S+R)/2,re=(L+M)/2;if(!g){switch(u.value){case"left":j=R;break;case"right":j=S;break}switch(l.value){case"top":re=M;break;case"bottom":re=L;break}}var Q=function(Le,se){return Le=Le-j,se=se-re,{x:Le*$-se*K+j,y:Le*K+se*$+re}},_=Q(S,L),q=Q(S,M),Y=Q(R,L),ee=Q(R,M);S=Math.min(_.x,q.x,Y.x,ee.x),R=Math.max(_.x,q.x,Y.x,ee.x),L=Math.min(_.y,q.y,Y.y,ee.y),M=Math.max(_.y,q.y,Y.y,ee.y)}var ne=F+"Rot",be=G[ne]=G[ne]||{};be.x1=S,be.y1=L,be.x2=R,be.y2=M,be.w=R-S,be.h=M-L,Nt(e,S,L,R,M),Nt(i.labelBounds.all,S,L,R,M)}return e}},ll=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value,i=r.pstyle("outline-offset").value,o=n+i;$f(e,r,a,o,"outside",o/2)}},$f=function(e,r,a,n,i,o){if(!(a===0||n<=0||i==="inside")){var s=r.cy(),u=r.pstyle("shape").value,l=s.renderer().nodeShapes[u],f=r.position(),v=f.x,c=f.y,h=r.width(),d=r.height();if(l.hasMiterBounds){i==="center"&&(n/=2);var p=l.miterBounds(v,c,h,d,n);rr(e,p)}else o!=null&&o>0&&ln(e,[o,o,o,o])}},$g=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,n=r.pstyle("border-width").pfValue,i=r.pstyle("border-position").value;$f(e,r,a,n,i)}},Kg=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=wt(),s=e._private,u=e.isNode(),l=e.isEdge(),f,v,c,h,d,p,g=s.rstyle,y=u&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(Ge){return Ge.pstyle("display").value!=="none"},b=!n||m(e)&&(!l||m(e.source())&&m(e.target()));if(b){var E=0,C=0;n&&r.includeOverlays&&(E=e.pstyle("overlay-opacity").value,E!==0&&(C=e.pstyle("overlay-padding").value));var A=0,w=0;n&&r.includeUnderlays&&(A=e.pstyle("underlay-opacity").value,A!==0&&(w=e.pstyle("underlay-padding").value));var x=Math.max(C,w),T=0,D=0;if(n&&(T=e.pstyle("width").pfValue,D=T/2),u&&r.includeNodes){var S=e.position();d=S.x,p=S.y;var R=e.outerWidth(),L=R/2,M=e.outerHeight(),I=M/2;f=d-L,v=d+L,c=p-I,h=p+I,Nt(o,f,c,v,h),n&&ll(o,e),n&&r.includeOutlines&&!i&&ll(o,e),n&&$g(o,e)}else if(l&&r.includeEdges)if(n&&!i){var N=e.pstyle("curve-style").strValue;if(f=Math.min(g.srcX,g.midX,g.tgtX),v=Math.max(g.srcX,g.midX,g.tgtX),c=Math.min(g.srcY,g.midY,g.tgtY),h=Math.max(g.srcY,g.midY,g.tgtY),f-=D,v+=D,c-=D,h+=D,Nt(o,f,c,v,h),N==="haystack"){var B=g.haystackPts;if(B&&B.length===2){if(f=B[0].x,c=B[0].y,v=B[1].x,h=B[1].y,f>v){var O=f;f=v,v=O}if(c>h){var F=c;c=h,h=F}Nt(o,f-D,c-D,v+D,h+D)}}else if(N==="bezier"||N==="unbundled-bezier"||ar(N,"segments")||ar(N,"taxi")){var G;switch(N){case"bezier":case"unbundled-bezier":G=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":G=g.linePts;break}if(G!=null)for(var k=0;k<G.length;k++){var z=G[k];f=z.x-D,v=z.x+D,c=z.y-D,h=z.y+D,Nt(o,f,c,v,h)}}}else{var U=e.source(),H=U.position(),$=e.target(),K=$.position();if(f=H.x,v=K.x,c=H.y,h=K.y,f>v){var j=f;f=v,v=j}if(c>h){var re=c;c=h,h=re}f-=D,v+=D,c-=D,h+=D,Nt(o,f,c,v,h)}if(n&&r.includeEdges&&l&&(ja(o,e,"mid-source"),ja(o,e,"mid-target"),ja(o,e,"source"),ja(o,e,"target")),n){var Q=e.pstyle("ghost").value==="yes";if(Q){var _=e.pstyle("ghost-offset-x").pfValue,q=e.pstyle("ghost-offset-y").pfValue;Nt(o,o.x1+_,o.y1+q,o.x2+_,o.y2+q)}}var Y=s.bodyBounds=s.bodyBounds||{};Ks(Y,o),ln(Y,y),un(Y,1),n&&(f=o.x1,v=o.x2,c=o.y1,h=o.y2,Nt(o,f-x,c-x,v+x,h+x));var ee=s.overlayBounds=s.overlayBounds||{};Ks(ee,o),ln(ee,y),un(ee,1);var ne=s.labelBounds=s.labelBounds||{};ne.all!=null?Ah(ne.all):ne.all=wt(),n&&r.includeLabels&&(r.includeMainLabels&&wo(o,e,null),l&&(r.includeSourceLabels&&wo(o,e,"source"),r.includeTargetLabels&&wo(o,e,"target")))}return o.x1=Mt(o.x1),o.y1=Mt(o.y1),o.x2=Mt(o.x2),o.y2=Mt(o.y2),o.w=Mt(o.x2-o.x1),o.h=Mt(o.y2-o.y1),o.w>0&&o.h>0&&b&&(ln(o,y),un(o,1)),o},Kf=function(e){var r=0,a=function(o){return(o?1:0)<<r++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},Zf=function(e){var r=function(s){return Math.round(s)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return qs([r(a.x),r(a.y),r(n.x),r(n.y)])}else{var i=e.position();return qs([r(i.x),r(i.y)])}},fl=function(e,r){var a=e._private,n,i=e.isEdge(),o=r==null?vl:Kf(r),s=o===vl;if(a.bbCache==null?(n=Kg(e,Ra),a.bbCache=n,a.bbCachePosKey=Zf(e)):n=a.bbCache,!s){var u=e.isNode();n=wt(),(r.includeNodes&&u||r.includeEdges&&!u)&&(r.includeOverlays?rr(n,a.overlayBounds):rr(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?rr(n,a.labelBounds.all):(r.includeMainLabels&&rr(n,a.labelBounds.mainRot),r.includeSourceLabels&&rr(n,a.labelBounds.sourceRot),r.includeTargetLabels&&rr(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Ra={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},vl=Kf(Ra),cl=ct(Ra);gr.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=Zr(function(f){var v=f._private;return v.bbCache==null||v.styleDirty||v.bbCachePosKey!==Zf(f)},function(f){return f.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=Ra:t=cl(t),e=fl(this[0],t);else{e=wt(),t=t||Ra;var n=cl(t),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),s&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var u=0;u<i.length;u++){var l=i[u];a(l)&&l.dirtyBoundingBoxCache(),rr(e,fl(l,n))}}return e.x1=Mt(e.x1),e.y1=Mt(e.y1),e.x2=Mt(e.x2),e.y2=Mt(e.y2),e.w=Mt(e.x2-e.x1),e.h=Mt(e.y2-e.y1),e};gr.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};gr.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(l){return l.isParent()}),e=e.not(n)),Pe(t)){var i=t;t=function(){return i}}var o=function(f,v){return f._private.bbAtOldPos=t(f,v)},s=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var u=Sh(this.boundingBox({useCache:!1}));return e.silentPositions(s),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),u};Kr.boundingbox=Kr.bb=Kr.boundingBox;Kr.renderedBoundingbox=Kr.renderedBoundingBox;var Zg=gr,ma,_a;ma=_a={};var Qf=function(e){e.uppercaseName=Ls(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Ls(e.outerName),ma[e.name]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var s=a.pstyle(e.name);switch(s.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return s.pfValue}}else return 1},ma["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){var s=a[e.name](),u=a.pstyle("border-position").value,l;u==="center"?l=a.pstyle("border-width").pfValue:u==="outside"?l=2*a.pstyle("border-width").pfValue:l=0;var f=2*a.padding();return s+l+f}else return 1},ma["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},ma["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};Qf({name:"width"});Qf({name:"height"});_a.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};_a.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};_a.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var Qg=_a,Jg=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},jg=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return Gn(r(e),a.zoom(),a.pan())}},ep=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(o){return Gn(o,i,n)})}},tp=function(e){return e.renderer().getControlPoints(e)},rp=function(e){return e.renderer().getSegmentPoints(e)},ap=function(e){return e.renderer().getSourceEndpoint(e)},np=function(e){return e.renderer().getTargetEndpoint(e)},ip=function(e){return e.renderer().getEdgeMidpoint(e)},hl={controlPoints:{get:tp,mult:!0},segmentPoints:{get:rp,mult:!0},sourceEndpoint:{get:ap},targetEndpoint:{get:np},midpoint:{get:ip}},op=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},sp=Object.keys(hl).reduce(function(t,e){var r=hl[e],a=op(e);return t[e]=function(){return Jg(this,r.get)},r.mult?t[a]=function(){return ep(this,r.get)}:t[a]=function(){return jg(this,r.get)},t},{}),up=pe({},Wg,Zg,Qg,sp);/*!
9
+ Event object based on jQuery events, MIT license
10
+
11
+ https://jquery.org/license/
12
+ https://tldrlegal.com/license/mit-license
13
+ https://github.com/jquery/jquery/blob/master/src/event.js
14
+ */var Jf=function(e,r){this.recycle(e,r)};function ca(){return!1}function en(){return!0}Jf.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ca,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?en:ca):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=en;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=en;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=en,this.stopPropagation()},isDefaultPrevented:ca,isPropagationStopped:ca,isImmediatePropagationStopped:ca};var jf=/^([^.]+)(\.(?:[^.]+))?$/,lp=".*",ev={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},dl=Object.keys(ev),fp={};function Hn(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fp,e=arguments.length>1?arguments[1]:void 0,r=0;r<dl.length;r++){var a=dl[r];this[a]=t[a]||ev[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var cr=Hn.prototype,tv=function(e,r,a,n,i,o,s){He(n)&&(i=n,n=null),s&&(o==null?o=s:o=pe({},o,s));for(var u=Fe(a)?a:a.split(/\s+/),l=0;l<u.length;l++){var f=u[l];if(!sr(f)){var v=f.match(jf);if(v){var c=v[1],h=v[2]?v[2]:null,d=r(e,f,c,h,n,i,o);if(d===!1)break}}}},gl=function(e,r){return e.addEventFields(e.context,r),new Jf(r.type,r)},vp=function(e,r,a){if(yc(a)){r(e,a);return}else if(Pe(a)){r(e,gl(e,a));return}for(var n=Fe(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var o=n[i];if(!sr(o)){var s=o.match(jf);if(s){var u=s[1],l=s[2]?s[2]:null,f=gl(e,{type:u,namespace:l,target:e.context});r(e,f)}}}};cr.on=cr.addListener=function(t,e,r,a,n){return tv(this,function(i,o,s,u,l,f,v){He(f)&&i.listeners.push({event:o,callback:f,type:s,namespace:u,qualifier:l,conf:v})},t,e,r,a,n),this};cr.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};cr.removeListener=cr.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=Zc(this.listeners));for(var i=this.listeners,o=function(l){var f=i[l];tv(n,function(v,c,h,d,p,g){if((f.type===h||t==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!p||v.qualifierCompare(f.qualifier,p))&&(!g||f.callback===g))return i.splice(l,1),!1},t,e,r,a)},s=i.length-1;s>=0;s--)o(s);return this};cr.removeAllListeners=function(){return this.removeListener("*")};cr.emit=cr.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,Fe(e)||(e=[e]),vp(this,function(i,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],n=a.length);for(var s=function(){var f=a[u];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===lp)&&i.eventMatches(i.context,f,o)){var v=[o];e!=null&&Jc(v,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==f}));var c=i.callbackContext(i.context,f,o),h=f.callback.apply(c,v);i.afterEmit(i.context,f,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<n;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},t),this.emitting--,this};var cp={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Na(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},tn=function(e){return he(e)?new fr(e):e},rv={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new Hn(cp,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=tn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=tn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=tn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=tn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Oe.eventAliasesOn(rv);var av={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(he(e)||At(e))return new fr(e).filter(this);if(He(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);s&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){he(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(he(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,o=this.length<e.length,s=o?n:i,u=o?i:n,l=0;l<s.length;l++){var f=s[l];u.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;he(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,o=function(u,l){for(var f=0;f<u.length;f++){var v=u[f],c=v._private.data.id,h=l.hasElementWithId(c);h||a.push(v)}};return o(n,i),o(i,n),a},diff:function(e){var r=this._private.cy;he(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=this,s=e,u=function(f,v,c){for(var h=0;h<f.length;h++){var d=f[h],p=d._private.data.id,g=v.hasElementWithId(p);g?i.merge(d):c.push(d)}};return u(o,s,a),u(s,o,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(he(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&n.push(o)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&he(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id,l=!i.has(u);if(l){var f=this.length++;this[f]=s,i.set(u,{ele:s,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&he(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);a.push(s)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u>a&&(a=u,n=s)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u<a&&(a=u,n=s)}return{value:a,ele:n}}},Ie=av;Ie.u=Ie["|"]=Ie["+"]=Ie.union=Ie.or=Ie.add;Ie["\\"]=Ie["!"]=Ie["-"]=Ie.difference=Ie.relativeComplement=Ie.subtract=Ie.not;Ie.n=Ie["&"]=Ie["."]=Ie.and=Ie.intersection=Ie.intersect;Ie["^"]=Ie["(+)"]=Ie["(-)"]=Ie.symmetricDifference=Ie.symdiff=Ie.xor;Ie.fnFilter=Ie.filterFn=Ie.stdFilter=Ie.filter;Ie.complement=Ie.abscomp=Ie.absoluteComplement;var hp={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},nv=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var v=f.pstyle("z-compound-depth");return v.value==="auto"?n?f.zDepth():0:v.value==="bottom"?-1:v.value==="top"?rs:0}var o=i(e)-i(r);if(o!==0)return o;function s(f){var v=f.pstyle("z-index-compare");return v.value==="auto"&&f.isNode()?1:0}var u=s(e)-s(r);if(u!==0)return u;var l=e.pstyle("z-index").value-r.pstyle("z-index").value;return l!==0?l:e.poolIndex()-r.poolIndex()},Ln={forEach:function(e,r){if(He(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],o=r?e.apply(r,[i,n,this]):e(i,n,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&i<n;i++)a.push(this[i]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!He(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(nv)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:rs-1}else{var i=r.source,o=r.target,s=i.zDepth(),u=o.zDepth();return Math.max(s,u,0)}}}};Ln.each=Ln.forEach;var dp=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":at(Symbol))!=e&&at(Symbol.iterator)!=e;r&&(Ln[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return rf({next:function(){return i<o?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};dp();var gp=ct({nodeDimensionsIncludeLabels:!1}),vn={layoutDimensions:function(e){e=gp(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(C){return!C.isParent()}),i=this.cy(),o=r.eles,s=function(A){return A.id()},u=Zr(a,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(A,w,x){var T={x:w.x1+w.w/2,y:w.y1+w.h/2},D={x:(x.x-T.x)*A,y:(x.y-T.y)*A};return{x:T.x+D.x,y:T.y+D.y}},f=r.spacingFactor&&r.spacingFactor!==1,v=function(){if(!f)return null;for(var A=wt(),w=0;w<n.length;w++){var x=n[w],T=u(x,w);Tf(A,T.x,T.y)}return A},c=v(),h=Zr(function(C,A){var w=u(C,A);if(f){var x=Math.abs(r.spacingFactor);w=l(x,c,w)}return r.transform!=null&&(w=r.transform(C,w)),w},s);if(r.animate){for(var d=0;d<n.length;d++){var p=n[d],g=h(p,d),y=r.animateFilter==null||r.animateFilter(p,d);if(y){var m=p.animation({position:g,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(m)}else p.position(g)}if(r.fit){var b=i.animation({fit:{boundingBox:o.boundingBoxAt(h),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else if(r.zoom!==void 0&&r.pan!==void 0){var E=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(E)}e.animations.forEach(function(C){return C.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),ra.all(e.animations.map(function(C){return C.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(pe({},e,{eles:this}))}};vn.createLayout=vn.makeLayout=vn.layout;function iv(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function Xn(t,e){return t=Sr(t),function(a){return iv(t,e,a)}}function Wn(t,e){t=Sr(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return iv(t,r,n)}}var ft={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Pe(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(he(e))if(r===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];n.removeAllBypasses(s,a)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];n.removeBypasses(l,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var o=n.data.parent?a.parents():null;if(o)for(var s=0;s<o.length;s++){var u=o[s],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function Eo(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function ds(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],o=n.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||Eo(i,a);var u=s.source,l=s.target;return r(u)&&(!o||Eo(u,r))&&(u===l||r(l)&&(!o||Eo(l,r)))}}}var aa=Xn("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});ft.takesUpSpace=Wn("takesUpSpace",ds({ok:aa}));var pp=Xn("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&aa(t)}),yp=Xn("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&aa(t)});ft.interactive=Wn("interactive",ds({ok:pp,parentOk:yp,edgeOkViaNode:aa}));ft.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var mp=Xn("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&aa(t)}),bp=aa;ft.visible=Wn("visible",ds({ok:mp,edgeOkViaNode:bp}));ft.hidden=function(){var t=this[0];if(t)return!t.visible()};ft.isBundledBezier=Wn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ft.bypass=ft.css=ft.style;ft.renderedCss=ft.renderedStyle;ft.removeBypass=ft.removeCss=ft.removeStyle;ft.pstyle=ft.parsedStyle;var or={};function pl(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&He(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&Fe(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!t.ableField||u._private[t.ableField],f=u._private[t.field]!=t.value;if(t.overrideAble){var v=t.overrideAble(u);if(v!==void 0&&(l=v,!v))return this}l&&(u._private[t.field]=t.value,f&&r.push(u))}var c=this.spawn(r);c.updateStyle(),c.emit(t.event),o&&c.emit(o)}return this}}function na(t){or[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},or[t.on]=pl({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),or[t.off]=pl({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}na({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});na({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});na({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});na({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});or.deselect=or.unselect;or.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};na({field:"active",on:"activate",off:"unactivate"});na({field:"pannable",on:"panify",off:"unpanify"});or.inactive=function(){var t=this[0];if(t)return!t._private.active};var gt={},yl=function(e){return function(a){for(var n=this,i=[],o=0;o<n.length;o++){var s=n[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),f=0;f<l.length;f++){var v=l[f],c=v.source(),h=v.target();if(e.noIncomingEdges&&h===s&&c!==s||e.noOutgoingEdges&&c===s&&h!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(a)}},ml=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var o=a[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],f=l.source(),v=l.target();e.outgoing&&f===o?(n.push(l),n.push(v)):e.incoming&&v===o&&(n.push(l),n.push(f))}}return this.spawn(n,!0).filter(r)}},bl=function(e){return function(r){for(var a=this,n=[],i={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],f=l.id();i[f]||(i[f]=!0,n.push(l),s=!0)}if(!s)break;a=o}return this.spawn(n,!0).filter(r)}};gt.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};pe(gt,{roots:yl({noIncomingEdges:!0}),leaves:yl({noOutgoingEdges:!0}),outgoers:Pt(ml({outgoing:!0}),"outgoers"),successors:bl({outgoing:!0}),incomers:Pt(ml({incoming:!0}),"incomers"),predecessors:bl({})});pe(gt,{neighborhood:Pt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),f=n===u?l:u;f.length>0&&e.push(f[0]),e.push(s[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});gt.neighbourhood=gt.neighborhood;gt.closedNeighbourhood=gt.closedNeighborhood;gt.openNeighbourhood=gt.openNeighborhood;pe(gt,{source:Pt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Pt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:wl({attr:"source"}),targets:wl({attr:"target"})});function wl(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],o=i._private[t.attr];o&&a.push(o)}return this.spawn(a,!0).filter(r)}}pe(gt,{edgesWith:Pt(El(),"edgesWith"),edgesTo:Pt(El({thisIsSrc:!0}),"edgesTo")});function El(t){return function(r){var a=[],n=this._private.cy,i=t||{};he(r)&&(r=n.$(r));for(var o=0;o<r.length;o++)for(var s=r[o]._private.edges,u=0;u<s.length;u++){var l=s[u],f=l._private.data,v=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),c=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),h=v||c;h&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!v||i.thisIsTgt&&!c)||a.push(l))}return this.spawn(a,!0)}}pe(gt,{connectedEdges:Pt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Pt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Pt(xl(),"parallelEdges"),codirectedEdges:Pt(xl({codirected:!0}),"codirectedEdges")});function xl(t){var e={codirected:!1};return t=pe({},e,t),function(a){for(var n=[],i=this.edges(),o=t,s=0;s<i.length;s++)for(var u=i[s],l=u._private,f=l.source,v=f._private.data.id,c=l.data.target,h=f._private.edges,d=0;d<h.length;d++){var p=h[d],g=p._private.data,y=g.target,m=g.source,b=y===c&&m===v,E=v===y&&c===m;(o.codirected&&b||!o.codirected&&(b||E))&&n.push(p)}return this.spawn(n,!0).filter(a)}}pe(gt,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(f,v){n.merge(f),i.unmerge(f),v.merge(f)};if(i.empty())return r.spawn();var u=function(){var f=a.collection();o.push(f);var v=i[0];s(v,f),r.bfs({directed:!1,roots:v,visit:function(h){return s(h,f)}}),f.forEach(function(c){c.connectedEdges().forEach(function(h){r.has(h)&&f.has(h.source())&&f.has(h.target())&&f.merge(h)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});gt.componentsOf=gt.components;var vt=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Ye("A collection must have a reference to the core");return}var i=new $t,o=!1;if(!r)r=[];else if(r.length>0&&Pe(r[0])&&!Na(r[0])){o=!0;for(var s=[],u=new ta,l=0,f=r.length;l<f;l++){var v=r[l];v.data==null&&(v.data={});var c=v.data;if(c.id==null)c.id=wf();else if(e.hasElementWithId(c.id)||u.has(c.id))continue;var h=new Fn(e,v,!1);s.push(h),u.add(c.id)}r=s}this.length=0;for(var d=0,p=r.length;d<p;d++){var g=r[d][0];if(g!=null){var y=g._private.data.id;(!a||!i.has(y))&&(a&&i.set(y,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var b=this.lazyMap=new $t,E=this.eles,C=0;C<E.length;C++){var A=E[C];b.set(A.id(),{index:C,ele:A})}}},a&&(this._private.map=i),o&&!n&&this.restore()},Ve=Fn.prototype=vt.prototype=Object.create(Array.prototype);Ve.instanceString=function(){return"collection"};Ve.spawn=function(t,e){return new vt(this.cy(),t,e)};Ve.spawnSelf=function(){return this.spawn(this)};Ve.cy=function(){return this._private.cy};Ve.renderer=function(){return this._private.cy.renderer()};Ve.element=function(){return this[0]};Ve.collection=function(){return of(this)?this:new vt(this._private.cy,[this])};Ve.unique=function(){return new vt(this._private.cy,this,!0)};Ve.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};Ve.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new vt(e)};Ve.$id=Ve.getElementById;Ve.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};Ve.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};Ve.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};Ve.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(Pe(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,o={},s=t.data.source,u=t.data.target;s!=null&&s!=n.source&&(o.source=""+s,i=!0),u!=null&&u!=n.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in t.data,f=t.data.parent;l&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var v=function(p,g,y){var m=t[p];m!=null&&m!==a[p]&&(m?e[g]():e[y]())};return v("removed","remove","restore"),v("selected","select","unselect"),v("selectable","selectify","unselectify"),v("locked","lock","unlock"),v("grabbable","grabify","ungrabify"),v("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var c={data:_t(a.data),position:_t(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var h=0;return a.classes.forEach(function(d){return c.classes+=h++===0?d:" "+d}),c}}};Ve.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};Ve.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new Fn(t,n,!1);e.push(i)}return new vt(t,e)};Ve.copy=Ve.clone;Ve.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],o=[],s,u=0,l=r.length;u<l;u++){var f=r[u];e&&!f.removed()||(f.isNode()?i.push(f):o.push(f))}s=i.concat(o);var v,c=function(){s.splice(v,1),v--};for(v=0;v<s.length;v++){var h=s[v],d=h._private,p=d.data;if(h.clearTraversalCache(),!(!e&&!d.removed)){if(p.id===void 0)p.id=wf();else if(ae(p.id))p.id=""+p.id;else if(sr(p.id)||!he(p.id)){Ye("Can not create element with invalid string ID `"+p.id+"`"),c();continue}else if(a.hasElementWithId(p.id)){Ye("Can not create second element with ID `"+p.id+"`"),c();continue}}var g=p.id;if(h.isNode()){var y=d.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(h.isEdge()){for(var m=h,b=["source","target"],E=b.length,C=!1,A=0;A<E;A++){var w=b[A],x=p[w];ae(x)&&(x=p[w]=""+p[w]),x==null||x===""?(Ye("Can not create edge `"+g+"` with unspecified "+w),C=!0):a.hasElementWithId(x)||(Ye("Can not create edge `"+g+"` with nonexistant "+w+" `"+x+"`"),C=!0)}if(C){c();continue}var T=a.getElementById(p.source),D=a.getElementById(p.target);T.same(D)?T._private.edges.push(m):(T._private.edges.push(m),D._private.edges.push(m)),m._private.source=T,m._private.target=D}d.map=new $t,d.map.set(g,{ele:h,index:0}),d.removed=!1,e&&a.addToPool(h)}for(var S=0;S<i.length;S++){var R=i[S],L=R._private.data;ae(L.parent)&&(L.parent=""+L.parent);var M=L.parent,I=M!=null;if(I||R._private.parent){var N=R._private.parent?a.collection().merge(R._private.parent):a.getElementById(M);if(N.empty())L.parent=void 0;else if(N[0].removed())Ne("Node added with missing parent, reference to parent removed"),L.parent=void 0,R._private.parent=null;else{for(var B=!1,O=N;!O.empty();){if(R.same(O)){B=!0,L.parent=void 0;break}O=O.parent()}B||(N[0]._private.children.push(R),R._private.parent=N[0],n.hasCompoundNodes=!0)}}}if(s.length>0){for(var F=s.length===r.length?r:new vt(a,s),G=0;G<F.length;G++){var k=F[G];k.isNode()||(k.parallelEdges().clearTraversalCache(),k.source().clearTraversalCache(),k.target().clearTraversalCache())}var z;n.hasCompoundNodes?z=a.collection().merge(F).merge(F.connectedNodes()).merge(F.parent()):z=F,z.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?F.emitAndNotify("add"):e&&F.emit("add")}return r};Ve.removed=function(){var t=this[0];return t&&t._private.removed};Ve.inside=function(){var t=this[0];return t&&!t._private.removed};Ve.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function o(M){for(var I=M._private.edges,N=0;N<I.length;N++)u(I[N])}function s(M){for(var I=M._private.children,N=0;N<I.length;N++)u(I[N])}function u(M){var I=n[M.id()];e&&M.removed()||I||(n[M.id()]=!0,M.isNode()?(a.push(M),o(M),s(M)):a.unshift(M))}for(var l=0,f=r.length;l<f;l++){var v=r[l];u(v)}function c(M,I){var N=M._private.edges;ur(N,I),M.clearTraversalCache()}function h(M){M.clearTraversalCache()}var d=[];d.ids={};function p(M,I){I=I[0],M=M[0];var N=M._private.children,B=M.id();ur(N,I),I._private.parent=null,d.ids[B]||(d.ids[B]=!0,d.push(M))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var g=0;g<a.length;g++){var y=a[g];if(y.isEdge()){var m=y.source()[0],b=y.target()[0];c(m,y),c(b,y);for(var E=y.parallelEdges(),C=0;C<E.length;C++){var A=E[C];h(A),A.isBundledBezier()&&A.dirtyBoundingBoxCache()}}else{var w=y.parent();w.length!==0&&p(w,y)}e&&(y._private.removed=!0)}var x=i._private.elements;i._private.hasCompoundNodes=!1;for(var T=0;T<x.length;T++){var D=x[T];if(D.isParent()){i._private.hasCompoundNodes=!0;break}}var S=new vt(this.cy(),a);S.size()>0&&(t?S.emitAndNotify("remove"):e&&S.emit("remove"));for(var R=0;R<d.length;R++){var L=d[R];(!e||!L.removed())&&L.updateStyle()}return S};Ve.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(t.source!==void 0||t.target!==void 0){var o=i(t.source),s=i(t.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var h=0;h<r.length;h++){var d=r[h],p=d._private.data;d.isEdge()&&(u&&(p.source=o),l&&(p.target=s))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),v=f===null||e.hasElementWithId(f);if(v){var c=f===null?void 0:f;e.batch(function(){var h=r.remove(a,n);h.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var p=r[d],g=p._private.data;p.isNode()&&(g.parent=c)}h.restore(a,n)}),r.emitAndNotify("move")}}return this};[Pf,Mg,fn,ir,jr,Xg,Yn,up,rv,av,hp,Ln,vn,ft,or,gt].forEach(function(t){pe(Ve,t)});var wp={add:function(e){var r,a=this;if(At(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],o=0;o<n.length;o++){var s=n[o];i.push(s.json())}r=new vt(a,i)}}else if(Fe(e)){var u=e;r=new vt(a,u)}else if(Pe(e)&&(Fe(e.nodes)||Fe(e.edges))){for(var l=e,f=[],v=["nodes","edges"],c=0,h=v.length;c<h;c++){var d=v[c],p=l[d];if(Fe(p))for(var g=0,y=p.length;g<y;g++){var m=pe({group:d},p[g]);f.push(m)}}r=new vt(a,f)}else{var b=e;r=new Fn(a,b).collection()}return r},remove:function(e){if(!At(e)){if(he(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function Ep(t,e,r,a){var n=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var v=0;v<4;++v)if(typeof arguments[v]!="number"||isNaN(arguments[v])||!isFinite(arguments[v]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var c=f?new Float32Array(u):new Array(u);function h(D,S){return 1-3*S+3*D}function d(D,S){return 3*S-6*D}function p(D){return 3*D}function g(D,S,R){return((h(S,R)*D+d(S,R))*D+p(S))*D}function y(D,S,R){return 3*h(S,R)*D*D+2*d(S,R)*D+p(S)}function m(D,S){for(var R=0;R<n;++R){var L=y(S,t,r);if(L===0)return S;var M=g(S,t,r)-D;S-=M/L}return S}function b(){for(var D=0;D<u;++D)c[D]=g(D*l,t,r)}function E(D,S,R){var L,M,I=0;do M=S+(R-S)/2,L=g(M,t,r)-D,L>0?R=M:S=M;while(Math.abs(L)>o&&++I<s);return M}function C(D){for(var S=0,R=1,L=u-1;R!==L&&c[R]<=D;++R)S+=l;--R;var M=(D-c[R])/(c[R+1]-c[R]),I=S+M*l,N=y(I,t,r);return N>=i?m(D,I):N===0?I:E(D,S,S+l)}var A=!1;function w(){A=!0,(t!==e||r!==a)&&b()}var x=function(S){return A||w(),t===e&&r===a?S:S===0?0:S===1?1:g(C(S),e,a)};x.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var T="generateBezier("+[t,e,r,a]+")";return x.toString=function(){return T},x}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var xp=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,n){var i={dx:a.v,dv:t(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),u=e(a,n,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),f=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,v=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(l=a(n,i),h=l/o*v):h=v;d=r(d||s,h),u.push(1+d.x),l+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(p){return u[p*(u.length-1)|0]}:l}}(),_e=function(e,r,a,n){var i=Ep(e,r,a,n);return function(o,s,u){return o+(s-o)*i(u)}},cn={linear:function(e,r,a){return e+(r-e)*a},ease:_e(.25,.1,.25,1),"ease-in":_e(.42,0,1,1),"ease-out":_e(0,0,.58,1),"ease-in-out":_e(.42,0,.58,1),"ease-in-sine":_e(.47,0,.745,.715),"ease-out-sine":_e(.39,.575,.565,1),"ease-in-out-sine":_e(.445,.05,.55,.95),"ease-in-quad":_e(.55,.085,.68,.53),"ease-out-quad":_e(.25,.46,.45,.94),"ease-in-out-quad":_e(.455,.03,.515,.955),"ease-in-cubic":_e(.55,.055,.675,.19),"ease-out-cubic":_e(.215,.61,.355,1),"ease-in-out-cubic":_e(.645,.045,.355,1),"ease-in-quart":_e(.895,.03,.685,.22),"ease-out-quart":_e(.165,.84,.44,1),"ease-in-out-quart":_e(.77,0,.175,1),"ease-in-quint":_e(.755,.05,.855,.06),"ease-out-quint":_e(.23,1,.32,1),"ease-in-out-quint":_e(.86,0,.07,1),"ease-in-expo":_e(.95,.05,.795,.035),"ease-out-expo":_e(.19,1,.22,1),"ease-in-out-expo":_e(1,0,0,1),"ease-in-circ":_e(.6,.04,.98,.335),"ease-out-circ":_e(.075,.82,.165,1),"ease-in-out-circ":_e(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return cn.linear;var n=xp(e,r,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":_e};function Tl(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Cl(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function kr(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var o=Cl(t,n),s=Cl(e,n);if(ae(o)&&ae(s))return Tl(i,o,s,r,a);if(Fe(o)&&Fe(s)){for(var u=[],l=0;l<s.length;l++){var f=o[l],v=s[l];if(f!=null&&v!=null){var c=Tl(i,f,v,r,a);u.push(c)}else u.push(v)}return u}}function Tp(t,e,r,a){var n=!a,i=t._private,o=e._private,s=o.easing,u=o.startTime,l=a?t:t.cy(),f=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=cn.linear;else{var v;if(he(s)){var c=f.parse("transition-timing-function",s);v=c.value}else v=s;var h,d;he(v)?(h=v,d=[]):(h=v[1],d=v.slice(2).map(function(F){return+F})),d.length>0?(h==="spring"&&d.push(o.duration),o.easingImpl=cn[h].apply(null,d)):o.easingImpl=cn[h]}var p=o.easingImpl,g;if(o.duration===0?g=1:g=(r-u)/o.duration,o.applying&&(g=o.progress),g<0?g=0:g>1&&(g=1),o.delay==null){var y=o.startPosition,m=o.position;if(m&&n&&!t.locked()){var b={};ha(y.x,m.x)&&(b.x=kr(y.x,m.x,g,p)),ha(y.y,m.y)&&(b.y=kr(y.y,m.y,g,p)),t.position(b)}var E=o.startPan,C=o.pan,A=i.pan,w=C!=null&&a;w&&(ha(E.x,C.x)&&(A.x=kr(E.x,C.x,g,p)),ha(E.y,C.y)&&(A.y=kr(E.y,C.y,g,p)),t.emit("pan"));var x=o.startZoom,T=o.zoom,D=T!=null&&a;D&&(ha(x,T)&&(i.zoom=Sa(i.minZoom,kr(x,T,g,p),i.maxZoom)),t.emit("zoom")),(w||D)&&t.emit("viewport");var S=o.style;if(S&&S.length>0&&n){for(var R=0;R<S.length;R++){var L=S[R],M=L.name,I=L,N=o.startStyle[M],B=f.properties[N.name],O=kr(N,I,g,p,B);f.overrideBypass(t,M,O)}t.emit("style")}}return o.progress=g,g}function ha(t,e){return t==null||e==null?!1:ae(t)&&ae(e)?!0:!!(t&&e)}function Cp(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function Dl(t,e){var r=e._private.aniEles,a=[];function n(f,v){var c=f._private,h=c.animation.current,d=c.animation.queue,p=!1;if(h.length===0){var g=d.shift();g&&h.push(g)}for(var y=function(A){for(var w=A.length-1;w>=0;w--){var x=A[w];x()}A.splice(0,A.length)},m=h.length-1;m>=0;m--){var b=h[m],E=b._private;if(E.stopped){h.splice(m,1),E.hooked=!1,E.playing=!1,E.started=!1,y(E.frames);continue}!E.playing&&!E.applying||(E.playing&&E.applying&&(E.applying=!1),E.started||Cp(f,b,t),Tp(f,b,t,v),E.applying&&(E.applying=!1),y(E.frames),E.step!=null&&E.step(t),b.completed()&&(h.splice(m,1),E.hooked=!1,E.playing=!1,E.started=!1,y(E.completes)),p=!0)}return!v&&h.length===0&&d.length===0&&a.push(f),p}for(var i=!1,o=0;o<r.length;o++){var s=r[o],u=n(s);i=i||u}var l=n(e,!0);(i||l)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Dp={animate:Oe.animate(),animation:Oe.animation(),animated:Oe.animated(),clearQueue:Oe.clearQueue(),delay:Oe.delay(),delayAnimation:Oe.delayAnimation(),stop:Oe.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&Tn(function(i){Dl(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){Dl(o,e)},a.beforeRenderPriorities.animations):r()}},Sp={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Na(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},rn=function(e){return he(e)?new fr(e):e},ov={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Hn(Sp,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,rn(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,rn(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,rn(r),a),this},once:function(e,r,a){return this.emitter().one(e,rn(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Oe.eventAliasesOn(ov);var Vo={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};Vo.jpeg=Vo.jpg;var hn={layout:function(e){var r=this;if(e==null){Ye("Layout options must be specified to make a layout");return}if(e.name==null){Ye("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){Ye("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;he(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var o=new n(pe({},e,{cy:r,eles:i}));return o}};hn.createLayout=hn.makeLayout=hn.layout;var Ap={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],o=e[i],s=r.getElementById(i);s.data(o)}})}},Lp=ct({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Uo={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.renderTo(e,r,a,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,a=r.extension("renderer",e.name);if(a==null){Ye("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Ne("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=Lp(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Uo.invalidateDimensions=Uo.resize;var dn={collection:function(e,r){return he(e)?this.$(e):At(e)?e.collection():Fe(e)?(r||(r={}),new vt(this,e,r.unique,r.removed)):new vt(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};dn.elements=dn.filter=dn.$;var ut={},wa="t",Rp="f";ut.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var o=t[i],s=e.getContextMeta(o);if(!s.empty){var u=e.getContextStyle(s),l=e.applyContextStyle(s,u,o);o._private.appliedInitStyle?e.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var f=e.updateStyleHints(o);f&&n.push(o)}}return n};ut.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var o=[],s={},u=0;u<r.length;u++){var l=r[u],f=t[u]===wa,v=e[u]===wa,c=f!==v,h=l.mappedProperties.length>0;if(c||v&&h){var d=void 0;c&&h||c?d=l.properties:h&&(d=l.mappedProperties);for(var p=0;p<d.length;p++){for(var g=d[p],y=g.name,m=!1,b=u+1;b<r.length;b++){var E=r[b],C=e[b]===wa;if(C&&(m=E.properties[g.name]!=null,m))break}!s[y]&&!m&&(s[y]=!0,o.push(y))}}}return a[n]=o,o};ut.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(t);s?r+=wa:r+=Rp}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};ut.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var o=r[i],s=e[i]===wa;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];n[l.name]=l}}return a[e]=n,n};ut.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},o=a.types,s=0;s<n.length;s++){var u=n[s],l=e[u],f=r.pstyle(u);if(!l)if(f)f.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(f!==l){if(l.mapped===o.fn&&f!=null&&f.mapping!=null&&f.mapping.value===l.value){var v=f.mapping,c=v.fnValue=l.value(r);if(c===v.prevFnValue)continue}var h=i[u]={prev:f};a.applyParsedProperty(r,l),h.next=r.pstyle(u),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}};ut.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(Y,ee,ne){return r.getPropertiesHash(Y,ee,ne)},o=e.styleKey;if(t.removed())return!1;var s=e.group==="nodes",u=t._private.style;a=Object.keys(u);for(var l=0;l<n.length;l++){var f=n[l];e.styleKeys[f]=[Tr,Ur]}for(var v=function(Y,ee){return e.styleKeys[ee][0]=Ta(Y,e.styleKeys[ee][0])},c=function(Y,ee){return e.styleKeys[ee][1]=Ca(Y,e.styleKeys[ee][1])},h=function(Y,ee){v(Y,ee),c(Y,ee)},d=function(Y,ee){for(var ne=0;ne<Y.length;ne++){var be=Y.charCodeAt(ne);v(be,ee),c(be,ee)}},p=2e9,g=function(Y){return-128<Y&&Y<128&&Math.floor(Y)!==Y?p-(Y*1024|0):Y},y=0;y<a.length;y++){var m=a[y],b=u[m];if(b!=null){var E=this.properties[m],C=E.type,A=E.groupKey,w=void 0;E.hashOverride!=null?w=E.hashOverride(t,b):b.pfValue!=null&&(w=b.pfValue);var x=E.enums==null?b.value:null,T=w!=null,D=x!=null,S=T||D,R=b.units;if(C.number&&S&&!C.multiple){var L=T?w:x;h(g(L),A),!T&&R!=null&&d(R,A)}else d(b.strValue,A)}}for(var M=[Tr,Ur],I=0;I<n.length;I++){var N=n[I],B=e.styleKeys[N];M[0]=Ta(B[0],M[0]),M[1]=Ca(B[1],M[1])}e.styleKey=Hc(M[0],M[1]);var O=e.styleKeys;e.labelDimsKey=er(O.labelDimensions);var F=i(t,["label"],O.labelDimensions);if(e.labelKey=er(F),e.labelStyleKey=er($a(O.commonLabel,F)),!s){var G=i(t,["source-label"],O.labelDimensions);e.sourceLabelKey=er(G),e.sourceLabelStyleKey=er($a(O.commonLabel,G));var k=i(t,["target-label"],O.labelDimensions);e.targetLabelKey=er(k),e.targetLabelStyleKey=er($a(O.commonLabel,k))}if(s){var z=e.styleKeys,U=z.nodeBody,H=z.nodeBorder,$=z.nodeOutline,K=z.backgroundImage,j=z.compound,re=z.pie,Q=z.stripe,_=[U,H,$,K,j,re,Q].filter(function(q){return q!=null}).reduce($a,[Tr,Ur]);e.nodeKey=er(_),e.hasPie=re!=null&&re[0]!==Tr&&re[1]!==Ur,e.hasStripe=Q!=null&&Q[0]!==Tr&&Q[1]!==Ur}return o!==e.styleKey};ut.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};ut.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,o=r.types,s=r.properties[a.name].type,u=a.bypass,l=n[a.name],f=l&&l.bypass,v=t._private,c="mapping",h=function(U){return U==null?null:U.pfValue!=null?U.pfValue:U.value},d=function(){var U=h(l),H=h(a);r.checkTriggers(t,a.name,U,H)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",u)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return l?l.bypass?(n[a.name]=l.bypassed,d(),!0):!1:(d(),!0);var p=function(){Ne("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var g=a.field.split("."),y=v.data,m=0;m<g.length&&y;m++){var b=g[m];y=y[b]}if(y==null)return p(),!1;var E;if(ae(y)){var C=a.fieldMax-a.fieldMin;C===0?E=0:E=(y-a.fieldMin)/C}else return Ne("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+y+"` for `"+t.id()+"` is non-numeric)"),!1;if(E<0?E=0:E>1&&(E=1),s.color){var A=a.valueMin[0],w=a.valueMax[0],x=a.valueMin[1],T=a.valueMax[1],D=a.valueMin[2],S=a.valueMax[2],R=a.valueMin[3]==null?1:a.valueMin[3],L=a.valueMax[3]==null?1:a.valueMax[3],M=[Math.round(A+(w-A)*E),Math.round(x+(T-x)*E),Math.round(D+(S-D)*E),Math.round(R+(L-R)*E)];i={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else if(s.number){var I=a.valueMin+(a.valueMax-a.valueMin)*E;i=this.parse(a.name,I,a.bypass,c)}else return!1;if(!i)return p(),!1;i.mapping=a,a=i;break}case o.data:{for(var N=a.field.split("."),B=v.data,O=0;O<N.length&&B;O++){var F=N[O];B=B[F]}if(B!=null&&(i=this.parse(a.name,B,a.bypass,c)),!i)return p(),!1;i.mapping=a,a=i;break}case o.fn:{var G=a.value,k=a.fnValue!=null?a.fnValue:G(t);if(a.prevFnValue=k,k==null)return Ne("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,k,a.bypass,c),!i)return Ne("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=_t(a),a=i;break}case void 0:break;default:return!1}return u?(f?a.bypassed=l.bypassed:a.bypassed=l,n[a.name]=a):f?l.bypassed=a:n[a.name]=a,d(),!0};ut.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s];u!=null&&(u.bypass?u.bypassed=null:n[s]=null)}}};ut.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};ut.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var s={},u=!1,l=0;l<n.length;l++){var f=n[l],v=t.pstyle(f),c=e[f];if(c){var h=c.prev,d=h,p=c.next!=null?c.next:v,g=!1,y=void 0,m=1e-6;d&&(ae(d.pfValue)&&ae(p.pfValue)?(g=p.pfValue-d.pfValue,y=d.pfValue+m*g):ae(d.value)&&ae(p.value)?(g=p.value-d.value,y=d.value+m*g):Fe(d.value)&&Fe(p.value)&&(g=d.value[0]!==p.value[0]||d.value[1]!==p.value[1]||d.value[2]!==p.value[2],y=d.strValue),g&&(s[f]=p.strValue,this.applyBypass(t,f,y),u=!0))}}if(!u)return;a.transitioning=!0,new ra(function(b){o>0?t.delayAnimation(o).play().promise().then(b):b()}).then(function(){return t.animation({style:s,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)};ut.checkTrigger=function(t,e,r,a,n,i){var o=this.properties[e],s=n(o);t.removed()||s!=null&&s(r,a,t)&&i(o)};ut.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})};ut.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};ut.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ut.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ut.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var Va={};Va.applyBypass=function(t,e,r,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var s=0;s<n.properties.length;s++){var u=n.properties[s],l=u.name,f=this.parse(l,r,!0);f&&i.push(f)}}else if(he(e)){var v=this.parse(e,r,!0);v&&i.push(v)}else if(Pe(e)){var c=e;a=r;for(var h=Object.keys(c),d=0;d<h.length;d++){var p=h[d],g=c[p];if(g===void 0&&(g=c[Bn(p)]),g!==void 0){var y=this.parse(p,g,!0);y&&i.push(y)}}}else return!1;if(i.length===0)return!1;for(var m=!1,b=0;b<t.length;b++){for(var E=t[b],C={},A=void 0,w=0;w<i.length;w++){var x=i[w];if(a){var T=E.pstyle(x.name);A=C[x.name]={prev:T}}m=this.applyParsedProperty(E,_t(x))||m,a&&(A.next=E.pstyle(x.name))}m&&this.updateStyleHints(E),a&&this.updateTransitions(E,C,o)}return m};Va.overrideBypass=function(t,e,r){e=es(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),s?i.strValue="rgb("+r.join(",")+")":u?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,l,r)}};Va.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Va.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],f=i.pstyle(l.name);if(!(!f||!f.bypass)){var v="",c=this.parse(u,v,!0),h=o[l.name]={prev:f};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,o,a)}};var gs={};gs.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};gs.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var Vt={};Vt.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};Vt.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],o=r.getStylePropertyValue(t,i.name,e);o!=null&&(a[i.name]=o,a[Bn(i.name)]=o)}return a}};Vt.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n??t.cy().style().getDefaultProperty(e)[r][0]};Vt.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,o=t.pstyle(n.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(r&&i.number&&s!=null&&ae(s)){var f=t.cy().zoom(),v=function(g){return g*f},c=function(g,y){return v(g)+y},h=Fe(s),d=h?u.every(function(p){return p!=null}):u!=null;return d?h?s.map(function(p,g){return c(p,u[g])}).join(" "):c(s,u):h?s.map(function(p){return he(p)?p:""+v(p)}).join(" "):""+v(s)}else if(l!=null)return l}return null}};Vt.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,o=t.pstyle(i);o!==void 0&&(Pe(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(r[i]=o)}return r};Vt.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s],l=n[s]||n[es(s)],f=this.parse(l.name,u);f&&r.push(f)}return r};Vt.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,o,s,u,l;for(u=0;u<e.length;u++)if(n=e[u],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=Ta(s,a[0]),a[1]=Ca(s,a[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),a[0]=Ta(s,a[0]),a[1]=Ca(s,a[1]);return a};Vt.getPropertiesHash=Vt.getNonDefaultPropertiesHash;var $n={};$n.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,o=Object.keys(i);e.selector(n);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e};$n.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};$n.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},o=0;o<n.length;o++){var s=n[o];i[s.name]=s.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var ps={};ps.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){a.length>n.length?a=a.substr(n.length):a=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Ne("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var v=f[1];if(v!=="core"){var c=new fr(v);if(c.invalid){Ne("Skipping parsing of block: Invalid selector found in string stylesheet: "+v),s();continue}}var h=f[2],d=!1;i=h;for(var p=[];;){var g=i.match(/^\s*$/);if(g)break;var y=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Ne("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}o=y[0];var m=y[1],b=y[2],E=e.properties[m];if(!E){Ne("Skipping property: Invalid property name in: "+o),u();continue}var C=r.parse(m,b);if(!C){Ne("Skipping property: Invalid property definition in: "+o),u();continue}p.push({name:m,val:b}),u()}if(d){s();break}r.selector(v);for(var A=0;A<p.length;A++){var w=p[A];r.css(w.name,w.val)}s()}return r};ps.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var Qe={};(function(){var t=rt,e=Tc,r=Dc,a=Sc,n=Ac,i=function(q){return"^"+q+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(q){var Y=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+q+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+Y+")\\s*\\,\\s*("+Y+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Qe.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(q,Y){switch(q.length){case 2:return Y[0]!=="deg"&&Y[0]!=="rad"&&Y[1]!=="deg"&&Y[1]!=="rad";case 1:return he(q[0])||Y[0]==="deg"||Y[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(q){var Y=q.length;return Y===1||Y===2||Y===4}}};var u={zeroNonZero:function(q,Y){return(q==null||Y==null)&&q!==Y||q==0&&Y!=0?!0:q!=0&&Y==0},any:function(q,Y){return q!=Y},emptyNonEmpty:function(q,Y){var ee=sr(q),ne=sr(Y);return ee&&!ne||!ee&&ne}},l=Qe.types,f=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],v=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],c=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],d=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],p=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any}],g=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(q,Y,ee){return q===Y?!1:ee.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],y=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],m=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],b=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],E=function(q,Y){return Y.value==="label"?-q.poolIndex():Y.pfValue},C=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:E},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:E},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],A=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],w=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],x=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],T=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],D=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(q,Y){return q===Y?!1:q==="bezier"||Y==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],S=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],R=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],L=[];Qe.pieBackgroundN=16,L.push({name:"pie-size",type:l.sizeMaybePercent}),L.push({name:"pie-hole",type:l.sizeMaybePercent}),L.push({name:"pie-start-angle",type:l.angle});for(var M=1;M<=Qe.pieBackgroundN;M++)L.push({name:"pie-"+M+"-background-color",type:l.color}),L.push({name:"pie-"+M+"-background-size",type:l.percent}),L.push({name:"pie-"+M+"-background-opacity",type:l.zeroOneNumber});var I=[];Qe.stripeBackgroundN=16,I.push({name:"stripe-size",type:l.sizeMaybePercent}),I.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var N=1;N<=Qe.stripeBackgroundN;N++)I.push({name:"stripe-"+N+"-background-color",type:l.color}),I.push({name:"stripe-"+N+"-background-size",type:l.percent}),I.push({name:"stripe-"+N+"-background-opacity",type:l.zeroOneNumber});var B=[],O=Qe.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(_){O.forEach(function(q){var Y=q+"-"+_.name,ee=_.type,ne=_.triggersBounds;B.push({name:Y,type:ee,triggersBounds:ne})})},{});var F=Qe.properties=[].concat(p,b,g,y,m,S,d,h,f,v,c,C,A,w,x,L,I,T,D,B,R),G=Qe.propertyGroups={behavior:p,transition:b,visibility:g,overlay:y,underlay:m,ghost:S,commonLabel:d,labelDimensions:h,mainLabel:f,sourceLabel:v,targetLabel:c,nodeBody:C,nodeBorder:A,nodeOutline:w,backgroundImage:x,pie:L,stripe:I,compound:T,edgeLine:D,edgeArrow:B,core:R},k=Qe.propertyGroupNames={},z=Qe.propertyGroupKeys=Object.keys(G);z.forEach(function(_){k[_]=G[_].map(function(q){return q.name}),G[_].forEach(function(q){return q.groupKey=_})});var U=Qe.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Qe.propertyNames=F.map(function(_){return _.name});for(var H=0;H<F.length;H++){var $=F[H];F[$.name]=$}for(var K=0;K<U.length;K++){var j=U[K],re=F[j.pointsTo],Q={name:j.name,alias:!0,pointsTo:re};F.push(Q),F[j.name]=Q}})();Qe.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};Qe.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=pe({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Qe.pieBackgroundN;f++){var v=l.name.replace("{{i}}",f),c=l.value;u[v]=c}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Qe.stripeBackgroundN;f++){var v=l.name.replace("{{i}}",f),c=l.value;u[v]=c}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return Qe.arrowPrefixes.forEach(function(f){var v=f+"-"+l.name,c=l.value;u[v]=c}),u},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,o=e[i],s=this.parse(i,o);r[i]=s}}return t.defaultProperties=r,t.defaultProperties};Qe.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Kn={};Kn.parse=function(t,e,r,a){var n=this;if(He(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",s=""+e,u=yf(t,s,o,i),l=n.propCache=n.propCache||[],f;return(f=l[u])||(f=l[u]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=_t(f),f&&(f.value=_t(f.value))),f};Kn.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&Ne("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Ne("The style value of `label` is deprecated for `"+n.name+"`"),n};Kn.parseImpl=function(t,e,r,a){var n=this;t=es(t);var i=n.properties[t],o=e,s=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var u=he(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(He(e))return{name:t,value:e,strValue:"fn",mapped:s.fn,bypass:r};var f,v;if(!(!u||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(s.data.regex).exec(e))){if(r)return!1;var c=s.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(v=new RegExp(s.mapData.regex).exec(e))){if(r||l.multiple)return!1;var h=s.mapData;if(!(l.color||l.number))return!1;var d=this.parse(t,v[4]);if(!d||d.mapped)return!1;var p=this.parse(t,v[5]);if(!p||p.mapped)return!1;if(d.pfValue===p.pfValue||d.strValue===p.strValue)return Ne("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(l.color){var g=d.value,y=p.value,m=g[0]===y[0]&&g[1]===y[1]&&g[2]===y[2]&&(g[3]===y[3]||(g[3]==null||g[3]===1)&&(y[3]==null||y[3]===1));if(m)return!1}return{name:t,value:v,strValue:""+e,mapped:h,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:p.value,bypass:r}}}if(l.multiple&&a!=="multiple"){var b;if(u?b=e.split(/\s+/):Fe(e)?b=e:b=[e],l.evenMultiple&&b.length%2!==0)return null;for(var E=[],C=[],A=[],w="",x=!1,T=0;T<b.length;T++){var D=n.parse(t,b[T],r,"multiple");x=x||he(D.value),E.push(D.value),A.push(D.pfValue!=null?D.pfValue:D.value),C.push(D.units),w+=(T>0?" ":"")+D.strValue}return l.validate&&!l.validate(E,C)?null:l.singleEnum&&x?E.length===1&&he(E[0])?{name:t,value:E[0],strValue:E[0],bypass:r}:null:{name:t,value:E,pfValue:A,strValue:w,bypass:r,units:C}}var S=function(){for(var Q=0;Q<l.enums.length;Q++){var _=l.enums[Q];if(_===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(l.number){var R,L="px";if(l.units&&(R=l.units),l.implicitUnits&&(L=l.implicitUnits),!l.unitless)if(u){var M="px|em"+(l.allowPercent?"|\\%":"");R&&(M=R);var I=e.match("^("+rt+")("+M+")?$");I&&(e=I[1],R=I[2]||L)}else(!R||l.implicitUnits)&&(R=L);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,S();if(l.integer&&!pc(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var N={name:t,value:e,strValue:""+e+(R||""),units:R,bypass:r};return l.unitless||R!=="px"&&R!=="em"?N.pfValue=e:N.pfValue=R==="px"||!R?e:this.getEmSizeInPixels()*e,(R==="ms"||R==="s")&&(N.pfValue=R==="ms"?e:1e3*e),(R==="deg"||R==="rad")&&(N.pfValue=R==="rad"?e:Th(e)),R==="%"&&(N.pfValue=e/100),N}else if(l.propList){var B=[],O=""+e;if(O!=="none"){for(var F=O.split(/\s*,\s*|\s+/),G=0;G<F.length;G++){var k=F[G].trim();n.properties[k]?B.push(k):Ne("`"+k+"` is not a valid property name")}if(B.length===0)return null}return{name:t,value:B,strValue:B.length===0?"none":B.join(" "),bypass:r}}else if(l.color){var z=ff(e);return z?{name:t,value:z,pfValue:z,strValue:"rgb("+z[0]+","+z[1]+","+z[2]+")",bypass:r}:null}else if(l.regex||l.regexes){if(l.enums){var U=S();if(U)return U}for(var H=l.regexes?l.regexes:[l.regex],$=0;$<H.length;$++){var K=new RegExp(H[$]),j=K.exec(e);if(j)return{name:t,value:l.singleRegexMatchValue?j[1]:j,strValue:""+e,bypass:r}}return null}else return l.string?{name:t,value:""+e,strValue:""+e,bypass:r}:l.enums?S():null};var st=function(e){if(!(this instanceof st))return new st(e);if(!jo(e)){Ye("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},pt=st.prototype;pt.instanceString=function(){return"style"};pt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};pt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};pt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};pt.selector=function(t){var e=t==="core"?null:new fr(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};pt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[Bn(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};pt.style=pt.css;pt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this};pt.append=function(t){return sf(t)?t.appendToStyle(this):Fe(t)?this.appendFromJson(t):he(t)&&this.appendFromString(t),this};st.fromJson=function(t,e){var r=new st(t);return r.fromJson(e),r};st.fromString=function(t,e){return new st(t).fromString(e)};[ut,Va,gs,Vt,$n,ps,Qe,Kn].forEach(function(t){pe(pt,t)});st.types=pt.types;st.properties=pt.properties;st.propertyGroups=pt.propertyGroups;st.propertyGroupNames=pt.propertyGroupNames;st.propertyGroupKeys=pt.propertyGroupKeys;var Mp={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return sf(e)?r.style=e.generateStyle(this):Fe(e)?r.style=st.fromJson(this,e):he(e)?r.style=st.fromString(this,e):r.style=st(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},Pp="single",Rr={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=Pp),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,n,i,o,s;switch(e.length){case 0:return r;case 1:if(he(e[0]))return a=e[0],r[a];if(Pe(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,ae(o)&&(r.x=o),ae(s)&&(r.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ae(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Pe(e)&&(s=a[0],u=s.x,l=s.y,ae(u)&&(n.x+=u),ae(l)&&(n.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=r,(i==="x"||i==="y")&&ae(o)&&(n[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(ae(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(he(e)){var n=e;e=this.$(n)}else if(bc(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else At(e)||(e=this.mutableElements());if(!(At(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),s=this.height(),u;if(r=ae(r)?r:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((o-2*r)/a.w,(s-2*r)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(a.x1+a.x2))/2,y:(s-u*(a.y1+a.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return ae(e)&&ae(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):ae(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:ae(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,o,s=!1;if(r.zoomingEnabled||(s=!0),ae(e)?o=e:Pe(e)&&(o=e.level,e.position!=null?i=Gn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(s=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,s||!ae(o)||o===n||i!=null&&(!ae(i.x)||!ae(i.y)))return null;if(i!=null){var u=a,l=n,f=o,v={x:-f/l*(i.x-u.x)+i.x,y:-f/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:v}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],o=!1,s=!1;if(!e)return this;if(ae(e.zoom)||(a=!1),Pe(e.pan)||(n=!1),!a&&!n)return this;if(a){var u=e.zoom;u<r.minZoom||u>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var l=e.pan;ae(l.x)&&(r.pan.x=l.x,s=!1),ae(l.y)&&(r.pan.y=l.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(he(e)){var a=e;e=this.mutableElements().filter(a)}else At(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var s={x:(i-r*(n.x1+n.x2))/2,y:(o-r*(n.y1+n.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?function(){var n=a.window().getComputedStyle(r),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Rr.centre=Rr.center;Rr.autolockNodes=Rr.autolock;Rr.autoungrabifyNodes=Rr.autoungrabify;var Ma={data:Oe.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Oe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Oe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Oe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ma.attr=Ma.data;Ma.removeAttr=Ma.removeData;var Pa=function(e){var r=this;e=pe({},e);var a=e.container;a&&!xn(a)&&xn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var o=et!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=pe({name:o?"grid":"null"},s.layout),s.renderer=pe({name:o?"canvas":"null"},s.renderer);var u=function(d,p,g){return p!==void 0?p:g!==void 0?g:d},l=this._private={container:a,ready:!1,options:s,elements:new vt(this),listeners:[],aniEles:new vt(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:ae(s.zoom)?s.zoom:1,pan:{x:Pe(s.pan)&&ae(s.pan.x)?s.pan.x:0,y:Pe(s.pan)&&ae(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var f=function(d,p){var g=d.some(wc);if(g)return ra.all(d).then(p);p(d)};l.styleEnabled&&r.setStyle([]);var v=pe({},s,s.renderer);r.initRenderer(v);var c=function(d,p,g){r.notifications(!1);var y=r.mutableElements();y.length>0&&y.remove(),d!=null&&(Pe(d)||Fe(d))&&r.add(d),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",p),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",g),r.emit("done")});var m=pe({},r._private.options.layout);m.eles=r.elements(),r.layout(m).run()};f([s.style,s.elements],function(h){var d=h[0],p=h[1];l.styleEnabled&&r.style().append(d),c(p,function(){r.startAnimationLoop(),l.ready=!0,He(s.ready)&&r.on("ready",s.ready);for(var g=0;g<i.length;g++){var y=i[g];r.on("ready",y)}n&&(n.readies=[]),r.emit("ready")},s.done)})},Rn=Pa.prototype;pe(Rn,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return et;var r=this._private.container.ownerDocument;return r===void 0||r==null?et:r.defaultView||et},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!xn(e)&&xn(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(pe({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return _t(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(E){return r.getElementById(E.id())};if(Pe(e)){if(r.startBatch(),e.elements){var o={},s=function(E,C){for(var A=[],w=[],x=0;x<E.length;x++){var T=E[x];if(!T.data.id){Ne("cy.json() cannot handle elements without an ID attribute");continue}var D=""+T.data.id,S=r.getElementById(D);o[D]=!0,S.length!==0?w.push({ele:S,json:T}):(C&&(T.group=C),A.push(T))}r.add(A);for(var R=0;R<w.length;R++){var L=w[R],M=L.ele,I=L.json;M.json(I)}};if(Fe(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var f=u[l],v=e.elements[f];Fe(v)&&s(v,f)}var c=r.collection();n.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?c.merge(b):b.remove()}),c.forEach(function(b){return b.children().move({parent:null})}),c.forEach(function(b){return i(b).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var p=h[d];e[p]!=null&&r[p](e[p])}return r.endBatch(),this}else{var g=!!e,y={};g?y.elements=this.elements().map(function(b){return b.json()}):(y.elements={},n.forEach(function(b){var E=b.group();y.elements[E]||(y.elements[E]=[]),y.elements[E].push(b.json())})),this._private.styleEnabled&&(y.style=r.style().json()),y.data=_t(r.data());var m=a.options;return y.zoomingEnabled=a.zoomingEnabled,y.userZoomingEnabled=a.userZoomingEnabled,y.zoom=a.zoom,y.minZoom=a.minZoom,y.maxZoom=a.maxZoom,y.panningEnabled=a.panningEnabled,y.userPanningEnabled=a.userPanningEnabled,y.pan=_t(a.pan),y.boxSelectionEnabled=a.boxSelectionEnabled,y.renderer=_t(m.renderer),y.hideEdgesOnViewport=m.hideEdgesOnViewport,y.textureOnViewport=m.textureOnViewport,y.wheelSensitivity=m.wheelSensitivity,y.motionBlur=m.motionBlur,y.multiClickDebounceTime=m.multiClickDebounceTime,y}}});Rn.$id=Rn.getElementById;[wp,Dp,ov,Vo,hn,Ap,Uo,dn,Mp,Rr,Ma].forEach(function(t){pe(Rn,t)});var Ip={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},Op={maximal:!1,acyclic:!1},Fr=function(e){return e.scratch("breadthfirst")},Sl=function(e,r){return e.scratch("breadthfirst",r)};function sv(t){this.options=pe({},Ip,Op,t)}sv.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(se){return se.isChildless()}),n=r,i=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,u=e.extent(),l=wt(s?t.boundingBox:{x1:u.x1,y1:u.y1,w:u.w,h:u.h}),f;if(At(t.roots))f=t.roots;else if(Fe(t.roots)){for(var v=[],c=0;c<t.roots.length;c++){var h=t.roots[c],d=e.getElementById(h);v.push(d)}f=e.collection(v)}else if(he(t.roots))f=e.$(t.roots);else if(i)f=a.roots();else{var p=r.components();f=e.collection();for(var g=function(){var fe=p[y],de=fe.maxDegree(!1),ye=fe.filter(function(me){return me.degree(!1)===de});f=f.add(ye)},y=0;y<p.length;y++)g()}var m=[],b={},E=function(fe,de){m[de]==null&&(m[de]=[]);var ye=m[de].length;m[de].push(fe),Sl(fe,{index:ye,depth:de})},C=function(fe,de){var ye=Fr(fe),me=ye.depth,we=ye.index;m[me][we]=null,fe.isChildless()&&E(fe,de)};n.bfs({roots:f,directed:t.directed,visit:function(fe,de,ye,me,we){var Ee=fe[0],Re=Ee.id();Ee.isChildless()&&E(Ee,we),b[Re]=!0}});for(var A=[],w=0;w<a.length;w++){var x=a[w];b[x.id()]||A.push(x)}var T=function(fe){for(var de=m[fe],ye=0;ye<de.length;ye++){var me=de[ye];if(me==null){de.splice(ye,1),ye--;continue}Sl(me,{depth:fe,index:ye})}},D=function(fe,de){for(var ye=Fr(fe),me=fe.incomers().filter(function(qe){return qe.isNode()&&r.has(qe)}),we=-1,Ee=fe.id(),Re=0;Re<me.length;Re++){var ze=me[Re],$e=Fr(ze);we=Math.max(we,$e.depth)}if(ye.depth<=we){if(!t.acyclic&&de[Ee])return null;var Be=we+1;return C(fe,Be),de[Ee]=Be,!0}return!1};if(i&&o){var S=[],R={},L=function(fe){return S.push(fe)},M=function(){return S.shift()};for(a.forEach(function(se){return S.push(se)});S.length>0;){var I=M(),N=D(I,R);if(N)I.outgoers().filter(function(se){return se.isNode()&&r.has(se)}).forEach(L);else if(N===null){Ne("Detected double maximal shift for node `"+I.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var B=0;if(t.avoidOverlap)for(var O=0;O<a.length;O++){var F=a[O],G=F.layoutDimensions(t),k=G.w,z=G.h;B=Math.max(B,k,z)}var U={},H=function(fe){if(U[fe.id()])return U[fe.id()];for(var de=Fr(fe).depth,ye=fe.neighborhood(),me=0,we=0,Ee=0;Ee<ye.length;Ee++){var Re=ye[Ee];if(!(Re.isEdge()||Re.isParent()||!a.has(Re))){var ze=Fr(Re);if(ze!=null){var $e=ze.index,Be=ze.depth;if(!($e==null||Be==null)){var qe=m[Be].length;Be<de&&(me+=$e/qe,we++)}}}}return we=Math.max(1,we),me=me/we,we===0&&(me=0),U[fe.id()]=me,me},$=function(fe,de){var ye=H(fe),me=H(de),we=ye-me;return we===0?lf(fe.id(),de.id()):we};t.depthSort!==void 0&&($=t.depthSort);for(var K=m.length,j=0;j<K;j++)m[j].sort($),T(j);for(var re=[],Q=0;Q<A.length;Q++)re.push(A[Q]);var _=function(){for(var fe=0;fe<K;fe++)T(fe)};re.length&&(m.unshift(re),K=m.length,_());for(var q=0,Y=0;Y<K;Y++)q=Math.max(m[Y].length,q);var ee={x:l.x1+l.w/2,y:l.y1+l.h/2},ne=a.reduce(function(se,fe){return function(de){return{w:se.w===-1?de.w:(se.w+de.w)/2,h:se.h===-1?de.h:(se.h+de.h)/2}}(fe.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),be=Math.max(K===1?0:s?(l.h-t.padding*2-ne.h)/(K-1):(l.h-t.padding*2-ne.h)/(K+1),B),Ge=m.reduce(function(se,fe){return Math.max(se,fe.length)},0),Le=function(fe){var de=Fr(fe),ye=de.depth,me=de.index;if(t.circle){var we=Math.min(l.w/2/K,l.h/2/K);we=Math.max(we,B);var Ee=we*ye+we-(K>0&&m[0].length<=3?we/2:0),Re=2*Math.PI/m[ye].length*me;return ye===0&&m[0].length===1&&(Ee=1),{x:ee.x+Ee*Math.cos(Re),y:ee.y+Ee*Math.sin(Re)}}else{var ze=m[ye].length,$e=Math.max(ze===1?0:s?(l.w-t.padding*2-ne.w)/((t.grid?Ge:ze)-1):(l.w-t.padding*2-ne.w)/((t.grid?Ge:ze)+1),B),Be={x:ee.x+(me+1-(ze+1)/2)*$e,y:ee.y+(ye+1-(K+1)/2)*be};return Be}};return r.nodes().layoutPositions(this,t,Le),this};var Np={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function uv(t){this.options=pe({},Np,t)}uv.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=wt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,v=0,c=0;c<i.length;c++){var h=i[c],d=h.layoutDimensions(e),p=d.w,g=d.h;v=Math.max(v,p,g)}if(ae(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(o.h,o.w)/2-v,i.length>1&&e.avoidOverlap){v*=1.75;var y=Math.cos(l)-Math.cos(0),m=Math.sin(l)-Math.sin(0),b=Math.sqrt(v*v/(y*y+m*m));f=Math.max(b,f)}var E=function(A,w){var x=e.startAngle+w*l*(n?1:-1),T=f*Math.cos(x),D=f*Math.sin(x),S={x:s.x+T,y:s.y+D};return S};return a.nodes().layoutPositions(this,e,E),this};var Bp={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function lv(t){this.options=pe({},Bp,t)}lv.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),o=wt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,f=0;f<i.length;f++){var v=i[f],c=void 0;c=e.concentric(v),u.push({value:c,node:v}),v._private.scratch.concentric=c}i.updateStyle();for(var h=0;h<i.length;h++){var d=i[h],p=d.layoutDimensions(e);l=Math.max(l,p.w,p.h)}u.sort(function(ne,be){return be.value-ne.value});for(var g=e.levelWidth(i),y=[[]],m=y[0],b=0;b<u.length;b++){var E=u[b];if(m.length>0){var C=Math.abs(m[0].value-E.value);C>=g&&(m=[],y.push(m))}m.push(E)}var A=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=y.length>0&&y[0].length>1,x=Math.min(o.w,o.h)/2-A,T=x/(y.length+w?1:0);A=Math.min(A,T)}for(var D=0,S=0;S<y.length;S++){var R=y[S],L=e.sweep===void 0?2*Math.PI-2*Math.PI/R.length:e.sweep,M=R.dTheta=L/Math.max(1,R.length-1);if(R.length>1&&e.avoidOverlap){var I=Math.cos(M)-Math.cos(0),N=Math.sin(M)-Math.sin(0),B=Math.sqrt(A*A/(I*I+N*N));D=Math.max(B,D)}R.r=D,D+=A}if(e.equidistant){for(var O=0,F=0,G=0;G<y.length;G++){var k=y[G],z=k.r-F;O=Math.max(O,z)}F=0;for(var U=0;U<y.length;U++){var H=y[U];U===0&&(F=H.r),H.r=F,F+=O}}for(var $={},K=0;K<y.length;K++)for(var j=y[K],re=j.dTheta,Q=j.r,_=0;_<j.length;_++){var q=j[_],Y=e.startAngle+(r?1:-1)*re*_,ee={x:s.x+Q*Math.cos(Y),y:s.y+Q*Math.sin(Y)};$[q.node.id()]=ee}return n.nodes().layoutPositions(this,e,function(ne){var be=ne.id();return $[be]}),this};var xo,kp={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Zn(t){this.options=pe({},kp,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(n){var i=n.source().data("id"),o=n.target().data("id"),s=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(a)}Zn.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?xo=!0:xo=!1;var a=Fp(e,r,t);xo&&zp(a),t.randomize&&_p(a);var n=Kt(),i=function(){Vp(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(c){return!(r.stopped||c>=t.numIter||(Up(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},s=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var c=t.eles.nodes(),h=vv(a,t,c);c.layoutPositions(r,t,h)}},u=0,l=!0;if(t.animate===!0){var f=function(){for(var c=0;l&&c<t.refresh;)l=o(u),u++,c++;if(!l)Ll(a,t),s();else{var h=Kt();h-n>=t.animationThreshold&&i(),Tn(f)}};f()}else{for(;l;)l=o(u),u++;Ll(a,t),s()}return this};Zn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Zn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Fp=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=wt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=a.eles.components(),l={},f=0;f<u.length;f++)for(var v=u[f],c=0;c<v.length;c++){var h=v[c];l[h.id()]=f}for(var f=0;f<s.nodeSize;f++){var d=i[f],p=d.layoutDimensions(a),g={};g.isLocked=d.locked(),g.id=d.data("id"),g.parentId=d.data("parent"),g.cmptId=l[d.id()],g.children=[],g.positionX=d.position("x"),g.positionY=d.position("y"),g.offsetX=0,g.offsetY=0,g.height=p.w,g.width=p.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(d.style("padding")),g.padRight=parseFloat(d.style("padding")),g.padTop=parseFloat(d.style("padding")),g.padBottom=parseFloat(d.style("padding")),g.nodeRepulsion=He(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,s.layoutNodes.push(g),s.idToIndex[g.id]=f}for(var y=[],m=0,b=-1,E=[],f=0;f<s.nodeSize;f++){var d=s.layoutNodes[f],C=d.parentId;C!=null?s.layoutNodes[s.idToIndex[C]].children.push(d.id):(y[++b]=d.id,E.push(d.id))}for(s.graphSet.push(E);m<=b;){var A=y[m++],w=s.idToIndex[A],h=s.layoutNodes[w],x=h.children;if(x.length>0){s.graphSet.push(x);for(var f=0;f<x.length;f++)y[++b]=x[f]}}for(var f=0;f<s.graphSet.length;f++)for(var T=s.graphSet[f],c=0;c<T.length;c++){var D=s.idToIndex[T[c]];s.indexToGraph[D]=f}for(var f=0;f<s.edgeSize;f++){var S=n[f],R={};R.id=S.data("id"),R.sourceId=S.data("source"),R.targetId=S.data("target");var L=He(a.idealEdgeLength)?a.idealEdgeLength(S):a.idealEdgeLength,M=He(a.edgeElasticity)?a.edgeElasticity(S):a.edgeElasticity,I=s.idToIndex[R.sourceId],N=s.idToIndex[R.targetId],B=s.indexToGraph[I],O=s.indexToGraph[N];if(B!=O){for(var F=Gp(R.sourceId,R.targetId,s),G=s.graphSet[F],k=0,g=s.layoutNodes[I];G.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],k++;for(g=s.layoutNodes[N];G.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],k++;L*=k*a.nestingFactor}R.idealLength=L,R.elasticity=M,s.layoutEdges.push(R)}return s},Gp=function(e,r,a){var n=fv(e,r,0,a);return 2>n.count?0:n.graph},fv=function(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=n.idToIndex[u],f=n.layoutNodes[l].children;if(f.length!==0){var v=n.indexToGraph[n.idToIndex[f[0]]],c=fv(e,r,v,n);if(c.count!==0)if(c.count===1){if(o++,o===2)break}else return c}}return{count:o,graph:a}},zp,_p=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*n)}},vv=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var l=(u.positionX-i.x1)/i.w,f=(u.positionY-i.y1)/i.h;return{x:n.x1+l*n.w,y:n.y1+f*n.h}}else return{x:u.positionX,y:u.positionY}}},Vp=function(e,r,a){var n=a.layout,i=a.eles.nodes(),o=vv(e,a,i);i.positions(o),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},Up=function(e,r,a){qp(e,r),Xp(e),Wp(e,r),$p(e),Kp(e)},qp=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[n[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[n[u]]];Yp(s,l,e,r)}},Al=function(e){return-1+2*e*Math.random()},Yp=function(e,r,a,n){var i=e.cmptId,o=r.cmptId;if(!(i!==o&&!a.isCompound)){var s=r.positionX-e.positionX,u=r.positionY-e.positionY,l=1;s===0&&u===0&&(s=Al(l),u=Al(l));var f=Hp(e,r,s,u);if(f>0)var v=n.nodeOverlap*f,c=Math.sqrt(s*s+u*u),h=v*s/c,d=v*u/c;else var p=Mn(e,s,u),g=Mn(r,-1*s,-1*u),y=g.x-p.x,m=g.y-p.y,b=y*y+m*m,c=Math.sqrt(b),v=(e.nodeRepulsion+r.nodeRepulsion)/b,h=v*y/c,d=v*m/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),r.isLocked||(r.offsetX+=h,r.offsetY+=d)}},Hp=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},Mn=function(e,r,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=a/r,l=o/s,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+o/2,f):0<r&&-1*l<=u&&u<=l?(f.x=n+s/2,f.y=i+s*a/2/r,f):0>r&&-1*l<=u&&u<=l?(f.x=n-s/2,f.y=i-s*a/2/r,f):0<a&&(u<=-1*l||u>=l)?(f.x=n+o*r/2/a,f.y=i+o/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-o*r/2/a,f.y=i-o/2),f)},Xp=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],o=e.layoutNodes[i],s=e.idToIndex[n.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,f=u.positionY-o.positionY;if(!(l===0&&f===0)){var v=Mn(o,l,f),c=Mn(u,-1*l,-1*f),h=c.x-v.x,d=c.y-v.y,p=Math.sqrt(h*h+d*d),g=Math.pow(n.idealLength-p,2)/n.elasticity;if(p!==0)var y=g*h/p,m=g*d/p;else var y=0,m=0;o.isLocked||(o.offsetX+=y,o.offsetY+=m),u.isLocked||(u.offsetX-=y,u.offsetY-=m)}}},Wp=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],o=i.length;if(n===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[l.parentId]],s=f.positionX,u=f.positionY;for(var v=0;v<o;v++){var c=e.layoutNodes[e.idToIndex[i[v]]];if(!c.isLocked){var h=s-c.positionX,d=u-c.positionY,p=Math.sqrt(h*h+d*d);if(p>a){var g=r.gravity*h/p,y=r.gravity*d/p;c.offsetX+=g,c.offsetY+=y}}}}},$p=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var f=u.offsetX,v=u.offsetY,c=0;c<l.length;c++){var h=e.layoutNodes[e.idToIndex[l[c]]];h.offsetX+=f,h.offsetY+=v,a[++i]=l[c]}u.offsetX=0,u.offsetY=0}}},Kp=function(e,r){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=Zp(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,cv(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},Zp=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},cv=function(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return cv(n,r)}},Ll=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var o=a[i],s=o.cmptId,u=n[s]=n[s]||[];u.push(o)}for(var l=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var v=0;v<f.length;v++){var c=f[v];f.x1=Math.min(f.x1,c.positionX-c.width/2),f.x2=Math.max(f.x2,c.positionX+c.width/2),f.y1=Math.min(f.y1,c.positionY-c.height/2),f.y2=Math.max(f.y2,c.positionY+c.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,l+=f.w*f.h}}n.sort(function(m,b){return b.w*b.h-m.w*m.h});for(var h=0,d=0,p=0,g=0,y=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var v=0;v<f.length;v++){var c=f[v];c.isLocked||(c.positionX+=h-f.x1,c.positionY+=d-f.y1)}h+=f.w+r.componentSpacing,p+=f.w+r.componentSpacing,g=Math.max(g,f.h),p>y&&(d+=g+r.componentSpacing,h=0,p=0,g=0)}}},Qp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function hv(t){this.options=pe({},Qp,t)}hv.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=wt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(U){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),f=function(H){if(H==null)return Math.min(u,l);var $=Math.min(u,l);$==u?u=H:l=H},v=function(H){if(H==null)return Math.max(u,l);var $=Math.max(u,l);$==u?u=H:l=H},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)u=c,l=h;else if(c!=null&&h==null)u=c,l=Math.ceil(o/u);else if(c==null&&h!=null)l=h,u=Math.ceil(o/l);else if(l*u>o){var d=f(),p=v();(d-1)*p>=o?f(d-1):(p-1)*d>=o&&v(p-1)}else for(;l*u<o;){var g=f(),y=v();(y+1)*g>=o?v(y+1):f(g+1)}var m=i.w/l,b=i.h/u;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var E=0;E<n.length;E++){var C=n[E],A=C._private.position;(A.x==null||A.y==null)&&(A.x=0,A.y=0);var w=C.layoutDimensions(e),x=e.avoidOverlapPadding,T=w.w+x,D=w.h+x;m=Math.max(m,T),b=Math.max(b,D)}for(var S={},R=function(H,$){return!!S["c-"+H+"-"+$]},L=function(H,$){S["c-"+H+"-"+$]=!0},M=0,I=0,N=function(){I++,I>=l&&(I=0,M++)},B={},O=0;O<n.length;O++){var F=n[O],G=e.position(F);if(G&&(G.row!==void 0||G.col!==void 0)){var k={row:G.row,col:G.col};if(k.col===void 0)for(k.col=0;R(k.row,k.col);)k.col++;else if(k.row===void 0)for(k.row=0;R(k.row,k.col);)k.row++;B[F.id()]=k,L(k.row,k.col)}}var z=function(H,$){var K,j;if(H.locked()||H.isParent())return!1;var re=B[H.id()];if(re)K=re.col*m+m/2+i.x1,j=re.row*b+b/2+i.y1;else{for(;R(M,I);)N();K=I*m+m/2+i.x1,j=M*b+b/2+i.y1,L(M,I),N()}return{x:K,y:j}};n.layoutPositions(this,e,z)}return this};var Jp={ready:function(){},stop:function(){}};function ys(t){this.options=pe({},Jp,t)}ys.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};ys.prototype.stop=function(){return this};var jp={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function dv(t){this.options=pe({},jp,t)}dv.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=He(t.positions);function n(i){if(t.positions==null)return mh(i.position());if(a)return t.positions(i);var o=t.positions[i._private.data.id];return o??null}return r.layoutPositions(this,t,function(i,o){var s=n(i);return i.locked()||s==null?!1:s}),this};var ey={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function gv(t){this.options=pe({},ey,t)}gv.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=wt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(o,s){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var ty=[{name:"breadthfirst",impl:sv},{name:"circle",impl:uv},{name:"concentric",impl:lv},{name:"cose",impl:Zn},{name:"grid",impl:hv},{name:"null",impl:ys},{name:"preset",impl:dv},{name:"random",impl:gv}];function pv(t){this.options=t,this.notifications=0}var Rl=function(){},Ml=function(){throw new Error("A headless instance can not render images")};pv.prototype={recalculateRenderedStyle:Rl,notify:function(){this.notifications++},init:Rl,isHeadless:function(){return!0},png:Ml,jpg:Ml};var ms={};ms.arrowShapeWidth=.3;ms.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(l,f,v,c,h,d,p){var g=h.x-v/2-p,y=h.x+v/2+p,m=h.y-v/2-p,b=h.y+v/2+p,E=g<=l&&l<=y&&m<=f&&f<=b;return E},a=function(l,f,v,c,h){var d=l*Math.cos(c)-f*Math.sin(c),p=l*Math.sin(c)+f*Math.cos(c),g=d*v,y=p*v,m=g+h.x,b=y+h.y;return{x:m,y:b}},n=function(l,f,v,c){for(var h=[],d=0;d<l.length;d+=2){var p=l[d],g=l[d+1];h.push(a(p,g,f,v,c))}return h},i=function(l){for(var f=[],v=0;v<l.length;v++){var c=l[v];f.push(c.x,c.y)}return f},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,f){he(f)&&(f=t[f]),t[l]=pe({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,h,d,p,g,y){var m=i(n(this.points,d+2*y,p,g)),b=Dt(c,h,m);return b},roughCollide:r,draw:function(c,h,d,p){var g=n(this.points,h,d,p);e.arrowShapeImpl("polygon")(c,g)},spacing:function(c){return 0},gap:o},f)};s("none",{collide:Cn,roughCollide:Cn,draw:as,spacing:Hs,gap:Hs}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),p=this.controlPoint,g=a(p[0],p[1],f,v,c);e.arrowShapeImpl(this.name)(l,d,g)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,f,v,c,h,d,p){var g=i(n(this.points,v+2*p,c,h)),y=i(n(this.pointsTee,v+2*p,c,h)),m=Dt(l,f,g)||Dt(l,f,y);return m},draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),p=n(this.pointsTee,f,v,c);e.arrowShapeImpl(this.name)(l,d,p)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,f,v,c,h,d,p){var g=h,y=Math.pow(g.x-l,2)+Math.pow(g.y-f,2)<=Math.pow((v+2*p)*this.radius,2),m=i(n(this.points,v+2*p,c,h));return Dt(l,f,m)||y},draw:function(l,f,v,c,h){var d=n(this.pointsTr,f,v,c);e.arrowShapeImpl(this.name)(l,d,c.x,c.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,f){var v=this.baseCrossLinePts.slice(),c=f/l,h=3,d=5;return v[h]=v[h]-c,v[d]=v[d]-c,v},collide:function(l,f,v,c,h,d,p){var g=i(n(this.points,v+2*p,c,h)),y=i(n(this.crossLinePts(v,d),v+2*p,c,h)),m=Dt(l,f,g)||Dt(l,f,y);return m},draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),p=n(this.crossLinePts(f,h),f,v,c);e.arrowShapeImpl(this.name)(l,d,p)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,f,v,c,h,d,p){var g=h,y=Math.pow(g.x-l,2)+Math.pow(g.y-f,2)<=Math.pow((v+2*p)*this.radius,2);return y},draw:function(l,f,v,c,h){e.arrowShapeImpl(this.name)(l,c.x,c.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Pr={};Pr.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],o=a[4],s=r.pan(),u=r.zoom(),l=((t-n)/o-s.x)/u,f=((e-i)/o-s.y)/u;return[l,f]};Pr.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(y){return parseFloat(r.getPropertyValue(y))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,s=t.clientHeight,u=n.left+n.right,l=n.top+n.bottom,f=i.left+i.right,v=e.width/(o+f),c=o-u,h=s-l,d=e.left+n.left+i.left,p=e.top+n.top+i.top;return this.containerBB=[d,p,c,h,v]};Pr.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Pr.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};Pr.findNearestElements=function(t,e,r,a){var n=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),f=(a?24:8)/u,v=(a?8:2)/u,c=(a?8:2)/u,h=1/0,d,p;r&&(o=o.interactive);function g(w,x){if(w.isNode()){if(p)return;p=w,s.push(w)}if(w.isEdge()&&(x==null||x<h))if(d){if(d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value){for(var T=0;T<s.length;T++)if(s[T].isEdge()){s[T]=w,d=w,h=x??h;break}}}else s.push(w),d=w,h=x??h}function y(w){var x=w.outerWidth()+2*v,T=w.outerHeight()+2*v,D=x/2,S=T/2,R=w.position(),L=w.pstyle("corner-radius").value==="auto"?"auto":w.pstyle("corner-radius").pfValue,M=w._private.rscratch;if(R.x-D<=t&&t<=R.x+D&&R.y-S<=e&&e<=R.y+S){var I=i.nodeShapes[n.getNodeShape(w)];if(I.checkPoint(t,e,0,x,T,R.x,R.y,L,M))return g(w,0),!0}}function m(w){var x=w._private,T=x.rscratch,D=w.pstyle("width").pfValue,S=w.pstyle("arrow-scale").value,R=D/2+f,L=R*R,M=R*2,O=x.source,F=x.target,I;if(T.edgeType==="segments"||T.edgeType==="straight"||T.edgeType==="haystack"){for(var N=T.allpts,B=0;B+3<N.length;B+=2)if(Nh(t,e,N[B],N[B+1],N[B+2],N[B+3],M)&&L>(I=zh(t,e,N[B],N[B+1],N[B+2],N[B+3])))return g(w,I),!0}else if(T.edgeType==="bezier"||T.edgeType==="multibezier"||T.edgeType==="self"||T.edgeType==="compound"){for(var N=T.allpts,B=0;B+5<T.allpts.length;B+=4)if(Bh(t,e,N[B],N[B+1],N[B+2],N[B+3],N[B+4],N[B+5],M)&&L>(I=Gh(t,e,N[B],N[B+1],N[B+2],N[B+3],N[B+4],N[B+5])))return g(w,I),!0}for(var O=O||x.source,F=F||x.target,G=n.getArrowWidth(D,S),k=[{name:"source",x:T.arrowStartX,y:T.arrowStartY,angle:T.srcArrowAngle},{name:"target",x:T.arrowEndX,y:T.arrowEndY,angle:T.tgtArrowAngle},{name:"mid-source",x:T.midX,y:T.midY,angle:T.midsrcArrowAngle},{name:"mid-target",x:T.midX,y:T.midY,angle:T.midtgtArrowAngle}],B=0;B<k.length;B++){var z=k[B],U=i.arrowShapes[w.pstyle(z.name+"-arrow-shape").value],H=w.pstyle("width").pfValue;if(U.roughCollide(t,e,G,z.angle,{x:z.x,y:z.y},H,f)&&U.collide(t,e,G,z.angle,{x:z.x,y:z.y},H,f))return g(w),!0}l&&s.length>0&&(y(O),y(F))}function b(w,x,T){return Ct(w,x,T)}function E(w,x){var T=w._private,D=c,S;x?S=x+"-":S="",w.boundingBox();var R=T.labelBounds[x||"main"],L=w.pstyle(S+"label").value,M=w.pstyle("text-events").strValue==="yes";if(!(!M||!L)){var I=b(T.rscratch,"labelX",x),N=b(T.rscratch,"labelY",x),B=b(T.rscratch,"labelAngle",x),O=w.pstyle(S+"text-margin-x").pfValue,F=w.pstyle(S+"text-margin-y").pfValue,G=R.x1-D-O,k=R.x2+D-O,z=R.y1-D-F,U=R.y2+D-F;if(B){var H=Math.cos(B),$=Math.sin(B),K=function(ee,ne){return ee=ee-I,ne=ne-N,{x:ee*H-ne*$+I,y:ee*$+ne*H+N}},j=K(G,z),re=K(G,U),Q=K(k,z),_=K(k,U),q=[j.x+O,j.y+F,Q.x+O,Q.y+F,_.x+O,_.y+F,re.x+O,re.y+F];if(Dt(t,e,q))return g(w),!0}else if(Qr(R,t,e))return g(w),!0}}for(var C=o.length-1;C>=0;C--){var A=o[C];A.isNode()?y(A)||E(A):m(A)||E(A)||E(A,"source")||E(A,"target")}return s};Pr.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(t,r),l=Math.max(t,r),f=Math.min(e,a),v=Math.max(e,a);t=u,r=l,e=f,a=v;var c=wt({x1:t,y1:e,x2:r,y2:a});function h(L,M,I){return Ct(L,M,I)}function d(L,M){var I=L._private,N=o,B="";L.boundingBox();var O=I.labelBounds.main;if(!O)return null;var F=h(I.rscratch,"labelX",M),G=h(I.rscratch,"labelY",M),k=h(I.rscratch,"labelAngle",M),z=L.pstyle(B+"text-margin-x").pfValue,U=L.pstyle(B+"text-margin-y").pfValue,H=O.x1-N-z,$=O.x2+N-z,K=O.y1-N-U,j=O.y2+N-U;if(k){var re=Math.cos(k),Q=Math.sin(k),_=function(Y,ee){return Y=Y-F,ee=ee-G,{x:Y*re-ee*Q+F,y:Y*Q+ee*re+G}};return[_(H,K),_($,K),_($,j),_(H,j)]}else return[{x:H,y:K},{x:$,y:K},{x:$,y:j},{x:H,y:j}]}for(var p=0;p<n.length;p++){var g=n[p];if(g.isNode()){var y=g,m=y.pstyle("text-events").strValue==="yes",b=y.pstyle("box-select-labels").strValue==="yes",E=y.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:b&&m});if(ss(c,E)){var C=d(y),A=[{x:c.x1,y:c.y1},{x:c.x2,y:c.y1},{x:c.x2,y:c.y2},{x:c.x1,y:c.y2}];(!C||Hh(C,A))&&s.push(y)}}else{var w=g,x=w._private,T=x.rscratch;if(T.startX!=null&&T.startY!=null&&!Qr(c,T.startX,T.startY)||T.endX!=null&&T.endY!=null&&!Qr(c,T.endX,T.endY))continue;if(T.edgeType==="bezier"||T.edgeType==="multibezier"||T.edgeType==="self"||T.edgeType==="compound"||T.edgeType==="segments"||T.edgeType==="haystack"){for(var D=x.rstyle.bezierPts||x.rstyle.linePts||x.rstyle.haystackPts,S=!0,R=0;R<D.length;R++)if(!Rh(c,D[R])){S=!1;break}S&&s.push(w)}else(T.edgeType==="haystack"||T.edgeType==="straight")&&s.push(w)}}return s};var Pn={};Pn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,f,v,c,h,y,m;if(r?(f=e.haystackPts[0],v=e.haystackPts[1],c=e.haystackPts[2],h=e.haystackPts[3]):(f=e.arrowStartX,v=e.arrowStartY,c=e.arrowEndX,h=e.arrowEndY),y=e.midX,m=e.midY,i)u=f-e.segpts[0],l=v-e.segpts[1];else if(n||o||s||a){var d=e.allpts,p=ot(d[0],d[2],d[4],.1),g=ot(d[1],d[3],d[5],.1);u=f-p,l=v-g}else u=f-y,l=v-m;e.srcArrowAngle=Ka(u,l);var y=e.midX,m=e.midY;if(r&&(y=(f+c)/2,m=(v+h)/2),u=c-f,l=h-v,i){var d=e.allpts;if(d.length/2%2===0){var b=d.length/2,E=b-2;u=d[b]-d[E],l=d[b+1]-d[E+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var b=d.length/2-1,E=b-2;u=d[b]-d[E],l=d[b+1]-d[E+1]}}else if(n||o||s){var d=e.allpts,C=e.ctrlpts,A,w,x,T;if(C.length/2%2===0){var D=d.length/2-1,S=D+2,R=S+2;A=ot(d[D],d[S],d[R],0),w=ot(d[D+1],d[S+1],d[R+1],0),x=ot(d[D],d[S],d[R],1e-4),T=ot(d[D+1],d[S+1],d[R+1],1e-4)}else{var S=d.length/2-1,D=S-2,R=S+2;A=ot(d[D],d[S],d[R],.4999),w=ot(d[D+1],d[S+1],d[R+1],.4999),x=ot(d[D],d[S],d[R],.5),T=ot(d[D+1],d[S+1],d[R+1],.5)}u=x-A,l=T-w}if(e.midtgtArrowAngle=Ka(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var d=e.allpts;if(d.length/2%2!==0){if(!e.isRound){var b=d.length/2-1,L=b+2;u=-(d[L]-d[b]),l=-(d[L+1]-d[b+1])}}}if(e.midsrcArrowAngle=Ka(u,l),i)u=c-e.segpts[e.segpts.length-2],l=h-e.segpts[e.segpts.length-1];else if(n||o||s||a){var d=e.allpts,M=d.length,p=ot(d[M-6],d[M-4],d[M-2],.9),g=ot(d[M-5],d[M-3],d[M-1],.9);u=c-p,l=h-g}else u=c-y,l=h-m;e.tgtArrowAngle=Ka(u,l)};Pn.getArrowWidth=Pn.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var qo,Yo,zt={},Rt={},Pl,Il,Cr,gn,Xt,br,xr,Ft,Gr,an,yv,mv,Ho,Xo,Ol,Nl=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},ry=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},ay=function(e,r,a,n,i){if(e!==Ol?Nl(r,e,zt):ry(Rt,zt),Nl(r,a,Rt),Pl=zt.nx*Rt.ny-zt.ny*Rt.nx,Il=zt.nx*Rt.nx-zt.ny*-Rt.ny,Xt=Math.asin(Math.max(-1,Math.min(1,Pl))),Math.abs(Xt)<1e-6){qo=r.x,Yo=r.y,xr=Gr=0;return}Cr=1,gn=!1,Il<0?Xt<0?Xt=Math.PI+Xt:(Xt=Math.PI-Xt,Cr=-1,gn=!0):Xt>0&&(Cr=-1,gn=!0),r.radius!==void 0?Gr=r.radius:Gr=n,br=Xt/2,an=Math.min(zt.len/2,Rt.len/2),i?(Ft=Math.abs(Math.cos(br)*Gr/Math.sin(br)),Ft>an?(Ft=an,xr=Math.abs(Ft*Math.sin(br)/Math.cos(br))):xr=Gr):(Ft=Math.min(an,Gr),xr=Math.abs(Ft*Math.sin(br)/Math.cos(br))),Ho=r.x+Rt.nx*Ft,Xo=r.y+Rt.ny*Ft,qo=Ho-Rt.ny*xr*Cr,Yo=Xo+Rt.nx*xr*Cr,yv=r.x+zt.nx*Ft,mv=r.y+zt.ny*Ft,Ol=r};function bv(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function bs(t,e,r,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(ay(t,e,r,a,n),{cx:qo,cy:Yo,radius:xr,startX:yv,startY:mv,stopX:Ho,stopY:Xo,startAngle:zt.ang+Math.PI/2*Cr,endAngle:Rt.ang-Math.PI/2*Cr,counterClockwise:gn})}var Ia=.01,ny=Math.sqrt(2*Ia),yt={};yt.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),s=t.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(C,A,w,x){var T=x-A,D=w-C,S=Math.sqrt(D*D+T*T);return{x:-T/S,y:D/S}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(u){var v=this.manualEndptToPx(t.source()[0],o),c=tt(v,2),h=c[0],d=c[1],p=this.manualEndptToPx(t.target()[0],s),g=tt(p,2),y=g[0],m=g[1],b={x1:h,y1:d,x2:y,y2:m};n=l(h,d,y,m),i=b}else Ne("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};yt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var o=a.source,s=a.target,u=o.position(),l=s.position(),f=o.width(),v=s.width(),c=o.height(),h=s.height(),d=r.pstyle("haystack-radius").value,p=d/2;n.haystackPts=n.allpts=[n.source.x*f*p+u.x,n.source.y*c*p+u.y,n.target.x*v*p+l.x,n.target.y*h*p+l.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};yt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),s=Math.min(a.pfValue.length,n.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var f=0;f<s;f++){var v=a.pfValue[f],c=n.pfValue[f],h=1-v,d=v,p=this.findMidptPtsEtc(t,e),g=p.midptPts,y=p.vectorNormInverse,m={x:g.x1*h+g.x2*d,y:g.y1*h+g.y2*d};r.segpts.push(m.x+y.x*c,m.y+y.y*c),r.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:u),r.isArcRadius.push((o.pfValue[f]!==void 0?o.pfValue[f]:l)==="arc-radius")}};yt.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,o=e.srcPos,s=t.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,v=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=r,h=v;a&&(c=0,h=u);var d=l-Math.PI/2,p=d-f/2,g=d+f/2,y=l+"_"+f;c=i[y]===void 0?i[y]=0:++i[y],n.ctrlpts=[o.x+Math.cos(p)*1.4*h*(c/3+1),o.y+Math.sin(p)*1.4*h*(c/3+1),o.x+Math.cos(g)*1.4*h*(c/3+1),o.y+Math.sin(g)*1.4*h*(c/3+1)]};yt.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,f=e.tgtH,v=t.pstyle("control-point-step-size").pfValue,c=t.pstyle("control-point-distances"),h=c?c.pfValue[0]:void 0,d=r,p=v;a&&(d=0,p=h);var g=50,y={x:i.x-s/2,y:i.y-u/2},m={x:o.x-l/2,y:o.y-f/2},b={x:Math.min(y.x,m.x),y:Math.min(y.y,m.y)},E=.5,C=Math.max(E,Math.log(s*Ia)),A=Math.max(E,Math.log(l*Ia));n.ctrlpts=[b.x,b.y-(1+Math.pow(g,1.12)/100)*p*(d/3+1)*C,b.x-(1+Math.pow(g,1.12)/100)*p*(d/3+1)*A,b.y]};yt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};yt.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,s=t.pstyle("control-point-distances"),u=t.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,f=s?s.pfValue[0]:void 0,v=u.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<l;h++){var d=(.5-e.eles.length/2+r)*o*(n?-1:1),p=void 0,g=os(d);c&&(f=s?s.pfValue[h]:o,v=u.value[h]),a?p=f:p=f!==void 0?g*f:void 0;var y=p!==void 0?p:d,m=1-v,b=v,E=this.findMidptPtsEtc(t,e),C=E.midptPts,A=E.vectorNormInverse,w={x:C.x1*m+C.x2*b,y:C.y1*m+C.y2*b};i.ctrlpts.push(w.x+A.x*y,w.y+A.y*y)}};yt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",f=e.posPts,v=e.srcW,c=e.srcH,h=e.tgtW,d=e.tgtH,p=t.pstyle("edge-distances").value,g=p!=="node-position",y=t.pstyle("taxi-direction").value,m=y,b=t.pstyle("taxi-turn"),E=b.units==="%",C=b.pfValue,A=C<0,w=t.pstyle("taxi-turn-min-distance").pfValue,x=g?(v+h)/2:0,T=g?(c+d)/2:0,D=f.x2-f.x1,S=f.y2-f.y1,R=function(P,V){return P>0?Math.max(P-V,0):Math.min(P+V,0)},L=R(D,x),M=R(S,T),I=!1;m===l?y=Math.abs(L)>Math.abs(M)?n:a:m===u||m===s?(y=a,I=!0):(m===i||m===o)&&(y=n,I=!0);var N=y===a,B=N?M:L,O=N?S:D,F=os(O),G=!1;!(I&&(E||A))&&(m===s&&O<0||m===u&&O>0||m===i&&O>0||m===o&&O<0)&&(F*=-1,B=F*Math.abs(B),G=!0);var k;if(E){var z=C<0?1+C:C;k=z*B}else{var U=C<0?B:0;k=U+C*F}var H=function(P){return Math.abs(P)<w||Math.abs(P)>=Math.abs(B)},$=H(k),K=H(Math.abs(B)-Math.abs(k)),j=$||K;if(j&&!G)if(N){var re=Math.abs(O)<=c/2,Q=Math.abs(D)<=h/2;if(re){var _=(f.x1+f.x2)/2,q=f.y1,Y=f.y2;r.segpts=[_,q,_,Y]}else if(Q){var ee=(f.y1+f.y2)/2,ne=f.x1,be=f.x2;r.segpts=[ne,ee,be,ee]}else r.segpts=[f.x1,f.y2]}else{var Ge=Math.abs(O)<=v/2,Le=Math.abs(S)<=d/2;if(Ge){var se=(f.y1+f.y2)/2,fe=f.x1,de=f.x2;r.segpts=[fe,se,de,se]}else if(Le){var ye=(f.x1+f.x2)/2,me=f.y1,we=f.y2;r.segpts=[ye,me,ye,we]}else r.segpts=[f.x2,f.y1]}else if(N){var Ee=f.y1+k+(g?c/2*F:0),Re=f.x1,ze=f.x2;r.segpts=[Re,Ee,ze,Ee]}else{var $e=f.x1+k+(g?v/2*F:0),Be=f.y1,qe=f.y2;r.segpts=[$e,Be,$e,qe]}if(r.isRound){var Se=t.pstyle("taxi-radius").value,ue=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(Se),r.isArcRadius=new Array(r.segpts.length/2).fill(ue)}};yt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,v=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,p=!ae(r.startX)||!ae(r.startY),g=!ae(r.arrowStartX)||!ae(r.arrowStartY),y=!ae(r.endX)||!ae(r.endY),m=!ae(r.arrowEndX)||!ae(r.arrowEndY),b=3,E=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=b*E,A=Ar({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),w=A<C,x=Ar({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),T=x<C,D=!1;if(p||g||w){D=!0;var S={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},R=Math.sqrt(S.x*S.x+S.y*S.y),L={x:S.x/R,y:S.y/R},M=Math.max(i,o),I={x:r.ctrlpts[0]+L.x*2*M,y:r.ctrlpts[1]+L.y*2*M},N=l.intersectLine(a.x,a.y,i,o,I.x,I.y,0,v,h);w?(r.ctrlpts[0]=r.ctrlpts[0]+L.x*(C-A),r.ctrlpts[1]=r.ctrlpts[1]+L.y*(C-A)):(r.ctrlpts[0]=N[0]+L.x*C,r.ctrlpts[1]=N[1]+L.y*C)}if(y||m||T){D=!0;var B={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},O=Math.sqrt(B.x*B.x+B.y*B.y),F={x:B.x/O,y:B.y/O},G=Math.max(i,o),k={x:r.ctrlpts[0]+F.x*2*G,y:r.ctrlpts[1]+F.y*2*G},z=f.intersectLine(n.x,n.y,s,u,k.x,k.y,0,c,d);T?(r.ctrlpts[0]=r.ctrlpts[0]+F.x*(C-x),r.ctrlpts[1]=r.ctrlpts[1]+F.y*(C-x)):(r.ctrlpts[0]=z[0]+F.x*C,r.ctrlpts[1]=z[1]+F.y*C)}D&&this.findEndpoints(t)}};yt.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=ot(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=ot(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(bs({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var v={x:e.segpts[f],y:e.segpts[f+1]},c=e.roundCorners[f/2];if(c.radius===0){var h={x:e.segpts[f+2],y:e.segpts[f+3]};e.midX=v.x,e.midY=v.y,e.midVector=[v.y-h.y,h.x-v.x]}else{var d=[v.x-c.cx,v.y-c.cy],p=c.radius/Math.sqrt(Math.pow(d[0],2)+Math.pow(d[1],2));d=d.map(function(g){return g*p}),e.midX=c.cx+d[0],e.midY=c.cy+d[1],e.midVector=d}}}}};yt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||ae(e.startX)&&ae(e.startY)&&ae(e.endX)&&ae(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Ne("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};yt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i=new $t,o=function(T,D){return[].concat(En(T),[D?1:0]).join("-")},s=[],u=[],l=0;l<t.length;l++){var f=t[l],v=f._private,c=f.pstyle("curve-style").value;if(!(f.removed()||!f.takesUpSpace())){if(c==="haystack"){u.push(f);continue}var h=c==="unbundled-bezier"||ar(c,"segments")||c==="straight"||c==="straight-triangle"||ar(c,"taxi"),d=c==="unbundled-bezier"||c==="bezier",p=v.source,g=v.target,y=p.poolIndex(),m=g.poolIndex(),b=[y,m].sort(),E=o(b,h),C=i.get(E);C==null&&(C={eles:[]},s.push({pairId:b,edgeIsUnbundled:h}),i.set(E,C)),C.eles.push(f),h&&(C.hasUnbundled=!0),d&&(C.hasBezier=!0)}}for(var A=function(){var T=s[w],D=T.pairId,S=T.edgeIsUnbundled,R=o(D,S),L=i.get(R),M;if(!L.hasUnbundled){var I=L.eles[0].parallelEdges().filter(function(ue){return ue.isBundledBezier()});ns(L.eles),I.forEach(function(ue){return L.eles.push(ue)}),L.eles.sort(function(ue,J){return ue.poolIndex()-J.poolIndex()})}var N=L.eles[0],B=N.source(),O=N.target();if(B.poolIndex()>O.poolIndex()){var F=B;B=O,O=F}var G=L.srcPos=B.position(),k=L.tgtPos=O.position(),z=L.srcW=B.outerWidth(),U=L.srcH=B.outerHeight(),H=L.tgtW=O.outerWidth(),$=L.tgtH=O.outerHeight(),K=L.srcShape=r.nodeShapes[e.getNodeShape(B)],j=L.tgtShape=r.nodeShapes[e.getNodeShape(O)],re=L.srcCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,Q=L.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,_=L.tgtRs=O._private.rscratch,q=L.srcRs=B._private.rscratch;L.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Y=0;Y<L.eles.length;Y++){var ee=L.eles[Y],ne=ee[0]._private.rscratch,be=ee.pstyle("curve-style").value,Ge=be==="unbundled-bezier"||ar(be,"segments")||ar(be,"taxi"),Le=!B.same(ee.source());if(!L.calculatedIntersection&&B!==O&&(L.hasBezier||L.hasUnbundled)){L.calculatedIntersection=!0;var se=K.intersectLine(G.x,G.y,z,U,k.x,k.y,0,re,q),fe=L.srcIntn=se,de=j.intersectLine(k.x,k.y,H,$,G.x,G.y,0,Q,_),ye=L.tgtIntn=de,me=L.intersectionPts={x1:se[0],x2:de[0],y1:se[1],y2:de[1]},we=L.posPts={x1:G.x,x2:k.x,y1:G.y,y2:k.y},Ee=de[1]-se[1],Re=de[0]-se[0],ze=Math.sqrt(Re*Re+Ee*Ee);ae(ze)&&ze>=ny||(ze=Math.sqrt(Math.max(Re*Re,Ia)+Math.max(Ee*Ee,Ia)));var $e=L.vector={x:Re,y:Ee},Be=L.vectorNorm={x:$e.x/ze,y:$e.y/ze},qe={x:-Be.y,y:Be.x};L.nodesOverlap=!ae(ze)||j.checkPoint(se[0],se[1],0,H,$,k.x,k.y,Q,_)||K.checkPoint(de[0],de[1],0,z,U,G.x,G.y,re,q),L.vectorNormInverse=qe,M={nodesOverlap:L.nodesOverlap,dirCounts:L.dirCounts,calculatedIntersection:!0,hasBezier:L.hasBezier,hasUnbundled:L.hasUnbundled,eles:L.eles,srcPos:k,srcRs:_,tgtPos:G,tgtRs:q,srcW:H,srcH:$,tgtW:z,tgtH:U,srcIntn:ye,tgtIntn:fe,srcShape:j,tgtShape:K,posPts:{x1:we.x2,y1:we.y2,x2:we.x1,y2:we.y1},intersectionPts:{x1:me.x2,y1:me.y2,x2:me.x1,y2:me.y1},vector:{x:-$e.x,y:-$e.y},vectorNorm:{x:-Be.x,y:-Be.y},vectorNormInverse:{x:-qe.x,y:-qe.y}}}var Se=Le?M:L;ne.nodesOverlap=Se.nodesOverlap,ne.srcIntn=Se.srcIntn,ne.tgtIntn=Se.tgtIntn,ne.isRound=be.startsWith("round"),n&&(B.isParent()||B.isChild()||O.isParent()||O.isChild())&&(B.parents().anySame(O)||O.parents().anySame(B)||B.same(O)&&B.isParent())?e.findCompoundLoopPoints(ee,Se,Y,Ge):B===O?e.findLoopPoints(ee,Se,Y,Ge):be.endsWith("segments")?e.findSegmentsPoints(ee,Se):be.endsWith("taxi")?e.findTaxiPoints(ee,Se):be==="straight"||!Ge&&L.eles.length%2===1&&Y===Math.floor(L.eles.length/2)?e.findStraightEdgePoints(ee):e.findBezierPoints(ee,Se,Y,Ge,Le),e.findEndpoints(ee),e.tryToCorrectInvalidPoints(ee,Se),e.checkForInvalidEdgeWarning(ee),e.storeAllpts(ee),e.storeEdgeProjections(ee),e.calculateArrowAngles(ee),e.recalculateEdgeLabelProjections(ee),e.calculateLabelAngles(ee)}},w=0;w<s.length;w++)A();this.findHaystackPoints(u)}};function wv(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}yt.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return wv(e.segpts)};yt.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return wv(e.ctrlpts)};yt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Ua={};Ua.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(n,i),f=[a.x+Math.cos(u)*l,a.y+Math.sin(u)*l];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};Ua.findEndpoints=function(t){var e,r,a,n,i=this,o,s=t.source()[0],u=t.target()[0],l=s.position(),f=u.position(),v=t.pstyle("target-arrow-shape").value,c=t.pstyle("source-arrow-shape").value,h=t.pstyle("target-distance-from-node").pfValue,d=t.pstyle("source-distance-from-node").pfValue,p=s._private.rscratch,g=u._private.rscratch,y=t.pstyle("curve-style").value,m=t._private.rscratch,b=m.edgeType,E=ar(y,"taxi"),C=b==="self"||b==="compound",A=b==="bezier"||b==="multibezier"||C,w=b!=="bezier",x=b==="straight"||b==="segments",T=b==="segments",D=A||w||x,S=C||E,R=t.pstyle("source-endpoint"),L=S?"outside-to-node":R.value,M=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,I=t.pstyle("target-endpoint"),N=S?"outside-to-node":I.value,B=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;m.srcManEndpt=R,m.tgtManEndpt=I;var O,F,G,k,z=(e=(I==null||(r=I.pfValue)===null||r===void 0?void 0:r.length)===2?I.pfValue:null)!==null&&e!==void 0?e:[0,0],U=(a=(R==null||(n=R.pfValue)===null||n===void 0?void 0:n.length)===2?R.pfValue:null)!==null&&a!==void 0?a:[0,0];if(A){var H=[m.ctrlpts[0],m.ctrlpts[1]],$=w?[m.ctrlpts[m.ctrlpts.length-2],m.ctrlpts[m.ctrlpts.length-1]]:H;O=$,F=H}else if(x){var K=T?m.segpts.slice(0,2):[f.x+z[0],f.y+z[1]],j=T?m.segpts.slice(m.segpts.length-2):[l.x+U[0],l.y+U[1]];O=j,F=K}if(N==="inside-to-node")o=[f.x,f.y];else if(I.units)o=this.manualEndptToPx(u,I);else if(N==="outside-to-line")o=m.tgtIntn;else if(N==="outside-to-node"||N==="outside-to-node-or-label"?G=O:(N==="outside-to-line"||N==="outside-to-line-or-label")&&(G=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),G[0],G[1],0,B,g),N==="outside-to-node-or-label"||N==="outside-to-line-or-label"){var re=u._private.rscratch,Q=re.labelWidth,_=re.labelHeight,q=re.labelX,Y=re.labelY,ee=Q/2,ne=_/2,be=u.pstyle("text-valign").value;be==="top"?Y-=ne:be==="bottom"&&(Y+=ne);var Ge=u.pstyle("text-halign").value;Ge==="left"?q-=ee:Ge==="right"&&(q+=ee);var Le=Aa(G[0],G[1],[q-ee,Y-ne,q+ee,Y-ne,q+ee,Y+ne,q-ee,Y+ne],f.x,f.y);if(Le.length>0){var se=l,fe=Er(se,qr(o)),de=Er(se,qr(Le)),ye=fe;if(de<fe&&(o=Le,ye=de),Le.length>2){var me=Er(se,{x:Le[2],y:Le[3]});me<ye&&(o=[Le[2],Le[3]])}}}var we=Za(o,O,i.arrowShapes[v].spacing(t)+h),Ee=Za(o,O,i.arrowShapes[v].gap(t)+h);if(m.endX=Ee[0],m.endY=Ee[1],m.arrowEndX=we[0],m.arrowEndY=we[1],L==="inside-to-node")o=[l.x,l.y];else if(R.units)o=this.manualEndptToPx(s,R);else if(L==="outside-to-line")o=m.srcIntn;else if(L==="outside-to-node"||L==="outside-to-node-or-label"?k=F:(L==="outside-to-line"||L==="outside-to-line-or-label")&&(k=[f.x,f.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),k[0],k[1],0,M,p),L==="outside-to-node-or-label"||L==="outside-to-line-or-label"){var Re=s._private.rscratch,ze=Re.labelWidth,$e=Re.labelHeight,Be=Re.labelX,qe=Re.labelY,Se=ze/2,ue=$e/2,J=s.pstyle("text-valign").value;J==="top"?qe-=ue:J==="bottom"&&(qe+=ue);var P=s.pstyle("text-halign").value;P==="left"?Be-=Se:P==="right"&&(Be+=Se);var V=Aa(k[0],k[1],[Be-Se,qe-ue,Be+Se,qe-ue,Be+Se,qe+ue,Be-Se,qe+ue],l.x,l.y);if(V.length>0){var X=f,W=Er(X,qr(o)),Z=Er(X,qr(V)),oe=W;if(Z<W&&(o=[V[0],V[1]],oe=Z),V.length>2){var te=Er(X,{x:V[2],y:V[3]});te<oe&&(o=[V[2],V[3]])}}}var ve=Za(o,F,i.arrowShapes[c].spacing(t)+d),le=Za(o,F,i.arrowShapes[c].gap(t)+d);m.startX=le[0],m.startY=le[1],m.arrowStartX=ve[0],m.arrowStartY=ve[1],D&&(!ae(m.startX)||!ae(m.startY)||!ae(m.endX)||!ae(m.endY)?m.badLine=!0:m.badLine=!1)};Ua.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Ua.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var ws={};function iy(t,e,r){for(var a=function(l,f,v,c){return ot(l,f,v,c)},n=e._private,i=n.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var s=t.bezierProjPcts[o];i.push({x:a(r[0],r[2],r[4],s),y:a(r[1],r[3],r[5],s)})}}ws.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<r.allpts.length;n+=4)iy(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};ws.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Ut={};Ut.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!sr(e)){var r,a,n=t._private,i=t.width(),o=t.height(),s=t.padding(),u=t.position(),l=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,v=n.rscratch,c=n.rstyle;switch(l){case"left":r=u.x-i/2-s;break;case"right":r=u.x+i/2+s;break;default:r=u.x}switch(f){case"top":a=u.y-o/2-s;break;case"bottom":a=u.y+o/2+s;break;default:a=u.y}v.labelX=r,v.labelY=a,c.labelX=r,c.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Ev=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},xv=function(e,r){var a=r.x-e.x,n=r.y-e.y;return Ev(a,n)},oy=function(e,r,a,n){var i=Sa(0,n-.001,1),o=Sa(0,n+.001,1),s=Xr(e,r,a,i),u=Xr(e,r,a,o);return xv(s,u)};Ut.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var o=function(v,c,h){Wt(r.rscratch,v,c,h),Wt(r.rstyle,v,c,h)};o("labelX",null,e.x),o("labelY",null,e.y);var s=Ev(a.midDispX,a.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var v=[],c=0;c+5<a.allpts.length;c+=4){var h={x:a.allpts[c],y:a.allpts[c+1]},d={x:a.allpts[c+2],y:a.allpts[c+3]},p={x:a.allpts[c+4],y:a.allpts[c+5]};v.push({p0:h,p1:d,p2:p,startDist:0,length:0,segments:[]})}var g=r.rstyle.bezierPts,y=n.bezierProjPcts.length;function m(w,x,T,D,S){var R=Ar(x,T),L=w.segments[w.segments.length-1],M={p0:x,p1:T,t0:D,t1:S,startDist:L?L.startDist+L.length:0,length:R};w.segments.push(M),w.length+=R}for(var b=0;b<v.length;b++){var E=v[b],C=v[b-1];C&&(E.startDist=C.startDist+C.length),m(E,E.p0,g[b*y],0,n.bezierProjPcts[0]);for(var A=0;A<y-1;A++)m(E,g[b*y+A],g[b*y+A+1],n.bezierProjPcts[A],n.bezierProjPcts[A+1]);m(E,g[b*y+y-1],E.p2,n.bezierProjPcts[y-1],1)}return u.cache=v},l=function(v){var c,h=v==="source";if(i[v]){var d=t.pstyle(v+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var p=u(),g,y=0,m=0,b=0;b<p.length;b++){for(var E=p[h?b:p.length-1-b],C=0;C<E.segments.length;C++){var A=E.segments[h?C:E.segments.length-1-C],w=b===p.length-1&&C===E.segments.length-1;if(y=m,m+=A.length,m>=d||w){g={cp:E,segment:A};break}}if(g)break}var x=g.cp,T=g.segment,D=(d-y)/T.length,S=T.t1-T.t0,R=h?T.t0+S*D:T.t1-S*D;R=Sa(0,R,1),e=Xr(x.p0,x.p1,x.p2,R),c=oy(x.p0,x.p1,x.p2,R);break}case"straight":case"segments":case"haystack":{for(var L=0,M,I,N,B,O=a.allpts.length,F=0;F+3<O&&(h?(N={x:a.allpts[F],y:a.allpts[F+1]},B={x:a.allpts[F+2],y:a.allpts[F+3]}):(N={x:a.allpts[O-2-F],y:a.allpts[O-1-F]},B={x:a.allpts[O-4-F],y:a.allpts[O-3-F]}),M=Ar(N,B),I=L,L+=M,!(L>=d));F+=2);var G=d-I,k=G/M;k=Sa(0,k,1),e=Dh(N,B,k),c=xv(N,B);break}}o("labelX",v,e.x),o("labelY",v,e.y),o("labelAutoAngle",v,c)}};l("source"),l("target"),this.applyLabelDimensions(t)}};Ut.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Ut.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=Sr(a,t._private.labelDimsKey);if(Ct(r.rscratch,"prefixedLabelDimsKey",e)!==n){Wt(r.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,u=Ct(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(u.length,1),f=i.height/l,v=f*o,c=i.width,h=i.height+(l-1)*(o-1)*f;Wt(r.rstyle,"labelWidth",e,c),Wt(r.rscratch,"labelWidth",e,c),Wt(r.rstyle,"labelHeight",e,h),Wt(r.rscratch,"labelHeight",e,h),Wt(r.rscratch,"labelLineHeight",e,v)}};Ut.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,o=function(U,H){return H?(Wt(r.rscratch,U,e,H),H):Ct(r.rscratch,U,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=t.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="​",f=n.split(`
15
+ `),v=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],p=/[\s\u200b]+|$/g,g=0;g<f.length;g++){var y=f[g],m=this.calculateLabelDimensions(t,y),b=m.width;if(h){var E=y.split("").join(l);y=E}if(b>v){var C=y.matchAll(p),A="",w=0,x=St(C),T;try{for(x.s();!(T=x.n()).done;){var D=T.value,S=D[0],R=y.substring(w,D.index);w=D.index+S.length;var L=A.length===0?R:A+R+S,M=this.calculateLabelDimensions(t,L),I=M.width;I<=v?A+=R+S:(A&&d.push(A),A=R+S)}}catch(z){x.e(z)}finally{x.f()}A.match(/^[\s\u200b]+$/)||d.push(A)}else d.push(y)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(`
16
+ `)),o("labelWrapKey",u)}else if(s==="ellipsis"){var N=t.pstyle("text-max-width").pfValue,B="",O="…",F=!1;if(this.calculateLabelDimensions(t,n).width<N)return n;for(var G=0;G<n.length;G++){var k=this.calculateLabelDimensions(t,B+n[G]+O).width;if(k>N)break;B+=n[G],G===n.length-1&&(F=!0)}return F||(B+=O),B}return n};Ut.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Ut.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),n=a.document,i=0,o=t.pstyle("font-style").strValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,l=t.pstyle("font-weight").strValue,f=this.labelCalcCanvas,v=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=n.createElement("canvas"),v=this.labelCalcCanvasContext=f.getContext("2d");var c=f.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}v.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var h=0,d=0,p=e.split(`
17
+ `),g=0;g<p.length;g++){var y=p[g],m=v.measureText(y),b=Math.ceil(m.width),E=s;h=Math.max(b,h),d+=E}return h+=i,d+=i,{width:h,height:d}};Ut.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:n&&s==="autorotate"?a.labelAutoAngle:s==="autorotate"?0:o.pfValue};Ut.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var Tv={},Bl=28,kl=!1;Tv.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<Bl||t.height()<Bl))return kl||(Ne("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),kl=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var Qn={};Qn.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u],f=l._private,v=f.rstyle;v.clean=!1,v.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var s=o.target;a(s)}).on("style.* background.*",function(o){var s=o.target;a(s,!1)});var n=function(o){if(o){var s=r.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],f=l._private.rstyle;l.isNode()&&!f.cleanConnected&&(a(l.connectedEdges()),f.cleanConnected=!0)}if(s)for(var v=0;v<s.length;v++){var c=s[v];c(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)};Qn.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};Qn.recalculateRenderedStyle=function(t,e){var r=function(E){return E._private.rstyle.cleanConnected};if(t.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i],s=o._private,u=s.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?n.push(o):a.push(o),u.clean=!0)}for(var l=0;l<n.length;l++){var f=n[l],v=f._private,c=v.rstyle,h=f.position();this.recalculateNodeLabelProjection(f),c.nodeX=h.x,c.nodeY=h.y,c.nodeW=f.pstyle("width").pfValue,c.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var p=a[d],g=p._private,y=g.rstyle,m=g.rscratch;y.srcX=m.arrowStartX,y.srcY=m.arrowStartY,y.tgtX=m.arrowEndX,y.tgtY=m.arrowEndY,y.midX=m.midX,y.midY=m.midY,y.labelAngle=m.labelAngle,y.sourceLabelAngle=m.sourceLabelAngle,y.targetLabelAngle=m.targetLabelAngle}}}};var Jn={};Jn.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};Jn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Jn.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(nv),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var Cv={};[Pr,Pn,yt,Ua,ws,Ut,Tv,Qn,Jn].forEach(function(t){pe(Cv,t)});var Dv={};Dv.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var o=i.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var s="data:",u=t.substring(0,s.length).toLowerCase()===s;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var ia={};ia.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var i=[],o=0;o<t.length;o++){var s=t[o];if(s!==void 0){var u=this.binder(s);i.push(u.on.apply(u,n))}}return i}var u=this.binder(t);return u.on.apply(u,n)};ia.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||mc(t);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var o=function(u,l,f){var v=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(v[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:v}),(t.addEventListener||t.on).apply(t,v),this};return{on:o,addEventListener:o,addListener:o,bind:o}};ia.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};ia.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};ia.load=function(){var t=this,e=t.cy.window(),r=function(P){return P.selected()},a=function(P){var V=P.getRootNode();if(V&&V.nodeType===11&&V.host!==void 0)return V},n=function(P,V,X,W){P==null&&(P=t.cy);for(var Z=0;Z<V.length;Z++){var oe=V[Z];P.emit({originalEvent:X,type:oe,position:W})}},i=function(P){return P.shiftKey||P.metaKey||P.ctrlKey},o=function(P,V){var X=!0;if(t.cy.hasCompoundNodes()&&P&&P.pannable())for(var W=0;V&&W<V.length;W++){var P=V[W];if(P.isNode()&&P.isParent()&&!P.pannable()){X=!1;break}}else X=!0;return X},s=function(P){P[0]._private.grabbed=!0},u=function(P){P[0]._private.grabbed=!1},l=function(P){P[0]._private.rscratch.inDragLayer=!0},f=function(P){P[0]._private.rscratch.inDragLayer=!1},v=function(P){P[0]._private.rscratch.isGrabTarget=!0},c=function(P){P[0]._private.rscratch.isGrabTarget=!1},h=function(P,V){var X=V.addToList,W=X.has(P);!W&&P.grabbable()&&!P.locked()&&(X.merge(P),s(P))},d=function(P,V){if(P.cy().hasCompoundNodes()&&!(V.inDragLayer==null&&V.addToList==null)){var X=P.descendants();V.inDragLayer&&(X.forEach(l),X.connectedEdges().forEach(l)),V.addToList&&h(X,V)}},p=function(P,V){V=V||{};var X=P.cy().hasCompoundNodes();V.inDragLayer&&(P.forEach(l),P.neighborhood().stdFilter(function(W){return!X||W.isEdge()}).forEach(l)),V.addToList&&P.forEach(function(W){h(W,V)}),d(P,V),m(P,{inDragLayer:V.inDragLayer}),t.updateCachedGrabbedEles()},g=p,y=function(P){P&&(t.getCachedZSortedEles().forEach(function(V){u(V),f(V),c(V)}),t.updateCachedGrabbedEles())},m=function(P,V){if(!(V.inDragLayer==null&&V.addToList==null)&&P.cy().hasCompoundNodes()){var X=P.ancestors().orphans();if(!X.same(P)){var W=X.descendants().spawnSelf().merge(X).unmerge(P).unmerge(P.descendants()),Z=W.connectedEdges();V.inDragLayer&&(Z.forEach(l),W.forEach(l)),V.addToList&&W.forEach(function(oe){h(oe,V)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},E=typeof MutationObserver<"u",C=typeof ResizeObserver<"u";E?(t.removeObserver=new MutationObserver(function(J){for(var P=0;P<J.length;P++){var V=J[P],X=V.removedNodes;if(X)for(var W=0;W<X.length;W++){var Z=X[W];if(Z===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(J){t.destroy()});var A=Ga(function(){t.cy.resize()},100);E&&(t.styleObserver=new MutationObserver(A),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",A),C&&(t.resizeObserver=new ResizeObserver(A),t.resizeObserver.observe(t.container));var w=function(P,V){for(;P!=null;)V(P),P=P.parentNode},x=function(){t.invalidateContainerClientCoordsCache()};w(t.container,function(J){t.registerBinding(J,"transitionend",x),t.registerBinding(J,"animationend",x),t.registerBinding(J,"scroll",x)}),t.registerBinding(t.container,"contextmenu",function(J){J.preventDefault()});var T=function(){return t.selection[4]!==0},D=function(P){for(var V=t.findContainerClientCoords(),X=V[0],W=V[1],Z=V[2],oe=V[3],te=P.touches?P.touches:[P],ve=!1,le=0;le<te.length;le++){var ge=te[le];if(X<=ge.clientX&&ge.clientX<=X+Z&&W<=ge.clientY&&ge.clientY<=W+oe){ve=!0;break}}if(!ve)return!1;for(var Ce=t.container,xe=P.target,ce=xe.parentNode,Ae=!1;ce;){if(ce===Ce){Ae=!0;break}ce=ce.parentNode}return!!Ae};t.registerBinding(t.container,"mousedown",function(P){if(D(P)&&!(t.hoverData.which===1&&P.which!==1)){P.preventDefault(),b(),t.hoverData.capture=!0,t.hoverData.which=P.which;var V=t.cy,X=[P.clientX,P.clientY],W=t.projectIntoViewport(X[0],X[1]),Z=t.selection,oe=t.findNearestElements(W[0],W[1],!0,!1),te=oe[0],ve=t.dragData.possibleDragElements;t.hoverData.mdownPos=W,t.hoverData.mdownGPos=X;var le=function(De){return{originalEvent:P,type:De,position:{x:W[0],y:W[1]}}},ge=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var De=t.hoverData.down;De?De.emit(le("taphold")):V.emit(le("taphold"))}},t.tapholdDuration)};if(P.which==3){t.hoverData.cxtStarted=!0;var Ce={originalEvent:P,type:"cxttapstart",position:{x:W[0],y:W[1]}};te?(te.activate(),te.emit(Ce),t.hoverData.down=te):V.emit(Ce),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(P.which==1){te&&te.activate();{if(te!=null&&t.nodeIsGrabbable(te)){var xe=function(De){De.emit(le("grab"))};if(v(te),!te.selected())ve=t.dragData.possibleDragElements=V.collection(),g(te,{addToList:ve}),te.emit(le("grabon")).emit(le("grab"));else{ve=t.dragData.possibleDragElements=V.collection();var ce=V.$(function(Ae){return Ae.isNode()&&Ae.selected()&&t.nodeIsGrabbable(Ae)});p(ce,{addToList:ve}),te.emit(le("grabon")),ce.forEach(xe)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=te,t.hoverData.downs=oe,t.hoverData.downTime=new Date().getTime()}n(te,["mousedown","tapstart","vmousedown"],P,{x:W[0],y:W[1]}),te==null?(Z[4]=1,t.data.bgActivePosistion={x:W[0],y:W[1]},t.redrawHint("select",!0),t.redraw()):te.pannable()&&(Z[4]=1),ge()}Z[0]=Z[2]=W[0],Z[1]=Z[3]=W[1]}},!1);var S=a(t.container);t.registerBinding([e,S],"mousemove",function(P){var V=t.hoverData.capture;if(!(!V&&!D(P))){var X=!1,W=t.cy,Z=W.zoom(),oe=[P.clientX,P.clientY],te=t.projectIntoViewport(oe[0],oe[1]),ve=t.hoverData.mdownPos,le=t.hoverData.mdownGPos,ge=t.selection,Ce=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Ce=t.findNearestElement(te[0],te[1],!0,!1));var xe=t.hoverData.last,ce=t.hoverData.down,Ae=[te[0]-ge[2],te[1]-ge[3]],De=t.dragData.possibleDragElements,Je;if(le){var Xe=oe[0]-le[0],mt=Xe*Xe,Ke=oe[1]-le[1],it=Ke*Ke,je=mt+it;t.hoverData.isOverThresholdDrag=Je=je>=t.desktopTapThreshold2}var lt=i(P);Je&&(t.hoverData.tapholdCancelled=!0);var jt=function(){var Lt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Lt.length===0?(Lt.push(Ae[0]),Lt.push(Ae[1])):(Lt[0]+=Ae[0],Lt[1]+=Ae[1])};X=!0,n(Ce,["mousemove","vmousemove","tapdrag"],P,{x:te[0],y:te[1]});var Ze=function(Lt){return{originalEvent:P,type:Lt,position:{x:te[0],y:te[1]}}},Yt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||W.emit(Ze("boxstart")),ge[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Je){var Ht=Ze("cxtdrag");ce?ce.emit(Ht):W.emit(Ht),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Ce!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(Ze("cxtdragout")),t.hoverData.cxtOver=Ce,Ce&&Ce.emit(Ze("cxtdragover")))}}else if(t.hoverData.dragging){if(X=!0,W.panningEnabled()&&W.userPanningEnabled()){var Or;if(t.hoverData.justStartedPan){var Ha=t.hoverData.mdownPos;Or={x:(te[0]-Ha[0])*Z,y:(te[1]-Ha[1])*Z},t.hoverData.justStartedPan=!1}else Or={x:Ae[0]*Z,y:Ae[1]*Z};W.panBy(Or),W.emit(Ze("dragpan")),t.hoverData.dragged=!0}te=t.projectIntoViewport(P.clientX,P.clientY)}else if(ge[4]==1&&(ce==null||ce.pannable())){if(Je){if(!t.hoverData.dragging&&W.boxSelectionEnabled()&&(lt||!W.panningEnabled()||!W.userPanningEnabled()))Yt();else if(!t.hoverData.selecting&&W.panningEnabled()&&W.userPanningEnabled()){var mr=o(ce,t.hoverData.downs);mr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ge[4]=0,t.data.bgActivePosistion=qr(ve),t.redrawHint("select",!0),t.redraw())}ce&&ce.pannable()&&ce.active()&&ce.unactivate()}}else{if(ce&&ce.pannable()&&ce.active()&&ce.unactivate(),(!ce||!ce.grabbed())&&Ce!=xe&&(xe&&n(xe,["mouseout","tapdragout"],P,{x:te[0],y:te[1]}),Ce&&n(Ce,["mouseover","tapdragover"],P,{x:te[0],y:te[1]}),t.hoverData.last=Ce),ce)if(Je){if(W.boxSelectionEnabled()&&lt)ce&&ce.grabbed()&&(y(De),ce.emit(Ze("freeon")),De.emit(Ze("free")),t.dragData.didDrag&&(ce.emit(Ze("dragfreeon")),De.emit(Ze("dragfree")))),Yt();else if(ce&&ce.grabbed()&&t.nodeIsDraggable(ce)){var xt=!t.dragData.didDrag;xt&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||p(De,{inDragLayer:!0});var dt={x:0,y:0};if(ae(Ae[0])&&ae(Ae[1])&&(dt.x+=Ae[0],dt.y+=Ae[1],xt)){var Tt=t.hoverData.dragDelta;Tt&&ae(Tt[0])&&ae(Tt[1])&&(dt.x+=Tt[0],dt.y+=Tt[1])}t.hoverData.draggingEles=!0,De.silentShift(dt).emit(Ze("position")).emit(Ze("drag")),t.redrawHint("drag",!0),t.redraw()}}else jt();X=!0}if(ge[2]=te[0],ge[3]=te[1],X)return P.stopPropagation&&P.stopPropagation(),P.preventDefault&&P.preventDefault(),!1}},!1);var R,L,M;t.registerBinding(e,"mouseup",function(P){if(!(t.hoverData.which===1&&P.which!==1&&t.hoverData.capture)){var V=t.hoverData.capture;if(V){t.hoverData.capture=!1;var X=t.cy,W=t.projectIntoViewport(P.clientX,P.clientY),Z=t.selection,oe=t.findNearestElement(W[0],W[1],!0,!1),te=t.dragData.possibleDragElements,ve=t.hoverData.down,le=i(P);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ve&&ve.unactivate();var ge=function(Xe){return{originalEvent:P,type:Xe,position:{x:W[0],y:W[1]}}};if(t.hoverData.which===3){var Ce=ge("cxttapend");if(ve?ve.emit(Ce):X.emit(Ce),!t.hoverData.cxtDragged){var xe=ge("cxttap");ve?ve.emit(xe):X.emit(xe)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(oe,["mouseup","tapend","vmouseup"],P,{x:W[0],y:W[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ve,["click","tap","vclick"],P,{x:W[0],y:W[1]}),L=!1,P.timeStamp-M<=X.multiClickDebounceTime()?(R&&clearTimeout(R),L=!0,M=null,n(ve,["dblclick","dbltap","vdblclick"],P,{x:W[0],y:W[1]})):(R=setTimeout(function(){L||n(ve,["oneclick","onetap","voneclick"],P,{x:W[0],y:W[1]})},X.multiClickDebounceTime()),M=P.timeStamp)),ve==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(P)&&(X.$(r).unselect(["tapunselect"]),te.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=te=X.collection()),oe==ve&&!t.dragData.didDrag&&!t.hoverData.selecting&&oe!=null&&oe._private.selectable&&(t.hoverData.dragging||(X.selectionType()==="additive"||le?oe.selected()?oe.unselect(["tapunselect"]):oe.select(["tapselect"]):le||(X.$(r).unmerge(oe).unselect(["tapunselect"]),oe.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ce=X.collection(t.getAllInBox(Z[0],Z[1],Z[2],Z[3]));t.redrawHint("select",!0),ce.length>0&&t.redrawHint("eles",!0),X.emit(ge("boxend"));var Ae=function(Xe){return Xe.selectable()&&!Xe.selected()};X.selectionType()==="additive"||le||X.$(r).unmerge(ce).unselect(),ce.emit(ge("box")).stdFilter(Ae).select().emit(ge("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Z[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var De=ve&&ve.grabbed();y(te),De&&(ve.emit(ge("freeon")),te.emit(ge("free")),t.dragData.didDrag&&(ve.emit(ge("dragfreeon")),te.emit(ge("dragfree"))))}}Z[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var I=[],N=4,B,O=1e5,F=function(P,V){for(var X=0;X<P.length;X++)if(P[X]%V!==0)return!1;return!0},G=function(P){for(var V=Math.abs(P[0]),X=1;X<P.length;X++)if(Math.abs(P[X])!==V)return!1;return!0},k=function(P){var V=!1,X=P.deltaY;if(X==null&&(P.wheelDeltaY!=null?X=P.wheelDeltaY/4:P.wheelDelta!=null&&(X=P.wheelDelta/4)),B==null)if(I.length>=N){var W=I;if(B=F(W,5),!B){var Z=Math.abs(W[0]);B=G(W)&&Z>5}if(B)for(var oe=0;oe<W.length;oe++)O=Math.min(Math.abs(W[oe]),O)}else I.push(X),V=!0;else B&&(O=Math.min(Math.abs(X),O));if(!t.scrollingPage){var te=t.cy,ve=te.zoom(),le=te.pan(),ge=t.projectIntoViewport(P.clientX,P.clientY),Ce=[ge[0]*ve+le.x,ge[1]*ve+le.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||T()){P.preventDefault();return}if(te.panningEnabled()&&te.userPanningEnabled()&&te.zoomingEnabled()&&te.userZoomingEnabled()){P.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var xe;V&&Math.abs(X)>5&&(X=os(X)*5),xe=X/-250,B&&(xe/=O,xe*=3),xe=xe*t.wheelSensitivity;var ce=P.deltaMode===1;ce&&(xe*=33);var Ae=te.zoom()*Math.pow(10,xe);P.type==="gesturechange"&&(Ae=t.gestureStartZoom*P.scale),te.zoom({level:Ae,renderedPosition:{x:Ce[0],y:Ce[1]}}),te.emit({type:P.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:P,position:{x:ge[0],y:ge[1]}})}}};t.registerBinding(t.container,"wheel",k,!0),t.registerBinding(e,"scroll",function(P){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(P){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||P.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(J){t.hasTouchStarted||k(J)},!0),t.registerBinding(t.container,"mouseout",function(P){var V=t.projectIntoViewport(P.clientX,P.clientY);t.cy.emit({originalEvent:P,type:"mouseout",position:{x:V[0],y:V[1]}})},!1),t.registerBinding(t.container,"mouseover",function(P){var V=t.projectIntoViewport(P.clientX,P.clientY);t.cy.emit({originalEvent:P,type:"mouseover",position:{x:V[0],y:V[1]}})},!1);var z,U,H,$,K,j,re,Q,_,q,Y,ee,ne,be=function(P,V,X,W){return Math.sqrt((X-P)*(X-P)+(W-V)*(W-V))},Ge=function(P,V,X,W){return(X-P)*(X-P)+(W-V)*(W-V)},Le;t.registerBinding(t.container,"touchstart",Le=function(P){if(t.hasTouchStarted=!0,!!D(P)){b(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var V=t.cy,X=t.touchData.now,W=t.touchData.earlier;if(P.touches[0]){var Z=t.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);X[0]=Z[0],X[1]=Z[1]}if(P.touches[1]){var Z=t.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);X[2]=Z[0],X[3]=Z[1]}if(P.touches[2]){var Z=t.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);X[4]=Z[0],X[5]=Z[1]}var oe=function(lt){return{originalEvent:P,type:lt,position:{x:X[0],y:X[1]}}};if(P.touches[1]){t.touchData.singleTouchMoved=!0,y(t.dragData.touchDragEles);var te=t.findContainerClientCoords();_=te[0],q=te[1],Y=te[2],ee=te[3],z=P.touches[0].clientX-_,U=P.touches[0].clientY-q,H=P.touches[1].clientX-_,$=P.touches[1].clientY-q,ne=0<=z&&z<=Y&&0<=H&&H<=Y&&0<=U&&U<=ee&&0<=$&&$<=ee;var ve=V.pan(),le=V.zoom();K=be(z,U,H,$),j=Ge(z,U,H,$),re=[(z+H)/2,(U+$)/2],Q=[(re[0]-ve.x)/le,(re[1]-ve.y)/le];var ge=200,Ce=ge*ge;if(j<Ce&&!P.touches[2]){var xe=t.findNearestElement(X[0],X[1],!0,!0),ce=t.findNearestElement(X[2],X[3],!0,!0);xe&&xe.isNode()?(xe.activate().emit(oe("cxttapstart")),t.touchData.start=xe):ce&&ce.isNode()?(ce.activate().emit(oe("cxttapstart")),t.touchData.start=ce):V.emit(oe("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(P.touches[2])V.boxSelectionEnabled()&&P.preventDefault();else if(!P.touches[1]){if(P.touches[0]){var Ae=t.findNearestElements(X[0],X[1],!0,!0),De=Ae[0];if(De!=null&&(De.activate(),t.touchData.start=De,t.touchData.starts=Ae,t.nodeIsGrabbable(De))){var Je=t.dragData.touchDragEles=V.collection(),Xe=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),De.selected()?(Xe=V.$(function(je){return je.selected()&&t.nodeIsGrabbable(je)}),p(Xe,{addToList:Je})):g(De,{addToList:Je}),v(De),De.emit(oe("grabon")),Xe?Xe.forEach(function(je){je.emit(oe("grab"))}):De.emit(oe("grab"))}n(De,["touchstart","tapstart","vmousedown"],P,{x:X[0],y:X[1]}),De==null&&(t.data.bgActivePosistion={x:Z[0],y:Z[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&n(t.touchData.start,["taphold"],P,{x:X[0],y:X[1]})},t.tapholdDuration)}}if(P.touches.length>=1){for(var mt=t.touchData.startPosition=[null,null,null,null,null,null],Ke=0;Ke<X.length;Ke++)mt[Ke]=W[Ke]=X[Ke];var it=P.touches[0];t.touchData.startGPosition=[it.clientX,it.clientY]}}},!1);var se;t.registerBinding(e,"touchmove",se=function(P){var V=t.touchData.capture;if(!(!V&&!D(P))){var X=t.selection,W=t.cy,Z=t.touchData.now,oe=t.touchData.earlier,te=W.zoom();if(P.touches[0]){var ve=t.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);Z[0]=ve[0],Z[1]=ve[1]}if(P.touches[1]){var ve=t.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);Z[2]=ve[0],Z[3]=ve[1]}if(P.touches[2]){var ve=t.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);Z[4]=ve[0],Z[5]=ve[1]}var le=function(rc){return{originalEvent:P,type:rc,position:{x:Z[0],y:Z[1]}}},ge=t.touchData.startGPosition,Ce;if(V&&P.touches[0]&&ge){for(var xe=[],ce=0;ce<Z.length;ce++)xe[ce]=Z[ce]-oe[ce];var Ae=P.touches[0].clientX-ge[0],De=Ae*Ae,Je=P.touches[0].clientY-ge[1],Xe=Je*Je,mt=De+Xe;Ce=mt>=t.touchTapThreshold2}if(V&&t.touchData.cxt){P.preventDefault();var Ke=P.touches[0].clientX-_,it=P.touches[0].clientY-q,je=P.touches[1].clientX-_,lt=P.touches[1].clientY-q,jt=Ge(Ke,it,je,lt),Ze=jt/j,Yt=150,Ht=Yt*Yt,Or=1.5,Ha=Or*Or;if(Ze>=Ha||jt>=Ht){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var mr=le("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(mr),t.touchData.start=null):W.emit(mr)}}if(V&&t.touchData.cxt){var mr=le("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(mr):W.emit(mr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var xt=t.findNearestElement(Z[0],Z[1],!0,!0);(!t.touchData.cxtOver||xt!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(le("cxtdragout")),t.touchData.cxtOver=xt,xt&&xt.emit(le("cxtdragover")))}else if(V&&P.touches[2]&&W.boxSelectionEnabled())P.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||W.emit(le("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,X[4]=1,!X||X.length===0||X[0]===void 0?(X[0]=(Z[0]+Z[2]+Z[4])/3,X[1]=(Z[1]+Z[3]+Z[5])/3,X[2]=(Z[0]+Z[2]+Z[4])/3+1,X[3]=(Z[1]+Z[3]+Z[5])/3+1):(X[2]=(Z[0]+Z[2]+Z[4])/3,X[3]=(Z[1]+Z[3]+Z[5])/3),t.redrawHint("select",!0),t.redraw();else if(V&&P.touches[1]&&!t.touchData.didSelect&&W.zoomingEnabled()&&W.panningEnabled()&&W.userZoomingEnabled()&&W.userPanningEnabled()){P.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var dt=t.dragData.touchDragEles;if(dt){t.redrawHint("drag",!0);for(var Tt=0;Tt<dt.length;Tt++){var sa=dt[Tt]._private;sa.grabbed=!1,sa.rscratch.inDragLayer=!1}}var Lt=t.touchData.start,Ke=P.touches[0].clientX-_,it=P.touches[0].clientY-q,je=P.touches[1].clientX-_,lt=P.touches[1].clientY-q,Ts=be(Ke,it,je,lt),Wv=Ts/K;if(ne){var $v=Ke-z,Kv=it-U,Zv=je-H,Qv=lt-$,Jv=($v+Zv)/2,jv=(Kv+Qv)/2,ua=W.zoom(),jn=ua*Wv,Xa=W.pan(),Cs=Q[0]*ua+Xa.x,Ds=Q[1]*ua+Xa.y,ec={x:-jn/ua*(Cs-Xa.x-Jv)+Cs,y:-jn/ua*(Ds-Xa.y-jv)+Ds};if(Lt&&Lt.active()){var dt=t.dragData.touchDragEles;y(dt),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Lt.unactivate().emit(le("freeon")),dt.emit(le("free")),t.dragData.didDrag&&(Lt.emit(le("dragfreeon")),dt.emit(le("dragfree")))}W.viewport({zoom:jn,pan:ec,cancelOnFailedZoom:!0}),W.emit(le("pinchzoom")),K=Ts,z=Ke,U=it,H=je,$=lt,t.pinching=!0}if(P.touches[0]){var ve=t.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);Z[0]=ve[0],Z[1]=ve[1]}if(P.touches[1]){var ve=t.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);Z[2]=ve[0],Z[3]=ve[1]}if(P.touches[2]){var ve=t.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);Z[4]=ve[0],Z[5]=ve[1]}}else if(P.touches[0]&&!t.touchData.didSelect){var It=t.touchData.start,ei=t.touchData.last,xt;if(!t.hoverData.draggingEles&&!t.swipePanning&&(xt=t.findNearestElement(Z[0],Z[1],!0,!0)),V&&It!=null&&P.preventDefault(),V&&It!=null&&t.nodeIsDraggable(It))if(Ce){var dt=t.dragData.touchDragEles,Ss=!t.dragData.didDrag;Ss&&p(dt,{inDragLayer:!0}),t.dragData.didDrag=!0;var la={x:0,y:0};if(ae(xe[0])&&ae(xe[1])&&(la.x+=xe[0],la.y+=xe[1],Ss)){t.redrawHint("eles",!0);var Ot=t.touchData.dragDelta;Ot&&ae(Ot[0])&&ae(Ot[1])&&(la.x+=Ot[0],la.y+=Ot[1])}t.hoverData.draggingEles=!0,dt.silentShift(la).emit(le("position")).emit(le("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==oe[0]&&t.touchData.startPosition[1]==oe[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Ot=t.touchData.dragDelta=t.touchData.dragDelta||[];Ot.length===0?(Ot.push(xe[0]),Ot.push(xe[1])):(Ot[0]+=xe[0],Ot[1]+=xe[1])}if(n(It||xt,["touchmove","tapdrag","vmousemove"],P,{x:Z[0],y:Z[1]}),(!It||!It.grabbed())&&xt!=ei&&(ei&&ei.emit(le("tapdragout")),xt&&xt.emit(le("tapdragover"))),t.touchData.last=xt,V)for(var Tt=0;Tt<Z.length;Tt++)Z[Tt]&&t.touchData.startPosition[Tt]&&Ce&&(t.touchData.singleTouchMoved=!0);if(V&&(It==null||It.pannable())&&W.panningEnabled()&&W.userPanningEnabled()){var tc=o(It,t.touchData.starts);tc&&(P.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=qr(t.touchData.startPosition)),t.swipePanning?(W.panBy({x:xe[0]*te,y:xe[1]*te}),W.emit(le("dragpan"))):Ce&&(t.swipePanning=!0,W.panBy({x:Ae*te,y:Je*te}),W.emit(le("dragpan")),It&&(It.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ve=t.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);Z[0]=ve[0],Z[1]=ve[1]}}for(var ce=0;ce<Z.length;ce++)oe[ce]=Z[ce];V&&P.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var fe;t.registerBinding(e,"touchcancel",fe=function(P){var V=t.touchData.start;t.touchData.capture=!1,V&&V.unactivate()});var de,ye,me,we;if(t.registerBinding(e,"touchend",de=function(P){var V=t.touchData.start,X=t.touchData.capture;if(X)P.touches.length===0&&(t.touchData.capture=!1),P.preventDefault();else return;var W=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Z=t.cy,oe=Z.zoom(),te=t.touchData.now,ve=t.touchData.earlier;if(P.touches[0]){var le=t.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);te[0]=le[0],te[1]=le[1]}if(P.touches[1]){var le=t.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY);te[2]=le[0],te[3]=le[1]}if(P.touches[2]){var le=t.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY);te[4]=le[0],te[5]=le[1]}var ge=function(Ht){return{originalEvent:P,type:Ht,position:{x:te[0],y:te[1]}}};V&&V.unactivate();var Ce;if(t.touchData.cxt){if(Ce=ge("cxttapend"),V?V.emit(Ce):Z.emit(Ce),!t.touchData.cxtDragged){var xe=ge("cxttap");V?V.emit(xe):Z.emit(xe)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!P.touches[2]&&Z.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ce=Z.collection(t.getAllInBox(W[0],W[1],W[2],W[3]));W[0]=void 0,W[1]=void 0,W[2]=void 0,W[3]=void 0,W[4]=0,t.redrawHint("select",!0),Z.emit(ge("boxend"));var Ae=function(Ht){return Ht.selectable()&&!Ht.selected()};ce.emit(ge("box")).stdFilter(Ae).select().emit(ge("boxselect")),ce.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(V!=null&&V.unactivate(),P.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!P.touches[1]){if(!P.touches[0]){if(!P.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var De=t.dragData.touchDragEles;if(V!=null){var Je=V._private.grabbed;y(De),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Je&&(V.emit(ge("freeon")),De.emit(ge("free")),t.dragData.didDrag&&(V.emit(ge("dragfreeon")),De.emit(ge("dragfree")))),n(V,["touchend","tapend","vmouseup","tapdragout"],P,{x:te[0],y:te[1]}),V.unactivate(),t.touchData.start=null}else{var Xe=t.findNearestElement(te[0],te[1],!0,!0);n(Xe,["touchend","tapend","vmouseup","tapdragout"],P,{x:te[0],y:te[1]})}var mt=t.touchData.startPosition[0]-te[0],Ke=mt*mt,it=t.touchData.startPosition[1]-te[1],je=it*it,lt=Ke+je,jt=lt*oe*oe;t.touchData.singleTouchMoved||(V||Z.$(":selected").unselect(["tapunselect"]),n(V,["tap","vclick"],P,{x:te[0],y:te[1]}),ye=!1,P.timeStamp-we<=Z.multiClickDebounceTime()?(me&&clearTimeout(me),ye=!0,we=null,n(V,["dbltap","vdblclick"],P,{x:te[0],y:te[1]})):(me=setTimeout(function(){ye||n(V,["onetap","voneclick"],P,{x:te[0],y:te[1]})},Z.multiClickDebounceTime()),we=P.timeStamp)),V!=null&&!t.dragData.didDrag&&V._private.selectable&&jt<t.touchTapThreshold2&&!t.pinching&&(Z.selectionType()==="single"?(Z.$(r).unmerge(V).unselect(["tapunselect"]),V.select(["tapselect"])):V.selected()?V.unselect(["tapunselect"]):V.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Ze=0;Ze<te.length;Ze++)ve[Ze]=te[Ze];t.dragData.didDrag=!1,P.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),P.touches.length<2&&(P.touches.length===1&&(t.touchData.startGPosition=[P.touches[0].clientX,P.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var Ee=[],Re=function(P){return{clientX:P.clientX,clientY:P.clientY,force:1,identifier:P.pointerId,pageX:P.pageX,pageY:P.pageY,radiusX:P.width/2,radiusY:P.height/2,screenX:P.screenX,screenY:P.screenY,target:P.target}},ze=function(P){return{event:P,touch:Re(P)}},$e=function(P){Ee.push(ze(P))},Be=function(P){for(var V=0;V<Ee.length;V++){var X=Ee[V];if(X.event.pointerId===P.pointerId){Ee.splice(V,1);return}}},qe=function(P){var V=Ee.filter(function(X){return X.event.pointerId===P.pointerId})[0];V.event=P,V.touch=Re(P)},Se=function(P){P.touches=Ee.map(function(V){return V.touch})},ue=function(P){return P.pointerType==="mouse"||P.pointerType===4};t.registerBinding(t.container,"pointerdown",function(J){ue(J)||(J.preventDefault(),$e(J),Se(J),Le(J))}),t.registerBinding(t.container,"pointerup",function(J){ue(J)||(Be(J),Se(J),de(J))}),t.registerBinding(t.container,"pointercancel",function(J){ue(J)||(Be(J),Se(J),fe(J))}),t.registerBinding(t.container,"pointermove",function(J){ue(J)||(J.preventDefault(),qe(J),Se(J),se(J))})}};var Qt={};Qt.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,o,s,u){this.renderer.nodeShapeImpl("polygon",a,n,i,o,s,this.points)},intersectLine:function(a,n,i,o,s,u,l,f){return Aa(s,u,this.points,a,n,i/2,o/2,l)},checkPoint:function(a,n,i,o,s,u,l,f){return Zt(a,n,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,n,i,o,s,u){return Oh(this.points,a,n,i,o,s)}}};Qt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){return Vh(i,o,e,r,a/2+s,n/2+s)},checkPoint:function(e,r,a,n,i,o,s,u){return Dr(e,r,n,i,o,s,a)}}};Qt.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,n,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===a&&u[l+"-cy"]===n)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=a,u[l+"-cy"]=n;var f=i/2,v=o/2;s=s==="auto"?Sf(i,o):s;for(var c=new Array(e.length/2),h=0;h<e.length/2;h++)c[h]={x:a+f*e[h*2],y:n+v*e[h*2+1]};var d,p,g,y,m=c.length;for(p=c[m-1],d=0;d<m;d++)g=c[d%m],y=c[(d+1)%m],u[l][d]=bs(p,g,y,s),p=g,g=y;return u[l]},draw:function(a,n,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",a,n,i,o,s,this.points,this.getOrCreateCorners(n,i,o,s,u,l,"drawCorners"))},intersectLine:function(a,n,i,o,s,u,l,f,v){return qh(s,u,this.points,a,n,i,o,l,this.getOrCreateCorners(a,n,i,o,f,v,"corners"))},checkPoint:function(a,n,i,o,s,u,l,f,v){return _h(a,n,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,f,v,"corners"))}}};Qt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:bt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){return Cf(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){var l=n/2,f=i/2;u=u==="auto"?lr(n,i):u,u=Math.min(l,f,u);var v=u*2;return!!(Zt(e,r,this.points,o,s,n,i-v,[0,-1],a)||Zt(e,r,this.points,o,s,n-v,i,[0,-1],a)||Dr(e,r,v,v,o-l+u,s-f+u,a)||Dr(e,r,v,v,o+l-u,s-f+u,a)||Dr(e,r,v,v,o+l-u,s+f-u,a)||Dr(e,r,v,v,o-l+u,s+f-u,a))}}};Qt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:us(),points:bt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,null,o)},generateCutTrianglePts:function(e,r,a,n,i){var o=i==="auto"?this.cornerLength:i,s=r/2,u=e/2,l=a-u,f=a+u,v=n-s,c=n+s;return{topLeft:[l,v+o,l+o,v,l+o,v+o],topRight:[f-o,v,f,v+o,f-o,v+o],bottomRight:[f,c-o,f-o,c,f-o,c-o],bottomLeft:[l+o,c,l,c-o,l+o,c-o]}},intersectLine:function(e,r,a,n,i,o,s,u){var l=this.generateCutTrianglePts(a+2*s,n+2*s,e,r,u),f=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Aa(i,o,f,e,r)},checkPoint:function(e,r,a,n,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(Zt(e,r,this.points,o,s,n,i-2*l,[0,-1],a)||Zt(e,r,this.points,o,s,n-2*l,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,o,s);return Dt(e,r,f.topLeft)||Dt(e,r,f.topRight)||Dt(e,r,f.bottomRight)||Dt(e,r,f.bottomLeft)}}};Qt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:bt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){var l=.15,f=.5,v=.85,c=this.generateBarrelBezierPts(a+2*s,n+2*s,e,r),h=function(g){var y=Xr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},l),m=Xr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},f),b=Xr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},v);return[g[0],g[1],y.x,y.y,m.x,m.y,b.x,b.y,g[4],g[5]]},d=[].concat(h(c.topLeft),h(c.topRight),h(c.bottomRight),h(c.bottomLeft));return Aa(i,o,d,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,o=e/2,s=a-o,u=a+o,l=n-i,f=n+i,v=No(e,r),c=v.heightOffset,h=v.widthOffset,d=v.ctrlPtOffsetPct*e,p={topLeft:[s,l+c,s+d,l,s+h,l],topRight:[u-h,l,u-d,l,u,l+c],bottomRight:[u,f-c,u-d,f,u-h,f],bottomLeft:[s+h,f,s+d,f,s,f-c]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,r,a,n,i,o,s,u){var l=No(n,i),f=l.heightOffset,v=l.widthOffset;if(Zt(e,r,this.points,o,s,n,i-2*f,[0,-1],a)||Zt(e,r,this.points,o,s,n-2*v,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,o,s),h=function(x,T,D){var S=D[4],R=D[2],L=D[0],M=D[5],I=D[1],N=Math.min(S,L),B=Math.max(S,L),O=Math.min(M,I),F=Math.max(M,I);if(N<=x&&x<=B&&O<=T&&T<=F){var G=Yh(S,R,L),k=kh(G[0],G[1],G[2],x),z=k.filter(function(U){return 0<=U&&U<=1});if(z.length>0)return z[0]}return null},d=Object.keys(c),p=0;p<d.length;p++){var g=d[p],y=c[g],m=h(e,r,y);if(m!=null){var b=y[5],E=y[3],C=y[1],A=ot(b,E,C,m);if(y.isTop&&A<=r||y.isBottom&&r<=A)return!0}}return!1}}};Qt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:bt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){var l=e-(a/2+s),f=r-(n/2+s),v=f,c=e+(a/2+s),h=nr(i,o,e,r,l,f,c,v,!1);return h.length>0?h:Cf(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){u=u==="auto"?lr(n,i):u;var l=2*u;if(Zt(e,r,this.points,o,s,n,i-l,[0,-1],a)||Zt(e,r,this.points,o,s,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,v=i/2+2*a,c=[o-f,s-v,o-f,s,o+f,s,o+f,s-v];return!!(Dt(e,r,c)||Dr(e,r,l,l,o+n/2-u,s+i/2-u,a)||Dr(e,r,l,l,o-n/2+u,s+i/2-u,a))}}};Qt.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",bt(3,0)),this.generateRoundPolygon("round-triangle",bt(3,0)),this.generatePolygon("rectangle",bt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",bt(5,0)),this.generateRoundPolygon("round-pentagon",bt(5,0)),this.generatePolygon("hexagon",bt(6,0)),this.generateRoundPolygon("round-hexagon",bt(6,0)),this.generatePolygon("heptagon",bt(7,0)),this.generateRoundPolygon("round-heptagon",bt(7,0)),this.generatePolygon("octagon",bt(8,0)),this.generateRoundPolygon("round-octagon",bt(8,0));var a=new Array(20);{var n=Oo(5,0),i=Oo(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)a[s*4]=n[s*2],a[s*4+1]=n[s*2+1],a[s*4+2]=i[s*2],a[s*4+3]=i[s*2+1]}a=Df(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}t.makePolygon=function(l){var f=l.join("$"),v="polygon-"+f,c;return(c=this[v])?c:e.generatePolygon(v,l)}};var qa={};qa.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};qa.redraw=function(t){t=t||Ef();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};qa.beforeRender=function(t,e){if(!this.destroyed){e==null&&Ye("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var Fl=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};qa.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Fl(t,!0,n);var i=Kt();t.render(t.renderOptions);var o=t.lastDrawTime=Kt();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var s=o-i;t.redrawTotalTime+=s,t.lastRedrawTime=s,t.averageRedrawTime=t.averageRedrawTime/2+s/2,t.requestedFrame=!1}else Fl(t,!1,n);t.skipFrame=!1,Tn(r)}};Tn(r)}};var sy=function(e){this.init(e)},Sv=sy,oa=Sv.prototype;oa.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];oa.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=n.getElementById(o)!=null;if(r.className.indexOf(s)<0&&(r.className=(r.className||"")+" "+s),!u){var l=n.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}var f=a.getComputedStyle(r),v=f.getPropertyValue("position");v==="static"&&Ne("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=ae(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};oa.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};oa.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};oa.isHeadless=function(){return!1};[ms,Cv,Dv,ia,Qt,qa].forEach(function(t){pe(oa,t)});var To=1e3/60,Av={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=Ga(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=function(l,f){var v=Kt(),c=n.averageRedrawTime,h=n.lastRedrawTime,d=[],p=n.cy.extent(),g=n.getPixelRatio();for(l||n.flushRenderedStyleQueue();;){var y=Kt(),m=y-v,b=y-f;if(h<To){var E=To-(l?c:0);if(b>=e.deqFastCost*E)break}else if(l){if(m>=e.deqCost*h||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*To)break;var C=e.deq(a,g,p);if(C.length>0)for(var A=0;A<C.length;A++)d.push(C[A]);else break}d.length>0&&(e.onDeqd(a,d),!l&&e.shouldRedraw(a,d,g,p)&&i())},s=e.priority||as;n.beforeRender(o,s(a))}}}},uy=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cn;hr(this,t),this.idsByKey=new $t,this.keyForId=new $t,this.cachesByLvl=new $t,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return dr(t,[{key:"getIdsFor",value:function(r){r==null&&Ye("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new ta,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new $t,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])}(),Gl=25,nn=50,pn=-4,Wo=3,Lv=7.99,ly=8,fy=1024,vy=1024,cy=1024,hy=.2,dy=.8,gy=10,py=.15,yy=.1,my=.9,by=.9,wy=100,Ey=1,Hr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},xy=ct({getKey:null,doesEleInvalidateKey:Cn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:mf,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ba=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=xy(r);pe(a,n),a.lookup=new uy(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},nt=ba.prototype;nt.reasons=Hr;nt.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};nt.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};nt.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new za(function(r,a){return a.reqs-r.reqs});return e};nt.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};nt.getElement=function(t,e,r,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(is(s*r))),a<pn)a=pn;else if(s>=Lv||a>Wo)return null;var l=Math.pow(2,a),f=e.h*l,v=e.w*l,c=o.eleTextBiggerThanMin(t,l);if(!this.isVisible(t,c))return null;var h=u.get(t,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(f<=Gl?d=Gl:f<=nn?d=nn:d=Math.ceil(f/nn)*nn,f>cy||v>vy)return null;var p=i.getTextureQueue(d),g=p[p.length-2],y=function(){return i.recycleTexture(d,v)||i.addTexture(d,v)};g||(g=p[p.length-1]),g||(g=y()),g.width-g.usedWidth<v&&(g=y());for(var m=function(N){return N&&N.scaledLabelShown===c},b=n&&n===Hr.dequeue,E=n&&n===Hr.highQuality,C=n&&n===Hr.downscale,A,w=a+1;w<=Wo;w++){var x=u.get(t,w);if(x){A=x;break}}var T=A&&A.level===a+1?A:null,D=function(){g.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,g.usedWidth,0,v,f)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,v,d),m(T))D();else if(m(A))if(E){for(var S=A.level;S>a;S--)T=i.getElement(t,e,r,S,Hr.downscale);D()}else return i.queueElement(t,A.level-1),A;else{var R;if(!b&&!E&&!C)for(var L=a-1;L>=pn;L--){var M=u.get(t,L);if(M){R=M;break}}if(m(R))return i.queueElement(t,a),R;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,t,e,c,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return h={x:g.usedWidth,texture:g,level:a,scale:l,width:v,height:f,scaledLabelShown:c},g.usedWidth+=Math.ceil(v+ly),g.eleCaches.push(h),u.set(t,a,h),i.checkTextureFullness(g),h};nt.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};nt.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=pn;i<=Wo;i++){var o=r.getForCachedKey(t,i);o&&a.push(o)}var s=r.invalidate(t);if(s)for(var u=0;u<a.length;u++){var l=a[u],f=l.texture;f.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}};nt.checkTextureUtility=function(t){t.invalidatedWidth>=hy*t.width&&this.retireTexture(t)};nt.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>dy&&t.fullnessChecks>=gy?ur(r,t):t.fullnessChecks++};nt.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;ur(a,t),t.retired=!0;for(var i=t.eleCaches,o=0;o<i.length;o++){var s=i[o];n.deleteCache(s.key,s.level)}ns(i);var u=e.getRetiredTextureQueue(r);u.push(t)};nt.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(fy,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};nt.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var o=n[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,ns(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),ur(n,o),a.push(o),o}};nt.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var s={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(s),n[i]=s}};nt.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o<Ey&&r.size()>0;o++){var s=r.pop(),u=s.key,l=s.eles[0],f=i.hasCache(l,s.level);if(a[u]=null,f)continue;n.push(s);var v=e.getBoundingBox(l);e.getElement(l,v,t,s.level,Hr.dequeue)}return n};nt.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=rs,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))};nt.onDequeue=function(t){this.onDequeues.push(t)};nt.offDequeue=function(t){ur(this.onDequeues,t)};nt.setupDequeueing=Av.setupDequeueing({deqRedrawThreshold:wy,deqCost:py,deqAvgCost:yy,deqNoDrawCost:my,deqFastCost:by,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var o=r[i].eles,s=0;s<o.length;s++){var u=o[s].boundingBox();if(ss(u,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Ty=1,Ea=-4,In=2,Cy=3.99,Dy=50,Sy=50,Ay=.15,Ly=.1,Ry=.9,My=.9,Py=1,zl=250,Iy=4e3*4e3,_l=32767,Oy=!0,Rv=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Kt()-2*zl,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=Ga(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},Sy),a.beforeRender(function(o,s){s-r.lastInvalidationTime<=zl?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(s,u){return u.reqs-s.reqs};r.layersQueue=new za(i),r.setupDequeueing()},ht=Rv.prototype,Vl=0,Ny=Math.pow(2,53)-1;ht.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),o={id:Vl=++Vl%Ny,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(r,r),s.translate(u,l),o};ht.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,o=i.zoom(),s=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(is(o*e)),r<Ea)r=Ea;else if(o>=Cy||r>In)return null}a.validateLayersElesOrdering(r,t);var u=a.layersByLevel,l=Math.pow(2,r),f=u[r]=u[r]||[],v,c=a.levelIsComplete(r,t),h,d=function(){var D=function(I){if(a.validateLayersElesOrdering(I,t),a.levelIsComplete(I,t))return h=u[I],!0},S=function(I){if(!h)for(var N=r+I;Ea<=N&&N<=In&&!D(N);N+=I);};S(1),S(-1);for(var R=f.length-1;R>=0;R--){var L=f[R];L.invalid&&ur(f,L)}};if(!c)d();else return f;var p=function(){if(!v){v=wt();for(var D=0;D<t.length;D++)Lh(v,t[D].boundingBox())}return v},g=function(D){D=D||{};var S=D.after;p();var R=Math.ceil(v.w*l),L=Math.ceil(v.h*l);if(R>_l||L>_l)return null;var M=R*L;if(M>Iy)return null;var I=a.makeLayer(v,r);if(S!=null){var N=f.indexOf(S)+1;f.splice(N,0,I)}else(D.insert===void 0||D.insert)&&f.unshift(I);return I};if(a.skipping&&!s)return null;for(var y=null,m=t.length/Ty,b=!s,E=0;E<t.length;E++){var C=t[E],A=C._private.rscratch,w=A.imgLayerCaches=A.imgLayerCaches||{},x=w[r];if(x){y=x;continue}if((!y||y.eles.length>=m||!Mh(y.bb,C.boundingBox()))&&(y=g({insert:!0,after:y}),!y))return null;h||b?a.queueLayer(y,C):a.drawEleInLayer(y,C,r,e),y.eles.push(C),w[r]=y}return h||(b?null:f)};ht.getEleLevelForLayerLevel=function(t,e){return t};ht.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,o=t.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,Oy),i.setImgSmoothing(o,!0))};ht.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var o=a[i];if(o.reqs>0||o.invalid)return!1;n+=o.eles.length}return n===e.length};ht.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,o=0;o<e.length;o++)if(n.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(n);continue}for(var s=i,o=0;o<n.eles.length;o++)if(n.eles[o]!==e[s+o]){this.invalidateLayer(n);break}}};ht.updateElementsInLayers=function(t,e){for(var r=this,a=Na(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],o=a?t[n]:t[n].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=Ea;l<=In;l++){var f=u[l];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,o,i))}};ht.haveLayers=function(){for(var t=this,e=!1,r=Ea;r<=In;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};ht.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Kt(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))};ht.invalidateLayer=function(t){if(this.lastInvalidationTime=Kt(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];ur(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};ht.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};ht.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};ht.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};ht.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<Py&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};ht.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var o=t.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[t.level]=t)}e.requestRedraw()}};ht.requestRedraw=Ga(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);ht.setupDequeueing=Av.setupDequeueing({deqRedrawThreshold:Dy,deqCost:Ay,deqAvgCost:Ly,deqNoDrawCost:Ry,deqFastCost:My,deq:function(e,r){return e.dequeue(r)},onDeqd:as,shouldRedraw:mf,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Mv={},Ul;function By(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function ky(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function ql(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var o=r,s=r[0];t.moveTo(s.x,s.y);for(var n=1;n<o.length;n++){var i=o[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function Fy(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,o=i[0];t.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var u=i[s];t.lineTo(u.x,u.y)}t.closePath&&t.closePath()}function Gy(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}Mv.arrowShapeImpl=function(t){return(Ul||(Ul={polygon:By,"triangle-backcurve":ky,"triangle-tee":ql,"circle-triangle":Fy,"triangle-cross":ql,circle:Gy}))[t]};var qt={};qt.drawElement=function(t,e,r,a,n,i){var o=this;e.isNode()?o.drawNode(t,e,r,a,n,i):o.drawEdge(t,e,r,a,n,i)};qt.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};qt.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};qt.drawCachedElementPortion=function(t,e,r,a,n,i,o,s){var u=this,l=r.getBoundingBox(e);if(!(l.w===0||l.h===0)){var f=r.getElement(e,l,a,n,i);if(f!=null){var v=s(u,e);if(v===0)return;var c=o(u,e),h=l.x1,d=l.y1,p=l.w,g=l.h,y,m,b,E,C;if(c!==0){var A=r.getRotationPoint(e);b=A.x,E=A.y,t.translate(b,E),t.rotate(c),C=u.getImgSmoothing(t),C||u.setImgSmoothing(t,!0);var w=r.getRotationOffset(e);y=w.x,m=w.y}else y=h,m=d;var x;v!==1&&(x=t.globalAlpha,t.globalAlpha=x*v),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,y,m,p,g),v!==1&&(t.globalAlpha=x),c!==0&&(t.rotate(-c),t.translate(-b,-E),C||u.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var zy=function(){return 0},_y=function(e,r){return e.getTextAngle(r,null)},Vy=function(e,r){return e.getTextAngle(r,"source")},Uy=function(e,r){return e.getTextAngle(r,"target")},qy=function(e,r){return r.effectiveOpacity()},Co=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};qt.drawCachedElement=function(t,e,r,a,n,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,f=s.slbTxrCache,v=s.tlbTxrCache,c=e.boundingBox(),h=i===!0?u.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||ss(c,a))){var d=e.isEdge(),p=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,u,r,n,h,zy,qy),(!d||!p)&&o.drawCachedElementPortion(t,e,l,r,n,h,_y,Co),d&&!p&&(o.drawCachedElementPortion(t,e,f,r,n,h,Vy,Co),o.drawCachedElementPortion(t,e,v,r,n,h,Uy,Co)),o.drawElementOverlay(t,e)}};qt.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}};qt.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];n.drawCachedElement(t,o,r,a)}};qt.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&n.drawCachedElement(t,o,r,a)}};qt.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||t.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(t,e,r,a)};var Jt={};Jt.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,v=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,p=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,y=l*f,m=l*f,b=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;v==="straight-triangle"?(o.eleStrokeStyle(t,e,I),o.drawEdgeTrianglePath(e,t,s.allpts)):(t.lineWidth=h,t.lineCap=d,o.eleStrokeStyle(t,e,I),o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},E=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(t.lineWidth=h+p,t.lineCap=d,p>0)o.colorStrokeStyle(t,g[0],g[1],g[2],I);else{t.lineCap="butt";return}v==="straight-triangle"?o.drawEdgeTrianglePath(e,t,s.allpts):(o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},C=function(){n&&o.drawEdgeOverlay(t,e)},A=function(){n&&o.drawEdgeUnderlay(t,e)},w=function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(t,e,I)},x=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var T=e.pstyle("ghost").value==="yes";if(T){var D=e.pstyle("ghost-offset-x").pfValue,S=e.pstyle("ghost-offset-y").pfValue,R=e.pstyle("ghost-opacity").value,L=y*R;t.translate(D,S),b(L),w(L),t.translate(-D,-S)}else E();A(),b(),w(),C(),x(),r&&t.translate(u.x1,u.y1)}};var Pv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=l,s.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,s.allpts,"solid")}}}};Jt.drawEdgeOverlay=Pv("overlay");Jt.drawEdgeUnderlay=Pv("underlay");Jt.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(u){var v=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===v;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=v,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<r.length;h+=4)e.quadraticCurveTo(r[h],r[h+1],r[h+2],r[h+3]);break;case"straight":case"haystack":for(var d=2;d+1<r.length;d+=2)e.lineTo(r[d],r[d+1]);break;case"segments":if(n.isRound){var p=St(n.roundCorners),g;try{for(p.s();!(g=p.n()).done;){var y=g.value;bv(e,y)}}catch(b){p.e(b)}finally{p.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var m=2;m+1<r.length;m+=2)e.lineTo(r[m],r[m+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};Jt.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*a/2,s[1]*a/2];e.beginPath(),e.moveTo(r[n]-u[0],r[n+1]-u[1]),e.lineTo(r[n]+u[0],r[n+1]+u[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}};Jt.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};Jt.drawArrowhead=function(t,e,r,a,n,i,o){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(r+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,v=e.pstyle("width").pfValue,c=e.pstyle(r+"-arrow-width"),h=c.value==="match-line"?v:c.pfValue;c.units==="%"&&(h*=v);var d=e.pstyle("opacity").value;o===void 0&&(o=d);var p=t.globalCompositeOperation;(o!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",s.colorFillStyle(t,255,255,255,1),s.colorStrokeStyle(t,255,255,255,1),s.drawArrowShape(e,t,l,v,u,h,a,n,i),t.globalCompositeOperation=p);var g=e.pstyle(r+"-arrow-color").value;s.colorFillStyle(t,g[0],g[1],g[2],o),s.colorStrokeStyle(t,g[0],g[1],g[2],o),s.drawArrowShape(e,t,f,v,u,h,a,n,i)}}};Jt.drawArrowShape=function(t,e,r,a,n,i,o,s,u){var l=this,f=this.usePaths()&&n!=="triangle-cross",v=!1,c,h=e,d={x:o,y:s},p=t.pstyle("arrow-scale").value,g=this.getArrowWidth(a,p),y=l.arrowShapes[n];if(f){var m=l.arrowPathCache=l.arrowPathCache||[],b=Sr(n),E=m[b];E!=null?(c=e=E,v=!0):(c=e=new Path2D,m[b]=c)}v||(e.beginPath&&e.beginPath(),f?y.draw(e,1,0,{x:0,y:0},1):y.draw(e,g,u,d,a),e.closePath&&e.closePath()),e=h,f&&(e.translate(o,s),e.rotate(u),e.scale(g,g)),(r==="filled"||r==="both")&&(f?e.fill(c):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(f?g:1),e.lineJoin="miter",f?e.stroke(c):e.stroke()),f&&(e.scale(1/g,1/g),e.rotate(-u),e.translate(-o,-s))};var Es={};Es.safeDrawImage=function(t,e,r,a,n,i,o,s,u,l){if(!(n<=0||i<=0||u<=0||l<=0))try{t.drawImage(e,r,a,n,i,o,s,u,l)}catch(f){Ne(f)}};Es.drawInscribedImage=function(t,e,r,a,n){var i=this,o=r.position(),s=o.x,u=o.y,l=r.cy().style(),f=l.getIndexedStyle.bind(l),v=f(r,"background-fit","value",a),c=f(r,"background-repeat","value",a),h=r.width(),d=r.height(),p=r.padding()*2,g=h+(f(r,"background-width-relative-to","value",a)==="inner"?0:p),y=d+(f(r,"background-height-relative-to","value",a)==="inner"?0:p),m=r._private.rscratch,b=f(r,"background-clip","value",a),E=b==="node",C=f(r,"background-image-opacity","value",a)*n,A=f(r,"background-image-smoothing","value",a),w=r.pstyle("corner-radius").value;w!=="auto"&&(w=r.pstyle("corner-radius").pfValue);var x=e.width||e.cachedW,T=e.height||e.cachedH;(x==null||T==null)&&(document.body.appendChild(e),x=e.cachedW=e.width||e.offsetWidth,T=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var D=x,S=T;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?D=f(r,"background-width","pfValue",a)*g:D=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?S=f(r,"background-height","pfValue",a)*y:S=f(r,"background-height","pfValue",a)),!(D===0||S===0)){if(v==="contain"){var R=Math.min(g/D,y/S);D*=R,S*=R}else if(v==="cover"){var R=Math.max(g/D,y/S);D*=R,S*=R}var L=s-g/2,M=f(r,"background-position-x","units",a),I=f(r,"background-position-x","pfValue",a);M==="%"?L+=(g-D)*I:L+=I;var N=f(r,"background-offset-x","units",a),B=f(r,"background-offset-x","pfValue",a);N==="%"?L+=(g-D)*B:L+=B;var O=u-y/2,F=f(r,"background-position-y","units",a),G=f(r,"background-position-y","pfValue",a);F==="%"?O+=(y-S)*G:O+=G;var k=f(r,"background-offset-y","units",a),z=f(r,"background-offset-y","pfValue",a);k==="%"?O+=(y-S)*z:O+=z,m.pathCache&&(L-=s,O-=u,s=0,u=0);var U=t.globalAlpha;t.globalAlpha=C;var H=i.getImgSmoothing(t),$=!1;if(A==="no"&&H?(i.setImgSmoothing(t,!1),$=!0):A==="yes"&&!H&&(i.setImgSmoothing(t,!0),$=!0),c==="no-repeat")E&&(t.save(),m.pathCache?t.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,g,y,w,m),t.clip())),i.safeDrawImage(t,e,0,0,x,T,L,O,D,S),E&&t.restore();else{var K=t.createPattern(e,c);t.fillStyle=K,i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,g,y,w,m),t.translate(L,O),t.fill(),t.translate(-L,-O)}t.globalAlpha=U,$&&i.setImgSmoothing(t,H)}};var Ir={};Ir.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(is(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};Ir.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e);t.textAlign=u,t.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,f=e.pstyle("label"),v=e.pstyle("source-label"),c=e.pstyle("target-label");if(l||(!f||!f.value)&&(!v||!v.value)&&(!c||!c.value))return;t.textAlign="center",t.textBaseline="bottom"}var h=!r,d;r&&(d=r,t.translate(-d.x1,-d.y1)),n==null?(o.drawText(t,e,null,h,i),e.isEdge()&&(o.drawText(t,e,"source",h,i),o.drawText(t,e,"target",h,i))):o.drawText(t,e,n,h,i),r&&t.translate(d.x1,d.y1)};Ir.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};Ir.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,l[0],l[1],l[2],s),this.colorStrokeStyle(t,f[0],f[1],f[2],u)};function Do(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+a-i,r),t.quadraticCurveTo(e+a,r,e+a,r+i),t.lineTo(e+a,r+n-i),t.quadraticCurveTo(e+a,r+n,e+a-i,r+n),t.lineTo(e+i,r+n),t.quadraticCurveTo(e,r+n,e,r+n-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),o?t.stroke():t.fill()}Ir.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=Ct(n,"labelAngle",e);r=t.isEdge()?s:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};Ir.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=Ct(o,"labelX",r),l=Ct(o,"labelY",r),f,v,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(t,e,n);var h=r?r+"-":"",d=Ct(o,"labelWidth",r),p=Ct(o,"labelHeight",r),g=e.pstyle(h+"text-margin-x").pfValue,y=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,E=e.pstyle("text-valign").value;m&&(b="center",E="center"),u+=g,l+=y;var C;switch(a?C=this.getTextAngle(e,r):C=0,C!==0&&(f=u,v=l,t.translate(f,v),t.rotate(C),u=0,l=0),E){case"top":break;case"center":l+=p/2;break;case"bottom":l+=p;break}var A=e.pstyle("text-background-opacity").value,w=e.pstyle("text-border-opacity").value,x=e.pstyle("text-border-width").pfValue,T=e.pstyle("text-background-padding").pfValue,D=e.pstyle("text-background-shape").strValue,S=D.indexOf("round")===0,R=2;if(A>0||x>0&&w>0){var L=u-T;switch(b){case"left":L-=d;break;case"center":L-=d/2;break}var M=l-p-T,I=d+2*T,N=p+2*T;if(A>0){var B=t.fillStyle,O=e.pstyle("text-background-color").value;t.fillStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+A*s+")",S?Do(t,L,M,I,N,R):t.fillRect(L,M,I,N),t.fillStyle=B}if(x>0&&w>0){var F=t.strokeStyle,G=t.lineWidth,k=e.pstyle("text-border-color").value,z=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+k[0]+","+k[1]+","+k[2]+","+w*s+")",t.lineWidth=x,t.setLineDash)switch(z){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=x/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(S?Do(t,L,M,I,N,R,"stroke"):t.strokeRect(L,M,I,N),z==="double"){var U=x/2;S?Do(t,L+U,M+U,I-U*2,N-U*2,R,"stroke"):t.strokeRect(L+U,M+U,I-U*2,N-U*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=G,t.strokeStyle=F}}var H=2*e.pstyle("text-outline-width").pfValue;if(H>0&&(t.lineWidth=H),e.pstyle("text-wrap").value==="wrap"){var $=Ct(o,"labelWrapCachedLines",r),K=Ct(o,"labelLineHeight",r),j=d/2,re=this.getLabelJustification(e);switch(re==="auto"||(b==="left"?re==="left"?u+=-d:re==="center"&&(u+=-j):b==="center"?re==="left"?u+=-j:re==="right"&&(u+=j):b==="right"&&(re==="center"?u+=j:re==="right"&&(u+=d))),E){case"top":l-=($.length-1)*K;break;case"center":case"bottom":l-=($.length-1)*K;break}for(var Q=0;Q<$.length;Q++)H>0&&t.strokeText($[Q],u,l),t.fillText($[Q],u,l),l+=K}else H>0&&t.strokeText(c,u,l),t.fillText(c,u,l);C!==0&&(t.rotate(-C),t.translate(-f,-v))}}};var pr={};pr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,f=l.rscratch,v=e.position();if(!(!ae(v.x)||!ae(v.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=o.usePaths(),d,p=!1,g=e.padding();s=e.width()+2*g,u=e.height()+2*g;var y;r&&(y=r,t.translate(-y.x1,-y.y1));for(var m=e.pstyle("background-image"),b=m.value,E=new Array(b.length),C=new Array(b.length),A=0,w=0;w<b.length;w++){var x=b[w],T=E[w]=x!=null&&x!=="none";if(T){var D=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",w);A++,C[w]=o.getCachedImage(x,D,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var S=e.pstyle("background-blacken").value,R=e.pstyle("border-width").pfValue,L=e.pstyle("background-opacity").value*c,M=e.pstyle("border-color").value,I=e.pstyle("border-style").value,N=e.pstyle("border-join").value,B=e.pstyle("border-cap").value,O=e.pstyle("border-position").value,F=e.pstyle("border-dash-pattern").pfValue,G=e.pstyle("border-dash-offset").pfValue,k=e.pstyle("border-opacity").value*c,z=e.pstyle("outline-width").pfValue,U=e.pstyle("outline-color").value,H=e.pstyle("outline-style").value,$=e.pstyle("outline-opacity").value*c,K=e.pstyle("outline-offset").value,j=e.pstyle("corner-radius").value;j!=="auto"&&(j=e.pstyle("corner-radius").pfValue);var re=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L;o.eleFillStyle(t,e,ue)},Q=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k;o.colorStrokeStyle(t,M[0],M[1],M[2],ue)},_=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$;o.colorStrokeStyle(t,U[0],U[1],U[2],ue)},q=function(ue,J,P,V){var X=o.nodePathCache=o.nodePathCache||[],W=yf(P==="polygon"?P+","+V.join(","):P,""+J,""+ue,""+j),Z=X[W],oe,te=!1;return Z!=null?(oe=Z,te=!0,f.pathCache=oe):(oe=new Path2D,X[W]=f.pathCache=oe),{path:oe,cacheHit:te}},Y=e.pstyle("shape").strValue,ee=e.pstyle("shape-polygon-points").pfValue;if(h){t.translate(v.x,v.y);var ne=q(s,u,Y,ee);d=ne.path,p=ne.cacheHit}var be=function(){if(!p){var ue=v;h&&(ue={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(d||t,ue.x,ue.y,s,u,j,f)}h?t.fill(d):t.fill()},Ge=function(){for(var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,P=l.backgrounding,V=0,X=0;X<C.length;X++){var W=e.cy().style().getIndexedStyle(e,"background-image-containment","value",X);if(J&&W==="over"||!J&&W==="inside"){V++;continue}E[X]&&C[X].complete&&!C[X].error&&(V++,o.drawInscribedImage(t,C[X],e,X,ue))}l.backgrounding=V!==A,P!==l.backgrounding&&e.updateStyle(!1)},Le=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(t,e,J),ue&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f)))},se=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasStripe(e)&&(t.save(),h?t.clip(f.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f),t.clip()),o.drawStripe(t,e,J),t.restore(),ue&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f)))},fe=function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,J=(S>0?S:-S)*ue,P=S>0?0:255;S!==0&&(o.colorFillStyle(t,P,P,P,J),h?t.fill(d):t.fill())},de=function(){if(R>0){if(t.lineWidth=R,t.lineCap=B,t.lineJoin=N,t.setLineDash)switch(I){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(F),t.lineDashOffset=G;break;case"solid":case"double":t.setLineDash([]);break}if(O!=="center"){if(t.save(),t.lineWidth*=2,O==="inside")h?t.clip(d):t.clip();else{var ue=new Path2D;ue.rect(-s/2-R,-u/2-R,s+2*R,u+2*R),ue.addPath(d),t.clip(ue,"evenodd")}h?t.stroke(d):t.stroke(),t.restore()}else h?t.stroke(d):t.stroke();if(I==="double"){t.lineWidth=R/3;var J=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(d):t.stroke(),t.globalCompositeOperation=J}t.setLineDash&&t.setLineDash([])}},ye=function(){if(z>0){if(t.lineWidth=z,t.lineCap="butt",t.setLineDash)switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var ue=v;h&&(ue={x:0,y:0});var J=o.getNodeShape(e),P=R;O==="inside"&&(P=0),O==="outside"&&(P*=2);var V=(s+P+(z+K))/s,X=(u+P+(z+K))/u,W=s*V,Z=u*X,oe=o.nodeShapes[J].points,te;if(h){var ve=q(W,Z,J,oe);te=ve.path}if(J==="ellipse")o.drawEllipsePath(te||t,ue.x,ue.y,W,Z);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(J)){var le=0,ge=0,Ce=0;J==="round-diamond"?le=(P+K+z)*1.4:J==="round-heptagon"?(le=(P+K+z)*1.075,Ce=-(P/2+K+z)/35):J==="round-hexagon"?le=(P+K+z)*1.12:J==="round-pentagon"?(le=(P+K+z)*1.13,Ce=-(P/2+K+z)/15):J==="round-tag"?(le=(P+K+z)*1.12,ge=(P/2+z+K)*.07):J==="round-triangle"&&(le=(P+K+z)*(Math.PI/2),Ce=-(P+K/2+z)/Math.PI),le!==0&&(V=(s+le)/s,W=s*V,["round-hexagon","round-tag"].includes(J)||(X=(u+le)/u,Z=u*X)),j=j==="auto"?Sf(W,Z):j;for(var xe=W/2,ce=Z/2,Ae=j+(P+z+K)/2,De=new Array(oe.length/2),Je=new Array(oe.length/2),Xe=0;Xe<oe.length/2;Xe++)De[Xe]={x:ue.x+ge+xe*oe[Xe*2],y:ue.y+Ce+ce*oe[Xe*2+1]};var mt,Ke,it,je,lt=De.length;for(Ke=De[lt-1],mt=0;mt<lt;mt++)it=De[mt%lt],je=De[(mt+1)%lt],Je[mt]=bs(Ke,it,je,Ae),Ke=it,it=je;o.drawRoundPolygonPath(te||t,ue.x+ge,ue.y+Ce,s*V,u*X,oe,Je)}else if(["roundrectangle","round-rectangle"].includes(J))j=j==="auto"?lr(W,Z):j,o.drawRoundRectanglePath(te||t,ue.x,ue.y,W,Z,j+(P+z+K)/2);else if(["cutrectangle","cut-rectangle"].includes(J))j=j==="auto"?us():j,o.drawCutRectanglePath(te||t,ue.x,ue.y,W,Z,null,j+(P+z+K)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(J))j=j==="auto"?lr(W,Z):j,o.drawBottomRoundRectanglePath(te||t,ue.x,ue.y,W,Z,j+(P+z+K)/2);else if(J==="barrel")o.drawBarrelPath(te||t,ue.x,ue.y,W,Z);else if(J.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(J)){var jt=(P+z+K)/s;oe=Dn(Sn(oe,jt)),o.drawPolygonPath(te||t,ue.x,ue.y,s,u,oe)}else{var Ze=(P+z+K)/s;oe=Dn(Sn(oe,-Ze)),o.drawPolygonPath(te||t,ue.x,ue.y,s,u,oe)}if(h?t.stroke(te):t.stroke(),H==="double"){t.lineWidth=P/3;var Yt=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(te):t.stroke(),t.globalCompositeOperation=Yt}t.setLineDash&&t.setLineDash([])}},me=function(){n&&o.drawNodeOverlay(t,e,v,s,u)},we=function(){n&&o.drawNodeUnderlay(t,e,v,s,u)},Ee=function(){o.drawElementText(t,e,null,a)},Re=e.pstyle("ghost").value==="yes";if(Re){var ze=e.pstyle("ghost-offset-x").pfValue,$e=e.pstyle("ghost-offset-y").pfValue,Be=e.pstyle("ghost-opacity").value,qe=Be*c;t.translate(ze,$e),_(),ye(),re(Be*L),be(),Ge(qe,!0),Q(Be*k),de(),Le(S!==0||R!==0),se(S!==0||R!==0),Ge(qe,!1),fe(qe),t.translate(-ze,-$e)}h&&t.translate(-v.x,-v.y),we(),h&&t.translate(v.x,v.y),_(),ye(),re(),be(),Ge(c,!0),Q(),de(),Le(S!==0||R!==0),se(S!==0||R!==0),Ge(c,!1),fe(),h&&t.translate(-v.x,-v.y),Ee(),me(),r&&t.translate(y.x1,y.y1)}};var Iv=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,o){var s=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,v=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(n=n||a.position(),i==null||o==null){var h=a.padding();i=a.width()+2*h,o=a.height()+2*h}s.colorFillStyle(r,f[0],f[1],f[2],l),s.nodeShapes[v].draw(r,n.x,n.y,i+u*2,o+u*2,c),r.fill()}}}};pr.drawNodeOverlay=Iv("overlay");pr.drawNodeUnderlay=Iv("underlay");pr.hasPie=function(t){return t=t[0],t._private.hasPie};pr.hasStripe=function(t){return t=t[0],t._private.hasStripe};pr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,f=e.width(),v=e.height(),c=Math.min(f,v)/2,h,d=0,p=this.usePaths();if(p&&(u=0,l=0),i.units==="%"?c=c*i.pfValue:i.pfValue!==void 0&&(c=i.pfValue/2),o.units==="%"?h=c*o.pfValue:o.pfValue!==void 0&&(h=o.pfValue/2),!(h>=c))for(var g=1;g<=n.pieBackgroundN;g++){var y=e.pstyle("pie-"+g+"-background-size").value,m=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*r,E=y/100;E+d>1&&(E=1-d);var C=1.5*Math.PI+2*Math.PI*d;C+=s;var A=2*Math.PI*E,w=C+A;y===0||d>=1||d+E>1||(h===0?(t.beginPath(),t.moveTo(u,l),t.arc(u,l,c,C,w),t.closePath()):(t.beginPath(),t.arc(u,l,c,C,w),t.arc(u,l,h,w,C,!0),t.closePath()),this.colorFillStyle(t,m[0],m[1],m[2],b),t.fill(),d+=E)}};pr.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,o=a.y,s=e.width(),u=e.height(),l=0,f=this.usePaths();t.save();var v=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(v){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var h=s,d=u;c.units==="%"?(h=h*c.pfValue,d=d*c.pfValue):c.pfValue!==void 0&&(h=c.pfValue,d=c.pfValue),f&&(i=0,o=0),o-=h/2,i-=d/2;for(var p=1;p<=n.stripeBackgroundN;p++){var g=e.pstyle("stripe-"+p+"-background-size").value,y=e.pstyle("stripe-"+p+"-background-color").value,m=e.pstyle("stripe-"+p+"-background-opacity").value*r,b=g/100;b+l>1&&(b=1-l),!(g===0||l>=1||l+b>1)&&(t.beginPath(),t.rect(i,o+d*l,h,d*b),t.closePath(),this.colorFillStyle(t,y[0],y[1],y[2],m),t.fill(),l+=b)}t.restore()};var Et={},Yy=100;Et.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};Et.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};Et.createGradientStyleFor=function(t,e,r,a,n){var i,o=this.usePaths(),s=r.pstyle(e+"-gradient-stop-colors").value,u=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var l=r.sourceEndpoint(),f=r.targetEndpoint(),v=r.midpoint(),c=Ar(l,v),h=Ar(f,v);i=t.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(c,h))}else{var d=o?{x:0,y:0}:r.position(),p=r.paddedWidth(),g=r.paddedHeight();i=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(p,g))}else if(r.isEdge()){var y=r.sourceEndpoint(),m=r.targetEndpoint();i=t.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:r.position(),E=r.paddedWidth(),C=r.paddedHeight(),A=E/2,w=C/2,x=r.pstyle("background-gradient-direction").value;switch(x){case"to-bottom":i=t.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":i=t.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":i=t.createLinearGradient(b.x+A,b.y,b.x-A,b.y);break;case"to-right":i=t.createLinearGradient(b.x-A,b.y,b.x+A,b.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(b.x-A,b.y-w,b.x+A,b.y+w);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(b.x-A,b.y+w,b.x+A,b.y-w);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(b.x+A,b.y-w,b.x-A,b.y+w);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(b.x+A,b.y+w,b.x-A,b.y-w);break}}if(!i)return null;for(var T=u.length===s.length,D=s.length,S=0;S<D;S++)i.addColorStop(T?u[S]:S/(D-1),"rgba("+s[S][0]+","+s[S][1]+","+s[S][2]+","+n+")");return i};Et.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n};Et.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"};Et.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}};Et.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n};Et.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"};Et.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}};Et.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=n*o,l=i*o,f;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var v=r.canvasContainer;v.style.width=n+"px",v.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)f=r.canvases[c],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)f=r.bufferCanvases[c],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,o<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=u*e.textureMult,f.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}};Et.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};Et.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};Et.render=function(t){var e=this;t=t||Ef();var r=e.cy,a=t.forcedContext,n=t.drawAllLayers,i=t.drawOnlyNodeLayer,o=t.forcedZoom,s=t.forcedPan,u=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=e.data,f=l.canvasNeedsRedraw,v=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),c=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,h=e.motionBlurPxRatio,d=r.hasCompoundNodes(),p=e.hoverData.draggingEles,g=!!(e.hoverData.selecting||e.touchData.selecting);c=c&&!a&&e.motionBlurEnabled&&!g;var y=c;a||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),c&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(y=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!v&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var m=r.style(),b=r.zoom(),E=o!==void 0?o:b,C=r.pan(),A={x:C.x,y:C.y},w={zoom:b,pan:{x:C.x,y:C.y}},x=e.prevViewport,T=x===void 0||w.zoom!==x.zoom||w.pan.x!==x.pan.x||w.pan.y!==x.pan.y;!T&&!(p&&!d)&&(e.motionBlurPxRatio=1),s&&(A=s),E*=u,A.x*=u,A.y*=u;var D=e.getCachedZSortedEles();function S(Q,_,q,Y,ee){var ne=Q.globalCompositeOperation;Q.globalCompositeOperation="destination-out",e.colorFillStyle(Q,255,255,255,e.motionBlurTransparency),Q.fillRect(_,q,Y,ee),Q.globalCompositeOperation=ne}function R(Q,_){var q,Y,ee,ne;!e.clearingMotionBlur&&(Q===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||Q===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(q={x:C.x*h,y:C.y*h},Y=b*h,ee=e.canvasWidth*h,ne=e.canvasHeight*h):(q=A,Y=E,ee=e.canvasWidth,ne=e.canvasHeight),Q.setTransform(1,0,0,1,0,0),_==="motionBlur"?S(Q,0,0,ee,ne):!a&&(_===void 0||_)&&Q.clearRect(0,0,ee,ne),n||(Q.translate(q.x,q.y),Q.scale(Y,Y)),s&&Q.translate(s.x,s.y),o&&Q.scale(o,o)}if(v||(e.textureDrawLastFrame=!1),v){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var L=e.data.bufferContexts[e.TEXTURE_BUFFER];L.setTransform(1,0,0,1,0,0),L.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:L,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var w=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};w.mpan={x:(0-w.pan.x)/w.zoom,y:(0-w.pan.y)/w.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var M=l.contexts[e.NODE],I=e.textureCache.texture,w=e.textureCache.viewport;M.setTransform(1,0,0,1,0,0),c?S(M,0,0,w.width,w.height):M.clearRect(0,0,w.width,w.height);var N=m.core("outside-texture-bg-color").value,B=m.core("outside-texture-bg-opacity").value;e.colorFillStyle(M,N[0],N[1],N[2],B),M.fillRect(0,0,w.width,w.height);var b=r.zoom();R(M,!1),M.clearRect(w.mpan.x,w.mpan.y,w.width/w.zoom/u,w.height/w.zoom/u),M.drawImage(I,w.mpan.x,w.mpan.y,w.width/w.zoom/u,w.height/w.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var O=r.extent(),F=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),G=e.hideEdgesOnViewport&&F,k=[];if(k[e.NODE]=!f[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,k[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),k[e.DRAG]=!f[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,k[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||k[e.NODE]){var z=c&&!k[e.NODE]&&h!==1,M=a||(z?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),U=c&&!z?"motionBlur":void 0;R(M,U),G?e.drawCachedNodes(M,D.nondrag,u,O):e.drawLayeredElements(M,D.nondrag,u,O),e.debug&&e.drawDebugPoints(M,D.nondrag),!n&&!c&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||k[e.DRAG])){var z=c&&!k[e.DRAG]&&h!==1,M=a||(z?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);R(M,c&&!z?"motionBlur":void 0),G?e.drawCachedNodes(M,D.drag,u,O):e.drawCachedElements(M,D.drag,u,O),e.debug&&e.drawDebugPoints(M,D.drag),!n&&!c&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,R),c&&h!==1){var H=l.contexts[e.NODE],$=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],K=l.contexts[e.DRAG],j=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],re=function(_,q,Y){_.setTransform(1,0,0,1,0,0),Y||!y?_.clearRect(0,0,e.canvasWidth,e.canvasHeight):S(_,0,0,e.canvasWidth,e.canvasHeight);var ee=h;_.drawImage(q,0,0,e.canvasWidth*ee,e.canvasHeight*ee,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||k[e.NODE])&&(re(H,$,k[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||k[e.DRAG])&&(re(K,j,k[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=w,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!v,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},Yy)),a||r.emit("render")};var da;Et.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,n=r.data,i=a.style(),o=t.drawOnlyNodeLayer,s=t.drawAllLayers,u=n.canvasNeedsRedraw,l=t.forcedContext;if(r.showFps||!o&&u[r.SELECT_BOX]&&!s){var f=l||n.contexts[r.SELECT_BOX];if(e(f),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var v=r.cy.zoom(),c=i.core("selection-box-border-width").value/v;f.lineWidth=c,f.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",f.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),c>0&&(f.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",f.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(n.bgActivePosistion&&!r.hoverData.selecting){var v=r.cy.zoom(),h=n.bgActivePosistion;f.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",f.beginPath(),f.arc(h.x,h.y,i.core("active-bg-size").pfValue/v,0,2*Math.PI),f.fill()}var d=r.lastRedrawTime;if(r.showFps&&d){d=Math.round(d);var p=Math.round(1e3/d),g="1 frame = "+d+" ms = "+p+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!da){var y=f.measureText(g);da=y.actualBoundingBoxAscent}f.fillText(g,0,da);var m=60;f.strokeRect(0,da+10,250,20),f.fillRect(0,da+10,250*Math.min(p/m,1),20)}s||(u[r.SELECT_BOX]=!1)}};function Yl(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function Hy(t,e,r){var a=Yl(t,t.VERTEX_SHADER,e),n=Yl(t,t.FRAGMENT_SHADER,r),i=t.createProgram();if(t.attachShader(i,a),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function Xy(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function xs(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function Wy(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function $y(t,e,r,a,n){var i=a*r+e.x,o=n*r+e.y;return o=Math.round(t.canvasHeight-o),[i,o]}function Ky(t){return t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function Zy(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function wr(t,e,r){var a=t[0]/255,n=t[1]/255,i=t[2]/255,o=e,s=r||new Array(4);return s[0]=a*o,s[1]=n*o,s[2]=i*o,s[3]=o,s}function zr(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function Qy(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function Jy(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function Ov(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function Nv(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function jy(t,e,r,a,n,i){switch(e){case t.FLOAT:return new Float32Array(r.buffer,i*a,n);case t.INT:return new Int32Array(r.buffer,i*a,n)}}function em(t,e,r,a){var n=Ov(t,e),i=tt(n,2),o=i[0],s=i[1],u=Nv(t,s,a),l=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,u,t.STATIC_DRAW),s===t.FLOAT?t.vertexAttribPointer(r,o,s,!1,0,0):s===t.INT&&t.vertexAttribIPointer(r,o,s,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),l}function Gt(t,e,r,a){var n=Ov(t,r),i=tt(n,3),o=i[0],s=i[1],u=i[2],l=Nv(t,s,e*o),f=o*u,v=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,v),t.bufferData(t.ARRAY_BUFFER,e*f,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),s===t.FLOAT?t.vertexAttribPointer(a,o,s,!1,f,0):s===t.INT&&t.vertexAttribIPointer(a,o,s,f,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var c=new Array(e),h=0;h<e;h++)c[h]=jy(t,s,l,f,o,h);return v.dataArray=l,v.stride=f,v.size=o,v.getView=function(d){return c[d]},v.setPoint=function(d,p,g){var y=c[d];y[0]=p,y[1]=g},v.bufferSubData=function(d){t.bindBuffer(t.ARRAY_BUFFER,v),d?t.bufferSubData(t.ARRAY_BUFFER,0,l,0,d*o):t.bufferSubData(t.ARRAY_BUFFER,0,l)},v}function tm(t,e,r){for(var a=9,n=new Float32Array(e*a),i=new Array(e),o=0;o<e;o++){var s=o*a*4;i[o]=new Float32Array(n.buffer,s,a)}var u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,n.byteLength,t.DYNAMIC_DRAW);for(var l=0;l<3;l++){var f=r+l;t.enableVertexAttribArray(f),t.vertexAttribPointer(f,3,t.FLOAT,!1,3*12,l*12),t.vertexAttribDivisor(f,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),u.getMatrixView=function(v){return i[v]},u.setData=function(v,c){i[c].set(v,0)},u.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferSubData(t.ARRAY_BUFFER,0,n)},u}function rm(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,n,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var Hl=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function So(){var t=new Hl(9);return Hl!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Xl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function am(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=r[0],h=r[1],d=r[2],p=r[3],g=r[4],y=r[5],m=r[6],b=r[7],E=r[8];return t[0]=c*a+h*o+d*l,t[1]=c*n+h*s+d*f,t[2]=c*i+h*u+d*v,t[3]=p*a+g*o+y*l,t[4]=p*n+g*s+y*f,t[5]=p*i+g*u+y*v,t[6]=m*a+b*o+E*l,t[7]=m*n+b*s+E*f,t[8]=m*i+b*u+E*v,t}function yn(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=r[0],h=r[1];return t[0]=a,t[1]=n,t[2]=i,t[3]=o,t[4]=s,t[5]=u,t[6]=c*a+h*o+l,t[7]=c*n+h*s+f,t[8]=c*i+h*u+v,t}function Wl(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=Math.sin(r),h=Math.cos(r);return t[0]=h*a+c*o,t[1]=h*n+c*s,t[2]=h*i+c*u,t[3]=h*o-c*a,t[4]=h*s-c*n,t[5]=h*u-c*i,t[6]=l,t[7]=f,t[8]=v,t}function $o(t,e,r){var a=r[0],n=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function nm(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var im=function(){function t(e,r,a,n){hr(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,r,r),this.scratch=n(e,r,this.texHeight,"scratch")}return dr(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,n=r.h,i=this.texHeight,o=this.texSize,s=i/n,u=a*s,l=n*s;return u>o&&(s=o/a,u=a*s,l=n*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(r,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(a),f=l.scale,v=l.texW,c=l.texH,h=function(b,E){if(n&&E){var C=E.context,A=b.x,w=b.row,x=A,T=u*w;C.save(),C.translate(x,T),C.scale(f,f),n(C,a),C.restore()}},d=[null,null],p=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:v,h:c},d[1]={x:i.freePointer.x+v,y:i.freePointer.row*u,w:0,h:c},i.freePointer.x+=v,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){var b=i.scratch,E=i.canvas;b.clear(),h({x:0,row:0},b);var C=o-i.freePointer.x,A=v-C,w=u;{var x=i.freePointer.x,T=i.freePointer.row*u,D=C;E.context.drawImage(b,0,0,D,w,x,T,D,w),d[0]={x,y:T,w:D,h:c}}{var S=C,R=(i.freePointer.row+1)*u,L=A;E&&E.context.drawImage(b,S,0,L,w,0,R,L,w),d[1]={x:0,y:R,w:L,h:c}}i.freePointer.x=A,i.freePointer.row++},y=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+v<=o)p();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(y(),p()):this.enableWrapping?g():(y(),p())}return this.keyToLocation.set(r,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(r),o=i.texW;return this.freePointer.x+o>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=Jy(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),om=function(){function t(e,r,a,n){hr(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return dr(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new im(r,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,o=Math.floor(a/n);this.scratch=i(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,n){var i=this.styleKeyToAtlas.get(r);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(r,a,n),this.styleKeyToAtlas.set(r,i)),i}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,o=null,s=St(this.atlases),u;try{var l=function(){var v=u.value,c=v.getKeys(),h=sm(a,c);if(h.size===0)return n.push(v),c.forEach(function(C){return i.set(C,v)}),1;o||(o=r._createAtlas(),n.push(o));var d=St(c),p;try{for(d.s();!(p=d.n()).done;){var g=p.value;if(!h.has(g)){var y=v.getOffsets(g),m=tt(y,2),b=m[0],E=m[1];o.canFit({w:b.w+E.w,h:b.h})||(o.lock(),o=r._createAtlas(),n.push(o)),v.canvas&&(r._copyTextureToNewAtlas(g,v,o),i.set(g,o))}}}catch(C){d.e(C)}finally{d.f()}v.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(f){s.e(f)}finally{s.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,a,n){var i=a.getOffsets(r),o=tt(i,2),s=o[0],u=o[1];if(u.w===0)n.draw(r,s,function(c){c.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),l.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,s.w,0,u.w,u.h);var f=s.w+u.w,v=s.h;n.draw(r,{w:f,h:v},function(c){c.drawImage(l,0,0,f,v,0,0,f,v)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function sm(t,e){return t.intersection?t.intersection(e):new Set(En(t).filter(function(r){return e.has(r)}))}var um=function(){function t(e,r){hr(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return dr(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var n=this.globalOptions,i=n.webglTexSize,o=n.createTextureCanvas,s=a.texRows,u=this._cacheScratchCanvas(o),l=new om(this.r,i,s,u);this.collections.set(r,l)}},{key:"addRenderType",value:function(r,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),o=pe({type:r,atlasCollection:i},a);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,n=-1,i=null;return function(o,s,u,l){return l?((!i||s!=a||u!=n)&&(a=s,n=u,i=r(o,s,u)),i):r(o,s,u)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,o=i===void 0?!1:i,s=n.filterEle,u=s===void 0?function(){return!0}:s,l=n.filterType,f=l===void 0?function(){return!0}:l,v=!1,c=!1,h=St(r),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;if(u(p)){var g=St(this.renderTypes.values()),y;try{var m=function(){var E=y.value,C=E.type;if(f(C)){var A=a.collections.get(E.collection),w=E.getKey(p),x=Array.isArray(w)?w:[w];if(o)x.forEach(function(R){return A.markKeyForGC(R)}),c=!0;else{var T=E.getID?E.getID(p):p.id(),D=a._key(C,T),S=a.typeAndIdToKey.get(D);S!==void 0&&!Zy(x,S)&&(v=!0,a.typeAndIdToKey.delete(D),S.forEach(function(R){return A.markKeyForGC(R)}))}}};for(g.s();!(y=g.n()).done;)m()}catch(b){g.e(b)}finally{g.f()}}}}catch(b){h.e(b)}finally{h.f()}return c&&(this.gc(),v=!1),v}},{key:"gc",value:function(){var r=St(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var n=a.value;n.gc()}}catch(i){r.e(i)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,n,i){var o=this.renderTypes.get(a),s=this.collections.get(o.collection),u=!1,l=s.draw(i,n,function(c){o.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),o.drawElement(c,r,n,!0,!0),c.restore()):o.drawElement(c,r,n,!0,!0),u=!0});if(u){var f=o.getID?o.getID(r):r.id(),v=this._key(a,f);this.typeAndIdToKey.has(v)?this.typeAndIdToKey.get(v).push(i):this.typeAndIdToKey.set(v,[i])}return l}},{key:"getAtlasInfo",value:function(r,a){var n=this,i=this.renderTypes.get(a),o=i.getKey(r),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(r,u),f=n.getOrCreateAtlas(r,a,l,u),v=f.getOffsets(u),c=tt(v,2),h=c[0],d=c[1];return{atlas:f,tex:h,tex1:h,tex2:d,bb:l}})}},{key:"getDebugInfo",value:function(){var r=[],a=St(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=tt(n.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,f=u.atlasCount;r.push({type:o,keyCount:l,atlasCount:f})}}catch(v){a.e(v)}finally{a.f()}return r}}])}(),lm=function(){function t(e){hr(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return dr(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])}(),fm=`
18
+ float circleSD(vec2 p, float r) {
19
+ return distance(vec2(0), p) - r; // signed distance
20
+ }
21
+ `,vm=`
22
+ float rectangleSD(vec2 p, vec2 b) {
23
+ vec2 d = abs(p)-b;
24
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
25
+ }
26
+ `,cm=`
27
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
28
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
29
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
30
+ vec2 q = abs(p) - b + cr.x;
31
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
32
+ }
33
+ `,hm=`
34
+ float ellipseSD(vec2 p, vec2 ab) {
35
+ p = abs( p ); // symmetry
36
+
37
+ // find root with Newton solver
38
+ vec2 q = ab*(p-ab);
39
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
40
+ for( int i=0; i<5; i++ ) {
41
+ vec2 cs = vec2(cos(w),sin(w));
42
+ vec2 u = ab*vec2( cs.x,cs.y);
43
+ vec2 v = ab*vec2(-cs.y,cs.x);
44
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
45
+ }
46
+
47
+ // compute final point and distance
48
+ float d = length(p-ab*vec2(cos(w),sin(w)));
49
+
50
+ // return signed distance
51
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
52
+ }
53
+ `,xa={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},On={IGNORE:1,USE_BB:2},Ao=0,$l=1,Kl=2,Lo=3,_r=4,on=5,ga=6,pa=7,dm=function(){function t(e,r,a){hr(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=Xy,this.atlasManager=new um(e,a),this.batchManager=new lm(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(xa.SCREEN),this.pickingProgram=this._createShaderProgram(xa.PICKING),this.vao=this._createVAO()}return dr(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(r,{filterType:function(s){return s===n},forceRedraw:!0}):i.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,n=`#version 300 es
54
+ precision highp float;
55
+
56
+ uniform mat3 uPanZoomMatrix;
57
+ uniform int uAtlasSize;
58
+
59
+ // instanced
60
+ in vec2 aPosition; // a vertex from the unit square
61
+
62
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
63
+ in int aVertType; // the type of thing we are rendering
64
+
65
+ // the z-index that is output when using picking mode
66
+ in vec4 aIndex;
67
+
68
+ // For textures
69
+ in int aAtlasId; // which shader unit/atlas to use
70
+ in vec4 aTex; // x/y/w/h of texture in atlas
71
+
72
+ // for edges
73
+ in vec4 aPointAPointB;
74
+ in vec4 aPointCPointD;
75
+ in vec2 aLineWidth; // also used for node border width
76
+
77
+ // simple shapes
78
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
79
+ in vec4 aColor; // also used for edges
80
+ in vec4 aBorderColor; // aLineWidth is used for border width
81
+
82
+ // output values passed to the fragment shader
83
+ out vec2 vTexCoord;
84
+ out vec4 vColor;
85
+ out vec2 vPosition;
86
+ // flat values are not interpolated
87
+ flat out int vAtlasId;
88
+ flat out int vVertType;
89
+ flat out vec2 vTopRight;
90
+ flat out vec2 vBotLeft;
91
+ flat out vec4 vCornerRadius;
92
+ flat out vec4 vBorderColor;
93
+ flat out vec2 vBorderWidth;
94
+ flat out vec4 vIndex;
95
+
96
+ void main(void) {
97
+ int vid = gl_VertexID;
98
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
99
+
100
+ if(aVertType == `.concat(Ao,`) {
101
+ float texX = aTex.x; // texture coordinates
102
+ float texY = aTex.y;
103
+ float texW = aTex.z;
104
+ float texH = aTex.w;
105
+
106
+ if(vid == 1 || vid == 2 || vid == 4) {
107
+ texX += texW;
108
+ }
109
+ if(vid == 2 || vid == 4 || vid == 5) {
110
+ texY += texH;
111
+ }
112
+
113
+ float d = float(uAtlasSize);
114
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
115
+
116
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
117
+ }
118
+ else if(aVertType == `).concat(_r," || aVertType == ").concat(pa,`
119
+ || aVertType == `).concat(on," || aVertType == ").concat(ga,`) { // simple shapes
120
+
121
+ // the bounding box is needed by the fragment shader
122
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
123
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
124
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
125
+
126
+ // calculations are done in the fragment shader, just pass these along
127
+ vColor = aColor;
128
+ vCornerRadius = aCornerRadius;
129
+ vBorderColor = aBorderColor;
130
+ vBorderWidth = aLineWidth;
131
+
132
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
133
+ }
134
+ else if(aVertType == `).concat($l,`) {
135
+ vec2 source = aPointAPointB.xy;
136
+ vec2 target = aPointAPointB.zw;
137
+
138
+ // adjust the geometry so that the line is centered on the edge
139
+ position.y = position.y - 0.5;
140
+
141
+ // stretch the unit square into a long skinny rectangle
142
+ vec2 xBasis = target - source;
143
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
144
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
145
+
146
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
147
+ vColor = aColor;
148
+ }
149
+ else if(aVertType == `).concat(Kl,`) {
150
+ vec2 pointA = aPointAPointB.xy;
151
+ vec2 pointB = aPointAPointB.zw;
152
+ vec2 pointC = aPointCPointD.xy;
153
+ vec2 pointD = aPointCPointD.zw;
154
+
155
+ // adjust the geometry so that the line is centered on the edge
156
+ position.y = position.y - 0.5;
157
+
158
+ vec2 p0, p1, p2, pos;
159
+ if(position.x == 0.0) { // The left side of the unit square
160
+ p0 = pointA;
161
+ p1 = pointB;
162
+ p2 = pointC;
163
+ pos = position;
164
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
165
+ p0 = pointD;
166
+ p1 = pointC;
167
+ p2 = pointB;
168
+ pos = vec2(0.0, -position.y);
169
+ }
170
+
171
+ vec2 p01 = p1 - p0;
172
+ vec2 p12 = p2 - p1;
173
+ vec2 p21 = p1 - p2;
174
+
175
+ // Find the normal vector.
176
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
177
+ vec2 normal = vec2(-tangent.y, tangent.x);
178
+
179
+ // Find the vector perpendicular to p0 -> p1.
180
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
181
+
182
+ // Determine the bend direction.
183
+ float sigma = sign(dot(p01 + p21, normal));
184
+ float width = aLineWidth[0];
185
+
186
+ if(sign(pos.y) == -sigma) {
187
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
188
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
189
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
190
+ } else {
191
+ // This is a non-intersecting vertex. Treat it like a mitre join.
192
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
193
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
194
+ }
195
+
196
+ vColor = aColor;
197
+ }
198
+ else if(aVertType == `).concat(Lo,` && vid < 3) {
199
+ // massage the first triangle into an edge arrow
200
+ if(vid == 0)
201
+ position = vec2(-0.15, -0.3);
202
+ if(vid == 1)
203
+ position = vec2( 0.0, 0.0);
204
+ if(vid == 2)
205
+ position = vec2( 0.15, -0.3);
206
+
207
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
208
+ vColor = aColor;
209
+ }
210
+ else {
211
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
212
+ }
213
+
214
+ vAtlasId = aAtlasId;
215
+ vVertType = aVertType;
216
+ vIndex = aIndex;
217
+ }
218
+ `),i=this.batchManager.getIndexArray(),o=`#version 300 es
219
+ precision highp float;
220
+
221
+ // declare texture unit for each texture atlas in the batch
222
+ `.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
223
+ `),`
224
+
225
+ uniform vec4 uBGColor;
226
+ uniform float uZoom;
227
+
228
+ in vec2 vTexCoord;
229
+ in vec4 vColor;
230
+ in vec2 vPosition; // model coordinates
231
+
232
+ flat in int vAtlasId;
233
+ flat in vec4 vIndex;
234
+ flat in int vVertType;
235
+ flat in vec2 vTopRight;
236
+ flat in vec2 vBotLeft;
237
+ flat in vec4 vCornerRadius;
238
+ flat in vec4 vBorderColor;
239
+ flat in vec2 vBorderWidth;
240
+
241
+ out vec4 outColor;
242
+
243
+ `).concat(fm,`
244
+ `).concat(vm,`
245
+ `).concat(cm,`
246
+ `).concat(hm,`
247
+
248
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
249
+ return vec4(
250
+ top.rgb + (bot.rgb * (1.0 - top.a)),
251
+ top.a + (bot.a * (1.0 - top.a))
252
+ );
253
+ }
254
+
255
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
256
+ // scale to the zoom level so that borders don't look blurry when zoomed in
257
+ // note 1.5 is an aribitrary value chosen because it looks good
258
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
259
+ }
260
+
261
+ void main(void) {
262
+ if(vVertType == `).concat(Ao,`) {
263
+ // look up the texel from the texture unit
264
+ `).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
265
+ else `),`
266
+ }
267
+ else if(vVertType == `).concat(Lo,`) {
268
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
269
+ outColor = blend(vColor, uBGColor);
270
+ outColor.a = 1.0; // make opaque, masks out line under arrow
271
+ }
272
+ else if(vVertType == `).concat(_r,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
273
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
274
+ }
275
+ else if(vVertType == `).concat(_r," || vVertType == ").concat(pa,`
276
+ || vVertType == `).concat(on," || vVertType == ").concat(ga,`) { // use SDF
277
+
278
+ float outerBorder = vBorderWidth[0];
279
+ float innerBorder = vBorderWidth[1];
280
+ float borderPadding = outerBorder * 2.0;
281
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
282
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
283
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
284
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
285
+
286
+ float d; // signed distance
287
+ if(vVertType == `).concat(_r,`) {
288
+ d = rectangleSD(p, b);
289
+ } else if(vVertType == `).concat(pa,` && w == h) {
290
+ d = circleSD(p, b.x); // faster than ellipse
291
+ } else if(vVertType == `).concat(pa,`) {
292
+ d = ellipseSD(p, b);
293
+ } else {
294
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
295
+ }
296
+
297
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
298
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
299
+ if(d > 0.0) {
300
+ if(d > outerBorder) {
301
+ discard;
302
+ } else {
303
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
304
+ }
305
+ } else {
306
+ if(d > innerBorder) {
307
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
308
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
309
+ outColor = distInterp(innerBorderColor, outerColor, d);
310
+ }
311
+ else {
312
+ vec4 outerColor;
313
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
314
+ outerColor = vec4(0);
315
+ } else if(innerBorder == 0.0) {
316
+ outerColor = vBorderColor;
317
+ } else {
318
+ outerColor = blend(vBorderColor, vColor);
319
+ }
320
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
321
+ }
322
+ }
323
+ }
324
+ else {
325
+ outColor = vColor;
326
+ }
327
+
328
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
329
+ else outColor = vIndex;`:"",`
330
+ }
331
+ `),s=Hy(a,n,o);s.aPosition=a.getAttribLocation(s,"aPosition"),s.aIndex=a.getAttribLocation(s,"aIndex"),s.aVertType=a.getAttribLocation(s,"aVertType"),s.aTransform=a.getAttribLocation(s,"aTransform"),s.aAtlasId=a.getAttribLocation(s,"aAtlasId"),s.aTex=a.getAttribLocation(s,"aTex"),s.aPointAPointB=a.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=a.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=a.getAttribLocation(s,"aLineWidth"),s.aColor=a.getAttribLocation(s,"aColor"),s.aCornerRadius=a.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=a.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=a.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=a.getUniformLocation(s,"uAtlasSize"),s.uBGColor=a.getUniformLocation(s,"uBGColor"),s.uZoom=a.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)s.uTextures.push(a.getUniformLocation(s,"uTexture".concat(u)));return s}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,n=this.gl,i=this.program,o=n.createVertexArray();return n.bindVertexArray(o),em(n,"vec2",i.aPosition,r),this.transformBuffer=tm(n,a,i.aTransform),this.indexBuffer=Gt(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Gt(n,a,"int",i.aVertType),this.atlasIdBuffer=Gt(n,a,"int",i.aAtlasId),this.texBuffer=Gt(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Gt(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Gt(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Gt(n,a,"vec2",i.aLineWidth),this.colorBuffer=Gt(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=Gt(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=Gt(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return ar(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xa.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,n){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(n);if(this._isVisible(r,s)){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(r);if(u===On.IGNORE)return;if(u==On.USE_BB){this.drawPickingRectangle(r,a,n);return}}var l=i.getAtlasInfo(r,n),f=St(l),v;try{for(f.s();!(v=f.n()).done;){var c=v.value,h=c.atlas,d=c.tex1,p=c.tex2;o.canAddToCurrentBatch(h)||this.endBatch();for(var g=o.getAtlasIndexForBatch(h),y=0,m=[[d,!0],[p,!1]];y<m.length;y++){var b=tt(m[y],2),E=b[0],C=b[1];if(E.w!=0){var A=this.instanceCount;this.vertTypeBuffer.getView(A)[0]=Ao;var w=this.indexBuffer.getView(A);zr(a,w);var x=this.atlasIdBuffer.getView(A);x[0]=g;var T=this.texBuffer.getView(A);T[0]=E.x,T[1]=E.y,T[2]=E.w,T[3]=E.h;var D=this.transformBuffer.getMatrixView(A);this.setTransformMatrix(r,D,s,c,C),this.instanceCount++,C||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(S){f.e(S)}finally{f.f()}}}},{key:"setTransformMatrix",value:function(r,a,n,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(n.shapeProps&&n.shapeProps.padding&&(s=r.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,v=l.w/(l.w+f.w);o||(v=1-v);var c=this._getAdjustedBB(u,s,o,v);this._applyTransformMatrix(a,c,n,r)}else{var h=n.getBoundingBox(r),d=this._getAdjustedBB(h,s,!0,1);this._applyTransformMatrix(a,d,n,r)}}},{key:"_applyTransformMatrix",value:function(r,a,n,i){var o,s;Xl(r);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),f=l.x,v=l.y;yn(r,r,[f,v]),Wl(r,r,u);var c=n.getRotationOffset(i);o=c.x+(a.xOffset||0),s=c.y+(a.yOffset||0)}else o=a.x1,s=a.y1;yn(r,r,[o,s]),$o(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,n,i){var o=r.x1,s=r.y1,u=r.w,l=r.h,f=r.yOffset;a&&(o-=a,s-=a,u+=2*a,l+=2*a);var v=0,c=u*i;return n&&i<1?u=c:!n&&i<1&&(v=u-c,o+=v,u=c),{x1:o,y1:s,w:u,h:l,xOffset:v,yOffset:f}}},{key:"drawPickingRectangle",value:function(r,a,n){var i=this.atlasManager.getRenderTypeOpts(n),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=_r;var s=this.indexBuffer.getView(o);zr(a,s);var u=this.colorBuffer.getView(o);wr([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(r,i)){var o=i.shapeProps,s=this._getVertTypeForShape(r,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(r)){this.drawTexture(r,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===on||s===ga){var l=i.getBoundingBox(r),f=this._getCornerRadius(r,o.radius,l),v=this.cornerRadiusBuffer.getView(u);v[0]=f,v[1]=f,v[2]=f,v[3]=f,s===ga&&(v[0]=0,v[2]=0)}var c=this.indexBuffer.getView(u);zr(a,c);var h=r.pstyle(o.color).value,d=r.pstyle(o.opacity).value,p=this.colorBuffer.getView(u);wr(h,d,p);var g=this.lineWidthBuffer.getView(u);if(g[0]=0,g[1]=0,o.border){var y=r.pstyle("border-width").value;if(y>0){var m=r.pstyle("border-color").value,b=r.pstyle("border-opacity").value,E=this.borderColorBuffer.getView(u);wr(m,b,E);var C=r.pstyle("border-position").value;if(C==="inside")g[0]=0,g[1]=-y;else if(C==="outside")g[0]=y,g[1]=0;else{var A=y/2;g[0]=A,g[1]=-A}}}var w=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(r,w,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var n=r.pstyle(a).value;switch(n){case"rectangle":return _r;case"ellipse":return pa;case"roundrectangle":case"round-rectangle":return on;case"bottom-round-rectangle":return ga;default:return}}},{key:"_getCornerRadius",value:function(r,a,n){var i=n.w,o=n.h;if(r.pstyle(a).value==="auto")return lr(i,o);var s=r.pstyle(a).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(r,a,n){if(r.visible()){var i=r._private.rscratch,o,s,u;if(n==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=r.pstyle(n+"-arrow-shape").value;if(l!=="none"){var f=r.pstyle(n+"-arrow-color").value,v=r.pstyle("opacity").value,c=r.pstyle("line-opacity").value,h=v*c,d=r.pstyle("width").pfValue,p=r.pstyle("arrow-scale").value,g=this.r.getArrowWidth(d,p),y=this.instanceCount,m=this.transformBuffer.getMatrixView(y);Xl(m),yn(m,m,[o,s]),$o(m,m,[g,g]),Wl(m,m,u),this.vertTypeBuffer.getView(y)[0]=Lo;var b=this.indexBuffer.getView(y);zr(a,b);var E=this.colorBuffer.getView(y);wr(f,h,E),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var n=this._getEdgePoints(r);if(n){var i=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,s=r.pstyle("width").pfValue,u=r.pstyle("line-color").value,l=i*o;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=$l;var v=this.indexBuffer.getView(f);zr(a,v);var c=this.colorBuffer.getView(f);wr(u,l,c);var h=this.lineWidthBuffer.getView(f);h[0]=s;var d=this.pointAPointBBuffer.getView(f);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p<n.length-2;p+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=Kl;var y=this.indexBuffer.getView(g);zr(a,y);var m=this.colorBuffer.getView(g);wr(u,l,m);var b=this.lineWidthBuffer.getView(g);b[0]=s;var E=n[p-2],C=n[p-1],A=n[p],w=n[p+1],x=n[p+2],T=n[p+3],D=n[p+4],S=n[p+5];p==0&&(E=2*A-x+.001,C=2*w-T+.001),p==n.length-4&&(D=2*x-A+.001,S=2*T-w+.001);var R=this.pointAPointBBuffer.getView(g);R[0]=E,R[1]=C,R[2]=A,R[3]=w;var L=this.pointCPointDBuffer.getView(g);L[0]=x,L[1]=T,L[2]=D,L[3]=S,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(r);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=r[0],n[1]=r[1];else if(i==a)n[i*2]=r[r.length-2],n[i*2+1]=r[r.length-1];else{var o=i/a;this._setCurvePoint(r,o,n,i*2)}return n}},{key:"_setCurvePoint",value:function(r,a,n,i){if(r.length<=2)n[i]=r[0],n[i+1]=r[1];else{for(var o=Array(r.length-2),s=0;s<o.length;s+=2){var u=(1-a)*r[s]+a*r[s+2],l=(1-a)*r[s+1]+a*r[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,a,n,i)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var s=St(this.buffers),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(d){s.e(d)}finally{s.f()}for(var f=this.batchManager.getAtlases(),v=0;v<f.length;v++)f[v].bufferIfNeeded(r);for(var c=0;c<f.length;c++)r.activeTexture(r.TEXTURE0+c),r.bindTexture(r.TEXTURE_2D,f[c].texture),r.uniform1i(o.uTextures[c],c);r.uniform1f(o.uZoom,Wy(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var h=wr(this.bgColor,1);r.uniform4fv(o.uBGColor,h),r.drawArraysInstanced(r.TRIANGLES,0,n,i),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.reduce(function(o,s){return o+s.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(o,s){return o+s.count},0);return{atlasInfo:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])}(),Bv={};Bv.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=gm(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=rm(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new dm(r,a,t);var n=function(v){return function(c){return r.getTextAngle(c,v)}},i=function(v){return function(c){var h=c.pstyle(v);return h&&h.value}},o=function(v){return function(c){return c.pstyle("".concat(v,"-opacity")).value>0}},s=function(v){var c=v.pstyle("text-events").strValue==="yes";return c?On.USE_BB:On.IGNORE},u=function(v){var c=v.position(),h=c.x,d=c.y,p=v.outerWidth(),g=v.outerHeight();return{w:p,h:g,x1:h-p/2,y1:d-g/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:Ky,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Ro(e.getLabelKey,null),getBoundingBox:Mo(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Ro(e.getSourceLabelKey,"source"),getBoundingBox:Mo(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Ro(e.getTargetLabelKey,"target"),getBoundingBox:Mo(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=Ga(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(f,v){var c=!1;v&&v.length>0&&(c|=r.drawing.invalidate(v)),c&&l()}),pm(r)};function gm(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return ff(r)}function kv(t,e){var r=t._private.rscratch;return Ct(r,"labelWrapCachedLines",e)||[]}var Ro=function(e,r){return function(a){var n=e(a),i=kv(a,r);return i.length>1?i.map(function(o,s){return"".concat(n,"_").concat(s)}):n}},Mo=function(e,r){return function(a,n){var i=e(a);if(typeof n=="string"){var o=n.indexOf("_");if(o>0){var s=Number(n.substring(o+1)),u=kv(a,r),l=i.h/u.length,f=l*s,v=i.y1+f;return{x1:i.x1,w:i.w,y1:v,h:l,yOffset:f}}}return i}};function pm(t){{var e=t.render;t.render=function(i){i=i||{};var o=t.cy;t.webgl&&(o.zoom()>Lv?(ym(t),e.call(t,i)):(mm(t),Gv(t,i,xa.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(i){r.call(t,i),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(i,o,s,u){return Cm(t,i,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var n=t.notify;t.notify=function(i,o){n.call(t,i,o),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function ym(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function mm(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function bm(t){var e=t.canvasWidth,r=t.canvasHeight,a=xs(t),n=a.pan,i=a.zoom,o=So();yn(o,o,[n.x,n.y]),$o(o,o,[i,i]);var s=So();nm(s,e,r);var u=So();return am(u,s,o),u}function Fv(t,e){var r=t.canvasWidth,a=t.canvasHeight,n=xs(t),i=n.pan,o=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(i.x,i.y),e.scale(o,o)}function wm(t,e){t.drawSelectionRectangle(e,function(r){return Fv(t,r)})}function Em(t){var e=t.data.contexts[t.NODE];e.save(),Fv(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function xm(t){var e=function(n,i,o){for(var s=n.atlasManager.getAtlasCollection(i),u=t.data.contexts[t.NODE],l=s.atlases,f=0;f<l.length;f++){var v=l[f],c=v.canvas;if(c){var h=c.width,d=c.height,p=h*f,g=c.height*o,y=.4;u.save(),u.scale(y,y),u.drawImage(c,p,g),u.strokeStyle="black",u.rect(p,g,h,d),u.stroke(),u.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function Tm(t,e,r,a,n){var i,o,s,u,l=xs(t),f=l.pan,v=l.zoom;{var c=$y(t,f,v,e,r),h=tt(c,2),d=h[0],p=h[1],g=6;i=d-g/2,o=p-g/2,s=g,u=g}if(s===0||u===0)return[];var y=t.data.contexts[t.WEBGL];y.bindFramebuffer(y.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(y.viewport(0,0,y.canvas.width,y.canvas.height),Gv(t,null,xa.PICKING),t.pickingFrameBuffer.needsDraw=!1);var m=s*u,b=new Uint8Array(m*4);y.readPixels(i,o,s,u,y.RGBA,y.UNSIGNED_BYTE,b),y.bindFramebuffer(y.FRAMEBUFFER,null);for(var E=new Set,C=0;C<m;C++){var A=b.slice(C*4,C*4+4),w=Qy(A)-1;w>=0&&E.add(w)}return E}function Cm(t,e,r){var a=Tm(t,e,r),n=t.getCachedZSortedEles(),i,o,s=St(a),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,f=n[l];if(!i&&f.isNode()&&(i=f),!o&&f.isEdge()&&(o=f),i&&o)break}}catch(v){s.e(v)}finally{s.f()}return[i,o].filter(Boolean)}function Po(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function Gv(t,e,r){var a;t.webglDebug&&(a=performance.now());var n=t.drawing,i=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&wm(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=bm(t),u=t.getCachedZSortedEles();if(i=u.length,n.startFrame(s,r),r.screen){for(var l=0;l<u.nondrag.length;l++)Po(t,l,u.nondrag[l]);for(var f=0;f<u.drag.length;f++)Po(t,f,u.drag[f])}else if(r.picking)for(var v=0;v<u.length;v++)Po(t,v,u[v]);n.endFrame(),r.screen&&t.webglDebugShowAtlases&&(Em(t),xm(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var c=performance.now(),h=!1,d=Math.ceil(c-a),p=n.getDebugInfo(),g=["".concat(i," elements"),"".concat(p.totalInstances," instances"),"".concat(p.batchCount," batches"),"".concat(p.totalAtlases," atlases"),"".concat(p.wrappedCount," wrapped textures"),"".concat(p.simpleCount," simple shapes")].join(", ");if(h)console.log("WebGL (".concat(r.name,") - time ").concat(d,"ms, ").concat(g));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(d,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var y=p.atlasInfo,m=St(y),b;try{for(m.s();!(b=m.n()).done;){var E=b.value;console.log(" ".concat(E.type,": ").concat(E.keyCount," keys, ").concat(E.atlasCount," atlases"))}}catch(C){m.e(C)}finally{m.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,n.gc())}var yr={};yr.drawPolygonPath=function(t,e,r,a,n,i){var o=a/2,s=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+s*i[1]);for(var u=1;u<i.length/2;u++)t.lineTo(e+o*i[u*2],r+s*i[u*2+1]);t.closePath()};yr.drawRoundPolygonPath=function(t,e,r,a,n,i,o){o.forEach(function(s){return bv(t,s)}),t.closePath()};yr.drawRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?lr(a,n):Math.min(i,s,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.arcTo(e+o,r-s,e+o,r,u),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.arcTo(e-o,r-s,e,r-s,u),t.lineTo(e,r-s),t.closePath()};yr.drawBottomRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?lr(a,n):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+o,r-s),t.lineTo(e+o,r),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.lineTo(e-o,r-s),t.lineTo(e,r-s),t.closePath()};yr.drawCutRectanglePath=function(t,e,r,a,n,i,o){var s=a/2,u=n/2,l=o==="auto"?us():o;t.beginPath&&t.beginPath(),t.moveTo(e-s+l,r-u),t.lineTo(e+s-l,r-u),t.lineTo(e+s,r-u+l),t.lineTo(e+s,r+u-l),t.lineTo(e+s-l,r+u),t.lineTo(e-s+l,r+u),t.lineTo(e-s,r+u-l),t.lineTo(e-s,r-u+l),t.closePath()};yr.drawBarrelPath=function(t,e,r,a,n){var i=a/2,o=n/2,s=e-i,u=e+i,l=r-o,f=r+o,v=No(a,n),c=v.widthOffset,h=v.heightOffset,d=v.ctrlPtOffsetPct*c;t.beginPath&&t.beginPath(),t.moveTo(s,l+h),t.lineTo(s,f-h),t.quadraticCurveTo(s+d,f,s+c,f),t.lineTo(u-c,f),t.quadraticCurveTo(u-d,f,u,f-h),t.lineTo(u,l+h),t.quadraticCurveTo(u-d,l,u-c,l),t.lineTo(s+c,l),t.quadraticCurveTo(s+d,l,s,l+h),t.closePath()};var Zl=Math.sin(0),Ql=Math.cos(0),Ko={},Zo={},zv=Math.PI/40;for(var Vr=0*Math.PI;Vr<2*Math.PI;Vr+=zv)Ko[Vr]=Math.sin(Vr),Zo[Vr]=Math.cos(Vr);yr.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,o,s=a/2,u=n/2,l=0*Math.PI;l<2*Math.PI;l+=zv)i=e-s*Ko[l]*Zl+s*Zo[l]*Ql,o=r+u*Zo[l]*Zl+u*Ko[l]*Ql,l===0?t.moveTo(i,o):t.lineTo(i,o);t.closePath()};var Ya={};Ya.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Ya.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],o=t.full?Math.ceil(a.h):n[3],s=ae(t.maxWidth)||ae(t.maxHeight),u=this.getPixelRatio(),l=1;if(t.scale!==void 0)i*=t.scale,o*=t.scale,l=t.scale;else if(s){var f=1/0,v=1/0;ae(t.maxWidth)&&(f=l*t.maxWidth/i),ae(t.maxHeight)&&(v=l*t.maxHeight/o),l=Math.min(f,v),i*=l,o*=l}s||(i*=u,o*=u,l*=u);var c=document.createElement("canvas");c.width=i,c.height=o,c.style.width=i+"px",c.style.height=o+"px";var h=c.getContext("2d");if(i>0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)h.translate(-a.x1*l,-a.y1*l),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(a.x1*l,a.y1*l);else{var p=e.pan(),g={x:p.x*l,y:p.y*l};l*=e.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}t.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=t.bg,h.rect(0,0,i,o),h.fill())}return c};function Dm(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function Jl(t){var e=t.indexOf(",");return t.substr(e+1)}function _v(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new ra(function(n,i){try{e.toBlob(function(o){o!=null?n(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){i(o)}});case"blob":return Dm(Jl(a()),r);case"base64":return Jl(a());case"base64uri":default:return a()}}Ya.png=function(t){return _v(t,this.bufferCanvasImage(t),"image/png")};Ya.jpg=function(t){return _v(t,this.bufferCanvasImage(t),"image/jpeg")};var Vv={};Vv.nodeShapeImpl=function(t,e,r,a,n,i,o,s){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i,s);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var Sm=Uv,Te=Uv.prototype;Te.CANVAS_LAYERS=3;Te.SELECT_BOX=0;Te.DRAG=1;Te.NODE=2;Te.WEBGL=3;Te.CANVAS_TYPES=["2d","2d","2d","webgl2"];Te.BUFFER_COUNT=3;Te.TEXTURE_BUFFER=0;Te.MOTIONBLUR_BUFFER_NODE=1;Te.MOTIONBLUR_BUFFER_DRAG=2;function Uv(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(Te.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Te.CANVAS_LAYERS),contexts:new Array(Te.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Te.CANVAS_LAYERS),bufferCanvases:new Array(Te.BUFFER_COUNT),bufferContexts:new Array(Te.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=t.cy.container();s.appendChild(e.data.canvasContainer),s.style[n]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Ec()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Te.CANVAS_LAYERS;l++){var f=e.data.canvases[l]=a.createElement("canvas"),v=Te.CANVAS_TYPES[l];e.data.contexts[l]=f.getContext(v),e.data.contexts[l]||Ye("Could not create canvas of type "+v),Object.keys(u).forEach(function(Q){f.style[Q]=u[Q]}),f.style.position="absolute",f.setAttribute("data-id","layer"+l),f.style.zIndex=String(Te.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(f),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Te.NODE].setAttribute("data-id","layer"+Te.NODE+"-node"),e.data.canvases[Te.SELECT_BOX].setAttribute("data-id","layer"+Te.SELECT_BOX+"-selectbox"),e.data.canvases[Te.DRAG].setAttribute("data-id","layer"+Te.DRAG+"-drag"),e.data.canvases[Te.WEBGL]&&e.data.canvases[Te.WEBGL].setAttribute("data-id","layer"+Te.WEBGL+"-webgl");for(var l=0;l<Te.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=a.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var c=wt(),h=function(_){return{x:(_.x1+_.x2)/2,y:(_.y1+_.y2)/2}},d=function(_){return{x:-_.w/2,y:-_.h/2}},p=function(_){var q=_[0]._private,Y=q.oldBackgroundTimestamp===q.backgroundTimestamp;return!Y},g=function(_){return _[0]._private.nodeKey},y=function(_){return _[0]._private.labelStyleKey},m=function(_){return _[0]._private.sourceLabelStyleKey},b=function(_){return _[0]._private.targetLabelStyleKey},E=function(_,q,Y,ee,ne){return e.drawElement(_,q,Y,!1,!1,ne)},C=function(_,q,Y,ee,ne){return e.drawElementText(_,q,Y,ee,"main",ne)},A=function(_,q,Y,ee,ne){return e.drawElementText(_,q,Y,ee,"source",ne)},w=function(_,q,Y,ee,ne){return e.drawElementText(_,q,Y,ee,"target",ne)},x=function(_){return _.boundingBox(),_[0]._private.bodyBounds},T=function(_){return _.boundingBox(),_[0]._private.labelBounds.main||c},D=function(_){return _.boundingBox(),_[0]._private.labelBounds.source||c},S=function(_){return _.boundingBox(),_[0]._private.labelBounds.target||c},R=function(_,q){return q},L=function(_){return h(x(_))},M=function(_,q,Y){var ee=_?_+"-":"";return{x:q.x+Y.pstyle(ee+"text-margin-x").pfValue,y:q.y+Y.pstyle(ee+"text-margin-y").pfValue}},I=function(_,q,Y){var ee=_[0]._private.rscratch;return{x:ee[q],y:ee[Y]}},N=function(_){return M("",I(_,"labelX","labelY"),_)},B=function(_){return M("source",I(_,"sourceLabelX","sourceLabelY"),_)},O=function(_){return M("target",I(_,"targetLabelX","targetLabelY"),_)},F=function(_){return d(x(_))},G=function(_){return d(D(_))},k=function(_){return d(S(_))},z=function(_){var q=T(_),Y=d(T(_));if(_.isNode()){switch(_.pstyle("text-halign").value){case"left":Y.x=-q.w-(q.leftPad||0);break;case"right":Y.x=-(q.rightPad||0);break}switch(_.pstyle("text-valign").value){case"top":Y.y=-q.h-(q.topPad||0);break;case"bottom":Y.y=-(q.botPad||0);break}}return Y},U=e.data.eleTxrCache=new ba(e,{getKey:g,doesEleInvalidateKey:p,drawElement:E,getBoundingBox:x,getRotationPoint:L,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),H=e.data.lblTxrCache=new ba(e,{getKey:y,drawElement:C,getBoundingBox:T,getRotationPoint:N,getRotationOffset:z,isVisible:R}),$=e.data.slbTxrCache=new ba(e,{getKey:m,drawElement:A,getBoundingBox:D,getRotationPoint:B,getRotationOffset:G,isVisible:R}),K=e.data.tlbTxrCache=new ba(e,{getKey:b,drawElement:w,getBoundingBox:S,getRotationPoint:O,getRotationOffset:k,isVisible:R}),j=e.data.lyrTxrCache=new Rv(e);e.onUpdateEleCalcs(function(_,q){U.invalidateElements(q),H.invalidateElements(q),$.invalidateElements(q),K.invalidateElements(q),j.invalidateElements(q);for(var Y=0;Y<q.length;Y++){var ee=q[Y]._private;ee.oldBackgroundTimestamp=ee.backgroundTimestamp}});var re=function(_){for(var q=0;q<_.length;q++)j.enqueueElementRefinement(_[q].ele)};U.onDequeue(re),H.onDequeue(re),$.onDequeue(re),K.onDequeue(re),t.webgl&&e.initWebgl(t,{getStyleKey:g,getLabelKey:y,getSourceLabelKey:m,getTargetLabelKey:b,drawElement:E,drawLabel:C,drawSourceLabel:A,drawTargetLabel:w,getElementBox:x,getLabelBox:T,getSourceLabelBox:D,getTargetLabelBox:S,getElementRotationPoint:L,getElementRotationOffset:F,getLabelRotationPoint:N,getSourceLabelRotationPoint:B,getTargetLabelRotationPoint:O,getLabelRotationOffset:z,getSourceLabelRotationOffset:G,getTargetLabelRotationOffset:k})}Te.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Te.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Te.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Te.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var Am=typeof Path2D<"u";Te.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Te.usePaths=function(){return Am&&this.pathsEnabled};Te.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};Te.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};Te.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":at(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),n=a.document;r=n.createElement("canvas"),r.width=t,r.height=e}return r};[Mv,qt,Jt,Es,Ir,pr,Et,Bv,yr,Ya,Vv].forEach(function(t){pe(Te,t)});var Lm=[{name:"null",impl:pv},{name:"base",impl:Sv},{name:"canvas",impl:Sm}],Rm=[{type:"layout",extensions:ty},{type:"renderer",extensions:Lm}],qv={},Yv={};function Hv(t,e,r){var a=r,n=function(x){Ne("Can not register `"+e+"` for `"+t+"` since `"+x+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Pa.prototype[e])return n(e);Pa.prototype[e]=r}else if(t==="collection"){if(vt.prototype[e])return n(e);vt.prototype[e]=r}else if(t==="layout"){for(var i=function(x){this.options=x,r.call(this,x),Pe(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var f=r.prototype.stop;o.stop=function(){var w=this.options;if(w&&w.animate){var x=this.animations;if(x)for(var T=0;T<x.length;T++)x[T].stop()}return f?f.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var v=function(x){return x._private.cy},c={addEventFields:function(x,T){T.layout=x,T.cy=v(x),T.target=x},bubble:function(){return!0},parent:function(x){return v(x)}};pe(o,{createEmitter:function(){return this._private.emitter=new Hn(c,this),this},emitter:function(){return this._private.emitter},on:function(x,T){return this.emitter().on(x,T),this},one:function(x,T){return this.emitter().one(x,T),this},once:function(x,T){return this.emitter().one(x,T),this},removeListener:function(x,T){return this.emitter().removeListener(x,T),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(x,T){return this.emitter().emit(x,T),this}}),Oe.eventAliasesOn(o),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var h=Xv("renderer","base"),d=h.prototype,p=r,g=r.prototype,y=function(){h.apply(this,arguments),p.apply(this,arguments)},m=y.prototype;for(var b in d){var E=d[b],C=g[b]!=null;if(C)return n(b);m[b]=E}for(var A in g)m[A]=g[A];d.clientFunctions.forEach(function(w){m[w]=m[w]||function(){Ye("Renderer does not implement `renderer."+w+"()` on its prototype")}}),a=y}else if(t==="__proto__"||t==="constructor"||t==="prototype")return Ye(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return vf({map:qv,keys:[t,e],value:a})}function Xv(t,e){return cf({map:qv,keys:[t,e]})}function Mm(t,e,r,a,n){return vf({map:Yv,keys:[t,e,r,a],value:n})}function Pm(t,e,r,a){return cf({map:Yv,keys:[t,e,r,a]})}var Qo=function(){if(arguments.length===2)return Xv.apply(null,arguments);if(arguments.length===3)return Hv.apply(null,arguments);if(arguments.length===4)return Pm.apply(null,arguments);if(arguments.length===5)return Mm.apply(null,arguments);Ye("Invalid extension access syntax")};Pa.prototype.extension=Qo;Rm.forEach(function(t){t.extensions.forEach(function(e){Hv(t.type,e.name,e.impl)})});var Nn=function(){if(!(this instanceof Nn))return new Nn;this.length=0},Mr=Nn.prototype;Mr.instanceString=function(){return"stylesheet"};Mr.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};Mr.css=function(t,e){var r=this.length-1;if(he(t))this[r].properties.push({name:t,value:e});else if(Pe(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var o=n[i],s=a[o];if(s!=null){var u=st.properties[o]||st.properties[Bn(o)];if(u!=null){var l=u.name,f=s;this[r].properties.push({name:l,value:f})}}}return this};Mr.style=Mr.css;Mr.generateStyle=function(t){var e=new st(t);return this.appendToStyle(e)};Mr.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var o=n[i];t.css(o.name,o.value)}}return t};var Im="3.32.1",ea=function(e){if(e===void 0&&(e={}),Pe(e))return new Pa(e);if(he(e))return Qo.apply(Qo,arguments)};ea.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(ea),t.apply(null,e),this};ea.warnings=function(t){return bf(t)};ea.version=Im;ea.stylesheet=ea.Stylesheet=Nn;var mn={exports:{}},bn={exports:{}},wn={exports:{}},Om=wn.exports,jl;function Nm(){return jl||(jl=1,function(t,e){(function(a,n){t.exports=n()})(Om,function(){return function(r){var a={};function n(i){if(a[i])return a[i].exports;var o=a[i]={i,l:!1,exports:{}};return r[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=r,n.c=a,n.i=function(i){return i},n.d=function(i,o,s){n.o(i,o)||Object.defineProperty(i,o,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(o,"a",o),o},n.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},n.p="",n(n.s=26)}([function(r,a,n){function i(){}i.QUALITY=1,i.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,i.DEFAULT_INCREMENTAL=!1,i.DEFAULT_ANIMATION_ON_LAYOUT=!0,i.DEFAULT_ANIMATION_DURING_LAYOUT=!1,i.DEFAULT_ANIMATION_PERIOD=50,i.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,i.DEFAULT_GRAPH_MARGIN=15,i.NODE_DIMENSIONS_INCLUDE_LABELS=!1,i.SIMPLE_NODE_SIZE=40,i.SIMPLE_NODE_HALF_SIZE=i.SIMPLE_NODE_SIZE/2,i.EMPTY_COMPOUND_NODE_SIZE=40,i.MIN_EDGE_LENGTH=1,i.WORLD_BOUNDARY=1e6,i.INITIAL_WORLD_BOUNDARY=i.WORLD_BOUNDARY/1e3,i.WORLD_CENTER_X=1200,i.WORLD_CENTER_Y=900,r.exports=i},function(r,a,n){var i=n(2),o=n(8),s=n(9);function u(f,v,c){i.call(this,c),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=c,this.bendpoints=[],this.source=f,this.target=v}u.prototype=Object.create(i.prototype);for(var l in i)u[l]=i[l];u.prototype.getSource=function(){return this.source},u.prototype.getTarget=function(){return this.target},u.prototype.isInterGraph=function(){return this.isInterGraph},u.prototype.getLength=function(){return this.length},u.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},u.prototype.getBendpoints=function(){return this.bendpoints},u.prototype.getLca=function(){return this.lca},u.prototype.getSourceInLca=function(){return this.sourceInLca},u.prototype.getTargetInLca=function(){return this.targetInLca},u.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},u.prototype.getOtherEndInGraph=function(f,v){for(var c=this.getOtherEnd(f),h=v.getGraphManager().getRoot();;){if(c.getOwner()==v)return c;if(c.getOwner()==h)break;c=c.getOwner().getParent()}return null},u.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},u.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},r.exports=u},function(r,a,n){function i(o){this.vGraphObject=o}r.exports=i},function(r,a,n){var i=n(2),o=n(10),s=n(13),u=n(0),l=n(16),f=n(4);function v(h,d,p,g){p==null&&g==null&&(g=d),i.call(this,g),h.graphManager!=null&&(h=h.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=h,p!=null&&d!=null?this.rect=new s(d.x,d.y,p.width,p.height):this.rect=new s}v.prototype=Object.create(i.prototype);for(var c in i)v[c]=i[c];v.prototype.getEdges=function(){return this.edges},v.prototype.getChild=function(){return this.child},v.prototype.getOwner=function(){return this.owner},v.prototype.getWidth=function(){return this.rect.width},v.prototype.setWidth=function(h){this.rect.width=h},v.prototype.getHeight=function(){return this.rect.height},v.prototype.setHeight=function(h){this.rect.height=h},v.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},v.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},v.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},v.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},v.prototype.getRect=function(){return this.rect},v.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},v.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},v.prototype.setRect=function(h,d){this.rect.x=h.x,this.rect.y=h.y,this.rect.width=d.width,this.rect.height=d.height},v.prototype.setCenter=function(h,d){this.rect.x=h-this.rect.width/2,this.rect.y=d-this.rect.height/2},v.prototype.setLocation=function(h,d){this.rect.x=h,this.rect.y=d},v.prototype.moveBy=function(h,d){this.rect.x+=h,this.rect.y+=d},v.prototype.getEdgeListToNode=function(h){var d=[],p=this;return p.edges.forEach(function(g){if(g.target==h){if(g.source!=p)throw"Incorrect edge source!";d.push(g)}}),d},v.prototype.getEdgesBetween=function(h){var d=[],p=this;return p.edges.forEach(function(g){if(!(g.source==p||g.target==p))throw"Incorrect edge source and/or target";(g.target==h||g.source==h)&&d.push(g)}),d},v.prototype.getNeighborsList=function(){var h=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)h.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";h.add(p.source)}}),h},v.prototype.withChildren=function(){var h=new Set,d,p;if(h.add(this),this.child!=null)for(var g=this.child.getNodes(),y=0;y<g.length;y++)d=g[y],p=d.withChildren(),p.forEach(function(m){h.add(m)});return h},v.prototype.getNoOfChildren=function(){var h=0,d;if(this.child==null)h=1;else for(var p=this.child.getNodes(),g=0;g<p.length;g++)d=p[g],h+=d.getNoOfChildren();return h==0&&(h=1),h},v.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},v.prototype.calcEstimatedSize=function(){return this.child==null?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)},v.prototype.scatter=function(){var h,d,p=-u.INITIAL_WORLD_BOUNDARY,g=u.INITIAL_WORLD_BOUNDARY;h=u.WORLD_CENTER_X+l.nextDouble()*(g-p)+p;var y=-u.INITIAL_WORLD_BOUNDARY,m=u.INITIAL_WORLD_BOUNDARY;d=u.WORLD_CENTER_Y+l.nextDouble()*(m-y)+y,this.rect.x=h,this.rect.y=d},v.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var h=this.getChild();if(h.updateBounds(!0),this.rect.x=h.getLeft(),this.rect.y=h.getTop(),this.setWidth(h.getRight()-h.getLeft()),this.setHeight(h.getBottom()-h.getTop()),u.NODE_DIMENSIONS_INCLUDE_LABELS){var d=h.getRight()-h.getLeft(),p=h.getBottom()-h.getTop();this.labelWidth>d&&(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)),this.labelHeight>p&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-p)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-p),this.setHeight(this.labelHeight))}}},v.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},v.prototype.transform=function(h){var d=this.rect.x;d>u.WORLD_BOUNDARY?d=u.WORLD_BOUNDARY:d<-u.WORLD_BOUNDARY&&(d=-u.WORLD_BOUNDARY);var p=this.rect.y;p>u.WORLD_BOUNDARY?p=u.WORLD_BOUNDARY:p<-u.WORLD_BOUNDARY&&(p=-u.WORLD_BOUNDARY);var g=new f(d,p),y=h.inverseTransformPoint(g);this.setLocation(y.x,y.y)},v.prototype.getLeft=function(){return this.rect.x},v.prototype.getRight=function(){return this.rect.x+this.rect.width},v.prototype.getTop=function(){return this.rect.y},v.prototype.getBottom=function(){return this.rect.y+this.rect.height},v.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=v},function(r,a,n){function i(o,s){o==null&&s==null?(this.x=0,this.y=0):(this.x=o,this.y=s)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(o){this.x=o},i.prototype.setY=function(o){this.y=o},i.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},r.exports=i},function(r,a,n){var i=n(2),o=n(10),s=n(0),u=n(6),l=n(3),f=n(1),v=n(13),c=n(12),h=n(11);function d(g,y,m){i.call(this,m),this.estimatedSize=o.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,y!=null&&y instanceof u?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}d.prototype=Object.create(i.prototype);for(var p in i)d[p]=i[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(g,y,m){if(y==null&&m==null){var b=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(b)>-1)throw"Node already in graph!";return b.owner=this,this.getNodes().push(b),b}else{var E=g;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(m)>-1))throw"Source or target not in graph!";if(!(y.owner==m.owner&&y.owner==this))throw"Both owners must be this graph!";return y.owner!=m.owner?null:(E.source=y,E.target=m,E.isInterGraph=!1,this.getEdges().push(E),y.edges.push(E),m!=y&&m.edges.push(E),E)}},d.prototype.remove=function(g){var y=g;if(g instanceof l){if(y==null)throw"Node is null!";if(!(y.owner!=null&&y.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var m=y.edges.slice(),b,E=m.length,C=0;C<E;C++)b=m[C],b.isInterGraph?this.graphManager.remove(b):b.source.owner.remove(b);var A=this.nodes.indexOf(y);if(A==-1)throw"Node not in owner node list!";this.nodes.splice(A,1)}else if(g instanceof f){var b=g;if(b==null)throw"Edge is null!";if(!(b.source!=null&&b.target!=null))throw"Source and/or target is null!";if(!(b.source.owner!=null&&b.target.owner!=null&&b.source.owner==this&&b.target.owner==this))throw"Source and/or target owner is invalid!";var w=b.source.edges.indexOf(b),x=b.target.edges.indexOf(b);if(!(w>-1&&x>-1))throw"Source and/or target doesn't know this edge!";b.source.edges.splice(w,1),b.target!=b.source&&b.target.edges.splice(x,1);var A=b.source.owner.getEdges().indexOf(b);if(A==-1)throw"Not in owner's edge list!";b.source.owner.getEdges().splice(A,1)}},d.prototype.updateLeftTop=function(){for(var g=o.MAX_VALUE,y=o.MAX_VALUE,m,b,E,C=this.getNodes(),A=C.length,w=0;w<A;w++){var x=C[w];m=x.getTop(),b=x.getLeft(),g>m&&(g=m),y>b&&(y=b)}return g==o.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?E=C[0].getParent().paddingLeft:E=this.margin,this.left=y-E,this.top=g-E,new c(this.left,this.top))},d.prototype.updateBounds=function(g){for(var y=o.MAX_VALUE,m=-o.MAX_VALUE,b=o.MAX_VALUE,E=-o.MAX_VALUE,C,A,w,x,T,D=this.nodes,S=D.length,R=0;R<S;R++){var L=D[R];g&&L.child!=null&&L.updateBounds(),C=L.getLeft(),A=L.getRight(),w=L.getTop(),x=L.getBottom(),y>C&&(y=C),m<A&&(m=A),b>w&&(b=w),E<x&&(E=x)}var M=new v(y,b,m-y,E-b);y==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),D[0].getParent().paddingLeft!=null?T=D[0].getParent().paddingLeft:T=this.margin,this.left=M.x-T,this.right=M.x+M.width+T,this.top=M.y-T,this.bottom=M.y+M.height+T},d.calculateBounds=function(g){for(var y=o.MAX_VALUE,m=-o.MAX_VALUE,b=o.MAX_VALUE,E=-o.MAX_VALUE,C,A,w,x,T=g.length,D=0;D<T;D++){var S=g[D];C=S.getLeft(),A=S.getRight(),w=S.getTop(),x=S.getBottom(),y>C&&(y=C),m<A&&(m=A),b>w&&(b=w),E<x&&(E=x)}var R=new v(y,b,m-y,E-b);return R},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var g=0,y=this.nodes,m=y.length,b=0;b<m;b++){var E=y[b];g+=E.calcEstimatedSize()}return g==0?this.estimatedSize=s.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=g/Math.sqrt(this.nodes.length),this.estimatedSize},d.prototype.updateConnected=function(){var g=this;if(this.nodes.length==0){this.isConnected=!0;return}var y=new h,m=new Set,b=this.nodes[0],E,C,A=b.withChildren();for(A.forEach(function(R){y.push(R),m.add(R)});y.length!==0;){b=y.shift(),E=b.getEdges();for(var w=E.length,x=0;x<w;x++){var T=E[x];if(C=T.getOtherEndInGraph(b,this),C!=null&&!m.has(C)){var D=C.withChildren();D.forEach(function(R){y.push(R),m.add(R)})}}}if(this.isConnected=!1,m.size>=this.nodes.length){var S=0;m.forEach(function(R){R.owner==g&&S++}),S==this.nodes.length&&(this.isConnected=!0)}},r.exports=d},function(r,a,n){var i,o=n(1);function s(u){i=n(5),this.layout=u,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var u=this.layout.newGraph(),l=this.layout.newNode(null),f=this.add(u,l);return this.setRootGraph(f),this.rootGraph},s.prototype.add=function(u,l,f,v,c){if(f==null&&v==null&&c==null){if(u==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(u)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(u),u.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return u.parent=l,l.child=u,u}else{c=f,v=l,f=u;var h=v.getOwner(),d=c.getOwner();if(!(h!=null&&h.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(h==d)return f.isInterGraph=!1,h.add(f,v,c);if(f.isInterGraph=!0,f.source=v,f.target=c,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},s.prototype.remove=function(u){if(u instanceof i){var l=u;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(l.getEdges());for(var v,c=f.length,h=0;h<c;h++)v=f[h],l.remove(v);var d=[];d=d.concat(l.getNodes());var p;c=d.length;for(var h=0;h<c;h++)p=d[h],l.remove(p);l==this.rootGraph&&this.setRootGraph(null);var g=this.graphs.indexOf(l);this.graphs.splice(g,1),l.parent=null}else if(u instanceof o){if(v=u,v==null)throw"Edge is null!";if(!v.isInterGraph)throw"Not an inter-graph edge!";if(!(v.source!=null&&v.target!=null))throw"Source and/or target is null!";if(!(v.source.edges.indexOf(v)!=-1&&v.target.edges.indexOf(v)!=-1))throw"Source and/or target doesn't know this edge!";var g=v.source.edges.indexOf(v);if(v.source.edges.splice(g,1),g=v.target.edges.indexOf(v),v.target.edges.splice(g,1),!(v.source.owner!=null&&v.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(v.source.owner.getGraphManager().edges.indexOf(v)==-1)throw"Not in owner graph manager's edge list!";var g=v.source.owner.getGraphManager().edges.indexOf(v);v.source.owner.getGraphManager().edges.splice(g,1)}},s.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},s.prototype.getGraphs=function(){return this.graphs},s.prototype.getAllNodes=function(){if(this.allNodes==null){for(var u=[],l=this.getGraphs(),f=l.length,v=0;v<f;v++)u=u.concat(l[v].getNodes());this.allNodes=u}return this.allNodes},s.prototype.resetAllNodes=function(){this.allNodes=null},s.prototype.resetAllEdges=function(){this.allEdges=null},s.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},s.prototype.getAllEdges=function(){if(this.allEdges==null){var u=[],l=this.getGraphs();l.length;for(var f=0;f<l.length;f++)u=u.concat(l[f].getEdges());u=u.concat(this.edges),this.allEdges=u}return this.allEdges},s.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},s.prototype.setAllNodesToApplyGravitation=function(u){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=u},s.prototype.getRoot=function(){return this.rootGraph},s.prototype.setRootGraph=function(u){if(u.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=u,u.parent==null&&(u.parent=this.layout.newNode("Root node"))},s.prototype.getLayout=function(){return this.layout},s.prototype.isOneAncestorOfOther=function(u,l){if(!(u!=null&&l!=null))throw"assert failed";if(u==l)return!0;var f=u.getOwner(),v;do{if(v=f.getParent(),v==null)break;if(v==l)return!0;if(f=v.getOwner(),f==null)break}while(!0);f=l.getOwner();do{if(v=f.getParent(),v==null)break;if(v==u)return!0;if(f=v.getOwner(),f==null)break}while(!0);return!1},s.prototype.calcLowestCommonAncestors=function(){for(var u,l,f,v,c,h=this.getAllEdges(),d=h.length,p=0;p<d;p++){if(u=h[p],l=u.source,f=u.target,u.lca=null,u.sourceInLca=l,u.targetInLca=f,l==f){u.lca=l.getOwner();continue}for(v=l.getOwner();u.lca==null;){for(u.targetInLca=f,c=f.getOwner();u.lca==null;){if(c==v){u.lca=c;break}if(c==this.rootGraph)break;if(u.lca!=null)throw"assert failed";u.targetInLca=c.getParent(),c=u.targetInLca.getOwner()}if(v==this.rootGraph)break;u.lca==null&&(u.sourceInLca=v.getParent(),v=u.sourceInLca.getOwner())}if(u.lca==null)throw"assert failed"}},s.prototype.calcLowestCommonAncestor=function(u,l){if(u==l)return u.getOwner();var f=u.getOwner();do{if(f==null)break;var v=l.getOwner();do{if(v==null)break;if(v==f)return v;v=v.getParent().getOwner()}while(!0);f=f.getParent().getOwner()}while(!0);return f},s.prototype.calcInclusionTreeDepths=function(u,l){u==null&&l==null&&(u=this.rootGraph,l=1);for(var f,v=u.getNodes(),c=v.length,h=0;h<c;h++)f=v[h],f.inclusionTreeDepth=l,f.child!=null&&this.calcInclusionTreeDepths(f.child,l+1)},s.prototype.includesInvalidEdge=function(){for(var u,l=this.edges.length,f=0;f<l;f++)if(u=this.edges[f],this.isOneAncestorOfOther(u.source,u.target))return!0;return!1},r.exports=s},function(r,a,n){var i=n(0);function o(){}for(var s in i)o[s]=i[s];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=o.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=o},function(r,a,n){var i=n(12);function o(){}o.calcSeparationAmount=function(s,u,l,f){if(!s.intersects(u))throw"assert failed";var v=new Array(2);this.decideDirectionsForOverlappingNodes(s,u,v),l[0]=Math.min(s.getRight(),u.getRight())-Math.max(s.x,u.x),l[1]=Math.min(s.getBottom(),u.getBottom())-Math.max(s.y,u.y),s.getX()<=u.getX()&&s.getRight()>=u.getRight()?l[0]+=Math.min(u.getX()-s.getX(),s.getRight()-u.getRight()):u.getX()<=s.getX()&&u.getRight()>=s.getRight()&&(l[0]+=Math.min(s.getX()-u.getX(),u.getRight()-s.getRight())),s.getY()<=u.getY()&&s.getBottom()>=u.getBottom()?l[1]+=Math.min(u.getY()-s.getY(),s.getBottom()-u.getBottom()):u.getY()<=s.getY()&&u.getBottom()>=s.getBottom()&&(l[1]+=Math.min(s.getY()-u.getY(),u.getBottom()-s.getBottom()));var c=Math.abs((u.getCenterY()-s.getCenterY())/(u.getCenterX()-s.getCenterX()));u.getCenterY()===s.getCenterY()&&u.getCenterX()===s.getCenterX()&&(c=1);var h=c*l[0],d=l[1]/c;l[0]<d?d=l[0]:h=l[1],l[0]=-1*v[0]*(d/2+f),l[1]=-1*v[1]*(h/2+f)},o.decideDirectionsForOverlappingNodes=function(s,u,l){s.getCenterX()<u.getCenterX()?l[0]=-1:l[0]=1,s.getCenterY()<u.getCenterY()?l[1]=-1:l[1]=1},o.getIntersection2=function(s,u,l){var f=s.getCenterX(),v=s.getCenterY(),c=u.getCenterX(),h=u.getCenterY();if(s.intersects(u))return l[0]=f,l[1]=v,l[2]=c,l[3]=h,!0;var d=s.getX(),p=s.getY(),g=s.getRight(),y=s.getX(),m=s.getBottom(),b=s.getRight(),E=s.getWidthHalf(),C=s.getHeightHalf(),A=u.getX(),w=u.getY(),x=u.getRight(),T=u.getX(),D=u.getBottom(),S=u.getRight(),R=u.getWidthHalf(),L=u.getHeightHalf(),M=!1,I=!1;if(f===c){if(v>h)return l[0]=f,l[1]=p,l[2]=c,l[3]=D,!1;if(v<h)return l[0]=f,l[1]=m,l[2]=c,l[3]=w,!1}else if(v===h){if(f>c)return l[0]=d,l[1]=v,l[2]=x,l[3]=h,!1;if(f<c)return l[0]=g,l[1]=v,l[2]=A,l[3]=h,!1}else{var N=s.height/s.width,B=u.height/u.width,O=(h-v)/(c-f),F=void 0,G=void 0,k=void 0,z=void 0,U=void 0,H=void 0;if(-N===O?f>c?(l[0]=y,l[1]=m,M=!0):(l[0]=g,l[1]=p,M=!0):N===O&&(f>c?(l[0]=d,l[1]=p,M=!0):(l[0]=b,l[1]=m,M=!0)),-B===O?c>f?(l[2]=T,l[3]=D,I=!0):(l[2]=x,l[3]=w,I=!0):B===O&&(c>f?(l[2]=A,l[3]=w,I=!0):(l[2]=S,l[3]=D,I=!0)),M&&I)return!1;if(f>c?v>h?(F=this.getCardinalDirection(N,O,4),G=this.getCardinalDirection(B,O,2)):(F=this.getCardinalDirection(-N,O,3),G=this.getCardinalDirection(-B,O,1)):v>h?(F=this.getCardinalDirection(-N,O,1),G=this.getCardinalDirection(-B,O,3)):(F=this.getCardinalDirection(N,O,2),G=this.getCardinalDirection(B,O,4)),!M)switch(F){case 1:z=p,k=f+-C/O,l[0]=k,l[1]=z;break;case 2:k=b,z=v+E*O,l[0]=k,l[1]=z;break;case 3:z=m,k=f+C/O,l[0]=k,l[1]=z;break;case 4:k=y,z=v+-E*O,l[0]=k,l[1]=z;break}if(!I)switch(G){case 1:H=w,U=c+-L/O,l[2]=U,l[3]=H;break;case 2:U=S,H=h+R*O,l[2]=U,l[3]=H;break;case 3:H=D,U=c+L/O,l[2]=U,l[3]=H;break;case 4:U=T,H=h+-R*O,l[2]=U,l[3]=H;break}}return!1},o.getCardinalDirection=function(s,u,l){return s>u?l:1+l%4},o.getIntersection=function(s,u,l,f){if(f==null)return this.getIntersection2(s,u,l);var v=s.x,c=s.y,h=u.x,d=u.y,p=l.x,g=l.y,y=f.x,m=f.y,b=void 0,E=void 0,C=void 0,A=void 0,w=void 0,x=void 0,T=void 0,D=void 0,S=void 0;return C=d-c,w=v-h,T=h*c-v*d,A=m-g,x=p-y,D=y*g-p*m,S=C*x-A*w,S===0?null:(b=(w*D-x*T)/S,E=(A*T-C*D)/S,new i(b,E))},o.angleOfVector=function(s,u,l,f){var v=void 0;return s!==l?(v=Math.atan((f-u)/(l-s)),l<s?v+=Math.PI:f<u&&(v+=this.TWO_PI)):f<u?v=this.ONE_AND_HALF_PI:v=this.HALF_PI,v},o.doIntersect=function(s,u,l,f){var v=s.x,c=s.y,h=u.x,d=u.y,p=l.x,g=l.y,y=f.x,m=f.y,b=(h-v)*(m-g)-(y-p)*(d-c);if(b===0)return!1;var E=((m-g)*(y-v)+(p-y)*(m-c))/b,C=((c-d)*(y-v)+(h-v)*(m-c))/b;return 0<E&&E<1&&0<C&&C<1},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,r.exports=o},function(r,a,n){function i(){}i.sign=function(o){return o>0?1:o<0?-1:0},i.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},i.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},r.exports=i},function(r,a,n){function i(){}i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,r.exports=i},function(r,a,n){var i=function(){function v(c,h){for(var d=0;d<h.length;d++){var p=h[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(c,p.key,p)}}return function(c,h,d){return h&&v(c.prototype,h),d&&v(c,d),c}}();function o(v,c){if(!(v instanceof c))throw new TypeError("Cannot call a class as a function")}var s=function(c){return{value:c,next:null,prev:null}},u=function(c,h,d,p){return c!==null?c.next=h:p.head=h,d!==null?d.prev=h:p.tail=h,h.prev=c,h.next=d,p.length++,h},l=function(c,h){var d=c.prev,p=c.next;return d!==null?d.next=p:h.head=p,p!==null?p.prev=d:h.tail=d,c.prev=c.next=null,h.length--,c},f=function(){function v(c){var h=this;o(this,v),this.length=0,this.head=null,this.tail=null,c!=null&&c.forEach(function(d){return h.push(d)})}return i(v,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(h,d){return u(d.prev,s(h),d,this)}},{key:"insertAfter",value:function(h,d){return u(d,s(h),d.next,this)}},{key:"insertNodeBefore",value:function(h,d){return u(d.prev,h,d,this)}},{key:"insertNodeAfter",value:function(h,d){return u(d,h,d.next,this)}},{key:"push",value:function(h){return u(this.tail,s(h),null,this)}},{key:"unshift",value:function(h){return u(null,s(h),this.head,this)}},{key:"remove",value:function(h){return l(h,this)}},{key:"pop",value:function(){return l(this.tail,this).value}},{key:"popNode",value:function(){return l(this.tail,this)}},{key:"shift",value:function(){return l(this.head,this).value}},{key:"shiftNode",value:function(){return l(this.head,this)}},{key:"get_object_at",value:function(h){if(h<=this.length()){for(var d=1,p=this.head;d<h;)p=p.next,d++;return p.value}}},{key:"set_object_at",value:function(h,d){if(h<=this.length()){for(var p=1,g=this.head;p<h;)g=g.next,p++;g.value=d}}}]),v}();r.exports=f},function(r,a,n){function i(o,s,u){this.x=null,this.y=null,o==null&&s==null&&u==null?(this.x=0,this.y=0):typeof o=="number"&&typeof s=="number"&&u==null?(this.x=o,this.y=s):o.constructor.name=="Point"&&s==null&&u==null&&(u=o,this.x=u.x,this.y=u.y)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.getLocation=function(){return new i(this.x,this.y)},i.prototype.setLocation=function(o,s,u){o.constructor.name=="Point"&&s==null&&u==null?(u=o,this.setLocation(u.x,u.y)):typeof o=="number"&&typeof s=="number"&&u==null&&(parseInt(o)==o&&parseInt(s)==s?this.move(o,s):(this.x=Math.floor(o+.5),this.y=Math.floor(s+.5)))},i.prototype.move=function(o,s){this.x=o,this.y=s},i.prototype.translate=function(o,s){this.x+=o,this.y+=s},i.prototype.equals=function(o){if(o.constructor.name=="Point"){var s=o;return this.x==s.x&&this.y==s.y}return this==o},i.prototype.toString=function(){return new i().constructor.name+"[x="+this.x+",y="+this.y+"]"},r.exports=i},function(r,a,n){function i(o,s,u,l){this.x=0,this.y=0,this.width=0,this.height=0,o!=null&&s!=null&&u!=null&&l!=null&&(this.x=o,this.y=s,this.width=u,this.height=l)}i.prototype.getX=function(){return this.x},i.prototype.setX=function(o){this.x=o},i.prototype.getY=function(){return this.y},i.prototype.setY=function(o){this.y=o},i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(o){this.width=o},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(o){this.height=o},i.prototype.getRight=function(){return this.x+this.width},i.prototype.getBottom=function(){return this.y+this.height},i.prototype.intersects=function(o){return!(this.getRight()<o.x||this.getBottom()<o.y||o.getRight()<this.x||o.getBottom()<this.y)},i.prototype.getCenterX=function(){return this.x+this.width/2},i.prototype.getMinX=function(){return this.getX()},i.prototype.getMaxX=function(){return this.getX()+this.width},i.prototype.getCenterY=function(){return this.y+this.height/2},i.prototype.getMinY=function(){return this.getY()},i.prototype.getMaxY=function(){return this.getY()+this.height},i.prototype.getWidthHalf=function(){return this.width/2},i.prototype.getHeightHalf=function(){return this.height/2},r.exports=i},function(r,a,n){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};function o(){}o.lastID=0,o.createID=function(s){return o.isPrimitive(s)?s:(s.uniqueID!=null||(s.uniqueID=o.getString(),o.lastID++),s.uniqueID)},o.getString=function(s){return s==null&&(s=o.lastID),"Object#"+s},o.isPrimitive=function(s){var u=typeof s>"u"?"undefined":i(s);return s==null||u!="object"&&u!="function"},r.exports=o},function(r,a,n){function i(p){if(Array.isArray(p)){for(var g=0,y=Array(p.length);g<p.length;g++)y[g]=p[g];return y}else return Array.from(p)}var o=n(0),s=n(6),u=n(3),l=n(1),f=n(5),v=n(4),c=n(17),h=n(27);function d(p){h.call(this),this.layoutQuality=o.QUALITY,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=o.DEFAULT_INCREMENTAL,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new s(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,p!=null&&(this.isRemoteUse=p)}d.RANDOM_SEED=1,d.prototype=Object.create(h.prototype),d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},d.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},d.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},d.prototype.newGraphManager=function(){var p=new s(this);return this.graphManager=p,p},d.prototype.newGraph=function(p){return new f(null,this.graphManager,p)},d.prototype.newNode=function(p){return new u(this.graphManager,p)},d.prototype.newEdge=function(p){return new l(null,null,p)},d.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},d.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var p;return this.checkLayoutSuccess()?p=!1:p=this.layout(),o.ANIMATE==="during"?!1:(p&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,p)},d.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},d.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var p=this.graphManager.getAllEdges(),g=0;g<p.length;g++)p[g];for(var y=this.graphManager.getRoot().getNodes(),g=0;g<y.length;g++)y[g];this.update(this.graphManager.getRoot())}},d.prototype.update=function(p){if(p==null)this.update2();else if(p instanceof u){var g=p;if(g.getChild()!=null)for(var y=g.getChild().getNodes(),m=0;m<y.length;m++)update(y[m]);if(g.vGraphObject!=null){var b=g.vGraphObject;b.update(g)}}else if(p instanceof l){var E=p;if(E.vGraphObject!=null){var C=E.vGraphObject;C.update(E)}}else if(p instanceof f){var A=p;if(A.vGraphObject!=null){var w=A.vGraphObject;w.update(A)}}},d.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=o.QUALITY,this.animationDuringLayout=o.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=o.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=o.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=o.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=o.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=o.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},d.prototype.transform=function(p){if(p==null)this.transform(new v(0,0));else{var g=new c,y=this.graphManager.getRoot().updateLeftTop();if(y!=null){g.setWorldOrgX(p.x),g.setWorldOrgY(p.y),g.setDeviceOrgX(y.x),g.setDeviceOrgY(y.y);for(var m=this.getAllNodes(),b,E=0;E<m.length;E++)b=m[E],b.transform(g)}}},d.prototype.positionNodesRandomly=function(p){if(p==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var g,y,m=p.getNodes(),b=0;b<m.length;b++)g=m[b],y=g.getChild(),y==null||y.getNodes().length==0?g.scatter():(this.positionNodesRandomly(y),g.updateBounds())},d.prototype.getFlatForest=function(){for(var p=[],g=!0,y=this.graphManager.getRoot().getNodes(),m=!0,b=0;b<y.length;b++)y[b].getChild()!=null&&(m=!1);if(!m)return p;var E=new Set,C=[],A=new Map,w=[];for(w=w.concat(y);w.length>0&&g;){for(C.push(w[0]);C.length>0&&g;){var x=C[0];C.splice(0,1),E.add(x);for(var T=x.getEdges(),b=0;b<T.length;b++){var D=T[b].getOtherEnd(x);if(A.get(x)!=D)if(!E.has(D))C.push(D),A.set(D,x);else{g=!1;break}}}if(!g)p=[];else{var S=[].concat(i(E));p.push(S);for(var b=0;b<S.length;b++){var R=S[b],L=w.indexOf(R);L>-1&&w.splice(L,1)}E=new Set,A=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var g=[],y=p.source,m=this.graphManager.calcLowestCommonAncestor(p.source,p.target),b=0;b<p.bendpoints.length;b++){var E=this.newNode(null);E.setRect(new Point(0,0),new Dimension(1,1)),m.add(E);var C=this.newEdge(null);this.graphManager.add(C,y,E),g.add(E),y=E}var C=this.newEdge(null);return this.graphManager.add(C,y,p.target),this.edgeToDummyNodes.set(p,g),p.isInterGraph()?this.graphManager.remove(p):m.remove(p),g},d.prototype.createBendpointsFromDummyNodes=function(){var p=[];p=p.concat(this.graphManager.getAllEdges()),p=[].concat(i(this.edgeToDummyNodes.keys())).concat(p);for(var g=0;g<p.length;g++){var y=p[g];if(y.bendpoints.length>0){for(var m=this.edgeToDummyNodes.get(y),b=0;b<m.length;b++){var E=m[b],C=new v(E.getCenterX(),E.getCenterY()),A=y.bendpoints.get(b);A.x=C.x,A.y=C.y,E.getOwner().remove(E)}this.graphManager.add(y,y.source,y.target)}}},d.transform=function(p,g,y,m){if(y!=null&&m!=null){var b=g;if(p<=50){var E=g/y;b-=(g-E)/50*(50-p)}else{var C=g*m;b+=(C-g)/50*(p-50)}return b}else{var A,w;return p<=50?(A=9*g/500,w=g/10):(A=9*g/50,w=-8*g),A*p+w}},d.findCenterOfTree=function(p){var g=[];g=g.concat(p);var y=[],m=new Map,b=!1,E=null;(g.length==1||g.length==2)&&(b=!0,E=g[0]);for(var C=0;C<g.length;C++){var A=g[C],w=A.getNeighborsList().size;m.set(A,A.getNeighborsList().size),w==1&&y.push(A)}var x=[];for(x=x.concat(y);!b;){var T=[];T=T.concat(x),x=[];for(var C=0;C<g.length;C++){var A=g[C],D=g.indexOf(A);D>=0&&g.splice(D,1);var S=A.getNeighborsList();S.forEach(function(M){if(y.indexOf(M)<0){var I=m.get(M),N=I-1;N==1&&x.push(M),m.set(M,N)}})}y=y.concat(x),(g.length==1||g.length==2)&&(b=!0,E=g[0])}return E},d.prototype.setGraphManager=function(p){this.graphManager=p},r.exports=d},function(r,a,n){function i(){}i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},r.exports=i},function(r,a,n){var i=n(4);function o(s,u){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(s){this.lworldExtX=s},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(s){this.lworldExtY=s},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},o.prototype.transformX=function(s){var u=0,l=this.lworldExtX;return l!=0&&(u=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/l),u},o.prototype.transformY=function(s){var u=0,l=this.lworldExtY;return l!=0&&(u=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/l),u},o.prototype.inverseTransformX=function(s){var u=0,l=this.ldeviceExtX;return l!=0&&(u=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/l),u},o.prototype.inverseTransformY=function(s){var u=0,l=this.ldeviceExtY;return l!=0&&(u=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/l),u},o.prototype.inverseTransformPoint=function(s){var u=new i(this.inverseTransformX(s.x),this.inverseTransformY(s.y));return u},r.exports=o},function(r,a,n){function i(h){if(Array.isArray(h)){for(var d=0,p=Array(h.length);d<h.length;d++)p[d]=h[d];return p}else return Array.from(h)}var o=n(15),s=n(7),u=n(0),l=n(8),f=n(9);function v(){o.call(this),this.useSmartIdealEdgeLengthCalculation=s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=s.DEFAULT_EDGE_LENGTH,this.springConstant=s.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=s.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=s.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=s.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=s.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*s.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=s.MAX_ITERATIONS}v.prototype=Object.create(o.prototype);for(var c in o)v[c]=o[c];v.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},v.prototype.calcIdealEdgeLengths=function(){for(var h,d,p,g,y,m,b=this.getGraphManager().getAllEdges(),E=0;E<b.length;E++)h=b[E],h.idealLength=this.idealEdgeLength,h.isInterGraph&&(p=h.getSource(),g=h.getTarget(),y=h.getSourceInLca().getEstimatedSize(),m=h.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(h.idealLength+=y+m-2*u.SIMPLE_NODE_SIZE),d=h.getLca().getInclusionTreeDepth(),h.idealLength+=s.DEFAULT_EDGE_LENGTH*s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(p.getInclusionTreeDepth()+g.getInclusionTreeDepth()-2*d))},v.prototype.initSpringEmbedder=function(){var h=this.getAllNodes().length;this.incremental?(h>s.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*s.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-s.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT_INCREMENTAL):(h>s.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(s.COOLING_ADAPTATION_FACTOR,1-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*(1-s.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},v.prototype.calcSpringForces=function(){for(var h=this.getAllEdges(),d,p=0;p<h.length;p++)d=h[p],this.calcSpringForce(d,d.idealLength)},v.prototype.calcRepulsionForces=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,g,y,m,b=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&h&&this.updateGrid(),E=new Set,p=0;p<b.length;p++)y=b[p],this.calculateRepulsionForceOfANode(y,E,h,d),E.add(y);else for(p=0;p<b.length;p++)for(y=b[p],g=p+1;g<b.length;g++)m=b[g],y.getOwner()==m.getOwner()&&this.calcRepulsionForce(y,m)},v.prototype.calcGravitationalForces=function(){for(var h,d=this.getAllNodesToApplyGravitation(),p=0;p<d.length;p++)h=d[p],this.calcGravitationalForce(h)},v.prototype.moveNodes=function(){for(var h=this.getAllNodes(),d,p=0;p<h.length;p++)d=h[p],d.move()},v.prototype.calcSpringForce=function(h,d){var p=h.getSource(),g=h.getTarget(),y,m,b,E;if(this.uniformLeafNodeSizes&&p.getChild()==null&&g.getChild()==null)h.updateLengthSimple();else if(h.updateLength(),h.isOverlapingSourceAndTarget)return;y=h.getLength(),y!=0&&(m=this.springConstant*(y-d),b=m*(h.lengthX/y),E=m*(h.lengthY/y),p.springForceX+=b,p.springForceY+=E,g.springForceX-=b,g.springForceY-=E)},v.prototype.calcRepulsionForce=function(h,d){var p=h.getRect(),g=d.getRect(),y=new Array(2),m=new Array(4),b,E,C,A,w,x,T;if(p.intersects(g)){l.calcSeparationAmount(p,g,y,s.DEFAULT_EDGE_LENGTH/2),x=2*y[0],T=2*y[1];var D=h.noOfChildren*d.noOfChildren/(h.noOfChildren+d.noOfChildren);h.repulsionForceX-=D*x,h.repulsionForceY-=D*T,d.repulsionForceX+=D*x,d.repulsionForceY+=D*T}else this.uniformLeafNodeSizes&&h.getChild()==null&&d.getChild()==null?(b=g.getCenterX()-p.getCenterX(),E=g.getCenterY()-p.getCenterY()):(l.getIntersection(p,g,m),b=m[2]-m[0],E=m[3]-m[1]),Math.abs(b)<s.MIN_REPULSION_DIST&&(b=f.sign(b)*s.MIN_REPULSION_DIST),Math.abs(E)<s.MIN_REPULSION_DIST&&(E=f.sign(E)*s.MIN_REPULSION_DIST),C=b*b+E*E,A=Math.sqrt(C),w=this.repulsionConstant*h.noOfChildren*d.noOfChildren/C,x=w*b/A,T=w*E/A,h.repulsionForceX-=x,h.repulsionForceY-=T,d.repulsionForceX+=x,d.repulsionForceY+=T},v.prototype.calcGravitationalForce=function(h){var d,p,g,y,m,b,E,C;d=h.getOwner(),p=(d.getRight()+d.getLeft())/2,g=(d.getTop()+d.getBottom())/2,y=h.getCenterX()-p,m=h.getCenterY()-g,b=Math.abs(y)+h.getWidth()/2,E=Math.abs(m)+h.getHeight()/2,h.getOwner()==this.graphManager.getRoot()?(C=d.getEstimatedSize()*this.gravityRangeFactor,(b>C||E>C)&&(h.gravitationForceX=-this.gravityConstant*y,h.gravitationForceY=-this.gravityConstant*m)):(C=d.getEstimatedSize()*this.compoundGravityRangeFactor,(b>C||E>C)&&(h.gravitationForceX=-this.gravityConstant*y*this.compoundGravityConstant,h.gravitationForceY=-this.gravityConstant*m*this.compoundGravityConstant))},v.prototype.isConverged=function(){var h,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),h=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,h||d},v.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},v.prototype.calcNoOfChildrenForAllNodes=function(){for(var h,d=this.graphManager.getAllNodes(),p=0;p<d.length;p++)h=d[p],h.noOfChildren=h.getNoOfChildren()},v.prototype.calcGrid=function(h){var d=0,p=0;d=parseInt(Math.ceil((h.getRight()-h.getLeft())/this.repulsionRange)),p=parseInt(Math.ceil((h.getBottom()-h.getTop())/this.repulsionRange));for(var g=new Array(d),y=0;y<d;y++)g[y]=new Array(p);for(var y=0;y<d;y++)for(var m=0;m<p;m++)g[y][m]=new Array;return g},v.prototype.addNodeToGrid=function(h,d,p){var g=0,y=0,m=0,b=0;g=parseInt(Math.floor((h.getRect().x-d)/this.repulsionRange)),y=parseInt(Math.floor((h.getRect().width+h.getRect().x-d)/this.repulsionRange)),m=parseInt(Math.floor((h.getRect().y-p)/this.repulsionRange)),b=parseInt(Math.floor((h.getRect().height+h.getRect().y-p)/this.repulsionRange));for(var E=g;E<=y;E++)for(var C=m;C<=b;C++)this.grid[E][C].push(h),h.setGridCoordinates(g,y,m,b)},v.prototype.updateGrid=function(){var h,d,p=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),h=0;h<p.length;h++)d=p[h],this.addNodeToGrid(d,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},v.prototype.calculateRepulsionForceOfANode=function(h,d,p,g){if(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&p||g){var y=new Set;h.surrounding=new Array;for(var m,b=this.grid,E=h.startX-1;E<h.finishX+2;E++)for(var C=h.startY-1;C<h.finishY+2;C++)if(!(E<0||C<0||E>=b.length||C>=b[0].length)){for(var A=0;A<b[E][C].length;A++)if(m=b[E][C][A],!(h.getOwner()!=m.getOwner()||h==m)&&!d.has(m)&&!y.has(m)){var w=Math.abs(h.getCenterX()-m.getCenterX())-(h.getWidth()/2+m.getWidth()/2),x=Math.abs(h.getCenterY()-m.getCenterY())-(h.getHeight()/2+m.getHeight()/2);w<=this.repulsionRange&&x<=this.repulsionRange&&y.add(m)}}h.surrounding=[].concat(i(y))}for(E=0;E<h.surrounding.length;E++)this.calcRepulsionForce(h,h.surrounding[E])},v.prototype.calcRepulsionRange=function(){return 0},r.exports=v},function(r,a,n){var i=n(1),o=n(7);function s(l,f,v){i.call(this,l,f,v),this.idealLength=o.DEFAULT_EDGE_LENGTH}s.prototype=Object.create(i.prototype);for(var u in i)s[u]=i[u];r.exports=s},function(r,a,n){var i=n(3);function o(u,l,f,v){i.call(this,u,l,f,v),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=[]}o.prototype=Object.create(i.prototype);for(var s in i)o[s]=i[s];o.prototype.setGridCoordinates=function(u,l,f,v){this.startX=u,this.finishX=l,this.startY=f,this.finishY=v},r.exports=o},function(r,a,n){function i(o,s){this.width=0,this.height=0,o!==null&&s!==null&&(this.height=s,this.width=o)}i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(o){this.width=o},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(o){this.height=o},r.exports=i},function(r,a,n){var i=n(14);function o(){this.map={},this.keys=[]}o.prototype.put=function(s,u){var l=i.createID(s);this.contains(l)||(this.map[l]=u,this.keys.push(s))},o.prototype.contains=function(s){return i.createID(s),this.map[s]!=null},o.prototype.get=function(s){var u=i.createID(s);return this.map[u]},o.prototype.keySet=function(){return this.keys},r.exports=o},function(r,a,n){var i=n(14);function o(){this.set={}}o.prototype.add=function(s){var u=i.createID(s);this.contains(u)||(this.set[u]=s)},o.prototype.remove=function(s){delete this.set[i.createID(s)]},o.prototype.clear=function(){this.set={}},o.prototype.contains=function(s){return this.set[i.createID(s)]==s},o.prototype.isEmpty=function(){return this.size()===0},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAllTo=function(s){for(var u=Object.keys(this.set),l=u.length,f=0;f<l;f++)s.push(this.set[u[f]])},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAll=function(s){for(var u=s.length,l=0;l<u;l++){var f=s[l];this.add(f)}},r.exports=o},function(r,a,n){var i=function(){function l(f,v){for(var c=0;c<v.length;c++){var h=v[c];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}return function(f,v,c){return v&&l(f.prototype,v),c&&l(f,c),f}}();function o(l,f){if(!(l instanceof f))throw new TypeError("Cannot call a class as a function")}var s=n(11),u=function(){function l(f,v){o(this,l),(v!==null||v!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var c=void 0;f instanceof s?c=f.size():c=f.length,this._quicksort(f,0,c-1)}return i(l,[{key:"_quicksort",value:function(v,c,h){if(c<h){var d=this._partition(v,c,h);this._quicksort(v,c,d),this._quicksort(v,d+1,h)}}},{key:"_partition",value:function(v,c,h){for(var d=this._get(v,c),p=c,g=h;;){for(;this.compareFunction(d,this._get(v,g));)g--;for(;this.compareFunction(this._get(v,p),d);)p++;if(p<g)this._swap(v,p,g),p++,g--;else return g}}},{key:"_get",value:function(v,c){return v instanceof s?v.get_object_at(c):v[c]}},{key:"_set",value:function(v,c,h){v instanceof s?v.set_object_at(c,h):v[c]=h}},{key:"_swap",value:function(v,c,h){var d=this._get(v,c);this._set(v,c,this._get(v,h)),this._set(v,h,d)}},{key:"_defaultCompareFunction",value:function(v,c){return c>v}}]),l}();r.exports=u},function(r,a,n){var i=function(){function u(l,f){for(var v=0;v<f.length;v++){var c=f[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(l,c.key,c)}}return function(l,f,v){return f&&u(l.prototype,f),v&&u(l,v),l}}();function o(u,l){if(!(u instanceof l))throw new TypeError("Cannot call a class as a function")}var s=function(){function u(l,f){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,u),this.sequence1=l,this.sequence2=f,this.match_score=v,this.mismatch_penalty=c,this.gap_penalty=h,this.iMax=l.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var d=0;d<this.iMax;d++){this.grid[d]=new Array(this.jMax);for(var p=0;p<this.jMax;p++)this.grid[d][p]=0}this.tracebackGrid=new Array(this.iMax);for(var g=0;g<this.iMax;g++){this.tracebackGrid[g]=new Array(this.jMax);for(var y=0;y<this.jMax;y++)this.tracebackGrid[g][y]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return i(u,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var f=1;f<this.jMax;f++)this.grid[0][f]=this.grid[0][f-1]+this.gap_penalty,this.tracebackGrid[0][f]=[!1,!1,!0];for(var v=1;v<this.iMax;v++)this.grid[v][0]=this.grid[v-1][0]+this.gap_penalty,this.tracebackGrid[v][0]=[!1,!0,!1];for(var c=1;c<this.iMax;c++)for(var h=1;h<this.jMax;h++){var d=void 0;this.sequence1[c-1]===this.sequence2[h-1]?d=this.grid[c-1][h-1]+this.match_score:d=this.grid[c-1][h-1]+this.mismatch_penalty;var p=this.grid[c-1][h]+this.gap_penalty,g=this.grid[c][h-1]+this.gap_penalty,y=[d,p,g],m=this.arrayAllMaxIndexes(y);this.grid[c][h]=y[m[0]],this.tracebackGrid[c][h]=[m.includes(0),m.includes(1),m.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var f=[];for(f.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});f[0];){var v=f[0],c=this.tracebackGrid[v.pos[0]][v.pos[1]];c[0]&&f.push({pos:[v.pos[0]-1,v.pos[1]-1],seq1:this.sequence1[v.pos[0]-1]+v.seq1,seq2:this.sequence2[v.pos[1]-1]+v.seq2}),c[1]&&f.push({pos:[v.pos[0]-1,v.pos[1]],seq1:this.sequence1[v.pos[0]-1]+v.seq1,seq2:"-"+v.seq2}),c[2]&&f.push({pos:[v.pos[0],v.pos[1]-1],seq1:"-"+v.seq1,seq2:this.sequence2[v.pos[1]-1]+v.seq2}),v.pos[0]===0&&v.pos[1]===0&&this.alignments.push({sequence1:v.seq1,sequence2:v.seq2}),f.shift()}return this.alignments}},{key:"getAllIndexes",value:function(f,v){for(var c=[],h=-1;(h=f.indexOf(v,h+1))!==-1;)c.push(h);return c}},{key:"arrayAllMaxIndexes",value:function(f){return this.getAllIndexes(f,Math.max.apply(null,f))}}]),u}();r.exports=s},function(r,a,n){var i=function(){};i.FDLayout=n(18),i.FDLayoutConstants=n(7),i.FDLayoutEdge=n(19),i.FDLayoutNode=n(20),i.DimensionD=n(21),i.HashMap=n(22),i.HashSet=n(23),i.IGeometry=n(8),i.IMath=n(9),i.Integer=n(10),i.Point=n(12),i.PointD=n(4),i.RandomSeed=n(16),i.RectangleD=n(13),i.Transform=n(17),i.UniqueIDGeneretor=n(14),i.Quicksort=n(24),i.LinkedList=n(11),i.LGraphObject=n(2),i.LGraph=n(5),i.LEdge=n(1),i.LGraphManager=n(6),i.LNode=n(3),i.Layout=n(15),i.LayoutConstants=n(0),i.NeedlemanWunsch=n(25),r.exports=i},function(r,a,n){function i(){this.listeners=[]}var o=i.prototype;o.addListener=function(s,u){this.listeners.push({event:s,callback:u})},o.removeListener=function(s,u){for(var l=this.listeners.length;l>=0;l--){var f=this.listeners[l];f.event===s&&f.callback===u&&this.listeners.splice(l,1)}},o.emit=function(s,u){for(var l=0;l<this.listeners.length;l++){var f=this.listeners[l];s===f.event&&f.callback(u)}},r.exports=i}])})}(wn)),wn.exports}var Bm=bn.exports,ef;function km(){return ef||(ef=1,function(t,e){(function(a,n){t.exports=n(Nm())})(Bm,function(r){return function(a){var n={};function i(o){if(n[o])return n[o].exports;var s=n[o]={i:o,l:!1,exports:{}};return a[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=a,i.c=n,i.i=function(o){return o},i.d=function(o,s,u){i.o(o,s)||Object.defineProperty(o,s,{configurable:!1,enumerable:!0,get:u})},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=7)}([function(a,n){a.exports=r},function(a,n,i){var o=i(0).FDLayoutConstants;function s(){}for(var u in o)s[u]=o[u];s.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,s.DEFAULT_RADIAL_SEPARATION=o.DEFAULT_EDGE_LENGTH,s.DEFAULT_COMPONENT_SEPERATION=60,s.TILE=!0,s.TILING_PADDING_VERTICAL=10,s.TILING_PADDING_HORIZONTAL=10,s.TREE_REDUCTION_ON_INCREMENTAL=!1,a.exports=s},function(a,n,i){var o=i(0).FDLayoutEdge;function s(l,f,v){o.call(this,l,f,v)}s.prototype=Object.create(o.prototype);for(var u in o)s[u]=o[u];a.exports=s},function(a,n,i){var o=i(0).LGraph;function s(l,f,v){o.call(this,l,f,v)}s.prototype=Object.create(o.prototype);for(var u in o)s[u]=o[u];a.exports=s},function(a,n,i){var o=i(0).LGraphManager;function s(l){o.call(this,l)}s.prototype=Object.create(o.prototype);for(var u in o)s[u]=o[u];a.exports=s},function(a,n,i){var o=i(0).FDLayoutNode,s=i(0).IMath;function u(f,v,c,h){o.call(this,f,v,c,h)}u.prototype=Object.create(o.prototype);for(var l in o)u[l]=o[l];u.prototype.move=function(){var f=this.graphManager.getLayout();this.displacementX=f.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=f.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>f.coolingFactor*f.maxNodeDisplacement&&(this.displacementX=f.coolingFactor*f.maxNodeDisplacement*s.sign(this.displacementX)),Math.abs(this.displacementY)>f.coolingFactor*f.maxNodeDisplacement&&(this.displacementY=f.coolingFactor*f.maxNodeDisplacement*s.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),f.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},u.prototype.propogateDisplacementToChildren=function(f,v){for(var c=this.getChild().getNodes(),h,d=0;d<c.length;d++)h=c[d],h.getChild()==null?(h.moveBy(f,v),h.displacementX+=f,h.displacementY+=v):h.propogateDisplacementToChildren(f,v)},u.prototype.setPred1=function(f){this.pred1=f},u.prototype.getPred1=function(){return pred1},u.prototype.getPred2=function(){return pred2},u.prototype.setNext=function(f){this.next=f},u.prototype.getNext=function(){return next},u.prototype.setProcessed=function(f){this.processed=f},u.prototype.isProcessed=function(){return processed},a.exports=u},function(a,n,i){var o=i(0).FDLayout,s=i(4),u=i(3),l=i(5),f=i(2),v=i(1),c=i(0).FDLayoutConstants,h=i(0).LayoutConstants,d=i(0).Point,p=i(0).PointD,g=i(0).Layout,y=i(0).Integer,m=i(0).IGeometry,b=i(0).LGraph,E=i(0).Transform;function C(){o.call(this),this.toBeTiled={}}C.prototype=Object.create(o.prototype);for(var A in o)C[A]=o[A];C.prototype.newGraphManager=function(){var w=new s(this);return this.graphManager=w,w},C.prototype.newGraph=function(w){return new u(null,this.graphManager,w)},C.prototype.newNode=function(w){return new l(this.graphManager,w)},C.prototype.newEdge=function(w){return new f(null,null,w)},C.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.isSubLayout||(v.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=v.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=v.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=c.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=c.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=c.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=c.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/c.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=c.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},C.prototype.layout=function(){var w=h.DEFAULT_CREATE_BENDS_AS_NEEDED;return w&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},C.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(v.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),T=this.nodesWithGravity.filter(function(R){return x.has(R)});this.graphManager.setAllNodesToApplyGravitation(T)}}else{var w=this.getFlatForest();if(w.length>0)this.positionNodesRadially(w);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),T=this.nodesWithGravity.filter(function(D){return x.has(D)});this.graphManager.setAllNodesToApplyGravitation(T),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},C.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%c.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var w=new Set(this.getAllNodes()),x=this.nodesWithGravity.filter(function(S){return w.has(S)});this.graphManager.setAllNodesToApplyGravitation(x),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var T=!this.isTreeGrowing&&!this.isGrowthFinished,D=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(T,D),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},C.prototype.getPositionsData=function(){for(var w=this.graphManager.getAllNodes(),x={},T=0;T<w.length;T++){var D=w[T].rect,S=w[T].id;x[S]={id:S,x:D.getCenterX(),y:D.getCenterY(),w:D.width,h:D.height}}return x},C.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var w=!1;if(c.ANIMATE==="during")this.emit("layoutstarted");else{for(;!w;)w=this.tick();this.graphManager.updateBounds()}},C.prototype.calculateNodesToApplyGravitationTo=function(){var w=[],x,T=this.graphManager.getGraphs(),D=T.length,S;for(S=0;S<D;S++)x=T[S],x.updateConnected(),x.isConnected||(w=w.concat(x.getNodes()));return w},C.prototype.createBendpoints=function(){var w=[];w=w.concat(this.graphManager.getAllEdges());var x=new Set,T;for(T=0;T<w.length;T++){var D=w[T];if(!x.has(D)){var S=D.getSource(),R=D.getTarget();if(S==R)D.getBendpoints().push(new p),D.getBendpoints().push(new p),this.createDummyNodesForBendpoints(D),x.add(D);else{var L=[];if(L=L.concat(S.getEdgeListToNode(R)),L=L.concat(R.getEdgeListToNode(S)),!x.has(L[0])){if(L.length>1){var M;for(M=0;M<L.length;M++){var I=L[M];I.getBendpoints().push(new p),this.createDummyNodesForBendpoints(I)}}L.forEach(function(N){x.add(N)})}}}if(x.size==w.length)break}},C.prototype.positionNodesRadially=function(w){for(var x=new d(0,0),T=Math.ceil(Math.sqrt(w.length)),D=0,S=0,R=0,L=new p(0,0),M=0;M<w.length;M++){M%T==0&&(R=0,S=D,M!=0&&(S+=v.DEFAULT_COMPONENT_SEPERATION),D=0);var I=w[M],N=g.findCenterOfTree(I);x.x=R,x.y=S,L=C.radialLayout(I,N,x),L.y>D&&(D=Math.floor(L.y)),R=Math.floor(L.x+v.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(h.WORLD_CENTER_X-L.x/2,h.WORLD_CENTER_Y-L.y/2))},C.radialLayout=function(w,x,T){var D=Math.max(this.maxDiagonalInTree(w),v.DEFAULT_RADIAL_SEPARATION);C.branchRadialLayout(x,null,0,359,0,D);var S=b.calculateBounds(w),R=new E;R.setDeviceOrgX(S.getMinX()),R.setDeviceOrgY(S.getMinY()),R.setWorldOrgX(T.x),R.setWorldOrgY(T.y);for(var L=0;L<w.length;L++){var M=w[L];M.transform(R)}var I=new p(S.getMaxX(),S.getMaxY());return R.inverseTransformPoint(I)},C.branchRadialLayout=function(w,x,T,D,S,R){var L=(D-T+1)/2;L<0&&(L+=180);var M=(L+T)%360,I=M*m.TWO_PI/360,N=S*Math.cos(I),B=S*Math.sin(I);w.setCenter(N,B);var O=[];O=O.concat(w.getEdges());var F=O.length;x!=null&&F--;for(var G=0,k=O.length,z,U=w.getEdgesBetween(x);U.length>1;){var H=U[0];U.splice(0,1);var $=O.indexOf(H);$>=0&&O.splice($,1),k--,F--}x!=null?z=(O.indexOf(U[0])+1)%k:z=0;for(var K=Math.abs(D-T)/F,j=z;G!=F;j=++j%k){var re=O[j].getOtherEnd(w);if(re!=x){var Q=(T+G*K)%360,_=(Q+K)%360;C.branchRadialLayout(re,w,Q,_,S+R,R),G++}}},C.maxDiagonalInTree=function(w){for(var x=y.MIN_VALUE,T=0;T<w.length;T++){var D=w[T],S=D.getDiagonal();S>x&&(x=S)}return x},C.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},C.prototype.groupZeroDegreeMembers=function(){var w=this,x={};this.memberGroups={},this.idToDummyNode={};for(var T=[],D=this.graphManager.getAllNodes(),S=0;S<D.length;S++){var R=D[S],L=R.getParent();this.getNodeDegreeWithChildren(R)===0&&(L.id==null||!this.getToBeTiled(L))&&T.push(R)}for(var S=0;S<T.length;S++){var R=T[S],M=R.getParent().id;typeof x[M]>"u"&&(x[M]=[]),x[M]=x[M].concat(R)}Object.keys(x).forEach(function(I){if(x[I].length>1){var N="DummyCompound_"+I;w.memberGroups[N]=x[I];var B=x[I][0].getParent(),O=new l(w.graphManager);O.id=N,O.paddingLeft=B.paddingLeft||0,O.paddingRight=B.paddingRight||0,O.paddingBottom=B.paddingBottom||0,O.paddingTop=B.paddingTop||0,w.idToDummyNode[N]=O;var F=w.getGraphManager().add(w.newGraph(),O),G=B.getChild();G.add(O);for(var k=0;k<x[I].length;k++){var z=x[I][k];G.remove(z),F.add(z)}}})},C.prototype.clearCompounds=function(){var w={},x={};this.performDFSOnCompounds();for(var T=0;T<this.compoundOrder.length;T++)x[this.compoundOrder[T].id]=this.compoundOrder[T],w[this.compoundOrder[T].id]=[].concat(this.compoundOrder[T].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[T].getChild()),this.compoundOrder[T].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(w,x)},C.prototype.clearZeroDegreeMembers=function(){var w=this,x=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(T){var D=w.idToDummyNode[T];x[T]=w.tileNodes(w.memberGroups[T],D.paddingLeft+D.paddingRight),D.rect.width=x[T].width,D.rect.height=x[T].height})},C.prototype.repopulateCompounds=function(){for(var w=this.compoundOrder.length-1;w>=0;w--){var x=this.compoundOrder[w],T=x.id,D=x.paddingLeft,S=x.paddingTop;this.adjustLocations(this.tiledMemberPack[T],x.rect.x,x.rect.y,D,S)}},C.prototype.repopulateZeroDegreeMembers=function(){var w=this,x=this.tiledZeroDegreePack;Object.keys(x).forEach(function(T){var D=w.idToDummyNode[T],S=D.paddingLeft,R=D.paddingTop;w.adjustLocations(x[T],D.rect.x,D.rect.y,S,R)})},C.prototype.getToBeTiled=function(w){var x=w.id;if(this.toBeTiled[x]!=null)return this.toBeTiled[x];var T=w.getChild();if(T==null)return this.toBeTiled[x]=!1,!1;for(var D=T.getNodes(),S=0;S<D.length;S++){var R=D[S];if(this.getNodeDegree(R)>0)return this.toBeTiled[x]=!1,!1;if(R.getChild()==null){this.toBeTiled[R.id]=!1;continue}if(!this.getToBeTiled(R))return this.toBeTiled[x]=!1,!1}return this.toBeTiled[x]=!0,!0},C.prototype.getNodeDegree=function(w){w.id;for(var x=w.getEdges(),T=0,D=0;D<x.length;D++){var S=x[D];S.getSource().id!==S.getTarget().id&&(T=T+1)}return T},C.prototype.getNodeDegreeWithChildren=function(w){var x=this.getNodeDegree(w);if(w.getChild()==null)return x;for(var T=w.getChild().getNodes(),D=0;D<T.length;D++){var S=T[D];x+=this.getNodeDegreeWithChildren(S)}return x},C.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},C.prototype.fillCompexOrderByDFS=function(w){for(var x=0;x<w.length;x++){var T=w[x];T.getChild()!=null&&this.fillCompexOrderByDFS(T.getChild().getNodes()),this.getToBeTiled(T)&&this.compoundOrder.push(T)}},C.prototype.adjustLocations=function(w,x,T,D,S){x+=D,T+=S;for(var R=x,L=0;L<w.rows.length;L++){var M=w.rows[L];x=R;for(var I=0,N=0;N<M.length;N++){var B=M[N];B.rect.x=x,B.rect.y=T,x+=B.rect.width+w.horizontalPadding,B.rect.height>I&&(I=B.rect.height)}T+=I+w.verticalPadding}},C.prototype.tileCompoundMembers=function(w,x){var T=this;this.tiledMemberPack=[],Object.keys(w).forEach(function(D){var S=x[D];T.tiledMemberPack[D]=T.tileNodes(w[D],S.paddingLeft+S.paddingRight),S.rect.width=T.tiledMemberPack[D].width,S.rect.height=T.tiledMemberPack[D].height})},C.prototype.tileNodes=function(w,x){var T=v.TILING_PADDING_VERTICAL,D=v.TILING_PADDING_HORIZONTAL,S={rows:[],rowWidth:[],rowHeight:[],width:0,height:x,verticalPadding:T,horizontalPadding:D};w.sort(function(M,I){return M.rect.width*M.rect.height>I.rect.width*I.rect.height?-1:M.rect.width*M.rect.height<I.rect.width*I.rect.height?1:0});for(var R=0;R<w.length;R++){var L=w[R];S.rows.length==0?this.insertNodeToRow(S,L,0,x):this.canAddHorizontal(S,L.rect.width,L.rect.height)?this.insertNodeToRow(S,L,this.getShortestRowIndex(S),x):this.insertNodeToRow(S,L,S.rows.length,x),this.shiftToLastRow(S)}return S},C.prototype.insertNodeToRow=function(w,x,T,D){var S=D;if(T==w.rows.length){var R=[];w.rows.push(R),w.rowWidth.push(S),w.rowHeight.push(0)}var L=w.rowWidth[T]+x.rect.width;w.rows[T].length>0&&(L+=w.horizontalPadding),w.rowWidth[T]=L,w.width<L&&(w.width=L);var M=x.rect.height;T>0&&(M+=w.verticalPadding);var I=0;M>w.rowHeight[T]&&(I=w.rowHeight[T],w.rowHeight[T]=M,I=w.rowHeight[T]-I),w.height+=I,w.rows[T].push(x)},C.prototype.getShortestRowIndex=function(w){for(var x=-1,T=Number.MAX_VALUE,D=0;D<w.rows.length;D++)w.rowWidth[D]<T&&(x=D,T=w.rowWidth[D]);return x},C.prototype.getLongestRowIndex=function(w){for(var x=-1,T=Number.MIN_VALUE,D=0;D<w.rows.length;D++)w.rowWidth[D]>T&&(x=D,T=w.rowWidth[D]);return x},C.prototype.canAddHorizontal=function(w,x,T){var D=this.getShortestRowIndex(w);if(D<0)return!0;var S=w.rowWidth[D];if(S+w.horizontalPadding+x<=w.width)return!0;var R=0;w.rowHeight[D]<T&&D>0&&(R=T+w.verticalPadding-w.rowHeight[D]);var L;w.width-S>=x+w.horizontalPadding?L=(w.height+R)/(S+x+w.horizontalPadding):L=(w.height+R)/w.width,R=T+w.verticalPadding;var M;return w.width<x?M=(w.height+R)/x:M=(w.height+R)/w.width,M<1&&(M=1/M),L<1&&(L=1/L),L<M},C.prototype.shiftToLastRow=function(w){var x=this.getLongestRowIndex(w),T=w.rowWidth.length-1,D=w.rows[x],S=D[D.length-1],R=S.width+w.horizontalPadding;if(w.width-w.rowWidth[T]>R&&x!=T){D.splice(-1,1),w.rows[T].push(S),w.rowWidth[x]=w.rowWidth[x]-R,w.rowWidth[T]=w.rowWidth[T]+R,w.width=w.rowWidth[instance.getLongestRowIndex(w)];for(var L=Number.MIN_VALUE,M=0;M<D.length;M++)D[M].height>L&&(L=D[M].height);x>0&&(L+=w.verticalPadding);var I=w.rowHeight[x]+w.rowHeight[T];w.rowHeight[x]=L,w.rowHeight[T]<S.height+w.verticalPadding&&(w.rowHeight[T]=S.height+w.verticalPadding);var N=w.rowHeight[x]+w.rowHeight[T];w.height+=N-I,this.shiftToLastRow(w)}},C.prototype.tilingPreLayout=function(){v.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},C.prototype.tilingPostLayout=function(){v.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},C.prototype.reduceTrees=function(){for(var w=[],x=!0,T;x;){var D=this.graphManager.getAllNodes(),S=[];x=!1;for(var R=0;R<D.length;R++)T=D[R],T.getEdges().length==1&&!T.getEdges()[0].isInterGraph&&T.getChild()==null&&(S.push([T,T.getEdges()[0],T.getOwner()]),x=!0);if(x==!0){for(var L=[],M=0;M<S.length;M++)S[M][0].getEdges().length==1&&(L.push(S[M]),S[M][0].getOwner().remove(S[M][0]));w.push(L),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=w},C.prototype.growTree=function(w){for(var x=w.length,T=w[x-1],D,S=0;S<T.length;S++)D=T[S],this.findPlaceforPrunedNode(D),D[2].add(D[0]),D[2].add(D[1],D[1].source,D[1].target);w.splice(w.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},C.prototype.findPlaceforPrunedNode=function(w){var x,T,D=w[0];D==w[1].source?T=w[1].target:T=w[1].source;var S=T.startX,R=T.finishX,L=T.startY,M=T.finishY,I=0,N=0,B=0,O=0,F=[I,B,N,O];if(L>0)for(var G=S;G<=R;G++)F[0]+=this.grid[G][L-1].length+this.grid[G][L].length-1;if(R<this.grid.length-1)for(var G=L;G<=M;G++)F[1]+=this.grid[R+1][G].length+this.grid[R][G].length-1;if(M<this.grid[0].length-1)for(var G=S;G<=R;G++)F[2]+=this.grid[G][M+1].length+this.grid[G][M].length-1;if(S>0)for(var G=L;G<=M;G++)F[3]+=this.grid[S-1][G].length+this.grid[S][G].length-1;for(var k=y.MAX_VALUE,z,U,H=0;H<F.length;H++)F[H]<k?(k=F[H],z=1,U=H):F[H]==k&&z++;if(z==3&&k==0)F[0]==0&&F[1]==0&&F[2]==0?x=1:F[0]==0&&F[1]==0&&F[3]==0?x=0:F[0]==0&&F[2]==0&&F[3]==0?x=3:F[1]==0&&F[2]==0&&F[3]==0&&(x=2);else if(z==2&&k==0){var $=Math.floor(Math.random()*2);F[0]==0&&F[1]==0?$==0?x=0:x=1:F[0]==0&&F[2]==0?$==0?x=0:x=2:F[0]==0&&F[3]==0?$==0?x=0:x=3:F[1]==0&&F[2]==0?$==0?x=1:x=2:F[1]==0&&F[3]==0?$==0?x=1:x=3:$==0?x=2:x=3}else if(z==4&&k==0){var $=Math.floor(Math.random()*4);x=$}else x=U;x==0?D.setCenter(T.getCenterX(),T.getCenterY()-T.getHeight()/2-c.DEFAULT_EDGE_LENGTH-D.getHeight()/2):x==1?D.setCenter(T.getCenterX()+T.getWidth()/2+c.DEFAULT_EDGE_LENGTH+D.getWidth()/2,T.getCenterY()):x==2?D.setCenter(T.getCenterX(),T.getCenterY()+T.getHeight()/2+c.DEFAULT_EDGE_LENGTH+D.getHeight()/2):D.setCenter(T.getCenterX()-T.getWidth()/2-c.DEFAULT_EDGE_LENGTH-D.getWidth()/2,T.getCenterY())},a.exports=C},function(a,n,i){var o={};o.layoutBase=i(0),o.CoSEConstants=i(1),o.CoSEEdge=i(2),o.CoSEGraph=i(3),o.CoSEGraphManager=i(4),o.CoSELayout=i(6),o.CoSENode=i(5),a.exports=o}])})}(bn)),bn.exports}var Fm=mn.exports,tf;function Gm(){return tf||(tf=1,function(t,e){(function(a,n){t.exports=n(km())})(Fm,function(r){return function(a){var n={};function i(o){if(n[o])return n[o].exports;var s=n[o]={i:o,l:!1,exports:{}};return a[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=a,i.c=n,i.i=function(o){return o},i.d=function(o,s,u){i.o(o,s)||Object.defineProperty(o,s,{configurable:!1,enumerable:!0,get:u})},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=1)}([function(a,n){a.exports=r},function(a,n,i){var o=i(0).layoutBase.LayoutConstants,s=i(0).layoutBase.FDLayoutConstants,u=i(0).CoSEConstants,l=i(0).CoSELayout,f=i(0).CoSENode,v=i(0).layoutBase.PointD,c=i(0).layoutBase.DimensionD,h={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(m,b){var E={};for(var C in m)E[C]=m[C];for(var C in b)E[C]=b[C];return E}function p(m){this.options=d(h,m),g(this.options)}var g=function(b){b.nodeRepulsion!=null&&(u.DEFAULT_REPULSION_STRENGTH=s.DEFAULT_REPULSION_STRENGTH=b.nodeRepulsion),b.idealEdgeLength!=null&&(u.DEFAULT_EDGE_LENGTH=s.DEFAULT_EDGE_LENGTH=b.idealEdgeLength),b.edgeElasticity!=null&&(u.DEFAULT_SPRING_STRENGTH=s.DEFAULT_SPRING_STRENGTH=b.edgeElasticity),b.nestingFactor!=null&&(u.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=b.nestingFactor),b.gravity!=null&&(u.DEFAULT_GRAVITY_STRENGTH=s.DEFAULT_GRAVITY_STRENGTH=b.gravity),b.numIter!=null&&(u.MAX_ITERATIONS=s.MAX_ITERATIONS=b.numIter),b.gravityRange!=null&&(u.DEFAULT_GRAVITY_RANGE_FACTOR=s.DEFAULT_GRAVITY_RANGE_FACTOR=b.gravityRange),b.gravityCompound!=null&&(u.DEFAULT_COMPOUND_GRAVITY_STRENGTH=s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=b.gravityCompound),b.gravityRangeCompound!=null&&(u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=b.gravityRangeCompound),b.initialEnergyOnIncremental!=null&&(u.DEFAULT_COOLING_FACTOR_INCREMENTAL=s.DEFAULT_COOLING_FACTOR_INCREMENTAL=b.initialEnergyOnIncremental),b.quality=="draft"?o.QUALITY=0:b.quality=="proof"?o.QUALITY=2:o.QUALITY=1,u.NODE_DIMENSIONS_INCLUDE_LABELS=s.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=b.nodeDimensionsIncludeLabels,u.DEFAULT_INCREMENTAL=s.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!b.randomize,u.ANIMATE=s.ANIMATE=o.ANIMATE=b.animate,u.TILE=b.tile,u.TILING_PADDING_VERTICAL=typeof b.tilingPaddingVertical=="function"?b.tilingPaddingVertical.call():b.tilingPaddingVertical,u.TILING_PADDING_HORIZONTAL=typeof b.tilingPaddingHorizontal=="function"?b.tilingPaddingHorizontal.call():b.tilingPaddingHorizontal};p.prototype.run=function(){var m,b,E=this.options;this.idToLNode={};var C=this.layout=new l,A=this;A.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var w=C.newGraphManager();this.gm=w;var x=this.options.eles.nodes(),T=this.options.eles.edges();this.root=w.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(x),C);for(var D=0;D<T.length;D++){var S=T[D],R=this.idToLNode[S.data("source")],L=this.idToLNode[S.data("target")];if(R!==L&&R.getEdgesBetween(L).length==0){var M=w.add(C.newEdge(),R,L);M.id=S.id()}}var I=function(O,F){typeof O=="number"&&(O=F);var G=O.data("id"),k=A.idToLNode[G];return{x:k.getRect().getCenterX(),y:k.getRect().getCenterY()}},N=function B(){for(var O=function(){E.fit&&E.cy.fit(E.eles,E.padding),m||(m=!0,A.cy.one("layoutready",E.ready),A.cy.trigger({type:"layoutready",layout:A}))},F=A.options.refresh,G,k=0;k<F&&!G;k++)G=A.stopped||A.layout.tick();if(G){C.checkLayoutSuccess()&&!C.isSubLayout&&C.doPostLayout(),C.tilingPostLayout&&C.tilingPostLayout(),C.isLayoutFinished=!0,A.options.eles.nodes().positions(I),O(),A.cy.one("layoutstop",A.options.stop),A.cy.trigger({type:"layoutstop",layout:A}),b&&cancelAnimationFrame(b),m=!1;return}var z=A.layout.getPositionsData();E.eles.nodes().positions(function(U,H){if(typeof U=="number"&&(U=H),!U.isParent()){for(var $=U.id(),K=z[$],j=U;K==null&&(K=z[j.data("parent")]||z["DummyCompound_"+j.data("parent")],z[$]=K,j=j.parent()[0],j!=null););return K!=null?{x:K.x,y:K.y}:{x:U.position("x"),y:U.position("y")}}}),O(),b=requestAnimationFrame(B)};return C.addListener("layoutstarted",function(){A.options.animate==="during"&&(b=requestAnimationFrame(N))}),C.runLayout(),this.options.animate!=="during"&&(A.options.eles.nodes().not(":parent").layoutPositions(A,A.options,I),m=!1),this},p.prototype.getTopMostNodes=function(m){for(var b={},E=0;E<m.length;E++)b[m[E].id()]=!0;var C=m.filter(function(A,w){typeof A=="number"&&(A=w);for(var x=A.parent()[0];x!=null;){if(b[x.id()])return!1;x=x.parent()[0]}return!0});return C},p.prototype.processChildrenList=function(m,b,E){for(var C=b.length,A=0;A<C;A++){var w=b[A],x=w.children(),T,D=w.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(w.outerWidth()!=null&&w.outerHeight()!=null?T=m.add(new f(E.graphManager,new v(w.position("x")-D.w/2,w.position("y")-D.h/2),new c(parseFloat(D.w),parseFloat(D.h)))):T=m.add(new f(this.graphManager)),T.id=w.data("id"),T.paddingLeft=parseInt(w.css("padding")),T.paddingTop=parseInt(w.css("padding")),T.paddingRight=parseInt(w.css("padding")),T.paddingBottom=parseInt(w.css("padding")),this.options.nodeDimensionsIncludeLabels&&w.isParent()){var S=w.boundingBox({includeLabels:!0,includeNodes:!1}).w,R=w.boundingBox({includeLabels:!0,includeNodes:!1}).h,L=w.css("text-halign");T.labelWidth=S,T.labelHeight=R,T.labelPos=L}if(this.idToLNode[w.data("id")]=T,isNaN(T.rect.x)&&(T.rect.x=0),isNaN(T.rect.y)&&(T.rect.y=0),x!=null&&x.length>0){var M;M=E.getGraphManager().add(E.newGraph(),T),this.processChildrenList(M,x,E)}}},p.prototype.stop=function(){return this.stopped=!0,this};var y=function(b){b("layout","cose-bilkent",p)};typeof cytoscape<"u"&&y(cytoscape),a.exports=y}])})}(mn)),mn.exports}var zm=Gm();const Um=ac(zm);export{Um as a,ea as c};