interactive-drawer 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/dist/index.js +6482 -94
- package/dist/mcp-app.html +48 -47
- package/dist/server.js +6424 -36
- package/dist/viewer/assets/Tableau10-DrPBiGEf.js +1 -0
- package/dist/viewer/assets/ar-SA-G6X2FPQ2-BFqqR8FR.js +10 -0
- package/dist/viewer/assets/arc-GaJhGPcn.js +1 -0
- package/dist/viewer/assets/array-eiH4WfvY.js +1 -0
- package/dist/viewer/assets/az-AZ-76LH7QW2-DCeCaEDa.js +1 -0
- package/dist/viewer/assets/bg-BG-XCXSNQG7-CJnR7Nxx.js +5 -0
- package/dist/viewer/assets/blockDiagram-c4efeb88-Bq-rw8Uo.js +118 -0
- package/dist/viewer/assets/bn-BD-2XOGV67Q-DniN6gQV.js +5 -0
- package/dist/viewer/assets/c4Diagram-c83219d4-P4d2aMNQ.js +10 -0
- package/dist/viewer/assets/ca-ES-6MX7JW3Y-RlcHvNhZ.js +8 -0
- package/dist/viewer/assets/channel-C9ytsi9W.js +1 -0
- package/dist/viewer/assets/chunk-DseTPa7n.js +1 -0
- package/dist/viewer/assets/chunk-EIO257PC-8vtwmiF2.js +22 -0
- package/dist/viewer/assets/classDiagram-beda092f-BbZqlrnC.js +2 -0
- package/dist/viewer/assets/classDiagram-v2-2358418a-ClJ67nU_.js +2 -0
- package/dist/viewer/assets/clone-DeosMkZ8.js +1 -0
- package/dist/viewer/assets/createText-1719965b-CDC9UGX7.js +7 -0
- package/dist/viewer/assets/cs-CZ-2BRQDIVT-BBRI7OB2.js +11 -0
- package/dist/viewer/assets/da-DK-5WZEPLOC-X7Tc9fPY.js +5 -0
- package/dist/viewer/assets/dagre-CYaQwyjE.js +1 -0
- package/dist/viewer/assets/de-DE-XR44H4JA-BGdWdZ6Y.js +8 -0
- package/dist/viewer/assets/directory-open-01563666-DJZ0Svp1.js +1 -0
- package/dist/viewer/assets/directory-open-4ed118d0-DmPqFVGU.js +1 -0
- package/dist/viewer/assets/dist-Df4G2036.js +7 -0
- package/dist/viewer/assets/edges-96097737-DFipR3OC.js +4 -0
- package/dist/viewer/assets/el-GR-BZB4AONW-cUKQ4z-m.js +10 -0
- package/dist/viewer/assets/en-B4ZKOASM-B7a4Uff4.js +1 -0
- package/dist/viewer/assets/erDiagram-0228fc6a-C0KmS7Y6.js +51 -0
- package/dist/viewer/assets/es-ES-U4NZUMDT-DO3b5sfh.js +9 -0
- package/dist/viewer/assets/eu-ES-A7QVB2H4-Bz48GjZD.js +11 -0
- package/dist/viewer/assets/fa-IR-HGAKTJCU-D5WdotN3.js +8 -0
- package/dist/viewer/assets/fi-FI-Z5N7JZ37-DSeyUEff.js +6 -0
- package/dist/viewer/assets/file-open-002ab408-DIgra59R.js +1 -0
- package/dist/viewer/assets/file-open-7c801643-BAm_j8m_.js +1 -0
- package/dist/viewer/assets/file-save-3189631c-B1XCX4Ho.js +1 -0
- package/dist/viewer/assets/file-save-745eba88-DBUdNUxO.js +1 -0
- package/dist/viewer/assets/flowDb-c6c81e3f-CxbqyWny.js +10 -0
- package/dist/viewer/assets/flowDiagram-50d868cf-DeY6CLtt.js +4 -0
- package/dist/viewer/assets/flowDiagram-v2-4f6560a1-D4r3CihG.js +1 -0
- package/dist/viewer/assets/flowchart-elk-definition-6af322e1-BUJhZGoB.js +139 -0
- package/dist/viewer/assets/fr-FR-RHASNOE6-DCzPW_R5.js +9 -0
- package/dist/viewer/assets/ganttDiagram-a2739b55-Y2jSgQ5_.js +257 -0
- package/dist/viewer/assets/gitGraphDiagram-82fe8481-B-G9PxZD.js +70 -0
- package/dist/viewer/assets/gl-ES-HMX3MZ6V-4v9b_boY.js +10 -0
- package/dist/viewer/assets/graphlib-BFISMqHp.js +1 -0
- package/dist/viewer/assets/he-IL-6SHJWFNN-BDBk7TIu.js +10 -0
- package/dist/viewer/assets/hi-IN-IWLTKZ5I-B6ZhK1-r.js +4 -0
- package/dist/viewer/assets/hu-HU-A5ZG7DT2-BmhPjlz2.js +7 -0
- package/dist/viewer/assets/id-ID-SAP4L64H-Ca9c1v2y.js +10 -0
- package/dist/viewer/assets/image-7KUKJ7J4-C_3TAm4E.js +1 -0
- package/dist/viewer/assets/image-blob-reduce.esm-BVtT0K8A.js +2 -0
- package/dist/viewer/assets/index-5325376f-BP_L7r1w.js +1 -0
- package/dist/viewer/assets/index-CAvUkg_l.js +210 -0
- package/dist/viewer/assets/index-DtRVLazd.css +1 -0
- package/dist/viewer/assets/infoDiagram-8eee0895-pHJ5AUlk.js +7 -0
- package/dist/viewer/assets/init-BdkYWjJJ.js +1 -0
- package/dist/viewer/assets/it-IT-JPQ66NNP-BtnPiSOt.js +11 -0
- package/dist/viewer/assets/ja-JP-DBVTYXUO-IKf5mITh.js +8 -0
- package/dist/viewer/assets/journeyDiagram-c64418c1-DcUxfC5f.js +139 -0
- package/dist/viewer/assets/kaa-6HZHGXH3-D98FSJfx.js +1 -0
- package/dist/viewer/assets/kab-KAB-ZGHBKWFO-8T1OXJlA.js +8 -0
- package/dist/viewer/assets/katex-D7lVlZR3.js +261 -0
- package/dist/viewer/assets/kk-KZ-P5N5QNE5-hmkL9lmH.js +1 -0
- package/dist/viewer/assets/km-KH-HSX4SM5Z-DIv7bsrY.js +11 -0
- package/dist/viewer/assets/ko-KR-MTYHY66A-Ce2HW7MD.js +9 -0
- package/dist/viewer/assets/ku-TR-6OUDTVRD-CmmFskjS.js +9 -0
- package/dist/viewer/assets/line-DVouyT6m.js +1 -0
- package/dist/viewer/assets/linear-CwtknuR1.js +1 -0
- package/dist/viewer/assets/lt-LT-XHIRWOB4-fxXcoOJu.js +3 -0
- package/dist/viewer/assets/lv-LV-5QDEKY6T-MuO2KWsv.js +7 -0
- package/dist/viewer/assets/mermaid-7ea9cbd6-QHMIyrmu.js +89 -0
- package/dist/viewer/assets/mindmap-definition-8da855dc-37JNJqVl.js +415 -0
- package/dist/viewer/assets/mr-IN-CRQNXWMA-4y5geKZE.js +13 -0
- package/dist/viewer/assets/my-MM-5M5IBNSE-B-IRBixJ.js +1 -0
- package/dist/viewer/assets/nb-NO-T6EIAALU-DKd_39gb.js +10 -0
- package/dist/viewer/assets/nl-NL-IS3SIHDZ-VUyGNxJV.js +8 -0
- package/dist/viewer/assets/nn-NO-6E72VCQL-D7O6iyxQ.js +8 -0
- package/dist/viewer/assets/oc-FR-POXYY2M6-BN5YJ9MM.js +8 -0
- package/dist/viewer/assets/ordinal-gnpqfIHn.js +1 -0
- package/dist/viewer/assets/pa-IN-N4M65BXN-BaKFq2TD.js +4 -0
- package/dist/viewer/assets/path-B4emajHp.js +1 -0
- package/dist/viewer/assets/percentages-BXMCSKIN-DYgAIZll.js +1 -0
- package/dist/viewer/assets/pica-C6VdRnu2.js +2 -0
- package/dist/viewer/assets/pieDiagram-a8764435-DF_IQH2O.js +35 -0
- package/dist/viewer/assets/pl-PL-T2D74RX3-Dxiw8she.js +9 -0
- package/dist/viewer/assets/pt-BR-5N22H2LF-C9V7C5Bx.js +9 -0
- package/dist/viewer/assets/pt-PT-UZXXM6DQ-BG4j3hQ6.js +9 -0
- package/dist/viewer/assets/quadrantDiagram-1e28029f-Bu-ydjF2.js +7 -0
- package/dist/viewer/assets/requirementDiagram-08caed73-D3rsJYSP.js +52 -0
- package/dist/viewer/assets/ro-RO-JPDTUUEW-C3joF14E.js +11 -0
- package/dist/viewer/assets/roundRect-h00du4IH.js +1 -0
- package/dist/viewer/assets/ru-RU-B4JR7IUQ-Bmxqcu-c.js +9 -0
- package/dist/viewer/assets/sankeyDiagram-a04cb91d-_p8wXWXs.js +8 -0
- package/dist/viewer/assets/sequenceDiagram-c5b8d532-Dtg9Z8RA.js +122 -0
- package/dist/viewer/assets/si-LK-N5RQ5JYF-DUy51NFG.js +1 -0
- package/dist/viewer/assets/sk-SK-C5VTKIMK-BTwIUYAW.js +6 -0
- package/dist/viewer/assets/sl-SI-NN7IZMDC-Dztr_8tT.js +6 -0
- package/dist/viewer/assets/stateDiagram-1ecb1508-Dl5UpWCH.js +1 -0
- package/dist/viewer/assets/stateDiagram-v2-c2b004d7-DDttuxof.js +1 -0
- package/dist/viewer/assets/styles-b4e223ce-SxTtvvOZ.js +160 -0
- package/dist/viewer/assets/styles-ca3715f6-Pj9q5Oqy.js +207 -0
- package/dist/viewer/assets/styles-d45a18b0-CXdBN14L.js +116 -0
- package/dist/viewer/assets/subset-shared.chunk-BjY0OTOG.js +1 -0
- package/dist/viewer/assets/subset-worker.chunk-CtXL6u_B.js +1 -0
- package/dist/viewer/assets/sv-SE-XGPEYMSR-SfqXUjz-.js +10 -0
- package/dist/viewer/assets/svgDrawCommon-b86b1483-CFeizGgn.js +1 -0
- package/dist/viewer/assets/ta-IN-2NMHFXQM-Bv5HXCfF.js +9 -0
- package/dist/viewer/assets/th-TH-HPSO5L25--_SAf8xQ.js +2 -0
- package/dist/viewer/assets/timeline-definition-faaaa080-DWR1Otmc.js +61 -0
- package/dist/viewer/assets/tr-TR-DEFEU3FU-CVMTsAZi.js +7 -0
- package/dist/viewer/assets/uk-UA-QMV73CPH-CPDONm8a.js +6 -0
- package/dist/viewer/assets/vi-VN-M7AON7JQ-CF_ysUfb.js +5 -0
- package/dist/viewer/assets/xychartDiagram-f5964ef8-_Jv5IYur.js +7 -0
- package/dist/viewer/assets/zh-CN-LNUGB5OW-B4SpY2Q5.js +10 -0
- package/dist/viewer/assets/zh-HK-E62DVLB3-BCMdT5Ol.js +1 -0
- package/dist/viewer/assets/zh-TW-RAJ6MFWO-CkV2IlSF.js +9 -0
- package/dist/viewer/index.html +3 -2
- package/package.json +13 -9
- package/dist/viewer/assets/Tableau10-B-NsZVaP.js +0 -1
- package/dist/viewer/assets/_commonjs-dynamic-modules-TDtrdbi3.js +0 -1
- package/dist/viewer/assets/ar-SA-G6X2FPQ2-DadQCH2-.js +0 -10
- package/dist/viewer/assets/arc-CQgrOt5x.js +0 -1
- package/dist/viewer/assets/array-BKyUJesY.js +0 -1
- package/dist/viewer/assets/az-AZ-76LH7QW2-DQfUuqqi.js +0 -1
- package/dist/viewer/assets/bg-BG-XCXSNQG7-BB40UBFK.js +0 -5
- package/dist/viewer/assets/blockDiagram-c4efeb88-BaF5AmVI.js +0 -118
- package/dist/viewer/assets/bn-BD-2XOGV67Q-uzDHfiqC.js +0 -5
- package/dist/viewer/assets/c4Diagram-c83219d4-hWhr-GlJ.js +0 -10
- package/dist/viewer/assets/ca-ES-6MX7JW3Y-BW7AckRl.js +0 -8
- package/dist/viewer/assets/channel-CXejbLtU.js +0 -1
- package/dist/viewer/assets/classDiagram-beda092f-CymCu8CT.js +0 -2
- package/dist/viewer/assets/classDiagram-v2-2358418a-DJAISyxA.js +0 -2
- package/dist/viewer/assets/clone-CfbodbqL.js +0 -1
- package/dist/viewer/assets/createText-1719965b-BnEANXd0.js +0 -7
- package/dist/viewer/assets/cs-CZ-2BRQDIVT-DuVk-qPr.js +0 -11
- package/dist/viewer/assets/da-DK-5WZEPLOC-DFahLFHr.js +0 -5
- package/dist/viewer/assets/de-DE-XR44H4JA-DoRzoyVr.js +0 -8
- package/dist/viewer/assets/directory-open-01563666-DWU9wJ6I.js +0 -1
- package/dist/viewer/assets/directory-open-4ed118d0-CunoC1EB.js +0 -1
- package/dist/viewer/assets/edges-96097737-BaZooScF.js +0 -4
- package/dist/viewer/assets/el-GR-BZB4AONW--pwLECF8.js +0 -10
- package/dist/viewer/assets/erDiagram-0228fc6a-57itH3DJ.js +0 -51
- package/dist/viewer/assets/es-ES-U4NZUMDT-C1NjAcMt.js +0 -9
- package/dist/viewer/assets/eu-ES-A7QVB2H4-Ck1DCJa4.js +0 -11
- package/dist/viewer/assets/fa-IR-HGAKTJCU-tLLl_5WD.js +0 -8
- package/dist/viewer/assets/fi-FI-Z5N7JZ37-DVtDP0gn.js +0 -6
- package/dist/viewer/assets/file-open-002ab408-DIuFHtCF.js +0 -1
- package/dist/viewer/assets/file-open-7c801643-684qeFg4.js +0 -1
- package/dist/viewer/assets/file-save-3189631c-C1wFhQhH.js +0 -1
- package/dist/viewer/assets/file-save-745eba88-Bb9F9Kg7.js +0 -1
- package/dist/viewer/assets/flowDb-c6c81e3f-C7AEsokK.js +0 -10
- package/dist/viewer/assets/flowDiagram-50d868cf-CssTUsiu.js +0 -4
- package/dist/viewer/assets/flowDiagram-v2-4f6560a1-D0GG9NIT.js +0 -1
- package/dist/viewer/assets/flowchart-elk-definition-6af322e1-CRyPEh1i.js +0 -139
- package/dist/viewer/assets/fr-FR-RHASNOE6-T_qZ0zEK.js +0 -9
- package/dist/viewer/assets/ganttDiagram-a2739b55-DsyTeswu.js +0 -257
- package/dist/viewer/assets/gitGraphDiagram-82fe8481-D85sePVV.js +0 -70
- package/dist/viewer/assets/gl-ES-HMX3MZ6V-IW3daBzE.js +0 -10
- package/dist/viewer/assets/graph-i-2SK2w1.js +0 -1
- package/dist/viewer/assets/he-IL-6SHJWFNN-CUxTwbdR.js +0 -10
- package/dist/viewer/assets/hi-IN-IWLTKZ5I-DvQFf43e.js +0 -4
- package/dist/viewer/assets/hu-HU-A5ZG7DT2-CO4Q4G1z.js +0 -7
- package/dist/viewer/assets/id-ID-SAP4L64H-Bf_UXdp6.js +0 -10
- package/dist/viewer/assets/image-blob-reduce.esm-D6s-rqMO.js +0 -7
- package/dist/viewer/assets/index-5325376f-BRzpdHqA.js +0 -1
- package/dist/viewer/assets/index-BDC2daNC.js +0 -275
- package/dist/viewer/assets/index-BcAUh2Nm.css +0 -1
- package/dist/viewer/assets/index-rEzfVlKD.js +0 -97
- package/dist/viewer/assets/infoDiagram-8eee0895-BkRxMuec.js +0 -7
- package/dist/viewer/assets/init-Gi6I4Gst.js +0 -1
- package/dist/viewer/assets/it-IT-JPQ66NNP-AwjkJc7y.js +0 -11
- package/dist/viewer/assets/ja-JP-DBVTYXUO-07sucMhN.js +0 -8
- package/dist/viewer/assets/journeyDiagram-c64418c1-6-ZVFaXG.js +0 -139
- package/dist/viewer/assets/kaa-6HZHGXH3-CXk_Wo6h.js +0 -1
- package/dist/viewer/assets/kab-KAB-ZGHBKWFO-D88OOW68.js +0 -8
- package/dist/viewer/assets/katex-BkgLa5T_.js +0 -261
- package/dist/viewer/assets/kk-KZ-P5N5QNE5-TzX_GmjC.js +0 -1
- package/dist/viewer/assets/km-KH-HSX4SM5Z-Dy-luINx.js +0 -11
- package/dist/viewer/assets/ko-KR-MTYHY66A-Bno63g5m.js +0 -9
- package/dist/viewer/assets/ku-TR-6OUDTVRD-Daw-B1bN.js +0 -9
- package/dist/viewer/assets/layout-BSQSdjji.js +0 -1
- package/dist/viewer/assets/line-DajA25FK.js +0 -1
- package/dist/viewer/assets/linear-BUWo07xp.js +0 -1
- package/dist/viewer/assets/lt-LT-XHIRWOB4-C3_9a2Cz.js +0 -3
- package/dist/viewer/assets/lv-LV-5QDEKY6T-3H9zX9pi.js +0 -7
- package/dist/viewer/assets/mindmap-definition-8da855dc-DIeJ0MUj.js +0 -425
- package/dist/viewer/assets/mr-IN-CRQNXWMA-DLf6m35n.js +0 -13
- package/dist/viewer/assets/my-MM-5M5IBNSE-CW_RWZBw.js +0 -1
- package/dist/viewer/assets/nb-NO-T6EIAALU-B0ZpuoZJ.js +0 -10
- package/dist/viewer/assets/nl-NL-IS3SIHDZ-nZ0JmIIM.js +0 -8
- package/dist/viewer/assets/nn-NO-6E72VCQL-C_dDeYAp.js +0 -8
- package/dist/viewer/assets/oc-FR-POXYY2M6-CsidHxkc.js +0 -8
- package/dist/viewer/assets/ordinal-Cboi1Yqb.js +0 -1
- package/dist/viewer/assets/pa-IN-N4M65BXN-DuEUGA-r.js +0 -4
- package/dist/viewer/assets/path-CbwjOpE9.js +0 -1
- package/dist/viewer/assets/pica-B90j7hbh.js +0 -7
- package/dist/viewer/assets/pieDiagram-a8764435-CY0HndHR.js +0 -35
- package/dist/viewer/assets/pl-PL-T2D74RX3-D87DC8D9.js +0 -9
- package/dist/viewer/assets/pt-BR-5N22H2LF-BtSoEeex.js +0 -9
- package/dist/viewer/assets/pt-PT-UZXXM6DQ-D4bk4PLe.js +0 -9
- package/dist/viewer/assets/quadrantDiagram-1e28029f-DGki2tT-.js +0 -7
- package/dist/viewer/assets/requirementDiagram-08caed73-BkzKWnbZ.js +0 -52
- package/dist/viewer/assets/ro-RO-JPDTUUEW-Ra2U-BVb.js +0 -11
- package/dist/viewer/assets/roundRect-0PYZxl1G.js +0 -1
- package/dist/viewer/assets/ru-RU-B4JR7IUQ-DAMFn0BJ.js +0 -9
- package/dist/viewer/assets/sankeyDiagram-a04cb91d-C1WQeKAS.js +0 -8
- package/dist/viewer/assets/sequenceDiagram-c5b8d532-BQy1AIyh.js +0 -122
- package/dist/viewer/assets/si-LK-N5RQ5JYF-DtRsuwQ6.js +0 -1
- package/dist/viewer/assets/sk-SK-C5VTKIMK-Dph_9bOP.js +0 -6
- package/dist/viewer/assets/sl-SI-NN7IZMDC-CzYryWZd.js +0 -6
- package/dist/viewer/assets/stateDiagram-1ecb1508-f7QEpJSj.js +0 -1
- package/dist/viewer/assets/stateDiagram-v2-c2b004d7-B8MjoGqH.js +0 -1
- package/dist/viewer/assets/styles-b4e223ce-DfLT12Nx.js +0 -160
- package/dist/viewer/assets/styles-ca3715f6-CnuYZzQT.js +0 -207
- package/dist/viewer/assets/styles-d45a18b0-Ci9tlpxY.js +0 -116
- package/dist/viewer/assets/subset-shared.chunk-B9IoriSA.js +0 -84
- package/dist/viewer/assets/subset-worker.chunk-Bpe7TPYu.js +0 -1
- package/dist/viewer/assets/sv-SE-XGPEYMSR-B4Y9n4LB.js +0 -10
- package/dist/viewer/assets/svgDrawCommon-b86b1483-4HzjGm6B.js +0 -1
- package/dist/viewer/assets/ta-IN-2NMHFXQM-DE7pdoSM.js +0 -9
- package/dist/viewer/assets/th-TH-HPSO5L25-Dd8iADEt.js +0 -2
- package/dist/viewer/assets/timeline-definition-faaaa080-DYgcS_Y5.js +0 -61
- package/dist/viewer/assets/tr-TR-DEFEU3FU-DTOmyIrt.js +0 -7
- package/dist/viewer/assets/uk-UA-QMV73CPH-B05zHRYx.js +0 -6
- package/dist/viewer/assets/vi-VN-M7AON7JQ-ChW6Q5sn.js +0 -5
- package/dist/viewer/assets/xychartDiagram-f5964ef8-BrW97HI1.js +0 -7
- package/dist/viewer/assets/zh-CN-LNUGB5OW-DF3LdZpE.js +0 -10
- package/dist/viewer/assets/zh-HK-E62DVLB3-C3QgGFS0.js +0 -1
- package/dist/viewer/assets/zh-TW-RAJ6MFWO-ciUClBxf.js +0 -9
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import{i as e,t}from"./chunk-DseTPa7n.js";import{U as n}from"./index-CAvUkg_l.js";import{D as r,M as i,Mt as a,Nt as o,Pt as s,R as c,T as l,_ as u,dn as d,f,hn as p,j as m}from"./mermaid-7ea9cbd6-QHMIyrmu.js";import{n as h}from"./createText-1719965b-CDC9UGX7.js";function g(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _(e){if(Array.isArray(e))return e}function v(e){if(Array.isArray(e))return g(e)}function y(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,j(r.key),r)}}function x(e,t,n){return t&&b(e.prototype,t),Object.defineProperty(e,`prototype`,{writable:!1}),e}function S(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=N(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function C(e,t,n){return(t=j(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function T(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function E(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O(e,t){return _(e)||T(e,t)||N(e,t)||E()}function k(e){return v(e)||w(e)||N(e)||D()}function A(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}function j(e){var t=A(e,`string`);return typeof t==`symbol`?t:t+``}function M(e){"@babel/helpers - typeof";return M=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},M(e)}function N(e,t){if(e){if(typeof e==`string`)return g(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}var P=typeof window>`u`?null:window,F=P?P.navigator:null;P&&P.document;var I=M(``),L=M({}),R=M(function(){}),z=typeof HTMLElement>`u`?`undefined`:M(HTMLElement),B=function(e){return e&&e.instanceString&&H(e.instanceString)?e.instanceString():null},V=function(e){return e!=null&&M(e)==I},H=function(e){return e!=null&&M(e)===R},U=function(e){return!Y(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},W=function(e){return e!=null&&M(e)===L&&!U(e)&&e.constructor===Object},G=function(e){return e!=null&&M(e)===L},K=function(e){return e!=null&&M(e)===M(1)&&!isNaN(e)},q=function(e){return K(e)&&Math.floor(e)===e},J=function(e){if(z!==`undefined`)return e!=null&&e instanceof HTMLElement},Y=function(e){return ee(e)||te(e)},ee=function(e){return B(e)===`collection`&&e._private.single},te=function(e){return B(e)===`collection`&&!e._private.single},ne=function(e){return B(e)===`core`},re=function(e){return B(e)===`stylesheet`},ie=function(e){return B(e)===`event`},ae=function(e){return e==null?!0:!!(e===``||e.match(/^\s+$/))},oe=function(e){return typeof HTMLElement>`u`?!1:e instanceof HTMLElement},se=function(e){return W(e)&&K(e.x1)&&K(e.x2)&&K(e.y1)&&K(e.y2)},ce=function(e){return G(e)&&H(e.then)},le=function(){return F&&F.userAgent.match(/msie|trident|edge/i)},ue=function(e,t){t||=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return`undefined`;for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join(`$`)};var n=function(){var r=this,i=arguments,a,o=t.apply(r,i),s=n.cache;return(a=s[o])||(a=s[o]=e.apply(r,i)),a};return n.cache={},n},de=ue(function(e){return e.replace(/([A-Z])/g,function(e){return`-`+e.toLowerCase()})}),fe=ue(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),pe=ue(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+`$`+t}),me=function(e){return ae(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},he=function(e,t){return e.slice(-1*t.length)===t},ge=`(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))`,_e=`rgb[a]?\\((`+ge+`[%]?)\\s*,\\s*(`+ge+`[%]?)\\s*,\\s*(`+ge+`[%]?)(?:\\s*,\\s*(`+ge+`))?\\)`,ve=`rgb[a]?\\((?:`+ge+`[%]?)\\s*,\\s*(?:`+ge+`[%]?)\\s*,\\s*(?:`+ge+`[%]?)(?:\\s*,\\s*(?:`+ge+`))?\\)`,ye=`hsl[a]?\\((`+ge+`)\\s*,\\s*(`+ge+`[%])\\s*,\\s*(`+ge+`[%])(?:\\s*,\\s*(`+ge+`))?\\)`,be=`hsl[a]?\\((?:`+ge+`)\\s*,\\s*(?:`+ge+`[%])\\s*,\\s*(?:`+ge+`[%])(?:\\s*,\\s*(?:`+ge+`))?\\)`,xe=`\\#[0-9a-fA-F]{3}`,Se=`\\#[0-9a-fA-F]{6}`,Ce=function(e,t){return e<t?-1:e>t?1:0},we=function(e,t){return-1*Ce(e,t)},X=Object.assign==null?function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e}:Object.assign.bind(Object),Te=function(e){if(!(!(e.length===4||e.length===7)||e[0]!==`#`)){var t=e.length===4,n,r,i,a=16;return t?(n=parseInt(e[1]+e[1],a),r=parseInt(e[2]+e[2],a),i=parseInt(e[3]+e[3],a)):(n=parseInt(e[1]+e[2],a),r=parseInt(e[3]+e[4],a),i=parseInt(e[5]+e[6],a)),[n,r,i]}},Ee=function(e){var t,n,r,i,a,o,s,c;function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var u=RegExp(`^`+ye+`$`).exec(e);if(u){if(n=parseInt(u[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,r=parseFloat(u[2]),r<0||r>100||(r/=100,i=parseFloat(u[3]),i<0||i>100)||(i/=100,a=u[4],a!==void 0&&(a=parseFloat(a),a<0||a>1)))return;if(r===0)o=s=c=Math.round(i*255);else{var d=i<.5?i*(1+r):i+r-i*r,f=2*i-d;o=Math.round(255*l(f,d,n+1/3)),s=Math.round(255*l(f,d,n)),c=Math.round(255*l(f,d,n-1/3))}t=[o,s,c,a]}return t},De=function(e){var t,n=RegExp(`^`+_e+`$`).exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if(a[a.length-1]===`%`&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var c=n[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;t.push(c)}}return t},Oe=function(e){return Ae[e.toLowerCase()]},ke=function(e){return(U(e)?e:null)||Oe(e)||Te(e)||De(e)||Ee(e)},Ae={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]},je=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(W(a))throw Error(`Tried to set map with object key`);i<n.length-1?(t[a]??(t[a]={}),t=t[a]):t[a]=e.value}},Me=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(W(a))throw Error(`Tried to get map with object key`);if(t=t[a],t==null)return t}return t},Ne=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function Pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Fe,Ie;function Le(){if(Ie)return Fe;Ie=1;function e(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}return Fe=e,Fe}var Re,ze;function Be(){return ze?Re:(ze=1,Re=typeof Ne==`object`&&Ne&&Ne.Object===Object&&Ne,Re)}var Ve,He;function Ue(){if(He)return Ve;He=1;var e=Be(),t=typeof self==`object`&&self&&self.Object===Object&&self;return Ve=e||t||Function(`return this`)(),Ve}var We,Ge;function Ke(){if(Ge)return We;Ge=1;var e=Ue();return We=function(){return e.Date.now()},We}var qe,Je;function Ye(){if(Je)return qe;Je=1;var e=/\s/;function t(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return qe=t,qe}var Xe,Ze;function Qe(){if(Ze)return Xe;Ze=1;var e=Ye(),t=/^\s+/;function n(n){return n&&n.slice(0,e(n)+1).replace(t,``)}return Xe=n,Xe}var $e,et;function tt(){return et?$e:(et=1,$e=Ue().Symbol,$e)}var nt,rt;function it(){if(rt)return nt;rt=1;var e=tt(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch{}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}return nt=a,nt}var at,ot;function st(){if(ot)return at;ot=1;var e=Object.prototype.toString;function t(t){return e.call(t)}return at=t,at}var ct,lt;function ut(){if(lt)return ct;lt=1;var e=tt(),t=it(),n=st(),r=`[object Null]`,i=`[object Undefined]`,a=e?e.toStringTag:void 0;function o(e){return e==null?e===void 0?i:r:a&&a in Object(e)?t(e):n(e)}return ct=o,ct}var dt,ft;function pt(){if(ft)return dt;ft=1;function e(e){return typeof e==`object`&&!!e}return dt=e,dt}var mt,ht;function gt(){if(ht)return mt;ht=1;var e=ut(),t=pt(),n=`[object Symbol]`;function r(r){return typeof r==`symbol`||t(r)&&e(r)==n}return mt=r,mt}var _t,vt;function yt(){if(vt)return _t;vt=1;var e=Qe(),t=Le(),n=gt(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(c){if(typeof c==`number`)return c;if(n(c))return r;if(t(c)){var l=typeof c.valueOf==`function`?c.valueOf():c;c=t(l)?l+``:l}if(typeof c!=`string`)return c===0?c:+c;c=e(c);var u=a.test(c);return u||o.test(c)?s(c.slice(2),u?2:8):i.test(c)?r:+c}return _t=c,_t}var bt,xt;function St(){if(xt)return bt;xt=1;var e=Le(),t=Ke(),n=yt(),r=`Expected a function`,i=Math.max,a=Math.min;function o(o,s,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof o!=`function`)throw TypeError(r);s=n(s)||0,e(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?i(n(c.maxWait)||0,s):d,v=`trailing`in c?!!c.trailing:v);function y(e){var t=l,n=u;return l=u=void 0,h=e,f=o.apply(n,t),f}function b(e){return h=e,p=setTimeout(C,s),g?y(e):f}function x(e){var t=e-m,n=e-h,r=s-t;return _?a(r,d-n):r}function S(e){var t=e-m,n=e-h;return m===void 0||t>=s||t<0||_&&n>=d}function C(){var e=t();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(t())}function D(){var e=t(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,s),y(m)}return p===void 0&&(p=setTimeout(C,s)),f}return D.cancel=T,D.flush=E,D}return bt=o,bt}var Ct=Pe(St()),wt=P?P.performance:null,Tt=wt&&wt.now?function(){return wt.now()}:function(){return Date.now()},Et=function(){if(P){if(P.requestAnimationFrame)return function(e){P.requestAnimationFrame(e)};if(P.mozRequestAnimationFrame)return function(e){P.mozRequestAnimationFrame(e)};if(P.webkitRequestAnimationFrame)return function(e){P.webkitRequestAnimationFrame(e)};if(P.msRequestAnimationFrame)return function(e){P.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(Tt())},1e3/60)}}(),Dt=function(e){return Et(e)},Ot=Tt,kt=9261,At=65599,jt=5381,Mt=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kt,n;n=e.next(),!n.done;)t=t*At+n.value|0;return t},Nt=function(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:kt)*At+e|0},Pt=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jt;return(t<<5)+t+e|0},Ft=function(e,t){return e*2097152+t},It=function(e){return e[0]*2097152+e[1]},Lt=function(e,t){return[Nt(e[0],t[0]),Pt(e[1],t[1])]},Rt=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return Mt({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},zt=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return Mt({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},Bt=function(){return Vt(arguments)},Vt=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=n===0?zt(r):zt(r,t)}return t};function Ht(e,t,n,r,i){var a=i*Math.PI/180;return{x:Math.cos(a)*(e-n)-Math.sin(a)*(t-r)+n,y:Math.sin(a)*(e-n)+Math.cos(a)*(t-r)+r}}var Ut=function(e,t,n,r,i,a){return{x:(e-n)*i+n,y:(t-r)*a+r}};function Wt(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,o=1/a,s=Ht(e.x,e.y,r,i,n),c=Ut(s.x,s.y,r,i,a,o);return{x:c.x,y:c.y}}var Gt=!0,Kt=console.warn!=null,qt=console.trace!=null,Jt=2**53-1||9007199254740991,Yt=function(){return!0},Xt=function(){return!1},Zt=function(){return 0},Qt=function(){},$t=function(e){throw Error(e)},en=function(e){if(e!==void 0)Gt=!!e;else return Gt},tn=function(e){en()&&(Kt?console.warn(e):(console.log(e),qt&&console.trace()))},nn=function(e){return X({},e)},rn=function(e){return e==null?e:U(e)?e.slice():W(e)?nn(e):e},an=function(e){return e.slice()},on=function(e,t){for(t=e=``;e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):`-`);return t},sn={},cn=function(){return sn},ln=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=n?.[a];r[a]=o===void 0?e[a]:o}return r}},un=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},dn=function(e){e.splice(0,e.length)},fn=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},pn=function(e,t,n){return n&&(t=pe(n,t)),e[t]},mn=function(e,t,n,r){n&&(t=pe(n,t)),e[t]=r},hn=function(){function e(){y(this,e),this._obj={}}return x(e,[{key:`set`,value:function(e,t){return this._obj[e]=t,this}},{key:`delete`,value:function(e){return this._obj[e]=void 0,this}},{key:`clear`,value:function(){this._obj={}}},{key:`has`,value:function(e){return this._obj[e]!==void 0}},{key:`get`,value:function(e){return this._obj[e]}}])}(),gn=typeof Map<`u`?Map:hn,_n=`undefined`,vn=function(){function e(t){if(y(this,e),this._obj=Object.create(null),this.size=0,t!=null)for(var n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t,r=0;r<n.length;r++)this.add(n[r])}return x(e,[{key:`instanceString`,value:function(){return`set`}},{key:`add`,value:function(e){var t=this._obj;t[e]!==1&&(t[e]=1,this.size++)}},{key:`delete`,value:function(e){var t=this._obj;t[e]===1&&(t[e]=0,this.size--)}},{key:`clear`,value:function(){this._obj=Object.create(null)}},{key:`has`,value:function(e){return this._obj[e]===1}},{key:`toArray`,value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:`forEach`,value:function(e,t){return this.toArray().forEach(e,t)}}])}(),yn=(typeof Set>`u`?`undefined`:M(Set))===_n?vn:Set,bn=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!ne(e)){$t(`An element must have a core reference and parameters set`);return}var r=t.group;if(r??=t.data&&t.data.source!=null&&t.data.target!=null?`edges`:`nodes`,r!==`nodes`&&r!==`edges`){$t("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?r===`edges`:!!t.pannable,active:!1,classes:new yn,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.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??(i.position.x=0),i.position.y??(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var c=[];U(t.classes)?c=t.classes:V(t.classes)&&(c=t.classes.split(/\s+/));for(var l=0,u=c.length;l<u;l++){var d=c[l];!d||d===``||i.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var f=t.style||t.css;f&&(tn("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},xn=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;W(t)&&!Y(t)&&(i=t,t=i.roots||i.root,n=i.visit,r=i.directed),r=arguments.length===2&&!H(n)?n:r,n=H(n)?n:function(){};for(var a=this._private.cy,o=t=V(t)?this.filter(t):t,s=[],c=[],l={},u={},d={},f=0,p,m=this.byGroup(),h=m.nodes,g=m.edges,_=0;_<o.length;_++){var v=o[_],y=v.id();v.isNode()&&(s.unshift(v),e.bfs&&(d[y]=!0,c.push(v)),u[y]=0)}for(var b=function(){var t=e.bfs?s.shift():s.pop(),i=t.id();if(e.dfs){if(d[i])return 0;d[i]=!0,c.push(t)}var a=u[i],o=l[i],m=o==null?null:o.source(),_=o==null?null:o.target(),v=o==null?void 0:t.same(m)?_[0]:m[0],y=n(t,o,v,f++,a);if(y===!0)return p=t,1;if(y===!1)return 1;for(var b=t.connectedEdges().filter(function(e){return(!r||e.source().same(t))&&g.has(e)}),x=0;x<b.length;x++){var S=b[x],C=S.connectedNodes().filter(function(e){return!e.same(t)&&h.has(e)}),w=C.id();C.length!==0&&!d[w]&&(C=C[0],s.push(C),e.bfs&&(d[w]=!0,c.push(C)),l[w]=S,u[w]=u[i]+1)}},x;s.length!==0&&(x=b(),!(x!==0&&x===1)););for(var S=a.collection(),C=0;C<c.length;C++){var w=c[C],T=l[w.id()];T!=null&&S.push(T),S.push(w)}return{path:a.collection(S),found:a.collection(p)}}},Sn={breadthFirstSearch:xn({bfs:!0}),depthFirstSearch:xn({dfs:!0})};Sn.bfs=Sn.breadthFirstSearch,Sn.dfs=Sn.depthFirstSearch;var Cn={exports:{}},wn=Cn.exports,Tn;function En(){return Tn?Cn.exports:(Tn=1,(function(e,t){(function(){var t,n,r=Math.floor,i,a,o,s,c,l,u=Math.min,d,f,p,m,h;n=function(e,t){return e<t?-1:e>t?1:0},l=function(e,t,i,a,o){var s;if(i??=0,o??=n,i<0)throw Error(`lo must be non-negative`);for(a??=e.length;i<a;)s=r((i+a)/2),o(t,e[s])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return r??=n,e.push(t),m(e,0,e.length-1,r)},a=function(e,t){var r,i;return t??=n,r=e.pop(),e.length?(i=e[0],e[0]=r,h(e,0,t)):i=r,i},c=function(e,t,r){var i;return r??=n,i=e[0],e[0]=t,h(e,0,r),i},s=function(e,t,r){var i;return r??=n,e.length&&r(e[0],t)<0&&(i=[e[0],t],t=i[0],e[0]=i[1],h(e,0,r)),t},i=function(e,t){var i,a,o,s,c,l;for(t??=n,s=(function(){l=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)l.push(t);return l}).apply(this).reverse(),c=[],a=0,o=s.length;a<o;a++)i=s[a],c.push(h(e,i,t));return c},p=function(e,t,r){var i;if(r??=n,i=e.indexOf(t),i!==-1)return m(e,0,i,r),h(e,i,r)},d=function(e,t,r){var a,o,c,l,u;if(r??=n,o=e.slice(0,t),!o.length)return o;for(i(o,r),u=e.slice(t),c=0,l=u.length;c<l;c++)a=u[c],s(o,a,r);return o.sort(r).reverse()},f=function(e,t,r){var o,s,c,d,f,p,m,h,g;if(r??=n,t*10<=e.length){if(c=e.slice(0,t).sort(r),!c.length)return c;for(s=c[c.length-1],m=e.slice(t),d=0,p=m.length;d<p;d++)o=m[d],r(o,s)<0&&(l(c,o,0,null,r),c.pop(),s=c[c.length-1]);return c}for(i(e,r),g=[],f=0,h=u(t,e.length);0<=h?f<h:f>h;0<=h?++f:--f)g.push(a(e,r));return g},m=function(e,t,r,i){var a,o,s;for(i??=n,a=e[r];r>t;){if(s=r-1>>1,o=e[s],i(a,o)<0){e[r]=o,r=s;continue}break}return e[r]=a},h=function(e,t,r){var i,a,o,s,c;for(r??=n,a=e.length,c=t,o=e[t],i=2*t+1;i<a;)s=i+1,s<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],t=i,i=2*t+1;return e[t]=o,m(e,c,t,r)},t=(function(){e.push=o,e.pop=a,e.replace=c,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=d,e.nsmallest=f;function e(e){this.cmp=e??n,this.nodes=[]}return e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return this.nodes.indexOf(e)!==-1},e.prototype.replace=function(e){return c(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return this.nodes.length===0},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t=new e;return t.nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e})(),(function(t,n){return e.exports=n()})(this,function(){return t})}).call(wn)})(Cn),Cn.exports)}var Dn,On;function kn(){return On?Dn:(On=1,Dn=En(),Dn)}var An=Pe(kn()),jn=ln({root:null,weight:function(e){return 1},directed:!1}),Mn={dijkstra:function(e){if(!W(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=jn(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,c=V(r)?this.filter(r)[0]:r[0],l={},u={},d={},f=this.byGroup(),p=f.nodes,m=f.edges;m.unmergeBy(function(e){return e.isLoop()});for(var h=function(e){return l[e.id()]},g=function(e,t){l[e.id()]=t,_.updateItem(e)},_=new An(function(e,t){return h(e)-h(t)}),v=0;v<p.length;v++){var y=p[v];l[y.id()]=y.same(c)?0:1/0,_.push(y)}for(var b=function(e,t){for(var n=(a?e.edgesTo(t):e.edgesWith(t)).intersect(m),r=1/0,i,o=0;o<n.length;o++){var c=n[o],l=s(c);(l<r||!i)&&(r=l,i=c)}return{edge:i,dist:r}};_.size()>0;){var x=_.pop(),S=h(x),C=x.id();if(d[C]=S,S!==1/0)for(var w=x.neighborhood().intersect(p),T=0;T<w.length;T++){var E=w[T],D=E.id(),O=b(x,E),k=S+O.dist;k<h(E)&&(g(E,k),u[D]={node:x,edge:O.edge})}}return{distanceTo:function(e){return d[(V(e)?p.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=V(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),r=a.node,i=r.id()}return o.spawn(n)}}}},Nn={kruskal:function(e){e||=function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},c=0;c<i;c++)a[c]=this.spawn(n[c]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),u=0;u<l.length;u++){var d=l[u],f=d.source()[0],p=d.target()[0],m=s(f),h=s(p),g=a[m],_=a[h];m!==h&&(o.merge(d),g.merge(_),a.splice(h,1))}return o}},Pn=ln({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Fn={aStar:function(e){var t=this.cy(),n=Pn(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var c=r.id(),l=i.id(),u={},d={},f={},p=new An(function(e,t){return d[e.id()]-d[t.id()]}),m=new yn,h={},g={},_=function(e,t){p.push(e),m.add(t)},v,y,b=function(){v=p.pop(),y=v.id(),m.delete(y)},x=function(e){return m.has(e)};_(r,c),u[c]=0,d[c]=a(r);for(var S=0;p.size()>0;){if(b(),S++,y===l){for(var C=[],w=i,T=l,E=g[T];C.unshift(w),E!=null&&C.unshift(E),w=h[T],w!=null;)T=w.id(),E=g[T];return{found:!0,distance:u[y],path:this.spawn(C),steps:S}}f[y]=!0;for(var D=v._private.edges,O=0;O<D.length;O++){var k=D[O];if(this.hasElementWithId(k.id())&&!(o&&k.data(`source`)!==y)){var A=k.source(),j=k.target(),M=A.id()===y?j:A,N=M.id();if(this.hasElementWithId(N)&&!f[N]){var P=u[y]+s(k);if(!x(N)){u[N]=P,d[N]=P+a(M),_(M,N),h[N]=v,g[N]=k;continue}P<u[N]&&(u[N]=P,d[N]=P+a(M),h[N]=v,g[N]=k)}}}}return{found:!1,distance:void 0,path:void 0,steps:S}}},In=ln({weight:function(e){return 1},directed:!1}),Ln={floydWarshall:function(e){for(var t=this.cy(),n=In(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,c=o.edges,l=s.length,u=l*l,d=function(e){return s.indexOf(e)},f=function(e){return s[e]},p=Array(u),m=0;m<u;m++){var h=m%l;(m-h)/l===h?p[m]=0:p[m]=1/0}for(var g=Array(u),_=Array(u),v=0;v<c.length;v++){var y=c[v],b=y.source()[0],x=y.target()[0];if(b!==x){var S=d(b),C=d(x),w=S*l+C,T=a(y);if(p[w]>T&&(p[w]=T,g[w]=C,_[w]=y),!i){var E=C*l+S;!i&&p[E]>T&&(p[E]=T,g[E]=S,_[E]=y)}}}for(var D=0;D<l;D++)for(var O=0;O<l;O++)for(var k=O*l+D,A=0;A<l;A++){var j=O*l+A,M=D*l+A;p[k]+p[M]<p[j]&&(p[j]=p[k]+p[M],g[j]=g[k])}var N=function(e){return(V(e)?t.filter(e):e)[0]},P=function(e){return d(N(e))};return{distance:function(e,t){var n=P(e),r=P(t);return p[n*l+r]},path:function(e,n){var r=P(e),i=P(n),a=f(r);if(r===i)return a.collection();if(g[r*l+i]==null)return t.collection();var o=t.collection(),s=r,c;for(o.merge(a);r!==i;)s=r,r=g[r*l+i],c=_[s*l+r],o.merge(c),o.merge(f(r));return o}}}},Rn=ln({weight:function(e){return 1},directed:!1,root:null}),zn={bellmanFord:function(e){var t=this,n=Rn(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,c=this.cy(),l=this.byGroup(),u=l.edges,d=l.nodes,f=d.length,p=new gn,m=!1,h=[];a=c.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var g=u.length,_=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},v=function(e){return(V(e)?c.$(e):e)[0]},y=function(e){return _(v(e)).dist},b=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,r=v(e),i=[],o=r;;){if(o==null)return t.spawn();var c=_(o),l=c.edge,u=c.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;l!=null&&i.unshift(l),o=u}return s.spawn(i)},x=0;x<f;x++){var S=d[x],C=_(S);S.same(a)?C.dist=0:C.dist=1/0,C.pred=null,C.edge=null}for(var w=!1,T=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,w=!0)},E=1;E<f;E++){w=!1;for(var D=0;D<g;D++){var O=u[D],k=O.source(),A=O.target(),j=o(O),M=_(k),N=_(A);T(k,A,O,M,N,j),i||T(A,k,O,N,M,j)}if(!w)break}if(w)for(var P=[],F=0;F<g;F++){var I=u[F],L=I.source(),R=I.target(),z=o(I),B=_(L).dist,H=_(R).dist;if(B+z<H||!i&&H+z<B)if(m||=(tn(`Graph contains a negative weight cycle for Bellman-Ford`),!0),e.findNegativeWeightCycles!==!1){var U=[];B+z<H&&U.push(L),!i&&H+z<B&&U.push(R);for(var W=U.length,G=0;G<W;G++){var K=U[G],q=[K];q.push(_(K).edge);for(var J=_(K).pred;q.indexOf(J)===-1;)q.push(J),q.push(_(J).edge),J=_(J).pred;q=q.slice(q.indexOf(J));for(var Y=q[0].id(),ee=0,te=2;te<q.length;te+=2)q[te].id()<Y&&(Y=q[te].id(),ee=te);q=q.slice(ee).concat(q.slice(0,ee)),q.push(q[0]);var ne=q.map(function(e){return e.id()}).join(`,`);P.indexOf(ne)===-1&&(h.push(s.spawn(q)),P.push(ne))}}else break}return{distanceTo:y,pathTo:b,hasNegativeWeightCycle:m,negativeWeightCycles:h}}},Bn=Math.sqrt(2),Vn=function(e,t,n){n.length===0&&$t(`Karger-Stein must be run on a connected (sub)graph`);for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],c=n,l=c.length-1;l>=0;l--){var u=c[l],d=u[1],f=u[2];(t[d]===o&&t[f]===s||t[d]===s&&t[f]===o)&&c.splice(l,1)}for(var p=0;p<c.length;p++){var m=c[p];m[1]===s?(c[p]=m.slice(),c[p][1]=o):m[2]===s&&(c[p]=m.slice(),c[p][2]=o)}for(var h=0;h<t.length;h++)t[h]===s&&(t[h]=o);return c},Hn=function(e,t,n,r){for(;n>r;)t=Vn(Math.floor(Math.random()*t.length),e,t),n--;return t},Un={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil((Math.log(i)/Math.LN2)**2),s=Math.floor(i/Bn);if(i<2){$t(`At least 2 nodes are required for Karger-Stein algorithm`);return}for(var c=[],l=0;l<a;l++){var u=r[l];c.push([l,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,f=[],p=Array(i),m=Array(i),h=Array(i),g=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},_=0;_<=o;_++){for(var v=0;v<i;v++)m[v]=v;var y=Hn(m,c.slice(),i,s),b=y.slice();g(m,h);var x=Hn(m,y,s,2),S=Hn(h,b,s,2);x.length<=S.length&&x.length<d?(d=x.length,f=x,g(m,p)):S.length<=x.length&&S.length<d&&(d=S.length,f=S,g(h,p))}for(var C=this.spawn(f.map(function(e){return r[e[0]]})),w=this.spawn(),T=this.spawn(),E=p[0],D=0;D<p.length;D++){var O=p[D],k=n[D];O===E?w.merge(k):T.merge(k)}var A=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!C.contains(t)&&n.merge(t)})}),n};return{cut:C,components:[A(w),A(T)],partition1:w,partition2:T}}},Wn=function(e){return{x:e.x,y:e.y}},Gn=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Kn=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},qn=function(e){return{x:e[0],y:e[1]}},Jn=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},Yn=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},Xn=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},Zn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];a?isFinite(c)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var l=e.length,u=Math.floor(l/2);return l%2==0?(e[u-1+o]+e[u+o])/2:e[u+1+o]},Qn=function(e){return Math.PI*e/180},$n=function(e,t){return Math.atan2(t,e)-Math.PI/2},er=Math.log2||function(e){return Math.log(e)/Math.log(2)},tr=function(e){return e>0?1:e<0?-1:0},nr=function(e,t){return Math.sqrt(rr(e,t))},rr=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},ir=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},ar=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},or=function(e,t,n,r){return{x:ar(e.x,t.x,n.x,r),y:ar(e.y,t.y,n.y,r)}},sr=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=nr(e,t),o={x:i.x/a,y:i.y/a};return n??=0,r??=n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},cr=function(e,t,n){return Math.max(e,Math.min(n,t))},lr=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}}},ur=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},dr=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},fr=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},pr=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},mr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},hr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,i,a;if(t.length===1)n=r=i=a=t[0];else if(t.length===2)n=i=t[0],a=r=t[1];else if(t.length===4){var o=O(t,4);n=o[0],r=o[1],i=o[2],a=o[3]}return e.x1-=a,e.x2+=r,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},gr=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},_r=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},vr=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},yr=function(e,t){return vr(e,t.x,t.y)},br=function(e,t){return vr(e,t.x1,t.y1)&&vr(e,t.x2,t.y2)},xr=Math.hypot??function(e,t){return Math.sqrt(e*e+t*t)};function Sr(e,t){if(e.length<3)throw Error(`Need at least 3 vertices`);var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=function(e){var t=xr(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},s=function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2},c=function(e,t,o,s){var c=r(t,e),l=r(s,o),u=a(c,l);return Math.abs(u)<1e-9?n(e,i(c,.5)):n(e,i(c,a(r(o,e),l)/u))},l=e.map(function(e){return{x:e.x,y:e.y}});s(l)<0&&l.reverse();for(var u=l.length,d=[],f=0;f<u;f++){var p=l[f],m=l[(f+1)%u],h=r(m,p),g=o({x:h.y,y:-h.x});d.push(g)}for(var _=d.map(function(e,r){return{p1:n(l[r],i(e,t)),p2:n(l[(r+1)%u],i(e,t))}}),v=[],y=0;y<u;y++){var b=_[(y-1+u)%u],x=_[y],S=c(b.p1,b.p2,x.p1,x.p2);v.push(S)}return v}function Cr(e,t,n,r,i,a){var o=Sr(Vr(e,t,n,r,i),a),s=lr();return o.forEach(function(e){return pr(s,e.x,e.y)}),s}var wr=function(e,t,n,r,i,a,o){var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:`auto`,c=s===`auto`?Jr(i,a):s,l=i/2,u=a/2;c=Math.min(c,l,u);var d=c!==l,f=c!==u,p;if(d){var m=n-l+c-o,h=r-u-o;if(p=Br(e,t,n,r,m,h,n+l-c+o,h,!1),p.length>0)return p}if(f){var g=n+l+o;if(p=Br(e,t,n,r,g,r-u+c-o,g,r+u-c+o,!1),p.length>0)return p}if(d){var _=n-l+c-o,v=r+u+o;if(p=Br(e,t,n,r,_,v,n+l-c+o,v,!1),p.length>0)return p}if(f){var y=n-l-o;if(p=Br(e,t,n,r,y,r-u+c-o,y,r+u-c+o,!1),p.length>0)return p}var b,x=n-l+c,S=r-u+c;if(b=Rr(e,t,n,r,x,S,c+o),b.length>0&&b[0]<=x&&b[1]<=S)return[b[0],b[1]];var C=n+l-c,w=r-u+c;if(b=Rr(e,t,n,r,C,w,c+o),b.length>0&&b[0]>=C&&b[1]<=w)return[b[0],b[1]];var T=n+l-c,E=r+u-c;if(b=Rr(e,t,n,r,T,E,c+o),b.length>0&&b[0]>=T&&b[1]>=E)return[b[0],b[1]];var D=n-l+c,O=r+u-c;return b=Rr(e,t,n,r,D,O,c+o),b.length>0&&b[0]<=D&&b[1]>=O?[b[0],b[1]]:[]},Tr=function(e,t,n,r,i,a,o){var s=o,c=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),d=Math.max(r,a);return c-s<=e&&e<=l+s&&u-s<=t&&t<=d+s},Er=function(e,t,n,r,i,a,o,s,c){var l={x1:Math.min(n,o,i)-c,x2:Math.max(n,o,i)+c,y1:Math.min(r,s,a)-c,y2:Math.max(r,s,a)+c};return!(e<l.x1||e>l.x2||t<l.y1||t>l.y2)},Dr=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},Or=function(e,t,n,r,i){e===0&&(e=1e-5),t/=e,n/=e,r/=e;var a,o=(3*n-t*t)/9,s=-(27*r)+t*(9*n-t*t*2),c,l,u,d,f;if(s/=54,a=o*o*o+s*s,i[1]=0,d=t/3,a>0){l=s+Math.sqrt(a),l=l<0?-((-l)**(1/3)):l**(1/3),u=s-Math.sqrt(a),u=u<0?-((-u)**(1/3)):u**(1/3),i[0]=-d+l+u,d+=(l+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+l)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,a===0){f=s<0?-((-s)**(1/3)):s**(1/3),i[0]=-d+2*f,i[4]=i[2]=-(f+d);return}o=-o,c=o*o*o,c=Math.acos(s/Math.sqrt(c)),f=2*Math.sqrt(o),i[0]=-d+f*Math.cos(c/3),i[2]=-d+f*Math.cos((c+2*Math.PI)/3),i[4]=-d+f*Math.cos((c+4*Math.PI)/3)},kr=function(e,t,n,r,i,a,o,s){var c=1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,l=9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,u=3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,f=[];Or(c,l,u,d,f);for(var p=1e-7,m=[],h=0;h<6;h+=2)Math.abs(f[h+1])<p&&f[h]>=0&&f[h]<=1&&m.push(f[h]);m.push(1),m.push(0);for(var g=-1,_,v,y,b=0;b<m.length;b++)_=(1-m[b])**2*n+2*(1-m[b])*m[b]*i+m[b]*m[b]*o,v=(1-m[b])**2*r+2*(1-m[b])*m[b]*a+m[b]*m[b]*s,y=(_-e)**2+(v-t)**2,g>=0?y<g&&(g=y):g=y;return g},Ar=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],c=s[0]*s[0]+s[1]*s[1],l=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/c;return u<0?l:d>c?(e-i)*(e-i)+(t-a)*(t-a):l-d},jr=function(e,t,n){for(var r,i,a,o,s,c=0,l=0;l<n.length/2;l++)if(r=n[l*2],i=n[l*2+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),!(r==e&&a==e))if(r>=e&&e>=a||r<=e&&e<=a)s=(e-r)/(a-r)*(o-i)+i,s>t&&c++;else continue;return c%2!=0},Mr=function(e,t,n,r,i,a,o,s,c){var l=Array(n.length),u;s[0]==null?u=s:(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2);for(var d=Math.cos(-u),f=Math.sin(-u),p=0;p<l.length/2;p++)l[p*2]=a/2*(n[p*2]*d-n[p*2+1]*f),l[p*2+1]=o/2*(n[p*2+1]*d+n[p*2]*f),l[p*2]+=r,l[p*2+1]+=i;return jr(e,t,c>0?Pr(Fr(l,-c)):l)},Nr=function(e,t,n,r,i,a,o,s){for(var c=Array(n.length*2),l=0;l<s.length;l++){var u=s[l];if(c[l*4+0]=u.startX,c[l*4+1]=u.startY,c[l*4+2]=u.stopX,c[l*4+3]=u.stopY,(u.cx-e)**2+(u.cy-t)**2<=u.radius**2)return!0}return jr(e,t,c)},Pr=function(e){for(var t=Array(e.length/2),n,r,i,a,o,s,c,l,u=0;u<e.length/4;u++){n=e[u*4],r=e[u*4+1],i=e[u*4+2],a=e[u*4+3],u<e.length/4-1?(o=e[(u+1)*4],s=e[(u+1)*4+1],c=e[(u+1)*4+2],l=e[(u+1)*4+3]):(o=e[0],s=e[1],c=e[2],l=e[3]);var d=Br(n,r,i,a,o,s,c,l,!0);t[u*2]=d[0],t[u*2+1]=d[1]}return t},Fr=function(e,t){for(var n=Array(e.length*2),r,i,a,o,s=0;s<e.length/2;s++){r=e[s*2],i=e[s*2+1],s<e.length/2-1?(a=e[(s+1)*2],o=e[(s+1)*2+1]):(a=e[0],o=e[1]);var c=o-i,l=-(a-r),u=Math.sqrt(c*c+l*l),d=c/u,f=l/u;n[s*4]=r+d*t,n[s*4+1]=i+f*t,n[s*4+2]=a+d*t,n[s*4+3]=o+f*t}return n},Ir=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var c=Math.sqrt(o*o+s*s),l=c-1;if(l<0)return[];var u=l/c;return[(n-e)*u+e,(r-t)*u+t]},Lr=function(e,t,n,r,i,a,o){return e-=i,t-=a,e/=n/2+o,t/=r/2+o,e*e+t*t<=1},Rr=function(e,t,n,r,i,a,o){var s=[n-e,r-t],c=[e-i,t-a],l=s[0]*s[0]+s[1]*s[1],u=2*(c[0]*s[0]+c[1]*s[1]),d=c[0]*c[0]+c[1]*c[1]-o*o,f=u*u-4*l*d;if(f<0)return[];var p=(-u+Math.sqrt(f))/(2*l),m=(-u-Math.sqrt(f))/(2*l),h=Math.min(p,m),g=Math.max(p,m),_=[];if(h>=0&&h<=1&&_.push(h),g>=0&&g<=1&&_.push(g),_.length===0)return[];var v=_[0]*s[0]+e,y=_[0]*s[1]+t;return _.length>1?_[0]==_[1]?[v,y]:[v,y,_[1]*s[0]+e,_[1]*s[1]+t]:[v,y]},zr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Br=function(e,t,n,r,i,a,o,s,c){var l=e-i,u=n-e,d=o-i,f=t-a,p=r-t,m=s-a,h=d*f-m*l,g=u*f-p*l,_=m*u-d*p;if(_!==0){var v=h/_,y=g/_,b=.001,x=0-b,S=1+b;return x<=v&&v<=S&&x<=y&&y<=S||c?[e+v*u,t+v*p]:[]}else if(h===0||g===0)return zr(e,n,o)===o?[o,s]:zr(e,n,i)===i?[i,a]:zr(i,o,n)===n?[n,r]:[];else return[]},Vr=function(e,t,n,r,i){var a=[],o=r/2,s=i/2,c=t,l=n;a.push({x:c+o*e[0],y:l+s*e[1]});for(var u=1;u<e.length/2;u++)a.push({x:c+o*e[u*2],y:l+s*e[u*2+1]});return a},Hr=function(e,t,n,r,i,a,o,s){var c=[],l,u=Array(n.length),d=!0;a??(d=!1);var f;if(d){for(var p=0;p<u.length/2;p++)u[p*2]=n[p*2]*a+r,u[p*2+1]=n[p*2+1]*o+i;f=s>0?Pr(Fr(u,-s)):u}else f=n;for(var m,h,g,_,v=0;v<f.length/2;v++)m=f[v*2],h=f[v*2+1],v<f.length/2-1?(g=f[(v+1)*2],_=f[(v+1)*2+1]):(g=f[0],_=f[1]),l=Br(e,t,r,i,m,h,g,_),l.length!==0&&c.push(l[0],l[1]);return c},Ur=function(e,t,n,r,i,a,o,s,c){var l=[],u,d=Array(n.length*2);c.forEach(function(n,a){a===0?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[a*4-2]=n.startX,d[a*4-1]=n.startY),d[a*4]=n.stopX,d[a*4+1]=n.stopY,u=Rr(e,t,r,i,n.cx,n.cy,n.radius),u.length!==0&&l.push(u[0],u[1])});for(var f=0;f<d.length/4;f++)u=Br(e,t,r,i,d[f*4],d[f*4+1],d[f*4+2],d[f*4+3],!1),u.length!==0&&l.push(u[0],u[1]);if(l.length>2){for(var p=[l[0],l[1]],m=(p[0]-e)**2+(p[1]-t)**2,h=1;h<l.length/2;h++){var g=(l[h*2]-e)**2+(l[h*2+1]-t)**2;g<=m&&(p[0]=l[h*2],p[1]=l[h*2+1],m=g)}return p}return l},Wr=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},Gr=function(e,t){var n=qr(e,t);return n=Kr(n),n},Kr=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,c=0;c<r;c++)t=e[2*c],n=e[2*c+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var l=2/(o-i),u=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*l,n=e[2*d+1]=e[2*d+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var f=0;f<r;f++)n=e[2*f+1]=e[2*f+1]+(-1-a);return e},qr=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i=Array(e*2),a,o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},Jr=function(e,t){return Math.min(e/4,t/4,8)},Yr=function(e,t){return Math.min(e/10,t/10,8)},Xr=function(){return 8},Zr=function(e,t,n){return[e-2*t+n,2*(t-e),e]},Qr=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function $r(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n=1/0,r=-1/0,i=S(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.x*t.x+o.y*t.y;n=Math.min(n,s),r=Math.max(r,s)}}catch(e){i.e(e)}finally{i.f()}return{min:n,max:r}}function i(e,t){return!(e.max<t.min||t.max<e.min)}var a=S([].concat(k(n(e)),k(n(t)))),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!i(r(e,s),r(t,s)))return!1}}catch(e){a.e(e)}finally{a.f()}return!0}var ei=ln({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),ti={pageRank:function(e){for(var t=ei(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),c=s.nodes,l=s.edges,u=c.length,d=u*u,f=l.length,p=Array(d),m=Array(u),h=(1-n)/u,g=0;g<u;g++){for(var _=0;_<u;_++){var v=g*u+_;p[v]=0}m[g]=0}for(var y=0;y<f;y++){var b=l[y],x=b.data(`source`),S=b.data(`target`);if(x!==S){var C=c.indexOfId(x),w=c.indexOfId(S),T=a(b),E=w*u+C;p[E]+=T,m[C]+=T}}for(var D=1/u+h,O=0;O<u;O++)if(m[O]===0)for(var k=0;k<u;k++){var A=k*u+O;p[A]=D}else for(var j=0;j<u;j++){var M=j*u+O;p[M]=p[M]/m[O]+h}for(var N=Array(u),P=Array(u),F,I=0;I<u;I++)N[I]=1;for(var L=0;L<i;L++){for(var R=0;R<u;R++)P[R]=0;for(var z=0;z<u;z++)for(var B=0;B<u;B++){var V=z*u+B;P[z]+=p[V]*N[B]}ir(P),F=N,N=P,P=F;for(var H=0,U=0;U<u;U++){var W=F[U]-N[U];H+=W*W}if(H<r)break}return{rank:function(e){return e=o.collection(e)[0],N[c.indexOf(e)]}}}},ni=ln({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ri={degreeCentralityNormalized:function(e){e=ni(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,c=0;c<r;c++){var l=n[c],u=l.id();e.root=l;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[u]=d.indegree,a[u]=d.outdegree}return{indegree:function(e){return o==0?0:(V(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return s===0?0:(V(e)&&(e=t.filter(e)),a[e.id()]/s)}}}else{for(var f={},p=0,m=0;m<r;m++){var h=n[m];e.root=h;var g=this.degreeCentrality(e);p<g.degree&&(p=g.degree),f[h.id()]=g.degree}return{degree:function(e){return p===0?0:(V(e)&&(e=t.filter(e)),f[e.id()]/p)}}}},degreeCentrality:function(e){e=ni(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var c=i.connectedEdges(),l=c.filter(function(e){return e.target().same(i)&&n.has(e)}),u=c.filter(function(e){return e.source().same(i)&&n.has(e)}),d=l.length,f=u.length,p=0,m=0,h=0;h<l.length;h++)p+=a(l[h]);for(var g=0;g<u.length;g++)m+=a(u[g]);return{indegree:d**(1-s)*p**+s,outdegree:f**(1-s)*m**+s}}else{for(var _=i.connectedEdges().intersection(n),v=_.length,y=0,b=0;b<_.length;b++)y+=a(_[b]);return{degree:v**(1-s)*y**+s}}}};ri.dc=ri.degreeCentrality,ri.dcn=ri.degreeCentralityNormalised=ri.degreeCentralityNormalized;var ii=ln({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),ai={closenessCentralityNormalized:function(e){for(var t=ii(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,c=this.nodes(),l=this.floydWarshall({weight:r,directed:i}),u=0;u<c.length;u++){for(var d=0,f=c[u],p=0;p<c.length;p++)if(u!==p){var m=l.distance(f,c[p]);n?d+=1/m:d+=m}n||(d=1/d),s<d&&(s=d),o[f.id()]=d}return{closeness:function(e){return s==0?0:(e=V(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=ii(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,c=this.nodes(),l=0;l<c.length;l++){var u=c[l];if(!u.same(n)){var d=o.distanceTo(u);a?s+=1/d:s+=d}}return a?s:1/s}};ai.cc=ai.closenessCentrality,ai.ccn=ai.closenessCentralityNormalised=ai.closenessCentralityNormalized;var oi=ln({weight:null,directed:!1}),si={betweennessCentrality:function(e){for(var t=oi(e),n=t.directed,r=t.weight,i=r!=null,a=this.cy(),o=this.nodes(),s={},c={},l=0,u={set:function(e,t){c[e]=t,t>l&&(l=t)},get:function(e){return c[e]}},d=0;d<o.length;d++){var f=o[d],p=f.id();n?s[p]=f.outgoers().nodes():s[p]=f.openNeighborhood().nodes(),u.set(p,0)}for(var m=function(){for(var e=o[h].id(),t=[],n={},c={},l={},d=new An(function(e,t){return l[e]-l[t]}),f=0;f<o.length;f++){var p=o[f].id();n[p]=[],c[p]=0,l[p]=1/0}for(c[e]=1,l[e]=0,d.push(e);!d.empty();){var m=d.pop();if(t.push(m),i)for(var g=0;g<s[m].length;g++){var _=s[m][g],v=a.getElementById(m),y=void 0;y=v.edgesTo(_).length>0?v.edgesTo(_)[0]:_.edgesTo(v)[0];var b=r(y);_=_.id(),l[_]>l[m]+b&&(l[_]=l[m]+b,d.nodes.indexOf(_)<0?d.push(_):d.updateItem(_),c[_]=0,n[_]=[]),l[_]==l[m]+b&&(c[_]=c[_]+c[m],n[_].push(m))}else for(var x=0;x<s[m].length;x++){var S=s[m][x].id();l[S]==1/0&&(d.push(S),l[S]=l[m]+1),l[S]==l[m]+1&&(c[S]=c[S]+c[m],n[S].push(m))}}for(var C={},w=0;w<o.length;w++)C[o[w].id()]=0;for(;t.length>0;){for(var T=t.pop(),E=0;E<n[T].length;E++){var D=n[T][E];C[D]=C[D]+c[D]/c[T]*(1+C[T])}T!=o[h].id()&&u.set(T,u.get(T)+C[T])}},h=0;h<o.length;h++)m();var g={betweenness:function(e){var t=a.collection(e).id();return u.get(t)},betweennessNormalized:function(e){if(l==0)return 0;var t=a.collection(e).id();return u.get(t)/l}};return g.betweennessNormalised=g.betweennessNormalized,g}};si.bc=si.betweennessCentrality;var ci=ln({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),li=function(e){return ci(e)},ui=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},di=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},fi=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},pi=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},mi=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=pi(e,r,t);return e},hi=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=e[i]**+n;return fi(r,t),r},gi=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*10**r)/10**r!=Math.round(t[i]*10**r)/10**r)return!1;return!0},_i=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(e[a*t+s]*1e3)/1e3>0&&o.push(n[s]);o.length!==0&&i.push(r.collection(o))}return i},vi=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},yi=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&vi(e[t],e[n])&&e.splice(n,1);return e},bi=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=li(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s=t.length,c=s*s,l=Array(c),u,d=0;d<c;d++)l[d]=0;for(var f=0;f<n.length;f++){var p=n[f],m=a[p.source().id()],h=a[p.target().id()],g=ui(p,i.attributes);l[m*s+h]+=g,l[h*s+m]+=g}di(l,s,i.multFactor),fi(l,s);for(var _=!0,v=0;_&&v<i.maxIterations;)_=!1,u=mi(l,s,i.expandFactor),l=hi(u,s,i.inflateFactor),gi(l,u,c,4)||(_=!0),v++;var y=_i(l,s,t,r);return y=yi(y),y},xi={markovClustering:bi,mcl:bi},Si=function(e){return e},Ci=function(e,t){return Math.abs(t-e)},wi=function(e,t,n){return e+Ci(t,n)},Ti=function(e,t,n){return e+(n-t)**2},Ei=function(e){return Math.sqrt(e)},Di=function(e,t,n){return Math.max(e,Ci(t,n))},Oi=function(e,t,n,r,i){for(var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Si,o=r,s,c,l=0;l<e;l++)s=t(l),c=n(l),o=i(o,s,c);return a(o)},ki={euclidean:function(e,t,n){return e>=2?Oi(e,t,n,0,Ti,Ei):Oi(e,t,n,0,wi)},squaredEuclidean:function(e,t,n){return Oi(e,t,n,0,Ti)},manhattan:function(e,t,n){return Oi(e,t,n,0,wi)},max:function(e,t,n){return Oi(e,t,n,-1/0,Di)}};ki[`squared-euclidean`]=ki.squaredEuclidean,ki.squaredeuclidean=ki.squaredEuclidean;function Ai(e,t,n,r,i,a){var o=H(e)?e:ki[e]||ki.euclidean;return t===0&&H(e)?o(i,a):o(t,n,r,i,a)}var ji=ln({k:2,m:2,sensitivityThreshold:1e-4,distance:`euclidean`,maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Mi=function(e){return ji(e)},Ni=function(e,t,n,r,i){var a=i===`kMedoids`?function(e){return r[e](n)}:function(e){return n[e]},o=function(e){return r[e](t)},s=n,c=t;return Ai(e,r.length,a,o,s,c)},Pi=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,c=0;c<r;c++)i[c]=e.min(n[c]).value,a[c]=e.max(n[c]).value;for(var l=0;l<t;l++){s=[];for(var u=0;u<r;u++)s[u]=Math.random()*(a[u]-i[u])+i[u];o[l]=s}return o},Fi=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var c=Ni(n,e,t[s],r,i);c<a&&(a=c,o=s)}return o},Ii=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)i=t[a],n[i.id()]===e&&r.push(i);return r},Li=function(e,t,n){return Math.abs(t-e)<=n},Ri=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},zi=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},Bi=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];zi(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},Vi=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=Ni(`manhattan`,t[i],e,n,`kMedoids`);return r},Hi=function(e){var t=this.cy(),n=this.nodes(),r=null,i=Mi(e),a=Array(i.k),o={},s;i.testMode?typeof i.testCentroids==`number`?(i.testCentroids,s=Pi(n,i.k,i.attributes)):s=M(i.testCentroids)===`object`?i.testCentroids:Pi(n,i.k,i.attributes):s=Pi(n,i.k,i.attributes);for(var c=!0,l=0;c&&l<i.maxIterations;){for(var u=0;u<n.length;u++)r=n[u],o[r.id()]=Fi(r,s,i.distance,i.attributes,`kMeans`);c=!1;for(var d=0;d<i.k;d++){var f=Ii(d,n,o);if(f.length!==0){for(var p=i.attributes.length,m=s[d],h=Array(p),g=Array(p),_=0;_<p;_++){g[_]=0;for(var v=0;v<f.length;v++)r=f[v],g[_]+=i.attributes[_](r);h[_]=g[_]/f.length,Li(h[_],m[_],i.sensitivityThreshold)||(c=!0)}s[d]=h,a[d]=t.collection(f)}}l++}return a},Ui=function(e){var t=this.cy(),n=this.nodes(),r=null,i=Mi(e),a=Array(i.k),o,s={},c,l=Array(i.k);i.testMode?typeof i.testCentroids==`number`||(o=M(i.testCentroids)===`object`?i.testCentroids:Bi(n,i.k)):o=Bi(n,i.k);for(var u=!0,d=0;u&&d<i.maxIterations;){for(var f=0;f<n.length;f++)r=n[f],s[r.id()]=Fi(r,o,i.distance,i.attributes,`kMedoids`);u=!1;for(var p=0;p<o.length;p++){var m=Ii(p,n,s);if(m.length!==0){l[p]=Vi(o[p],m,i.attributes);for(var h=0;h<m.length;h++)c=Vi(m[h],m,i.attributes),c<l[p]&&(l[p]=c,o[p]=m[h],u=!0);a[p]=t.collection(m)}}d++}return a},Wi=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var c=0;c<e.length;c++)r[s][c]=n[s][c]**+i.m;for(var l=0;l<e.length;l++)for(var u=0;u<i.attributes.length;u++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][l]*i.attributes[u](t[d]),o+=r[d][l];e[l][u]=a/o}},Gi=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,c,l=2/(i.m-1),u=0;u<n.length;u++)for(var d=0;d<r.length;d++){o=0;for(var f=0;f<n.length;f++)s=Ni(i.distance,r[d],n[u],i.attributes,`cmeans`),c=Ni(i.distance,r[d],n[f],i.attributes,`cmeans`),o+=(s/c)**+l;e[d][u]=1/o}},Ki=function(e,t,n,r){for(var i=Array(n.k),a=0;a<i.length;a++)i[a]=[];for(var o,s,c=0;c<t.length;c++){o=-1/0,s=-1;for(var l=0;l<t[0].length;l++)t[c][l]>o&&(o=t[c][l],s=l);i[s].push(e[c])}for(var u=0;u<i.length;u++)i[u]=r.collection(i[u]);return i},qi=function(e){for(var t=this.cy(),n=this.nodes(),r=Mi(e),i,a,o,s=Array(n.length),c,l=0;l<n.length;l++)s[l]=Array(r.k);o=Array(n.length);for(var u=0;u<n.length;u++)o[u]=Array(r.k);for(var d=0;d<n.length;d++){for(var f=0,p=0;p<r.k;p++)o[d][p]=Math.random(),f+=o[d][p];for(var m=0;m<r.k;m++)o[d][m]=o[d][m]/f}a=Array(r.k);for(var h=0;h<r.k;h++)a[h]=Array(r.attributes.length);c=Array(n.length);for(var g=0;g<n.length;g++)c[g]=Array(r.k);for(var _=!0,v=0;_&&v<r.maxIterations;)_=!1,Wi(a,n,o,c,r),Gi(o,s,a,n,r),Ri(o,s,r.sensitivityThreshold)||(_=!0),v++;return i=Ki(n,o,r,t),{clusters:i,degreeOfMembership:o}},Ji={kMeans:Hi,kMedoids:Ui,fuzzyCMeans:qi,fcm:qi},Yi=ln({distance:`euclidean`,linkage:`min`,mode:`threshold`,threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Xi={single:`min`,complete:`max`},Zi=function(e){var t=Yi(e),n=Xi[t.linkage];return n!=null&&(t.linkage=n),t},Qi=function(e,t,n,r,i){for(var a=0,o=1/0,s,c=i.attributes,l=function(e,t){return Ai(i.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},u=0;u<e.length;u++){var d=e[u].key,f=n[d][r[d]];f<o&&(a=d,o=f)}if(i.mode===`threshold`&&o>=i.threshold||i.mode===`dendrogram`&&e.length===1)return!1;var p=t[a],m=t[r[a]],h=i.mode===`dendrogram`?{left:p,right:m,key:p.key}:{value:p.value.concat(m.value),key:p.key};e[p.index]=h,e.splice(m.index,1),t[p.key]=h;for(var g=0;g<e.length;g++){var _=e[g];p.key===_.key?s=1/0:i.linkage===`min`?(s=n[p.key][_.key],n[p.key][_.key]>n[m.key][_.key]&&(s=n[m.key][_.key])):i.linkage===`max`?(s=n[p.key][_.key],n[p.key][_.key]<n[m.key][_.key]&&(s=n[m.key][_.key])):s=i.linkage===`mean`?(n[p.key][_.key]*p.size+n[m.key][_.key]*m.size)/(p.size+m.size):i.mode===`dendrogram`?l(_.value,p.value):l(_.value[0],p.value[0]),n[p.key][_.key]=n[_.key][p.key]=s}for(var v=0;v<e.length;v++){var y=e[v].key;if(r[y]===p.key||r[y]===m.key){for(var b=y,x=0;x<e.length;x++){var S=e[x].key;n[y][S]<n[y][b]&&(b=S)}r[y]=b}e[v].index=v}return p.key=m.key=p.index=m.index=null,!0},$i=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&$i(e.left,t),e.right&&$i(e.right,t)))},ea=function(e,t){if(!e)return``;if(e.left&&e.right){var n=ea(e.left,t),r=ea(e.right,t),i=t.add({group:`nodes`,data:{id:n+`,`+r}});return t.add({group:`edges`,data:{source:n,target:i.id()}}),t.add({group:`edges`,data:{source:r,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},ta=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];return t===0?(e.left&&$i(e.left,r),e.right&&$i(e.right,i),a=r.concat(i),[n.collection(a)]):t===1?e.value?[n.collection(e.value)]:(e.left&&$i(e.left,r),e.right&&$i(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=ta(e.left,t-1,n)),e.right&&(i=ta(e.right,t-1,n)),r.concat(i))},na=function(e){for(var t=this.cy(),n=this.nodes(),r=Zi(e),i=r.attributes,a=function(e,t){return Ai(r.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},o=[],s=[],c=[],l=[],u=0;u<n.length;u++){var d={value:r.mode===`dendrogram`?n[u]:[n[u]],key:u,index:u};o[u]=d,l[u]=d,s[u]=[],c[u]=0}for(var f=0;f<o.length;f++)for(var p=0;p<=f;p++){var m=void 0;m=r.mode===`dendrogram`?f===p?1/0:a(o[f].value,o[p].value):f===p?1/0:a(o[f].value[0],o[p].value[0]),s[f][p]=m,s[p][f]=m,m<s[f][c[f]]&&(c[f]=p)}for(var h=Qi(o,l,s,c,r);h;)h=Qi(o,l,s,c,r);var g;return r.mode===`dendrogram`?(g=ta(o[0],r.dendrogramDepth,t),r.addDendrogram&&ea(o[0],t)):(g=Array(o.length),o.forEach(function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)})),g},ra={hierarchicalClustering:na,hca:na},ia=ln({distance:`euclidean`,preference:`median`,damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),aa=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||$t(`Damping must range on [0.5, 1). Got: ${t}`);var r=[`median`,`mean`,`min`,`max`];return r.some(function(e){return e===n})||K(n)||$t(`Preference must be one of [${r.map(function(e){return`'${e}'`}).join(`, `)}] or a number. Got: ${n}`),ia(e)},oa=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-Ai(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},sa=function(e,t){var n=null;return n=t===`median`?Zn(e):t===`mean`?Xn(e):t===`min`?Jn(e):t===`max`?Yn(e):t,n},ca=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},la=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var c=n[s];t[i*e+c]>o&&(a=c,o=t[i*e+c])}a>0&&r.push(a)}for(var l=0;l<n.length;l++)r[n[l]]=n[l];return r},ua=function(e,t,n){for(var r=la(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,c=-1/0,l=0;l<a.length;l++){for(var u=0,d=0;d<a.length;d++)u+=t[a[d]*e+a[l]];u>c&&(s=l,c=u)}n[i]=a[s]}return r=la(e,t,n),r},da=function(e){for(var t=this.cy(),n=this.nodes(),r=aa(e),i={},a=0;a<n.length;a++)i[n[a].id()]=a;for(var o=n.length,s=o*o,c=Array(s),l,u,d,f=0;f<s;f++)c[f]=-1/0;for(var p=0;p<o;p++)for(var m=0;m<o;m++)p!==m&&(c[p*o+m]=oa(r.distance,n[p],n[m],r.attributes));l=sa(c,r.preference);for(var h=0;h<o;h++)c[h*o+h]=l;u=Array(s);for(var g=0;g<s;g++)u[g]=0;d=Array(s);for(var _=0;_<s;_++)d[_]=0;for(var v=Array(o),y=Array(o),b=Array(o),x=0;x<o;x++)v[x]=0,y[x]=0,b[x]=0;for(var S=Array(o*r.minIterations),C=0;C<S.length;C++)S[C]=0;var w;for(w=0;w<r.maxIterations;w++){for(var T=0;T<o;T++){for(var E=-1/0,D=-1/0,O=-1,k=0,A=0;A<o;A++)v[A]=u[T*o+A],k=d[T*o+A]+c[T*o+A],k>=E?(D=E,E=k,O=A):k>D&&(D=k);for(var j=0;j<o;j++)u[T*o+j]=(1-r.damping)*(c[T*o+j]-E)+r.damping*v[j];u[T*o+O]=(1-r.damping)*(c[T*o+O]-D)+r.damping*v[O]}for(var M=0;M<o;M++){for(var N=0,P=0;P<o;P++)v[P]=d[P*o+M],y[P]=Math.max(0,u[P*o+M]),N+=y[P];N-=y[M],y[M]=u[M*o+M],N+=y[M];for(var F=0;F<o;F++)d[F*o+M]=(1-r.damping)*Math.min(0,N-y[F])+r.damping*v[F];d[M*o+M]=(1-r.damping)*(N-y[M])+r.damping*v[M]}for(var I=0,L=0;L<o;L++){var R=d[L*o+L]+u[L*o+L]>0?1:0;S[w%r.minIterations*o+L]=R,I+=R}if(I>0&&(w>=r.minIterations-1||w==r.maxIterations-1)){for(var z=0,B=0;B<o;B++){b[B]=0;for(var V=0;V<r.minIterations;V++)b[B]+=S[V*o+B];(b[B]===0||b[B]===r.minIterations)&&z++}if(z===o)break}}for(var H=ca(o,u,d),U=ua(o,c,H),W={},G=0;G<H.length;G++)W[H[G]]=[];for(var K=0;K<n.length;K++){var q=U[i[n[K].id()]];q!=null&&W[q].push(n[K])}for(var J=Array(H.length),Y=0;Y<H.length;Y++)J[Y]=t.collection(W[H[Y]]);return J},fa={affinityPropagation:da,ap:da},pa=ln({root:void 0,directed:!1}),ma={hierholzer:function(e){if(!W(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=pa(e),r=n.root,i=n.directed,a=this,o=!1,s,c,l;r&&(l=V(r)?this.filter(r)[0].id():r[0].id());var u={},d={};i?a.forEach(function(e){var t=e.id();if(e.isNode()){var n=e.indegree(!0),r=e.outdegree(!0),i=n-r,a=r-n;i==1?s?o=!0:s=t:a==1?c?o=!0:c=t:(a>1||i>1)&&(o=!0),u[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):a.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(s?c?o=!0:c=t:s=t),u[t]=[],e.connectedEdges().forEach(function(e){return u[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var f={found:!1,trail:void 0};if(o)return f;if(c&&s)if(i){if(l&&c!=l)return f;l=c}else if(l&&c!=l&&s!=l)return f;else l||=c;else l||=a[0].id();var p=function(e){for(var t=e,n=[e],r,a,o;u[t].length;)r=u[t].shift(),a=d[r][0],o=d[r][1],t==o?!i&&t!=a&&(u[a]=u[a].filter(function(e){return e!=r}),t=a):(u[o]=u[o].filter(function(e){return e!=r}),t=o),n.unshift(r),n.unshift(t);return n},m=[],h=[];for(h=p(l);h.length!=1;)u[h[0]].length==0?(m.unshift(a.getElementById(h.shift())),m.unshift(a.getElementById(h.shift()))):h=p(h.shift()).concat(h);for(var g in m.unshift(a.getElementById(h.shift())),u)if(u[g].length)return f;return f.found=!0,f.trail=this.spawn(m,!0),f}},ha=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],c=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);c.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);c.merge(n),t[r].cutVertex?c.merge(i.filter(function(e){return e.isLoop()})):c.merge(i)})}),i.push(c)},c=function(l,u,d){l===d&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.size()===0)i.push(e.spawn(e.getElementById(u)));else{var p,m,h,g;f.forEach(function(e){p=e.source().id(),m=e.target().id(),h=p===u?m:p,h!==d&&(g=e.id(),o[g]||(o[g]=!0,a.push({x:u,y:h,edge:e})),h in t?t[u].low=Math.min(t[u].low,t[h].id):(c(l,h,u),t[u].low=Math.min(t[u].low,t[h].low),t[u].id<=t[h].low&&(t[u].cutVertex=!0,s(u,h))))})}};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,c(n,n),t[n].cutVertex=r>1)}});var l=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(l),components:i}},ga={hopcroftTarjanBiconnected:ha,htbc:ha,htb:ha,hopcroftTarjanBiconnectedComponents:ha},_a=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var c=e.spawn();;){var l=i.pop();if(c.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var u=c.edgesWith(c),d=c.merge(u);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},va={tarjanStronglyConnected:_a,tsc:_a,tscc:_a,tarjanStronglyConnectedComponents:_a},ya={};[Sn,Mn,Nn,Fn,Ln,zn,Un,ti,ri,ai,si,xi,Ji,ra,fa,ma,ga,va].forEach(function(e){X(ya,e)});var ba=0,xa=1,Sa=2,Ca=function(e){if(!(this instanceof Ca))return new Ca(e);this.id=`Thenable/1.0.7`,this.state=ba,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))};Ca.prototype={fulfill:function(e){return wa(this,xa,`fulfillValue`,e)},reject:function(e){return wa(this,Sa,`rejectReason`,e)},then:function(e,t){var n=this,r=new Ca;return n.onFulfilled.push(Da(e,r,`fulfill`)),n.onRejected.push(Da(t,r,`reject`)),Ta(n),r.proxy}};var wa=function(e,t,n,r){return e.state===ba&&(e.state=t,e[n]=r,Ta(e)),e},Ta=function(e){e.state===xa?Ea(e,`onFulfilled`,e.fulfillValue):e.state===Sa&&Ea(e,`onRejected`,e.rejectReason)},Ea=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};typeof setImmediate==`function`?setImmediate(i):setTimeout(i,0)}},Da=function(e,t,n){return function(r){if(typeof e!=`function`)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}Oa(t,i)}}},Oa=function(e,t){if(e===t||e.proxy===t){e.reject(TypeError(`cannot resolve promise with itself`));return}var n;if(M(t)===`object`&&t!==null||typeof t==`function`)try{n=t.then}catch(t){e.reject(t);return}if(typeof n==`function`){var r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError(`circular thenable chain`)):Oa(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};Ca.all=function(e){return new Ca(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,i++,i===e.length&&t(r)},o=0;o<e.length;o++)(function(t){var r=e[t];r!=null&&r.then!=null?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)})(o)})},Ca.resolve=function(e){return new Ca(function(t,n){t(e)})},Ca.reject=function(e){return new Ca(function(t,n){n(e)})};var ka=typeof Promise<`u`?Promise:Ca,Aa=function(e,t,n){var r=ne(e),i=!r,a=this._private=X({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&H(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},ja=Aa.prototype;X(ja,{instanceString:function(){return`animation`},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;t=e.queue?n.queue:n.current,t.push(this),Y(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 t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];r!=null&&(e[t]=e[n],e[n]=r)};if(n(`zoom`,`startZoom`),n(`pan`,`startPan`),n(`position`,`startPosition`),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case`frame`:n=t.frames;break;default:case`complete`:case`completed`:n=t.completes}return new ka(function(e,t){n.push(function(){e()})})}}),ja.complete=ja.completed,ja.run=ja.play,ja.running=ja.playing;var Ma={animated:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];if(n)return n._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++){var r=t[n];r._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var c=a.style();if(e=X({},e,t),Object.keys(e).length===0)return new Aa(i[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case`slow`:e.duration=600;break;case`fast`:e.duration=200;break}if(s&&(e.style=c.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var l=e.renderedPosition,u=a.pan(),d=a.zoom();e.position=Kn(l,d,u)}if(o&&e.panBy!=null){var f=e.panBy,p=a.pan();e.pan={x:p.x+f.x,y:p.y+f.y}}var m=e.center||e.centre;if(o&&m!=null){var h=a.getCenterPan(m.eles,e.zoom);h!=null&&(e.pan=h)}if(o&&e.fit!=null){var g=e.fit,_=a.getFitViewport(g.eles||g.boundingBox,g.padding);_!=null&&(e.pan=_.pan,e.zoom=_.zoom)}if(o&&W(e.zoom)){var v=a.getZoomedViewport(e.zoom);v==null?e.zoom=null:(v.zoomed&&(e.zoom=v.zoom),v.panned&&(e.pan=v.pan))}return new Aa(i[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n;if(!(this._private.cy||this).styleEnabled())return this;t&&(e=X({},e,t));for(var i=0;i<r.length;i++){var a=r[i],o=a.animated()&&(e.queue===void 0||e.queue);a.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n,i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var o=r[a]._private,s=o.animation.current,c=0;c<s.length;c++){var l=s[c]._private;t&&(l.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return i.notify(`draw`),this}}},Na,Pa;function Fa(){return Pa?Na:(Pa=1,Na=Array.isArray,Na)}var Ia,La;function Ra(){if(La)return Ia;La=1;var e=Fa(),t=gt(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,a){if(e(i))return!1;var o=typeof i;return o==`number`||o==`symbol`||o==`boolean`||i==null||t(i)?!0:r.test(i)||!n.test(i)||a!=null&&i in Object(a)}return Ia=i,Ia}var za,Ba;function Va(){if(Ba)return za;Ba=1;var e=ut(),t=Le(),n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Proxy]`;function o(o){if(!t(o))return!1;var s=e(o);return s==r||s==i||s==n||s==a}return za=o,za}var Ha,Ua;function Wa(){return Ua?Ha:(Ua=1,Ha=Ue()[`__core-js_shared__`],Ha)}var Ga,Ka;function qa(){if(Ka)return Ga;Ka=1;var e=Wa(),t=function(){var t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||``);return t?`Symbol(src)_1.`+t:``}();function n(e){return!!t&&t in e}return Ga=n,Ga}var Ja,Ya;function Xa(){if(Ya)return Ja;Ya=1;var e=Function.prototype.toString;function t(t){if(t!=null){try{return e.call(t)}catch{}try{return t+``}catch{}}return``}return Ja=t,Ja}var Za,Qa;function $a(){if(Qa)return Za;Qa=1;var e=Va(),t=qa(),n=Le(),r=Xa(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=RegExp(`^`+c.call(l).replace(i,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function d(i){return!n(i)||t(i)?!1:(e(i)?u:a).test(r(i))}return Za=d,Za}var eo,to;function no(){if(to)return eo;to=1;function e(e,t){return e?.[t]}return eo=e,eo}var ro,io;function ao(){if(io)return ro;io=1;var e=$a(),t=no();function n(n,r){var i=t(n,r);return e(i)?i:void 0}return ro=n,ro}var oo,so;function co(){return so?oo:(so=1,oo=ao()(Object,`create`),oo)}var lo,uo;function fo(){if(uo)return lo;uo=1;var e=co();function t(){this.__data__=e?e(null):{},this.size=0}return lo=t,lo}var po,mo;function ho(){if(mo)return po;mo=1;function e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return po=e,po}var go,_o;function vo(){if(_o)return go;_o=1;var e=co(),t=`__lodash_hash_undefined__`,n=Object.prototype.hasOwnProperty;function r(r){var i=this.__data__;if(e){var a=i[r];return a===t?void 0:a}return n.call(i,r)?i[r]:void 0}return go=r,go}var yo,bo;function xo(){if(bo)return yo;bo=1;var e=co(),t=Object.prototype.hasOwnProperty;function n(n){var r=this.__data__;return e?r[n]!==void 0:t.call(r,n)}return yo=n,yo}var So,Co;function wo(){if(Co)return So;Co=1;var e=co(),t=`__lodash_hash_undefined__`;function n(n,r){var i=this.__data__;return this.size+=this.has(n)?0:1,i[n]=e&&r===void 0?t:r,this}return So=n,So}var To,Eo;function Do(){if(Eo)return To;Eo=1;var e=fo(),t=ho(),n=vo(),r=xo(),i=wo();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,To=a,To}var Oo,ko;function Ao(){if(ko)return Oo;ko=1;function e(){this.__data__=[],this.size=0}return Oo=e,Oo}var jo,Mo;function No(){if(Mo)return jo;Mo=1;function e(e,t){return e===t||e!==e&&t!==t}return jo=e,jo}var Po,Fo;function Io(){if(Fo)return Po;Fo=1;var e=No();function t(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}return Po=t,Po}var Lo,Ro;function zo(){if(Ro)return Lo;Ro=1;var e=Io(),t=Array.prototype.splice;function n(n){var r=this.__data__,i=e(r,n);return i<0?!1:(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}return Lo=n,Lo}var Bo,Vo;function Ho(){if(Vo)return Bo;Vo=1;var e=Io();function t(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}return Bo=t,Bo}var Uo,Wo;function Go(){if(Wo)return Uo;Wo=1;var e=Io();function t(t){return e(this.__data__,t)>-1}return Uo=t,Uo}var Ko,qo;function Jo(){if(qo)return Ko;qo=1;var e=Io();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return Ko=t,Ko}var Yo,Xo;function Zo(){if(Xo)return Yo;Xo=1;var e=Ao(),t=zo(),n=Ho(),r=Go(),i=Jo();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Yo=a,Yo}var Qo,$o;function es(){return $o?Qo:($o=1,Qo=ao()(Ue(),`Map`),Qo)}var ts,ns;function rs(){if(ns)return ts;ns=1;var e=Do(),t=Zo(),n=es();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return ts=r,ts}var is,as;function os(){if(as)return is;as=1;function e(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}return is=e,is}var ss,cs;function ls(){if(cs)return ss;cs=1;var e=os();function t(t,n){var r=t.__data__;return e(n)?r[typeof n==`string`?`string`:`hash`]:r.map}return ss=t,ss}var us,ds;function fs(){if(ds)return us;ds=1;var e=ls();function t(t){var n=e(this,t).delete(t);return this.size-=n?1:0,n}return us=t,us}var ps,ms;function hs(){if(ms)return ps;ms=1;var e=ls();function t(t){return e(this,t).get(t)}return ps=t,ps}var gs,_s;function vs(){if(_s)return gs;_s=1;var e=ls();function t(t){return e(this,t).has(t)}return gs=t,gs}var ys,bs;function xs(){if(bs)return ys;bs=1;var e=ls();function t(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}return ys=t,ys}var Ss,Cs;function ws(){if(Cs)return Ss;Cs=1;var e=rs(),t=fs(),n=hs(),r=vs(),i=xs();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ss=a,Ss}var Ts,Es;function Ds(){if(Es)return Ts;Es=1;var e=ws(),t=`Expected a function`;function n(r,i){if(typeof r!=`function`||i!=null&&typeof i!=`function`)throw TypeError(t);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;if(n.has(t))return n.get(t);var o=r.apply(this,e);return a.cache=n.set(t,o)||n,o};return a.cache=new(n.Cache||e),a}return n.Cache=e,Ts=n,Ts}var Os,ks;function As(){if(ks)return Os;ks=1;var e=Ds(),t=500;function n(n){var r=e(n,function(e){return i.size===t&&i.clear(),e}),i=r.cache;return r}return Os=n,Os}var js,Ms;function Ns(){if(Ms)return js;Ms=1;var e=As(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return js=e(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(``),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,`$1`):t||e)}),r}),js}var Ps,Fs;function Is(){if(Fs)return Ps;Fs=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}return Ps=e,Ps}var Ls,Rs;function zs(){if(Rs)return Ls;Rs=1;var e=tt(),t=Is(),n=Fa(),r=gt(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(e){if(typeof e==`string`)return e;if(n(e))return t(e,o)+``;if(r(e))return a?a.call(e):``;var i=e+``;return i==`0`&&1/e==-1/0?`-0`:i}return Ls=o,Ls}var Bs,Vs;function Hs(){if(Vs)return Bs;Vs=1;var e=zs();function t(t){return t==null?``:e(t)}return Bs=t,Bs}var Us,Ws;function Gs(){if(Ws)return Us;Ws=1;var e=Fa(),t=Ra(),n=Ns(),r=Hs();function i(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}return Us=i,Us}var Ks,qs;function Js(){if(qs)return Ks;qs=1;var e=gt();function t(t){if(typeof t==`string`||e(t))return t;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n}return Ks=t,Ks}var Ys,Xs;function Zs(){if(Xs)return Ys;Xs=1;var e=Gs(),t=Js();function n(n,r){r=e(r,n);for(var i=0,a=r.length;n!=null&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}return Ys=n,Ys}var Qs,$s;function ec(){if($s)return Qs;$s=1;var e=Zs();function t(t,n,r){var i=t==null?void 0:e(t,n);return i===void 0?r:i}return Qs=t,Qs}var tc=Pe(ec()),nc,rc;function ic(){if(rc)return nc;rc=1;var e=ao();return nc=function(){try{var t=e(Object,`defineProperty`);return t({},``,{}),t}catch{}}(),nc}var ac,oc;function sc(){if(oc)return ac;oc=1;var e=ic();function t(t,n,r){n==`__proto__`&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}return ac=t,ac}var cc,lc;function uc(){if(lc)return cc;lc=1;var e=sc(),t=No(),n=Object.prototype.hasOwnProperty;function r(r,i,a){var o=r[i];(!(n.call(r,i)&&t(o,a))||a===void 0&&!(i in r))&&e(r,i,a)}return cc=r,cc}var dc,fc;function pc(){if(fc)return dc;fc=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(n,r){var i=typeof n;return r??=e,!!r&&(i==`number`||i!=`symbol`&&t.test(n))&&n>-1&&n%1==0&&n<r}return dc=n,dc}var mc,hc;function gc(){if(hc)return mc;hc=1;var e=uc(),t=Gs(),n=pc(),r=Le(),i=Js();function a(a,o,s,c){if(!r(a))return a;o=t(o,a);for(var l=-1,u=o.length,d=u-1,f=a;f!=null&&++l<u;){var p=i(o[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return a;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=r(h)?h:n(o[l+1])?[]:{})}e(f,p,m),f=f[p]}return a}return mc=a,mc}var _c,vc;function yc(){if(vc)return _c;vc=1;var e=gc();function t(t,n,r){return t==null?t:e(t,n,r)}return _c=t,_c}var bc=Pe(yc()),xc,Sc;function Cc(){if(Sc)return xc;Sc=1;function e(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}return xc=e,xc}var wc,Tc;function Ec(){if(Tc)return wc;Tc=1;var e=Is(),t=Cc(),n=Fa(),r=gt(),i=Ns(),a=Js(),o=Hs();function s(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}return wc=s,wc}var Dc=Pe(Ec()),Oc={data:function(e){return e=X({},{field:`data`,bindingEvent:`data`,allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:`data`,settingTriggersEvent:!1,triggerFnName:`trigger`,immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=this,a=i.length!==void 0,o=a?i:[i],s=a?i[0]:i;if(V(t)){var c=t.indexOf(`.`)!==-1&&Dc(t);if(r.allowGetting&&n===void 0){var l;return s&&(r.beforeGet(s),l=c&&s._private[r.field][t]===void 0?tc(s._private[r.field],c):s._private[r.field][t]),l}else if(r.allowSetting&&n!==void 0&&!r.immutableKeys[t]){var u=C({},t,n);r.beforeSet(i,u);for(var d=0,f=o.length;d<f;d++){var p=o[d];r.canSet(p)&&(c&&s._private[r.field][t]===void 0?bc(p._private[r.field],c,n):p._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&W(t)){var m=t,h,g,_=Object.keys(m);r.beforeSet(i,m);for(var v=0;v<_.length;v++)if(h=_[v],g=m[h],!r.immutableKeys[h])for(var y=0;y<o.length;y++){var b=o[y];r.canSet(b)&&(b._private[r.field][h]=g)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&H(t)){var x=t;i.on(r.bindingEvent,x)}else if(r.allowGetting&&t===void 0){var S;return s&&(r.beforeGet(s),S=s._private[r.field]),S}return i}},removeData:function(e){return e=X({},{field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=r.length===void 0?[r]:r;if(V(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var c=a[s];if(!ae(c)&&!n.immutableKeys[c])for(var l=0,u=i.length;l<u;l++)i[l]._private[n.field][c]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(t===void 0){for(var d=0,f=i.length;d<f;d++)for(var p=i[d]._private[n.field],m=Object.keys(p),h=0;h<m.length;h++){var g=m[h];n.immutableKeys[g]||(p[g]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},kc={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new ka(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}},Ac={};[Ma,Oc,kc].forEach(function(e){X(Ac,e)});var jc={animate:Ac.animate(),animation:Ac.animation(),animated:Ac.animated(),clearQueue:Ac.clearQueue(),delay:Ac.delay(),delayAnimation:Ac.delayAnimation(),stop:Ac.stop()},Mc={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(e){return n.push(e)}),n}else U(e)||(e=(e||``).match(/\S+/g)||[]);for(var r=[],i=new yn(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,c=s.classes,l=!1,u=0;u<e.length;u++){var d=e[u];if(!c.has(d)){l=!0;break}}l||=c.size!==e.length,l&&(s.classes=i,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit(`class`),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){U(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],c=s._private.classes,l=!1,u=0;u<e.length;u++){var d=e[u],f=c.has(d),p=!1;t||r&&!f?(c.add(d),p=!0):(!t||r&&f)&&(c.delete(d),p=!0),!l&&p&&(i.push(s),l=!0)}return i.length>0&&this.spawn(i).updateStyle().emit(`class`),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Mc.className=Mc.classNames=Mc.classes;var Z={metaChar:`[\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\\`\\{\\|\\}\\~]`,comparatorOp:`=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=`,boolOp:`\\?|\\!|\\^`,string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:ge,meta:`degree|indegree|outdegree`,separator:`\\s*,\\s*`,descendant:`\\s+`,child:`\\s+>\\s+`,subject:`\\$`,group:`node|edge|\\*`,directedEdge:`\\s+->\\s+`,undirectedEdge:`\\s+<->\\s+`};Z.variable=`(?:[\\w-.]|(?:\\\\`+Z.metaChar+`))+`,Z.className=`(?:[\\w-]|(?:\\\\`+Z.metaChar+`))+`,Z.value=Z.string+`|`+Z.number,Z.id=Z.variable,(function(){var e=Z.comparatorOp.split(`|`),t,n;for(n=0;n<e.length;n++)t=e[n],Z.comparatorOp+=`|@`+t;for(e=Z.comparatorOp.split(`|`),n=0;n<e.length;n++)t=e[n],!(t.indexOf(`!`)>=0)&&t!==`=`&&(Z.comparatorOp+=`|\\!`+t)})();var Nc=function(){return{checks:[]}},Q={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},Pc=[{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(e,t){return we(e.selector,t.selector)}),Fc=function(){for(var e={},t,n=0;n<Pc.length;n++)t=Pc[n],e[t.selector]=t.matches;return e}(),Ic=function(e,t){return Fc[e](t)},Lc=`(`+Pc.map(function(e){return e.selector}).join(`|`)+`)`,Rc=function(e){return e.replace(RegExp(`\\\\(`+Z.metaChar+`)`,`g`),function(e,t){return t})},zc=function(e,t,n){e[e.length-1]=n},Bc=[{name:`group`,query:!0,regex:`(`+Z.group+`)`,populate:function(e,t,n){var r=O(n,1)[0];t.checks.push({type:Q.GROUP,value:r===`*`?r:r+`s`})}},{name:`state`,query:!0,regex:Lc,populate:function(e,t,n){var r=O(n,1)[0];t.checks.push({type:Q.STATE,value:r})}},{name:`id`,query:!0,regex:`\\#(`+Z.id+`)`,populate:function(e,t,n){var r=O(n,1)[0];t.checks.push({type:Q.ID,value:Rc(r)})}},{name:`className`,query:!0,regex:`\\.(`+Z.className+`)`,populate:function(e,t,n){var r=O(n,1)[0];t.checks.push({type:Q.CLASS,value:Rc(r)})}},{name:`dataExists`,query:!0,regex:`\\[\\s*(`+Z.variable+`)\\s*\\]`,populate:function(e,t,n){var r=O(n,1)[0];t.checks.push({type:Q.DATA_EXIST,field:Rc(r)})}},{name:`dataCompare`,query:!0,regex:`\\[\\s*(`+Z.variable+`)\\s*(`+Z.comparatorOp+`)\\s*(`+Z.value+`)\\s*\\]`,populate:function(e,t,n){var r=O(n,3),i=r[0],a=r[1],o=r[2];o=RegExp(`^`+Z.string+`$`).exec(o)==null?parseFloat(o):o.substring(1,o.length-1),t.checks.push({type:Q.DATA_COMPARE,field:Rc(i),operator:a,value:o})}},{name:`dataBool`,query:!0,regex:`\\[\\s*(`+Z.boolOp+`)\\s*(`+Z.variable+`)\\s*\\]`,populate:function(e,t,n){var r=O(n,2),i=r[0],a=r[1];t.checks.push({type:Q.DATA_BOOL,field:Rc(a),operator:i})}},{name:`metaCompare`,query:!0,regex:`\\[\\[\\s*(`+Z.meta+`)\\s*(`+Z.comparatorOp+`)\\s*(`+Z.number+`)\\s*\\]\\]`,populate:function(e,t,n){var r=O(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:Q.META_COMPARE,field:Rc(i),operator:a,value:parseFloat(o)})}},{name:`nextQuery`,separator:!0,regex:Z.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return n!=null&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=Nc()}},{name:`directedEdge`,separator:!0,regex:Z.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Nc(),r=t,i=Nc();return n.checks.push({type:Q.DIRECTED_EDGE,source:r,target:i}),zc(e,t,n),e.edgeCount++,i}else{var a=Nc(),o=t,s=Nc();return a.checks.push({type:Q.NODE_SOURCE,source:o,target:s}),zc(e,t,a),e.edgeCount++,s}}},{name:`undirectedEdge`,separator:!0,regex:Z.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Nc(),r=t,i=Nc();return n.checks.push({type:Q.UNDIRECTED_EDGE,nodes:[r,i]}),zc(e,t,n),e.edgeCount++,i}else{var a=Nc(),o=t,s=Nc();return a.checks.push({type:Q.NODE_NEIGHBOR,node:o,neighbor:s}),zc(e,t,a),s}}},{name:`child`,separator:!0,regex:Z.child,populate:function(e,t){if(e.currentSubject==null){var n=Nc(),r=Nc(),i=e[e.length-1];return n.checks.push({type:Q.CHILD,parent:i,child:r}),zc(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=Nc(),o=e[e.length-1],s=Nc(),c=Nc(),l=Nc(),u=Nc();return a.checks.push({type:Q.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:Q.TRUE}],u.checks.push({type:Q.TRUE}),s.checks.push({type:Q.PARENT,parent:u,child:l}),zc(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=Nc(),f=Nc(),p=[{type:Q.PARENT,parent:d,child:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`descendant`,separator:!0,regex:Z.descendant,populate:function(e,t){if(e.currentSubject==null){var n=Nc(),r=Nc(),i=e[e.length-1];return n.checks.push({type:Q.DESCENDANT,ancestor:i,descendant:r}),zc(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=Nc(),o=e[e.length-1],s=Nc(),c=Nc(),l=Nc(),u=Nc();return a.checks.push({type:Q.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:Q.TRUE}],u.checks.push({type:Q.TRUE}),s.checks.push({type:Q.ANCESTOR,ancestor:u,descendant:l}),zc(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=Nc(),f=Nc(),p=[{type:Q.ANCESTOR,ancestor:d,descendant:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`subject`,modifier:!0,regex:Z.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return tn("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=n==null?null:n.type;r===Q.DIRECTED_EDGE?n.type=Q.NODE_TARGET:r===Q.UNDIRECTED_EDGE&&(n.type=Q.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Bc.forEach(function(e){return e.regexObj=RegExp(`^`+e.regex)});var Vc=function(e){for(var t,n,r,i=0;i<Bc.length;i++){var a=Bc[i],o=a.name,s=e.match(a.regexObj);if(s!=null){n=s,t=a,r=o;var c=s[0];e=e.substring(c.length);break}}return{expr:t,match:n,name:r,remaining:e}},Hc=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Uc={parse:function(e){var t=this,n=t.inputText=e,r=t[0]=Nc();for(t.length=1,n=Hc(n);;){var i=Vc(n);if(i.expr==null)return tn("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(o===!1)return!1;if(o!=null&&(r=o),n=i.remaining,n.match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var c=0;c<t.length;c++){var l=t[c];if(l.compoundCount>0&&l.edgeCount>0)return tn("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return tn("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;l.edgeCount===1&&tn("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},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(e){return e??``},t=function(t){return V(t)?`"`+t+`"`:e(t)},n=function(e){return` `+e+` `},r=function(r,a){var o=r.type,s=r.value;switch(o){case Q.GROUP:var c=e(s);return c.substring(0,c.length-1);case Q.DATA_COMPARE:var l=r.field,u=r.operator;return`[`+l+n(e(u))+t(s)+`]`;case Q.DATA_BOOL:var d=r.operator,f=r.field;return`[`+e(d)+f+`]`;case Q.DATA_EXIST:return`[`+r.field+`]`;case Q.META_COMPARE:var p=r.operator;return`[[`+r.field+n(e(p))+t(s)+`]]`;case Q.STATE:return s;case Q.ID:return`#`+s;case Q.CLASS:return`.`+s;case Q.PARENT:case Q.CHILD:return i(r.parent,a)+n(`>`)+i(r.child,a);case Q.ANCESTOR:case Q.DESCENDANT:return i(r.ancestor,a)+` `+i(r.descendant,a);case Q.COMPOUND_SPLIT:var m=i(r.left,a),h=i(r.subject,a),g=i(r.right,a);return m+(m.length>0?` `:``)+h+g;case Q.TRUE:return``}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&a===0?`$`:``)+r(i,t)},``)},a=``,o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=`, `)}return this.toStringCache=a,a}},Wc=function(e,t,n){var r,i=V(e),a=K(e),o=V(n),s,c,l=!1,u=!1,d=!1;switch(t.indexOf(`!`)>=0&&(t=t.replace(`!`,``),u=!0),t.indexOf(`@`)>=0&&(t=t.replace(`@`,``),l=!0),(i||o||l)&&(s=!i&&!a?``:``+e,c=``+n),l&&(e=s=s.toLowerCase(),n=c=c.toLowerCase()),t){case`*=`:r=s.indexOf(c)>=0;break;case`$=`:r=s.indexOf(c,s.length-c.length)>=0;break;case`^=`:r=s.indexOf(c)===0;break;case`=`:r=e===n;break;case`>`:d=!0,r=e>n;break;case`>=`:d=!0,r=e>=n;break;case`<`:d=!0,r=e<n;break;case`<=`:d=!0,r=e<=n;break;default:r=!1;break}return u&&(e!=null||!d)&&(r=!r),r},Gc=function(e,t){switch(t){case`?`:return!!e;case`!`:return!e;case`^`:return e===void 0}},Kc=function(e){return e!==void 0},qc=function(e,t){return e.data(t)},Jc=function(e,t){return e[t]()},Yc=[],Xc=function(e,t){return e.checks.every(function(e){return Yc[e.type](e,t)})};Yc[Q.GROUP]=function(e,t){var n=e.value;return n===`*`||n===t.group()},Yc[Q.STATE]=function(e,t){var n=e.value;return Ic(n,t)},Yc[Q.ID]=function(e,t){var n=e.value;return t.id()===n},Yc[Q.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},Yc[Q.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Wc(Jc(t,n),r,i)},Yc[Q.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Wc(qc(t,n),r,i)},Yc[Q.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return Gc(qc(t,n),r)},Yc[Q.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,Kc(qc(t,n))},Yc[Q.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return Xc(n,i)&&Xc(r,a)||Xc(r,i)&&Xc(n,a)},Yc[Q.NODE_NEIGHBOR]=function(e,t){return Xc(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&Xc(e.neighbor,t)})},Yc[Q.DIRECTED_EDGE]=function(e,t){return Xc(e.source,t.source())&&Xc(e.target,t.target())},Yc[Q.NODE_SOURCE]=function(e,t){return Xc(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&Xc(e.target,t)})},Yc[Q.NODE_TARGET]=function(e,t){return Xc(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&Xc(e.source,t)})},Yc[Q.CHILD]=function(e,t){return Xc(e.child,t)&&Xc(e.parent,t.parent())},Yc[Q.PARENT]=function(e,t){return Xc(e.parent,t)&&t.children().some(function(t){return Xc(e.child,t)})},Yc[Q.DESCENDANT]=function(e,t){return Xc(e.descendant,t)&&t.ancestors().some(function(t){return Xc(e.ancestor,t)})},Yc[Q.ANCESTOR]=function(e,t){return Xc(e.ancestor,t)&&t.descendants().some(function(t){return Xc(e.descendant,t)})},Yc[Q.COMPOUND_SPLIT]=function(e,t){return Xc(e.subject,t)&&Xc(e.left,t)&&Xc(e.right,t)},Yc[Q.TRUE]=function(){return!0},Yc[Q.COLLECTION]=function(e,t){return e.value.has(t)},Yc[Q.FILTER]=function(e,t){var n=e.value;return n(t)};var Zc={matches:function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(Xc(r,e))return!0}return!1},filter:function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===Q.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(Xc(r,e))return!0}return!1};return t.text()??(n=function(){return!0}),e.filter(n)}},Qc=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||V(e)&&e.match(/^\s*$/)||(Y(e)?this.addQuery({checks:[{type:Q.COLLECTION,value:e.collection()}]}):H(e)?this.addQuery({checks:[{type:Q.FILTER,value:e}]}):V(e)?this.parse(e)||(this.invalid=!0):$t(`A selector must be created from a string; found `))},$c=Qc.prototype;[Uc,Zc].forEach(function(e){return X($c,e)}),$c.text=function(){return this.inputText},$c.size=function(){return this.length},$c.eq=function(e){return this[e]},$c.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},$c.addQuery=function(e){this[this.length++]=e},$c.selector=$c.toString;var el={allAre:function(e){var t=new Qc(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new Qc(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length?t===1?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}):!1},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};el.allAreNeighbours=el.allAreNeighbors,el.has=el.contains,el.equal=el.equals=el.same;var tl=function(e,t){return function(n,r,i,a){var o=n,s=this,c;if(o==null?c=``:Y(o)&&o.length===1&&(c=o.id()),s.length===1&&c){var l=s[0]._private,u=l.traversalCache=l.traversalCache||{},d=u[t]=u[t]||[],f=zt(c);return d[f]||(d[f]=e.call(s,n,r,i,a))}else return e.call(s,n,r,i,a)}},nl={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t||=r,t=t.intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:tl(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},`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 t=[];function n(e){for(var r=0;r<e.length;r++){var i=e[r];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function rl(e,t,n,r){for(var i=[],a=new yn,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var c=e[s];n?i.push(c):o&&r(i,a,c)}for(;i.length>0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function il(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}nl.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return rl(this,e,t,il)};function al(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}nl.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return rl(this,e,t,al)};function ol(e,t,n){al(e,t,n),il(e,t,n)}nl.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return rl(this,e,t,ol)},nl.ancestors=nl.parents;var sl=cl={data:Ac.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:Ac.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ac.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:Ac.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),rscratch:Ac.data({field:`rscratch`,allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ac.removeData({field:`rscratch`,triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},cl;sl.attr=sl.data,sl.removeAttr=sl.removeData;var ll=cl,ul={};function dl(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}else return}}X(ul,{degree:dl(function(e,t){return t.source().same(t.target())?2:1}),indegree:dl(function(e,t){return t.target().same(e)?1:0}),outdegree:dl(function(e,t){return t.source().same(e)?1:0})});function fl(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}X(ul,{minDegree:fl(`degree`,function(e,t){return e<t}),maxDegree:fl(`degree`,function(e,t){return e>t}),minIndegree:fl(`indegree`,function(e,t){return e<t}),maxIndegree:fl(`indegree`,function(e,t){return e>t}),minOutdegree:fl(`outdegree`,function(e,t){return e<t}),maxOutdegree:fl(`outdegree`,function(e,t){return e>t})}),X(ul,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var pl,ml,hl=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:t.x==null?0:t.x-a.x,y:t.y==null?0:t.y-a.y};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},gl={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,t){hl(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};pl=ml={position:Ac.data(gl),silentPosition:Ac.data(X({},gl,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){hl(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(W(e))t?this.silentPosition(e):this.position(e);else if(H(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=n(a,i))&&(t?a.silentPosition(o):a.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(W(e)?(r={x:K(e.x)?e.x:0,y:K(e.y)?e.y:0},n=t):V(e)&&K(t)&&(r={x:0,y:0},r[e]=t),r!=null){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),c={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(c):o.position(c)}}i.endBatch()}return this},silentShift:function(e,t){return W(e)?this.shift(e,!0):V(e)&&K(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=W(e)?e:void 0,s=o!==void 0||t!==void 0&&V(e);if(n&&n.isNode())if(s)for(var c=0;c<this.length;c++){var l=this[c];t===void 0?o!==void 0&&l.position(Kn(o,i,a)):l.position(e,(t-a[e])/i)}else return o=Gn(n.position(),i,a),e===void 0?o:o[e];else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=W(e)?e:void 0,a=i!==void 0||t!==void 0&&V(e),o=r.hasCompoundNodes();if(n&&n.isNode())if(a)for(var s=0;s<this.length;s++){var c=this[s],l=o?c.parent():null,u=l&&l.length>0,d=u;u&&(l=l[0]);var f=d?l.position():{x:0,y:0};t===void 0?i!==void 0&&c.position({x:i.x+f.x,y:i.y+f.y}):c.position(e,t+f[e])}else{var p=n.position(),m=o?n.parent():null,h=m&&m.length>0,g=h;h&&(m=m[0]);var _=g?m.position():{x:0,y:0};return i={x:p.x-_.x,y:p.y-_.y},e===void 0?i:i[e]}else if(!a)return;return this}},pl.modelPosition=pl.point=pl.position,pl.modelPositions=pl.points=pl.positions,pl.renderedPoint=pl.renderedPosition,pl.relativePoint=pl.relativePosition;var _l=ml,vl=yl={},yl;yl.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,c=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:c,w:o-a,h:c-s}},yl.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()||this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify(`bounds`)}}),this},yl.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;function n(e){if(!e.isParent())return;var t=e._private,n=e.children(),r=e.pstyle(`compound-sizing-wrt-labels`).value===`include`,i={width:{val:e.pstyle(`min-width`).pfValue,left:e.pstyle(`min-width-bias-left`),right:e.pstyle(`min-width-bias-right`)},height:{val:e.pstyle(`min-height`).pfValue,top:e.pstyle(`min-height-bias-top`),bottom:e.pstyle(`min-height-bias-bottom`)}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(a.w===0||a.h===0)&&(a={w:e.pstyle(`width`).pfValue,h:e.pstyle(`height`).pfValue},a.x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);function s(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function c(e,t,n,r){if(n.units===`%`)switch(r){case`width`:return e>0?n.pfValue*e:0;case`height`:return t>0?n.pfValue*t:0;case`average`:return e>0&&t>0?n.pfValue*(e+t)/2:0;case`min`:return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case`max`:return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if(n.units===`px`)return n.pfValue;else return 0}var l=i.width.left.value;i.width.left.units===`px`&&i.width.val>0&&(l=l*100/i.width.val);var u=i.width.right.value;i.width.right.units===`px`&&i.width.val>0&&(u=u*100/i.width.val);var d=i.height.top.value;i.height.top.units===`px`&&i.height.val>0&&(d=d*100/i.height.val);var f=i.height.bottom.value;i.height.bottom.units===`px`&&i.height.val>0&&(f=f*100/i.height.val);var p=s(i.width.val-a.w,l,u),m=p.biasDiff,h=p.biasComplementDiff,g=s(i.height.val-a.h,d,f),_=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=c(a.w,a.h,e.pstyle(`padding`),e.pstyle(`padding-relative-to`).value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-m+a.x1+a.x2+h)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-_+a.y1+a.y2+v)/2}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;(!a.compoundBoundsClean||e)&&(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var bl=function(e){return e===1/0||e===-1/0?0:e},xl=function(e,t,n,r,i){r-t===0||i-n===0||t==null||n==null||r==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Sl=function(e,t){return t==null?e:xl(e,t.x1,t.y1,t.x2,t.y2)},Cl=function(e,t,n){return pn(e,t,n)},wl=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+`-arrow-shape`).value,s,c;if(o!==`none`){n===`source`?(s=i.srcX,c=i.srcY):n===`target`?(s=i.tgtX,c=i.tgtY):(s=i.midX,c=i.midY);var l=r.arrowBounds=r.arrowBounds||{},u=l[n]=l[n]||{};u.x1=s-a,u.y1=c-a,u.x2=s+a,u.y2=c+a,u.w=u.x2-u.x1,u.h=u.y2-u.y1,mr(u,1),xl(e,u.x1,u.y1,u.x2,u.y2)}}},Tl=function(e,t,n){if(!t.cy().headless()){var r=n?n+`-`:``,i=t._private,a=i.rstyle;if(t.pstyle(r+`label`).strValue){var o=t.pstyle(`text-halign`),s=t.pstyle(`text-valign`),c=Cl(a,`labelWidth`,n),l=Cl(a,`labelHeight`,n),u=Cl(a,`labelX`,n),d=Cl(a,`labelY`,n),f=t.pstyle(r+`text-margin-x`).pfValue,p=t.pstyle(r+`text-margin-y`).pfValue,m=t.isEdge(),h=t.pstyle(r+`text-rotation`),g=t.pstyle(`text-outline-width`).pfValue,_=t.pstyle(`text-border-width`).pfValue/2,v=t.pstyle(`text-background-padding`).pfValue,y=2,b=l,x=c,S=x/2,C=b/2,w,T,E,D;if(m)w=u-S,T=u+S,E=d-C,D=d+C;else{switch(o.value){case`left`:w=u-x,T=u;break;case`center`:w=u-S,T=u+S;break;case`right`:w=u,T=u+x;break}switch(s.value){case`top`:E=d-b,D=d;break;case`center`:E=d-C,D=d+C;break;case`bottom`:E=d,D=d+b;break}}var O=f-Math.max(g,_)-v-y,k=f+Math.max(g,_)+v+y,A=p-Math.max(g,_)-v-y,j=p+Math.max(g,_)+v+y;w+=O,T+=k,E+=A,D+=j;var M=n||`main`,N=i.labelBounds,P=N[M]=N[M]||{};P.x1=w,P.y1=E,P.x2=T,P.y2=D,P.w=T-w,P.h=D-E,P.leftPad=O,P.rightPad=k,P.topPad=A,P.botPad=j;var F=m&&h.strValue===`autorotate`,I=h.pfValue!=null&&h.pfValue!==0;if(F||I){var L=F?Cl(i.rstyle,`labelAngle`,n):h.pfValue,R=Math.cos(L),z=Math.sin(L),B=(w+T)/2,V=(E+D)/2;if(!m){switch(o.value){case`left`:B=T;break;case`right`:B=w;break}switch(s.value){case`top`:V=D;break;case`bottom`:V=E;break}}var H=function(e,t){return e-=B,t-=V,{x:e*R-t*z+B,y:e*z+t*R+V}},U=H(w,E),W=H(w,D),G=H(T,E),K=H(T,D);w=Math.min(U.x,W.x,G.x,K.x),T=Math.max(U.x,W.x,G.x,K.x),E=Math.min(U.y,W.y,G.y,K.y),D=Math.max(U.y,W.y,G.y,K.y)}var q=M+`Rot`,J=N[q]=N[q]||{};J.x1=w,J.y1=E,J.x2=T,J.y2=D,J.w=T-w,J.h=D-E,xl(e,w,E,T,D),xl(i.labelBounds.all,w,E,T,D)}return e}},El=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`outline-opacity`).value,r=t.pstyle(`outline-width`).value+t.pstyle(`outline-offset`).value;Dl(e,t,n,r,`outside`,r/2)}},Dl=function(e,t,n,r,i,a){if(!(n===0||r<=0||i===`inside`)){var o=t.cy(),s=t.pstyle(`shape`).value,c=o.renderer().nodeShapes[s],l=t.position(),u=l.x,d=l.y,f=t.width(),p=t.height();c.hasMiterBounds?(i===`center`&&(r/=2),Sl(e,c.miterBounds(u,d,f,p,r))):a!=null&&a>0&&hr(e,[a,a,a,a])}},Ol=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`border-opacity`).value,r=t.pstyle(`border-width`).pfValue,i=t.pstyle(`border-position`).value;Dl(e,t,n,r,i)}},kl=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=lr(),o=e._private,s=e.isNode(),c=e.isEdge(),l,u,d,f,p,m,h=o.rstyle,g=s&&r?e.pstyle(`bounds-expansion`).pfValue:[0],_=function(e){return e.pstyle(`display`).value!==`none`},v=!r||_(e)&&(!c||_(e.source())&&_(e.target()));if(v){var y=0,b=0;r&&t.includeOverlays&&(y=e.pstyle(`overlay-opacity`).value,y!==0&&(b=e.pstyle(`overlay-padding`).value));var x=0,S=0;r&&t.includeUnderlays&&(x=e.pstyle(`underlay-opacity`).value,x!==0&&(S=e.pstyle(`underlay-padding`).value));var C=Math.max(b,S),w=0,T=0;if(r&&(w=e.pstyle(`width`).pfValue,T=w/2),s&&t.includeNodes){var E=e.position();p=E.x,m=E.y;var D=e.outerWidth()/2,O=e.outerHeight()/2;l=p-D,u=p+D,d=m-O,f=m+O,xl(a,l,d,u,f),r&&El(a,e),r&&t.includeOutlines&&!i&&El(a,e),r&&Ol(a,e)}else if(c&&t.includeEdges)if(r&&!i){var k=e.pstyle(`curve-style`).strValue;if(l=Math.min(h.srcX,h.midX,h.tgtX),u=Math.max(h.srcX,h.midX,h.tgtX),d=Math.min(h.srcY,h.midY,h.tgtY),f=Math.max(h.srcY,h.midY,h.tgtY),l-=T,u+=T,d-=T,f+=T,xl(a,l,d,u,f),k===`haystack`){var A=h.haystackPts;if(A&&A.length===2){if(l=A[0].x,d=A[0].y,u=A[1].x,f=A[1].y,l>u){var j=l;l=u,u=j}if(d>f){var M=d;d=f,f=M}xl(a,l-T,d-T,u+T,f+T)}}else if(k===`bezier`||k===`unbundled-bezier`||he(k,`segments`)||he(k,`taxi`)){var N;switch(k){case`bezier`:case`unbundled-bezier`:N=h.bezierPts;break;case`segments`:case`taxi`:case`round-segments`:case`round-taxi`:N=h.linePts;break}if(N!=null)for(var P=0;P<N.length;P++){var F=N[P];l=F.x-T,u=F.x+T,d=F.y-T,f=F.y+T,xl(a,l,d,u,f)}}}else{var I=e.source().position(),L=e.target().position();if(l=I.x,u=L.x,d=I.y,f=L.y,l>u){var R=l;l=u,u=R}if(d>f){var z=d;d=f,f=z}l-=T,u+=T,d-=T,f+=T,xl(a,l,d,u,f)}if(r&&t.includeEdges&&c&&(wl(a,e,`mid-source`),wl(a,e,`mid-target`),wl(a,e,`source`),wl(a,e,`target`)),r&&e.pstyle(`ghost`).value===`yes`){var B=e.pstyle(`ghost-offset-x`).pfValue,V=e.pstyle(`ghost-offset-y`).pfValue;xl(a,a.x1+B,a.y1+V,a.x2+B,a.y2+V)}var H=o.bodyBounds=o.bodyBounds||{};gr(H,a),hr(H,g),mr(H,1),r&&(l=a.x1,u=a.x2,d=a.y1,f=a.y2,xl(a,l-C,d-C,u+C,f+C));var U=o.overlayBounds=o.overlayBounds||{};gr(U,a),hr(U,g),mr(U,1);var W=o.labelBounds=o.labelBounds||{};W.all==null?W.all=lr():dr(W.all),r&&t.includeLabels&&(t.includeMainLabels&&Tl(a,e,null),c&&(t.includeSourceLabels&&Tl(a,e,`source`),t.includeTargetLabels&&Tl(a,e,`target`)))}return a.x1=bl(a.x1),a.y1=bl(a.y1),a.x2=bl(a.x2),a.y2=bl(a.y2),a.w=bl(a.x2-a.x1),a.h=bl(a.y2-a.y1),a.w>0&&a.h>0&&v&&(hr(a,g),mr(a,1)),a},Al=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},jl=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return Rt([t(n.x),t(n.y),t(r.x),t(r.y)])}else{var i=e.position();return Rt([t(i.x),t(i.y)])}},Ml=function(e,t){var n=e._private,r,i=e.isEdge(),a=(t==null?Pl:Al(t))===Pl;if(n.bbCache==null?(r=kl(e,Nl),n.bbCache=r,n.bbCachePosKey=jl(e)):r=n.bbCache,!a){var o=e.isNode();r=lr(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?Sl(r,n.overlayBounds):Sl(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?Sl(r,n.labelBounds.all):(t.includeMainLabels&&Sl(r,n.labelBounds.mainRot),t.includeSourceLabels&&Sl(r,n.labelBounds.sourceRot),t.includeTargetLabels&&Sl(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},Nl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Pl=Al(Nl),Fl=ln(Nl);yl.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=ue(function(e){var t=e._private;return t.bbCache==null||t.styleDirty||t.bbCachePosKey!==jl(e)},function(e){return e.id()});if(n&&this.length===1&&!r(this[0]))e=e===void 0?Nl:Fl(e),t=Ml(this[0],e);else{t=lr(),e||=Nl;var i=Fl(e),a=this,o=a.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s<a.length;s++){var c=a[s];r(c)&&c.dirtyBoundingBoxCache(),Sl(t,Ml(c,i))}}return t.x1=bl(t.x1),t.y1=bl(t.y1),t.x2=bl(t.x2),t.y2=bl(t.y2),t.w=bl(t.x2-t.x1),t.h=bl(t.y2-t.y1),t},yl.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds[`mid-source`]=null,t.arrowBounds[`mid-target`]=null}return this.emitAndNotify(`bounds`),this},yl.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(e){return e.isParent()}),t=t.not(i)),W(e)){var a=e;e=function(){return a}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var c=ur(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),c},vl.boundingbox=vl.bb=vl.boundingBox,vl.renderedBoundingbox=vl.renderedBoundingBox;var Il=yl,Ll=Rl={},Rl,zl=function(e){e.uppercaseName=me(e.name),e.autoName=`auto`+e.uppercaseName,e.labelName=`label`+e.uppercaseName,e.outerName=`outer`+e.uppercaseName,e.uppercaseOuterName=me(e.outerName),Ll[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t)if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case`label`:return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}else return 1},Ll[`outer`+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)if(n){var r=t[e.name](),i=t.pstyle(`border-position`).value,a=i===`center`?t.pstyle(`border-width`).pfValue:i===`outside`?2*t.pstyle(`border-width`).pfValue:0,o=2*t.padding();return r+a+o}else return 1},Ll[`rendered`+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},Ll[`rendered`+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};zl({name:`width`}),zl({name:`height`}),Rl.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding===void 0?e.pstyle(`padding`).pfValue:t.autoPadding):e.pstyle(`padding`).pfValue},Rl.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},Rl.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var Bl=Rl,Vl=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},Hl=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return Gn(t(e),n.zoom(),n.pan())}},Ul=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return Gn(e,i,r)})}},Wl={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},Gl=function(e){return`rendered`+e[0].toUpperCase()+e.substr(1)},Kl=X({},_l,Il,Bl,Object.keys(Wl).reduce(function(e,t){var n=Wl[t],r=Gl(t);return e[t]=function(){return Vl(this,n.get)},n.mult?e[r]=function(){return Ul(this,n.get)}:e[r]=function(){return Hl(this,n.get)},e},{})),ql=function(e,t){this.recycle(e,t)};function Jl(){return!1}function Yl(){return!0}ql.prototype={instanceString:function(){return`event`},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Jl,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Yl:Jl):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type==null?this.type:t.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Yl;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Yl;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Yl,this.stopPropagation()},isDefaultPrevented:Jl,isPropagationStopped:Jl,isImmediatePropagationStopped:Jl};var Xl=/^([^.]+)(\.(?:[^.]+))?$/,Zl=`.*`,Ql={qualifierCompare:function(e,t){return e===t},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},$l=Object.keys(Ql),eu={};function tu(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:eu,t=arguments.length>1?arguments[1]:void 0,n=0;n<$l.length;n++){var r=$l[n];this[r]=e[r]||Ql[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var nu=tu.prototype,ru=function(e,t,n,r,i,a,o){H(r)&&(i=r,r=null),o&&(a=a==null?o:X({},a,o));for(var s=U(n)?n:n.split(/\s+/),c=0;c<s.length;c++){var l=s[c];if(!ae(l)){var u=l.match(Xl);if(u){var d=u[1];if(t(e,l,d,u[2]?u[2]:null,r,i,a)===!1)break}}}},iu=function(e,t){return e.addEventFields(e.context,t),new ql(t.type,t)},au=function(e,t,n){if(ie(n)){t(e,n);return}else if(W(n)){t(e,iu(e,n));return}for(var r=U(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!ae(a)){var o=a.match(Xl);if(o){var s=o[1];t(e,iu(e,{type:s,namespace:o[2]?o[2]:null,target:e.context}))}}}};nu.on=nu.addListener=function(e,t,n,r,i){return ru(this,function(e,t,n,r,i,a,o){H(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},nu.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},nu.removeListener=nu.off=function(e,t,n,r){var i=this;this.emitting!==0&&(this.listeners=an(this.listeners));for(var a=this.listeners,o=function(o){var s=a[o];ru(i,function(t,n,r,i,c,l){if((s.type===r||e===`*`)&&(!i&&s.namespace!==`.*`||s.namespace===i)&&(!c||t.qualifierCompare(s.qualifier,c))&&(!l||s.callback===l))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},nu.removeAllListeners=function(){return this.removeListener(`*`)},nu.emit=nu.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,U(t)||(t=[t]),au(this,function(e,a){n!=null&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(){var n=r[s];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||n.namespace===Zl)&&e.eventMatches(e.context,n,a)){var i=[a];t!=null&&fn(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var o=e.callbackContext(e.context,n,a),c=n.callback.apply(o,i);e.afterEmit(e.context,n,a),c===!1&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var ou={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&ee(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},su=function(e){return V(e)?new Qc(e):e},cu={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||=new tu(ou,t)}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=su(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=su(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=su(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=su(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};Ac.eventAliasesOn(cu);var lu={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(V(e)||Y(e))return new Qc(e).filter(this);if(H(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i];(t?e.apply(t,[a,i,r]):e(a,i,r))&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){V(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}else return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(V(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,a=this.length<e.length,o=a?r:i,s=a?i:r,c=0;c<o.length;c++){var l=o[c];s.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;V(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,a=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return a(r,i),a(i,r),n},diff:function(e){var t=this._private.cy;V(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return s(a,o,n),s(o,a,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(V(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&V(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var c=this.length++;this[c]=o,i.set(s,{ele:o,index:c})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&V(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n=-1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>n&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<n&&(n=s,r=o)}return{value:n,ele:r}}},uu=lu;uu.u=uu[`|`]=uu[`+`]=uu.union=uu.or=uu.add,uu[`\\`]=uu[`!`]=uu[`-`]=uu.difference=uu.relativeComplement=uu.subtract=uu.not,uu.n=uu[`&`]=uu[`.`]=uu.and=uu.intersection=uu.intersect,uu[`^`]=uu[`(+)`]=uu[`(-)`]=uu.symmetricDifference=uu.symdiff=uu.xor,uu.fnFilter=uu.filterFn=uu.stdFilter=uu.filter,uu.complement=uu.abscomp=uu.absoluteComplement;var du={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}},fu=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle(`z-compound-depth`);return t.value===`auto`?n?e.zDepth():0:t.value===`bottom`?-1:t.value===`top`?Jt:0}var i=r(e)-r(t);if(i!==0)return i;function a(e){return e.pstyle(`z-index-compare`).value===`auto`&&e.isNode()?1:0}var o=a(e)-a(t);if(o!==0)return o;var s=e.pstyle(`z-index`).value-t.pstyle(`z-index`).value;return s===0?e.poolIndex()-t.poolIndex():s},pu={forEach:function(e,t){if(H(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if((t?e.apply(t,[i,r,this]):e(i,r,this))===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t??=r,e??=0,e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},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(!H(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(fu)},zDepth:function(){var e=this[0];if(e){var t=e._private;if(t.group===`nodes`){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:Jt-1}else{var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}}};pu.each=pu.forEach,(function(){var e=`undefined`;(typeof Symbol>`u`?`undefined`:M(Symbol))!=e&&M(Symbol.iterator)!=e&&(pu[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return C({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})})})();var mu=ln({nodeDimensionsIncludeLabels:!1}),hu={layoutDimensions:function(e){e=mu(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=ue(n,o);e.emit({type:`layoutstart`,layout:e}),e.animations=[];var c=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},l=t.spacingFactor&&t.spacingFactor!==1,u=function(){if(!l)return null;for(var e=lr(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);pr(e,i.x,i.y)}return e}(),d=ue(function(e,n){var r=s(e,n);return l&&(r=c(Math.abs(t.spacingFactor),u,r)),t.transform!=null&&(r=t.transform(e,r)),r},o);if(t.animate){for(var f=0;f<r.length;f++){var p=r[f],m=d(p,f);if(t.animateFilter==null||t.animateFilter(p,f)){var h=p.animation({position:m,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(h)}else p.position(m)}if(t.fit){var g=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(t.zoom!==void 0&&t.pan!==void 0){var _=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(_)}e.animations.forEach(function(e){return e.play()}),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),ka.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e})})}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e});return this},layout:function(e){return this.cy().makeLayout(X({},e,{eles:this}))}};hu.createLayout=hu.makeLayout=hu.layout;function gu(e,t,n){var r=n._private,i=r.styleCache=r.styleCache||[],a;return(a=i[e])??(a=i[e]=t(n)),a}function _u(e,t){return e=zt(e),function(n){return gu(e,t,n)}}function vu(e,t){e=zt(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return gu(e,n,t)}}var yu={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(e){return e._private.styleCache=null};if(e.hasCompoundNodes()){var n=this.spawnSelf().merge(this.descendants()).merge(this.parents());n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(e){t(e),e.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!(e||e===void 0),n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify(`style`):i.emit(`style`),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n)return n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n)),n._private.style[e]??(t?r.style().getDefaultProperty(e):null)},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue===void 0?n.value:n.pfValue}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(W(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify(`style`)}else if(V(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,r),this.emitAndNotify(`style`);else if(e===void 0){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(e===void 0)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var c=i[s];r.removeBypasses(c,e,n)}}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 t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle(`opacity`).value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i=a[o].pstyle(`opacity`).value*i;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)return t?e.effectiveOpacity()===0:e.pstyle(`opacity`).value===0},backgrounding:function(){return this.cy().styleEnabled()?!!this[0]._private.backgrounding:!1}};function bu(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){var i=n[r];if(!t(i))return!1}return!0}function xu(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||bu(i,r);var s=o.source,c=o.target;return n(s)&&(!a||bu(s,n))&&(s===c||n(c)&&(!a||bu(c,n)))}}}var Su=_u(`eleTakesUpSpace`,function(e){return e.pstyle(`display`).value===`element`&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});yu.takesUpSpace=vu(`takesUpSpace`,xu({ok:Su})),yu.interactive=vu(`interactive`,xu({ok:_u(`eleInteractive`,function(e){return e.pstyle(`events`).value===`yes`&&e.pstyle(`visibility`).value===`visible`&&Su(e)}),parentOk:_u(`parentInteractive`,function(e){return e.pstyle(`visibility`).value===`visible`&&Su(e)}),edgeOkViaNode:Su})),yu.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},yu.visible=vu(`visible`,xu({ok:_u(`eleVisible`,function(e){return e.pstyle(`visibility`).value===`visible`&&e.pstyle(`opacity`).pfValue!==0&&Su(e)}),edgeOkViaNode:Su})),yu.hidden=function(){var e=this[0];if(e)return!e.visible()},yu.isBundledBezier=vu(`isBundledBezier`,function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle(`curve-style`).value===`bezier`&&this.takesUpSpace():!1}),yu.bypass=yu.css=yu.style,yu.renderedCss=yu.renderedStyle,yu.removeBypass=yu.removeCss=yu.removeStyle,yu.pstyle=yu.parsedStyle;var Cu={};function wu(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(t.length===1&&H(t[0])){var a=t[0];this.on(e.event,a)}else if(t.length===0||t.length===1&&U(t[0])){for(var o=t.length===1?t[0]:null,s=0;s<this.length;s++){var c=this[s],l=!e.ableField||c._private[e.ableField],u=c._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(c);if(d!==void 0&&(l=d,!d))return this}l&&(c._private[e.field]=e.value,u&&n.push(c))}var f=this.spawn(n);f.updateStyle(),f.emit(e.event),o&&f.emit(o)}return this}}function Tu(e){Cu[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},Cu[e.on]=wu({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),Cu[e.off]=wu({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}Tu({field:`locked`,overrideField:function(e){return e.cy().autolock()?!0:void 0},on:`lock`,off:`unlock`}),Tu({field:`grabbable`,overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:`grabify`,off:`ungrabify`}),Tu({field:`selected`,ableField:`selectable`,overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:`select`,off:`unselect`}),Tu({field:`selectable`,overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:`selectify`,off:`unselectify`}),Cu.deselect=Cu.unselect,Cu.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},Tu({field:`active`,on:`activate`,off:`unactivate`}),Tu({field:`pannable`,on:`panify`,off:`unpanify`}),Cu.inactive=function(){var e=this[0];if(e)return!e._private.active};var Eu={},Du=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),c=0;c<s.length;c++){var l=s[c],u=l.source(),d=l.target();if(e.noIncomingEdges&&d===a&&u!==a||e.noOutgoingEdges&&u===a&&d!==a){o=!0;break}}o||r.push(a)}}return this.spawn(r,!0).filter(t)}},Ou=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var c=o[s],l=c.source(),u=c.target();e.outgoing&&l===a?(r.push(c),r.push(u)):e.incoming&&u===a&&(r.push(c),r.push(l))}}return this.spawn(r,!0).filter(t)}},ku=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(a.length===0)break;for(var o=!1,s=0;s<a.length;s++){var c=a[s],l=c.id();i[l]||(i[l]=!0,r.push(c),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};Eu.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},X(Eu,{roots:Du({noIncomingEdges:!0}),leaves:Du({noOutgoingEdges:!0}),outgoers:tl(Ou({outgoing:!0}),`outgoers`),successors:ku({outgoing:!0}),incomers:tl(Ou({incoming:!0}),`incomers`),predecessors:ku({})}),X(Eu,{neighborhood:tl(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],c=s.source(),l=s.target(),u=i===c?l:c;u.length>0&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},`neighborhood`),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Eu.neighbourhood=Eu.neighborhood,Eu.closedNeighbourhood=Eu.closedNeighborhood,Eu.openNeighbourhood=Eu.openNeighborhood,X(Eu,{source:tl(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},`source`),target:tl(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},`target`),sources:Au({attr:`source`}),targets:Au({attr:`target`})});function Au(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}X(Eu,{edgesWith:tl(ju(),`edgesWith`),edgesTo:tl(ju({thisIsSrc:!0}),`edgesTo`)});function ju(e){return function(t){var n=[],r=this._private.cy,i=e||{};V(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var c=o[s],l=c._private.data,u=this.hasElementWithId(l.source)&&t.hasElementWithId(l.target),d=t.hasElementWithId(l.source)&&this.hasElementWithId(l.target);(u||d)&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!u||i.thisIsTgt&&!d)||n.push(c))}return this.spawn(n,!0)}}X(Eu,{connectedEdges:tl(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)},`connectedEdges`),connectedNodes:tl(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},`connectedNodes`),parallelEdges:tl(Mu(),`parallelEdges`),codirectedEdges:tl(Mu({codirected:!0}),`codirectedEdges`)});function Mu(e){return e=X({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,c=s._private.data.id,l=o.data.target,u=s._private.edges,d=0;d<u.length;d++){var f=u[d],p=f._private.data,m=p.target,h=p.source,g=m===l&&h===c,_=c===m&&l===h;(i.codirected&&g||!i.codirected&&(g||_))&&n.push(f)}return this.spawn(n,!0).filter(t)}}X(Eu,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=e==null?t.nodes():e.nodes(),a=[];e!=null&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})};do s();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Eu.componentsOf=Eu.components;var Nu=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){$t(`A collection must have a reference to the core`);return}var i=new gn,a=!1;if(!t)t=[];else if(t.length>0&&W(t[0])&&!ee(t[0])){a=!0;for(var o=[],s=new yn,c=0,l=t.length;c<l;c++){var u=t[c];u.data??={};var d=u.data;if(d.id==null)d.id=on();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var f=new bn(e,u,!1);o.push(f),s.add(d.id)}t=o}this.length=0;for(var p=0,m=t.length;p<m;p++){var h=t[p][0];if(h!=null){var g=h._private.data.id;(!n||!i.has(g))&&(n&&i.set(g,{index:this.length,ele:h}),this[this.length]=h,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap??this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new gn,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},Pu=bn.prototype=Nu.prototype=Object.create(Array.prototype);Pu.instanceString=function(){return`collection`},Pu.spawn=function(e,t){return new Nu(this.cy(),e,t)},Pu.spawnSelf=function(){return this.spawn(this)},Pu.cy=function(){return this._private.cy},Pu.renderer=function(){return this._private.cy.renderer()},Pu.element=function(){return this[0]},Pu.collection=function(){return te(this)?this:new Nu(this._private.cy,[this])},Pu.unique=function(){return new Nu(this._private.cy,this,!0)},Pu.hasElementWithId=function(e){return e=``+e,this._private.map.has(e)},Pu.getElementById=function(e){e=``+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new Nu(t)},Pu.$id=Pu.getElementById,Pu.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},Pu.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Pu.indexOfId=function(e){return e=``+e,this._private.map.get(e).index},Pu.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(W(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,c=e.data.target;s!=null&&s!=i.source&&(o.source=``+s,a=!0),c!=null&&c!=i.target&&(o.target=``+c,a=!0),a&&(t=t.move(o))}else{var l=`parent`in e.data,u=e.data.parent;l&&(u!=null||i.parent!=null)&&u!=i.parent&&(u===void 0&&(u=null),u!=null&&(u=``+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];o!=null&&o!==r[n]&&(o?t[i]():t[a]())};return d(`removed`,`remove`,`restore`),d(`selected`,`select`,`unselect`),d(`selectable`,`selectify`,`unselectify`),d(`locked`,`lock`,`unlock`),d(`grabbable`,`grabify`,`ungrabify`),d(`pannable`,`panify`,`unpanify`),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var f={data:rn(r.data),position:rn(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};f.classes=``;var p=0;return r.classes.forEach(function(e){return f.classes+=p++===0?e:` `+e}),f}}},Pu.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},Pu.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new bn(e,this[n].json(),!1);t.push(r)}return new Nu(e,t)},Pu.copy=Pu.clone,Pu.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),i=r._private,a=[],o=[],s,c=0,l=n.length;c<l;c++){var u=n[c];t&&!u.removed()||(u.isNode()?a.push(u):o.push(u))}s=a.concat(o);var d,f=function(){s.splice(d,1),d--};for(d=0;d<s.length;d++){var p=s[d],m=p._private,h=m.data;if(p.clearTraversalCache(),!(!t&&!m.removed)){if(h.id===void 0)h.id=on();else if(K(h.id))h.id=``+h.id;else if(ae(h.id)||!V(h.id)){$t("Can not create element with invalid string ID `"+h.id+"`"),f();continue}else if(r.hasElementWithId(h.id)){$t("Can not create second element with ID `"+h.id+"`"),f();continue}}var g=h.id;if(p.isNode()){var _=m.position;_.x??=0,_.y??=0}if(p.isEdge()){for(var v=p,y=[`source`,`target`],b=y.length,x=!1,S=0;S<b;S++){var C=y[S],w=h[C];K(w)&&(w=h[C]=``+h[C]),w==null||w===``?($t("Can not create edge `"+g+"` with unspecified "+C),x=!0):r.hasElementWithId(w)||($t("Can not create edge `"+g+"` with nonexistant "+C+" `"+w+"`"),x=!0)}if(x){f();continue}var T=r.getElementById(h.source),E=r.getElementById(h.target);T.same(E)?T._private.edges.push(v):(T._private.edges.push(v),E._private.edges.push(v)),v._private.source=T,v._private.target=E}m.map=new gn,m.map.set(g,{ele:p,index:0}),m.removed=!1,t&&r.addToPool(p)}for(var D=0;D<a.length;D++){var O=a[D],k=O._private.data;K(k.parent)&&(k.parent=``+k.parent);var A=k.parent;if(A!=null||O._private.parent){var j=O._private.parent?r.collection().merge(O._private.parent):r.getElementById(A);if(j.empty())k.parent=void 0;else if(j[0].removed())tn(`Node added with missing parent, reference to parent removed`),k.parent=void 0,O._private.parent=null;else{for(var M=!1,N=j;!N.empty();){if(O.same(N)){M=!0,k.parent=void 0;break}N=N.parent()}M||(j[0]._private.children.push(O),O._private.parent=j[0],i.hasCompoundNodes=!0)}}}if(s.length>0){for(var P=s.length===n.length?n:new Nu(r,s),F=0;F<P.length;F++){var I=P[F];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}(i.hasCompoundNodes?r.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify(`add`):t&&P.emit(`add`)}return n},Pu.removed=function(){var e=this[0];return e&&e._private.removed},Pu.inside=function(){var e=this[0];return e&&!e._private.removed},Pu.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)c(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)c(t[n])}function c(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var l=0,u=n.length;l<u;l++){var d=n[l];c(d)}function f(e,t){var n=e._private.edges;un(n,t),e.clearTraversalCache()}function p(e){e.clearTraversalCache()}var m=[];m.ids={};function h(e,t){t=t[0],e=e[0];var n=e._private.children,r=e.id();un(n,t),t._private.parent=null,m.ids[r]||(m.ids[r]=!0,m.push(e))}n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var g=0;g<r.length;g++){var _=r[g];if(_.isEdge()){var v=_.source()[0],y=_.target()[0];f(v,_),f(y,_);for(var b=_.parallelEdges(),x=0;x<b.length;x++){var S=b[x];p(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var C=_.parent();C.length!==0&&h(C,_)}t&&(_._private.removed=!0)}var w=a._private.elements;a._private.hasCompoundNodes=!1;for(var T=0;T<w.length;T++)if(w[T].isParent()){a._private.hasCompoundNodes=!0;break}var E=new Nu(this.cy(),r);E.size()>0&&(e?E.emitAndNotify(`remove`):t&&E.emit(`remove`));for(var D=0;D<m.length;D++){var O=m[D];(!t||!O.removed())&&O.updateStyle()}return E},Pu.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return e==null?e:``+e};if(e.source!==void 0||e.target!==void 0){var o=a(e.source),s=a(e.target),c=o!=null&&t.hasElementWithId(o),l=s!=null&&t.hasElementWithId(s);(c||l)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify(`moveout`);for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(c&&(a.source=o),l&&(a.target=s))}n.restore(r,i)}),n.emitAndNotify(`move`))}else if(e.parent!==void 0){var u=a(e.parent);if(u===null||t.hasElementWithId(u)){var d=u===null?void 0:u;t.batch(function(){var e=n.remove(r,i);e.emitAndNotify(`moveout`);for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=d)}e.restore(r,i)}),n.emitAndNotify(`move`)}}return this},[ya,jc,Mc,el,nl,ll,ul,Kl,cu,lu,du,pu,hu,yu,Cu,Eu].forEach(function(e){X(Pu,e)});var Fu={add:function(e){var t,n=this;if(Y(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new Nu(n,i)}}else if(U(e))t=new Nu(n,e);else if(W(e)&&(U(e.nodes)||U(e.edges))){for(var s=e,c=[],l=[`nodes`,`edges`],u=0,d=l.length;u<d;u++){var f=l[u],p=s[f];if(U(p))for(var m=0,h=p.length;m<h;m++){var g=X({group:f},p[m]);c.push(g)}}t=new Nu(n,c)}else t=new bn(n,e).collection();return t},remove:function(e){if(!Y(e)&&V(e)){var t=e;e=this.$(t)}return e.remove()}};function Iu(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,c=11,l=1/(c-1),u=typeof Float32Array<`u`;if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!=`number`||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var f=u?new Float32Array(c):Array(c);function p(e,t){return 1-3*t+3*e}function m(e,t){return 3*t-6*e}function h(e){return 3*e}function g(e,t,n){return((p(t,n)*e+m(t,n))*e+h(t))*e}function _(e,t,n){return 3*p(t,n)*e*e+2*m(t,n)*e+h(t)}function v(t,r){for(var a=0;a<i;++a){var o=_(r,e,n);if(o===0)return r;var s=g(r,e,n)-t;r-=s/o}return r}function y(){for(var t=0;t<c;++t)f[t]=g(t*l,e,n)}function b(t,r,i){var a,c,l=0;do c=r+(i-r)/2,a=g(c,e,n)-t,a>0?i=c:r=c;while(Math.abs(a)>o&&++l<s);return c}function x(t){for(var r=0,i=1,o=c-1;i!==o&&f[i]<=t;++i)r+=l;--i;var s=(t-f[i])/(f[i+1]-f[i]),u=r+s*l,d=_(u,e,n);return d>=a?v(t,u):d===0?u:b(t,r,r+l)}var S=!1;function C(){S=!0,(e!==t||n!==r)&&y()}var w=function(i){return S||C(),e===t&&n===r?i:i===0?0:i===1?1:g(x(i),t,r)};w.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var T=`generateBezier(`+[e,t,n,r]+`)`;return w.toString=function(){return T},w}var Lu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,r*.5,i),o=t(n,r*.5,a),s=t(n,r,o),c=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),l=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x+=c*r,n.v+=l*r,n}return function e(t,r,i){var a={x:-1,v:0,tension:null,friction:null},o=[0],s=0,c=1/1e4,l=16/1e3,u,d,f;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i||=null,a.tension=t,a.friction=r,u=i!==null,u?(s=e(t,r),d=s/i*l):d=l;f=n(f||a,d),o.push(1+f.x),s+=16,Math.abs(f.x)>c&&Math.abs(f.v)>c;);return u?function(e){return o[e*(o.length-1)|0]}:s}}(),Ru=function(e,t,n,r){var i=Iu(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},zu={linear:function(e,t,n){return e+(t-e)*n},ease:Ru(.25,.1,.25,1),"ease-in":Ru(.42,0,1,1),"ease-out":Ru(0,0,.58,1),"ease-in-out":Ru(.42,0,.58,1),"ease-in-sine":Ru(.47,0,.745,.715),"ease-out-sine":Ru(.39,.575,.565,1),"ease-in-out-sine":Ru(.445,.05,.55,.95),"ease-in-quad":Ru(.55,.085,.68,.53),"ease-out-quad":Ru(.25,.46,.45,.94),"ease-in-out-quad":Ru(.455,.03,.515,.955),"ease-in-cubic":Ru(.55,.055,.675,.19),"ease-out-cubic":Ru(.215,.61,.355,1),"ease-in-out-cubic":Ru(.645,.045,.355,1),"ease-in-quart":Ru(.895,.03,.685,.22),"ease-out-quart":Ru(.165,.84,.44,1),"ease-in-out-quart":Ru(.77,0,.175,1),"ease-in-quint":Ru(.755,.05,.855,.06),"ease-out-quint":Ru(.23,1,.32,1),"ease-in-out-quint":Ru(.86,0,.07,1),"ease-in-expo":Ru(.95,.05,.795,.035),"ease-out-expo":Ru(.19,1,.22,1),"ease-in-out-expo":Ru(1,0,0,1),"ease-in-circ":Ru(.6,.04,.98,.335),"ease-out-circ":Ru(.075,.82,.165,1),"ease-in-out-circ":Ru(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return zu.linear;var r=Lu(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Ru};function Bu(e,t,n,r,i){if(r===1||t===n)return n;var a=i(t,n,r);return e==null?a:((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max)),a)}function Vu(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!==`%`)?e.pfValue:e.value:e}function Hu(e,t,n,r,i){var a=i==null?null:i.type;n<0?n=0:n>1&&(n=1);var o=Vu(e,i),s=Vu(t,i);if(K(o)&&K(s))return Bu(a,o,s,n,r);if(U(o)&&U(s)){for(var c=[],l=0;l<s.length;l++){var u=o[l],d=s[l];if(u!=null&&d!=null){var f=Bu(a,u,d,n,r);c.push(f)}else c.push(d)}return c}}function Uu(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,c=o.startTime,l=(r?e:e.cy()).style();if(!o.easingImpl)if(s==null)o.easingImpl=zu.linear;else{var u=V(s)?l.parse(`transition-timing-function`,s).value:s,d,f;V(u)?(d=u,f=[]):(d=u[1],f=u.slice(2).map(function(e){return+e})),f.length>0?(d===`spring`&&f.push(o.duration),o.easingImpl=zu[d].apply(null,f)):o.easingImpl=zu[d]}var p=o.easingImpl,m=o.duration===0?1:(n-c)/o.duration;if(o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var h=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var _={};Wu(h.x,g.x)&&(_.x=Hu(h.x,g.x,m,p)),Wu(h.y,g.y)&&(_.y=Hu(h.y,g.y,m,p)),e.position(_)}var v=o.startPan,y=o.pan,b=a.pan,x=y!=null&&r;x&&(Wu(v.x,y.x)&&(b.x=Hu(v.x,y.x,m,p)),Wu(v.y,y.y)&&(b.y=Hu(v.y,y.y,m,p)),e.emit(`pan`));var S=o.startZoom,C=o.zoom,w=C!=null&&r;w&&(Wu(S,C)&&(a.zoom=cr(a.minZoom,Hu(S,C,m,p),a.maxZoom)),e.emit(`zoom`)),(x||w)&&e.emit(`viewport`);var T=o.style;if(T&&T.length>0&&i){for(var E=0;E<T.length;E++){var D=T[E],O=D.name,k=D,A=o.startStyle[O],j=l.properties[A.name],M=Hu(A,k,m,p,j);l.overrideBypass(e,O,M)}e.emit(`style`)}}return o.progress=m,m}function Wu(e,t){return e==null||t==null?!1:K(e)&&K(t)?!0:!!(e&&t)}function Gu(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function Ku(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(a.length===0){var c=o.shift();c&&a.push(c)}for(var l=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];n()}e.splice(0,e.length)},u=a.length-1;u>=0;u--){var d=a[u],f=d._private;if(f.stopped){a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.frames);continue}!f.playing&&!f.applying||(f.playing&&f.applying&&(f.applying=!1),f.started||Gu(t,d,e),Uu(t,d,e,n),f.applying&&=!1,l(f.frames),f.step!=null&&f.step(e),d.completed()&&(a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.completes)),s=!0)}return!n&&a.length===0&&o.length===0&&r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=n[o],c=i(s);a||=c}var l=i(t,!0);(a||l)&&(n.length>0?t.notify(`draw`,n):t.notify(`draw`)),n.unmerge(r),t.emit(`step`)}var qu={animate:Ac.animate(),animation:Ac.animation(),animated:Ac.animated(),clearQueue:Ac.clearQueue(),delay:Ac.delay(),delayAnimation:Ac.delayAnimation(),stop:Ac.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&Dt(function(n){Ku(n,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(t,n){Ku(n,e)},n.beforeRenderPriorities.animations):t()}},Ju={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&ee(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target}},Yu=function(e){return V(e)?new Qc(e):e},Xu={createEmitter:function(){var e=this._private;return e.emitter||=new tu(Ju,this),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Yu(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Yu(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Yu(t),n),this},once:function(e,t,n){return this.emitter().one(e,Yu(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Ac.eventAliasesOn(Xu);var Zu={png:function(e){var t=this._private.renderer;return e||={},t.png(e)},jpg:function(e){var t=this._private.renderer;return e||={},e.bg=e.bg||`#fff`,t.jpg(e)}};Zu.jpeg=Zu.jpg;var Qu={layout:function(e){var t=this;if(e==null){$t(`Layout options must be specified to make a layout`);return}if(e.name==null){$t("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension(`layout`,n);if(r==null){$t("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}return new r(X({},e,{cy:t,eles:V(e.eles)?t.$(e.eles):e.eles==null?t.$():e.eles}))}};Qu.createLayout=Qu.makeLayout=Qu.layout;var $u={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.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??=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 t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},ed=ln({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]}),td={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),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 t=this,n=t.extension(`renderer`,e.name);if(n==null){$t(`Can not initialise: No such renderer \`${e.name}\` found. Did you forget to import it and \`cytoscape.use()\` it?`);return}e.wheelSensitivity!==void 0&&tn(`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 r=ed(e);r.cy=t,t._private.renderer=new n(r),this.notify(`init`)},destroyRenderer:function(){var e=this;e.notify(`destroy`);var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on(`render`,e)},offRender:function(e){return this.off(`render`,e)}};td.invalidateDimensions=td.resize;var nd={collection:function(e,t){return V(e)?this.$(e):Y(e)?e.collection():U(e)?(t||={},new Nu(this,e,t.unique,t.removed)):new Nu(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};nd.elements=nd.filter=nd.$;var rd={},id=`t`,ad=`f`;rd.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var i=e[r],a=t.getContextMeta(i);if(!a.empty){var o=t.getContextStyle(a),s=t.applyContextStyle(a,o,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,t.updateStyleHints(i)&&n.push(i)}}return n},rd.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+`-`+t,a=r[i];if(a)return a;for(var o=[],s={},c=0;c<n.length;c++){var l=n[c],u=e[c]===id,d=t[c]===id,f=u!==d,p=l.mappedProperties.length>0;if(f||d&&p){var m=void 0;f&&p||f?m=l.properties:p&&(m=l.mappedProperties);for(var h=0;h<m.length;h++){for(var g=m[h],_=g.name,v=!1,y=c+1;y<n.length;y++){var b=n[y];if(t[y]===id&&(v=b.properties[g.name]!=null,v))break}!s[_]&&!v&&(s[_]=!0,o.push(_))}}}return r[i]=o,o},rd.getContextMeta=function(e){for(var t=this,n=``,r,i=e._private.styleCxtKey||``,a=0;a<t.length;a++){var o=t[a];o.selector&&o.selector.matches(e)?n+=id:n+=ad}return r=t.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},rd.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var o=n[a];if(t[a]===id)for(var s=0;s<o.properties.length;s++){var c=o.properties[s];i[c.name]=c}}return r[t]=i,i},rd.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},o=r.types,s=0;s<i.length;s++){var c=i[s],l=t[c],u=n.pstyle(c);if(!l)if(u)l=u.bypass?{name:c,deleteBypassed:!0}:{name:c,delete:!0};else continue;if(u!==l){if(l.mapped===o.fn&&u!=null&&u.mapping!=null&&u.mapping.value===l.value){var d=u.mapping;if((d.fnValue=l.value(n))===d.prevFnValue)continue}var f=a[c]={prev:u};r.applyParsedProperty(n,l),f.next=n.pstyle(c),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:a}},rd.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s=t.group===`nodes`,c=e._private.style;r=Object.keys(c);for(var l=0;l<i.length;l++){var u=i[l];t.styleKeys[u]=[kt,jt]}for(var d=function(e,n){return t.styleKeys[n][0]=Nt(e,t.styleKeys[n][0])},f=function(e,n){return t.styleKeys[n][1]=Pt(e,t.styleKeys[n][1])},p=function(e,t){d(e,t),f(e,t)},m=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),f(r,t)}},h=2e9,g=function(e){return-128<e&&e<128&&Math.floor(e)!==e?h-(e*1024|0):e},_=0;_<r.length;_++){var v=r[_],y=c[v];if(y!=null){var b=this.properties[v],x=b.type,S=b.groupKey,C=void 0;b.hashOverride==null?y.pfValue!=null&&(C=y.pfValue):C=b.hashOverride(e,y);var w=b.enums==null?y.value:null,T=C!=null,E=T||w!=null,D=y.units;x.number&&E&&!x.multiple?(p(g(T?C:w),S),!T&&D!=null&&m(D,S)):m(y.strValue,S)}}for(var O=[kt,jt],k=0;k<i.length;k++){var A=i[k],j=t.styleKeys[A];O[0]=Nt(j[0],O[0]),O[1]=Pt(j[1],O[1])}t.styleKey=Ft(O[0],O[1]);var M=t.styleKeys;t.labelDimsKey=It(M.labelDimensions);var N=a(e,[`label`],M.labelDimensions);if(t.labelKey=It(N),t.labelStyleKey=It(Lt(M.commonLabel,N)),!s){var P=a(e,[`source-label`],M.labelDimensions);t.sourceLabelKey=It(P),t.sourceLabelStyleKey=It(Lt(M.commonLabel,P));var F=a(e,[`target-label`],M.labelDimensions);t.targetLabelKey=It(F),t.targetLabelStyleKey=It(Lt(M.commonLabel,F))}if(s){var I=t.styleKeys,L=I.nodeBody,R=I.nodeBorder,z=I.nodeOutline,B=I.backgroundImage,V=I.compound,H=I.pie,U=I.stripe;t.nodeKey=It([L,R,z,B,V,H,U].filter(function(e){return e!=null}).reduce(Lt,[kt,jt])),t.hasPie=H!=null&&H[0]!==kt&&H[1]!==jt,t.hasStripe=U!=null&&U[0]!==kt&&U[1]!==jt}return o!==t.styleKey},rd.clearStyleHints=function(e){var t=e._private;t.styleCxtKey=``,t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null},rd.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a,o=n.types,s=n.properties[r.name].type,c=r.bypass,l=i[r.name],u=l&&l.bypass,d=e._private,f=`mapping`,p=function(e){return e==null?null:e.pfValue==null?e.value:e.pfValue},m=function(){var t=p(l),i=p(r);n.checkTriggers(e,r.name,t,i)};if(t.name===`curve-style`&&e.isEdge()&&(t.value!==`bezier`&&e.isLoop()||t.value===`haystack`&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,`bezier`,c)),r.delete)return i[r.name]=void 0,m(),!0;if(r.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,m(),!0):!1:(m(),!0);if(r.deleteBypass)return l?l.bypass?(i[r.name]=l.bypassed,m(),!0):!1:(m(),!0);var h=function(){tn("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case o.mapData:for(var g=r.field.split(`.`),_=d.data,v=0;v<g.length&&_;v++){var y=g[v];_=_[y]}if(_==null)return h(),!1;var b;if(K(_)){var x=r.fieldMax-r.fieldMin;b=x===0?0:(_-r.fieldMin)/x}else return tn("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+`: `+_+"` for `"+e.id()+"` is non-numeric)"),!1;if(b<0?b=0:b>1&&(b=1),s.color){var S=r.valueMin[0],C=r.valueMax[0],w=r.valueMin[1],T=r.valueMax[1],E=r.valueMin[2],D=r.valueMax[2],O=r.valueMin[3]==null?1:r.valueMin[3],k=r.valueMax[3]==null?1:r.valueMax[3],A=[Math.round(S+(C-S)*b),Math.round(w+(T-w)*b),Math.round(E+(D-E)*b),Math.round(O+(k-O)*b)];a={bypass:r.bypass,name:r.name,value:A,strValue:`rgb(`+A[0]+`, `+A[1]+`, `+A[2]+`)`}}else if(s.number){var j=r.valueMin+(r.valueMax-r.valueMin)*b;a=this.parse(r.name,j,r.bypass,f)}else return!1;if(!a)return h(),!1;a.mapping=r,r=a;break;case o.data:for(var M=r.field.split(`.`),N=d.data,P=0;P<M.length&&N;P++){var F=M[P];N=N[F]}if(N!=null&&(a=this.parse(r.name,N,r.bypass,f)),!a)return h(),!1;a.mapping=r,r=a;break;case o.fn:var I=r.value,L=r.fnValue==null?I(e):r.fnValue;if(r.prevFnValue=L,L==null)return tn("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(a=this.parse(r.name,L,r.bypass,f),!a)return tn("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;a.mapping=rn(r),r=a;break;case void 0:break;default:return!1}return c?(u?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):u?l.bypassed=r:i[r.name]=r,m(),!0},rd.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],c=i[s];c!=null&&(c.bypass?c.bypassed=null:i[s]=null)}}},rd.update=function(){this._private.cy.mutableElements().updateStyle()},rd.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle(`transition-property`).value,a=e.pstyle(`transition-duration`).pfValue,o=e.pstyle(`transition-delay`).pfValue;if(i.length>0&&a>0){for(var s={},c=!1,l=0;l<i.length;l++){var u=i[l],d=e.pstyle(u),f=t[u];if(f){var p=f.prev,m=f.next==null?d:f.next,h=!1,g=void 0,_=1e-6;p&&(K(p.pfValue)&&K(m.pfValue)?(h=m.pfValue-p.pfValue,g=p.pfValue+_*h):K(p.value)&&K(m.value)?(h=m.value-p.value,g=p.value+_*h):U(p.value)&&U(m.value)&&(h=p.value[0]!==m.value[0]||p.value[1]!==m.value[1]||p.value[2]!==m.value[2],g=p.strValue),h&&(s[u]=m.strValue,this.applyBypass(e,u,g),c=!0))}}if(!c)return;r.transitioning=!0,new ka(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle(`transition-timing-function`).value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify(`style`),r.transitioning=!1})}else r.transitioning&&=(this.removeBypasses(e,i),e.emitAndNotify(`style`),!1)},rd.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);e.removed()||s!=null&&s(n,r,e)&&a(o)},rd.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify(`zorder`,e)})},rd.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},rd.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},rd.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},rd.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var od={};od.applyBypass=function(e,t,n,r){var i=this,a=[],o=!0;if(t===`*`||t===`**`){if(n!==void 0)for(var s=0;s<i.properties.length;s++){var c=i.properties[s].name,l=this.parse(c,n,!0);l&&a.push(l)}}else if(V(t)){var u=this.parse(t,n,!0);u&&a.push(u)}else if(W(t)){var d=t;r=n;for(var f=Object.keys(d),p=0;p<f.length;p++){var m=f[p],h=d[m];if(h===void 0&&(h=d[fe(m)]),h!==void 0){var g=this.parse(m,h,!0);g&&a.push(g)}}}else return!1;if(a.length===0)return!1;for(var _=!1,v=0;v<e.length;v++){for(var y=e[v],b={},x=void 0,S=0;S<a.length;S++){var C=a[S];if(r){var w=y.pstyle(C.name);x=b[C.name]={prev:w}}_=this.applyParsedProperty(y,rn(C))||_,r&&(x.next=y.pstyle(C.name))}_&&this.updateStyleHints(y),r&&this.updateTransitions(y,b,o)}return _},od.overrideBypass=function(e,t,n){t=de(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,c=o.mutiple,l=a?a.pfValue==null?a.value:a.pfValue:null;!a||!a.bypass?this.applyBypass(i,t,n):(a.value=n,a.pfValue!=null&&(a.pfValue=n),s?a.strValue=`rgb(`+n.join(`,`)+`)`:c?a.strValue=n.join(` `):a.strValue=``+n,this.updateStyleHints(i)),this.checkTriggers(i,t,l,n)}},od.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},od.removeBypasses=function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var c=t[s],l=this.properties[c],u=a.pstyle(l.name);if(!(!u||!u.bypass)){var d=this.parse(c,``,!0),f=o[l.name]={prev:u};this.applyParsedProperty(a,d),f.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,r)}};var sd={};sd.getEmSizeInPixels=function(){var e=this.containerCss(`font-size`);return e==null?1:parseFloat(e)},sd.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var cd={};cd.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},cd.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);o!=null&&(r[a.name]=o,r[fe(a.name)]=o)}return r}},cd.getIndexedStyle=function(e,t,n,r){return e.pstyle(t)[n][r]??e.cy().style().getDefaultProperty(t)[n][0]},cd.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,c=o.units,l=o.strValue;if(n&&a.number&&s!=null&&K(s)){var u=e.cy().zoom(),d=function(e){return e*u},f=function(e,t){return d(e)+t},p=U(s);return(p?c.every(function(e){return e!=null}):c!=null)?p?s.map(function(e,t){return f(e,c[t])}).join(` `):f(s,c):p?s.map(function(e){return V(e)?e:``+d(e)}).join(` `):``+d(s)}else if(l!=null)return l}return null}},cd.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);a!==void 0&&(a=W(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},cd.getPropsList=function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],c=r[s],l=i[s]||i[de(s)],u=this.parse(l.name,c);u&&n.push(u)}return n},cd.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),i,a,o,s,c,l;for(c=0;c<t.length;c++)if(i=t[c],a=e.pstyle(i,!1),a!=null)if(a.pfValue!=null)r[0]=Nt(s,r[0]),r[1]=Pt(s,r[1]);else for(o=a.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),r[0]=Nt(s,r[0]),r[1]=Pt(s,r[1]);return r},cd.getPropertiesHash=cd.getNonDefaultPropertiesHash;var ld={};ld.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var c=o[s],l=a[c];t.css(c,l)}}return t},ld.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},ld.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():`core`,style:a})}return e};var ud={};ud.appendFromString=function(e){var t=this,n=this,r=``+e,i,a,o;r=r.replace(/[/][*](\s|.)+?[*][/]/g,``);function s(){r=r.length>i.length?r.substr(i.length):``}function c(){a=a.length>o.length?a.substr(o.length):``}for(;!r.match(/^\s*$/);){var l=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){tn(`Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: `+r);break}i=l[0];var u=l[1];if(u!==`core`&&new Qc(u).invalid){tn(`Skipping parsing of block: Invalid selector found in string stylesheet: `+u),s();continue}var d=l[2],f=!1;a=d;for(var p=[];!a.match(/^\s*$/);){var m=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){tn(`Skipping parsing of block: Invalid formatting of style property and value definitions found in:`+d),f=!0;break}o=m[0];var h=m[1],g=m[2];if(!t.properties[h]){tn(`Skipping property: Invalid property name in: `+o),c();continue}if(!n.parse(h,g)){tn(`Skipping property: Invalid property definition in: `+o),c();continue}p.push({name:h,val:g}),c()}if(f){s();break}n.selector(u);for(var _=0;_<p.length;_++){var v=p[_];n.css(v.name,v.val)}s()}return n},ud.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var dd={};(function(){var e=ge,t=ve,n=be,r=xe,i=Se,a=function(e){return`^`+e+`\\s*\\(\\s*([\\w\\.]+)\\s*\\)$`},o=function(a){var o=e+`|\\w+|`+t+`|`+n+`|`+r+`|`+i;return`^`+a+`\\s*\\(([\\w\\.]+)\\s*\\,\\s*(`+e+`)\\s*\\,\\s*(`+e+`)\\s*,\\s*(`+o+`)\\s*\\,\\s*(`+o+`)\\)$`},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,`^(none)$`,`^(.+)$`];dd.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},boxSelection:{enums:[`contain`,`overlap`,`none`]},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`,`circle`]},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`.split(`.`)},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:a(`data`)},layoutData:{mapping:!0,regex:a(`layoutData`)},scratch:{mapping:!0,regex:a(`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(e,t){switch(e.length){case 2:return t[0]!==`deg`&&t[0]!==`rad`&&t[1]!==`deg`&&t[1]!==`rad`;case 1:return V(e[0])||t[0]===`deg`||t[0]===`rad`;default:return!1}}},easing:{regexes:[`^(spring)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`,`^(cubic-bezier)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\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`.split(`.`)},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(e){var t=e.length;return t===1||t===2||t===4}}};var c={zeroNonZero:function(e,t){return(e==null||t==null)&&e!==t||e==0&&t!=0?!0:e!=0&&t==0},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=ae(e),r=ae(t);return n&&!r||!n&&r}},l=dd.types,u=[{name:`label`,type:l.text,triggersBounds:c.any,triggersZOrder:c.emptyNonEmpty},{name:`text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any}],d=[{name:`source-label`,type:l.text,triggersBounds:c.any},{name:`source-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`source-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-offset`,type:l.size,triggersBounds:c.any}],f=[{name:`target-label`,type:l.text,triggersBounds:c.any},{name:`target-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`target-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-offset`,type:l.size,triggersBounds:c.any}],p=[{name:`font-family`,type:l.fontFamily,triggersBounds:c.any},{name:`font-style`,type:l.fontStyle,triggersBounds:c.any},{name:`font-weight`,type:l.fontWeight,triggersBounds:c.any},{name:`font-size`,type:l.size,triggersBounds:c.any},{name:`text-transform`,type:l.textTransform,triggersBounds:c.any},{name:`text-wrap`,type:l.textWrap,triggersBounds:c.any},{name:`text-overflow-wrap`,type:l.textOverflowWrap,triggersBounds:c.any},{name:`text-max-width`,type:l.size,triggersBounds:c.any},{name:`text-outline-width`,type:l.size,triggersBounds:c.any},{name:`line-height`,type:l.positiveNumber,triggersBounds:c.any}],m=[{name:`text-valign`,type:l.valign,triggersBounds:c.any},{name:`text-halign`,type:l.halign,triggersBounds:c.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:c.any},{name:`text-border-opacity`,type:l.zeroOneNumber},{name:`text-border-color`,type:l.color},{name:`text-border-width`,type:l.size,triggersBounds:c.any},{name:`text-border-style`,type:l.borderStyle,triggersBounds:c.any},{name:`text-background-shape`,type:l.textBackgroundShape,triggersBounds:c.any},{name:`text-justification`,type:l.justification},{name:`box-select-labels`,type:l.bool,triggersBounds:c.any}],h=[{name:`events`,type:l.bool,triggersZOrder:c.any},{name:`text-events`,type:l.bool,triggersZOrder:c.any},{name:`box-selection`,type:l.boxSelection,triggersZOrder:c.any}],g=[{name:`display`,type:l.display,triggersZOrder:c.any,triggersBounds:c.any,triggersBoundsOfConnectedEdges:c.any,triggersBoundsOfParallelEdges:function(e,t,n){return e===t?!1:n.pstyle(`curve-style`).value===`bezier`}},{name:`visibility`,type:l.visibility,triggersZOrder:c.any},{name:`opacity`,type:l.zeroOneNumber,triggersZOrder:c.zeroNonZero},{name:`text-opacity`,type:l.zeroOneNumber},{name:`min-zoomed-font-size`,type:l.size},{name:`z-compound-depth`,type:l.zCompoundDepth,triggersZOrder:c.any},{name:`z-index-compare`,type:l.zIndexCompare,triggersZOrder:c.any},{name:`z-index`,type:l.number,triggersZOrder:c.any}],_=[{name:`overlay-padding`,type:l.size,triggersBounds:c.any},{name:`overlay-color`,type:l.color},{name:`overlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`overlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`overlay-corner-radius`,type:l.cornerRadius}],v=[{name:`underlay-padding`,type:l.size,triggersBounds:c.any},{name:`underlay-color`,type:l.color},{name:`underlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`underlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`underlay-corner-radius`,type:l.cornerRadius}],y=[{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}],b=function(e,t){return t.value===`label`?-e.poolIndex():t.pfValue},x=[{name:`height`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`width`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`shape`,type:l.nodeShape,triggersBounds:c.any},{name:`shape-polygon-points`,type:l.polygonPointList,triggersBounds:c.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:c.any},{name:`padding-relative-to`,type:l.paddingRelativeTo,triggersBounds:c.any},{name:`bounds-expansion`,type:l.boundsExpansion,triggersBounds:c.any}],S=[{name:`border-color`,type:l.color},{name:`border-opacity`,type:l.zeroOneNumber},{name:`border-width`,type:l.size,triggersBounds:c.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}],C=[{name:`outline-color`,type:l.color},{name:`outline-opacity`,type:l.zeroOneNumber},{name:`outline-width`,type:l.size,triggersBounds:c.any},{name:`outline-style`,type:l.borderStyle},{name:`outline-offset`,type:l.size,triggersBounds:c.any}],w=[{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:c.any},{name:`compound-sizing-wrt-labels`,type:l.compoundIncludeLabels,triggersBounds:c.any},{name:`min-width`,type:l.size,triggersBounds:c.any},{name:`min-width-bias-left`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-width-bias-right`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height`,type:l.size,triggersBounds:c.any},{name:`min-height-bias-top`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height-bias-bottom`,type:l.sizeMaybePercent,triggersBounds:c.any}],E=[{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:c.any,triggersBoundsOfParallelEdges:function(e,t){return e===t?!1:e===`bezier`||t===`bezier`}},{name:`haystack-radius`,type:l.zeroOneNumber,triggersBounds:c.any},{name:`source-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`target-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`control-point-step-size`,type:l.size,triggersBounds:c.any},{name:`control-point-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`control-point-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`segment-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-radii`,type:l.numbers,triggersBounds:c.any},{name:`radius-type`,type:l.radiusType,triggersBounds:c.any},{name:`taxi-turn`,type:l.bidirectionalSizeMaybePercent,triggersBounds:c.any},{name:`taxi-turn-min-distance`,type:l.size,triggersBounds:c.any},{name:`taxi-direction`,type:l.axisDirection,triggersBounds:c.any},{name:`taxi-radius`,type:l.number,triggersBounds:c.any},{name:`edge-distances`,type:l.edgeDistances,triggersBounds:c.any},{name:`arrow-scale`,type:l.positiveNumber,triggersBounds:c.any},{name:`loop-direction`,type:l.angle,triggersBounds:c.any},{name:`loop-sweep`,type:l.angle,triggersBounds:c.any},{name:`source-distance-from-node`,type:l.size,triggersBounds:c.any},{name:`target-distance-from-node`,type:l.size,triggersBounds:c.any}],D=[{name:`ghost`,type:l.bool,triggersBounds:c.any},{name:`ghost-offset-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-offset-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-opacity`,type:l.zeroOneNumber}],O=[{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}],k=[];dd.pieBackgroundN=16,k.push({name:`pie-size`,type:l.sizeMaybePercent}),k.push({name:`pie-hole`,type:l.sizeMaybePercent}),k.push({name:`pie-start-angle`,type:l.angle});for(var A=1;A<=dd.pieBackgroundN;A++)k.push({name:`pie-`+A+`-background-color`,type:l.color}),k.push({name:`pie-`+A+`-background-size`,type:l.percent}),k.push({name:`pie-`+A+`-background-opacity`,type:l.zeroOneNumber});var j=[];dd.stripeBackgroundN=16,j.push({name:`stripe-size`,type:l.sizeMaybePercent}),j.push({name:`stripe-direction`,type:l.axisDirectionPrimary});for(var M=1;M<=dd.stripeBackgroundN;M++)j.push({name:`stripe-`+M+`-background-color`,type:l.color}),j.push({name:`stripe-`+M+`-background-size`,type:l.percent}),j.push({name:`stripe-`+M+`-background-opacity`,type:l.zeroOneNumber});var N=[],P=dd.arrowPrefixes=[`source`,`mid-source`,`target`,`mid-target`];[{name:`arrow-shape`,type:l.arrowShape,triggersBounds:c.any},{name:`arrow-color`,type:l.color},{name:`arrow-fill`,type:l.arrowFill},{name:`arrow-width`,type:l.arrowWidth}].forEach(function(e){P.forEach(function(t){var n=t+`-`+e.name,r=e.type,i=e.triggersBounds;N.push({name:n,type:r,triggersBounds:i})})},{});var F=dd.properties=[].concat(h,y,g,_,v,D,m,p,u,d,f,x,S,C,w,k,j,T,E,N,O),I=dd.propertyGroups={behavior:h,transition:y,visibility:g,overlay:_,underlay:v,ghost:D,commonLabel:m,labelDimensions:p,mainLabel:u,sourceLabel:d,targetLabel:f,nodeBody:x,nodeBorder:S,nodeOutline:C,backgroundImage:w,pie:k,stripe:j,compound:T,edgeLine:E,edgeArrow:N,core:O},L=dd.propertyGroupNames={};(dd.propertyGroupKeys=Object.keys(I)).forEach(function(e){L[e]=I[e].map(function(e){return e.name}),I[e].forEach(function(t){return t.groupKey=e})});var R=dd.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`}];dd.propertyNames=F.map(function(e){return e.name});for(var z=0;z<F.length;z++){var B=F[z];F[B.name]=B}for(var H=0;H<R.length;H++){var U=R[H],W=F[U.pointsTo],G={name:U.name,alias:!0,pointsTo:W};F.push(G),F[U.name]=G}})(),dd.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},dd.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=X({"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`,"box-selection":`contain`,"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(e,t){for(var n=1;n<=dd.pieBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"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(e,t){for(var n=1;n<=dd.stripeBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"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(e,t){return dd.arrowPrefixes.forEach(function(n){var r=n+`-`+t.name;e[r]=t.value}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a];n[a]=this.parse(a,o)}}return e.defaultProperties=n,e.defaultProperties},dd.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 fd={};fd.parse=function(e,t,n,r){var i=this;if(H(t))return i.parseImplWarn(e,t,n,r);var a=r===`mapping`||r===!0||r===!1||r==null?`dontcare`:r,o=n?`t`:`f`,s=Bt(e,``+t,o,a),c=i.propCache=i.propCache||[],l;return(l=c[s])||(l=c[s]=i.parseImplWarn(e,t,n,r)),(n||r===`mapping`)&&(l=rn(l),l&&(l.value=rn(l.value))),l},fd.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return!i&&t!=null&&tn(`The style property \`${e}: ${t}\` is invalid`),i&&(i.name===`width`||i.name===`height`)&&t===`label`&&tn("The style value of `label` is deprecated for `"+i.name+"`"),i},fd.parseImpl=function(e,t,n,r){var i=this;e=de(e);var a=i.properties[e],o=t,s=i.types;if(!a||t===void 0)return null;a.alias&&(a=a.pointsTo,e=a.name);var c=V(t);c&&(t=t.trim());var l=a.type;if(!l)return null;if(n&&(t===``||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(H(t))return{name:e,value:t,strValue:`fn`,mapped:s.fn,bypass:n};var u,d;if(!(!c||r||t.length<7||t[1]!==`a`)){if(t.length>=7&&t[0]===`d`&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var f=s.data;return{name:e,value:u,strValue:``+t,mapped:f,field:u[1],bypass:n}}else if(t.length>=10&&t[0]===`m`&&(d=new RegExp(s.mapData.regex).exec(t))){if(n||l.multiple)return!1;var p=s.mapData;if(!(l.color||l.number))return!1;var m=this.parse(e,d[4]);if(!m||m.mapped)return!1;var h=this.parse(e,d[5]);if(!h||h.mapped)return!1;if(m.pfValue===h.pfValue||m.strValue===h.strValue)return tn("`"+e+`: `+t+"` is not a valid mapper because the output range is zero; converting to `"+e+`: `+m.strValue+"`"),this.parse(e,m.strValue);if(l.color){var g=m.value,_=h.value;if(g[0]===_[0]&&g[1]===_[1]&&g[2]===_[2]&&(g[3]===_[3]||(g[3]==null||g[3]===1)&&(_[3]==null||_[3]===1)))return!1}return{name:e,value:d,strValue:``+t,mapped:p,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:m.value,valueMax:h.value,bypass:n}}}if(l.multiple&&r!==`multiple`){var v=c?t.split(/\s+/):U(t)?t:[t];if(l.evenMultiple&&v.length%2!=0)return null;for(var y=[],b=[],x=[],S=``,C=!1,w=0;w<v.length;w++){var T=i.parse(e,v[w],n,`multiple`);C||=V(T.value),y.push(T.value),x.push(T.pfValue==null?T.value:T.pfValue),b.push(T.units),S+=(w>0?` `:``)+T.strValue}return l.validate&&!l.validate(y,b)?null:l.singleEnum&&C?y.length===1&&V(y[0])?{name:e,value:y[0],strValue:y[0],bypass:n}:null:{name:e,value:y,pfValue:x,strValue:S,bypass:n,units:b}}var E=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:``+t,bypass:n};return null};if(l.number){var D,O=`px`;if(l.units&&(D=l.units),l.implicitUnits&&(O=l.implicitUnits),!l.unitless)if(c){var k=`px|em`+(l.allowPercent?`|\\%`:``);D&&(k=D);var A=t.match(`^(`+ge+`)(`+k+`)?$`);A&&(t=A[1],D=A[2]||O)}else (!D||l.implicitUnits)&&(D=O);if(t=parseFloat(t),isNaN(t)&&l.enums===void 0)return null;if(isNaN(t)&&l.enums!==void 0)return t=o,E();if(l.integer&&!q(t)||l.min!==void 0&&(t<l.min||l.strictMin&&t===l.min)||l.max!==void 0&&(t>l.max||l.strictMax&&t===l.max))return null;var j={name:e,value:t,strValue:``+t+(D||``),units:D,bypass:n};return l.unitless||D!==`px`&&D!==`em`?j.pfValue=t:j.pfValue=D===`px`||!D?t:this.getEmSizeInPixels()*t,(D===`ms`||D===`s`)&&(j.pfValue=D===`ms`?t:1e3*t),(D===`deg`||D===`rad`)&&(j.pfValue=D===`rad`?t:Qn(t)),D===`%`&&(j.pfValue=t/100),j}else if(l.propList){var M=[],N=``+t;if(N!==`none`){for(var P=N.split(/\s*,\s*|\s+/),F=0;F<P.length;F++){var I=P[F].trim();i.properties[I]?M.push(I):tn("`"+I+"` is not a valid property name")}if(M.length===0)return null}return{name:e,value:M,strValue:M.length===0?`none`:M.join(` `),bypass:n}}else if(l.color){var L=ke(t);return L?{name:e,value:L,pfValue:L,strValue:`rgb(`+L[0]+`,`+L[1]+`,`+L[2]+`)`,bypass:n}:null}else if(l.regex||l.regexes){if(l.enums){var R=E();if(R)return R}for(var z=l.regexes?l.regexes:[l.regex],B=0;B<z.length;B++){var W=new RegExp(z[B]).exec(t);if(W)return{name:e,value:l.singleRegexMatchValue?W[1]:W,strValue:``+t,bypass:n}}return null}else if(l.string)return{name:e,value:``+t,strValue:``+t,bypass:n};else if(l.enums)return E();else return null};var pd=function(e){if(!(this instanceof pd))return new pd(e);if(!ne(e)){$t(`A style must have a core reference`);return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},md=pd.prototype;md.instanceString=function(){return`style`},md.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},md.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},md.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},md.selector=function(e){var t=e===`core`?null:new Qc(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},md.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];a===void 0&&(a=n[fe(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else t.length===2&&this.cssRule(t[0],t[1]);return this},md.style=md.css,md.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},md.append=function(e){return re(e)?e.appendToStyle(this):U(e)?this.appendFromJson(e):V(e)&&this.appendFromString(e),this},pd.fromJson=function(e,t){var n=new pd(e);return n.fromJson(t),n},pd.fromString=function(e,t){return new pd(e).fromString(t)},[rd,od,sd,cd,ld,ud,dd,fd].forEach(function(e){X(md,e)}),pd.types=md.types,pd.properties=md.properties,pd.propertyGroups=md.propertyGroups,pd.propertyGroupNames=md.propertyGroupNames,pd.propertyGroupKeys=md.propertyGroupKeys;var hd={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return re(e)?t.style=e.generateStyle(this):U(e)?t.style=pd.fromJson(this,e):V(e)?t.style=pd.fromString(this,e):t.style=pd(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},gd=`single`,_d={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 t=this._private;if(t.selectionType??=gd,e!==void 0)(e===`additive`||e===`single`)&&(t.selectionType=e);else return t.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,t=this._private.pan,n,r,i,a,o;switch(e.length){case 0:return t;case 1:if(V(e[0]))return n=e[0],t[n];if(W(e[0])){if(!this._private.panningEnabled)return this;i=e[0],a=i.x,o=i.y,K(a)&&(t.x=a),K(o)&&(t.y=o),this.emit(`pan viewport`)}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n===`x`||n===`y`)&&K(r)&&(t[n]=r),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},panBy:function(e,t){var n=arguments,r=this._private.pan,i,a,o,s,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:W(e)&&(o=n[0],s=o.x,c=o.y,K(s)&&(r.x+=s),K(c)&&(r.y+=c),this.emit(`pan viewport`));break;case 2:i=e,a=t,(i===`x`||i===`y`)&&K(a)&&(r[i]+=a),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},gc:function(){this.notify(`gc`)},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit(`pan zoom viewport`),this.notify(`viewport`)}return this},getFitViewport:function(e,t){if(K(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(V(e)){var r=e;e=this.$(r)}else if(se(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else Y(e)||(e=this.mutableElements());if(!(Y(e)&&e.empty())){n||=e.boundingBox();var a=this.width(),o=this.height(),s;if(t=K(t)?t:0,!isNaN(a)&&!isNaN(o)&&a>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){s=Math.min((a-2*t)/n.w,(o-2*t)/n.h),s=s>this._private.maxZoom?this._private.maxZoom:s,s=s<this._private.minZoom?this._private.minZoom:s;var c={x:(a-s*(n.x1+n.x2))/2,y:(o-s*(n.y1+n.y2))/2};return{zoom:s,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return K(e)&&K(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):K(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:K(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),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 t=this._private,n=t.pan,r=t.zoom,i,a,o=!1;if(t.zoomingEnabled||(o=!0),K(e)?a=e:W(e)&&(a=e.level,e.position==null?e.renderedPosition!=null&&(i=e.renderedPosition):i=Gn(e.position,r,n),i!=null&&!t.panningEnabled&&(o=!0)),a=a>t.maxZoom?t.maxZoom:a,a=a<t.minZoom?t.minZoom:a,o||!K(a)||a===r||i!=null&&(!K(i.x)||!K(i.y)))return null;if(i!=null){var s=n,c=r,l=a;return{zoomed:!0,panned:!0,zoom:l,pan:{x:-l/c*(i.x-s.x)+i.x,y:-l/c*(i.y-s.y)+i.y}}}else return{zoomed:!0,panned:!1,zoom:a,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit(`zoom`+(t.panned?` pan`:``)+` viewport`),this.notify(`viewport`),this)},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e||(K(e.zoom)||(n=!1),W(e.pan)||(r=!1),!n&&!r))return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push(`zoom`))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var c=e.pan;K(c.x)&&(t.pan.x=c.x,o=!1),K(c.y)&&(t.pan.y=c.y,o=!1),o||i.push(`pan`)}return i.length>0&&(i.push(`viewport`),this.emit(i.join(` `)),this.notify(`viewport`)),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit(`pan viewport`),this.notify(`viewport`)),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(V(e)){var n=e;e=this.mutableElements().filter(n)}else Y(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),i=this.width(),a=this.height();return t=t===void 0?this._private.zoom:t,{x:(i-t*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled||this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r(`padding-left`)-r(`padding-right`),height:t.clientHeight-r(`padding-top`)-r(`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,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};_d.centre=_d.center,_d.autolockNodes=_d.autolock,_d.autoungrabifyNodes=_d.autoungrabify;var vd={data:Ac.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeData:Ac.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),scratch:Ac.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:Ac.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0})};vd.attr=vd.data,vd.removeAttr=vd.removeData;var yd=function(e){var t=this;e=X({},e);var n=e.container;n&&!J(n)&&J(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r||={},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=P!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=X({name:a?`grid`:`null`},o.layout),o.renderer=X({name:a?`canvas`:`null`},o.renderer);var s=function(e,t,n){return t===void 0?n===void 0?e:n:t},c=this._private={container:n,ready:!1,options:o,elements:new Nu(this),listeners:[],aniEles:new Nu(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?a:o.styleEnabled,zoom:K(o.zoom)?o.zoom:1,pan:{x:W(o.pan)&&K(o.pan.x)?o.pan.x:0,y:W(o.pan)&&K(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var l=function(e,t){if(e.some(ce))return ka.all(e).then(t);t(e)};c.styleEnabled&&t.setStyle([]);var u=X({},o,o.renderer);t.initRenderer(u);var d=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),e!=null&&(W(e)||U(e))&&t.add(e),t.one(`layoutready`,function(e){t.notifications(!0),t.emit(e),t.one(`load`,n),t.emitAndNotify(`load`)}).one(`layoutstop`,function(){t.one(`done`,r),t.emit(`done`)});var a=X({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};l([o.style,o.elements],function(e){var n=e[0],a=e[1];c.styleEnabled&&t.style().append(n),d(a,function(){t.startAnimationLoop(),c.ready=!0,H(o.ready)&&t.on(`ready`,o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on(`ready`,n)}r&&(r.readies=[]),t.emit(`ready`)},o.done)})},bd=yd.prototype;X(bd,{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(){if(this._private.container==null)return P;var e=this._private.container.ownerDocument;return e===void 0||e==null?P:e.defaultView||P},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!J(e)&&J(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(X({},r,r.renderer,{name:r.renderer.name===`null`?`canvas`:r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit(`mount`),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:`null`}),e.emit(`unmount`),e},options:function(){return rn(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(e){return t.getElementById(e.id())};if(W(e)){if(t.startBatch(),e.elements){var a={},o=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){tn(`cy.json() cannot handle elements without an ID attribute`);continue}var c=``+s.data.id,l=t.getElementById(c);a[c]=!0,l.length===0?(n&&(s.group=n),r.push(s)):i.push({ele:l,json:s})}t.add(r);for(var u=0;u<i.length;u++){var d=i[u],f=d.ele,p=d.json;f.json(p)}};if(U(e.elements))o(e.elements);else for(var s=[`nodes`,`edges`],c=0;c<s.length;c++){var l=s[c],u=e.elements[l];U(u)&&o(u,l)}var d=t.collection();r.filter(function(e){return!a[e.id()]}).forEach(function(e){e.isParent()?d.merge(e):e.remove()}),d.forEach(function(e){return e.children().move({parent:null})}),d.forEach(function(e){return i(e).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var f=[`minZoom`,`maxZoom`,`zoomingEnabled`,`userZoomingEnabled`,`panningEnabled`,`userPanningEnabled`,`boxSelectionEnabled`,`autolock`,`autoungrabify`,`autounselectify`,`multiClickDebounceTime`],p=0;p<f.length;p++){var m=f[p];e[m]!=null&&t[m](e[m])}return t.endBatch(),this}else{var h=!!e,g={};h?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},r.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=rn(t.data());var _=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=rn(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=rn(_.renderer),g.hideEdgesOnViewport=_.hideEdgesOnViewport,g.textureOnViewport=_.textureOnViewport,g.wheelSensitivity=_.wheelSensitivity,g.motionBlur=_.motionBlur,g.multiClickDebounceTime=_.multiClickDebounceTime,g}}}),bd.$id=bd.getElementById,[Fu,qu,Xu,Zu,Qu,$u,td,nd,hd,_d,vd].forEach(function(e){X(bd,e)});var xd={fit:!0,directed:!1,direction:`downward`,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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},Sd={maximal:!1,acyclic:!1},Cd=function(e){return e.scratch(`breadthfirst`)},wd=function(e,t){return e.scratch(`breadthfirst`,t)};function Td(e){this.options=X({},xd,Sd,e)}Td.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(e){return e.isChildless()}),i=n,a=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,s=!!e.boundingBox,c=lr(s?e.boundingBox:structuredClone(t.extent())),l;if(Y(e.roots))l=e.roots;else if(U(e.roots)){for(var u=[],d=0;d<e.roots.length;d++){var f=e.roots[d],p=t.getElementById(f);u.push(p)}l=t.collection(u)}else if(V(e.roots))l=t.$(e.roots);else if(a)l=r.roots();else{var m=n.components();l=t.collection();for(var h=function(){var e=m[g],t=e.maxDegree(!1),n=e.filter(function(e){return e.degree(!1)===t});l=l.add(n)},g=0;g<m.length;g++)h()}var _=[],v={},y=function(e,t){_[t]??(_[t]=[]);var n=_[t].length;_[t].push(e),wd(e,{index:n,depth:t})},b=function(e,t){var n=Cd(e),r=n.depth,i=n.index;_[r][i]=null,e.isChildless()&&y(e,t)};i.bfs({roots:l,directed:e.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&y(a,i),v[o]=!0}});for(var x=[],S=0;S<r.length;S++){var C=r[S];v[C.id()]||x.push(C)}var w=function(e){for(var t=_[e],n=0;n<t.length;n++){var r=t[n];if(r==null){t.splice(n,1),n--;continue}wd(r,{depth:e,index:n})}},T=function(t,r){for(var i=Cd(t),a=t.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=t.id(),c=0;c<a.length;c++){var l=a[c],u=Cd(l);o=Math.max(o,u.depth)}if(i.depth<=o){if(!e.acyclic&&r[s])return null;var d=o+1;return b(t,d),r[s]=d,!0}return!1};if(a&&o){var E=[],D={},O=function(e){return E.push(e)},k=function(){return E.shift()};for(r.forEach(function(e){return E.push(e)});E.length>0;){var A=k(),j=T(A,D);if(j)A.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(O);else if(j===null){tn("Detected double maximal shift for node `"+A.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(e.avoidOverlap)for(var N=0;N<r.length;N++){var P=r[N].layoutDimensions(e),F=P.w,I=P.h;M=Math.max(M,F,I)}var L={},R=function(e){if(L[e.id()])return L[e.id()];for(var t=Cd(e).depth,n=e.neighborhood(),i=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent()||!r.has(s))){var c=Cd(s);if(c!=null){var l=c.index,u=c.depth;if(!(l==null||u==null)){var d=_[u].length;u<t&&(i+=l/d,a++)}}}}return a=Math.max(1,a),i/=a,a===0&&(i=0),L[e.id()]=i,i},z=function(e,t){var n=R(e)-R(t);return n===0?Ce(e.id(),t.id()):n};e.depthSort!==void 0&&(z=e.depthSort);for(var B=_.length,H=0;H<B;H++)_[H].sort(z),w(H);for(var W=[],G=0;G<x.length;G++)W.push(x[G]);W.length&&(_.unshift(W),B=_.length,function(){for(var e=0;e<B;e++)w(e)}());for(var K=0,q=0;q<B;q++)K=Math.max(_[q].length,K);var J={x:c.x1+c.w/2,y:c.y1+c.h/2},ee=r.reduce(function(t,n){return function(e){return{w:t.w===-1?e.w:(t.w+e.w)/2,h:t.h===-1?e.h:(t.h+e.h)/2}}(n.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),te=Math.max(B===1?0:s?(c.h-e.padding*2-ee.h)/(B-1):(c.h-e.padding*2-ee.h)/(B+1),M),ne=_.reduce(function(e,t){return Math.max(e,t.length)},0),re=function(t){var n=Cd(t),r=n.depth,i=n.index;if(e.circle){var a=Math.min(c.w/2/B,c.h/2/B);a=Math.max(a,M);var o=a*r+a-(B>0&&_[0].length<=3?a/2:0),l=2*Math.PI/_[r].length*i;return r===0&&_[0].length===1&&(o=1),{x:J.x+o*Math.cos(l),y:J.y+o*Math.sin(l)}}else{var u=_[r].length,d=Math.max(u===1?0:s?(c.w-e.padding*2-ee.w)/((e.grid?ne:u)-1):(c.w-e.padding*2-ee.w)/((e.grid?ne:u)+1),M);return{x:J.x+(i+1-(u+1)/2)*d,y:J.y+(r+1-(B+1)/2)*te}}},ie={downward:0,leftward:90,upward:180,rightward:-90};return Object.keys(ie).indexOf(e.direction)===-1&&$t(`Invalid direction '${e.direction}' specified for breadthfirst layout. Valid values are: ${Object.keys(ie).join(`, `)}`),n.nodes().layoutPositions(this,e,function(t){return Wt(re(t),c,ie[e.direction])}),this};var Ed={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Dd(e){this.options=X({},Ed,e)}Dd.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,a=r.nodes().not(`:parent`);t.sort&&(a=a.sort(t.sort));for(var o=lr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=(t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),l,u=0,d=0;d<a.length;d++){var f=a[d].layoutDimensions(t),p=f.w,m=f.h;u=Math.max(u,p,m)}if(l=K(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){u*=1.75;var h=Math.cos(c)-Math.cos(0),g=Math.sin(c)-Math.sin(0),_=Math.sqrt(u*u/(h*h+g*g));l=Math.max(_,l)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=l*Math.cos(r),o=l*Math.sin(r);return{x:s.x+a,y:s.y+o}}),this};var Od={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function kd(e){this.options=X({},Od,e)}kd.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,r=e.cy,i=t.eles,a=i.nodes().not(`:parent`),o=lr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=[],l=0,u=0;u<a.length;u++){var d=a[u],f=void 0;f=t.concentric(d),c.push({value:f,node:d}),d._private.scratch.concentric=f}a.updateStyle();for(var p=0;p<a.length;p++){var m=a[p].layoutDimensions(t);l=Math.max(l,m.w,m.h)}c.sort(function(e,t){return t.value-e.value});for(var h=t.levelWidth(a),g=[[]],_=g[0],v=0;v<c.length;v++){var y=c[v];_.length>0&&Math.abs(_[0].value-y.value)>=h&&(_=[],g.push(_)),_.push(y)}var b=l+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,S=(Math.min(o.w,o.h)/2-b)/(g.length+x?1:0);b=Math.min(b,S)}for(var C=0,w=0;w<g.length;w++){var T=g[w],E=T.dTheta=(t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep)/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var D=Math.cos(E)-Math.cos(0),O=Math.sin(E)-Math.sin(0),k=Math.sqrt(b*b/(D*D+O*O));C=Math.max(k,C)}T.r=C,C+=b}if(t.equidistant){for(var A=0,j=0,M=0;M<g.length;M++){var N=g[M].r-j;A=Math.max(A,N)}j=0;for(var P=0;P<g.length;P++){var F=g[P];P===0&&(j=F.r),F.r=j,j+=A}}for(var I={},L=0;L<g.length;L++)for(var R=g[L],z=R.dTheta,B=R.r,V=0;V<R.length;V++){var H=R[V],U=t.startAngle+(n?1:-1)*z*V,W={x:s.x+B*Math.cos(U),y:s.y+B*Math.sin(U)};I[H.node.id()]=W}return i.nodes().layoutPositions(this,t,function(e){return I[e.id()]}),this};var Ad,jd={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){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 Md(e){this.options=X({},jd,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data(`id`),r=e.target().data(`id`),i=t.some(function(e){return e.data(`id`)===n}),a=t.some(function(e){return e.data(`id`)===r});return!i||!a});this.options.eles=this.options.eles.not(n)}Md.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:`layoutstart`,layout:n}),Ad=!0===e.debug;var r=Nd(t,n,e);Ad&&Id(r),e.randomize&&Ld(r);var i=Ot(),a=function(){zd(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(Bd(r,e),r.temperature*=e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)a(),n.one(`layoutstop`,e.stop),n.emit({type:`layoutstop`,layout:n});else{var t=e.eles.nodes(),i=Rd(r,e,t);t.layoutPositions(n,e,i)}},c=0,l=!0;if(e.animate===!0){var u=function(){for(var t=0;l&&t<e.refresh;)l=o(c),c++,t++;l?(Ot()-i>=e.animationThreshold&&a(),Dt(u)):(Qd(r,e),s())};u()}else{for(;l;)l=o(c),c++;Qd(r,e),s()}return this},Md.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit(`layoutstop`),this},Md.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Nd=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=lr(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),c={},l=0;l<s.length;l++)for(var u=s[l],d=0;d<u.length;d++){var f=u[d];c[f.id()]=l}for(var l=0;l<o.nodeSize;l++){var p=i[l],m=p.layoutDimensions(n),h={};h.isLocked=p.locked(),h.id=p.data(`id`),h.parentId=p.data(`parent`),h.cmptId=c[p.id()],h.children=[],h.positionX=p.position(`x`),h.positionY=p.position(`y`),h.offsetX=0,h.offsetY=0,h.height=m.w,h.width=m.h,h.maxX=h.positionX+h.width/2,h.minX=h.positionX-h.width/2,h.maxY=h.positionY+h.height/2,h.minY=h.positionY-h.height/2,h.padLeft=parseFloat(p.style(`padding`)),h.padRight=parseFloat(p.style(`padding`)),h.padTop=parseFloat(p.style(`padding`)),h.padBottom=parseFloat(p.style(`padding`)),h.nodeRepulsion=H(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,o.layoutNodes.push(h),o.idToIndex[h.id]=l}for(var g=[],_=0,v=-1,y=[],l=0;l<o.nodeSize;l++){var p=o.layoutNodes[l],b=p.parentId;b==null?(g[++v]=p.id,y.push(p.id)):o.layoutNodes[o.idToIndex[b]].children.push(p.id)}for(o.graphSet.push(y);_<=v;){var x=g[_++],S=o.idToIndex[x],f=o.layoutNodes[S],C=f.children;if(C.length>0){o.graphSet.push(C);for(var l=0;l<C.length;l++)g[++v]=C[l]}}for(var l=0;l<o.graphSet.length;l++)for(var w=o.graphSet[l],d=0;d<w.length;d++){var T=o.idToIndex[w[d]];o.indexToGraph[T]=l}for(var l=0;l<o.edgeSize;l++){var E=r[l],D={};D.id=E.data(`id`),D.sourceId=E.data(`source`),D.targetId=E.data(`target`);var O=H(n.idealEdgeLength)?n.idealEdgeLength(E):n.idealEdgeLength,k=H(n.edgeElasticity)?n.edgeElasticity(E):n.edgeElasticity,A=o.idToIndex[D.sourceId],j=o.idToIndex[D.targetId];if(o.indexToGraph[A]!=o.indexToGraph[j]){for(var M=Pd(D.sourceId,D.targetId,o),N=o.graphSet[M],P=0,h=o.layoutNodes[A];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;for(h=o.layoutNodes[j];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;O*=P*n.nestingFactor}D.idealLength=O,D.elasticity=k,o.layoutEdges.push(D)}return o},Pd=function(e,t,n){var r=Fd(e,t,0,n);return 2>r.count?0:r.graph},Fd=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],c=r.idToIndex[s],l=r.layoutNodes[c].children;if(l.length!==0){var u=r.indexToGraph[r.idToIndex[l[0]]],d=Fd(e,t,u,r);if(d.count!==0)if(d.count===1){if(a++,a===2)break}else return d}}return{count:a,graph:n}},Id,Ld=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];a.children.length===0&&!a.isLocked&&(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},Rd=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data(`id`)]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data(`id`)]];if(t.boundingBox){var s=i.w===0?.5:(o.positionX-i.x1)/i.w,c=i.h===0?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+c*r.h}}else return{x:o.positionX,y:o.positionY}}},zd=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=Rd(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one(`layoutready`,n.ready),r.emit({type:`layoutready`,layout:this}))},Bd=function(e,t,n){Vd(e,t),Kd(e),qd(e,t),Jd(e),Yd(e)},Vd=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var c=e.layoutNodes[e.idToIndex[r[s]]];Ud(o,c,e,t)}},Hd=function(e){return-1+2*e*Math.random()},Ud=function(e,t,n,r){if(!(e.cmptId!==t.cmptId&&!n.isCompound)){var i=t.positionX-e.positionX,a=t.positionY-e.positionY,o=1;i===0&&a===0&&(i=Hd(o),a=Hd(o));var s=Wd(e,t,i,a);if(s>0)var c=r.nodeOverlap*s,l=Math.sqrt(i*i+a*a),u=c*i/l,d=c*a/l;else var f=Gd(e,i,a),p=Gd(t,-1*i,-1*a),m=p.x-f.x,h=p.y-f.y,g=m*m+h*h,l=Math.sqrt(g),c=(e.nodeRepulsion+t.nodeRepulsion)/g,u=c*m/l,d=c*h/l;e.isLocked||(e.offsetX-=u,e.offsetY-=d),t.isLocked||(t.offsetX+=u,t.offsetY+=d)}},Wd=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},Gd=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,c=a/o,l={};return t===0&&0<n||t===0&&0>n?(l.x=r,l.y=i+a/2,l):0<t&&-1*c<=s&&s<=c?(l.x=r+o/2,l.y=i+o*n/2/t,l):0>t&&-1*c<=s&&s<=c?(l.x=r-o/2,l.y=i-o*n/2/t,l):0<n&&(s<=-1*c||s>=c)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(s<=-1*c||s>=c)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},Kd=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],c=s.positionX-a.positionX,l=s.positionY-a.positionY;if(!(c===0&&l===0)){var u=Gd(a,c,l),d=Gd(s,-1*c,-1*l),f=d.x-u.x,p=d.y-u.y,m=Math.sqrt(f*f+p*p),h=(r.idealLength-m)**2/r.elasticity;if(m!==0)var g=h*f/m,_=h*p/m;else var g=0,_=0;a.isLocked||(a.offsetX+=g,a.offsetY+=_),s.isLocked||(s.offsetX-=g,s.offsetY-=_)}}},qd=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],a=i.length;if(r===0)var o=e.clientHeight/2,s=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[i[0]]],l=e.layoutNodes[e.idToIndex[c.parentId]],o=l.positionX,s=l.positionY;for(var u=0;u<a;u++){var d=e.layoutNodes[e.idToIndex[i[u]]];if(!d.isLocked){var f=o-d.positionX,p=s-d.positionY,m=Math.sqrt(f*f+p*p);if(m>n){var h=t.gravity*f/m,g=t.gravity*p/m;d.offsetX+=h,d.offsetY+=g}}}}},Jd=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],c=s.children;if(0<c.length&&!s.isLocked){for(var l=s.offsetX,u=s.offsetY,d=0;d<c.length;d++){var f=e.layoutNodes[e.idToIndex[c[d]]];f.offsetX+=l,f.offsetY+=u,n[++i]=c[d]}s.offsetX=0,s.offsetY=0}}},Yd=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var i=Xd(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,Zd(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},Xd=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},Zd=function(e,t){var n=e.parentId;if(n!=null){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((r.maxX==null||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(r.minX==null||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(r.maxY==null||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(r.minY==null||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return Zd(r,t)}},Qd=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var c=r[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var l=0;l<c.length;l++){var u=c[l];c.x1=Math.min(c.x1,u.positionX-u.width/2),c.x2=Math.max(c.x2,u.positionX+u.width/2),c.y1=Math.min(c.y1,u.positionY-u.height/2),c.y2=Math.max(c.y2,u.positionY+u.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,s+=c.w*c.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var d=0,f=0,p=0,m=0,h=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var c=r[i];if(c){for(var l=0;l<c.length;l++){var u=c[l];u.isLocked||(u.positionX+=d-c.x1,u.positionY+=f-c.y1)}d+=c.w+t.componentSpacing,p+=c.w+t.componentSpacing,m=Math.max(m,c.h),p>h&&(f+=m+t.componentSpacing,d=0,p=0,m=0)}}},$d={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ef(e){this.options=X({},$d,e)}ef.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(`:parent`);t.sort&&(i=i.sort(t.sort));var a=lr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(a.h===0||a.w===0)r.nodes().layoutPositions(this,t,function(e){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),c=Math.round(s),l=Math.round(a.w/a.h*s),u=function(e){if(e==null)return Math.min(c,l);Math.min(c,l)==c?c=e:l=e},d=function(e){if(e==null)return Math.max(c,l);Math.max(c,l)==c?c=e:l=e},f=t.rows,p=t.cols==null?t.columns:t.cols;if(f!=null&&p!=null)c=f,l=p;else if(f!=null&&p==null)c=f,l=Math.ceil(o/c);else if(f==null&&p!=null)l=p,c=Math.ceil(o/l);else if(l*c>o){var m=u(),h=d();(m-1)*h>=o?u(m-1):(h-1)*m>=o&&d(h-1)}else for(;l*c<o;){var g=u(),_=d();(_+1)*g>=o?d(_+1):u(g+1)}var v=a.w/l,y=a.h/c;if(t.condense&&(v=0,y=0),t.avoidOverlap)for(var b=0;b<i.length;b++){var x=i[b],S=x._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var C=x.layoutDimensions(t),w=t.avoidOverlapPadding,T=C.w+w,E=C.h+w;v=Math.max(v,T),y=Math.max(y,E)}for(var D={},O=function(e,t){return!!D[`c-`+e+`-`+t]},k=function(e,t){D[`c-`+e+`-`+t]=!0},A=0,j=0,M=function(){j++,j>=l&&(j=0,A++)},N={},P=0;P<i.length;P++){var F=i[P],I=t.position(F);if(I&&(I.row!==void 0||I.col!==void 0)){var L={row:I.row,col:I.col};if(L.col===void 0)for(L.col=0;O(L.row,L.col);)L.col++;else if(L.row===void 0)for(L.row=0;O(L.row,L.col);)L.row++;N[F.id()]=L,k(L.row,L.col)}}i.layoutPositions(this,t,function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=N[e.id()];if(i)n=i.col*v+v/2+a.x1,r=i.row*y+y/2+a.y1;else{for(;O(A,j);)M();n=j*v+v/2+a.x1,r=A*y+y/2+a.y1,k(A,j),M()}return{x:n,y:r}})}return this};var tf={ready:function(){},stop:function(){}};function nf(e){this.options=X({},tf,e)}nf.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit(`layoutstart`),t.nodes().positions(function(){return{x:0,y:0}}),n.one(`layoutready`,e.ready),n.emit(`layoutready`),n.one(`layoutstop`,e.stop),n.emit(`layoutstop`),this},nf.prototype.stop=function(){return this};var rf={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function af(e){this.options=X({},rf,e)}af.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=H(e.positions);function r(t){return e.positions==null?Wn(t.position()):n?e.positions(t):e.positions[t._private.data.id]??null}return t.layoutPositions(this,e,function(e,t){var n=r(e);return e.locked()||n==null?!1:n}),this};var of={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function sf(e){this.options=X({},of,e)}sf.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=lr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var cf=[{name:`breadthfirst`,impl:Td},{name:`circle`,impl:Dd},{name:`concentric`,impl:kd},{name:`cose`,impl:Md},{name:`grid`,impl:ef},{name:`null`,impl:nf},{name:`preset`,impl:af},{name:`random`,impl:sf}];function lf(e){this.options=e,this.notifications=0}var uf=function(){},df=function(){throw Error(`A headless instance can not render images`)};lf.prototype={recalculateRenderedStyle:uf,notify:function(){this.notifications++},init:uf,isHeadless:function(){return!0},png:df,jpg:df};var ff={};ff.arrowShapeWidth=.3,ff.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,c=i.x+n/2+o,l=i.y-n/2-o,u=i.y+n/2+o;return s<=e&&e<=c&&l<=t&&t<=u},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r),s=a*n,c=o*n;return{x:s+i.x,y:c+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],c=e[o+1];a.push(r(s,c,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).pfValue*2},s=function(r,s){V(s)&&(s=e[s]),e[r]=X({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return jr(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl(`polygon`)(e,o)},spacing:function(e){return 0},gap:o},s)};s(`none`,{collide:Xt,roughCollide:Xt,draw:Qt,spacing:Zt,gap:Zt}),s(`triangle`,{points:[-.15,-.3,0,0,.15,-.3]}),s(`arrow`,`triangle`),s(`triangle-backcurve`,{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var c=i(this.points,n,a,o),l=this.controlPoint,u=r(l[0],l[1],n,a,o);t.arrowShapeImpl(this.name)(e,c,u)},gap:function(e){return o(e)*.8}}),s(`triangle-tee`,{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.pointsTee,n+2*c,r,o));return jr(e,t,l)||jr(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`circle-triangle`,{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,c){var l=o,u=(l.x-e)**2+(l.y-t)**2<=((n+2*c)*this.radius)**2;return jr(e,t,a(i(this.points,n+2*c,r,o)))||u},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.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(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,i=3,a=5;return n[i]=n[i]-r,n[a]=n[a]-r,n},collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.crossLinePts(n,s),n+2*c,r,o));return jr(e,t,l)||jr(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`vee`,{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return o(e)*.525}}),s(`circle`,{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return(s.x-e)**2+(s.y-t)**2<=((n+2*o)*this.radius)**2},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`tee`,{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){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(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}}),s(`chevron`,{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}})};var pf={};pf.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),c=n.zoom();return[((e-i)/o-s.x)/c,((t-a)/o-s.y)/c]},pf.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r(`padding-left`),right:r(`padding-right`),top:r(`padding-top`),bottom:r(`padding-bottom`)},a={left:r(`border-left-width`),right:r(`border-right-width`),top:r(`border-top-width`),bottom:r(`border-bottom-width`)},o=e.clientWidth,s=e.clientHeight,c=i.left+i.right,l=i.top+i.bottom,u=a.left+a.right,d=t.width/(o+u),f=o-c,p=s-l;return this.containerBB=[t.left+i.left+a.left,t.top+i.top+a.top,f,p,d]},pf.invalidateContainerClientCoordsCache=function(){this.containerBB=null},pf.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},pf.findNearestElements=function(e,t,n,r){var i=this,a=this,o=a.getCachedZSortedEles(),s=[],c=a.cy.zoom(),l=a.cy.hasCompoundNodes(),u=(r?24:8)/c,d=(r?8:2)/c,f=(r?8:2)/c,p=1/0,m,h;n&&(o=o.interactive);function g(e,t){if(e.isNode()){if(h)return;h=e,s.push(e)}if(e.isEdge()&&(t==null||t<p))if(m){if(m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value&&m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value){for(var n=0;n<s.length;n++)if(s[n].isEdge()){s[n]=e,m=e,p=t??p;break}}}else s.push(e),m=e,p=t??p}function _(n){var r=n.outerWidth()+2*d,o=n.outerHeight()+2*d,s=r/2,c=o/2,l=n.position(),u=n.pstyle(`corner-radius`).value===`auto`?`auto`:n.pstyle(`corner-radius`).pfValue,f=n._private.rscratch;if(l.x-s<=e&&e<=l.x+s&&l.y-c<=t&&t<=l.y+c&&a.nodeShapes[i.getNodeShape(n)].checkPoint(e,t,0,r,o,l.x,l.y,u,f))return g(n,0),!0}function v(n){var r=n._private,o=r.rscratch,c=n.pstyle(`width`).pfValue,d=n.pstyle(`arrow-scale`).value,f=c/2+u,p=f*f,m=f*2,h=r.source,v=r.target,y;if(o.edgeType===`segments`||o.edgeType===`straight`||o.edgeType===`haystack`){for(var b=o.allpts,x=0;x+3<b.length;x+=2)if(Tr(e,t,b[x],b[x+1],b[x+2],b[x+3],m)&&p>(y=Ar(e,t,b[x],b[x+1],b[x+2],b[x+3])))return g(n,y),!0}else if(o.edgeType===`bezier`||o.edgeType===`multibezier`||o.edgeType===`self`||o.edgeType===`compound`){for(var b=o.allpts,x=0;x+5<o.allpts.length;x+=4)if(Er(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5],m)&&p>(y=kr(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5])))return g(n,y),!0}for(var h=h||r.source,v=v||r.target,S=i.getArrowWidth(c,d),C=[{name:`source`,x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:`target`,x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:`mid-source`,x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:`mid-target`,x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}],x=0;x<C.length;x++){var w=C[x],T=a.arrowShapes[n.pstyle(w.name+`-arrow-shape`).value],E=n.pstyle(`width`).pfValue;if(T.roughCollide(e,t,S,w.angle,{x:w.x,y:w.y},E,u)&&T.collide(e,t,S,w.angle,{x:w.x,y:w.y},E,u))return g(n),!0}l&&s.length>0&&(_(h),_(v))}function y(e,t,n){return pn(e,t,n)}function b(n,r){var i=n._private,a=f,o=r?r+`-`:``;n.boundingBox();var s=i.labelBounds[r||`main`],c=n.pstyle(o+`label`).value;if(!(n.pstyle(`text-events`).strValue!==`yes`||!c)){var l=y(i.rscratch,`labelX`,r),u=y(i.rscratch,`labelY`,r),d=y(i.rscratch,`labelAngle`,r),p=n.pstyle(o+`text-margin-x`).pfValue,m=n.pstyle(o+`text-margin-y`).pfValue,h=s.x1-a-p,_=s.x2+a-p,v=s.y1-a-m,b=s.y2+a-m;if(d){var x=Math.cos(d),S=Math.sin(d),C=function(e,t){return e-=l,t-=u,{x:e*x-t*S+l,y:e*S+t*x+u}},w=C(h,v),T=C(h,b),E=C(_,v),D=C(_,b);if(jr(e,t,[w.x+p,w.y+m,E.x+p,E.y+m,D.x+p,D.y+m,T.x+p,T.y+m]))return g(n),!0}else if(vr(s,e,t))return g(n),!0}}for(var x=o.length-1;x>=0;x--){var S=o[x];S.isNode()?_(S)||b(S):v(S)||b(S)||b(S,`source`)||b(S,`target`)}return s},pf.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),c=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=s,n=c,t=l,r=u;var d=lr({x1:e,y1:t,x2:n,y2:r}),f=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function m(e,t,n){return pn(e,t,n)}function h(e,t){var n=e._private,r=a,i=``;e.boundingBox();var o=n.labelBounds.main;if(!o)return null;var s=m(n.rscratch,`labelX`,t),c=m(n.rscratch,`labelY`,t),l=m(n.rscratch,`labelAngle`,t),u=e.pstyle(i+`text-margin-x`).pfValue,d=e.pstyle(i+`text-margin-y`).pfValue,f=o.x1-r-u,p=o.x2+r-u,h=o.y1-r-d,g=o.y2+r-d;if(l){var _=Math.cos(l),v=Math.sin(l),y=function(e,t){return e-=s,t-=c,{x:e*_-t*v+s,y:e*v+t*_+c}};return[y(f,h),y(p,h),y(p,g),y(f,g)]}else return[{x:f,y:h},{x:p,y:h},{x:p,y:g},{x:f,y:g}]}function g(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}for(var _=0;_<i.length;_++){var v=i[_];if(v.isNode()){var y=v,b=y.pstyle(`text-events`).strValue===`yes`,x=y.pstyle(`box-selection`).strValue,S=y.pstyle(`box-select-labels`).strValue===`yes`;if(x===`none`)continue;var C=(x===`overlap`||S)&&b,w=y.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:C});if(x===`contain`){var T=!1;if(S&&b){var E=h(y);E&&$r(E,f)&&(o.push(y),T=!0)}!T&&br(d,w)&&o.push(y)}else if(x===`overlap`&&_r(d,w)){var D=y.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if($r([{x:D.x1,y:D.y1},{x:D.x2,y:D.y1},{x:D.x2,y:D.y2},{x:D.x1,y:D.y2}],f))o.push(y);else{var k=h(y);k&&$r(k,f)&&o.push(y)}}}else{var A=v,j=A._private,M=j.rscratch,N=A.pstyle(`box-selection`).strValue;if(N===`none`)continue;if(N===`contain`){if(M.startX!=null&&M.startY!=null&&!vr(d,M.startX,M.startY)||M.endX!=null&&M.endY!=null&&!vr(d,M.endX,M.endY))continue;if(M.edgeType===`bezier`||M.edgeType===`multibezier`||M.edgeType===`self`||M.edgeType===`compound`||M.edgeType===`segments`||M.edgeType===`haystack`){for(var P=j.rstyle.bezierPts||j.rstyle.linePts||j.rstyle.haystackPts,F=!0,I=0;I<P.length;I++)if(!yr(d,P[I])){F=!1;break}F&&o.push(A)}else M.edgeType===`straight`&&o.push(A)}else if(N===`overlap`){var L=!1;if(M.startX!=null&&M.startY!=null&&M.endX!=null&&M.endY!=null&&(vr(d,M.startX,M.startY)||vr(d,M.endX,M.endY)))o.push(A),L=!0;else if(!L&&M.edgeType===`haystack`){for(var R=j.rstyle.haystackPts,z=0;z<R.length;z++)if(yr(d,R[z])){o.push(A),L=!0;break}}if(!L){var B=j.rstyle.bezierPts||j.rstyle.linePts||j.rstyle.haystackPts;if((!B||B.length<2)&&M.edgeType===`straight`&&M.startX!=null&&M.startY!=null&&M.endX!=null&&M.endY!=null&&(B=[{x:M.startX,y:M.startY},{x:M.endX,y:M.endY}]),!B||B.length<2)continue;for(var V=0;V<B.length-1;V++){for(var H=B[V],U=B[V+1],W=0;W<p.length;W++){var G=O(p[W],2),K=G[0],q=G[1];if(g(H,U,K,q)){o.push(A),L=!0;break}}if(L)break}}}}}return o};var mf={};mf.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType===`haystack`,r=t.edgeType===`bezier`,i=t.edgeType===`multibezier`,a=t.edgeType===`segments`,o=t.edgeType===`compound`,s=t.edgeType===`self`,c,l,u,d,f,p,m,h;if(n?(u=t.haystackPts[0],d=t.haystackPts[1],f=t.haystackPts[2],p=t.haystackPts[3]):(u=t.arrowStartX,d=t.arrowStartY,f=t.arrowEndX,p=t.arrowEndY),m=t.midX,h=t.midY,a)c=u-t.segpts[0],l=d-t.segpts[1];else if(i||o||s||r){var g=t.allpts,_=ar(g[0],g[2],g[4],.1),v=ar(g[1],g[3],g[5],.1);c=u-_,l=d-v}else c=u-m,l=d-h;t.srcArrowAngle=$n(c,l);var m=t.midX,h=t.midY;if(n&&(m=(u+f)/2,h=(d+p)/2),c=f-u,l=p-d,a){var g=t.allpts;if(g.length/2%2==0){var y=g.length/2,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}else if(t.isRound)c=t.midVector[1],l=-t.midVector[0];else{var y=g.length/2-1,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}}else if(i||o||s){var g=t.allpts,x=t.ctrlpts,S,C,w,T;if(x.length/2%2==0){var E=g.length/2-1,D=E+2,O=D+2;S=ar(g[E],g[D],g[O],0),C=ar(g[E+1],g[D+1],g[O+1],0),w=ar(g[E],g[D],g[O],1e-4),T=ar(g[E+1],g[D+1],g[O+1],1e-4)}else{var D=g.length/2-1,E=D-2,O=D+2;S=ar(g[E],g[D],g[O],.4999),C=ar(g[E+1],g[D+1],g[O+1],.4999),w=ar(g[E],g[D],g[O],.5),T=ar(g[E+1],g[D+1],g[O+1],.5)}c=w-S,l=T-C}if(t.midtgtArrowAngle=$n(c,l),t.midDispX=c,t.midDispY=l,c*=-1,l*=-1,a){var g=t.allpts;if(g.length/2%2!=0&&!t.isRound){var y=g.length/2-1,k=y+2;c=-(g[k]-g[y]),l=-(g[k+1]-g[y+1])}}if(t.midsrcArrowAngle=$n(c,l),a)c=f-t.segpts[t.segpts.length-2],l=p-t.segpts[t.segpts.length-1];else if(i||o||s||r){var g=t.allpts,A=g.length,_=ar(g[A-6],g[A-4],g[A-2],.9),v=ar(g[A-5],g[A-3],g[A-1],.9);c=f-_,l=p-v}else c=f-m,l=p-h;t.tgtArrowAngle=$n(c,l)},mf.getArrowWidth=mf.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+`, `+t];return r||(r=Math.max((e*13.37)**.9,29)*t,n[e+`, `+t]=r,r)};var hf,gf,_f={},vf={},yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},Ff=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},If=function(e,t,n,r,i){if(e===Nf?Ff(vf,_f):Pf(t,e,_f),Pf(t,n,vf),yf=_f.nx*vf.ny-_f.ny*vf.nx,bf=_f.nx*vf.nx-_f.ny*-vf.ny,Cf=Math.asin(Math.max(-1,Math.min(1,yf))),Math.abs(Cf)<1e-6){hf=t.x,gf=t.y,Tf=Df=0;return}xf=1,Sf=!1,bf<0?Cf<0?Cf=Math.PI+Cf:(Cf=Math.PI-Cf,xf=-1,Sf=!0):Cf>0&&(xf=-1,Sf=!0),Df=t.radius===void 0?r:t.radius,wf=Cf/2,Of=Math.min(_f.len/2,vf.len/2),i?(Ef=Math.abs(Math.cos(wf)*Df/Math.sin(wf)),Ef>Of?(Ef=Of,Tf=Math.abs(Ef*Math.sin(wf)/Math.cos(wf))):Tf=Df):(Ef=Math.min(Of,Df),Tf=Math.abs(Ef*Math.sin(wf)/Math.cos(wf))),jf=t.x+vf.nx*Ef,Mf=t.y+vf.ny*Ef,hf=jf-vf.ny*Tf*xf,gf=Mf+vf.nx*Tf*xf,kf=t.x+_f.nx*Ef,Af=t.y+_f.ny*Ef,Nf=t};function Lf(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Rf(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(If(e,t,n,r,i),{cx:hf,cy:gf,radius:Tf,startX:kf,startY:Af,stopX:jf,stopY:Mf,startAngle:_f.ang+Math.PI/2*xf,endAngle:vf.ang-Math.PI/2*xf,counterClockwise:Sf})}var zf=.01,Bf=Math.sqrt(2*zf),Vf={};Vf.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,i=t.vectorNormInverse,a,o=e.pstyle(`source-endpoint`),s=e.pstyle(`target-endpoint`),c=o.units!=null&&s.units!=null,l=function(e,t,n,r){var i=r-t,a=n-e,o=Math.sqrt(a*a+i*i);return{x:-i/o,y:a/o}};switch(e.pstyle(`edge-distances`).value){case`node-position`:a=n;break;case`intersection`:a=r;break;case`endpoints`:if(c){var u=O(this.manualEndptToPx(e.source()[0],o),2),d=u[0],f=u[1],p=O(this.manualEndptToPx(e.target()[0],s),2),m=p[0],h=p[1],g={x1:d,y1:f,x2:m,y2:h};i=l(d,f,m,h),a=g}else tn(`Edge ${e.id()} has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).`),a=r;break}return{midptPts:a,vectorNormInverse:i}},Vf.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,c=o.position(),l=s.position(),u=o.width(),d=s.width(),f=o.height(),p=s.height(),m=n.pstyle(`haystack-radius`).value/2;i.haystackPts=i.allpts=[i.source.x*u*m+c.x,i.source.y*f*m+c.y,i.target.x*d*m+l.x,i.target.y*p*m+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType=`haystack`,i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Vf.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle(`segment-weights`),i=e.pstyle(`segment-distances`),a=e.pstyle(`segment-radii`),o=e.pstyle(`radius-type`),s=Math.min(r.pfValue.length,i.pfValue.length),c=a.pfValue[a.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];n.edgeType=`segments`,n.segpts=[],n.radii=[],n.isArcRadius=[];for(var u=0;u<s;u++){var d=r.pfValue[u],f=i.pfValue[u],p=1-d,m=d,h=this.findMidptPtsEtc(e,t),g=h.midptPts,_=h.vectorNormInverse,v={x:g.x1*p+g.x2*m,y:g.y1*p+g.y2*m};n.segpts.push(v.x+_.x*f,v.y+_.y*f),n.radii.push(a.pfValue[u]===void 0?c:a.pfValue[u]),n.isArcRadius.push((o.pfValue[u]===void 0?l:o.pfValue[u])===`arc-radius`)}},Vf.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle(`control-point-distances`),c=s?s.pfValue[0]:void 0,l=e.pstyle(`loop-direction`).pfValue,u=e.pstyle(`loop-sweep`).pfValue,d=e.pstyle(`control-point-step-size`).pfValue;i.edgeType=`self`;var f=n,p=d;r&&(f=0,p=c);var m=l-Math.PI/2,h=m-u/2,g=m+u/2,_=String(l+`_`+u);f=a[_]===void 0?a[_]=0:++a[_],i.ctrlpts=[o.x+Math.cos(h)*1.4*p*(f/3+1),o.y+Math.sin(h)*1.4*p*(f/3+1),o.x+Math.cos(g)*1.4*p*(f/3+1),o.y+Math.sin(g)*1.4*p*(f/3+1)]},Vf.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType=`compound`;var a=t.srcPos,o=t.tgtPos,s=t.srcW,c=t.srcH,l=t.tgtW,u=t.tgtH,d=e.pstyle(`control-point-step-size`).pfValue,f=e.pstyle(`control-point-distances`),p=f?f.pfValue[0]:void 0,m=n,h=d;r&&(m=0,h=p);var g=50,_={x:a.x-s/2,y:a.y-c/2},v={x:o.x-l/2,y:o.y-u/2},y={x:Math.min(_.x,v.x),y:Math.min(_.y,v.y)},b=.5,x=Math.max(b,Math.log(s*zf)),S=Math.max(b,Math.log(l*zf));i.ctrlpts=[y.x,y.y-(1+g**1.12/100)*h*(m/3+1)*x,y.x-(1+g**1.12/100)*h*(m/3+1)*S,y.y]},Vf.findStraightEdgePoints=function(e){e._private.rscratch.edgeType=`straight`},Vf.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle(`control-point-step-size`).pfValue,s=e.pstyle(`control-point-distances`),c=e.pstyle(`control-point-weights`),l=s&&c?Math.min(s.value.length,c.value.length):1,u=s?s.pfValue[0]:void 0,d=c.value[0],f=r;a.edgeType=f?`multibezier`:`bezier`,a.ctrlpts=[];for(var p=0;p<l;p++){var m=(.5-t.eles.length/2+n)*o*(i?-1:1),h=void 0,g=tr(m);f&&(u=s?s.pfValue[p]:o,d=c.value[p]),h=r?u:u===void 0?void 0:g*u;var _=h===void 0?m:h,v=1-d,y=d,b=this.findMidptPtsEtc(e,t),x=b.midptPts,S=b.vectorNormInverse,C={x:x.x1*v+x.x2*y,y:x.y1*v+x.y2*y};a.ctrlpts.push(C.x+S.x*_,C.y+S.y*_)}},Vf.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType=`segments`;var r=`vertical`,i=`horizontal`,a=`leftward`,o=`rightward`,s=`downward`,c=`upward`,l=`auto`,u=t.posPts,d=t.srcW,f=t.srcH,p=t.tgtW,m=t.tgtH,h=e.pstyle(`edge-distances`).value!==`node-position`,g=e.pstyle(`taxi-direction`).value,_=g,v=e.pstyle(`taxi-turn`),y=v.units===`%`,b=v.pfValue,x=b<0,S=e.pstyle(`taxi-turn-min-distance`).pfValue,C=h?(d+p)/2:0,w=h?(f+m)/2:0,T=u.x2-u.x1,E=u.y2-u.y1,D=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},O=D(T,C),k=D(E,w),A=!1;_===l?g=Math.abs(O)>Math.abs(k)?i:r:_===c||_===s?(g=r,A=!0):(_===a||_===o)&&(g=i,A=!0);var j=g===r,M=j?k:O,N=j?E:T,P=tr(N),F=!1;!(A&&(y||x))&&(_===s&&N<0||_===c&&N>0||_===a&&N>0||_===o&&N<0)&&(P*=-1,M=P*Math.abs(M),F=!0);var I=y?(b<0?1+b:b)*M:(b<0?M:0)+b*P,L=function(e){return Math.abs(e)<S||Math.abs(e)>=Math.abs(M)},R=L(I),z=L(Math.abs(M)-Math.abs(I));if((R||z)&&!F)if(j){var B=Math.abs(N)<=f/2,V=Math.abs(T)<=p/2;if(B){var H=(u.x1+u.x2)/2;n.segpts=[H,u.y1,H,u.y2]}else if(V){var U=(u.y1+u.y2)/2;n.segpts=[u.x1,U,u.x2,U]}else n.segpts=[u.x1,u.y2]}else{var W=Math.abs(N)<=d/2,G=Math.abs(E)<=m/2;if(W){var K=(u.y1+u.y2)/2;n.segpts=[u.x1,K,u.x2,K]}else if(G){var q=(u.x1+u.x2)/2;n.segpts=[q,u.y1,q,u.y2]}else n.segpts=[u.x2,u.y1]}else if(j){var J=u.y1+I+(h?f/2*P:0);n.segpts=[u.x1,J,u.x2,J]}else{var Y=u.x1+I+(h?d/2*P:0);n.segpts=[Y,u.y1,Y,u.y2]}if(n.isRound){var ee=e.pstyle(`taxi-radius`).value,te=e.pstyle(`radius-type`).value[0]===`arc-radius`;n.radii=Array(n.segpts.length/2).fill(ee),n.isArcRadius=Array(n.segpts.length/2).fill(te)}},Vf.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType===`bezier`){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,c=t.tgtH,l=t.srcShape,u=t.tgtShape,d=t.srcCornerRadius,f=t.tgtCornerRadius,p=t.srcRs,m=t.tgtRs,h=!K(n.startX)||!K(n.startY),g=!K(n.arrowStartX)||!K(n.arrowStartY),_=!K(n.endX)||!K(n.endY),v=!K(n.arrowEndX)||!K(n.arrowEndY),y=3*(this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth),b=nr({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=b<y,S=nr({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),C=S<y,w=!1;if(h||g||x){w=!0;var T={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(T.x*T.x+T.y*T.y),D={x:T.x/E,y:T.y/E},O=Math.max(a,o),k={x:n.ctrlpts[0]+D.x*2*O,y:n.ctrlpts[1]+D.y*2*O},A=l.intersectLine(r.x,r.y,a,o,k.x,k.y,0,d,p);x?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(y-b),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(y-b)):(n.ctrlpts[0]=A[0]+D.x*y,n.ctrlpts[1]=A[1]+D.y*y)}if(_||v||C){w=!0;var j={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},M=Math.sqrt(j.x*j.x+j.y*j.y),N={x:j.x/M,y:j.y/M},P=Math.max(a,o),F={x:n.ctrlpts[0]+N.x*2*P,y:n.ctrlpts[1]+N.y*2*P},I=u.intersectLine(i.x,i.y,s,c,F.x,F.y,0,f,m);C?(n.ctrlpts[0]=n.ctrlpts[0]+N.x*(y-S),n.ctrlpts[1]=n.ctrlpts[1]+N.y*(y-S)):(n.ctrlpts[0]=I[0]+N.x*y,n.ctrlpts[1]=I[1]+N.y*y)}w&&this.findEndpoints(e)}},Vf.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType===`multibezier`||t.edgeType===`bezier`||t.edgeType===`self`||t.edgeType===`compound`){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,i;t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=ar(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=ar(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if(t.edgeType===`straight`)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType===`segments`){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var o=t.radii[a/2-1],s=t.isArcRadius[a/2-1];t.roundCorners.push(Rf({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:o},{x:t.allpts[a+2],y:t.allpts[a+3]},o,s))}}if(t.segpts.length%4==0){var c=t.segpts.length/2,l=c-2;t.midX=(t.segpts[l]+t.segpts[c])/2,t.midY=(t.segpts[l+1]+t.segpts[c+1])/2}else{var u=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[u],t.midY=t.segpts[u+1];else{var d={x:t.segpts[u],y:t.segpts[u+1]},f=t.roundCorners[u/2];if(f.radius===0){var p={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=d.x,t.midY=d.y,t.midVector=[d.y-p.y,p.x-d.x]}else{var m=[d.x-f.cx,d.y-f.cy],h=f.radius/Math.sqrt(m[0]**2+m[1]**2);m=m.map(function(e){return e*h}),t.midX=f.cx+m[0],t.midY=f.cy+m[1],t.midVector=m}}}}},Vf.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||K(t.startX)&&K(t.startY)&&K(t.endX)&&K(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,tn("Edge `"+e.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."))},Vf.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy.hasCompoundNodes(),i=new gn,a=function(e,t){return[].concat(k(e),[t?1:0]).join(`-`)},o=[],s=[],c=0;c<e.length;c++){var l=e[c],u=l._private,d=l.pstyle(`curve-style`).value;if(!(l.removed()||!l.takesUpSpace())){if(d===`haystack`){s.push(l);continue}var f=d===`unbundled-bezier`||he(d,`segments`)||d===`straight`||d===`straight-triangle`||he(d,`taxi`),p=d===`unbundled-bezier`||d===`bezier`,m=u.source,h=u.target,g=[m.poolIndex(),h.poolIndex()].sort(),_=a(g,f),v=i.get(_);v??(v={eles:[]},o.push({pairId:g,edgeIsUnbundled:f}),i.set(_,v)),v.eles.push(l),f&&(v.hasUnbundled=!0),p&&(v.hasBezier=!0)}}for(var y=function(){var e=o[b],s=e.pairId,c=e.edgeIsUnbundled,l=a(s,c),u=i.get(l),d;if(!u.hasUnbundled){var f=u.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});dn(u.eles),f.forEach(function(e){return u.eles.push(e)}),u.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var p=u.eles[0],m=p.source(),h=p.target();if(m.poolIndex()>h.poolIndex()){var g=m;m=h,h=g}var _=u.srcPos=m.position(),v=u.tgtPos=h.position(),y=u.srcW=m.outerWidth(),x=u.srcH=m.outerHeight(),S=u.tgtW=h.outerWidth(),C=u.tgtH=h.outerHeight(),w=u.srcShape=n.nodeShapes[t.getNodeShape(m)],T=u.tgtShape=n.nodeShapes[t.getNodeShape(h)],E=u.srcCornerRadius=m.pstyle(`corner-radius`).value===`auto`?`auto`:m.pstyle(`corner-radius`).pfValue,D=u.tgtCornerRadius=h.pstyle(`corner-radius`).value===`auto`?`auto`:h.pstyle(`corner-radius`).pfValue,O=u.tgtRs=h._private.rscratch,k=u.srcRs=m._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var A=0;A<u.eles.length;A++){var j=u.eles[A],M=j[0]._private.rscratch,N=j.pstyle(`curve-style`).value,P=N===`unbundled-bezier`||he(N,`segments`)||he(N,`taxi`),F=!m.same(j.source());if(!u.calculatedIntersection&&m!==h&&(u.hasBezier||u.hasUnbundled)){u.calculatedIntersection=!0;var I=w.intersectLine(_.x,_.y,y,x,v.x,v.y,0,E,k),L=u.srcIntn=I,R=T.intersectLine(v.x,v.y,S,C,_.x,_.y,0,D,O),z=u.tgtIntn=R,B=u.intersectionPts={x1:I[0],x2:R[0],y1:I[1],y2:R[1]},V=u.posPts={x1:_.x,x2:v.x,y1:_.y,y2:v.y},H=R[1]-I[1],U=R[0]-I[0],W=Math.sqrt(U*U+H*H);K(W)&&W>=Bf||(W=Math.sqrt(Math.max(U*U,zf)+Math.max(H*H,zf)));var G=u.vector={x:U,y:H},q=u.vectorNorm={x:G.x/W,y:G.y/W},J={x:-q.y,y:q.x};u.nodesOverlap=!K(W)||T.checkPoint(I[0],I[1],0,S,C,v.x,v.y,D,O)||w.checkPoint(R[0],R[1],0,y,x,_.x,_.y,E,k),u.vectorNormInverse=J,d={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:O,tgtPos:_,tgtRs:k,srcW:S,srcH:C,tgtW:y,tgtH:x,srcIntn:z,tgtIntn:L,srcShape:T,tgtShape:w,posPts:{x1:V.x2,y1:V.y2,x2:V.x1,y2:V.y1},intersectionPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},vector:{x:-G.x,y:-G.y},vectorNorm:{x:-q.x,y:-q.y},vectorNormInverse:{x:-J.x,y:-J.y}}}var Y=F?d:u;M.nodesOverlap=Y.nodesOverlap,M.srcIntn=Y.srcIntn,M.tgtIntn=Y.tgtIntn,M.isRound=N.startsWith(`round`),r&&(m.isParent()||m.isChild()||h.isParent()||h.isChild())&&(m.parents().anySame(h)||h.parents().anySame(m)||m.same(h)&&m.isParent())?t.findCompoundLoopPoints(j,Y,A,P):m===h?t.findLoopPoints(j,Y,A,P):N.endsWith(`segments`)?t.findSegmentsPoints(j,Y):N.endsWith(`taxi`)?t.findTaxiPoints(j,Y):N===`straight`||!P&&u.eles.length%2==1&&A===Math.floor(u.eles.length/2)?t.findStraightEdgePoints(j):t.findBezierPoints(j,Y,A,P,F),t.findEndpoints(j),t.tryToCorrectInvalidPoints(j,Y),t.checkForInvalidEdgeWarning(j),t.storeAllpts(j),t.storeEdgeProjections(j),t.calculateArrowAngles(j),t.recalculateEdgeLabelProjections(j),t.calculateLabelAngles(j)}},b=0;b<o.length;b++)y();this.findHaystackPoints(s)}};function Hf(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}Vf.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),t.edgeType===`segments`)return Hf(t.segpts)},Vf.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n===`bezier`||n===`multibezier`||n===`self`||n===`compound`)return Hf(t.ctrlpts)},Vf.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Uf={};Uf.manualEndptToPx=function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;if(t.value.length===2){var s=[t.pfValue[0],t.pfValue[1]];return t.units[0]===`%`&&(s[0]*=i),t.units[1]===`%`&&(s[1]*=a),s[0]+=r.x,s[1]+=r.y,s}else{var c=t.pfValue[0];c=-Math.PI/2+c;var l=2*Math.max(i,a),u=[r.x+Math.cos(c)*l,r.y+Math.sin(c)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,u[0],u[1],0,e.pstyle(`corner-radius`).value===`auto`?`auto`:e.pstyle(`corner-radius`).pfValue,o)}},Uf.findEndpoints=function(e){var t,n,r=this,i,a=e.source()[0],o=e.target()[0],s=a.position(),c=o.position(),l=e.pstyle(`target-arrow-shape`).value,u=e.pstyle(`source-arrow-shape`).value,d=e.pstyle(`target-distance-from-node`).pfValue,f=e.pstyle(`source-distance-from-node`).pfValue,p=a._private.rscratch,m=o._private.rscratch,h=e.pstyle(`curve-style`).value,g=e._private.rscratch,_=g.edgeType,v=he(h,`taxi`),y=_===`self`||_===`compound`,b=_===`bezier`||_===`multibezier`||y,x=_!==`bezier`,S=_===`straight`||_===`segments`,C=_===`segments`,w=b||x||S,T=y||v,E=e.pstyle(`source-endpoint`),D=T?`outside-to-node`:E.value,O=a.pstyle(`corner-radius`).value===`auto`?`auto`:a.pstyle(`corner-radius`).pfValue,k=e.pstyle(`target-endpoint`),A=T?`outside-to-node`:k.value,j=o.pstyle(`corner-radius`).value===`auto`?`auto`:o.pstyle(`corner-radius`).pfValue;g.srcManEndpt=E,g.tgtManEndpt=k;var M,N,P,F,I=((k==null||(t=k.pfValue)==null?void 0:t.length)===2?k.pfValue:null)??[0,0],L=((E==null||(n=E.pfValue)==null?void 0:n.length)===2?E.pfValue:null)??[0,0];if(b){var R=[g.ctrlpts[0],g.ctrlpts[1]];M=x?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:R,N=R}else if(S){var z=C?g.segpts.slice(0,2):[c.x+I[0],c.y+I[1]];M=C?g.segpts.slice(g.segpts.length-2):[s.x+L[0],s.y+L[1]],N=z}if(A===`inside-to-node`)i=[c.x,c.y];else if(k.units)i=this.manualEndptToPx(o,k);else if(A===`outside-to-line`)i=g.tgtIntn;else if(A===`outside-to-node`||A===`outside-to-node-or-label`?P=M:(A===`outside-to-line`||A===`outside-to-line-or-label`)&&(P=[s.x,s.y]),i=r.nodeShapes[this.getNodeShape(o)].intersectLine(c.x,c.y,o.outerWidth(),o.outerHeight(),P[0],P[1],0,j,m),A===`outside-to-node-or-label`||A===`outside-to-line-or-label`){var B=o._private.rscratch,V=B.labelWidth,H=B.labelHeight,U=B.labelX,W=B.labelY,G=V/2,q=H/2,J=o.pstyle(`text-valign`).value;J===`top`?W-=q:J===`bottom`&&(W+=q);var Y=o.pstyle(`text-halign`).value;Y===`left`?U-=G:Y===`right`&&(U+=G);var ee=Hr(P[0],P[1],[U-G,W-q,U+G,W-q,U+G,W+q,U-G,W+q],c.x,c.y);if(ee.length>0){var te=s,ne=rr(te,qn(i)),re=rr(te,qn(ee)),ie=ne;re<ne&&(i=ee,ie=re),ee.length>2&&rr(te,{x:ee[2],y:ee[3]})<ie&&(i=[ee[2],ee[3]])}}var ae=Wr(i,M,r.arrowShapes[l].spacing(e)+d),oe=Wr(i,M,r.arrowShapes[l].gap(e)+d);if(g.endX=oe[0],g.endY=oe[1],g.arrowEndX=ae[0],g.arrowEndY=ae[1],D===`inside-to-node`)i=[s.x,s.y];else if(E.units)i=this.manualEndptToPx(a,E);else if(D===`outside-to-line`)i=g.srcIntn;else if(D===`outside-to-node`||D===`outside-to-node-or-label`?F=N:(D===`outside-to-line`||D===`outside-to-line-or-label`)&&(F=[c.x,c.y]),i=r.nodeShapes[this.getNodeShape(a)].intersectLine(s.x,s.y,a.outerWidth(),a.outerHeight(),F[0],F[1],0,O,p),D===`outside-to-node-or-label`||D===`outside-to-line-or-label`){var se=a._private.rscratch,ce=se.labelWidth,le=se.labelHeight,ue=se.labelX,de=se.labelY,fe=ce/2,pe=le/2,me=a.pstyle(`text-valign`).value;me===`top`?de-=pe:me===`bottom`&&(de+=pe);var ge=a.pstyle(`text-halign`).value;ge===`left`?ue-=fe:ge===`right`&&(ue+=fe);var _e=Hr(F[0],F[1],[ue-fe,de-pe,ue+fe,de-pe,ue+fe,de+pe,ue-fe,de+pe],s.x,s.y);if(_e.length>0){var ve=c,ye=rr(ve,qn(i)),be=rr(ve,qn(_e)),xe=ye;be<ye&&(i=[_e[0],_e[1]],xe=be),_e.length>2&&rr(ve,{x:_e[2],y:_e[3]})<xe&&(i=[_e[2],_e[3]])}}var Se=Wr(i,N,r.arrowShapes[u].spacing(e)+f),Ce=Wr(i,N,r.arrowShapes[u].gap(e)+f);g.startX=Ce[0],g.startY=Ce[1],g.arrowStartX=Se[0],g.arrowStartY=Se[1],w&&(!K(g.startX)||!K(g.startY)||!K(g.endX)||!K(g.endY)?g.badLine=!0:g.badLine=!1)},Uf.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},Uf.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var Wf={};function Gf(e,t,n){for(var r=function(e,t,n,r){return ar(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Wf.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r===`multibezier`||r===`bezier`||r===`self`||r===`compound`){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)Gf(this,e,n.allpts.slice(i,i+6))}else if(r===`segments`)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if(r===`haystack`){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth},Wf.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var Kf={};Kf.recalculateNodeLabelProjection=function(e){var t=e.pstyle(`label`).strValue;if(!ae(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),c=e.position(),l=e.pstyle(`text-halign`).strValue,u=e.pstyle(`text-valign`).strValue,d=i.rscratch,f=i.rstyle;switch(l){case`left`:n=c.x-a/2-s;break;case`right`:n=c.x+a/2+s;break;default:n=c.x}switch(u){case`top`:r=c.y-o/2-s;break;case`bottom`:r=c.y+o/2+s;break;default:r=c.y}d.labelX=n,d.labelY=r,f.labelX=n,f.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var qf=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n*=-1),n},Jf=function(e,t){return qf(t.x-e.x,t.y-e.y)},Yf=function(e,t,n,r){var i=cr(0,r-.001,1),a=cr(0,r+.001,1);return Jf(or(e,t,n,i),or(e,t,n,a))};Kf.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle(`label`).strValue,source:e.pstyle(`source-label`).strValue,target:e.pstyle(`target-label`).strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){mn(n.rscratch,e,t,r),mn(n.rstyle,e,t,r)};o(`labelX`,null,t.x),o(`labelY`,null,t.y),o(`labelAutoAngle`,null,qf(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},c={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:c,startDist:0,length:0,segments:[]})}var l=n.rstyle.bezierPts,u=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=nr(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var f=0;f<e.length;f++){var p=e[f],m=e[f-1];m&&(p.startDist=m.startDist+m.length),d(p,p.p0,l[f*u],0,i.bezierProjPcts[0]);for(var h=0;h<u-1;h++)d(p,l[f*u+h],l[f*u+h+1],i.bezierProjPcts[h],i.bezierProjPcts[h+1]);d(p,l[f*u+u-1],p.p2,i.bezierProjPcts[u-1],1)}return s.cache=e},c=function(n){var i,c=n===`source`;if(a[n]){var l=e.pstyle(n+`-text-offset`).pfValue;switch(r.edgeType){case`self`:case`compound`:case`bezier`:case`multibezier`:for(var u=s(),d,f=0,p=0,m=0;m<u.length;m++){for(var h=u[c?m:u.length-1-m],g=0;g<h.segments.length;g++){var _=h.segments[c?g:h.segments.length-1-g],v=m===u.length-1&&g===h.segments.length-1;if(f=p,p+=_.length,p>=l||v){d={cp:h,segment:_};break}}if(d)break}var y=d.cp,b=d.segment,x=(l-f)/b.length,S=b.t1-b.t0,C=c?b.t0+S*x:b.t1-S*x;C=cr(0,C,1),t=or(y.p0,y.p1,y.p2,C),i=Yf(y.p0,y.p1,y.p2,C);break;case`straight`:case`segments`:case`haystack`:for(var w=0,T,E,D,O,k=r.allpts.length,A=0;A+3<k&&(c?(D={x:r.allpts[A],y:r.allpts[A+1]},O={x:r.allpts[A+2],y:r.allpts[A+3]}):(D={x:r.allpts[k-2-A],y:r.allpts[k-1-A]},O={x:r.allpts[k-4-A],y:r.allpts[k-3-A]}),T=nr(D,O),E=w,w+=T,!(w>=l));A+=2);var j=(l-E)/T;j=cr(0,j,1),t=sr(D,O,j),i=Jf(D,O);break}o(`labelX`,n,t.x),o(`labelY`,n,t.y),o(`labelAutoAngle`,n,i)}};c(`source`),c(`target`),this.applyLabelDimensions(e)}},Kf.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,`source`),this.applyPrefixedLabelDimensions(e,`target`))},Kf.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=zt(r,e._private.labelDimsKey);if(pn(n.rscratch,`prefixedLabelDimsKey`,t)!==i){mn(n.rscratch,`prefixedLabelDimsKey`,t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle(`line-height`).pfValue,s=e.pstyle(`text-wrap`).strValue,c=pn(n.rscratch,`labelWrapCachedLines`,t)||[],l=s===`wrap`?Math.max(c.length,1):1,u=a.height/l,d=u*o,f=a.width,p=a.height+(l-1)*(o-1)*u;mn(n.rstyle,`labelWidth`,t,f),mn(n.rscratch,`labelWidth`,t,f),mn(n.rstyle,`labelHeight`,t,p),mn(n.rscratch,`labelHeight`,t,p),mn(n.rscratch,`labelLineHeight`,t,d)}},Kf.getLabelText=function(e,t){var n=e._private,r=t?t+`-`:``,i=e.pstyle(r+`label`).strValue,a=e.pstyle(`text-transform`).value,o=function(e,r){return r?(mn(n.rscratch,e,t,r),r):pn(n.rscratch,e,t)};if(!i)return``;a==`none`||(a==`uppercase`?i=i.toUpperCase():a==`lowercase`&&(i=i.toLowerCase()));var s=e.pstyle(`text-wrap`).value;if(s===`wrap`){var c=o(`labelKey`);if(c!=null&&o(`labelWrapKey`)===c)return o(`labelWrapCachedText`);for(var l=``,u=i.split(`
|
|
5
|
+
`),d=e.pstyle(`text-max-width`).pfValue,f=e.pstyle(`text-overflow-wrap`).value===`anywhere`,p=[],m=/[\s\u200b]+|$/g,h=0;h<u.length;h++){var g=u[h],_=this.calculateLabelDimensions(e,g).width;if(f&&(g=g.split(``).join(l)),_>d){var v=g.matchAll(m),y=``,b=0,x=S(v),C;try{for(x.s();!(C=x.n()).done;){var w=C.value,T=w[0],E=g.substring(b,w.index);b=w.index+T.length;var D=y.length===0?E:y+E+T;this.calculateLabelDimensions(e,D).width<=d?y+=E+T:(y&&p.push(y),y=E+T)}}catch(e){x.e(e)}finally{x.f()}y.match(/^[\s\u200b]+$/)||p.push(y)}else p.push(g)}o(`labelWrapCachedLines`,p),i=o(`labelWrapCachedText`,p.join(`
|
|
6
|
+
`)),o(`labelWrapKey`,c)}else if(s===`ellipsis`){var O=e.pstyle(`text-max-width`).pfValue,k=``,A=`…`,j=!1;if(this.calculateLabelDimensions(e,i).width<O)return i;for(var M=0;M<i.length&&!(this.calculateLabelDimensions(e,k+i[M]+A).width>O);M++)k+=i[M],M===i.length-1&&(j=!0);return j||(k+=A),k}return i},Kf.getLabelJustification=function(e){var t=e.pstyle(`text-justification`).strValue,n=e.pstyle(`text-halign`).strValue;if(t===`auto`)if(e.isNode())switch(n){case`left`:return`right`;case`right`:return`left`;default:return`center`}else return`center`;else return t},Kf.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=0,i=e.pstyle(`font-style`).strValue,a=e.pstyle(`font-size`).pfValue,o=e.pstyle(`font-family`).strValue,s=e.pstyle(`font-weight`).strValue,c=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=n.createElement(`canvas`),l=this.labelCalcCanvasContext=c.getContext(`2d`);var u=c.style;u.position=`absolute`,u.left=`-9999px`,u.top=`-9999px`,u.zIndex=`-1`,u.visibility=`hidden`,u.pointerEvents=`none`}l.font=`${i} ${s} ${a}px ${o}`;for(var d=0,f=0,p=t.split(`
|
|
7
|
+
`),m=0;m<p.length;m++){var h=p[m],g=l.measureText(h),_=Math.ceil(g.width),v=a;d=Math.max(_,d),f+=v}return d+=r,f+=r,{width:d,height:f}},Kf.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`),o=a.strValue;return o===`none`?0:r&&o===`autorotate`?n.labelAutoAngle:o===`autorotate`?0:a.pfValue},Kf.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,`source`),r.targetLabelAngle=t.calculateLabelAngle(e,`target`))};var Xf={},Zf=28,Qf=!1;Xf.getNodeShape=function(e){var t=this,n=e.pstyle(`shape`).value;if(n===`cutrectangle`&&(e.width()<Zf||e.height()<Zf))return Qf||=(tn("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),!0),`rectangle`;if(e.isParent())return n===`rectangle`||n===`roundrectangle`||n===`round-rectangle`||n===`cutrectangle`||n===`cut-rectangle`||n===`barrel`?n:`rectangle`;if(n===`polygon`){var r=e.pstyle(`shape-polygon-points`).value;return t.nodeShapes.makePolygon(r).name}return n};var $f={};$f.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on(`bounds.* dirty.*`,function(e){var t=e.target;r(t)}).on(`style.* background.*`,function(e){var t=e.target;r(t,!1)});var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],c=s._private.rstyle;s.isNode()&&!c.cleanConnected&&(r(s.connectedEdges()),c.cleanConnected=!0)}if(a)for(var l=0;l<a.length;l++){var u=a[l];u(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},$f.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},$f.recalculateRenderedStyle=function(e,t){var n=function(e){return e._private.rstyle.cleanConnected};if(e.length!==0){var r=[],i=[];if(!this.destroyed){t===void 0&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,c=s.rstyle;o.isEdge()&&(!n(o.source())||!n(o.target()))&&(c.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(c.clean=!1),!(t&&c.clean||o.removed())&&o.pstyle(`display`).value!==`none`&&(s.group===`nodes`?i.push(o):r.push(o),c.clean=!0)}for(var l=0;l<i.length;l++){var u=i[l],d=u._private.rstyle,f=u.position();this.recalculateNodeLabelProjection(u),d.nodeX=f.x,d.nodeY=f.y,d.nodeW=u.pstyle(`width`).pfValue,d.nodeH=u.pstyle(`height`).pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var m=r[p]._private,h=m.rstyle,g=m.rscratch;h.srcX=g.arrowStartX,h.srcY=g.arrowStartY,h.tgtX=g.arrowEndX,h.tgtY=g.arrowEndY,h.midX=g.midX,h.midY=g.midY,h.labelAngle=g.labelAngle,h.sourceLabelAngle=g.sourceLabelAngle,h.targetLabelAngle=g.targetLabelAngle}}}};var ep={};ep.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},ep.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},ep.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(fu),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var tp={};[pf,mf,Vf,Uf,Wf,Kf,Xf,$f,ep].forEach(function(e){X(tp,e)});var np={};np.getCachedImage=function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener(`load`,n),a.image;a=i[e]=i[e]||{};var o=a.image=new Image;o.addEventListener(`load`,n),o.addEventListener(`error`,function(){o.error=!0});var s=`data:`;return e.substring(0,s.length).toLowerCase()!==s&&(t=t===`null`?null:t,o.crossOrigin=t),o.src=e,o};var rp={};rp.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(s!==void 0){var c=this.binder(s);a.push(c.on.apply(c,i))}}return a}var c=this.binder(e);return c.on.apply(c,i)},rp.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||oe(e);if(t.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},`passive`,{get:function(){return i=!0,!0}});n.addEventListener(`test`,null,a)}catch{}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:a??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},rp.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},rp.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},rp.load=function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(e){var t=e.getRootNode();if(t&&t.nodeType===11&&t.host!==void 0)return t},i=function(t,n,r,i){t??=e.cy;for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},a=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},o=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){var t=n[i];if(t.isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},s=function(e){e[0]._private.grabbed=!0},c=function(e){e[0]._private.grabbed=!1},l=function(e){e[0]._private.rscratch.inDragLayer=!0},u=function(e){e[0]._private.rscratch.inDragLayer=!1},d=function(e){e[0]._private.rscratch.isGrabTarget=!0},f=function(e){e[0]._private.rscratch.isGrabTarget=!1},p=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),s(e))},m=function(e,t){if(e.cy().hasCompoundNodes()&&!(t.inDragLayer==null&&t.addToList==null)){var n=e.descendants();t.inDragLayer&&(n.forEach(l),n.connectedEdges().forEach(l)),t.addToList&&p(n,t)}},h=function(t,n){n||={};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(l),t.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(l)),n.addToList&&t.forEach(function(e){p(e,n)}),m(t,n),v(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},g=h,_=function(t){t&&(e.getCachedZSortedEles().forEach(function(e){c(e),u(e),f(e)}),e.updateCachedGrabbedEles())},v=function(e,t){if(!(t.inDragLayer==null&&t.addToList==null)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(l),r.forEach(l)),t.addToList&&r.forEach(function(e){p(e,t)})}}},y=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},b=typeof MutationObserver<`u`,x=typeof ResizeObserver<`u`;b?(e.removeObserver=new MutationObserver(function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r){for(var i=0;i<r.length;i++)if(r[i]===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,`DOMNodeRemoved`,function(t){e.destroy()});var S=Ct(function(){e.cy.resize()},100);b&&(e.styleObserver=new MutationObserver(S),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,`resize`,S),x&&(e.resizeObserver=new ResizeObserver(S),e.resizeObserver.observe(e.container));var C=function(e,t){for(;e!=null;)t(e),e=e.parentNode},w=function(){e.invalidateContainerClientCoordsCache()};C(e.container,function(t){e.registerBinding(t,`transitionend`,w),e.registerBinding(t,`animationend`,w),e.registerBinding(t,`scroll`,w)}),e.registerBinding(e.container,`contextmenu`,function(e){e.preventDefault()});var T=function(){return e.selection[4]!==0},E=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],c=!1,l=0;l<s.length;l++){var u=s[l];if(r<=u.clientX&&u.clientX<=r+a&&i<=u.clientY&&u.clientY<=i+o){c=!0;break}}if(!c)return!1;for(var d=e.container,f=t.target.parentNode,p=!1;f;){if(f===d){p=!0;break}f=f.parentNode}return!!p};e.registerBinding(e.container,`mousedown`,function(t){if(E(t)&&!(e.hoverData.which===1&&t.which!==1)){t.preventDefault(),y(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,r=[t.clientX,t.clientY],a=e.projectIntoViewport(r[0],r[1]),o=e.selection,s=e.findNearestElements(a[0],a[1],!0,!1),c=s[0],l=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=r;var u=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}},f=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var t=e.hoverData.down;t?t.emit(u(`taphold`)):n.emit(u(`taphold`))}},e.tapholdDuration)};if(t.which==3){e.hoverData.cxtStarted=!0;var p={originalEvent:t,type:`cxttapstart`,position:{x:a[0],y:a[1]}};c?(c.activate(),c.emit(p),e.hoverData.down=c):n.emit(p),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(t.which==1){if(c&&c.activate(),c!=null&&e.nodeIsGrabbable(c)){var m=function(e){e.emit(u(`grab`))};if(d(c),!c.selected())l=e.dragData.possibleDragElements=n.collection(),g(c,{addToList:l}),c.emit(u(`grabon`)).emit(u(`grab`));else{l=e.dragData.possibleDragElements=n.collection();var _=n.$(function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)});h(_,{addToList:l}),c.emit(u(`grabon`)),_.forEach(m)}e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0)}e.hoverData.down=c,e.hoverData.downs=s,e.hoverData.downTime=new Date().getTime(),i(c,[`mousedown`,`tapstart`,`vmousedown`],t,{x:a[0],y:a[1]}),c==null?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint(`select`,!0),e.redraw()):c.pannable()&&(o[4]=1),f()}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}},!1);var D=r(e.container);e.registerBinding([t,D],`mousemove`,function(t){if(!(!e.hoverData.capture&&!E(t))){var n=!1,r=e.cy,s=r.zoom(),c=[t.clientX,t.clientY],l=e.projectIntoViewport(c[0],c[1]),u=e.hoverData.mdownPos,d=e.hoverData.mdownGPos,f=e.selection,p=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(p=e.findNearestElement(l[0],l[1],!0,!1));var m=e.hoverData.last,g=e.hoverData.down,v=[l[0]-f[2],l[1]-f[3]],y=e.dragData.possibleDragElements,b;if(d){var x=c[0]-d[0],S=x*x,C=c[1]-d[1],w=S+C*C;e.hoverData.isOverThresholdDrag=b=w>=e.desktopTapThreshold2}var T=a(t);b&&(e.hoverData.tapholdCancelled=!0);var D=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];t.length===0?(t.push(v[0]),t.push(v[1])):(t[0]+=v[0],t[1]+=v[1])};n=!0,i(p,[`mousemove`,`vmousemove`,`tapdrag`],t,{x:l[0],y:l[1]});var O=function(e){return{originalEvent:t,type:e,position:{x:l[0],y:l[1]}}},k=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||r.emit(O(`boxstart`)),f[4]=1,e.hoverData.selecting=!0,e.redrawHint(`select`,!0),e.redraw()};if(e.hoverData.which===3){if(b){var A=O(`cxtdrag`);g?g.emit(A):r.emit(A),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||p!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(O(`cxtdragout`)),e.hoverData.cxtOver=p,p&&p.emit(O(`cxtdragover`)))}}else if(e.hoverData.dragging){if(n=!0,r.panningEnabled()&&r.userPanningEnabled()){var j;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;j={x:(l[0]-M[0])*s,y:(l[1]-M[1])*s},e.hoverData.justStartedPan=!1}else j={x:v[0]*s,y:v[1]*s};r.panBy(j),r.emit(O(`dragpan`)),e.hoverData.dragged=!0}l=e.projectIntoViewport(t.clientX,t.clientY)}else if(f[4]==1&&(g==null||g.pannable()))b&&(!e.hoverData.dragging&&r.boxSelectionEnabled()&&(T||!r.panningEnabled()||!r.userPanningEnabled())?k():!e.hoverData.selecting&&r.panningEnabled()&&r.userPanningEnabled()&&o(g,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=qn(u),e.redrawHint(`select`,!0),e.redraw()),g&&g.pannable()&&g.active()&&g.unactivate());else{if(g&&g.pannable()&&g.active()&&g.unactivate(),(!g||!g.grabbed())&&p!=m&&(m&&i(m,[`mouseout`,`tapdragout`],t,{x:l[0],y:l[1]}),p&&i(p,[`mouseover`,`tapdragover`],t,{x:l[0],y:l[1]}),e.hoverData.last=p),g)if(b){if(r.boxSelectionEnabled()&&T)g&&g.grabbed()&&(_(y),g.emit(O(`freeon`)),y.emit(O(`free`)),e.dragData.didDrag&&(g.emit(O(`dragfreeon`)),y.emit(O(`dragfree`)))),k();else if(g&&g.grabbed()&&e.nodeIsDraggable(g)){var N=!e.dragData.didDrag;N&&e.redrawHint(`eles`,!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||h(y,{inDragLayer:!0});var P={x:0,y:0};if(K(v[0])&&K(v[1])&&(P.x+=v[0],P.y+=v[1],N)){var F=e.hoverData.dragDelta;F&&K(F[0])&&K(F[1])&&(P.x+=F[0],P.y+=F[1])}e.hoverData.draggingEles=!0,y.silentShift(P).emit(O(`position`)).emit(O(`drag`)),e.redrawHint(`drag`,!0),e.redraw()}}else D();n=!0}if(f[2]=l[0],f[3]=l[1],n)return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1}},!1);var O,k,A;e.registerBinding(t,`mouseup`,function(t){if(!(e.hoverData.which===1&&t.which!==1&&e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var r=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,c=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,u=e.hoverData.down,d=a(t);e.data.bgActivePosistion&&(e.redrawHint(`select`,!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,u&&u.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(e.hoverData.which===3){var p=f(`cxttapend`);if(u?u.emit(p):r.emit(p),!e.hoverData.cxtDragged){var m=f(`cxttap`);u?u.emit(m):r.emit(m)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(c,[`mouseup`,`tapend`,`vmouseup`],t,{x:o[0],y:o[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(u,[`click`,`tap`,`vclick`],t,{x:o[0],y:o[1]}),k=!1,t.timeStamp-A<=r.multiClickDebounceTime()?(O&&clearTimeout(O),k=!0,A=null,i(u,[`dblclick`,`dbltap`,`vdblclick`],t,{x:o[0],y:o[1]})):(O=setTimeout(function(){k||i(u,[`oneclick`,`onetap`,`voneclick`],t,{x:o[0],y:o[1]})},r.multiClickDebounceTime()),A=t.timeStamp)),u==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(t)&&(r.$(n).unselect([`tapunselect`]),l.length>0&&e.redrawHint(`eles`,!0),e.dragData.possibleDragElements=l=r.collection()),c==u&&!e.dragData.didDrag&&!e.hoverData.selecting&&c!=null&&c._private.selectable&&(e.hoverData.dragging||(r.selectionType()===`additive`||d?c.selected()?c.unselect([`tapunselect`]):c.select([`tapselect`]):d||(r.$(n).unmerge(c).unselect([`tapunselect`]),c.select([`tapselect`]))),e.redrawHint(`eles`,!0)),e.hoverData.selecting){var h=r.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint(`select`,!0),h.length>0&&e.redrawHint(`eles`,!0),r.emit(f(`boxend`)),r.selectionType()===`additive`||d||r.$(n).unmerge(h).unselect(),h.emit(f(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f(`boxselect`)),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint(`select`,!0),e.redrawHint(`eles`,!0),e.redraw()),!s[4]){e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0);var g=u&&u.grabbed();_(l),g&&(u.emit(f(`freeon`)),l.emit(f(`free`)),e.dragData.didDrag&&(u.emit(f(`dragfreeon`)),l.emit(f(`dragfree`))))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var j=[],M=4,N,P=1e5,F=function(e,t){for(var n=0;n<e.length;n++)if(e[n]%t!==0)return!1;return!0},I=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0},L=function(t){var n=!1,r=t.deltaY;if(r??(t.wheelDeltaY==null?t.wheelDelta!=null&&(r=t.wheelDelta/4):r=t.wheelDeltaY/4),r!==0){if(N==null)if(j.length>=M){var i=j;if(N=F(i,5),!N){var a=Math.abs(i[0]);N=I(i)&&a>5}if(N)for(var o=0;o<i.length;o++)P=Math.min(Math.abs(i[o]),P)}else j.push(r),n=!0;else N&&(P=Math.min(Math.abs(r),P));if(!e.scrollingPage){var s=e.cy,c=s.zoom(),l=s.pan(),u=e.projectIntoViewport(t.clientX,t.clientY),d=[u[0]*c+l.x,u[1]*c+l.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||T()){t.preventDefault();return}if(s.panningEnabled()&&s.userPanningEnabled()&&s.zoomingEnabled()&&s.userZoomingEnabled()){t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint(`eles`,!0),e.redraw()},150);var f;n&&Math.abs(r)>5&&(r=tr(r)*5),f=r/-250,N&&(f/=P,f*=3),f*=e.wheelSensitivity,t.deltaMode===1&&(f*=33);var p=s.zoom()*10**f;t.type===`gesturechange`&&(p=e.gestureStartZoom*t.scale),s.zoom({level:p,renderedPosition:{x:d[0],y:d[1]}}),s.emit({type:t.type===`gesturechange`?`pinchzoom`:`scrollzoom`,originalEvent:t,position:{x:u[0],y:u[1]}})}}}};e.registerBinding(e.container,`wheel`,L,!0),e.registerBinding(t,`scroll`,function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,`gesturestart`,function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()},!0),e.registerBinding(e.container,`gesturechange`,function(t){e.hasTouchStarted||L(t)},!0),e.registerBinding(e.container,`mouseout`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseout`,position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,`mouseover`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseover`,position:{x:n[0],y:n[1]}})},!1);var R,z,B,V,H,U,W,G,q,J,Y,ee,te,ne=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},re=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)},ie;e.registerBinding(e.container,`touchstart`,ie=function(t){if(e.hasTouchStarted=!0,E(t)){y(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,r=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);r[0]=o[0],r[1]=o[1]}if(t.touches[1]){var o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);r[2]=o[0],r[3]=o[1]}if(t.touches[2]){var o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);r[4]=o[0],r[5]=o[1]}var s=function(e){return{originalEvent:t,type:e,position:{x:r[0],y:r[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,_(e.dragData.touchDragEles);var c=e.findContainerClientCoords();q=c[0],J=c[1],Y=c[2],ee=c[3],R=t.touches[0].clientX-q,z=t.touches[0].clientY-J,B=t.touches[1].clientX-q,V=t.touches[1].clientY-J,te=0<=R&&R<=Y&&0<=B&&B<=Y&&0<=z&&z<=ee&&0<=V&&V<=ee;var l=n.pan(),u=n.zoom();H=ne(R,z,B,V),U=re(R,z,B,V),W=[(R+B)/2,(z+V)/2],G=[(W[0]-l.x)/u,(W[1]-l.y)/u];var f=200,p=f*f;if(U<p&&!t.touches[2]){var m=e.findNearestElement(r[0],r[1],!0,!0),v=e.findNearestElement(r[2],r[3],!0,!0);m&&m.isNode()?(m.activate().emit(s(`cxttapstart`)),e.touchData.start=m):v&&v.isNode()?(v.activate().emit(s(`cxttapstart`)),e.touchData.start=v):n.emit(s(`cxttapstart`)),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(!t.touches[1]&&t.touches[0]){var b=e.findNearestElements(r[0],r[1],!0,!0),x=b[0];if(x!=null&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var S=e.dragData.touchDragEles=n.collection(),C=null;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),x.selected()?(C=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),h(C,{addToList:S})):g(x,{addToList:S}),d(x),x.emit(s(`grabon`)),C?C.forEach(function(e){e.emit(s(`grab`))}):x.emit(s(`grab`))}i(x,[`touchstart`,`tapstart`,`vmousedown`],t,{x:r[0],y:r[1]}),x??(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint(`select`,!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&i(e.touchData.start,[`taphold`],t,{x:r[0],y:r[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var w=e.touchData.startPosition=[null,null,null,null,null,null],T=0;T<r.length;T++)w[T]=a[T]=r[T];var D=t.touches[0];e.touchData.startGPosition=[D.clientX,D.clientY]}}},!1);var ae;e.registerBinding(t,`touchmove`,ae=function(t){var n=e.touchData.capture;if(!(!n&&!E(t))){var r=e.selection,a=e.cy,s=e.touchData.now,c=e.touchData.earlier,l=a.zoom();if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:s[0],y:s[1]}}},f=e.touchData.startGPosition,p;if(n&&t.touches[0]&&f){for(var m=[],g=0;g<s.length;g++)m[g]=s[g]-c[g];var v=t.touches[0].clientX-f[0],y=v*v,b=t.touches[0].clientY-f[1];p=y+b*b>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-q,S=t.touches[0].clientY-J,C=t.touches[1].clientX-q,w=t.touches[1].clientY-J,T=re(x,S,C,w),D=T/U,O=150,k=O*O,A=1.5;if(D>=A*A||T>=k){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var j=d(`cxttapend`);e.touchData.start?(e.touchData.start.unactivate().emit(j),e.touchData.start=null):a.emit(j)}}if(n&&e.touchData.cxt){var j=d(`cxtdrag`);e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.touchData.start?e.touchData.start.emit(j):a.emit(j),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var M=e.findNearestElement(s[0],s[1],!0,!0);(!e.touchData.cxtOver||M!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(d(`cxtdragout`)),e.touchData.cxtOver=M,M&&M.emit(d(`cxtdragover`)))}else if(n&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit(d(`boxstart`)),e.touchData.selecting=!0,e.touchData.didSelect=!0,r[4]=1,!r||r.length===0||r[0]===void 0?(r[0]=(s[0]+s[2]+s[4])/3,r[1]=(s[1]+s[3]+s[5])/3,r[2]=(s[0]+s[2]+s[4])/3+1,r[3]=(s[1]+s[3]+s[5])/3+1):(r[2]=(s[0]+s[2]+s[4])/3,r[3]=(s[1]+s[3]+s[5])/3),e.redrawHint(`select`,!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var N=e.dragData.touchDragEles;if(N){e.redrawHint(`drag`,!0);for(var P=0;P<N.length;P++){var F=N[P]._private;F.grabbed=!1,F.rscratch.inDragLayer=!1}}var I=e.touchData.start,x=t.touches[0].clientX-q,S=t.touches[0].clientY-J,C=t.touches[1].clientX-q,w=t.touches[1].clientY-J,L=ne(x,S,C,w),W=L/H;if(te){var Y=x-R,ee=S-z,ie=C-B,ae=w-V,oe=(Y+ie)/2,se=(ee+ae)/2,ce=a.zoom(),le=ce*W,ue=a.pan(),de=G[0]*ce+ue.x,fe=G[1]*ce+ue.y,pe={x:-le/ce*(de-ue.x-oe)+de,y:-le/ce*(fe-ue.y-se)+fe};if(I&&I.active()){var N=e.dragData.touchDragEles;_(N),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),I.unactivate().emit(d(`freeon`)),N.emit(d(`free`)),e.dragData.didDrag&&(I.emit(d(`dragfreeon`)),N.emit(d(`dragfree`)))}a.viewport({zoom:le,pan:pe,cancelOnFailedZoom:!0}),a.emit(d(`pinchzoom`)),H=L,R=x,z=S,B=C,V=w,e.pinching=!0}if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var me=e.touchData.start,he=e.touchData.last,M;if(!e.hoverData.draggingEles&&!e.swipePanning&&(M=e.findNearestElement(s[0],s[1],!0,!0)),n&&me!=null&&t.preventDefault(),n&&me!=null&&e.nodeIsDraggable(me))if(p){var N=e.dragData.touchDragEles,ge=!e.dragData.didDrag;ge&&h(N,{inDragLayer:!0}),e.dragData.didDrag=!0;var _e={x:0,y:0};if(K(m[0])&&K(m[1])&&(_e.x+=m[0],_e.y+=m[1],ge)){e.redrawHint(`eles`,!0);var ve=e.touchData.dragDelta;ve&&K(ve[0])&&K(ve[1])&&(_e.x+=ve[0],_e.y+=ve[1])}e.hoverData.draggingEles=!0,N.silentShift(_e).emit(d(`position`)).emit(d(`drag`)),e.redrawHint(`drag`,!0),e.touchData.startPosition[0]==c[0]&&e.touchData.startPosition[1]==c[1]&&e.redrawHint(`eles`,!0),e.redraw()}else{var ve=e.touchData.dragDelta=e.touchData.dragDelta||[];ve.length===0?(ve.push(m[0]),ve.push(m[1])):(ve[0]+=m[0],ve[1]+=m[1])}if(i(me||M,[`touchmove`,`tapdrag`,`vmousemove`],t,{x:s[0],y:s[1]}),(!me||!me.grabbed())&&M!=he&&(he&&he.emit(d(`tapdragout`)),M&&M.emit(d(`tapdragover`))),e.touchData.last=M,n)for(var P=0;P<s.length;P++)s[P]&&e.touchData.startPosition[P]&&p&&(e.touchData.singleTouchMoved=!0);if(n&&(me==null||me.pannable())&&a.panningEnabled()&&a.userPanningEnabled()){o(me,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=qn(e.touchData.startPosition)),e.swipePanning?(a.panBy({x:m[0]*l,y:m[1]*l}),a.emit(d(`dragpan`))):p&&(e.swipePanning=!0,a.panBy({x:v*l,y:b*l}),a.emit(d(`dragpan`)),me&&(me.unactivate(),e.redrawHint(`select`,!0),e.touchData.start=null)));var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}}for(var g=0;g<s.length;g++)c[g]=s[g];n&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.redraw())}},!1);var oe;e.registerBinding(t,`touchcancel`,oe=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()});var se,ce,le,ue;if(e.registerBinding(t,`touchend`,se=function(t){var r=e.touchData.start;if(e.touchData.capture)t.touches.length===0&&(e.touchData.capture=!1),t.preventDefault();else return;var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),c=e.touchData.now,l=e.touchData.earlier;if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);c[0]=u[0],c[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);c[2]=u[0],c[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);c[4]=u[0],c[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}};r&&r.unactivate();var f;if(e.touchData.cxt){if(f=d(`cxttapend`),r?r.emit(f):o.emit(f),!e.touchData.cxtDragged){var p=d(`cxttap`);r?r.emit(p):o.emit(p)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!t.touches[2]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var m=o.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint(`select`,!0),o.emit(d(`boxend`)),m.emit(d(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(d(`boxselect`)),m.nonempty()&&e.redrawHint(`eles`,!0),e.redraw()}if(r?.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);else if(!t.touches[1]&&!t.touches[0]&&!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var h=e.dragData.touchDragEles;if(r!=null){var g=r._private.grabbed;_(h),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),g&&(r.emit(d(`freeon`)),h.emit(d(`free`)),e.dragData.didDrag&&(r.emit(d(`dragfreeon`)),h.emit(d(`dragfree`)))),i(r,[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]}),r.unactivate(),e.touchData.start=null}else i(e.findNearestElement(c[0],c[1],!0,!0),[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]});var v=e.touchData.startPosition[0]-c[0],y=v*v,b=e.touchData.startPosition[1]-c[1],x=(y+b*b)*s*s;e.touchData.singleTouchMoved||(r||o.$(`:selected`).unselect([`tapunselect`]),i(r,[`tap`,`vclick`],t,{x:c[0],y:c[1]}),ce=!1,t.timeStamp-ue<=o.multiClickDebounceTime()?(le&&clearTimeout(le),ce=!0,ue=null,i(r,[`dbltap`,`vdblclick`],t,{x:c[0],y:c[1]})):(le=setTimeout(function(){ce||i(r,[`onetap`,`voneclick`],t,{x:c[0],y:c[1]})},o.multiClickDebounceTime()),ue=t.timeStamp)),r!=null&&!e.dragData.didDrag&&r._private.selectable&&x<e.touchTapThreshold2&&!e.pinching&&(o.selectionType()===`single`?(o.$(n).unmerge(r).unselect([`tapunselect`]),r.select([`tapselect`])):r.selected()?r.unselect([`tapunselect`]):r.select([`tapselect`]),e.redrawHint(`eles`,!0)),e.touchData.singleTouchMoved=!0}for(var S=0;S<c.length;S++)l[S]=c[S];e.dragData.didDrag=!1,t.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),t.touches.length<2&&(t.touches.length===1&&(e.touchData.startGPosition=[t.touches[0].clientX,t.touches[0].clientY]),e.pinching=!1,e.redrawHint(`eles`,!0),e.redraw())},!1),typeof TouchEvent>`u`){var de=[],fe=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},pe=function(e){return{event:e,touch:fe(e)}},me=function(e){de.push(pe(e))},he=function(e){for(var t=0;t<de.length;t++)if(de[t].event.pointerId===e.pointerId){de.splice(t,1);return}},ge=function(e){var t=de.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=fe(e)},_e=function(e){e.touches=de.map(function(e){return e.touch})},ve=function(e){return e.pointerType===`mouse`||e.pointerType===4};e.registerBinding(e.container,`pointerdown`,function(e){ve(e)||(e.preventDefault(),me(e),_e(e),ie(e))}),e.registerBinding(e.container,`pointerup`,function(e){ve(e)||(he(e),_e(e),se(e))}),e.registerBinding(e.container,`pointercancel`,function(e){ve(e)||(he(e),_e(e),oe(e))}),e.registerBinding(e.container,`pointermove`,function(e){ve(e)||(e.preventDefault(),ge(e),_e(e),ae(e))})}};var ip={};ip.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(`polygon`,e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return Hr(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return Mr(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:e!==`rectangle`,miterBounds:function(e,t,n,r,i,a){return Cr(this.points,e,t,n,r,i)}}},ip.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:`ellipse`,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return Ir(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return Lr(e,t,r,i,a,o,n)}}},ip.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(o[s]!==void 0&&o[s+`-cx`]===e&&o[s+`-cy`]===n)return o[s];o[s]=Array(t.length/2),o[s+`-cx`]=e,o[s+`-cy`]=n;var c=r/2,l=i/2;a=a===`auto`?Yr(r,i):a;for(var u=Array(t.length/2),d=0;d<t.length/2;d++)u[d]={x:e+c*t[d*2],y:n+l*t[d*2+1]};var f,p,m,h,g=u.length;for(p=u[g-1],f=0;f<g;f++)m=u[f%g],h=u[(f+1)%g],o[s][f]=Rf(p,m,h,a),p=m,m=h;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl(`round-polygon`,e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,`drawCorners`))},intersectLine:function(e,t,n,r,i,a,o,s,c){return Ur(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,c,`corners`))},checkPoint:function(e,t,n,r,i,a,o,s,c){return Nr(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,c,`corners`))}}},ip.generateRoundRectangle=function(){return this.nodeShapes[`round-rectangle`]=this.nodeShapes.roundrectangle={renderer:this,name:`round-rectangle`,points:Gr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return wr(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var c=r/2,l=i/2;s=s===`auto`?Jr(r,i):s,s=Math.min(c,l,s);var u=s*2;return!!(Mr(e,t,this.points,a,o,r,i-u,[0,-1],n)||Mr(e,t,this.points,a,o,r-u,i,[0,-1],n)||Lr(e,t,u,u,a-c+s,o-l+s,n)||Lr(e,t,u,u,a+c-s,o-l+s,n)||Lr(e,t,u,u,a+c-s,o+l-s,n)||Lr(e,t,u,u,a-c+s,o+l-s,n))}}},ip.generateCutRectangle=function(){return this.nodeShapes[`cut-rectangle`]=this.nodeShapes.cutrectangle={renderer:this,name:`cut-rectangle`,cornerLength:Xr(),points:Gr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a=i===`auto`?this.cornerLength:i,o=t/2,s=e/2,c=n-s,l=n+s,u=r-o,d=r+o;return{topLeft:[c,u+a,c+a,u,c+a,u+a],topRight:[l-a,u,l,u+a,l-a,u+a],bottomRight:[l,d-a,l-a,d,l-a,d-a],bottomLeft:[c+a,d,c,d-a,c+a,d-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var c=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s);return Hr(i,a,[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var c=s===`auto`?this.cornerLength:s;if(Mr(e,t,this.points,a,o,r,i-2*c,[0,-1],n)||Mr(e,t,this.points,a,o,r-2*c,i,[0,-1],n))return!0;var l=this.generateCutTrianglePts(r,i,a,o);return jr(e,t,l.topLeft)||jr(e,t,l.topRight)||jr(e,t,l.bottomRight)||jr(e,t,l.bottomLeft)}}},ip.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:`barrel`,points:Gr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var c=.15,l=.5,u=.85,d=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),f=function(e){var t=or({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},c),n=or({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},l),r=or({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},u);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]};return Hr(i,a,[].concat(f(d.topLeft),f(d.topRight),f(d.bottomRight),f(d.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,c=r-i,l=r+i,u=Qr(e,t),d=u.heightOffset,f=u.widthOffset,p=u.ctrlPtOffsetPct*e,m={topLeft:[o,c+d,o+p,c,o+f,c],topRight:[s-f,c,s-p,c,s,c+d],bottomRight:[s,l-d,s-p,l,s-f,l],bottomLeft:[o+f,l,o+p,l,o,l-d]};return m.topLeft.isTop=!0,m.topRight.isTop=!0,m.bottomLeft.isBottom=!0,m.bottomRight.isBottom=!0,m},checkPoint:function(e,t,n,r,i,a,o,s){var c=Qr(r,i),l=c.heightOffset,u=c.widthOffset;if(Mr(e,t,this.points,a,o,r,i-2*l,[0,-1],n)||Mr(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,i,a,o),f=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1];if(Math.min(r,a)<=e&&e<=Math.max(r,a)&&Math.min(o,s)<=t&&t<=Math.max(o,s)){var c=Zr(r,i,a),l=Dr(c[0],c[1],c[2],e).filter(function(e){return 0<=e&&e<=1});if(l.length>0)return l[0]}return null},p=Object.keys(d),m=0;m<p.length;m++){var h=d[p[m]],g=f(e,t,h);if(g!=null){var _=h[5],v=h[3],y=h[1],b=ar(_,v,y,g);if(h.isTop&&b<=t||h.isBottom&&t<=b)return!0}}return!1}}},ip.generateBottomRoundrectangle=function(){return this.nodeShapes[`bottom-round-rectangle`]=this.nodeShapes.bottomroundrectangle={renderer:this,name:`bottom-round-rectangle`,points:Gr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var c=e-(n/2+o),l=t-(r/2+o),u=l,d=Br(i,a,e,t,c,l,e+(n/2+o),u,!1);return d.length>0?d:wr(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){s=s===`auto`?Jr(r,i):s;var c=2*s;if(Mr(e,t,this.points,a,o,r,i-c,[0,-1],n)||Mr(e,t,this.points,a,o,r-c,i,[0,-1],n))return!0;var l=r/2+2*n,u=i/2+2*n;return!!(jr(e,t,[a-l,o-u,a-l,o,a+l,o,a+l,o-u])||Lr(e,t,c,c,a+r/2-s,o+i/2-s,n)||Lr(e,t,c,c,a-r/2+s,o+i/2-s,n))}}},ip.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon(`triangle`,Gr(3,0)),this.generateRoundPolygon(`round-triangle`,Gr(3,0)),this.generatePolygon(`rectangle`,Gr(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon(`diamond`,n),this.generateRoundPolygon(`round-diamond`,n),this.generatePolygon(`pentagon`,Gr(5,0)),this.generateRoundPolygon(`round-pentagon`,Gr(5,0)),this.generatePolygon(`hexagon`,Gr(6,0)),this.generateRoundPolygon(`round-hexagon`,Gr(6,0)),this.generatePolygon(`heptagon`,Gr(7,0)),this.generateRoundPolygon(`round-heptagon`,Gr(7,0)),this.generatePolygon(`octagon`,Gr(8,0)),this.generateRoundPolygon(`round-octagon`,Gr(8,0));var r=Array(20),i=qr(5,0),a=qr(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[s*2]*=o,a[s*2+1]*=o;for(var s=0;s<20/4;s++)r[s*4]=i[s*2],r[s*4+1]=i[s*2+1],r[s*4+2]=a[s*2],r[s*4+3]=a[s*2+1];r=Kr(r),this.generatePolygon(`star`,r),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 c=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon(`tag`,c),this.generateRoundPolygon(`round-tag`,c),e.makePolygon=function(e){var n=`polygon-`+e.join(`$`),r;return(r=this[n])?r:t.generatePolygon(n,e)}};var ap={};ap.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},ap.redraw=function(e){e||=cn();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},ap.beforeRender=function(e,t){if(!this.destroyed){t??$t(`Priority is not optional for beforeRender`);var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var op=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};ap.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){op(e,!0,r);var i=Ot();e.render(e.renderOptions);var a=e.lastDrawTime=Ot();e.averageRedrawTime===void 0&&(e.averageRedrawTime=a-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else op(e,!1,r);e.skipFrame=!1,Dt(n)}};Dt(n)}};var sp=function(e){this.init(e)},cp=sp.prototype;cp.clientFunctions=[`redrawHint`,`render`,`renderTo`,`matchCanvasSize`,`nodeShapeImpl`,`arrowShapeImpl`],cp.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var i=r.document,a=i.head,o=`__________cytoscape_stylesheet`,s=`__________cytoscape_container`,c=i.getElementById(o)!=null;if(n.className.indexOf(s)<0&&(n.className=(n.className||``)+` `+s),!c){var l=i.createElement(`style`);l.id=o,l.textContent=`.`+s+` { position: relative; }`,a.insertBefore(l,a.children[0])}r.getComputedStyle(n).getPropertyValue(`position`)===`static`&&tn(`A Cytoscape container has style position:static and so can not use UI extensions properly`)}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.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]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=K(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},cp.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e===`init`){n.load();return}if(e===`destroy`){n.destroy();return}(e===`add`||e===`remove`||e===`move`&&r.hasCompoundNodes()||e===`load`||e===`zorder`||e===`mount`)&&n.invalidateCachedZSortedEles(),e===`viewport`&&n.redrawHint(`select`,!0),e===`gc`&&n.redrawHint(`gc`,!0),(e===`load`||e===`resize`||e===`mount`)&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),this.startRenderLoop(),this.redraw()}},cp.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},cp.isHeadless=function(){return!1},[ff,tp,np,rp,ip,ap].forEach(function(e){X(cp,e)});var lp=1e3/60,up={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Ct(function(){n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),n.redraw()},e.deqRedrawThreshold),i=function(i,a){var o=Ot(),s=n.averageRedrawTime,c=n.lastRedrawTime,l=[],u=n.cy.extent(),d=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var f=Ot(),p=f-o,m=f-a;if(c<lp){var h=lp-(i?s:0);if(m>=e.deqFastCost*h)break}else if(i){if(p>=e.deqCost*c||p>=e.deqAvgCost*s)break}else if(m>=e.deqNoDrawCost*lp)break;var g=e.deq(t,d,u);if(g.length>0)for(var _=0;_<g.length;_++)l.push(g[_]);else break}l.length>0&&(e.onDeqd(t,l),!i&&e.shouldRedraw(t,l,d,u)&&r())},a=e.priority||Qt;n.beforeRender(i,a(t))}}}},dp=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xt;y(this,e),this.idsByKey=new gn,this.keyForId=new gn,this.cachesByLvl=new gn,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return x(e,[{key:`getIdsFor`,value:function(e){e??$t(`Can not get id list for null key`);var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new yn,t.set(e,n)),n}},{key:`addIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).add(t)}},{key:`deleteIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).delete(t)}},{key:`getNumberOfIdsForKey`,value:function(e){return e==null?0:this.getIdsFor(e).size}},{key:`updateKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:`deleteKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:`keyHasChangedFor`,value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:`isInvalid`,value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:`getCachesAt`,value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new gn,t.set(e,r),n.push(e)),r}},{key:`getCache`,value:function(e,t){return this.getCachesAt(t).get(e)}},{key:`get`,value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return r!=null&&this.updateKeyMappingFor(e),r}},{key:`getForCachedKey`,value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:`hasCache`,value:function(e,t){return this.getCachesAt(t).has(e)}},{key:`has`,value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:`setCache`,value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:`set`,value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:`deleteCache`,value:function(e,t){this.getCachesAt(t).delete(e)}},{key:`delete`,value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:`invalidateKey`,value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:`invalidate`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||this.getNumberOfIdsForKey(n)===0}}])}(),fp=25,pp=50,mp=-4,hp=3,gp=7.99,_p=8,vp=1024,yp=1024,bp=1024,xp=.2,Sp=.8,Cp=10,wp=.15,Tp=.1,Ep=.9,Dp=.9,Op=100,kp=1,Ap={dequeue:`dequeue`,downscale:`downscale`,highQuality:`highQuality`},jp=ln({getKey:null,doesEleInvalidateKey:Xt,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Yt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Mp=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=jp(t);X(n,r),n.lookup=new dp(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Np=Mp.prototype;Np.reasons=Ap,Np.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Np.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{};return n[e]=n[e]||[]},Np.getElementQueue=function(){var e=this;return e.eleCacheQueue=e.eleCacheQueue||new An(function(e,t){return t.reqs-e.reqs})},Np.getElementKeyToQueue=function(){var e=this;return e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{}},Np.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),c=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(r??=Math.ceil(er(s*n)),r<mp)r=mp;else if(s>=gp||r>hp)return null;var l=2**r,u=t.h*l,d=t.w*l,f=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,f))return null;var p=c.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var m=u<=fp?fp:u<=pp?pp:Math.ceil(u/pp)*pp;if(u>bp||d>yp)return null;var h=a.getTextureQueue(m),g=h[h.length-2],_=function(){return a.recycleTexture(m,d)||a.addTexture(m,d)};g||=h[h.length-1],g||=_(),g.width-g.usedWidth<d&&(g=_());for(var v=function(e){return e&&e.scaledLabelShown===f},y=i&&i===Ap.dequeue,b=i&&i===Ap.highQuality,x=i&&i===Ap.downscale,S,C=r+1;C<=hp;C++){var w=c.get(e,C);if(w){S=w;break}}var T=S&&S.level===r+1?S:null,E=function(){g.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,g.usedWidth,0,d,u)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,d,m),v(T))E();else if(v(S))if(b){for(var D=S.level;D>r;D--)T=a.getElement(e,t,n,D,Ap.downscale);E()}else return a.queueElement(e,S.level-1),S;else{var O;if(!y&&!b&&!x)for(var k=r-1;k>=mp;k--){var A=c.get(e,k);if(A){O=A;break}}if(v(O))return a.queueElement(e,r),O;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,e,t,f,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:l,width:d,height:u,scaledLabelShown:f},g.usedWidth+=Math.ceil(d+_p),g.eleCaches.push(p),c.set(e,r,p),a.checkTextureFullness(g),p},Np.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Np.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var i=mp;i<=hp;i++){var a=n.getForCachedKey(e,i);a&&r.push(a)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],c=s.texture;c.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},Np.checkTextureUtility=function(e){e.invalidatedWidth>=xp*e.width&&this.retireTexture(e)},Np.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>Sp&&e.fullnessChecks>=Cp?un(t,e):e.fullnessChecks++},Np.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;un(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}dn(a),t.getRetiredTextureQueue(n).push(e)},Np.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),i={};return r.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(vp,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=n.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext(`2d`),i},Np.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,dn(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),un(i,o),r.push(o),o}},Np.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},Np.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<kp&&n.size()>0;o++){var s=n.pop(),c=s.key,l=s.eles[0],u=a.hasCache(l,s.level);if(r[c]=null,!u){i.push(s);var d=t.getBoundingBox(l);t.getElement(l,d,e,s.level,Ap.dequeue)}}return i},Np.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];a!=null&&(a.eles.length===1?(a.reqs=Jt,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},Np.onDequeue=function(e){this.onDequeues.push(e)},Np.offDequeue=function(e){un(this.onDequeues,e)},Np.setupDequeueing=up.setupDequeueing({deqRedrawThreshold:Op,deqCost:wp,deqAvgCost:Tp,deqNoDrawCost:Ep,deqFastCost:Dp,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(_r(a[o].boundingBox(),r))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Pp=1,Fp=-4,Ip=2,Lp=3.99,Rp=50,zp=50,Bp=.15,Vp=.1,Hp=.9,Up=.9,Wp=1,Gp=250,Kp=4e3*4e3,qp=32767,Jp=!0,Yp=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Ot()-2*Gp,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Ct(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},zp),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=Gp?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new An(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},Xp=Yp.prototype,Zp=0,Qp=2**53-1;Xp.makeLayer=function(e,t){var n=2**t,r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:Zp=++Zp%Qp,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext(`2d`),eles:[],elesQueue:[],reqs:0},s=o.context,c=-o.bb.x1,l=-o.bb.y1;return s.scale(n,n),s.translate(c,l),o},Xp.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(er(i*t)),n<Fp)n=Fp;else if(i>=Lp||n>Ip)return null}r.validateLayersElesOrdering(n,e);var o=r.layersByLevel,s=2**n,c=o[n]=o[n]||[],l,u=r.levelIsComplete(n,e),d,f=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=o[t],!0},i=function(e){if(!d)for(var r=n+e;Fp<=r&&r<=Ip&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var s=c[a];s.invalid&&un(c,s)}};if(!u)f();else return c;var p=function(){if(!l){l=lr();for(var t=0;t<e.length;t++)fr(l,e[t].boundingBox())}return l},m=function(e){e||={};var t=e.after;p();var i=Math.ceil(l.w*s),a=Math.ceil(l.h*s);if(i>qp||a>qp||i*a>Kp)return null;var o=r.makeLayer(l,n);if(t!=null){var u=c.indexOf(t)+1;c.splice(u,0,o)}else (e.insert===void 0||e.insert)&&c.unshift(o);return o};if(r.skipping&&!a)return null;for(var h=null,g=e.length/Pp,_=!a,v=0;v<e.length;v++){var y=e[v],b=y._private.rscratch,x=b.imgLayerCaches=b.imgLayerCaches||{},S=x[n];if(S){h=S;continue}if((!h||h.eles.length>=g||!br(h.bb,y.boundingBox()))&&(h=m({insert:!0,after:h}),!h))return null;d||_?r.queueLayer(h,y):r.drawEleInLayer(h,y,n,t),h.eles.push(y),x[n]=h}return d||(_?null:c)},Xp.getEleLevelForLayerLevel=function(e,t){return e},Xp.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();s.w===0||s.h===0||!t.visible()||(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,Jp),a.setImgSmoothing(o,!0))},Xp.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||n.length===0)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0||a.invalid)return!1;r+=a.eles.length}return r===t.length},Xp.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},Xp.updateElementsInLayers=function(e,t){for(var n=this,r=ee(e[0]),i=0;i<e.length;i++)for(var a=r?null:e[i],o=r?e[i]:e[i].ele,s=o._private.rscratch,c=s.imgLayerCaches=s.imgLayerCaches||{},l=Fp;l<=Ip;l++){var u=c[l];u&&(a&&n.getEleLevelForLayerLevel(u.level)!==a.level||t(u,o,a))}},Xp.haveLayers=function(){for(var e=this,t=!1,n=Fp;n<=Ip;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},Xp.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Ot(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},Xp.invalidateLayer=function(e){if(this.lastInvalidationTime=Ot(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];un(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},Xp.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||(i=e.replacement=t.makeLayer(e.bb,e.level),i.replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},Xp.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},Xp.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},Xp.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<Wp&&n.size()!==0;){var a=n.peek();if(a.replacement){n.pop();continue}if(a.replaces&&a!==a.replaces.replacement){n.pop();continue}if(a.invalid){n.pop();continue}var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),r.length===0&&r.push(!0),a.elesQueue.length===0&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}return r},Xp.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},Xp.requestRedraw=Ct(function(){var e=this.renderer;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),e.redraw()},100),Xp.setupDequeueing=up.setupDequeueing({deqRedrawThreshold:Rp,deqCost:Bp,deqAvgCost:Vp,deqNoDrawCost:Hp,deqFastCost:Up,deq:function(e,t){return e.dequeue(t)},onDeqd:Qt,shouldRedraw:Yt,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var $p={},em;function tm(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function nm(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];i===0&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function rm(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(var i=1;i<o.length;i++){var a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function im(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,Math.PI*2,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var c=a[s];e.lineTo(c.x,c.y)}e.closePath&&e.closePath()}function am(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}$p.arrowShapeImpl=function(e){return(em||={polygon:tm,"triangle-backcurve":nm,"triangle-tee":rm,"circle-triangle":im,"triangle-cross":rm,circle:am})[e]};var om={};om.drawElement=function(e,t,n,r,i,a){var o=this;t.isNode()?o.drawNode(e,t,n,r,i,a):o.drawEdge(e,t,n,r,i,a)},om.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},om.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},om.drawCachedElementPortion=function(e,t,n,r,i,a,o,s){var c=this,l=n.getBoundingBox(t);if(!(l.w===0||l.h===0)){var u=n.getElement(t,l,r,i,a);if(u!=null){var d=s(c,t);if(d===0)return;var f=o(c,t),p=l.x1,m=l.y1,h=l.w,g=l.h,_,v,y,b,x;if(f!==0){var S=n.getRotationPoint(t);y=S.x,b=S.y,e.translate(y,b),e.rotate(f),x=c.getImgSmoothing(e),x||c.setImgSmoothing(e,!0);var C=n.getRotationOffset(t);_=C.x,v=C.y}else _=p,v=m;var w;d!==1&&(w=e.globalAlpha,e.globalAlpha=w*d),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,_,v,h,g),d!==1&&(e.globalAlpha=w),f!==0&&(e.rotate(-f),e.translate(-y,-b),x||c.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var sm=function(){return 0},cm=function(e,t){return e.getTextAngle(t,null)},lm=function(e,t){return e.getTextAngle(t,`source`)},um=function(e,t){return e.getTextAngle(t,`target`)},dm=function(e,t){return t.effectiveOpacity()},fm=function(e,t){return t.pstyle(`text-opacity`).pfValue*t.effectiveOpacity()};om.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,c=s.eleTxrCache,l=s.lblTxrCache,u=s.slbTxrCache,d=s.tlbTxrCache,f=t.boundingBox(),p=a===!0?c.reasons.highQuality:null;if(!(f.w===0||f.h===0||!t.visible())&&(!r||_r(f,r))){var m=t.isEdge(),h=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,c,n,i,p,sm,dm),(!m||!h)&&o.drawCachedElementPortion(e,t,l,n,i,p,cm,fm),m&&!h&&(o.drawCachedElementPortion(e,t,u,n,i,p,lm,fm),o.drawCachedElementPortion(e,t,d,n,i,p,um,fm)),o.drawElementOverlay(e,t)}},om.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},om.drawCachedElements=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];i.drawCachedElement(e,o,n,r)}},om.drawCachedNodes=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];o.isNode()&&i.drawCachedElement(e,o,n,r)}},om.drawLayeredElements=function(e,t,n,r){var i=this,a=i.data.lyrTxrCache.getLayers(t,n);if(a)for(var o=0;o<a.length;o++){var s=a[o],c=s.bb;c.w===0||c.h===0||e.drawImage(s.canvas,c.x1,c.y1,c.w,c.h)}else i.drawCachedElements(e,t,n,r)};var pm={};pm.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=t._private.rscratch;if(!(a&&!t.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var c;n&&(c=n,e.translate(-c.x1,-c.y1));var l=a?t.pstyle(`opacity`).value:1,u=a?t.pstyle(`line-opacity`).value:1,d=t.pstyle(`curve-style`).value,f=t.pstyle(`line-style`).value,p=t.pstyle(`width`).pfValue,m=t.pstyle(`line-cap`).value,h=t.pstyle(`line-outline-width`).value,g=t.pstyle(`line-outline-color`).value,_=l*u,v=l*u,y=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;d===`straight-triangle`?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=m,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},b=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;if(e.lineWidth=p+h,e.lineCap=m,h>0)o.colorStrokeStyle(e,g[0],g[1],g[2],n);else{e.lineCap=`butt`;return}d===`straight-triangle`?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},x=function(){i&&o.drawEdgeOverlay(e,t)},S=function(){i&&o.drawEdgeUnderlay(e,t)},C=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};if(e.lineJoin=`round`,t.pstyle(`ghost`).value===`yes`){var T=t.pstyle(`ghost-offset-x`).pfValue,E=t.pstyle(`ghost-offset-y`).pfValue,D=_*t.pstyle(`ghost-opacity`).value;e.translate(T,E),y(D),C(D),e.translate(-T,-E)}else b();S(),y(),C(),x(),w(),n&&e.translate(c.x1,c.y1)}};var mm=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n){if(n.visible()){var r=n.pstyle(`${e}-opacity`).value;if(r!==0){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-color`).value;t.lineWidth=s,o.edgeType===`self`&&!a?t.lineCap=`butt`:t.lineCap=`round`,i.colorStrokeStyle(t,c[0],c[1],c[2],r),i.drawEdgePath(n,t,o.allpts,`solid`)}}}};pm.drawEdgeOverlay=mm(`overlay`),pm.drawEdgeUnderlay=mm(`underlay`),pm.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o,s=!1,c=this.usePaths(),l=e.pstyle(`line-dash-pattern`).pfValue,u=e.pstyle(`line-dash-offset`).pfValue;if(c){var d=n.join(`$`);i.pathCacheKey&&i.pathCacheKey===d?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=d,i.pathCache=o)}if(a.setLineDash)switch(r){case`dotted`:a.setLineDash([1,1]);break;case`dashed`:a.setLineDash(l),a.lineDashOffset=u;break;case`solid`:a.setLineDash([]);break}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case`bezier`:case`self`:case`compound`:case`multibezier`:for(var f=2;f+3<n.length;f+=4)t.quadraticCurveTo(n[f],n[f+1],n[f+2],n[f+3]);break;case`straight`:case`haystack`:for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1]);break;case`segments`:if(i.isRound){var m=S(i.roundCorners),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;Lf(t,g)}}catch(e){m.e(e)}finally{m.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var _=2;_+1<n.length;_+=2)t.lineTo(n[_],n[_+1]);break}t=a,c?t.stroke(o):t.stroke(),t.setLineDash&&t.setLineDash([])},pm.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle(`width`).pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],c=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-c[0],n[i+1]-c[1]),t.lineTo(n[i]+c[0],n[i+1]+c[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},pm.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i=r.edgeType===`haystack`;i||this.drawArrowhead(e,t,`source`,r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,`mid-target`,r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,`mid-source`,r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,`target`,r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},pm.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||r==null||isNaN(i)||i==null||isNaN(a)||a==null)){var s=this,c=t.pstyle(n+`-arrow-shape`).value;if(c!==`none`){var l=t.pstyle(n+`-arrow-fill`).value===`hollow`?`both`:`filled`,u=t.pstyle(n+`-arrow-fill`).value,d=t.pstyle(`width`).pfValue,f=t.pstyle(n+`-arrow-width`),p=f.value===`match-line`?d:f.pfValue;f.units===`%`&&(p*=d);var m=t.pstyle(`opacity`).value;o===void 0&&(o=m);var h=e.globalCompositeOperation;(o!==1||u===`hollow`)&&(e.globalCompositeOperation=`destination-out`,s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,l,d,c,p,r,i,a),e.globalCompositeOperation=h);var g=t.pstyle(n+`-arrow-color`).value;s.colorFillStyle(e,g[0],g[1],g[2],o),s.colorStrokeStyle(e,g[0],g[1],g[2],o),s.drawArrowShape(t,e,u,d,c,p,r,i,a)}}},pm.drawArrowShape=function(e,t,n,r,i,a,o,s,c){var l=this,u=this.usePaths()&&i!==`triangle-cross`,d=!1,f,p=t,m={x:o,y:s},h=e.pstyle(`arrow-scale`).value,g=this.getArrowWidth(r,h),_=l.arrowShapes[i];if(u){var v=l.arrowPathCache=l.arrowPathCache||[],y=zt(i),b=v[y];b==null?(f=t=new Path2D,v[y]=f):(f=t=b,d=!0)}d||(t.beginPath&&t.beginPath(),u?_.draw(t,1,0,{x:0,y:0},1):_.draw(t,g,c,m,r),t.closePath&&t.closePath()),t=p,u&&(t.translate(o,s),t.rotate(c),t.scale(g,g)),(n===`filled`||n===`both`)&&(u?t.fill(f):t.fill()),(n===`hollow`||n===`both`)&&(t.lineWidth=a/(u?g:1),t.lineJoin=`miter`,u?t.stroke(f):t.stroke()),u&&(t.scale(1/g,1/g),t.rotate(-c),t.translate(-o,-s))};var hm={};hm.safeDrawImage=function(e,t,n,r,i,a,o,s,c,l){if(!(i<=0||a<=0||c<=0||l<=0))try{e.drawImage(t,n,r,i,a,o,s,c,l)}catch(e){tn(e)}},hm.drawInscribedImage=function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,c=o.y,l=n.cy().style(),u=l.getIndexedStyle.bind(l),d=u(n,`background-fit`,`value`,r),f=u(n,`background-repeat`,`value`,r),p=n.width(),m=n.height(),h=n.padding()*2,g=p+(u(n,`background-width-relative-to`,`value`,r)===`inner`?0:h),_=m+(u(n,`background-height-relative-to`,`value`,r)===`inner`?0:h),v=n._private.rscratch,y=u(n,`background-clip`,`value`,r)===`node`,b=u(n,`background-image-opacity`,`value`,r)*i,x=u(n,`background-image-smoothing`,`value`,r),S=n.pstyle(`corner-radius`).value;S!==`auto`&&(S=n.pstyle(`corner-radius`).pfValue);var C=t.width||t.cachedW,w=t.height||t.cachedH;(C==null||w==null)&&(document.body.appendChild(t),C=t.cachedW=t.width||t.offsetWidth,w=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var T=C,E=w;if(u(n,`background-width`,`value`,r)!==`auto`&&(T=u(n,`background-width`,`units`,r)===`%`?u(n,`background-width`,`pfValue`,r)*g:u(n,`background-width`,`pfValue`,r)),u(n,`background-height`,`value`,r)!==`auto`&&(E=u(n,`background-height`,`units`,r)===`%`?u(n,`background-height`,`pfValue`,r)*_:u(n,`background-height`,`pfValue`,r)),!(T===0||E===0)){if(d===`contain`){var D=Math.min(g/T,_/E);T*=D,E*=D}else if(d===`cover`){var D=Math.max(g/T,_/E);T*=D,E*=D}var O=s-g/2,k=u(n,`background-position-x`,`units`,r),A=u(n,`background-position-x`,`pfValue`,r);k===`%`?O+=(g-T)*A:O+=A;var j=u(n,`background-offset-x`,`units`,r),M=u(n,`background-offset-x`,`pfValue`,r);j===`%`?O+=(g-T)*M:O+=M;var N=c-_/2,P=u(n,`background-position-y`,`units`,r),F=u(n,`background-position-y`,`pfValue`,r);P===`%`?N+=(_-E)*F:N+=F;var I=u(n,`background-offset-y`,`units`,r),L=u(n,`background-offset-y`,`pfValue`,r);I===`%`?N+=(_-E)*L:N+=L,v.pathCache&&(O-=s,N-=c,s=0,c=0);var R=e.globalAlpha;e.globalAlpha=b;var z=a.getImgSmoothing(e),B=!1;x===`no`&&z?(a.setImgSmoothing(e,!1),B=!0):x===`yes`&&!z&&(a.setImgSmoothing(e,!0),B=!0),f===`no-repeat`?(y&&(e.save(),v.pathCache?e.clip(v.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.clip())),a.safeDrawImage(e,t,0,0,C,w,O,N,T,E),y&&e.restore()):(e.fillStyle=e.createPattern(t,f),a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.translate(O,N),e.fill(),e.translate(-O,-N)),e.globalAlpha=R,B&&a.setImgSmoothing(e,z)}};var gm={};gm.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio();t=2**Math.ceil(er(n*r))}return!(e.pstyle(`font-size`).pfValue*t<e.pstyle(`min-zoomed-font-size`).pfValue)},gm.drawElementText=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(r==null){if(a&&!o.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle(`label`);if(!s||!s.value)return;e.textAlign=o.getLabelJustification(t),e.textBaseline=`bottom`}else{var c=t.element()._private.rscratch.badLine,l=t.pstyle(`label`),u=t.pstyle(`source-label`),d=t.pstyle(`target-label`);if(c||(!l||!l.value)&&(!u||!u.value)&&(!d||!d.value))return;e.textAlign=`center`,e.textBaseline=`bottom`}var f=!n,p;n&&(p=n,e.translate(-p.x1,-p.y1)),i==null?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,`source`,f,a),o.drawText(e,t,`target`,f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},gm.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},gm.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle(`font-style`).strValue,i=t.pstyle(`font-size`).pfValue+`px`,a=t.pstyle(`font-family`).strValue,o=t.pstyle(`font-weight`).strValue,s=n?t.effectiveOpacity()*t.pstyle(`text-opacity`).value:1,c=t.pstyle(`text-outline-opacity`).value*s,l=t.pstyle(`color`).value,u=t.pstyle(`text-outline-color`).value;e.font=r+` `+o+` `+i+` `+a,e.lineJoin=`round`,this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,u[0],u[1],u[2],c)};function _m(e,t,n,r,i){var a=Math.min(r,i)/2,o=t+r/2,s=n+i/2;e.beginPath(),e.arc(o,s,a,0,Math.PI*2),e.closePath()}function vm(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}gm.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`);if(a.strValue===`autorotate`){var o=pn(r,`labelAngle`,t);n=e.isEdge()?o:0}else n=a.strValue===`none`?0:a.pfValue;return n},gm.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!(i&&(o===0||t.pstyle(`text-opacity`).value===0))){n===`main`&&(n=null);var s=pn(a,`labelX`,n),c=pn(a,`labelY`,n),l,u,d=this.getLabelText(t,n);if(d!=null&&d!==``&&!isNaN(s)&&!isNaN(c)){this.setupTextStyle(e,t,i);var f=n?n+`-`:``,p=pn(a,`labelWidth`,n),m=pn(a,`labelHeight`,n),h=t.pstyle(f+`text-margin-x`).pfValue,g=t.pstyle(f+`text-margin-y`).pfValue,_=t.isEdge(),v=t.pstyle(`text-halign`).value,y=t.pstyle(`text-valign`).value;_&&(v=`center`,y=`center`),s+=h,c+=g;var b=r?this.getTextAngle(t,n):0;switch(b!==0&&(l=s,u=c,e.translate(l,u),e.rotate(b),s=0,c=0),y){case`top`:break;case`center`:c+=m/2;break;case`bottom`:c+=m;break}var x=t.pstyle(`text-background-opacity`).value,S=t.pstyle(`text-border-opacity`).value,C=t.pstyle(`text-border-width`).pfValue,w=t.pstyle(`text-background-padding`).pfValue,T=t.pstyle(`text-background-shape`).strValue,E=T===`round-rectangle`||T===`roundrectangle`,D=T===`circle`,O=2;if(x>0||C>0&&S>0){var k=e.fillStyle,A=e.strokeStyle,j=e.lineWidth,M=t.pstyle(`text-background-color`).value,N=t.pstyle(`text-border-color`).value,P=t.pstyle(`text-border-style`).value,F=x>0,I=C>0&&S>0,L=s-w;switch(v){case`left`:L-=p;break;case`center`:L-=p/2;break}var R=c-m-w,z=p+2*w,B=m+2*w;if(F&&(e.fillStyle=`rgba(${M[0]},${M[1]},${M[2]},${x*o})`),I&&(e.strokeStyle=`rgba(${N[0]},${N[1]},${N[2]},${S*o})`,e.lineWidth=C,e.setLineDash))switch(P){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`double`:e.lineWidth=C/4,e.setLineDash([]);break;default:e.setLineDash([]);break}if(E?(e.beginPath(),vm(e,L,R,z,B,O)):D?(e.beginPath(),_m(e,L,R,z,B)):(e.beginPath(),e.rect(L,R,z,B)),F&&e.fill(),I&&e.stroke(),I&&P===`double`){var V=C/2;e.beginPath(),E?vm(e,L+V,R+V,z-2*V,B-2*V,O):e.rect(L+V,R+V,z-2*V,B-2*V),e.stroke()}e.fillStyle=k,e.strokeStyle=A,e.lineWidth=j,e.setLineDash&&e.setLineDash([])}var H=2*t.pstyle(`text-outline-width`).pfValue;if(H>0&&(e.lineWidth=H),t.pstyle(`text-wrap`).value===`wrap`){var U=pn(a,`labelWrapCachedLines`,n),W=pn(a,`labelLineHeight`,n),G=p/2,K=this.getLabelJustification(t);switch(K===`auto`||(v===`left`?K===`left`?s+=-p:K===`center`&&(s+=-G):v===`center`?K===`left`?s+=-G:K===`right`&&(s+=G):v===`right`&&(K===`center`?s+=G:K===`right`&&(s+=p))),y){case`top`:c-=(U.length-1)*W;break;case`center`:case`bottom`:c-=(U.length-1)*W;break}for(var q=0;q<U.length;q++)H>0&&e.strokeText(U[q],s,c),e.fillText(U[q],s,c),c+=W}else H>0&&e.strokeText(d,s,c),e.fillText(d,s,c);b!==0&&(e.rotate(-b),e.translate(-l,-u))}}};var ym={};ym.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,c,l=t._private,u=l.rscratch,d=t.position();if(!(!K(d.x)||!K(d.y))&&!(a&&!t.visible())){var f=a?t.effectiveOpacity():1,p=o.usePaths(),m,h=!1,g=t.padding();s=t.width()+2*g,c=t.height()+2*g;var _;n&&(_=n,e.translate(-_.x1,-_.y1));for(var v=t.pstyle(`background-image`).value,y=Array(v.length),b=Array(v.length),x=0,S=0;S<v.length;S++){var C=v[S];if(y[S]=C!=null&&C!==`none`){var w=t.cy().style().getIndexedStyle(t,`background-image-crossorigin`,`value`,S);x++,b[S]=o.getCachedImage(C,w,function(){l.backgroundTimestamp=Date.now(),t.emitAndNotify(`background`)})}}var T=t.pstyle(`background-blacken`).value,E=t.pstyle(`border-width`).pfValue,D=t.pstyle(`background-opacity`).value*f,O=t.pstyle(`border-color`).value,k=t.pstyle(`border-style`).value,A=t.pstyle(`border-join`).value,j=t.pstyle(`border-cap`).value,M=t.pstyle(`border-position`).value,N=t.pstyle(`border-dash-pattern`).pfValue,P=t.pstyle(`border-dash-offset`).pfValue,F=t.pstyle(`border-opacity`).value*f,I=t.pstyle(`outline-width`).pfValue,L=t.pstyle(`outline-color`).value,R=t.pstyle(`outline-style`).value,z=t.pstyle(`outline-opacity`).value*f,B=t.pstyle(`outline-offset`).value,V=t.pstyle(`corner-radius`).value;V!==`auto`&&(V=t.pstyle(`corner-radius`).pfValue);var H=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D;o.eleFillStyle(e,t,n)},U=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(e,O[0],O[1],O[2],t)},W=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;o.colorStrokeStyle(e,L[0],L[1],L[2],t)},G=function(e,t,n,r){var i=o.nodePathCache=o.nodePathCache||[],a=Bt(n===`polygon`?n+`,`+r.join(`,`):n,``+t,``+e,``+V),s=i[a],c,l=!1;return s==null?(c=new Path2D,i[a]=u.pathCache=c):(c=s,l=!0,u.pathCache=c),{path:c,cacheHit:l}},q=t.pstyle(`shape`).strValue,J=t.pstyle(`shape-polygon-points`).pfValue;if(p){e.translate(d.x,d.y);var Y=G(s,c,q,J);m=Y.path,h=Y.cacheHit}var ee=function(){if(!h){var n=d;p&&(n={x:0,y:0}),o.nodeShapes[o.getNodeShape(t)].draw(m||e,n.x,n.y,s,c,V,u)}p?e.fill(m):e.fill()},te=function(){for(var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=l.backgrounding,a=0,s=0;s<b.length;s++){var c=t.cy().style().getIndexedStyle(t,`background-image-containment`,`value`,s);if(r&&c===`over`||!r&&c===`inside`){a++;continue}y[s]&&b[s].complete&&!b[s].error&&(a++,o.drawInscribedImage(e,b[s],t,s,n))}l.backgrounding=a!==x,i!==l.backgrounding&&t.updateStyle(!1)},ne=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasPie(t)&&(o.drawPie(e,t,r),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,V,u)))},re=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasStripe(t)&&(e.save(),p?e.clip(u.pathCache):(o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,V,u),e.clip()),o.drawStripe(e,t,r),e.restore(),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,V,u)))},ie=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;T!==0&&(o.colorFillStyle(e,r,r,r,n),p?e.fill(m):e.fill())},ae=function(){if(E>0){if(e.lineWidth=E,e.lineCap=j,e.lineJoin=A,e.setLineDash)switch(k){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash(N),e.lineDashOffset=P;break;case`solid`:case`double`:e.setLineDash([]);break}if(M!==`center`){if(e.save(),e.lineWidth*=2,M===`inside`)p?e.clip(m):e.clip();else{var t=new Path2D;t.rect(-s/2-E,-c/2-E,s+2*E,c+2*E),t.addPath(m),e.clip(t,`evenodd`)}p?e.stroke(m):e.stroke(),e.restore()}else p?e.stroke(m):e.stroke();if(k===`double`){e.lineWidth=E/3;var n=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(m):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},oe=function(){if(I>0){if(e.lineWidth=I,e.lineCap=`butt`,e.setLineDash)switch(R){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`solid`:case`double`:e.setLineDash([]);break}var n=d;p&&(n={x:0,y:0});var r=o.getNodeShape(t),i=E;M===`inside`&&(i=0),M===`outside`&&(i*=2);var a=(s+i+(I+B))/s,l=(c+i+(I+B))/c,u=s*a,f=c*l,m=o.nodeShapes[r].points,h;if(p&&(h=G(u,f,r,m).path),r===`ellipse`)o.drawEllipsePath(h||e,n.x,n.y,u,f);else if([`round-diamond`,`round-heptagon`,`round-hexagon`,`round-octagon`,`round-pentagon`,`round-polygon`,`round-triangle`,`round-tag`].includes(r)){var g=0,_=0,v=0;r===`round-diamond`?g=(i+B+I)*1.4:r===`round-heptagon`?(g=(i+B+I)*1.075,v=-(i/2+B+I)/35):r===`round-hexagon`?g=(i+B+I)*1.12:r===`round-pentagon`?(g=(i+B+I)*1.13,v=-(i/2+B+I)/15):r===`round-tag`?(g=(i+B+I)*1.12,_=(i/2+I+B)*.07):r===`round-triangle`&&(g=(i+B+I)*(Math.PI/2),v=-(i+B/2+I)/Math.PI),g!==0&&(a=(s+g)/s,u=s*a,[`round-hexagon`,`round-tag`].includes(r)||(l=(c+g)/c,f=c*l)),V=V===`auto`?Yr(u,f):V;for(var y=u/2,b=f/2,x=V+(i+I+B)/2,S=Array(m.length/2),C=Array(m.length/2),w=0;w<m.length/2;w++)S[w]={x:n.x+_+y*m[w*2],y:n.y+v+b*m[w*2+1]};var T,D,O,k,A=S.length;for(D=S[A-1],T=0;T<A;T++)O=S[T%A],k=S[(T+1)%A],C[T]=Rf(D,O,k,x),D=O,O=k;o.drawRoundPolygonPath(h||e,n.x+_,n.y+v,s*a,c*l,m,C)}else if([`roundrectangle`,`round-rectangle`].includes(r))V=V===`auto`?Jr(u,f):V,o.drawRoundRectanglePath(h||e,n.x,n.y,u,f,V+(i+I+B)/2);else if([`cutrectangle`,`cut-rectangle`].includes(r))V=V===`auto`?Xr():V,o.drawCutRectanglePath(h||e,n.x,n.y,u,f,null,V+(i+I+B)/4);else if([`bottomroundrectangle`,`bottom-round-rectangle`].includes(r))V=V===`auto`?Jr(u,f):V,o.drawBottomRoundRectanglePath(h||e,n.x,n.y,u,f,V+(i+I+B)/2);else if(r===`barrel`)o.drawBarrelPath(h||e,n.x,n.y,u,f);else if(r.startsWith(`polygon`)||[`rhomboid`,`right-rhomboid`,`round-tag`,`tag`,`vee`].includes(r)){var j=(i+I+B)/s;m=Pr(Fr(m,j)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}else{var N=(i+I+B)/s;m=Pr(Fr(m,-N)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}if(p?e.stroke(h):e.stroke(),R===`double`){e.lineWidth=i/3;var P=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(h):e.stroke(),e.globalCompositeOperation=P}e.setLineDash&&e.setLineDash([])}},se=function(){i&&o.drawNodeOverlay(e,t,d,s,c)},ce=function(){i&&o.drawNodeUnderlay(e,t,d,s,c)},le=function(){o.drawElementText(e,t,null,r)};if(t.pstyle(`ghost`).value===`yes`){var ue=t.pstyle(`ghost-offset-x`).pfValue,de=t.pstyle(`ghost-offset-y`).pfValue,fe=t.pstyle(`ghost-opacity`).value,pe=fe*f;e.translate(ue,de),W(),oe(),H(fe*D),ee(),te(pe,!0),U(fe*F),ae(),ne(T!==0||E!==0),re(T!==0||E!==0),te(pe,!1),ie(pe),e.translate(-ue,-de)}p&&e.translate(-d.x,-d.y),ce(),p&&e.translate(d.x,d.y),W(),oe(),H(),ee(),te(f,!0),U(),ae(),ne(T!==0||E!==0),re(T!==0||E!==0),te(f,!1),ie(),p&&e.translate(-d.x,-d.y),le(),se(),n&&e.translate(_.x1,_.y1)}};var bm=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n,r,i,a){var o=this;if(n.visible()){var s=n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-opacity`).value,l=n.pstyle(`${e}-color`).value,u=n.pstyle(`${e}-shape`).value,d=n.pstyle(`${e}-corner-radius`).value;if(c>0){if(r||=n.position(),i==null||a==null){var f=n.padding();i=n.width()+2*f,a=n.height()+2*f}o.colorFillStyle(t,l[0],l[1],l[2],c),o.nodeShapes[u].draw(t,r.x,r.y,i+s*2,a+s*2,d),t.fill()}}}};ym.drawNodeOverlay=bm(`overlay`),ym.drawNodeUnderlay=bm(`underlay`),ym.hasPie=function(e){return e=e[0],e._private.hasPie},ym.hasStripe=function(e){return e=e[0],e._private.hasStripe},ym.drawPie=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=t.pstyle(`pie-size`),o=t.pstyle(`pie-hole`),s=t.pstyle(`pie-start-angle`).pfValue,c=r.x,l=r.y,u=t.width(),d=t.height(),f=Math.min(u,d)/2,p,m=0;if(this.usePaths()&&(c=0,l=0),a.units===`%`?f*=a.pfValue:a.pfValue!==void 0&&(f=a.pfValue/2),o.units===`%`?p=f*o.pfValue:o.pfValue!==void 0&&(p=o.pfValue/2),!(p>=f))for(var h=1;h<=i.pieBackgroundN;h++){var g=t.pstyle(`pie-`+h+`-background-size`).value,_=t.pstyle(`pie-`+h+`-background-color`).value,v=t.pstyle(`pie-`+h+`-background-opacity`).value*n,y=g/100;y+m>1&&(y=1-m);var b=1.5*Math.PI+2*Math.PI*m;b+=s;var x=2*Math.PI*y,S=b+x;g===0||m>=1||m+y>1||(p===0?(e.beginPath(),e.moveTo(c,l),e.arc(c,l,f,b,S),e.closePath()):(e.beginPath(),e.arc(c,l,f,b,S),e.arc(c,l,p,S,b,!0),e.closePath()),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),m+=y)}},ym.drawStripe=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),c=t.height(),l=0,u=this.usePaths();e.save();var d=t.pstyle(`stripe-direction`).value,f=t.pstyle(`stripe-size`);switch(d){case`vertical`:break;case`righward`:e.rotate(-Math.PI/2);break}var p=s,m=c;f.units===`%`?(p*=f.pfValue,m*=f.pfValue):f.pfValue!==void 0&&(p=f.pfValue,m=f.pfValue),u&&(a=0,o=0),o-=p/2,a-=m/2;for(var h=1;h<=i.stripeBackgroundN;h++){var g=t.pstyle(`stripe-`+h+`-background-size`).value,_=t.pstyle(`stripe-`+h+`-background-color`).value,v=t.pstyle(`stripe-`+h+`-background-opacity`).value*n,y=g/100;y+l>1&&(y=1-l),!(g===0||l>=1||l+y>1)&&(e.beginPath(),e.rect(a,o+m*l,p,m*y),e.closePath(),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),l+=y)}e.restore()};var xm={},Sm=100;xm.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},xm.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,i=0;i<t.length;i++)if(r=t[i],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},xm.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+`-gradient-stop-colors`).value,c=n.pstyle(t+`-gradient-stop-positions`).pfValue;if(r===`radial-gradient`)if(n.isEdge()){var l=n.sourceEndpoint(),u=n.targetEndpoint(),d=n.midpoint(),f=nr(l,d),p=nr(u,d);a=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(f,p))}else{var m=o?{x:0,y:0}:n.position(),h=n.paddedWidth(),g=n.paddedHeight();a=e.createRadialGradient(m.x,m.y,0,m.x,m.y,Math.max(h,g))}else if(n.isEdge()){var _=n.sourceEndpoint(),v=n.targetEndpoint();a=e.createLinearGradient(_.x,_.y,v.x,v.y)}else{var y=o?{x:0,y:0}:n.position(),b=n.paddedWidth(),x=n.paddedHeight(),S=b/2,C=x/2;switch(n.pstyle(`background-gradient-direction`).value){case`to-bottom`:a=e.createLinearGradient(y.x,y.y-C,y.x,y.y+C);break;case`to-top`:a=e.createLinearGradient(y.x,y.y+C,y.x,y.y-C);break;case`to-left`:a=e.createLinearGradient(y.x+S,y.y,y.x-S,y.y);break;case`to-right`:a=e.createLinearGradient(y.x-S,y.y,y.x+S,y.y);break;case`to-bottom-right`:case`to-right-bottom`:a=e.createLinearGradient(y.x-S,y.y-C,y.x+S,y.y+C);break;case`to-top-right`:case`to-right-top`:a=e.createLinearGradient(y.x-S,y.y+C,y.x+S,y.y-C);break;case`to-bottom-left`:case`to-left-bottom`:a=e.createLinearGradient(y.x+S,y.y-C,y.x-S,y.y+C);break;case`to-top-left`:case`to-left-top`:a=e.createLinearGradient(y.x+S,y.y+C,y.x-S,y.y-C);break}}if(!a)return null;for(var w=c.length===s.length,T=s.length,E=0;E<T;E++)a.addColorStop(w?c[E]:E/(T-1),`rgba(`+s[E][0]+`,`+s[E][1]+`,`+s[E][2]+`,`+i+`)`);return a},xm.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`background`,t,n,r);if(!i)return null;e.fillStyle=i},xm.colorFillStyle=function(e,t,n,r,i){e.fillStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},xm.eleFillStyle=function(e,t,n){var r=t.pstyle(`background-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle(`background-color`).value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},xm.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`line`,t,n,r);if(!i)return null;e.strokeStyle=i},xm.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},xm.eleStrokeStyle=function(e,t,n){var r=t.pstyle(`line-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle(`line-color`).value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},xm.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var c=i*o,l=a*o,u;if(!(c===t.canvasWidth&&l===t.canvasHeight)){t.fontCaches=null;var d=n.canvasContainer;d.style.width=i+`px`,d.style.height=a+`px`;for(var f=0;f<t.CANVAS_LAYERS;f++)u=n.canvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;for(var f=0;f<t.BUFFER_COUNT;f++)u=n.bufferCanvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;t.textureMult=1,o<=1&&(u=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,u.width=c*t.textureMult,u.height=l*t.textureMult),t.canvasWidth=c,t.canvasHeight=l,t.pixelRatio=o}},xm.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},xm.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},xm.render=function(e){var t=this;e||=cn();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,c=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=t.data,u=l.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),f=e.motionBlur===void 0?t.motionBlur:e.motionBlur,p=t.motionBlurPxRatio,m=n.hasCompoundNodes(),h=t.hoverData.draggingEles,g=!!(t.hoverData.selecting||t.touchData.selecting);f=f&&!r&&t.motionBlurEnabled&&!g;var _=f;r||(t.prevPxRatio!==c&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint(`eles`,!0),t.redrawHint(`drag`,!0)),t.prevPxRatio=c),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),f&&(t.mbFrames??=0,t.mbFrames++,t.mbFrames<3&&(_=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(u[t.NODE]=!0,u[t.SELECT_BOX]=!0);var v=n.style(),y=n.zoom(),b=o===void 0?y:o,x=n.pan(),S={x:x.x,y:x.y},C={zoom:y,pan:{x:x.x,y:x.y}},w=t.prevViewport;!(w===void 0||C.zoom!==w.zoom||C.pan.x!==w.pan.x||C.pan.y!==w.pan.y)&&!(h&&!m)&&(t.motionBlurPxRatio=1),s&&(S=s),b*=c,S.x*=c,S.y*=c;var T=t.getCachedZSortedEles();function E(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function D(e,n){var a,c,u,d;!t.clearingMotionBlur&&(e===l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||e===l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(a={x:x.x*p,y:x.y*p},c=y*p,u=t.canvasWidth*p,d=t.canvasHeight*p):(a=S,c=b,u=t.canvasWidth,d=t.canvasHeight),e.setTransform(1,0,0,1,0,0),n===`motionBlur`?E(e,0,0,u,d):!r&&(n===void 0||n)&&e.clearRect(0,0,u,d),i||(e.translate(a.x,a.y),e.scale(c,c)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var O=t.data.bufferContexts[t.TEXTURE_BUFFER];O.setTransform(1,0,0,1,0,0),O.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:O,drawOnlyNodeLayer:!0,forcedPxRatio:c*t.textureMult});var C=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};C.mpan={x:(0-C.pan.x)/C.zoom,y:(0-C.pan.y)/C.zoom}}u[t.DRAG]=!1,u[t.NODE]=!1;var k=l.contexts[t.NODE],A=t.textureCache.texture,C=t.textureCache.viewport;k.setTransform(1,0,0,1,0,0),f?E(k,0,0,C.width,C.height):k.clearRect(0,0,C.width,C.height);var j=v.core(`outside-texture-bg-color`).value,M=v.core(`outside-texture-bg-opacity`).value;t.colorFillStyle(k,j[0],j[1],j[2],M),k.fillRect(0,0,C.width,C.height);var y=n.zoom();D(k,!1),k.clearRect(C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c),k.drawImage(A,C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c)}else t.textureOnViewport&&!r&&(t.textureCache=null);var N=n.extent(),P=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),F=t.hideEdgesOnViewport&&P,I=[];if(I[t.NODE]=!u[t.NODE]&&f&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,I[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),I[t.DRAG]=!u[t.DRAG]&&f&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,I[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),u[t.NODE]||i||a||I[t.NODE]){var L=f&&!I[t.NODE]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.nondrag,c,N):t.drawLayeredElements(k,T.nondrag,c,N),t.debug&&t.drawDebugPoints(k,T.nondrag),!i&&!f&&(u[t.NODE]=!1)}if(!a&&(u[t.DRAG]||i||I[t.DRAG])){var L=f&&!I[t.DRAG]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.drag,c,N):t.drawCachedElements(k,T.drag,c,N),t.debug&&t.drawDebugPoints(k,T.drag),!i&&!f&&(u[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,D),f&&p!==1){var R=l.contexts[t.NODE],z=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],B=l.contexts[t.DRAG],V=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],H=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!_?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):E(e,0,0,t.canvasWidth,t.canvasHeight);var i=p;e.drawImage(n,0,0,t.canvasWidth*i,t.canvasHeight*i,0,0,t.canvasWidth,t.canvasHeight)};(u[t.NODE]||I[t.NODE])&&(H(R,z,I[t.NODE]),u[t.NODE]=!1),(u[t.DRAG]||I[t.DRAG])&&(H(B,V,I[t.DRAG]),u[t.DRAG]=!1)}t.prevViewport=C,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),f&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,u[t.NODE]=!0,u[t.DRAG]=!0,t.redraw()},Sm)),r||n.emit(`render`)};var Cm;xm.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,c=i.canvasNeedsRedraw,l=e.forcedContext;if(n.showFps||!o&&c[n.SELECT_BOX]&&!s){var u=l||i.contexts[n.SELECT_BOX];if(t(u),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),f=a.core(`selection-box-border-width`).value/d;u.lineWidth=f,u.fillStyle=`rgba(`+a.core(`selection-box-color`).value[0]+`,`+a.core(`selection-box-color`).value[1]+`,`+a.core(`selection-box-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),f>0&&(u.strokeStyle=`rgba(`+a.core(`selection-box-border-color`).value[0]+`,`+a.core(`selection-box-border-color`).value[1]+`,`+a.core(`selection-box-border-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){var d=n.cy.zoom(),p=i.bgActivePosistion;u.fillStyle=`rgba(`+a.core(`active-bg-color`).value[0]+`,`+a.core(`active-bg-color`).value[1]+`,`+a.core(`active-bg-color`).value[2]+`,`+a.core(`active-bg-opacity`).value+`)`,u.beginPath(),u.arc(p.x,p.y,a.core(`active-bg-size`).pfValue/d,0,2*Math.PI),u.fill()}var m=n.lastRedrawTime;if(n.showFps&&m){m=Math.round(m);var h=Math.round(1e3/m),g=`1 frame = `+m+` ms = `+h+` fps`;u.setTransform(1,0,0,1,0,0),u.fillStyle=`rgba(255, 0, 0, 0.75)`,u.strokeStyle=`rgba(255, 0, 0, 0.75)`,u.font=`30px Arial`,Cm||=u.measureText(g).actualBoundingBoxAscent,u.fillText(g,0,Cm),u.strokeRect(0,Cm+10,250,20),u.fillRect(0,Cm+10,250*Math.min(h/60,1),20)}s||(c[n.SELECT_BOX]=!1)}};function wm(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function Tm(e,t,n){var r=wm(e,e.VERTEX_SHADER,t),i=wm(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error(`Could not initialize shaders`);return a}function Em(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext(`2d`);return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function Dm(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function Om(e){var t=e.pixelRatio;return e.cy.zoom()*t}function km(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return o=Math.round(e.canvasHeight-o),[a,o]}function Am(e){return e.pstyle(`background-fill`).value!==`solid`||e.pstyle(`background-image`).strValue!==`none`?!1:e.pstyle(`border-width`).value===0||e.pstyle(`border-opacity`).value===0?!0:e.pstyle(`border-style`).value===`solid`}function jm(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Mm(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||[,,,,];return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function Nm(e,t){var n=t||[,,,,];return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function Pm(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function Fm(e,t){var n=e.createTexture();return n.buffer=function(t){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function Im(e,t){switch(t){case`float`:return[1,e.FLOAT,4];case`vec2`:return[2,e.FLOAT,4];case`vec3`:return[3,e.FLOAT,4];case`vec4`:return[4,e.FLOAT,4];case`int`:return[1,e.INT,4];case`ivec2`:return[2,e.INT,4]}}function Lm(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function Rm(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function zm(e,t,n,r){var i=O(Im(e,t),2),a=i[0],o=i[1],s=Lm(e,o,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,s,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,a,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,a,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function Bm(e,t,n,r){var i=O(Im(e,n),3),a=i[0],o=i[1],s=i[2],c=Lm(e,o,t*a),l=a*s,u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t*l,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,l,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,l,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),f=0;f<t;f++)d[f]=Rm(e,o,c,l,a,f);return u.dataArray=c,u.stride=l,u.size=a,u.getView=function(e){return d[e]},u.setPoint=function(e,t,n){var r=d[e];r[0]=t,r[1]=n},u.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,u),t?e.bufferSubData(e.ARRAY_BUFFER,0,c,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,c)},u}function Vm(e,t,n){for(var r=9,i=new Float32Array(t*r),a=Array(t),o=0;o<t;o++){var s=o*r*4;a[o]=new Float32Array(i.buffer,s,r)}var c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,i.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var u=n+l;e.enableVertexAttribArray(u),e.vertexAttribPointer(u,3,e.FLOAT,!1,36,l*12),e.vertexAttribDivisor(u,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),c.getMatrixView=function(e){return a[e]},c.setData=function(e,t){a[t].set(e,0)},c.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferSubData(e.ARRAY_BUFFER,0,i)},c}function Hm(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var Um=typeof Float32Array<`u`?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Wm(){var e=new Um(9);return Um!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Gm(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Km(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1],m=n[2],h=n[3],g=n[4],_=n[5],v=n[6],y=n[7],b=n[8];return e[0]=f*r+p*o+m*l,e[1]=f*i+p*s+m*u,e[2]=f*a+p*c+m*d,e[3]=h*r+g*o+_*l,e[4]=h*i+g*s+_*u,e[5]=h*a+g*c+_*d,e[6]=v*r+y*o+b*l,e[7]=v*i+y*s+b*u,e[8]=v*a+y*c+b*d,e}function qm(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=f*r+p*o+l,e[7]=f*i+p*s+u,e[8]=f*a+p*c+d,e}function Jm(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=Math.sin(n),p=Math.cos(n);return e[0]=p*r+f*o,e[1]=p*i+f*s,e[2]=p*a+f*c,e[3]=p*o-f*r,e[4]=p*s-f*i,e[5]=p*c-f*a,e[6]=l,e[7]=u,e[8]=d,e}function Ym(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Xm(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var Zm=function(){function e(t,n,r,i){y(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,n,n),this.scratch=i(t,n,this.texHeight,`scratch`)}return x(e,[{key:`lock`,value:function(){this.locked=!0}},{key:`getKeys`,value:function(){return new Set(this.keyToLocation.keys())}},{key:`getScale`,value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:`draw`,value:function(e,t,n){var r=this;if(this.locked)throw Error(`can't draw, atlas is locked`);var i=this.texSize,a=this.texRows,o=this.texHeight,s=this.getScale(t),c=s.scale,l=s.texW,u=s.texH,d=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,l=a,u=o*s;i.save(),i.translate(l,u),i.scale(c,c),n(i,t),i.restore()}},f=[null,null],p=function(){d(r.freePointer,r.canvas),f[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:l,h:u},f[1]={x:r.freePointer.x+l,y:r.freePointer.row*o,w:0,h:u},r.freePointer.x+=l,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},m=function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=i-r.freePointer.x,a=l-n,s=o,c=r.freePointer.x,p=r.freePointer.row*o,m=n;t.context.drawImage(e,0,0,m,s,c,p,m,s),f[0]={x:c,y:p,w:m,h:u};var h=n,g=(r.freePointer.row+1)*o,_=a;t&&t.context.drawImage(e,h,0,_,s,0,g,_,s),f[1]={x:0,y:g,w:_,h:u},r.freePointer.x=a,r.freePointer.row++},h=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+l<=i)p();else if(this.freePointer.row>=a-1)return!1;else this.freePointer.x===i?(h(),p()):this.enableWrapping?m():(h(),p());return this.keyToLocation.set(e,f),this.needsBuffer=!0,f}},{key:`getOffsets`,value:function(e){return this.keyToLocation.get(e)}},{key:`isEmpty`,value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:`canFit`,value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return this.freePointer.x+r>t?this.freePointer.row<n-1:!0}},{key:`bufferIfNeeded`,value:function(e){this.texture||=Fm(e,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(),null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),Qm=function(){function e(t,n,r,i){y(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return x(e,[{key:`getKeys`,value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:`_createAtlas`,value:function(){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;return new Zm(e,t,n,r)}},{key:`_getScratchCanvas`,value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;this.scratch=r(e,t,Math.floor(t/n),`scratch`)}return this.scratch}},{key:`draw`,value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||(r=this.atlases[this.atlases.length-1],(!r||!r.canFit(t))&&(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:`getAtlas`,value:function(e){return this.styleKeyToAtlas.get(e)}},{key:`hasAtlas`,value:function(e){return this.styleKeyToAtlas.has(e)}},{key:`markKeyForGC`,value:function(e){this.markedKeys.add(e)}},{key:`gc`,value:function(){var e=this,t=this.markedKeys;if(t.size===0){console.log(`nothing to garbage collect`);return}var n=[],r=new Map,i=null,a=S(this.atlases),o;try{var s=function(){var a=o.value,s=a.getKeys(),c=$m(t,s);if(c.size===0)return n.push(a),s.forEach(function(e){return r.set(e,a)}),1;i||(i=e._createAtlas(),n.push(i));var l=S(s),u;try{for(l.s();!(u=l.n()).done;){var d=u.value;if(!c.has(d)){var f=O(a.getOffsets(d),2),p=f[0],m=f[1];i.canFit({w:p.w+m.w,h:p.h})||(i.lock(),i=e._createAtlas(),n.push(i)),a.canvas&&(e._copyTextureToNewAtlas(d,a,i),r.set(d,i))}}}catch(e){l.e(e)}finally{l.f()}a.dispose()};for(a.s();!(o=a.n()).done;)if(s())continue}catch(e){a.e(e)}finally{a.f()}this.atlases=n,this.styleKeyToAtlas=r,this.markedKeys=new Set}},{key:`_copyTextureToNewAtlas`,value:function(e,t,n){var r=O(t.getOffsets(e),2),i=r[0],a=r[1];if(a.w===0)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,c=i.h;n.draw(e,{w:s,h:c},function(e){e.drawImage(o,0,0,s,c,0,0,s,c)})}}},{key:`getCounts`,value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function $m(e,t){return e.intersection?e.intersection(t):new Set(k(e).filter(function(e){return t.has(e)}))}var eh=function(){function e(t,n){y(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return x(e,[{key:`getAtlasSize`,value:function(){return this.atlasSize}},{key:`addAtlasCollection`,value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new Qm(this.r,r,a,o);this.collections.set(e,s)}},{key:`addRenderType`,value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw Error(`invalid atlas collection name '${n}'`);var r=X({type:e,atlasCollection:this.collections.get(n)},t);this.renderTypes.set(e,r)}},{key:`getRenderTypeOpts`,value:function(e){return this.renderTypes.get(e)}},{key:`getAtlasCollection`,value:function(e){return this.collections.get(e)}},{key:`_cacheScratchCanvas`,value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?((!r||a!=t||o!=n)&&(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:`_key`,value:function(e,t){return`${e}-${t}`}},{key:`invalidate`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.forceRedraw,i=r===void 0?!1:r,a=n.filterEle,o=a===void 0?function(){return!0}:a,s=n.filterType,c=s===void 0?function(){return!0}:s,l=!1,u=!1,d=S(e),f;try{for(d.s();!(f=d.n()).done;){var p=f.value;if(o(p)){var m=S(this.renderTypes.values()),h;try{var g=function(){var e=h.value,n=e.type;if(c(n)){var r=t.collections.get(e.collection),a=e.getKey(p),o=Array.isArray(a)?a:[a];if(i)o.forEach(function(e){return r.markKeyForGC(e)}),u=!0;else{var s=e.getID?e.getID(p):p.id(),d=t._key(n,s),f=t.typeAndIdToKey.get(d);f!==void 0&&!jm(o,f)&&(l=!0,t.typeAndIdToKey.delete(d),f.forEach(function(e){return r.markKeyForGC(e)}))}}};for(m.s();!(h=m.n()).done;)g()}catch(e){m.e(e)}finally{m.f()}}}}catch(e){d.e(e)}finally{d.f()}return u&&(this.gc(),l=!1),l}},{key:`gc`,value:function(){var e=S(this.collections.values()),t;try{for(e.s();!(t=e.n()).done;)t.value.gc()}catch(t){e.e(t)}finally{e.f()}}},{key:`getOrCreateAtlas`,value:function(e,t,n,r){var i=this.renderTypes.get(t),a=this.collections.get(i.collection),o=!1,s=a.draw(r,n,function(t){i.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),i.drawElement(t,e,n,!0,!0),t.restore()):i.drawElement(t,e,n,!0,!0),o=!0});if(o){var c=i.getID?i.getID(e):e.id(),l=this._key(t,c);this.typeAndIdToKey.has(l)?this.typeAndIdToKey.get(l).push(r):this.typeAndIdToKey.set(l,[r])}return s}},{key:`getAtlasInfo`,value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map(function(i){var a=r.getBoundingBox(e,i),o=n.getOrCreateAtlas(e,t,a,i),s=O(o.getOffsets(i),2),c=s[0];return{atlas:o,tex:c,tex1:c,tex2:s[1],bb:a}})}},{key:`getDebugInfo`,value:function(){var e=[],t=S(this.collections),n;try{for(t.s();!(n=t.n()).done;){var r=O(n.value,2),i=r[0],a=r[1].getCounts(),o=a.keyCount,s=a.atlasCount;e.push({type:i,keyCount:o,atlasCount:s})}}catch(e){t.e(e)}finally{t.f()}return e}}])}(),th=function(){function e(t){y(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return x(e,[{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(e,t){return t})}},{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(e){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(e):!0}},{key:`getAtlasIndexForBatch`,value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw Error(`cannot add more atlases to batch`);this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),nh=`
|
|
8
|
+
float circleSD(vec2 p, float r) {
|
|
9
|
+
return distance(vec2(0), p) - r; // signed distance
|
|
10
|
+
}
|
|
11
|
+
`,rh=`
|
|
12
|
+
float rectangleSD(vec2 p, vec2 b) {
|
|
13
|
+
vec2 d = abs(p)-b;
|
|
14
|
+
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
15
|
+
}
|
|
16
|
+
`,ih=`
|
|
17
|
+
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
18
|
+
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
19
|
+
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
20
|
+
vec2 q = abs(p) - b + cr.x;
|
|
21
|
+
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
22
|
+
}
|
|
23
|
+
`,ah=`
|
|
24
|
+
float ellipseSD(vec2 p, vec2 ab) {
|
|
25
|
+
p = abs( p ); // symmetry
|
|
26
|
+
|
|
27
|
+
// find root with Newton solver
|
|
28
|
+
vec2 q = ab*(p-ab);
|
|
29
|
+
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
30
|
+
for( int i=0; i<5; i++ ) {
|
|
31
|
+
vec2 cs = vec2(cos(w),sin(w));
|
|
32
|
+
vec2 u = ab*vec2( cs.x,cs.y);
|
|
33
|
+
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
34
|
+
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// compute final point and distance
|
|
38
|
+
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
39
|
+
|
|
40
|
+
// return signed distance
|
|
41
|
+
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
42
|
+
}
|
|
43
|
+
`,oh={SCREEN:{name:`screen`,screen:!0},PICKING:{name:`picking`,picking:!0}},sh={IGNORE:1,USE_BB:2},ch=0,lh=1,uh=2,dh=3,fh=4,ph=5,mh=6,hh=7,gh=function(){function e(t,n,r){y(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=Em,this.atlasManager=new eh(t,r),this.batchManager=new th(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(oh.SCREEN),this.pickingProgram=this._createShaderProgram(oh.PICKING),this.vao=this._createVAO()}return x(e,[{key:`addAtlasCollection`,value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:`addTextureAtlasRenderType`,value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:`addSimpleShapeRenderType`,value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:`invalidate`,value:function(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:`gc`,value:function(){this.atlasManager.gc()}},{key:`_createShaderProgram`,value:function(e){var t=this.gl,n=`#version 300 es
|
|
44
|
+
precision highp float;
|
|
45
|
+
|
|
46
|
+
uniform mat3 uPanZoomMatrix;
|
|
47
|
+
uniform int uAtlasSize;
|
|
48
|
+
|
|
49
|
+
// instanced
|
|
50
|
+
in vec2 aPosition; // a vertex from the unit square
|
|
51
|
+
|
|
52
|
+
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
53
|
+
in int aVertType; // the type of thing we are rendering
|
|
54
|
+
|
|
55
|
+
// the z-index that is output when using picking mode
|
|
56
|
+
in vec4 aIndex;
|
|
57
|
+
|
|
58
|
+
// For textures
|
|
59
|
+
in int aAtlasId; // which shader unit/atlas to use
|
|
60
|
+
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
61
|
+
|
|
62
|
+
// for edges
|
|
63
|
+
in vec4 aPointAPointB;
|
|
64
|
+
in vec4 aPointCPointD;
|
|
65
|
+
in vec2 aLineWidth; // also used for node border width
|
|
66
|
+
|
|
67
|
+
// simple shapes
|
|
68
|
+
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
69
|
+
in vec4 aColor; // also used for edges
|
|
70
|
+
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
71
|
+
|
|
72
|
+
// output values passed to the fragment shader
|
|
73
|
+
out vec2 vTexCoord;
|
|
74
|
+
out vec4 vColor;
|
|
75
|
+
out vec2 vPosition;
|
|
76
|
+
// flat values are not interpolated
|
|
77
|
+
flat out int vAtlasId;
|
|
78
|
+
flat out int vVertType;
|
|
79
|
+
flat out vec2 vTopRight;
|
|
80
|
+
flat out vec2 vBotLeft;
|
|
81
|
+
flat out vec4 vCornerRadius;
|
|
82
|
+
flat out vec4 vBorderColor;
|
|
83
|
+
flat out vec2 vBorderWidth;
|
|
84
|
+
flat out vec4 vIndex;
|
|
85
|
+
|
|
86
|
+
void main(void) {
|
|
87
|
+
int vid = gl_VertexID;
|
|
88
|
+
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
89
|
+
|
|
90
|
+
if(aVertType == ${ch}) {
|
|
91
|
+
float texX = aTex.x; // texture coordinates
|
|
92
|
+
float texY = aTex.y;
|
|
93
|
+
float texW = aTex.z;
|
|
94
|
+
float texH = aTex.w;
|
|
95
|
+
|
|
96
|
+
if(vid == 1 || vid == 2 || vid == 4) {
|
|
97
|
+
texX += texW;
|
|
98
|
+
}
|
|
99
|
+
if(vid == 2 || vid == 4 || vid == 5) {
|
|
100
|
+
texY += texH;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
float d = float(uAtlasSize);
|
|
104
|
+
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
105
|
+
|
|
106
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
107
|
+
}
|
|
108
|
+
else if(aVertType == ${fh} || aVertType == ${hh}
|
|
109
|
+
|| aVertType == ${ph} || aVertType == ${mh}) { // simple shapes
|
|
110
|
+
|
|
111
|
+
// the bounding box is needed by the fragment shader
|
|
112
|
+
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
113
|
+
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
114
|
+
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
115
|
+
|
|
116
|
+
// calculations are done in the fragment shader, just pass these along
|
|
117
|
+
vColor = aColor;
|
|
118
|
+
vCornerRadius = aCornerRadius;
|
|
119
|
+
vBorderColor = aBorderColor;
|
|
120
|
+
vBorderWidth = aLineWidth;
|
|
121
|
+
|
|
122
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
123
|
+
}
|
|
124
|
+
else if(aVertType == ${lh}) {
|
|
125
|
+
vec2 source = aPointAPointB.xy;
|
|
126
|
+
vec2 target = aPointAPointB.zw;
|
|
127
|
+
|
|
128
|
+
// adjust the geometry so that the line is centered on the edge
|
|
129
|
+
position.y = position.y - 0.5;
|
|
130
|
+
|
|
131
|
+
// stretch the unit square into a long skinny rectangle
|
|
132
|
+
vec2 xBasis = target - source;
|
|
133
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
134
|
+
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
135
|
+
|
|
136
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
137
|
+
vColor = aColor;
|
|
138
|
+
}
|
|
139
|
+
else if(aVertType == ${uh}) {
|
|
140
|
+
vec2 pointA = aPointAPointB.xy;
|
|
141
|
+
vec2 pointB = aPointAPointB.zw;
|
|
142
|
+
vec2 pointC = aPointCPointD.xy;
|
|
143
|
+
vec2 pointD = aPointCPointD.zw;
|
|
144
|
+
|
|
145
|
+
// adjust the geometry so that the line is centered on the edge
|
|
146
|
+
position.y = position.y - 0.5;
|
|
147
|
+
|
|
148
|
+
vec2 p0, p1, p2, pos;
|
|
149
|
+
if(position.x == 0.0) { // The left side of the unit square
|
|
150
|
+
p0 = pointA;
|
|
151
|
+
p1 = pointB;
|
|
152
|
+
p2 = pointC;
|
|
153
|
+
pos = position;
|
|
154
|
+
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
155
|
+
p0 = pointD;
|
|
156
|
+
p1 = pointC;
|
|
157
|
+
p2 = pointB;
|
|
158
|
+
pos = vec2(0.0, -position.y);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
vec2 p01 = p1 - p0;
|
|
162
|
+
vec2 p12 = p2 - p1;
|
|
163
|
+
vec2 p21 = p1 - p2;
|
|
164
|
+
|
|
165
|
+
// Find the normal vector.
|
|
166
|
+
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
167
|
+
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
168
|
+
|
|
169
|
+
// Find the vector perpendicular to p0 -> p1.
|
|
170
|
+
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
171
|
+
|
|
172
|
+
// Determine the bend direction.
|
|
173
|
+
float sigma = sign(dot(p01 + p21, normal));
|
|
174
|
+
float width = aLineWidth[0];
|
|
175
|
+
|
|
176
|
+
if(sign(pos.y) == -sigma) {
|
|
177
|
+
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
178
|
+
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
179
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
180
|
+
} else {
|
|
181
|
+
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
182
|
+
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
183
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
vColor = aColor;
|
|
187
|
+
}
|
|
188
|
+
else if(aVertType == ${dh} && vid < 3) {
|
|
189
|
+
// massage the first triangle into an edge arrow
|
|
190
|
+
if(vid == 0)
|
|
191
|
+
position = vec2(-0.15, -0.3);
|
|
192
|
+
if(vid == 1)
|
|
193
|
+
position = vec2( 0.0, 0.0);
|
|
194
|
+
if(vid == 2)
|
|
195
|
+
position = vec2( 0.15, -0.3);
|
|
196
|
+
|
|
197
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
198
|
+
vColor = aColor;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
vAtlasId = aAtlasId;
|
|
205
|
+
vVertType = aVertType;
|
|
206
|
+
vIndex = aIndex;
|
|
207
|
+
}
|
|
208
|
+
`,r=this.batchManager.getIndexArray(),i=Tm(t,n,`#version 300 es
|
|
209
|
+
precision highp float;
|
|
210
|
+
|
|
211
|
+
// declare texture unit for each texture atlas in the batch
|
|
212
|
+
${r.map(function(e){return`uniform sampler2D uTexture${e};`}).join(`
|
|
213
|
+
`)}
|
|
214
|
+
|
|
215
|
+
uniform vec4 uBGColor;
|
|
216
|
+
uniform float uZoom;
|
|
217
|
+
|
|
218
|
+
in vec2 vTexCoord;
|
|
219
|
+
in vec4 vColor;
|
|
220
|
+
in vec2 vPosition; // model coordinates
|
|
221
|
+
|
|
222
|
+
flat in int vAtlasId;
|
|
223
|
+
flat in vec4 vIndex;
|
|
224
|
+
flat in int vVertType;
|
|
225
|
+
flat in vec2 vTopRight;
|
|
226
|
+
flat in vec2 vBotLeft;
|
|
227
|
+
flat in vec4 vCornerRadius;
|
|
228
|
+
flat in vec4 vBorderColor;
|
|
229
|
+
flat in vec2 vBorderWidth;
|
|
230
|
+
|
|
231
|
+
out vec4 outColor;
|
|
232
|
+
|
|
233
|
+
${nh}
|
|
234
|
+
${rh}
|
|
235
|
+
${ih}
|
|
236
|
+
${ah}
|
|
237
|
+
|
|
238
|
+
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
239
|
+
return vec4(
|
|
240
|
+
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
241
|
+
top.a + (bot.a * (1.0 - top.a))
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
246
|
+
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
247
|
+
// note 1.5 is an aribitrary value chosen because it looks good
|
|
248
|
+
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
void main(void) {
|
|
252
|
+
if(vVertType == ${ch}) {
|
|
253
|
+
// look up the texel from the texture unit
|
|
254
|
+
${r.map(function(e){return`if(vAtlasId == ${e}) outColor = texture(uTexture${e}, vTexCoord);`}).join(`
|
|
255
|
+
else `)}
|
|
256
|
+
}
|
|
257
|
+
else if(vVertType == ${dh}) {
|
|
258
|
+
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
259
|
+
outColor = blend(vColor, uBGColor);
|
|
260
|
+
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
261
|
+
}
|
|
262
|
+
else if(vVertType == ${fh} && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
263
|
+
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
264
|
+
}
|
|
265
|
+
else if(vVertType == ${fh} || vVertType == ${hh}
|
|
266
|
+
|| vVertType == ${ph} || vVertType == ${mh}) { // use SDF
|
|
267
|
+
|
|
268
|
+
float outerBorder = vBorderWidth[0];
|
|
269
|
+
float innerBorder = vBorderWidth[1];
|
|
270
|
+
float borderPadding = outerBorder * 2.0;
|
|
271
|
+
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
272
|
+
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
273
|
+
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
274
|
+
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
275
|
+
|
|
276
|
+
float d; // signed distance
|
|
277
|
+
if(vVertType == ${fh}) {
|
|
278
|
+
d = rectangleSD(p, b);
|
|
279
|
+
} else if(vVertType == ${hh} && w == h) {
|
|
280
|
+
d = circleSD(p, b.x); // faster than ellipse
|
|
281
|
+
} else if(vVertType == ${hh}) {
|
|
282
|
+
d = ellipseSD(p, b);
|
|
283
|
+
} else {
|
|
284
|
+
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
288
|
+
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
289
|
+
if(d > 0.0) {
|
|
290
|
+
if(d > outerBorder) {
|
|
291
|
+
discard;
|
|
292
|
+
} else {
|
|
293
|
+
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
294
|
+
}
|
|
295
|
+
} else {
|
|
296
|
+
if(d > innerBorder) {
|
|
297
|
+
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
298
|
+
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
299
|
+
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
vec4 outerColor;
|
|
303
|
+
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
304
|
+
outerColor = vec4(0);
|
|
305
|
+
} else if(innerBorder == 0.0) {
|
|
306
|
+
outerColor = vBorderColor;
|
|
307
|
+
} else {
|
|
308
|
+
outerColor = blend(vBorderColor, vColor);
|
|
309
|
+
}
|
|
310
|
+
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
outColor = vColor;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
${e.picking?`if(outColor.a == 0.0) discard;
|
|
319
|
+
else outColor = vIndex;`:``}
|
|
320
|
+
}
|
|
321
|
+
`);i.aPosition=t.getAttribLocation(i,`aPosition`),i.aIndex=t.getAttribLocation(i,`aIndex`),i.aVertType=t.getAttribLocation(i,`aVertType`),i.aTransform=t.getAttribLocation(i,`aTransform`),i.aAtlasId=t.getAttribLocation(i,`aAtlasId`),i.aTex=t.getAttribLocation(i,`aTex`),i.aPointAPointB=t.getAttribLocation(i,`aPointAPointB`),i.aPointCPointD=t.getAttribLocation(i,`aPointCPointD`),i.aLineWidth=t.getAttribLocation(i,`aLineWidth`),i.aColor=t.getAttribLocation(i,`aColor`),i.aCornerRadius=t.getAttribLocation(i,`aCornerRadius`),i.aBorderColor=t.getAttribLocation(i,`aBorderColor`),i.uPanZoomMatrix=t.getUniformLocation(i,`uPanZoomMatrix`),i.uAtlasSize=t.getUniformLocation(i,`uAtlasSize`),i.uBGColor=t.getUniformLocation(i,`uBGColor`),i.uZoom=t.getUniformLocation(i,`uZoom`),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,`uTexture${a}`));return i}},{key:`_createVAO`,value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),zm(n,`vec2`,r.aPosition,e),this.transformBuffer=Vm(n,t,r.aTransform),this.indexBuffer=Bm(n,t,`vec4`,r.aIndex),this.vertTypeBuffer=Bm(n,t,`int`,r.aVertType),this.atlasIdBuffer=Bm(n,t,`int`,r.aAtlasId),this.texBuffer=Bm(n,t,`vec4`,r.aTex),this.pointAPointBBuffer=Bm(n,t,`vec4`,r.aPointAPointB),this.pointCPointDBuffer=Bm(n,t,`vec4`,r.aPointCPointD),this.lineWidthBuffer=Bm(n,t,`vec2`,r.aLineWidth),this.colorBuffer=Bm(n,t,`vec4`,r.aColor),this.cornerRadiusBuffer=Bm(n,t,`vec4`,r.aCornerRadius),this.borderColorBuffer=Bm(n,t,`vec4`,r.aBorderColor),n.bindVertexArray(null),i}},{key:`buffers`,get:function(){var e=this;return this._buffers||=Object.keys(this).filter(function(e){return he(e,`Buffer`)}).map(function(t){return e[t]}),this._buffers}},{key:`startFrame`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oh.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,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(e,t){return e.visible()?t&&t.isVisible?t.isVisible(e):!0:!1}},{key:`drawTexture`,value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&!(e.isEdge()&&!this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(o===sh.IGNORE)return;if(o==sh.USE_BB){this.drawPickingRectangle(e,t,n);return}}var s=S(r.getAtlasInfo(e,n)),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=l.atlas,d=l.tex1,f=l.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var p=i.getAtlasIndexForBatch(u),m=0,h=[[d,!0],[f,!1]];m<h.length;m++){var g=O(h[m],2),_=g[0],v=g[1];if(_.w!=0){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=ch,Nm(t,this.indexBuffer.getView(y));var b=this.atlasIdBuffer.getView(y);b[0]=p;var x=this.texBuffer.getView(y);x[0]=_.x,x[1]=_.y,x[2]=_.w,x[3]=_.h;var C=this.transformBuffer.getMatrixView(y);this.setTransformMatrix(e,C,a,l,v),this.instanceCount++,v||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){s.e(e)}finally{s.f()}}}},{key:`setTransformMatrix`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,c=r.tex2,l=s.w/(s.w+c.w);i||(l=1-l);var u=this._getAdjustedBB(o,a,i,l);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),f=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,f,n,e)}}},{key:`_applyTransformMatrix`,value:function(e,t,n,r){var i,a;Gm(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r),c=s.x,l=s.y;qm(e,e,[c,l]),Jm(e,e,o);var u=n.getRotationOffset(r);i=u.x+(t.xOffset||0),a=u.y+(t.yOffset||0)}else i=t.x1,a=t.y1;qm(e,e,[i,a]),Ym(e,e,[t.w,t.h])}},{key:`_getAdjustedBB`,value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,c=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l,yOffset:c}}},{key:`drawPickingRectangle`,value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=fh,Nm(t,this.indexBuffer.getView(i)),Mm([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:`drawNode`,value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(a===void 0||r.isSimple&&!r.isSimple(e)){this.drawTexture(e,t,n);return}var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,a===ph||a===mh){var s=r.getBoundingBox(e),c=this._getCornerRadius(e,i.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=c,l[1]=c,l[2]=c,l[3]=c,a===mh&&(l[0]=0,l[2]=0)}Nm(t,this.indexBuffer.getView(o));var u=e.pstyle(i.color).value,d=e.pstyle(i.opacity).value;Mm(u,d,this.colorBuffer.getView(o));var f=this.lineWidthBuffer.getView(o);if(f[0]=0,f[1]=0,i.border){var p=e.pstyle(`border-width`).value;if(p>0){var m=e.pstyle(`border-color`).value,h=e.pstyle(`border-opacity`).value;Mm(m,h,this.borderColorBuffer.getView(o));var g=e.pstyle(`border-position`).value;if(g===`inside`)f[0]=0,f[1]=-p;else if(g===`outside`)f[0]=p,f[1]=0;else{var _=p/2;f[0]=_,f[1]=-_}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:`_getVertTypeForShape`,value:function(e,t){switch(e.pstyle(t).value){case`rectangle`:return fh;case`ellipse`:return hh;case`roundrectangle`:case`round-rectangle`:return ph;case`bottom-round-rectangle`:return mh;default:return}}},{key:`_getCornerRadius`,value:function(e,t,n){var r=n.w,i=n.h;if(e.pstyle(t).value===`auto`)return Jr(r,i);var a=e.pstyle(t).pfValue,o=r/2,s=i/2;return Math.min(a,s,o)}},{key:`drawEdgeArrow`,value:function(e,t,n){if(e.visible()){var r=e._private.rscratch,i,a,o;if(n===`source`?(i=r.arrowStartX,a=r.arrowStartY,o=r.srcArrowAngle):(i=r.arrowEndX,a=r.arrowEndY,o=r.tgtArrowAngle),!(isNaN(i)||i==null||isNaN(a)||a==null||isNaN(o)||o==null)&&e.pstyle(n+`-arrow-shape`).value!==`none`){var s=e.pstyle(n+`-arrow-color`).value,c=e.pstyle(`opacity`).value*e.pstyle(`line-opacity`).value,l=e.pstyle(`width`).pfValue,u=e.pstyle(`arrow-scale`).value,d=this.r.getArrowWidth(l,u),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);Gm(p),qm(p,p,[i,a]),Ym(p,p,[d,d]),Jm(p,p,o),this.vertTypeBuffer.getView(f)[0]=dh,Nm(t,this.indexBuffer.getView(f)),Mm(s,c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:`drawEdgeLine`,value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle(`opacity`).value,i=e.pstyle(`line-opacity`).value,a=e.pstyle(`width`).pfValue,o=e.pstyle(`line-color`).value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=lh,Nm(t,this.indexBuffer.getView(c)),Mm(o,s,this.colorBuffer.getView(c));var l=this.lineWidthBuffer.getView(c);l[0]=a;var u=this.pointAPointBBuffer.getView(c);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var d=0;d<n.length-2;d+=2){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=uh,Nm(t,this.indexBuffer.getView(f)),Mm(o,s,this.colorBuffer.getView(f));var p=this.lineWidthBuffer.getView(f);p[0]=a;var m=n[d-2],h=n[d-1],g=n[d],_=n[d+1],v=n[d+2],y=n[d+3],b=n[d+4],x=n[d+5];d==0&&(m=2*g-v+.001,h=2*_-y+.001),d==n.length-4&&(b=2*v-g+.001,x=2*y-_+.001);var S=this.pointAPointBBuffer.getView(f);S[0]=m,S[1]=h,S[2]=g,S[3]=_;var C=this.pointCPointDBuffer.getView(f);C[0]=v,C[1]=y,C[2]=b,C[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:`_isValidEdge`,value:function(e){var t=e._private.rscratch;return!(t.badLine||t.allpts==null||isNaN(t.allpts[0]))}},{key:`_getEdgePoints`,value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(n.length==4)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:`_getNumSegments`,value:function(e){return Math.min(15,this.maxInstances)}},{key:`_getCurveSegmentPoints`,value:function(e,t){if(e.length==4)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(r==0)n[0]=e[0],n[1]=e[1];else if(r==t)n[r*2]=e[e.length-2],n[r*2+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,r*2)}return n}},{key:`_setCurvePoint`,value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:`endBatch`,value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(r!==0){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a=S(this.buffers),o;try{for(a.s();!(o=a.n()).done;)o.value.bufferSubData(r)}catch(e){a.e(e)}finally{a.f()}for(var s=this.batchManager.getAtlases(),c=0;c<s.length;c++)s[c].bufferIfNeeded(e);for(var l=0;l<s.length;l++)e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_2D,s[l].texture),e.uniform1i(i.uTextures[l],l);e.uniform1f(i.uZoom,Om(this.r)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var u=Mm(this.bgColor,1);e.uniform4fv(i.uBGColor,u),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:s.length}),this.startBatch()}}},{key:`getDebugInfo`,value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),_h={};_h.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=vh(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=Hm(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new gh(n,r,e);var i=function(e){return function(t){return n.getTextAngle(t,e)}},a=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},o=function(e){return function(t){return t.pstyle(`${e}-opacity`).value>0}},s=function(e){return e.pstyle(`text-events`).strValue===`yes`?sh.USE_BB:sh.IGNORE},c=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};n.drawing.addAtlasCollection(`node`,{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection(`label`,{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType(`node-body`,{collection:`node`,getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType(`node-body`,{getBoundingBox:c,isSimple:Am,shapeProps:{shape:`shape`,color:`background-color`,opacity:`background-opacity`,radius:`corner-radius`,border:!0}}),n.drawing.addSimpleShapeRenderType(`node-overlay`,{getBoundingBox:c,isVisible:o(`overlay`),shapeProps:{shape:`overlay-shape`,color:`overlay-color`,opacity:`overlay-opacity`,padding:`overlay-padding`,radius:`overlay-corner-radius`}}),n.drawing.addSimpleShapeRenderType(`node-underlay`,{getBoundingBox:c,isVisible:o(`underlay`),shapeProps:{shape:`underlay-shape`,color:`underlay-color`,opacity:`underlay-opacity`,padding:`underlay-padding`,radius:`underlay-corner-radius`}}),n.drawing.addTextureAtlasRenderType(`label`,{collection:`label`,getTexPickingMode:s,getKey:bh(t.getLabelKey,null),getBoundingBox:xh(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a(`label`)}),n.drawing.addTextureAtlasRenderType(`edge-source-label`,{collection:`label`,getTexPickingMode:s,getKey:bh(t.getSourceLabelKey,`source`),getBoundingBox:xh(t.getSourceLabelBox,`source`),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i(`source`),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a(`source-label`)}),n.drawing.addTextureAtlasRenderType(`edge-target-label`,{collection:`label`,getTexPickingMode:s,getKey:bh(t.getTargetLabelKey,`target`),getBoundingBox:xh(t.getTargetLabelBox,`target`),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i(`target`),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a(`target-label`)});var l=Ct(function(){console.log(`garbage collect flag set`),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&l()}),Sh(n)};function vh(e){var t=e.cy.container();return ke(t&&t.style&&t.style.backgroundColor||`white`)}function yh(e,t){var n=e._private.rscratch;return pn(n,`labelWrapCachedLines`,t)||[]}var bh=function(e,t){return function(n){var r=e(n),i=yh(n,t);return i.length>1?i.map(function(e,t){return`${r}_${t}`}):r}},xh=function(e,t){return function(n,r){var i=e(n);if(typeof r==`string`){var a=r.indexOf(`_`);if(a>0){var o=Number(r.substring(a+1)),s=yh(n,t),c=i.h/s.length,l=c*o,u=i.y1+l;return{x1:i.x1,w:i.w,y1:u,h:c,yOffset:l}}}return i}};function Sh(e){var t=e.render;e.render=function(n){n||={};var r=e.cy;e.webgl&&(r.zoom()>gp?(Ch(e),t.call(e,n)):(wh(e),Nh(e,n,oh.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return jh(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),t===`viewport`||t===`bounds`?e.pickingFrameBuffer.needsDraw=!0:t===`background`&&e.drawing.invalidate(n,{type:`node-body`})}}function Ch(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function wh(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function Th(e){var t=e.canvasWidth,n=e.canvasHeight,r=Dm(e),i=r.pan,a=r.zoom,o=Wm();qm(o,o,[i.x,i.y]),Ym(o,o,[a,a]);var s=Wm();Xm(s,t,n);var c=Wm();return Km(c,s,o),c}function Eh(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=Dm(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function Dh(e,t){e.drawSelectionRectangle(t,function(t){return Eh(e,t)})}function Oh(e){var t=e.data.contexts[e.NODE];t.save(),Eh(e,t),t.strokeStyle=`rgba(0, 0, 0, 0.3)`,t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function kh(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var c=o[s].canvas;if(c){var l=c.width,u=c.height,d=l*s,f=c.height*r,p=.4;a.save(),a.scale(p,p),a.drawImage(c,d,f),a.strokeStyle=`black`,a.rect(d,f,l,u),a.stroke(),a.restore()}}},n=0;t(e.drawing,`node`,n++),t(e.drawing,`label`,n++)}function Ah(e,t,n,r,i){var a,o,s,c,l=Dm(e),u=l.pan,d=l.zoom,f=O(km(e,u,d,t,n),2),p=f[0],m=f[1],h=6;if(a=p-h/2,o=m-h/2,s=h,c=h,s===0||c===0)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),Nh(e,null,oh.PICKING),e.pickingFrameBuffer.needsDraw=!1);var _=s*c,v=new Uint8Array(_*4);g.readPixels(a,o,s,c,g.RGBA,g.UNSIGNED_BYTE,v),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var y=new Set,b=0;b<_;b++){var x=Pm(v.slice(b*4,b*4+4))-1;x>=0&&y.add(x)}return y}function jh(e,t,n){var r=Ah(e,t,n),i=e.getCachedZSortedEles(),a,o,s=S(r),c;try{for(s.s();!(c=s.n()).done;){var l=i[c.value];if(!a&&l.isNode()&&(a=l),!o&&l.isEdge()&&(o=l),a&&o)break}}catch(e){s.e(e)}finally{s.f()}return[a,o].filter(Boolean)}function Mh(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,`node-underlay`),r.drawNode(n,t,`node-body`),r.drawTexture(n,t,`label`),r.drawNode(n,t,`node-overlay`)):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,`source`),r.drawEdgeArrow(n,t,`target`),r.drawTexture(n,t,`label`),r.drawTexture(n,t,`edge-source-label`),r.drawTexture(n,t,`edge-target-label`))}function Nh(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&Dh(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.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=Th(e),c=e.getCachedZSortedEles();if(a=c.length,i.startFrame(s,n),n.screen){for(var l=0;l<c.nondrag.length;l++)Mh(e,l,c.nondrag[l]);for(var u=0;u<c.drag.length;u++)Mh(e,u,c.drag[u])}else if(n.picking)for(var d=0;d<c.length;d++)Mh(e,d,c[d]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(Oh(e),kh(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),p=!1,m=Math.ceil(f-r),h=i.getDebugInfo(),g=[`${a} elements`,`${h.totalInstances} instances`,`${h.batchCount} batches`,`${h.totalAtlases} atlases`,`${h.wrappedCount} wrapped textures`,`${h.simpleCount} simple shapes`].join(`, `);if(p)console.log(`WebGL (${n.name}) - time ${m}ms, ${g}`);else{console.log(`WebGL (${n.name}) - frame time ${m}ms`),console.log(`Totals:`),console.log(` ${g}`),console.log(`Texture Atlases Used:`);var _=h.atlasInfo,v=S(_),y;try{for(v.s();!(y=v.n()).done;){var b=y.value;console.log(` ${b.type}: ${b.keyCount} keys, ${b.atlasCount} atlases`)}}catch(e){v.e(e)}finally{v.f()}console.log(``)}}e.data.gc&&(console.log(`Garbage Collect!`),e.data.gc=!1,i.gc())}var Ph={};Ph.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var c=1;c<a.length/2;c++)e.lineTo(t+o*a[c*2],n+s*a[c*2+1]);e.closePath()},Ph.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return Lf(e,t)}),e.closePath()},Ph.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Jr(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,c),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.arcTo(t-o,n-s,t,n-s,c),e.lineTo(t,n-s),e.closePath()},Ph.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?Jr(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},Ph.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,c=i/2,l=o===`auto`?Xr():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+l,n-c),e.lineTo(t+s-l,n-c),e.lineTo(t+s,n-c+l),e.lineTo(t+s,n+c-l),e.lineTo(t+s-l,n+c),e.lineTo(t-s+l,n+c),e.lineTo(t-s,n+c-l),e.lineTo(t-s,n-c+l),e.closePath()},Ph.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,c=t+a,l=n-o,u=n+o,d=Qr(r,i),f=d.widthOffset,p=d.heightOffset,m=d.ctrlPtOffsetPct*f;e.beginPath&&e.beginPath(),e.moveTo(s,l+p),e.lineTo(s,u-p),e.quadraticCurveTo(s+m,u,s+f,u),e.lineTo(c-f,u),e.quadraticCurveTo(c-m,u,c,u-p),e.lineTo(c,l+p),e.quadraticCurveTo(c-m,l,c-f,l),e.lineTo(s+f,l),e.quadraticCurveTo(s+m,l,s,l+p),e.closePath()};for(var Fh=Math.sin(0),Ih=Math.cos(0),Lh={},Rh={},zh=Math.PI/40,Bh=0*Math.PI;Bh<2*Math.PI;Bh+=zh)Lh[Bh]=Math.sin(Bh),Rh[Bh]=Math.cos(Bh);Ph.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,c=i/2,l=0*Math.PI;l<2*Math.PI;l+=zh)a=t-s*Lh[l]*Fh+s*Rh[l]*Ih,o=n+c*Rh[l]*Fh+c*Lh[l]*Ih,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Vh={};Vh.createBuffer=function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]},Vh.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=K(e.maxWidth)||K(e.maxHeight),s=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,a*=e.scale,c=e.scale;else if(o){var l=1/0,u=1/0;K(e.maxWidth)&&(l=c*e.maxWidth/i),K(e.maxHeight)&&(u=c*e.maxHeight/a),c=Math.min(l,u),i*=c,a*=c}o||(i*=s,a*=s,c*=s);var d=document.createElement(`canvas`);d.width=i,d.height=a,d.style.width=i+`px`,d.style.height=a+`px`;var f=d.getContext(`2d`);if(i>0&&a>0){f.clearRect(0,0,i,a),f.globalCompositeOperation=`source-over`;var p=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*c,-n.y1*c),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(n.x1*c,n.y1*c);else{var m=t.pan(),h={x:m.x*c,y:m.y*c};c*=t.zoom(),f.translate(h.x,h.y),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(-h.x,-h.y)}e.bg&&(f.globalCompositeOperation=`destination-over`,f.fillStyle=e.bg,f.rect(0,0,i,a),f.fill())}return d};function Hh(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function Uh(e){var t=e.indexOf(`,`);return e.substr(t+1)}function Wh(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case`blob-promise`:return new ka(function(r,i){try{t.toBlob(function(e){e==null?i(Error("`canvas.toBlob()` sent a null value in its callback")):r(e)},n,e.quality)}catch(e){i(e)}});case`blob`:return Hh(Uh(r()),n);case`base64`:return Uh(r());default:return r()}}Vh.png=function(e){return Wh(e,this.bufferCanvasImage(e),`image/png`)},Vh.jpg=function(e){return Wh(e,this.bufferCanvasImage(e),`image/jpeg`)};var Gh={};Gh.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case`ellipse`:return this.drawEllipsePath(t,n,r,i,a);case`polygon`:return this.drawPolygonPath(t,n,r,i,a,o);case`round-polygon`:return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case`roundrectangle`:case`round-rectangle`:return this.drawRoundRectanglePath(t,n,r,i,a,s);case`cutrectangle`:case`cut-rectangle`:return this.drawCutRectanglePath(t,n,r,i,a,o,s);case`bottomroundrectangle`:case`bottom-round-rectangle`:return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case`barrel`:return this.drawBarrelPath(t,n,r,i,a)}};var Kh=qh,$=qh.prototype;$.CANVAS_LAYERS=3,$.SELECT_BOX=0,$.DRAG=1,$.NODE=2,$.WEBGL=3,$.CANVAS_TYPES=[`2d`,`2d`,`2d`,`webgl2`],$.BUFFER_COUNT=3,$.TEXTURE_BUFFER=0,$.MOTIONBLUR_BUFFER_NODE=1,$.MOTIONBLUR_BUFFER_DRAG=2;function qh(e){var t=this,n=t.cy.window().document;e.webgl&&($.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log(`webgl rendering enabled`)),t.data={canvases:Array($.CANVAS_LAYERS),contexts:Array($.CANVAS_LAYERS),canvasNeedsRedraw:Array($.CANVAS_LAYERS),bufferCanvases:Array($.BUFFER_COUNT),bufferContexts:Array($.CANVAS_LAYERS)};var r=`-webkit-tap-highlight-color`,i=`rgba(0,0,0,0)`;t.data.canvasContainer=n.createElement(`div`);var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position=`relative`,a.zIndex=`0`,a.overflow=`hidden`;var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":`none`,"-moz-user-select":`-moz-none`,"user-select":`none`,"-webkit-tap-highlight-color":`rgba(0,0,0,0)`,"outline-style":`none`};le()&&(s[`-ms-touch-action`]=`none`,s[`touch-action`]=`none`);for(var c=0;c<$.CANVAS_LAYERS;c++){var l=t.data.canvases[c]=n.createElement(`canvas`),u=$.CANVAS_TYPES[c];t.data.contexts[c]=l.getContext(u),t.data.contexts[c]||$t(`Could not create canvas of type `+u),Object.keys(s).forEach(function(e){l.style[e]=s[e]}),l.style.position=`absolute`,l.setAttribute(`data-id`,`layer`+c),l.style.zIndex=String($.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[$.NODE].setAttribute(`data-id`,`layer`+$.NODE+`-node`),t.data.canvases[$.SELECT_BOX].setAttribute(`data-id`,`layer`+$.SELECT_BOX+`-selectbox`),t.data.canvases[$.DRAG].setAttribute(`data-id`,`layer`+$.DRAG+`-drag`),t.data.canvases[$.WEBGL]&&t.data.canvases[$.WEBGL].setAttribute(`data-id`,`layer`+$.WEBGL+`-webgl`);for(var c=0;c<$.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=n.createElement(`canvas`),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext(`2d`),t.data.bufferCanvases[c].style.position=`absolute`,t.data.bufferCanvases[c].setAttribute(`data-id`,`buffer`+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility=`hidden`;t.pathsEnabled=!0;var d=lr(),f=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},p=function(e){return{x:-e.w/2,y:-e.h/2}},m=function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},h=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},_=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`main`,a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`source`,a)},S=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`target`,a)},C=function(e){return e.boundingBox(),e[0]._private.bodyBounds},w=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},D=function(e,t){return t},O=function(e){return f(C(e))},k=function(e,t,n){var r=e?e+`-`:``;return{x:t.x+n.pstyle(r+`text-margin-x`).pfValue,y:t.y+n.pstyle(r+`text-margin-y`).pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},j=function(e){return k(``,A(e,`labelX`,`labelY`),e)},M=function(e){return k(`source`,A(e,`sourceLabelX`,`sourceLabelY`),e)},N=function(e){return k(`target`,A(e,`targetLabelX`,`targetLabelY`),e)},P=function(e){return p(C(e))},F=function(e){return p(T(e))},I=function(e){return p(E(e))},L=function(e){var t=w(e),n=p(w(e));if(e.isNode()){switch(e.pstyle(`text-halign`).value){case`left`:n.x=-t.w-(t.leftPad||0);break;case`right`:n.x=-(t.rightPad||0);break}switch(e.pstyle(`text-valign`).value){case`top`:n.y=-t.h-(t.topPad||0);break;case`bottom`:n.y=-(t.botPad||0);break}}return n},R=t.data.eleTxrCache=new Mp(t,{getKey:h,doesEleInvalidateKey:m,drawElement:y,getBoundingBox:C,getRotationPoint:O,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),z=t.data.lblTxrCache=new Mp(t,{getKey:g,drawElement:b,getBoundingBox:w,getRotationPoint:j,getRotationOffset:L,isVisible:D}),B=t.data.slbTxrCache=new Mp(t,{getKey:_,drawElement:x,getBoundingBox:T,getRotationPoint:M,getRotationOffset:F,isVisible:D}),V=t.data.tlbTxrCache=new Mp(t,{getKey:v,drawElement:S,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:D}),H=t.data.lyrTxrCache=new Yp(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),z.invalidateElements(t),B.invalidateElements(t),V.invalidateElements(t),H.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var U=function(e){for(var t=0;t<e.length;t++)H.enqueueElementRefinement(e[t].ele)};R.onDequeue(U),z.onDequeue(U),B.onDequeue(U),V.onDequeue(U),e.webgl&&t.initWebgl(e,{getStyleKey:h,getLabelKey:g,getSourceLabelKey:_,getTargetLabelKey:v,drawElement:y,drawLabel:b,drawSourceLabel:x,drawTargetLabel:S,getElementBox:C,getLabelBox:w,getSourceLabelBox:T,getTargetLabelBox:E,getElementRotationPoint:O,getElementRotationOffset:P,getLabelRotationPoint:j,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:N,getLabelRotationOffset:L,getSourceLabelRotationOffset:F,getTargetLabelRotationOffset:I})}$.redrawHint=function(e,t){var n=this;switch(e){case`eles`:n.data.canvasNeedsRedraw[$.NODE]=t;break;case`drag`:n.data.canvasNeedsRedraw[$.DRAG]=t;break;case`select`:n.data.canvasNeedsRedraw[$.SELECT_BOX]=t;break;case`gc`:n.data.gc=!0;break}};var Jh=typeof Path2D<`u`;$.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},$.usePaths=function(){return Jh&&this.pathsEnabled},$.setImgSmoothing=function(e,t){e.imageSmoothingEnabled==null?(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t):e.imageSmoothingEnabled=t},$.getImgSmoothing=function(e){return e.imageSmoothingEnabled==null?e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled:e.imageSmoothingEnabled},$.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>`u`?`undefined`:M(OffscreenCanvas))===`undefined`?(n=this.cy.window().document.createElement(`canvas`),n.width=e,n.height=t):n=new OffscreenCanvas(e,t),n},[$p,om,pm,hm,gm,ym,xm,_h,Ph,Vh,Gh].forEach(function(e){X($,e)});var Yh=[{type:`layout`,extensions:cf},{type:`renderer`,extensions:[{name:`null`,impl:lf},{name:`base`,impl:sp},{name:`canvas`,impl:Kh}]}],Xh={},Zh={};function Qh(e,t,n){var r=n,i=function(n){tn("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if(e===`core`){if(yd.prototype[t])return i(t);yd.prototype[t]=n}else if(e===`collection`){if(Nu.prototype[t])return i(t);Nu.prototype[t]=n}else if(e===`layout`){for(var a=function(e){this.options=e,n.call(this,e),W(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],c=0;c<s.length;c++){var l=s[c];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 u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit(`layoutstop`),this},o.destroy||=function(){return this},o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},f={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};X(o,{createEmitter:function(){return this._private.emitter=new tu(f,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Ac.eventAliasesOn(o),r=a}else if(e===`renderer`&&t!==`null`&&t!==`base`){var p=$h(`renderer`,`base`),m=p.prototype,h=n,g=n.prototype,_=function(){p.apply(this,arguments),h.apply(this,arguments)},v=_.prototype;for(var y in m){var b=m[y];if(g[y]!=null)return i(y);v[y]=b}for(var x in g)v[x]=g[x];m.clientFunctions.forEach(function(e){v[e]=v[e]||function(){$t("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=_}else if(e===`__proto__`||e===`constructor`||e===`prototype`)return $t(e+` is an illegal type to be registered, possibly lead to prototype pollutions`);return je({map:Xh,keys:[e,t],value:r})}function $h(e,t){return Me({map:Xh,keys:[e,t]})}function eg(e,t,n,r,i){return je({map:Zh,keys:[e,t,n,r],value:i})}function tg(e,t,n,r){return Me({map:Zh,keys:[e,t,n,r]})}var ng=function(){if(arguments.length===2)return $h.apply(null,arguments);if(arguments.length===3)return Qh.apply(null,arguments);if(arguments.length===4)return tg.apply(null,arguments);if(arguments.length===5)return eg.apply(null,arguments);$t(`Invalid extension access syntax`)};yd.prototype.extension=ng,Yh.forEach(function(e){e.extensions.forEach(function(t){Qh(e.type,t.name,t.impl)})});var rg=function(){if(!(this instanceof rg))return new rg;this.length=0},ig=rg.prototype;ig.instanceString=function(){return`stylesheet`},ig.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},ig.css=function(e,t){var n=this.length-1;if(V(e))this[n].properties.push({name:e,value:t});else if(W(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(s!=null){var c=pd.properties[o]||pd.properties[fe(o)];if(c!=null){var l=c.name,u=s;this[n].properties.push({name:l,value:u})}}}return this},ig.style=ig.css,ig.generateStyle=function(e){var t=new pd(e);return this.appendToStyle(t)},ig.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var ag=`3.33.1`,og=function(e){if(e===void 0&&(e={}),W(e))return new yd(e);if(V(e))return ng.apply(ng,arguments)};og.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(og),e.apply(null,t),this},og.warnings=function(e){return en(e)},og.version=ag,og.stylesheet=og.Stylesheet=rg;var sg=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.layoutBase=r():n.layoutBase=r()})(e,function(){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=26)})([(function(e,t,n){function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r}),(function(e,t,n){var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw`Node is not incident with this edge`},o.prototype.getOtherEndInGraph=function(e,t){for(var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();;){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=[,,,,];this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.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=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o}),(function(e,t,n){function r(e){this.vGraphObject=e}e.exports=r}),(function(e,t,n){var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),c=n(4);function l(e,t,n,o){n==null&&o==null&&(o=t),r.call(this,o),e.graphManager!=null&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,n!=null&&t!=null?this.rect=new a(t.x,t.y,n.width,n.height):this.rect=new a}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.getEdges=function(){return this.edges},l.prototype.getChild=function(){return this.child},l.prototype.getOwner=function(){return this.owner},l.prototype.getWidth=function(){return this.rect.width},l.prototype.setWidth=function(e){this.rect.width=e},l.prototype.getHeight=function(){return this.rect.height},l.prototype.setHeight=function(e){this.rect.height=e},l.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},l.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},l.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},l.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},l.prototype.getRect=function(){return this.rect},l.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},l.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},l.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},l.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},l.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},l.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},l.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.target==e){if(r.source!=n)throw`Incorrect edge source!`;t.push(r)}}),t},l.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(!(r.source==n||r.target==n))throw`Incorrect edge source and/or target`;(r.target==e||r.source==e)&&t.push(r)}),t},l.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach(function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw`Incorrect incidency!`;e.add(n.source)}}),e},l.prototype.withChildren=function(){var e=new Set,t,n;if(e.add(this),this.child!=null)for(var r=this.child.getNodes(),i=0;i<r.length;i++)t=r[i],n=t.withChildren(),n.forEach(function(t){e.add(t)});return e},l.prototype.getNoOfChildren=function(){var e=0,t;if(this.child==null)e=1;else for(var n=this.child.getNodes(),r=0;r<n.length;r++)t=n[r],e+=t.getNoOfChildren();return e==0&&(e=1),e},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw`assert failed`;return this.estimatedSize},l.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)},l.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},l.prototype.updateBounds=function(){if(this.getChild()==null)throw`assert failed`;if(this.getChild().getNodes().length!=0){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth>t&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&(this.labelPos==`center`?this.rect.y-=(this.labelHeight-n)/2:this.labelPos==`top`&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw`assert failed`;return this.inclusionTreeDepth},l.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new c(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=l}),(function(e,t,n){function r(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r}),(function(e,t,n){var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),c=n(1),l=n(13),u=n(12),d=n(11);function f(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,t!=null&&t instanceof o?this.graphManager=t:t!=null&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in f.prototype=Object.create(r.prototype),r)f[p]=r[p];f.prototype.getNodes=function(){return this.nodes},f.prototype.getEdges=function(){return this.edges},f.prototype.getGraphManager=function(){return this.graphManager},f.prototype.getParent=function(){return this.parent},f.prototype.getLeft=function(){return this.left},f.prototype.getRight=function(){return this.right},f.prototype.getTop=function(){return this.top},f.prototype.getBottom=function(){return this.bottom},f.prototype.isConnected=function(){return this.isConnected},f.prototype.add=function(e,t,n){if(t==null&&n==null){var r=e;if(this.graphManager==null)throw`Graph has no graph mgr!`;if(this.getNodes().indexOf(r)>-1)throw`Node already in graph!`;return r.owner=this,this.getNodes().push(r),r}else{var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw`Source or target not in graph!`;if(!(t.owner==n.owner&&t.owner==this))throw`Both owners must be this graph!`;return t.owner==n.owner?(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i):null}},f.prototype.remove=function(e){var t=e;if(e instanceof s){if(t==null)throw`Node is null!`;if(!(t.owner!=null&&t.owner==this))throw`Owner graph is invalid!`;if(this.graphManager==null)throw`Owner graph manager is invalid!`;for(var n=t.edges.slice(),r,i=n.length,a=0;a<i;a++)r=n[a],r.isInterGraph?this.graphManager.remove(r):r.source.owner.remove(r);var o=this.nodes.indexOf(t);if(o==-1)throw`Node not in owner node list!`;this.nodes.splice(o,1)}else if(e instanceof c){var r=e;if(r==null)throw`Edge is null!`;if(!(r.source!=null&&r.target!=null))throw`Source and/or target is null!`;if(!(r.source.owner!=null&&r.target.owner!=null&&r.source.owner==this&&r.target.owner==this))throw`Source and/or target owner is invalid!`;var l=r.source.edges.indexOf(r),u=r.target.edges.indexOf(r);if(!(l>-1&&u>-1))throw`Source and/or target doesn't know this edge!`;r.source.edges.splice(l,1),r.target!=r.source&&r.target.edges.splice(u,1);var o=r.source.owner.getEdges().indexOf(r);if(o==-1)throw`Not in owner's edge list!`;r.source.owner.getEdges().splice(o,1)}},f.prototype.updateLeftTop=function(){for(var e=i.MAX_VALUE,t=i.MAX_VALUE,n,r,a,o=this.getNodes(),s=o.length,c=0;c<s;c++){var l=o[c];n=l.getTop(),r=l.getLeft(),e>n&&(e=n),t>r&&(t=r)}return e==i.MAX_VALUE?null:(a=o[0].getParent().paddingLeft==null?this.margin:o[0].getParent().paddingLeft,this.left=t-a,this.top=e-a,new u(this.left,this.top))},f.prototype.updateBounds=function(e){for(var t=i.MAX_VALUE,n=-i.MAX_VALUE,r=i.MAX_VALUE,a=-i.MAX_VALUE,o,s,c,u,d,f=this.nodes,p=f.length,m=0;m<p;m++){var h=f[m];e&&h.child!=null&&h.updateBounds(),o=h.getLeft(),s=h.getRight(),c=h.getTop(),u=h.getBottom(),t>o&&(t=o),n<s&&(n=s),r>c&&(r=c),a<u&&(a=u)}var g=new l(t,r,n-t,a-r);t==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),d=f[0].getParent().paddingLeft==null?this.margin:f[0].getParent().paddingLeft,this.left=g.x-d,this.right=g.x+g.width+d,this.top=g.y-d,this.bottom=g.y+g.height+d},f.calculateBounds=function(e){for(var t=i.MAX_VALUE,n=-i.MAX_VALUE,r=i.MAX_VALUE,a=-i.MAX_VALUE,o,s,c,u,d=e.length,f=0;f<d;f++){var p=e[f];o=p.getLeft(),s=p.getRight(),c=p.getTop(),u=p.getBottom(),t>o&&(t=o),n<s&&(n=s),r>c&&(r=c),a<u&&(a=u)}return new l(t,r,n-t,a-r)},f.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},f.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw`assert failed`;return this.estimatedSize},f.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++){var i=t[r];e+=i.calcEstimatedSize()}return e==0?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=e/Math.sqrt(this.nodes.length),this.estimatedSize},f.prototype.updateConnected=function(){var e=this;if(this.nodes.length==0){this.isConnected=!0;return}var t=new d,n=new Set,r=this.nodes[0],i,a;for(r.withChildren().forEach(function(e){t.push(e),n.add(e)});t.length!==0;){r=t.shift(),i=r.getEdges();for(var o=i.length,s=0;s<o;s++)a=i[s].getOtherEndInGraph(r,this),a!=null&&!n.has(a)&&a.withChildren().forEach(function(e){t.push(e),n.add(e)})}if(this.isConnected=!1,n.size>=this.nodes.length){var c=0;n.forEach(function(t){t.owner==e&&c++}),c==this.nodes.length&&(this.isConnected=!0)}},e.exports=f}),(function(e,t,n){var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(n==null&&r==null&&i==null){if(e==null)throw`Graph is null!`;if(t==null)throw`Parent node is null!`;if(this.graphs.indexOf(e)>-1)throw`Graph already in this graph mgr!`;if(this.graphs.push(e),e.parent!=null)throw`Already has a parent!`;if(t.child!=null)throw`Already has a child!`;return e.parent=t,t.child=e,e}else{i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(!(a!=null&&a.getGraphManager()==this))throw`Source not in this graph mgr!`;if(!(o!=null&&o.getGraphManager()==this))throw`Target not in this graph mgr!`;if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw`Edge already in inter-graph edge list!`;if(this.edges.push(n),!(n.source!=null&&n.target!=null))throw`Edge source and/or target is null!`;if(!(n.source.edges.indexOf(n)==-1&&n.target.edges.indexOf(n)==-1))throw`Edge already in source and/or target incidency list!`;return n.source.edges.push(n),n.target.edges.push(n),n}},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw`Graph not in this graph mgr`;if(!(t==this.rootGraph||t.parent!=null&&t.parent.graphManager==this))throw`Invalid parent node!`;var n=[];n=n.concat(t.getEdges());for(var a,o=n.length,s=0;s<o;s++)a=n[s],t.remove(a);var c=[];c=c.concat(t.getNodes());var l;o=c.length;for(var s=0;s<o;s++)l=c[s],t.remove(l);t==this.rootGraph&&this.setRootGraph(null);var u=this.graphs.indexOf(t);this.graphs.splice(u,1),t.parent=null}else if(e instanceof i){if(a=e,a==null)throw`Edge is null!`;if(!a.isInterGraph)throw`Not an inter-graph edge!`;if(!(a.source!=null&&a.target!=null))throw`Source and/or target is null!`;if(!(a.source.edges.indexOf(a)!=-1&&a.target.edges.indexOf(a)!=-1))throw`Source and/or target doesn't know this edge!`;var u=a.source.edges.indexOf(a);if(a.source.edges.splice(u,1),u=a.target.edges.indexOf(a),a.target.edges.splice(u,1),!(a.source.owner!=null&&a.source.owner.getGraphManager()!=null))throw`Edge owner graph or owner graph manager is null!`;if(a.source.owner.getGraphManager().edges.indexOf(a)==-1)throw`Not in owner graph manager's edge list!`;var u=a.source.owner.getGraphManager().edges.indexOf(a);a.source.owner.getGraphManager().edges.splice(u,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(this.allNodes==null){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(this.allEdges==null){var e=[],t=this.getGraphs();t.length;for(var n=0;n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(this.allNodesToApplyGravitation!=null)throw`assert failed`;this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw`Root not in this graph mgr!`;this.rootGraph=e,e.parent??=this.layout.newNode(`Root node`)},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(!(e!=null&&t!=null))throw`assert failed`;if(e==t)return!0;var n=e.getOwner(),r;do{if(r=n.getParent(),r==null)break;if(r==t)return!0;if(n=r.getOwner(),n==null)break}while(!0);n=t.getOwner();do{if(r=n.getParent(),r==null)break;if(r==e)return!0;if(n=r.getOwner(),n==null)break}while(!0);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++){if(e=a[s],t=e.source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t==n){e.lca=t.getOwner();continue}for(r=t.getOwner();e.lca==null;){for(e.targetInLca=n,i=n.getOwner();e.lca==null;){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(e.lca!=null)throw`assert failed`;e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;e.lca??(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(e.lca==null)throw`assert failed`}},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();var n=e.getOwner();do{if(n==null)break;var r=t.getOwner();do{if(r==null)break;if(r==n)return r;r=r.getParent().getOwner()}while(!0);n=n.getParent().getOwner()}while(!0);return n},a.prototype.calcInclusionTreeDepths=function(e,t){e==null&&t==null&&(e=this.rootGraph,t=1);for(var n,r=e.getNodes(),i=r.length,a=0;a<i;a++)n=r[a],n.inclusionTreeDepth=t,n.child!=null&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=this.edges.length,n=0;n<t;n++)if(e=this.edges[n],this.isOneAncestorOfOther(e.source,e.target))return!0;return!1},e.exports=a}),(function(e,t,n){var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=i.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i}),(function(e,t,n){var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw`assert failed`;var i=[,,];this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){e.getCenterX()<t.getCenterX()?n[0]=-1:n[0]=1,e.getCenterY()<t.getCenterY()?n[1]=-1:n[1]=1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),c=e.getY(),l=e.getRight(),u=e.getX(),d=e.getBottom(),f=e.getRight(),p=e.getWidthHalf(),m=e.getHeightHalf(),h=t.getX(),g=t.getY(),_=t.getRight(),v=t.getX(),y=t.getBottom(),b=t.getRight(),x=t.getWidthHalf(),S=t.getHeightHalf(),C=!1,w=!1;if(r===a){if(i>o)return n[0]=r,n[1]=c,n[2]=a,n[3]=y,!1;if(i<o)return n[0]=r,n[1]=d,n[2]=a,n[3]=g,!1}else if(i===o){if(r>a)return n[0]=s,n[1]=i,n[2]=_,n[3]=o,!1;if(r<a)return n[0]=l,n[1]=i,n[2]=h,n[3]=o,!1}else{var T=e.height/e.width,E=t.height/t.width,D=(o-i)/(a-r),O=void 0,k=void 0,A=void 0,j=void 0,M=void 0,N=void 0;if(-T===D?r>a?(n[0]=u,n[1]=d,C=!0):(n[0]=l,n[1]=c,C=!0):T===D&&(r>a?(n[0]=s,n[1]=c,C=!0):(n[0]=f,n[1]=d,C=!0)),-E===D?a>r?(n[2]=v,n[3]=y,w=!0):(n[2]=_,n[3]=g,w=!0):E===D&&(a>r?(n[2]=h,n[3]=g,w=!0):(n[2]=b,n[3]=y,w=!0)),C&&w)return!1;if(r>a?i>o?(O=this.getCardinalDirection(T,D,4),k=this.getCardinalDirection(E,D,2)):(O=this.getCardinalDirection(-T,D,3),k=this.getCardinalDirection(-E,D,1)):i>o?(O=this.getCardinalDirection(-T,D,1),k=this.getCardinalDirection(-E,D,3)):(O=this.getCardinalDirection(T,D,2),k=this.getCardinalDirection(E,D,4)),!C)switch(O){case 1:j=c,A=r+-m/D,n[0]=A,n[1]=j;break;case 2:A=f,j=i+p*D,n[0]=A,n[1]=j;break;case 3:j=d,A=r+m/D,n[0]=A,n[1]=j;break;case 4:A=u,j=i+-p*D,n[0]=A,n[1]=j;break}if(!w)switch(k){case 1:N=g,M=a+-S/D,n[2]=M,n[3]=N;break;case 2:M=b,N=o+x*D,n[2]=M,n[3]=N;break;case 3:N=y,M=a+S/D,n[2]=M,n[3]=N;break;case 4:M=v,N=o+-x*D,n[2]=M,n[3]=N;break}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(i==null)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,c=t.y,l=n.x,u=n.y,d=i.x,f=i.y,p=void 0,m=void 0,h=void 0,g=void 0,_=void 0,v=void 0,y=void 0,b=void 0,x=void 0;return h=c-o,_=a-s,y=s*o-a*c,g=f-u,v=l-d,b=d*u-l*f,x=h*v-g*_,x===0?null:(p=(_*b-v*y)/x,m=(g*y-h*b)/x,new r(p,m))},i.angleOfVector=function(e,t,n,r){var i=void 0;return e===n?i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI:(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)),i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,c=n.x,l=n.y,u=r.x,d=r.y,f=(o-i)*(d-l)-(u-c)*(s-a);if(f===0)return!1;var p=((d-l)*(u-i)+(c-u)*(d-a))/f,m=((a-s)*(u-i)+(o-i)*(d-a))/f;return 0<p&&p<1&&0<m&&m<1},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i}),(function(e,t,n){function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r}),(function(e,t,n){function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var a=function(e){return{value:e,next:null,prev:null}},o=function(e,t,n,r){return e===null?r.head=t:e.next=t,n===null?r.tail=t:n.prev=t,t.prev=e,t.next=n,r.length++,t},s=function(e,t){var n=e.prev,r=e.next;return n===null?t.head=r:n.next=r,r===null?t.tail=n:r.prev=n,e.prev=e.next=null,t.length--,e};e.exports=function(){function e(t){var n=this;i(this,e),this.length=0,this.head=null,this.tail=null,t?.forEach(function(e){return n.push(e)})}return r(e,[{key:`size`,value:function(){return this.length}},{key:`insertBefore`,value:function(e,t){return o(t.prev,a(e),t,this)}},{key:`insertAfter`,value:function(e,t){return o(t,a(e),t.next,this)}},{key:`insertNodeBefore`,value:function(e,t){return o(t.prev,e,t,this)}},{key:`insertNodeAfter`,value:function(e,t){return o(t,e,t.next,this)}},{key:`push`,value:function(e){return o(this.tail,a(e),null,this)}},{key:`unshift`,value:function(e){return o(null,a(e),this.head,this)}},{key:`remove`,value:function(e){return s(e,this)}},{key:`pop`,value:function(){return s(this.tail,this).value}},{key:`popNode`,value:function(){return s(this.tail,this)}},{key:`shift`,value:function(){return s(this.head,this).value}},{key:`shiftNode`,value:function(){return s(this.head,this)}},{key:`get_object_at`,value:function(e){if(e<=this.length()){for(var t=1,n=this.head;t<e;)n=n.next,t++;return n.value}}},{key:`set_object_at`,value:function(e,t){if(e<=this.length()){for(var n=1,r=this.head;n<e;)r=r.next,n++;r.value=t}}}]),e}()}),(function(e,t,n){function r(e,t,n){this.x=null,this.y=null,e==null&&t==null&&n==null?(this.x=0,this.y=0):typeof e==`number`&&typeof t==`number`&&n==null?(this.x=e,this.y=t):e.constructor.name==`Point`&&t==null&&n==null&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){e.constructor.name==`Point`&&t==null&&n==null?(n=e,this.setLocation(n.x,n.y)):typeof e==`number`&&typeof t==`number`&&n==null&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){if(e.constructor.name==`Point`){var t=e;return this.x==t.x&&this.y==t.y}return this==e},r.prototype.toString=function(){return new r().constructor.name+`[x=`+this.x+`,y=`+this.y+`]`},e.exports=r}),(function(e,t,n){function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,e!=null&&t!=null&&n!=null&&r!=null&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r}),(function(e,t,n){var r=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};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:e.uniqueID==null?(e.uniqueID=i.getString(),i.lastID++,e.uniqueID):e.uniqueID},i.getString=function(e){return e??=i.lastID,`Object#`+e},i.isPrimitive=function(e){var t=e===void 0?`undefined`:r(e);return e==null||t!=`object`&&t!=`function`},e.exports=i}),(function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}var i=n(0),a=n(6),o=n(3),s=n(1),c=n(5),l=n(4),u=n(17),d=n(27);function f(e){d.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,e!=null&&(this.isRemoteUse=e)}f.RANDOM_SEED=1,f.prototype=Object.create(d.prototype),f.prototype.getGraphManager=function(){return this.graphManager},f.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},f.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},f.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},f.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},f.prototype.newGraph=function(e){return new c(null,this.graphManager,e)},f.prototype.newNode=function(e){return new o(this.graphManager,e)},f.prototype.newEdge=function(e){return new s(null,null,e)},f.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},f.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var e=this.checkLayoutSuccess()?!1:this.layout();return i.ANIMATE===`during`?!1:(e&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},f.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},f.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];for(var n=this.graphManager.getRoot().getNodes(),t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},f.prototype.update=function(e){if(e==null)this.update2();else if(e instanceof o){var t=e;if(t.getChild()!=null)for(var n=t.getChild().getNodes(),r=0;r<n.length;r++)update(n[r]);t.vGraphObject!=null&&t.vGraphObject.update(t)}else if(e instanceof s){var i=e;i.vGraphObject!=null&&i.vGraphObject.update(i)}else if(e instanceof c){var a=e;a.vGraphObject!=null&&a.vGraphObject.update(a)}},f.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},f.prototype.transform=function(e){if(e==null)this.transform(new l(0,0));else{var t=new u,n=this.graphManager.getRoot().updateLeftTop();if(n!=null){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r=this.getAllNodes(),i,a=0;a<r.length;a++)i=r[a],i.transform(t)}}},f.prototype.positionNodesRandomly=function(e){if(e==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)t=r[i],n=t.getChild(),n==null||n.getNodes().length==0?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},f.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)n[a].getChild()!=null&&(i=!1);if(!i)return e;var o=new Set,s=[],c=new Map,l=[];for(l=l.concat(n);l.length>0&&t;){for(s.push(l[0]);s.length>0&&t;){var u=s[0];s.splice(0,1),o.add(u);for(var d=u.getEdges(),a=0;a<d.length;a++){var f=d[a].getOtherEnd(u);if(c.get(u)!=f)if(!o.has(f))s.push(f),c.set(f,u);else{t=!1;break}}}if(!t)e=[];else{var p=[].concat(r(o));e.push(p);for(var a=0;a<p.length;a++){var m=p[a],h=l.indexOf(m);h>-1&&l.splice(h,1)}o=new Set,c=new Map}}return e},f.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}var o=this.newEdge(null);return this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},f.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys()),e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new l(o.getCenterX(),o.getCenterY()),c=n.bendpoints.get(a);c.x=s.x,c.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},f.transform=function(e,t,n,r){if(n!=null&&r!=null){var i=t;if(e<=50){var a=t/n;i-=(t-a)/50*(50-e)}else{var o=t*r;i+=(o-t)/50*(e-50)}return i}else{var s,c;return e<=50?(s=9*t/500,c=t/10):(s=9*t/50,c=-8*t),s*e+c}},f.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;(t.length==1||t.length==2)&&(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=t[o],c=s.getNeighborsList().size;r.set(s,s.getNeighborsList().size),c==1&&n.push(s)}var l=[];for(l=l.concat(n);!i;){var u=[];u=u.concat(l),l=[];for(var o=0;o<t.length;o++){var s=t[o],d=t.indexOf(s);d>=0&&t.splice(d,1),s.getNeighborsList().forEach(function(e){if(n.indexOf(e)<0){var t=r.get(e)-1;t==1&&l.push(e),r.set(e,t)}})}n=n.concat(l),(t.length==1||t.length==2)&&(i=!0,a=t[0])}return a},f.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=f}),(function(e,t,n){function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=Math.sin(r.seed++)*1e4,r.x-Math.floor(r.x)},e.exports=r}),(function(e,t,n){var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return n!=0&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return n!=0&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return n!=0&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return n!=0&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i}),(function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}var i=n(15),a=n(7),o=n(0),s=n(8),c=n(9);function l(){i.call(this),this.useSmartIdealEdgeLengthCalculation=a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=a.DEFAULT_EDGE_LENGTH,this.springConstant=a.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=a.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=a.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=a.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=a.MAX_ITERATIONS}for(var u in l.prototype=Object.create(i.prototype),i)l[u]=i[u];l.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,i,s,c=this.getGraphManager().getAllEdges(),l=0;l<c.length;l++)e=c[l],e.idealLength=this.idealEdgeLength,e.isInterGraph&&(n=e.getSource(),r=e.getTarget(),i=e.getSourceInLca().getEstimatedSize(),s=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=i+s-2*o.SIMPLE_NODE_SIZE),t=e.getLca().getInclusionTreeDepth(),e.idealLength+=a.DEFAULT_EDGE_LENGTH*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(n.getInclusionTreeDepth()+r.getInclusionTreeDepth()-2*t))},l.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e=this.getAllEdges(),t,n=0;n<e.length;n++)t=e[n],this.calcSpringForce(t,t.idealLength)},l.prototype.calcRepulsionForces=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,r,i,o,s=this.getAllNodes(),c;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&e&&this.updateGrid(),c=new Set,n=0;n<s.length;n++)i=s[n],this.calculateRepulsionForceOfANode(i,c,e,t),c.add(i);else for(n=0;n<s.length;n++)for(i=s[n],r=n+1;r<s.length;r++)o=s[r],i.getOwner()==o.getOwner()&&this.calcRepulsionForce(i,o)},l.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},l.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t,n=0;n<e.length;n++)t=e[n],t.move()},l.prototype.calcSpringForce=function(e,t){var n=e.getSource(),r=e.getTarget(),i,a,o,s;if(this.uniformLeafNodeSizes&&n.getChild()==null&&r.getChild()==null)e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;i=e.getLength(),i!=0&&(a=this.springConstant*(i-t),o=a*(e.lengthX/i),s=a*(e.lengthY/i),n.springForceX+=o,n.springForceY+=s,r.springForceX-=o,r.springForceY-=s)},l.prototype.calcRepulsionForce=function(e,t){var n=e.getRect(),r=t.getRect(),i=[,,],o=[,,,,],l,u,d,f,p,m,h;if(n.intersects(r)){s.calcSeparationAmount(n,r,i,a.DEFAULT_EDGE_LENGTH/2),m=2*i[0],h=2*i[1];var g=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=g*m,e.repulsionForceY-=g*h,t.repulsionForceX+=g*m,t.repulsionForceY+=g*h}else this.uniformLeafNodeSizes&&e.getChild()==null&&t.getChild()==null?(l=r.getCenterX()-n.getCenterX(),u=r.getCenterY()-n.getCenterY()):(s.getIntersection(n,r,o),l=o[2]-o[0],u=o[3]-o[1]),Math.abs(l)<a.MIN_REPULSION_DIST&&(l=c.sign(l)*a.MIN_REPULSION_DIST),Math.abs(u)<a.MIN_REPULSION_DIST&&(u=c.sign(u)*a.MIN_REPULSION_DIST),d=l*l+u*u,f=Math.sqrt(d),p=this.repulsionConstant*e.noOfChildren*t.noOfChildren/d,m=p*l/f,h=p*u/f,e.repulsionForceX-=m,e.repulsionForceY-=h,t.repulsionForceX+=m,t.repulsionForceY+=h},l.prototype.calcGravitationalForce=function(e){var t=e.getOwner(),n=(t.getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,c;e.getOwner()==this.graphManager.getRoot()?(c=t.getEstimatedSize()*this.gravityRangeFactor,(o>c||s>c)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a)):(c=t.getEstimatedSize()*this.compoundGravityRangeFactor,(o>c||s>c)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant))},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)e=t[n],e.noOfChildren=e.getNoOfChildren()},l.prototype.calcGrid=function(e){var t=0,n=0;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=Array(t),i=0;i<t;i++)r[i]=Array(n);for(var i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=[];return r},l.prototype.addNodeToGrid=function(e,t,n){var r=0,i=0,a=0,o=0;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var c=a;c<=o;c++)this.grid[s][c].push(e),e.setGridCoordinates(r,i,a,o)},l.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),e=0;e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(e,t,n,i){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&n||i){var o=new Set;e.surrounding=[];for(var s,c=this.grid,l=e.startX-1;l<e.finishX+2;l++)for(var u=e.startY-1;u<e.finishY+2;u++)if(!(l<0||u<0||l>=c.length||u>=c[0].length)){for(var d=0;d<c[l][u].length;d++)if(s=c[l][u][d],!(e.getOwner()!=s.getOwner()||e==s)&&!t.has(s)&&!o.has(s)){var f=Math.abs(e.getCenterX()-s.getCenterX())-(e.getWidth()/2+s.getWidth()/2),p=Math.abs(e.getCenterY()-s.getCenterY())-(e.getHeight()/2+s.getHeight()/2);f<=this.repulsionRange&&p<=this.repulsionRange&&o.add(s)}}e.surrounding=[].concat(r(o))}for(l=0;l<e.surrounding.length;l++)this.calcRepulsionForce(e,e.surrounding[l])},l.prototype.calcRepulsionRange=function(){return 0},e.exports=l}),(function(e,t,n){var r=n(1),i=n(7);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a}),(function(e,t,n){var r=n(3);function i(e,t,n,i){r.call(this,e,t,n,i),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];i.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=i}),(function(e,t,n){function r(e,t){this.width=0,this.height=0,e!==null&&t!==null&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r}),(function(e,t,n){var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){return r.createID(e),this.map[e]!=null},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i}),(function(e,t,n){var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return this.size()===0},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var a=n(11);e.exports=function(){function e(t,n){i(this,e),(n!==null||n!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof a?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:`_quicksort`,value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:`_partition`,value:function(e,t,n){for(var r=this._get(e,t),i=t,a=n;;){for(;this.compareFunction(r,this._get(e,a));)a--;for(;this.compareFunction(this._get(e,i),r);)i++;if(i<a)this._swap(e,i,a),i++,a--;else return a}}},{key:`_get`,value:function(e,t){return e instanceof a?e.get_object_at(t):e[t]}},{key:`_set`,value:function(e,t,n){e instanceof a?e.set_object_at(t,n):e[t]=n}},{key:`_swap`,value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:`_defaultCompareFunction`,value:function(e,t){return t>e}}]),e}()}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.exports=function(){function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=a,this.gap_penalty=o,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=Array(this.iMax);for(var s=0;s<this.iMax;s++){this.grid[s]=Array(this.jMax);for(var c=0;c<this.jMax;c++)this.grid[s][c]=0}this.tracebackGrid=Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=Array(this.jMax);for(var u=0;u<this.jMax;u++)this.tracebackGrid[l][u]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:`getScore`,value:function(){return this.score}},{key:`getAlignments`,value:function(){return this.alignments}},{key:`computeGrids`,value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=void 0;i=this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty;var a=this.grid[n-1][r]+this.gap_penalty,o=this.grid[n][r-1]+this.gap_penalty,s=[i,a,o],c=this.arrayAllMaxIndexes(s);this.grid[n][r]=s[c[0]],this.tracebackGrid[n][r]=[c.includes(0),c.includes(1),c.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:`alignmentTraceback`,value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:``,seq2:``});e[0];){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:`-`+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:`-`+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),t.pos[0]===0&&t.pos[1]===0&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:`getAllIndexes`,value:function(e,t){for(var n=[],r=-1;(r=e.indexOf(t,r+1))!==-1;)n.push(r);return n}},{key:`arrayAllMaxIndexes`,value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}()}),(function(e,t,n){var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(7),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(4),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(24),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(5),r.LEdge=n(1),r.LGraphManager=n(6),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(25),e.exports=r}),(function(e,t,n){function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r})])})})),cg=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(sg()):typeof define==`function`&&define.amd?define([`layout-base`],r):typeof e==`object`?e.coseBase=r(sg()):n.coseBase=r(n.layoutBase)})(e,function(e){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=7)})([(function(t,n){t.exports=e}),(function(e,t,n){var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i}),(function(e,t,n){var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),this.child==null||this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.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},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n=this.getChild().getNodes(),r,i=0;i<n.length;i++)r=n[i],r.getChild()==null?(r.moveBy(e,t),r.displacementX+=e,r.displacementY+=t):r.propogateDisplacementToChildren(e,t)},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a}),(function(e,t,n){var r=n(0).FDLayout,i=n(4),a=n(3),o=n(5),s=n(2),c=n(1),l=n(0).FDLayoutConstants,u=n(0).LayoutConstants,d=n(0).Point,f=n(0).PointD,p=n(0).Layout,m=n(0).Integer,h=n(0).IGeometry,g=n(0).LGraph,_=n(0).Transform;function v(){r.call(this),this.toBeTiled={}}for(var y in v.prototype=Object.create(r.prototype),r)v[y]=r[y];v.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},v.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},v.prototype.newNode=function(e){return new o(this.graphManager,e)},v.prototype.newEdge=function(e){return new s(null,null,e)},v.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(c.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=c.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=c.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=l.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=l.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.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/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=l.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},v.prototype.layout=function(){return u.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},v.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),!this.incremental){var e=this.getFlatForest();if(e.length>0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}else if(c.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(n)}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},v.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%l.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-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 e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=l.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=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},v.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},v.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if(l.ANIMATE===`during`)this.emit(`layoutstarted`);else{for(;!e;)e=this.tick();this.graphManager.updateBounds()}},v.prototype.calculateNodesToApplyGravitationTo=function(){var e=[],t,n=this.graphManager.getGraphs(),r=n.length,i;for(i=0;i<r;i++)t=n[i],t.updateConnected(),t.isConnected||(e=e.concat(t.getNodes()));return e},v.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t=new Set,n;for(n=0;n<e.length;n++){var r=e[n];if(!t.has(r)){var i=r.getSource(),a=r.getTarget();if(i==a)r.getBendpoints().push(new f),r.getBendpoints().push(new f),this.createDummyNodesForBendpoints(r),t.add(r);else{var o=[];if(o=o.concat(i.getEdgeListToNode(a)),o=o.concat(a.getEdgeListToNode(i)),!t.has(o[0])){if(o.length>1){var s;for(s=0;s<o.length;s++){var c=o[s];c.getBendpoints().push(new f),this.createDummyNodesForBendpoints(c)}}o.forEach(function(e){t.add(e)})}}}if(t.size==e.length)break}},v.prototype.positionNodesRadially=function(e){for(var t=new d(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new f(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,s!=0&&(i+=c.DEFAULT_COMPONENT_SEPERATION),r=0);var l=e[s],m=p.findCenterOfTree(l);t.x=a,t.y=i,o=v.radialLayout(l,m,t),o.y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+c.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(u.WORLD_CENTER_X-o.x/2,u.WORLD_CENTER_Y-o.y/2))},v.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),c.DEFAULT_RADIAL_SEPARATION);v.branchRadialLayout(t,null,0,359,0,r);var i=g.calculateBounds(e),a=new _;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++)e[o].transform(a);var s=new f(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(s)},v.branchRadialLayout=function(e,t,n,r,i,a){var o=(r-n+1)/2;o<0&&(o+=180);var s=(o+n)%360*h.TWO_PI/360,c=i*Math.cos(s),l=i*Math.sin(s);e.setCenter(c,l);var u=[];u=u.concat(e.getEdges());var d=u.length;t!=null&&d--;for(var f=0,p=u.length,m,g=e.getEdgesBetween(t);g.length>1;){var _=g[0];g.splice(0,1);var y=u.indexOf(_);y>=0&&u.splice(y,1),p--,d--}m=t==null?0:(u.indexOf(g[0])+1)%p;for(var b=Math.abs(r-n)/d,x=m;f!=d;x=++x%p){var S=u[x].getOtherEnd(e);if(S!=t){var C=(n+f*b)%360,w=(C+b)%360;v.branchRadialLayout(S,e,C,w,i+a,a),f++}}},v.maxDiagonalInTree=function(e){for(var t=m.MIN_VALUE,n=0;n<e.length;n++){var r=e[n].getDiagonal();r>t&&(t=r)}return t},v.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},v.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=r[i],s=a.getParent();this.getNodeDegreeWithChildren(a)===0&&(s.id==null||!this.getToBeTiled(s))&&n.push(a)}for(var i=0;i<n.length;i++){var a=n[i],c=a.getParent().id;t[c]===void 0&&(t[c]=[]),t[c]=t[c].concat(a)}Object.keys(t).forEach(function(n){if(t[n].length>1){var r=`DummyCompound_`+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),c=i.getChild();c.add(a);for(var l=0;l<t[n].length;l++){var u=t[n][l];c.remove(u),s.add(u)}}})},v.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},v.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(n){var r=e.idToDummyNode[n];t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height})},v.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},v.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach(function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)})},v.prototype.getToBeTiled=function(e){var t=e.id;if(this.toBeTiled[t]!=null)return this.toBeTiled[t];var n=e.getChild();if(n==null)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(a.getChild()==null){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}return this.toBeTiled[t]=!0,!0},v.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},v.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(e.getChild()==null)return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},v.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},v.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];n.getChild()!=null&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},v.prototype.adjustLocations=function(e,t,n,r,i){t+=r,n+=i;for(var a=t,o=0;o<e.rows.length;o++){var s=e.rows[o];t=a;for(var c=0,l=0;l<s.length;l++){var u=s[l];u.rect.x=t,u.rect.y=n,t+=u.rect.width+e.horizontalPadding,u.rect.height>c&&(c=u.rect.height)}n+=c+e.verticalPadding}},v.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach(function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height})},v.prototype.tileNodes=function(e,t){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:c.TILING_PADDING_VERTICAL,horizontalPadding:c.TILING_PADDING_HORIZONTAL};e.sort(function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:e.rect.width*e.rect.height<t.rect.width*t.rect.height?1:0});for(var r=0;r<e.length;r++){var i=e[r];n.rows.length==0?this.insertNodeToRow(n,i,0,t):this.canAddHorizontal(n,i.rect.width,i.rect.height)?this.insertNodeToRow(n,i,this.getShortestRowIndex(n),t):this.insertNodeToRow(n,i,n.rows.length,t),this.shiftToLastRow(n)}return n},v.prototype.insertNodeToRow=function(e,t,n,r){var i=r;n==e.rows.length&&(e.rows.push([]),e.rowWidth.push(i),e.rowHeight.push(0));var a=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(a+=e.horizontalPadding),e.rowWidth[n]=a,e.width<a&&(e.width=a);var o=t.rect.height;n>0&&(o+=e.verticalPadding);var s=0;o>e.rowHeight[n]&&(s=e.rowHeight[n],e.rowHeight[n]=o,s=e.rowHeight[n]-s),e.height+=s,e.rows[n].push(t)},v.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},v.prototype.getLongestRowIndex=function(e){for(var t=-1,n=Number.MIN_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},v.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a=0;e.rowHeight[r]<n&&r>0&&(a=n+e.verticalPadding-e.rowHeight[r]);var o=e.width-i>=t+e.horizontalPadding?(e.height+a)/(i+t+e.horizontalPadding):(e.height+a)/e.width;a=n+e.verticalPadding;var s=e.width<t?(e.height+a)/t:(e.height+a)/e.width;return s<1&&(s=1/s),o<1&&(o=1/o),o<s},v.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var c=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.height+=l-c,this.shiftToLastRow(e)}},v.prototype.tilingPreLayout=function(){c.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},v.prototype.tilingPostLayout=function(){c.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},v.prototype.reduceTrees=function(){for(var e=[],t=!0,n;t;){var r=this.graphManager.getAllNodes(),i=[];t=!1;for(var a=0;a<r.length;a++)n=r[a],n.getEdges().length==1&&!n.getEdges()[0].isInterGraph&&n.getChild()==null&&(i.push([n,n.getEdges()[0],n.getOwner()]),t=!0);if(t==1){for(var o=[],s=0;s<i.length;s++)i[s][0].getEdges().length==1&&(o.push(i[s]),i[s][0].getOwner().remove(i[s][0]));e.push(o),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},v.prototype.growTree=function(e){for(var t=e[e.length-1],n,r=0;r<t.length;r++)n=t[r],this.findPlaceforPrunedNode(n),n[2].add(n[0]),n[2].add(n[1],n[1].source,n[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},v.prototype.findPlaceforPrunedNode=function(e){var t,n,r=e[0];n=r==e[1].source?e[1].target:e[1].source;var i=n.startX,a=n.finishX,o=n.startY,s=n.finishY,c=[0,0,0,0];if(o>0)for(var u=i;u<=a;u++)c[0]+=this.grid[u][o-1].length+this.grid[u][o].length-1;if(a<this.grid.length-1)for(var u=o;u<=s;u++)c[1]+=this.grid[a+1][u].length+this.grid[a][u].length-1;if(s<this.grid[0].length-1)for(var u=i;u<=a;u++)c[2]+=this.grid[u][s+1].length+this.grid[u][s].length-1;if(i>0)for(var u=o;u<=s;u++)c[3]+=this.grid[i-1][u].length+this.grid[i][u].length-1;for(var d=m.MAX_VALUE,f,p,h=0;h<c.length;h++)c[h]<d?(d=c[h],f=1,p=h):c[h]==d&&f++;if(f==3&&d==0)c[0]==0&&c[1]==0&&c[2]==0?t=1:c[0]==0&&c[1]==0&&c[3]==0?t=0:c[0]==0&&c[2]==0&&c[3]==0?t=3:c[1]==0&&c[2]==0&&c[3]==0&&(t=2);else if(f==2&&d==0){var g=Math.floor(Math.random()*2);t=c[0]==0&&c[1]==0?g==0?0:1:c[0]==0&&c[2]==0?g==0?0:2:c[0]==0&&c[3]==0?g==0?0:3:c[1]==0&&c[2]==0?g==0?1:2:c[1]==0&&c[3]==0?g==0?1:3:g==0?2:3}else if(f==4&&d==0){var g=Math.floor(Math.random()*4);t=g}else t=p;t==0?r.setCenter(n.getCenterX(),n.getCenterY()-n.getHeight()/2-l.DEFAULT_EDGE_LENGTH-r.getHeight()/2):t==1?r.setCenter(n.getCenterX()+n.getWidth()/2+l.DEFAULT_EDGE_LENGTH+r.getWidth()/2,n.getCenterY()):t==2?r.setCenter(n.getCenterX(),n.getCenterY()+n.getHeight()/2+l.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(n.getCenterX()-n.getWidth()/2-l.DEFAULT_EDGE_LENGTH-r.getWidth()/2,n.getCenterY())},e.exports=v}),(function(e,t,n){var r={};r.layoutBase=n(0),r.CoSEConstants=n(1),r.CoSEEdge=n(2),r.CoSEGraph=n(3),r.CoSEGraphManager=n(4),r.CoSELayout=n(6),r.CoSENode=n(5),e.exports=r})])})})),lg=e(t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(cg()):typeof define==`function`&&define.amd?define([`cose-base`],r):typeof e==`object`?e.cytoscapeCoseBilkent=r(cg()):n.cytoscapeCoseBilkent=r(n.coseBase)})(e,function(e){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=1)})([(function(t,n){t.exports=e}),(function(e,t,n){var r=n(0).layoutBase.LayoutConstants,i=n(0).layoutBase.FDLayoutConstants,a=n(0).CoSEConstants,o=n(0).CoSELayout,s=n(0).CoSENode,c=n(0).layoutBase.PointD,l=n(0).layoutBase.DimensionD,u={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(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function f(e){this.options=d(u,e),p(this.options)}var p=function(e){e.nodeRepulsion!=null&&(a.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion),e.idealEdgeLength!=null&&(a.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=e.idealEdgeLength),e.edgeElasticity!=null&&(a.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=e.edgeElasticity),e.nestingFactor!=null&&(a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),e.gravity!=null&&(a.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=e.gravity),e.numIter!=null&&(a.MAX_ITERATIONS=i.MAX_ITERATIONS=e.numIter),e.gravityRange!=null&&(a.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),e.gravityCompound!=null&&(a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),e.gravityRangeCompound!=null&&(a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),e.initialEnergyOnIncremental!=null&&(a.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),e.quality==`draft`?r.QUALITY=0:e.quality==`proof`?r.QUALITY=2:r.QUALITY=1,a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!e.randomize,a.ANIMATE=i.ANIMATE=r.ANIMATE=e.animate,a.TILE=e.tile,a.TILING_PADDING_VERTICAL=typeof e.tilingPaddingVertical==`function`?e.tilingPaddingVertical.call():e.tilingPaddingVertical,a.TILING_PADDING_HORIZONTAL=typeof e.tilingPaddingHorizontal==`function`?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};f.prototype.run=function(){var e,t,n=this.options;this.idToLNode={};var r=this.layout=new o,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:`layoutstart`,layout:this});var a=r.newGraphManager();this.gm=a;var s=this.options.eles.nodes(),c=this.options.eles.edges();this.root=a.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(s),r);for(var l=0;l<c.length;l++){var u=c[l],d=this.idToLNode[u.data(`source`)],f=this.idToLNode[u.data(`target`)];if(d!==f&&d.getEdgesBetween(f).length==0){var p=a.add(r.newEdge(),d,f);p.id=u.id()}}var m=function(e,t){typeof e==`number`&&(e=t);var n=e.data(`id`),r=i.idToLNode[n];return{x:r.getRect().getCenterX(),y:r.getRect().getCenterY()}},h=function a(){for(var o=function(){n.fit&&n.cy.fit(n.eles,n.padding),e||(e=!0,i.cy.one(`layoutready`,n.ready),i.cy.trigger({type:`layoutready`,layout:i}))},s=i.options.refresh,c,l=0;l<s&&!c;l++)c=i.stopped||i.layout.tick();if(c){r.checkLayoutSuccess()&&!r.isSubLayout&&r.doPostLayout(),r.tilingPostLayout&&r.tilingPostLayout(),r.isLayoutFinished=!0,i.options.eles.nodes().positions(m),o(),i.cy.one(`layoutstop`,i.options.stop),i.cy.trigger({type:`layoutstop`,layout:i}),t&&cancelAnimationFrame(t),e=!1;return}var u=i.layout.getPositionsData();n.eles.nodes().positions(function(e,t){if(typeof e==`number`&&(e=t),!e.isParent()){for(var n=e.id(),r=u[n],i=e;r==null&&(r=u[i.data(`parent`)]||u[`DummyCompound_`+i.data(`parent`)],u[n]=r,i=i.parent()[0],i!=null););return r==null?{x:e.position(`x`),y:e.position(`y`)}:{x:r.x,y:r.y}}}),o(),t=requestAnimationFrame(a)};return r.addListener(`layoutstarted`,function(){i.options.animate===`during`&&(t=requestAnimationFrame(h))}),r.runLayout(),this.options.animate!==`during`&&(i.options.eles.nodes().not(`:parent`).layoutPositions(i,i.options,m),e=!1),this},f.prototype.getTopMostNodes=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;return e.filter(function(e,n){typeof e==`number`&&(e=n);for(var r=e.parent()[0];r!=null;){if(t[r.id()])return!1;r=r.parent()[0]}return!0})},f.prototype.processChildrenList=function(e,t,n){for(var r=t.length,i=0;i<r;i++){var a=t[i],o=a.children(),u,d=a.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(u=a.outerWidth()!=null&&a.outerHeight()!=null?e.add(new s(n.graphManager,new c(a.position(`x`)-d.w/2,a.position(`y`)-d.h/2),new l(parseFloat(d.w),parseFloat(d.h)))):e.add(new s(this.graphManager)),u.id=a.data(`id`),u.paddingLeft=parseInt(a.css(`padding`)),u.paddingTop=parseInt(a.css(`padding`)),u.paddingRight=parseInt(a.css(`padding`)),u.paddingBottom=parseInt(a.css(`padding`)),this.options.nodeDimensionsIncludeLabels&&a.isParent()){var f=a.boundingBox({includeLabels:!0,includeNodes:!1}).w,p=a.boundingBox({includeLabels:!0,includeNodes:!1}).h,m=a.css(`text-halign`);u.labelWidth=f,u.labelHeight=p,u.labelPos=m}if(this.idToLNode[a.data(`id`)]=u,isNaN(u.rect.x)&&(u.rect.x=0),isNaN(u.rect.y)&&(u.rect.y=0),o!=null&&o.length>0){var h=n.getGraphManager().add(n.newGraph(),u);this.processChildrenList(h,o,n)}}},f.prototype.stop=function(){return this.stopped=!0,this};var m=function(e){e(`layout`,`cose-bilkent`,f)};typeof cytoscape<`u`&&m(cytoscape),e.exports=m})])})}))(),1);e(p(),1),n();var ug=function(){var e=function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},t=[1,4],n=[1,13],r=[1,12],i=[1,15],a=[1,16],o=[1,20],s=[1,19],c=[6,7,8],l=[1,26],u=[1,24],d=[1,25],f=[6,7,11],p=[1,6,13,15,16,19,22],m=[1,33],h=[1,34],g=[1,6,7,11,13,15,16,19,22],_={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`MINDMAP`,11:`EOF`,13:`SPACELIST`,15:`ICON`,16:`CLASS`,19:`NODE_DSTART`,20:`NODE_DESCR`,21:`NODE_DEND`,22:`NODE_ID`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace(`Stop NL `);break;case 9:r.getLogger().trace(`Stop EOF `);break;case 11:r.getLogger().trace(`Stop NL2 `);break;case 12:r.getLogger().trace(`Stop EOF2 `);break;case 15:r.getLogger().info(`Node: `,a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 16:r.getLogger().trace(`Icon: `,a[s]),r.decorateNode({icon:a[s]});break;case 17:case 21:r.decorateNode({class:a[s]});break;case 18:r.getLogger().trace(`SPACELIST`);break;case 19:r.getLogger().trace(`Node: `,a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 20:r.decorateNode({icon:a[s]});break;case 25:r.getLogger().trace(`node found ..`,a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 26:this.$={id:a[s],descr:a[s],type:r.nodeType.DEFAULT};break;case 27:r.getLogger().trace(`node found ..`,a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:n,7:[1,10],9:9,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(c,[2,3]),{1:[2,2]},e(c,[2,4]),e(c,[2,5]),{1:[2,6],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:n,9:22,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:l,7:u,10:23,11:d},e(f,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(f,[2,18]),e(f,[2,19]),e(f,[2,20]),e(f,[2,21]),e(f,[2,23]),e(f,[2,24]),e(f,[2,26],{19:[1,30]}),{20:[1,31]},{6:l,7:u,10:32,11:d},{1:[2,7],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(p,[2,14],{7:m,11:h}),e(g,[2,8]),e(g,[2,9]),e(g,[2,10]),e(f,[2,15]),e(f,[2,16]),e(f,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:m,11:h}),e(g,[2,11]),e(g,[2,12]),{21:[1,37]},e(f,[2,25]),e(f,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},parse:function(e){var t=this,n=[0],r=[],i=[null],a=[],o=this.table,s=``,c=0,l=0,u=2,d=1,f=a.slice.call(arguments,1),p=Object.create(this.lexer),m={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(m.yy[h]=this.yy[h]);p.setInput(e,m.yy),m.yy.lexer=p,m.yy.parser=this,p.yylloc===void 0&&(p.yylloc={});var g=p.yylloc;a.push(g);var _=p.options&&p.options.ranges;typeof m.yy.parseError==`function`?this.parseError=m.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function v(){var e=r.pop()||p.lex()||d;return typeof e!=`number`&&(e instanceof Array&&(r=e,e=r.pop()),e=t.symbols_[e]||e),e}for(var y,b,x,S,C={},w,T,E,D;;){if(b=n[n.length-1],this.defaultActions[b]?x=this.defaultActions[b]:(y??=v(),x=o[b]&&o[b][y]),x===void 0||!x.length||!x[0]){var O=``;for(w in D=[],o[b])this.terminals_[w]&&w>u&&D.push(`'`+this.terminals_[w]+`'`);O=p.showPosition?`Parse error on line `+(c+1)+`:
|
|
322
|
+
`+p.showPosition()+`
|
|
323
|
+
Expecting `+D.join(`, `)+`, got '`+(this.terminals_[y]||y)+`'`:`Parse error on line `+(c+1)+`: Unexpected `+(y==d?`end of input`:`'`+(this.terminals_[y]||y)+`'`),this.parseError(O,{text:p.match,token:this.terminals_[y]||y,line:p.yylineno,loc:g,expected:D})}if(x[0]instanceof Array&&x.length>1)throw Error(`Parse Error: multiple actions possible at state: `+b+`, token: `+y);switch(x[0]){case 1:n.push(y),i.push(p.yytext),a.push(p.yylloc),n.push(x[1]),y=null,l=p.yyleng,s=p.yytext,c=p.yylineno,g=p.yylloc;break;case 2:if(T=this.productions_[x[1]][1],C.$=i[i.length-T],C._$={first_line:a[a.length-(T||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(T||1)].first_column,last_column:a[a.length-1].last_column},_&&(C._$.range=[a[a.length-(T||1)].range[0],a[a.length-1].range[1]]),S=this.performAction.apply(C,[s,l,c,m.yy,x[1],i,a].concat(f)),S!==void 0)return S;T&&(n=n.slice(0,-1*T*2),i=i.slice(0,-1*T),a=a.slice(0,-1*T)),n.push(this.productions_[x[1]][0]),i.push(C.$),a.push(C._$),E=o[n[n.length-2]][n[n.length-1]],n.push(E);break;case 3:return!0}}return!0}};_.lexer=function(){return{EOF:1,parseError:function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
324
|
+
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},showPosition:function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
325
|
+
`+t+`^`},test_match:function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}else return!1}else if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e===!1?!1:e):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
|
|
326
|
+
`+this.showPosition(),{text:``,token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,n,r){switch(n){case 0:return e.getLogger().trace(`Found comment`,t.yytext),6;case 1:return 8;case 2:this.begin(`CLASS`);break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:e.getLogger().trace(`Begin icon`),this.begin(`ICON`);break;case 6:return e.getLogger().trace(`SPACELINE`),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace(`end icon`),this.popState();break;case 10:return e.getLogger().trace(`Exploding node`),this.begin(`NODE`),19;case 11:return e.getLogger().trace(`Cloud`),this.begin(`NODE`),19;case 12:return e.getLogger().trace(`Explosion Bang`),this.begin(`NODE`),19;case 13:return e.getLogger().trace(`Cloud Bang`),this.begin(`NODE`),19;case 14:return this.begin(`NODE`),19;case 15:return this.begin(`NODE`),19;case 16:return this.begin(`NODE`),19;case 17:return this.begin(`NODE`),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin(`NSTR2`);break;case 22:return`NODE_DESCR`;case 23:this.popState();break;case 24:e.getLogger().trace(`Starting NSTR`),this.begin(`NSTR`);break;case 25:return e.getLogger().trace(`description:`,t.yytext),`NODE_DESCR`;case 26:this.popState();break;case 27:return this.popState(),e.getLogger().trace(`node end ))`),`NODE_DEND`;case 28:return this.popState(),e.getLogger().trace(`node end )`),`NODE_DEND`;case 29:return this.popState(),e.getLogger().trace(`node end ...`,t.yytext),`NODE_DEND`;case 30:return this.popState(),e.getLogger().trace(`node end ((`),`NODE_DEND`;case 31:return this.popState(),e.getLogger().trace(`node end (-`),`NODE_DEND`;case 32:return this.popState(),e.getLogger().trace(`node end (-`),`NODE_DEND`;case 33:return this.popState(),e.getLogger().trace(`node end ((`),`NODE_DEND`;case 34:return this.popState(),e.getLogger().trace(`node end ((`),`NODE_DEND`;case 35:return e.getLogger().trace(`Long description:`,t.yytext),20;case 36:return e.getLogger().trace(`Long description:`,t.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}}}();function v(){this.yy={}}return v.prototype=_,_.Parser=v,new v}();ug.parser=ug;var dg=ug,fg=[],pg=0,mg={},hg=()=>{fg=[],pg=0,mg={}},gg=function(e){for(let t=fg.length-1;t>=0;t--)if(fg[t].level<e)return fg[t];return null},_g=()=>fg.length>0?fg[0]:null,vg=(e,t,n,r)=>{l.info(`addNode`,e,t,n,r);let i=u(),a=i.mindmap?.padding??f.mindmap.padding;switch(r){case yg.ROUNDED_RECT:case yg.RECT:case yg.HEXAGON:a*=2}let o={id:pg++,nodeId:m(t,i),level:e,descr:m(n,i),type:r,children:[],width:i.mindmap?.maxNodeWidth??f.mindmap.maxNodeWidth,padding:a},s=gg(e);if(s)s.children.push(o),fg.push(o);else if(fg.length===0)fg.push(o);else throw Error(`There can be only one root. No parent could be found for ("`+o.descr+`")`)},yg={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},bg={clear:hg,addNode:vg,getMindmap:_g,nodeType:yg,getType:(e,t)=>{switch(l.debug(`In get type`,e,t),e){case`[`:return yg.RECT;case`(`:return t===`)`?yg.ROUNDED_RECT:yg.CLOUD;case`((`:return yg.CIRCLE;case`)`:return yg.CLOUD;case`))`:return yg.BANG;case`{{`:return yg.HEXAGON;default:return yg.DEFAULT}},setElementForId:(e,t)=>{mg[e]=t},decorateNode:e=>{if(!e)return;let t=u(),n=fg[fg.length-1];e.icon&&(n.icon=m(e.icon,t)),e.class&&(n.class=m(e.class,t))},type2Str:e=>{switch(e){case yg.DEFAULT:return`no-border`;case yg.RECT:return`rect`;case yg.ROUNDED_RECT:return`rounded-rect`;case yg.CIRCLE:return`circle`;case yg.CLOUD:return`cloud`;case yg.BANG:return`bang`;case yg.HEXAGON:return`hexgon`;default:return`no-border`}},getLogger:()=>l,getElementById:e=>mg[e]},xg=12,Sg=function(e,t,n,r){t.append(`path`).attr(`id`,`node-`+n.id).attr(`class`,`node-bkg node-`+e.type2Str(n.type)).attr(`d`,`M0 ${n.height-5} v${-n.height+10} q0,-5 5,-5 h${n.width-10} q5,0 5,5 v${n.height-5} H0 Z`),t.append(`line`).attr(`class`,`node-line-`+r).attr(`x1`,0).attr(`y1`,n.height).attr(`x2`,n.width).attr(`y2`,n.height)},Cg=function(e,t,n){t.append(`rect`).attr(`id`,`node-`+n.id).attr(`class`,`node-bkg node-`+e.type2Str(n.type)).attr(`height`,n.height).attr(`width`,n.width)},wg=function(e,t,n){let r=n.width,i=n.height,a=.15*r,o=.25*r,s=.35*r,c=.2*r;t.append(`path`).attr(`id`,`node-`+n.id).attr(`class`,`node-bkg node-`+e.type2Str(n.type)).attr(`d`,`M0 0 a${a},${a} 0 0,1 ${r*.25},${-1*r*.1}
|
|
327
|
+
a${s},${s} 1 0,1 ${r*.4},${-1*r*.1}
|
|
328
|
+
a${o},${o} 1 0,1 ${r*.35},${1*r*.2}
|
|
329
|
+
|
|
330
|
+
a${a},${a} 1 0,1 ${r*.15},${1*i*.35}
|
|
331
|
+
a${c},${c} 1 0,1 ${-1*r*.15},${1*i*.65}
|
|
332
|
+
|
|
333
|
+
a${o},${a} 1 0,1 ${-1*r*.25},${r*.15}
|
|
334
|
+
a${s},${s} 1 0,1 ${-1*r*.5},0
|
|
335
|
+
a${a},${a} 1 0,1 ${-1*r*.25},${-1*r*.15}
|
|
336
|
+
|
|
337
|
+
a${a},${a} 1 0,1 ${-1*r*.1},${-1*i*.35}
|
|
338
|
+
a${c},${c} 1 0,1 ${r*.1},${-1*i*.65}
|
|
339
|
+
|
|
340
|
+
H0 V0 Z`)},Tg=function(e,t,n){let r=n.width,i=n.height,a=.15*r;t.append(`path`).attr(`id`,`node-`+n.id).attr(`class`,`node-bkg node-`+e.type2Str(n.type)).attr(`d`,`M0 0 a${a},${a} 1 0,0 ${r*.25},${-1*i*.1}
|
|
341
|
+
a${a},${a} 1 0,0 ${r*.25},0
|
|
342
|
+
a${a},${a} 1 0,0 ${r*.25},0
|
|
343
|
+
a${a},${a} 1 0,0 ${r*.25},${1*i*.1}
|
|
344
|
+
|
|
345
|
+
a${a},${a} 1 0,0 ${r*.15},${1*i*.33}
|
|
346
|
+
a${a*.8},${a*.8} 1 0,0 0,${1*i*.34}
|
|
347
|
+
a${a},${a} 1 0,0 ${-1*r*.15},${1*i*.33}
|
|
348
|
+
|
|
349
|
+
a${a},${a} 1 0,0 ${-1*r*.25},${i*.15}
|
|
350
|
+
a${a},${a} 1 0,0 ${-1*r*.25},0
|
|
351
|
+
a${a},${a} 1 0,0 ${-1*r*.25},0
|
|
352
|
+
a${a},${a} 1 0,0 ${-1*r*.25},${-1*i*.15}
|
|
353
|
+
|
|
354
|
+
a${a},${a} 1 0,0 ${-1*r*.1},${-1*i*.33}
|
|
355
|
+
a${a*.8},${a*.8} 1 0,0 0,${-1*i*.34}
|
|
356
|
+
a${a},${a} 1 0,0 ${r*.1},${-1*i*.33}
|
|
357
|
+
|
|
358
|
+
H0 V0 Z`)},Eg=function(e,t,n){t.append(`circle`).attr(`id`,`node-`+n.id).attr(`class`,`node-bkg node-`+e.type2Str(n.type)).attr(`r`,n.width/2)};function Dg(e,t,n,r,i){return e.insert(`polygon`,`:first-child`).attr(`points`,r.map(function(e){return e.x+`,`+e.y}).join(` `)).attr(`transform`,`translate(`+(i.width-t)/2+`, `+n+`)`)}var Og=function(e,t,n){let r=n.height,i=r/4,a=n.width-n.padding+2*i;Dg(t,a,r,[{x:i,y:0},{x:a-i,y:0},{x:a,y:-r/2},{x:a-i,y:-r},{x:i,y:-r},{x:0,y:-r/2}],n)},kg=function(e,t,n){t.append(`rect`).attr(`id`,`node-`+n.id).attr(`class`,`node-bkg node-`+e.type2Str(n.type)).attr(`height`,n.height).attr(`rx`,n.padding).attr(`ry`,n.padding).attr(`width`,n.width)},Ag=function(e,t,n,i,a){let o=a.htmlLabels,s=i%(xg-1),c=t.append(`g`);n.section=s;let l=`section-`+s;s<0&&(l+=` section-root`),c.attr(`class`,(n.class?n.class+` `:``)+`mindmap-node `+l);let u=c.append(`g`),d=c.append(`g`);h(d,n.descr.replace(/(<br\/*>)/g,`
|
|
359
|
+
`),{useHtmlLabels:o,width:n.width,classes:`mindmap-node-label`}),o||d.attr(`dy`,`1em`).attr(`alignment-baseline`,`middle`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`);let f=d.node().getBBox(),[p]=r(a.fontSize);if(n.height=f.height+p*1.1*.5+n.padding,n.width=f.width+2*n.padding,n.icon)if(n.type===e.nodeType.CIRCLE)n.height+=50,n.width+=50,c.append(`foreignObject`).attr(`height`,`50px`).attr(`width`,n.width).attr(`style`,`text-align: center;`).append(`div`).attr(`class`,`icon-container`).append(`i`).attr(`class`,`node-icon-`+s+` `+n.icon),d.attr(`transform`,`translate(`+n.width/2+`, `+(n.height/2-1.5*n.padding)+`)`);else{n.width+=50;let e=n.height;n.height=Math.max(e,60);let t=Math.abs(n.height-e);c.append(`foreignObject`).attr(`width`,`60px`).attr(`height`,n.height).attr(`style`,`text-align: center;margin-top:`+t/2+`px;`).append(`div`).attr(`class`,`icon-container`).append(`i`).attr(`class`,`node-icon-`+s+` `+n.icon),d.attr(`transform`,`translate(`+(25+n.width/2)+`, `+(t/2+n.padding/2)+`)`)}else if(o){let e=(n.width-f.width)/2,t=(n.height-f.height)/2;d.attr(`transform`,`translate(`+e+`, `+t+`)`)}else{let e=n.width/2,t=n.padding/2;d.attr(`transform`,`translate(`+e+`, `+t+`)`)}switch(n.type){case e.nodeType.DEFAULT:Sg(e,u,n,s);break;case e.nodeType.ROUNDED_RECT:kg(e,u,n);break;case e.nodeType.RECT:Cg(e,u,n);break;case e.nodeType.CIRCLE:u.attr(`transform`,`translate(`+n.width/2+`, `+n.height/2+`)`),Eg(e,u,n);break;case e.nodeType.CLOUD:wg(e,u,n);break;case e.nodeType.BANG:Tg(e,u,n);break;case e.nodeType.HEXAGON:Og(e,u,n);break}return e.setElementForId(n.id,c),n.height},jg=function(e,t){let n=e.getElementById(t.id),r=t.x||0,i=t.y||0;n.attr(`transform`,`translate(`+r+`,`+i+`)`)};og.use(lg.default);function Mg(e,t,n,r,i){Ag(e,t,n,r,i),n.children&&n.children.forEach((n,a)=>{Mg(e,t,n,r<0?a:r,i)})}function Ng(e,t){t.edges().map((t,n)=>{let r=t.data();if(t[0]._private.bodyBounds){let i=t[0]._private.rscratch;l.trace(`Edge: `,n,r),e.insert(`path`).attr(`d`,`M ${i.startX},${i.startY} L ${i.midX},${i.midY} L${i.endX},${i.endY} `).attr(`class`,`edge section-edge-`+r.section+` edge-depth-`+r.depth)}})}function Pg(e,t,n,r){t.add({group:`nodes`,data:{id:e.id.toString(),labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach(i=>{Pg(i,t,n,r+1),t.add({group:`edges`,data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:r,section:i.section}})})}function Fg(e,t){return new Promise(n=>{let r=d(`body`).append(`div`).attr(`id`,`cy`).attr(`style`,`display:none`),i=og({container:document.getElementById(`cy`),style:[{selector:`edge`,style:{"curve-style":`bezier`}}]});r.remove(),Pg(e,i,t,0),i.nodes().forEach(function(e){e.layoutDimensions=()=>{let t=e.data();return{w:t.width,h:t.height}}}),i.layout({name:`cose-bilkent`,quality:`proof`,styleEnabled:!1,animate:!1}).run(),i.ready(e=>{l.info(`Ready`,e),n(i)})})}function Ig(e,t){t.nodes().map((t,n)=>{let r=t.data();r.x=t.position().x,r.y=t.position().y,jg(e,r);let i=e.getElementById(r.nodeId);l.info(`Id:`,n,`Position: (`,t.position().x,`, `,t.position().y,`)`,r),i.attr(`transform`,`translate(${t.position().x-r.width/2}, ${t.position().y-r.height/2})`),i.attr(`attr`,`apa-${n})`)})}var Lg={draw:async(e,t,n,r)=>{l.debug(`Rendering mindmap diagram
|
|
360
|
+
`+e);let a=r.db,o=a.getMindmap();if(!o)return;let s=u();s.htmlLabels=!1;let d=i(t),p=d.append(`g`);p.attr(`class`,`mindmap-edges`);let m=d.append(`g`);m.attr(`class`,`mindmap-nodes`),Mg(a,m,o,-1,s);let h=await Fg(o,s);Ng(p,h),Ig(a,h),c(void 0,d,s.mindmap?.padding??f.mindmap.padding,s.mindmap?.useMaxWidth??f.mindmap.useMaxWidth)}},Rg=e=>{let t=``;for(let t=0;t<e.THEME_COLOR_LIMIT;t++)e[`lineColor`+t]=e[`lineColor`+t]||e[`cScaleInv`+t],s(e[`lineColor`+t])?e[`lineColor`+t]=o(e[`lineColor`+t],20):e[`lineColor`+t]=a(e[`lineColor`+t],20);for(let n=0;n<e.THEME_COLOR_LIMIT;n++){let r=``+(17-3*n);t+=`
|
|
361
|
+
.section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} polygon, .section-${n-1} path {
|
|
362
|
+
fill: ${e[`cScale`+n]};
|
|
363
|
+
}
|
|
364
|
+
.section-${n-1} text {
|
|
365
|
+
fill: ${e[`cScaleLabel`+n]};
|
|
366
|
+
}
|
|
367
|
+
.node-icon-${n-1} {
|
|
368
|
+
font-size: 40px;
|
|
369
|
+
color: ${e[`cScaleLabel`+n]};
|
|
370
|
+
}
|
|
371
|
+
.section-edge-${n-1}{
|
|
372
|
+
stroke: ${e[`cScale`+n]};
|
|
373
|
+
}
|
|
374
|
+
.edge-depth-${n-1}{
|
|
375
|
+
stroke-width: ${r};
|
|
376
|
+
}
|
|
377
|
+
.section-${n-1} line {
|
|
378
|
+
stroke: ${e[`cScaleInv`+n]} ;
|
|
379
|
+
stroke-width: 3;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.disabled, .disabled circle, .disabled text {
|
|
383
|
+
fill: lightgray;
|
|
384
|
+
}
|
|
385
|
+
.disabled text {
|
|
386
|
+
fill: #efefef;
|
|
387
|
+
}
|
|
388
|
+
`}return t},zg={db:bg,renderer:Lg,parser:dg,styles:e=>`
|
|
389
|
+
.edge {
|
|
390
|
+
stroke-width: 3;
|
|
391
|
+
}
|
|
392
|
+
${Rg(e)}
|
|
393
|
+
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
|
|
394
|
+
fill: ${e.git0};
|
|
395
|
+
}
|
|
396
|
+
.section-root text {
|
|
397
|
+
fill: ${e.gitBranchLabel0};
|
|
398
|
+
}
|
|
399
|
+
.icon-container {
|
|
400
|
+
height:100%;
|
|
401
|
+
display: flex;
|
|
402
|
+
justify-content: center;
|
|
403
|
+
align-items: center;
|
|
404
|
+
}
|
|
405
|
+
.edge {
|
|
406
|
+
fill: none;
|
|
407
|
+
}
|
|
408
|
+
.mindmap-node-label {
|
|
409
|
+
dy: 1em;
|
|
410
|
+
alignment-baseline: middle;
|
|
411
|
+
text-anchor: middle;
|
|
412
|
+
dominant-baseline: middle;
|
|
413
|
+
text-align: center;
|
|
414
|
+
}
|
|
415
|
+
`};export{zg as diagram};
|