excalidrop 0.2.3 → 0.2.5
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 +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +108 -12
- package/dist/cli.js.map +1 -1
- package/dist/frontend/assets/{advancedFormat-Be4KR5mp.js → advancedFormat-Dp_c57XA.js} +1 -1
- package/dist/frontend/assets/{ar-SA-G6X2FPQ2-B6ekz3Ba.js → ar-SA-G6X2FPQ2-BwXW1ybG.js} +1 -1
- package/dist/frontend/assets/{arc-DlgXyGPj.js → arc-7RkGOdiy.js} +1 -1
- package/dist/frontend/assets/{az-AZ-76LH7QW2-01MDUsF0.js → az-AZ-76LH7QW2-SBQsCqHj.js} +1 -1
- package/dist/frontend/assets/{bg-BG-XCXSNQG7--fArB8Ao.js → bg-BG-XCXSNQG7-zs8De6l9.js} +1 -1
- package/dist/frontend/assets/{blockDiagram-38ab4fdb-CmsVhOwi.js → blockDiagram-38ab4fdb-CT2zD06W.js} +1 -1
- package/dist/frontend/assets/{blockDiagram-68f4deed-DU_wNYlO.js → blockDiagram-68f4deed-3lmIK2Bk.js} +1 -1
- package/dist/frontend/assets/{bn-BD-2XOGV67Q-h8juqzfQ.js → bn-BD-2XOGV67Q-B-2OCP4N.js} +1 -1
- package/dist/frontend/assets/{c4Diagram-15b5d702-ClZalz0L.js → c4Diagram-15b5d702-CSPRIaDT.js} +1 -1
- package/dist/frontend/assets/{c4Diagram-3d4e48cf-BkFVM0tP.js → c4Diagram-3d4e48cf-CQt6opHb.js} +1 -1
- package/dist/frontend/assets/{ca-ES-6MX7JW3Y-DMBR3qVX.js → ca-ES-6MX7JW3Y-iIxk-Gll.js} +1 -1
- package/dist/frontend/assets/channel-OH_PITOx.js +1 -0
- package/dist/frontend/assets/{classDiagram-70f12bd4-BXAJnakg.js → classDiagram-70f12bd4-OMDSDr1i.js} +1 -1
- package/dist/frontend/assets/{classDiagram-d40c83e7-DVhipa45.js → classDiagram-d40c83e7-BpAtbr8O.js} +1 -1
- package/dist/frontend/assets/{classDiagram-v2-d5a6b087-CiHMsbhj.js → classDiagram-v2-d5a6b087-QtlOqN0e.js} +1 -1
- package/dist/frontend/assets/{classDiagram-v2-f2320105-1CqIxWOB.js → classDiagram-v2-f2320105-VllXFdze.js} +1 -1
- package/dist/frontend/assets/clone-_Vll1BLd.js +1 -0
- package/dist/frontend/assets/{createText-2e5e7dd3-D3kSz3YE.js → createText-2e5e7dd3-6ttRBJsO.js} +1 -1
- package/dist/frontend/assets/{createText-d213de94-DvJeLlQX.js → createText-d213de94-JzWc24xd.js} +1 -1
- package/dist/frontend/assets/{cs-CZ-2BRQDIVT-BUcdPrAr.js → cs-CZ-2BRQDIVT-fPVgqU2L.js} +1 -1
- package/dist/frontend/assets/{cytoscape-cose-bilkent-CKoSm_2z.js → cytoscape-cose-bilkent-CJzXFGta.js} +1 -1
- package/dist/frontend/assets/{da-DK-5WZEPLOC-C1nkchuC.js → da-DK-5WZEPLOC-psRkCDVX.js} +1 -1
- package/dist/frontend/assets/{de-DE-XR44H4JA-DO2_bO1X.js → de-DE-XR44H4JA-CgZZPE5b.js} +1 -1
- package/dist/frontend/assets/{edges-332bd1c7-C5qM1sDU.js → edges-332bd1c7-EpC_kh1k.js} +1 -1
- package/dist/frontend/assets/{edges-e0da2a9e-BRt7qomS.js → edges-e0da2a9e-CCMBX5lb.js} +1 -1
- package/dist/frontend/assets/{el-GR-BZB4AONW-CrjSdaU2.js → el-GR-BZB4AONW-CQPL7bJ4.js} +1 -1
- package/dist/frontend/assets/{elk.bundled-Dmec6Rq6.js → elk.bundled-ogAb6LF2.js} +1 -1
- package/dist/frontend/assets/{erDiagram-880f2ed8-BI7kP523.js → erDiagram-880f2ed8-BWgQHv-I.js} +1 -1
- package/dist/frontend/assets/{erDiagram-9861fffd-DMyCDrgI.js → erDiagram-9861fffd-Dd32vKja.js} +1 -1
- package/dist/frontend/assets/{es-ES-U4NZUMDT-rrdjPi-M.js → es-ES-U4NZUMDT-CuR7trRZ.js} +1 -1
- package/dist/frontend/assets/{eu-ES-A7QVB2H4-uYn3S3D5.js → eu-ES-A7QVB2H4-BSZygKKM.js} +1 -1
- package/dist/frontend/assets/{fa-IR-HGAKTJCU-DWW_BVFR.js → fa-IR-HGAKTJCU-bwGz1mOB.js} +1 -1
- package/dist/frontend/assets/{fi-FI-Z5N7JZ37-CMXxeZ4W.js → fi-FI-Z5N7JZ37-BsUySUul.js} +1 -1
- package/dist/frontend/assets/{flowDb-7c981674-Dsj6xMzr.js → flowDb-7c981674-kRbag2pE.js} +1 -1
- package/dist/frontend/assets/{flowDb-956e92f1-26g7kJju.js → flowDb-956e92f1-vn4uI2TH.js} +1 -1
- package/dist/frontend/assets/{flowDiagram-66a62f08-C9eQZtdf.js → flowDiagram-66a62f08-BpPndqtT.js} +1 -1
- package/dist/frontend/assets/{flowDiagram-cbd28bf7-D051xFrI.js → flowDiagram-cbd28bf7-cO9OTq48.js} +1 -1
- package/dist/frontend/assets/flowDiagram-v2-96b9c2cf-DXcy5hm8.js +1 -0
- package/dist/frontend/assets/flowDiagram-v2-ffc7f31a-sMPpVd7I.js +1 -0
- package/dist/frontend/assets/{flowchart-elk-definition-36e2d292-C9fsvhV-.js → flowchart-elk-definition-36e2d292-B-ZSGAIw.js} +1 -1
- package/dist/frontend/assets/{flowchart-elk-definition-4a651766-BkVNuJOw.js → flowchart-elk-definition-4a651766-lAyMp_aq.js} +1 -1
- package/dist/frontend/assets/{fr-FR-RHASNOE6-DIfK_rjW.js → fr-FR-RHASNOE6-DcoW-O38.js} +1 -1
- package/dist/frontend/assets/{ganttDiagram-04f9e578-CZeF2a4Y.js → ganttDiagram-04f9e578-DOyjnzV9.js} +1 -1
- package/dist/frontend/assets/{ganttDiagram-c361ad54-DbkIZ-wU.js → ganttDiagram-c361ad54-CeJI8GjD.js} +1 -1
- package/dist/frontend/assets/{gitGraphDiagram-21fc4d3e-CLqlSEuE.js → gitGraphDiagram-21fc4d3e-C6s48pfn.js} +1 -1
- package/dist/frontend/assets/{gitGraphDiagram-72cf32ee-Cvf9uYWB.js → gitGraphDiagram-72cf32ee-BHEfLGfv.js} +1 -1
- package/dist/frontend/assets/{gl-ES-HMX3MZ6V-CCxCH2oK.js → gl-ES-HMX3MZ6V-CObSl3rz.js} +1 -1
- package/dist/frontend/assets/{graph-MptL1QoF.js → graph-C7nn5gAF.js} +1 -1
- package/dist/frontend/assets/{graph-Mzuu2QFH.js → graph-CNR0SPWy.js} +1 -1
- package/dist/frontend/assets/{he-IL-6SHJWFNN-CJuJutJZ.js → he-IL-6SHJWFNN-C7qpDwUh.js} +1 -1
- package/dist/frontend/assets/{hi-IN-IWLTKZ5I-BORPH6vU.js → hi-IN-IWLTKZ5I-z09Zjp66.js} +1 -1
- package/dist/frontend/assets/{hu-HU-A5ZG7DT2-Dr7UDbjo.js → hu-HU-A5ZG7DT2-wMK1oaa5.js} +1 -1
- package/dist/frontend/assets/{id-ID-SAP4L64H-D0Widkq7.js → id-ID-SAP4L64H-BNUbgjon.js} +1 -1
- package/dist/frontend/assets/{index-3862675e-DVT5-vN2.js → index-3862675e-dnXOYH4z.js} +1 -1
- package/dist/frontend/assets/{index-6079d271-R4KRnW5Z.js → index-6079d271-DgLNzcYg.js} +1 -1
- package/dist/frontend/assets/{index-Bd-8869C.js → index-BhUVktMi.js} +21 -21
- package/dist/frontend/assets/{index-B45XzZiR.js → index-CoLRMCf6.js} +4 -4
- package/dist/frontend/assets/{infoDiagram-4a4f5b27-BvY1qS17.js → infoDiagram-4a4f5b27-DQlI_3va.js} +1 -1
- package/dist/frontend/assets/{infoDiagram-f8f76790-D60YvG33.js → infoDiagram-f8f76790-CTPoVPxd.js} +1 -1
- package/dist/frontend/assets/{it-IT-JPQ66NNP-C08Vu0BG.js → it-IT-JPQ66NNP-Cf_kx0kE.js} +1 -1
- package/dist/frontend/assets/{ja-JP-DBVTYXUO-Ciu7LaRi.js → ja-JP-DBVTYXUO-E7b_wcDI.js} +1 -1
- package/dist/frontend/assets/{journeyDiagram-29694f62-DvrnJXsd.js → journeyDiagram-29694f62-DM3f4JHE.js} +1 -1
- package/dist/frontend/assets/{journeyDiagram-49397b02-Dy9LU86E.js → journeyDiagram-49397b02-BIhjmC_O.js} +1 -1
- package/dist/frontend/assets/{kaa-6HZHGXH3-GhGTIjpu.js → kaa-6HZHGXH3-CNvSXcXO.js} +1 -1
- package/dist/frontend/assets/{kab-KAB-ZGHBKWFO-B3q4BqYw.js → kab-KAB-ZGHBKWFO-Bv5kgmQ2.js} +1 -1
- package/dist/frontend/assets/{kk-KZ-P5N5QNE5-GWoLZvco.js → kk-KZ-P5N5QNE5-CXs57_4f.js} +1 -1
- package/dist/frontend/assets/{km-KH-HSX4SM5Z-CnAQJCYr.js → km-KH-HSX4SM5Z-CfM7hwRA.js} +1 -1
- package/dist/frontend/assets/{ko-KR-MTYHY66A-B2Rh9krp.js → ko-KR-MTYHY66A-CBFmSfw-.js} +1 -1
- package/dist/frontend/assets/{ku-TR-6OUDTVRD-C27elmON.js → ku-TR-6OUDTVRD-DvkSYchG.js} +1 -1
- package/dist/frontend/assets/{layout-c-hOA8zE.js → layout-BvE2dc7G.js} +1 -1
- package/dist/frontend/assets/{layout-D1hl6oKi.js → layout-D14yXSeC.js} +1 -1
- package/dist/frontend/assets/{line-DtMz1ssZ.js → line-1qBZAQC3.js} +1 -1
- package/dist/frontend/assets/{linear-D-Y4WtO_.js → linear-Dt3eUX_V.js} +1 -1
- package/dist/frontend/assets/{lt-LT-XHIRWOB4-B6jd693w.js → lt-LT-XHIRWOB4-J-msrcDU.js} +1 -1
- package/dist/frontend/assets/{lv-LV-5QDEKY6T-sXB-8i6R.js → lv-LV-5QDEKY6T-DaN4C10F.js} +1 -1
- package/dist/frontend/assets/{mindmap-definition-ac74a2e8-CawO9I_f.js → mindmap-definition-ac74a2e8-BR4LukmQ.js} +1 -1
- package/dist/frontend/assets/{mindmap-definition-fc14e90a-CXMNA68v.js → mindmap-definition-fc14e90a-CWvTViHo.js} +1 -1
- package/dist/frontend/assets/{mr-IN-CRQNXWMA-BJ6QSiPi.js → mr-IN-CRQNXWMA-ktApWOTi.js} +1 -1
- package/dist/frontend/assets/{my-MM-5M5IBNSE-BMdOIRP5.js → my-MM-5M5IBNSE-V9rgPdlF.js} +1 -1
- package/dist/frontend/assets/{nb-NO-T6EIAALU-BVG6JUMN.js → nb-NO-T6EIAALU-DtItXAp7.js} +1 -1
- package/dist/frontend/assets/{nl-NL-IS3SIHDZ-ZprCvTYR.js → nl-NL-IS3SIHDZ-BhDH_DSM.js} +1 -1
- package/dist/frontend/assets/{nn-NO-6E72VCQL-CcljFAGy.js → nn-NO-6E72VCQL-Cmu__B2N.js} +1 -1
- package/dist/frontend/assets/{oc-FR-POXYY2M6-zCuu6Ns2.js → oc-FR-POXYY2M6-B1ipaxWB.js} +1 -1
- package/dist/frontend/assets/{pa-IN-N4M65BXN-D_iftL9v.js → pa-IN-N4M65BXN-CspiXbaI.js} +1 -1
- package/dist/frontend/assets/{pica-DsW4eP6T.js → pica-BnLKmlI9.js} +1 -1
- package/dist/frontend/assets/{pie-U_uHwWsL.js → pie-yOyKxyuQ.js} +1 -1
- package/dist/frontend/assets/{pieDiagram-421022e6-naaI7HiE.js → pieDiagram-421022e6-CEAjBr9n.js} +1 -1
- package/dist/frontend/assets/{pieDiagram-8a3498a8-m6nTf1O_.js → pieDiagram-8a3498a8-BDF9pk3a.js} +1 -1
- package/dist/frontend/assets/{pl-PL-T2D74RX3-CRQQfZUe.js → pl-PL-T2D74RX3-DPLKcO3V.js} +1 -1
- package/dist/frontend/assets/{pt-BR-5N22H2LF-DLvfG7RR.js → pt-BR-5N22H2LF-HdPZ9IjM.js} +1 -1
- package/dist/frontend/assets/{pt-PT-UZXXM6DQ-Chkg6-JC.js → pt-PT-UZXXM6DQ-eQuCmVkX.js} +1 -1
- package/dist/frontend/assets/{quadrantDiagram-0957ecba-BJR82kAx.js → quadrantDiagram-0957ecba-CJtOKuvw.js} +1 -1
- package/dist/frontend/assets/{quadrantDiagram-120e2f19-CsWgLp5e.js → quadrantDiagram-120e2f19-CIudpvkB.js} +1 -1
- package/dist/frontend/assets/{relay-BSVGqyIy.js → relay-27QhYxsz.js} +2 -2
- package/dist/frontend/assets/{requirementDiagram-23d650b8-CHmg-ycX.js → requirementDiagram-23d650b8-CT8mR7OZ.js} +1 -1
- package/dist/frontend/assets/{requirementDiagram-deff3bca-LIsyxsZZ.js → requirementDiagram-deff3bca-DF8oj5rR.js} +1 -1
- package/dist/frontend/assets/{ro-RO-JPDTUUEW-B_a5A5-x.js → ro-RO-JPDTUUEW-Cf_hTV0G.js} +1 -1
- package/dist/frontend/assets/{ru-RU-B4JR7IUQ-CY5sI1Ru.js → ru-RU-B4JR7IUQ-1jl-uARc.js} +1 -1
- package/dist/frontend/assets/{sankeyDiagram-04a897e0-DN5e16d0.js → sankeyDiagram-04a897e0-DKYqiQW1.js} +1 -1
- package/dist/frontend/assets/{sankeyDiagram-23345273-BBjQCtHz.js → sankeyDiagram-23345273-D6q6zk3O.js} +1 -1
- package/dist/frontend/assets/{selectAll-Dcq-dC_E.js → selectAll-DnBS9Lop.js} +1 -1
- package/dist/frontend/assets/{sequenceDiagram-17ac3bff-CIXyQiN6.js → sequenceDiagram-17ac3bff-B-ApO9S3.js} +1 -1
- package/dist/frontend/assets/{sequenceDiagram-704730f1-BmDwBhsF.js → sequenceDiagram-704730f1-LsimFKny.js} +1 -1
- package/dist/frontend/assets/{si-LK-N5RQ5JYF-DEPKL_1i.js → si-LK-N5RQ5JYF-fGMGxPBq.js} +1 -1
- package/dist/frontend/assets/{sk-SK-C5VTKIMK-XqrGDM2K.js → sk-SK-C5VTKIMK-CxwI7DZI.js} +1 -1
- package/dist/frontend/assets/{sl-SI-NN7IZMDC-Dia3d1Yy.js → sl-SI-NN7IZMDC-CLeJbfwa.js} +1 -1
- package/dist/frontend/assets/{stateDiagram-587899a1-CY1BCaUa.js → stateDiagram-587899a1-z_iwmJtq.js} +1 -1
- package/dist/frontend/assets/{stateDiagram-9c5f0230-gyjWQtSe.js → stateDiagram-9c5f0230-uJj0qAy3.js} +1 -1
- package/dist/frontend/assets/{stateDiagram-v2-51a3dcff-CAIiXqRE.js → stateDiagram-v2-51a3dcff-l0agXsoC.js} +1 -1
- package/dist/frontend/assets/{stateDiagram-v2-d93cdb3a-DvUpzRiQ.js → stateDiagram-v2-d93cdb3a-BSWk8P8r.js} +1 -1
- package/dist/frontend/assets/{styles-2ab5d517-BE3yBf4Z.js → styles-2ab5d517-BI73CrZU.js} +1 -1
- package/dist/frontend/assets/{styles-5f03d8d2-CGBEZiW_.js → styles-5f03d8d2-VNi1kjTQ.js} +1 -1
- package/dist/frontend/assets/{styles-6aaf32cf-JdIhb4_Y.js → styles-6aaf32cf-BM3CKRnB.js} +1 -1
- package/dist/frontend/assets/{styles-9a916d00-DRmxoyEF.js → styles-9a916d00-C4gV2ylK.js} +1 -1
- package/dist/frontend/assets/{styles-c10674c1-C3TEvIjw.js → styles-c10674c1-BRwHq-EW.js} +1 -1
- package/dist/frontend/assets/{styles-edf9a4b0-B_FeyXdP.js → styles-edf9a4b0-CBXqHHmY.js} +1 -1
- package/dist/frontend/assets/subset-shared.chunk.js +1 -1
- package/dist/frontend/assets/subset-worker.chunk.js +1 -1
- package/dist/frontend/assets/{sv-SE-XGPEYMSR-CBrvnOWh.js → sv-SE-XGPEYMSR-qKu1mFSv.js} +1 -1
- package/dist/frontend/assets/{svgDrawCommon-08f97a94-DI4ZG6xI.js → svgDrawCommon-08f97a94-IXEHR1r4.js} +1 -1
- package/dist/frontend/assets/{svgDrawCommon-3ba9043b-Dl5HsA0X.js → svgDrawCommon-3ba9043b-toLm6jgg.js} +1 -1
- package/dist/frontend/assets/{ta-IN-2NMHFXQM-DGYl9sGK.js → ta-IN-2NMHFXQM-DOXlrm5-.js} +1 -1
- package/dist/frontend/assets/{th-TH-HPSO5L25-Bq3K3L0F.js → th-TH-HPSO5L25-BZ-azUGl.js} +1 -1
- package/dist/frontend/assets/{timeline-definition-7e6b55e7-DWL-fZtL.js → timeline-definition-7e6b55e7-aFlyY4OS.js} +1 -1
- package/dist/frontend/assets/{timeline-definition-85554ec2-C14kwDFd.js → timeline-definition-85554ec2-Bi5xvegN.js} +1 -1
- package/dist/frontend/assets/{tr-TR-DEFEU3FU-CSwI35xw.js → tr-TR-DEFEU3FU-Bzbc67dh.js} +1 -1
- package/dist/frontend/assets/{uk-UA-QMV73CPH-Dxy7prmb.js → uk-UA-QMV73CPH-DaHFnTc_.js} +1 -1
- package/dist/frontend/assets/{union-DQ7m6Pel.js → union-Cs-neO9A.js} +1 -1
- package/dist/frontend/assets/{vi-VN-M7AON7JQ-BNyYTgjT.js → vi-VN-M7AON7JQ-DOa2_6-S.js} +1 -1
- package/dist/frontend/assets/{xychartDiagram-b6496bcd-DWKYL0ZD.js → xychartDiagram-b6496bcd-BHYThcfA.js} +1 -1
- package/dist/frontend/assets/{xychartDiagram-e933f94c-Bw4brW9l.js → xychartDiagram-e933f94c-uzjYNeEa.js} +1 -1
- package/dist/frontend/assets/{zh-CN-LNUGB5OW-BNhZCPEt.js → zh-CN-LNUGB5OW-DZqEStLk.js} +1 -1
- package/dist/frontend/assets/{zh-HK-E62DVLB3-D_rDALSq.js → zh-HK-E62DVLB3-BdDMs2KK.js} +1 -1
- package/dist/frontend/assets/{zh-TW-RAJ6MFWO-rUlbmCTA.js → zh-TW-RAJ6MFWO-BvgMmc_x.js} +1 -1
- package/dist/frontend/assets/{zipObject-Db5-6vIz.js → zipObject-CW3NmqXn.js} +1 -1
- package/dist/frontend/index.html +1 -1
- package/package.json +1 -1
- package/dist/frontend/assets/channel-BxFR7168.js +0 -1
- package/dist/frontend/assets/clone-CMl85WSi.js +0 -1
- package/dist/frontend/assets/flowDiagram-v2-96b9c2cf-DIa4RdMh.js +0 -1
- package/dist/frontend/assets/flowDiagram-v2-ffc7f31a-CnvFT8HV.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as A}from"./graph-MptL1QoF.js";import{l as H}from"./layout-c-hOA8zE.js";import{i as N}from"./union-DQ7m6Pel.js";import{c as V}from"./clone-CMl85WSi.js";import{m as $}from"./zipObject-Db5-6vIz.js";import{i as q,u as U,s as W,a as _,b as z,f as D,e as O,d as K,p as Q,h as B,j as J,k as Y,m as Z}from"./edges-e0da2a9e-BRt7qomS.js";import{l as s,g as T,q as S}from"./index-B45XzZiR.js";import{c as I}from"./createText-2e5e7dd3-D3kSz3YE.js";import{e as L}from"./index-Bd-8869C.js";function y(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:tt(e),edges:et(e)};return N(e.graph())||(t.value=V(e.graph())),t}function tt(e){return $(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),i={v:t};return N(n)||(i.value=n),N(r)||(i.parent=r),i})}function et(e){return $(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return N(t.name)||(r.name=t.name),N(n)||(r.value=n),r})}let l={},g={},R={};const nt=()=>{g={},R={},l={}},p=(e,t)=>(s.trace("In isDescendant",t," ",e," = ",g[t].includes(e)),!!g[t].includes(e)),it=(e,t)=>(s.info("Descendants of ",t," is ",g[t]),s.info("Edge is ",e),e.v===t||e.w===t?!1:g[t]?g[t].includes(e.v)||p(e.v,t)||p(e.w,t)||g[t].includes(e.w):(s.debug("Tilt, ",t,",not in descendants"),!1)),P=(e,t,n,r)=>{s.warn("Copying children of ",e,"root",r,"data",t.node(e),r);const i=t.children(e)||[];e!==r&&i.push(e),s.warn("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)P(a,t,n,r);else{const d=t.node(a);s.info("cp ",a," to ",r," with parent ",e),n.setNode(a,d),r!==t.parent(a)&&(s.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==r&&a!==e?(s.debug("Setting parent",a,e),n.setParent(a,e)):(s.info("In copy ",e,"root",r,"data",t.node(e),r),s.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));const u=t.edges(a);s.debug("Copying Edges",u),u.forEach(f=>{s.info("Edge",f);const h=t.edge(f.v,f.w,f.name);s.info("Edge data",h,r);try{it(f,r)?(s.info("Copying as ",f.v,f.w,h,f.name),n.setEdge(f.v,f.w,h,f.name),s.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):s.info("Skipping copy of edge ",f.v,"-->",f.w," rootId: ",r," clusterId:",e)}catch(w){s.error(w)}})}s.debug("Removing node",a),t.removeNode(a)})},k=(e,t)=>{const n=t.children(e);let r=[...n];for(const i of n)R[i]=e,r=[...r,...k(i,t)];return r},C=(e,t)=>{s.trace("Searching",e);const n=t.children(e);if(s.trace("Searching children of id ",e,n),n.length<1)return s.trace("This is a valid node",e),e;for(const r of n){const i=C(r,t);if(i)return s.trace("Found replacement for",e," => ",i),i}},X=e=>!l[e]||!l[e].externalConnections?e:l[e]?l[e].id:e,st=(e,t)=>{if(!e||t>10){s.debug("Opting out, no graph ");return}else s.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(s.warn("Cluster identified",n," Replacement id in edges: ",C(n,e)),g[n]=k(n,e),l[n]={id:C(n,e),clusterData:e.node(n)})}),e.nodes().forEach(function(n){const r=e.children(n),i=e.edges();r.length>0?(s.debug("Cluster identified",n,g),i.forEach(a=>{if(a.v!==n&&a.w!==n){const d=p(a.v,n),u=p(a.w,n);d^u&&(s.warn("Edge: ",a," leaves cluster ",n),s.warn("Descendants of XXX ",n,": ",g[n]),l[n].externalConnections=!0)}})):s.debug("Not a cluster ",n,g)});for(let n of Object.keys(l)){const r=l[n].id,i=e.parent(r);i!==n&&l[i]&&!l[i].externalConnections&&(l[n].id=i)}e.edges().forEach(function(n){const r=e.edge(n);s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let i=n.v,a=n.w;if(s.warn("Fix XXX",l,"ids:",n.v,n.w,"Translating: ",l[n.v]," --- ",l[n.w]),l[n.v]&&l[n.w]&&l[n.v]===l[n.w]){s.warn("Fixing and trixing link to self - removing XXX",n.v,n.w,n.name),s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name);const d=n.w+"---"+n.v;e.setNode(d,{domId:d,id:d,labelStyle:"",labelText:r.label,padding:0,shape:"labelRect",style:""});const u=structuredClone(r),f=structuredClone(r);u.label="",u.arrowTypeEnd="none",f.label="",u.fromCluster=n.v,f.toCluster=n.v,e.setEdge(i,d,u,n.name+"-cyclic-special"),e.setEdge(d,a,f,n.name+"-cyclic-special")}else if(l[n.v]||l[n.w]){if(s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name),i!==n.v){const d=e.parent(i);l[d].externalConnections=!0,r.fromCluster=n.v}if(a!==n.w){const d=e.parent(a);l[d].externalConnections=!0,r.toCluster=n.w}s.warn("Fix Replacing with XXX",i,a,n.name),e.setEdge(i,a,r,n.name)}}),s.warn("Adjusted Graph",y(e)),F(e,0),s.trace(l)},F=(e,t)=>{if(s.warn("extractor - ",t,y(e),e.children("D")),t>10){s.error("Bailing out");return}let n=e.nodes(),r=!1;for(const i of n){const a=e.children(i);r=r||a.length>0}if(!r){s.debug("Done, no node has children",e.nodes());return}s.debug("Nodes = ",n,t);for(const i of n)if(s.debug("Extracting node",i,l,l[i]&&!l[i].externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!l[i])s.debug("Not a cluster",i,t);else if(!l[i].externalConnections&&e.children(i)&&e.children(i).length>0){s.warn("Cluster without external connections, without a parent and with children",i,t);let d=e.graph().rankdir==="TB"?"LR":"TB";l[i]&&l[i].clusterData&&l[i].clusterData.dir&&(d=l[i].clusterData.dir,s.warn("Fixing dir",l[i].clusterData.dir,d));const u=new A({multigraph:!0,compound:!0}).setGraph({rankdir:d,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});s.warn("Old graph before copy",y(e)),P(i,e,u,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:l[i].clusterData,labelText:l[i].labelText,graph:u}),s.warn("New graph after copy node: (",i,")",y(u)),s.debug("Old graph after copy",y(e))}else s.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!l[i].externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),s.debug(l);n=e.nodes(),s.warn("New list of nodes",n);for(const i of n){const a=e.node(i);s.warn(" Now next level",i,a),a.clusterNode&&F(a.graph,t+1)}},G=(e,t)=>{if(t.length===0)return[];let n=Object.assign(t);return t.forEach(r=>{const i=e.children(r),a=G(e,i);n=[...n,...a]}),n},rt=e=>G(e,e.children()),at=(e,t)=>{s.info("Creating subgraph rect for ",t.id,t);const n=T(),r=e.insert("g").attr("class","cluster"+(t.class?" "+t.class:"")).attr("id",t.id),i=r.insert("rect",":first-child"),a=S(n.flowchart.htmlLabels),d=r.insert("g").attr("class","cluster-label"),u=t.labelType==="markdown"?I(d,t.labelText,{style:t.labelStyle,useHtmlLabels:a}):d.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}const h=0*t.padding,w=h/2,m=t.width<=f.width+h?f.width+h:t.width;t.width<=f.width+h?t.diff=(f.width-t.width)/2-t.padding/2:t.diff=-t.padding/2,s.trace("Data ",t,JSON.stringify(t)),i.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-m/2).attr("y",t.y-t.height/2-w).attr("width",m).attr("height",t.height+h);const{subGraphTitleTopMargin:v}=D(n);a?d.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2+v})`):d.attr("transform",`translate(${t.x}, ${t.y-t.height/2+v})`);const x=i.node().getBBox();return t.width=x.width,t.height=x.height,t.intersect=function(c){return B(t,c)},r},ct=(e,t)=>{const n=e.insert("g").attr("class","note-cluster").attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+i).attr("height",t.height+i).attr("fill","none");const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.intersect=function(u){return B(t,u)},n},ot=(e,t)=>{const n=T(),r=e.insert("g").attr("class",t.classes).attr("id",t.id),i=r.insert("rect",":first-child"),a=r.insert("g").attr("class","cluster-label"),d=r.append("rect"),u=a.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}f=u.getBBox();const h=0*t.padding,w=h/2,m=t.width<=f.width+t.padding?f.width+t.padding:t.width;t.width<=f.width+t.padding?t.diff=(f.width+t.padding*0-t.width)/2:t.diff=-t.padding/2,i.attr("class","outer").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w).attr("width",m+h).attr("height",t.height+h),d.attr("class","inner").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w+f.height-1).attr("width",m+h).attr("height",t.height+h-f.height-3);const{subGraphTitleTopMargin:v}=D(n);a.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2-t.padding/3+(S(n.flowchart.htmlLabels)?5:3)+v})`);const x=i.node().getBBox();return t.height=x.height,t.intersect=function(c){return B(t,c)},r},lt=(e,t)=>{const n=e.insert("g").attr("class",t.classes).attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("class","divider").attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2).attr("width",t.width+i).attr("height",t.height+i);const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.diff=-t.padding/2,t.intersect=function(u){return B(t,u)},n},ft={rect:at,roundedWithTitle:ot,noteGroup:ct,divider:lt};let j={};const dt=(e,t)=>{s.trace("Inserting cluster");const n=t.shape||"rect";j[t.id]=ft[n](e,t)},ut=()=>{j={}},M=async(e,t,n,r,i,a)=>{s.info("Graph in recursive render: XXX",y(t),i);const d=t.graph().rankdir;s.trace("Dir in recursive render - dir:",d);const u=e.insert("g").attr("class","root");t.nodes()?s.info("Recursive render XXX",t.nodes()):s.info("No nodes found for",t),t.edges().length>0&&s.trace("Recursive edges",t.edge(t.edges()[0]));const f=u.insert("g").attr("class","clusters"),h=u.insert("g").attr("class","edgePaths"),w=u.insert("g").attr("class","edgeLabels"),m=u.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(c){const o=t.node(c);if(i!==void 0){const b=JSON.parse(JSON.stringify(i.clusterData));s.info("Setting data for cluster XXX (",c,") ",b,i),t.setNode(i.id,b),t.parent(c)||(s.trace("Setting parent",c,i.id),t.setParent(c,i.id,b))}if(s.info("(Insert) Node XXX"+c+": "+JSON.stringify(t.node(c))),o&&o.clusterNode){s.info("Cluster identified",c,o.width,t.node(c));const b=await M(m,o.graph,n,r,t.node(c),a),E=b.elem;U(o,E),o.diff=b.diff||0,s.info("Node bounds (abc123)",c,o,o.width,o.x,o.y),W(E,o),s.warn("Recursive render complete ",E,o)}else t.children(c).length>0?(s.info("Cluster - the non recursive path XXX",c,o.id,o,t),s.info(C(o.id,t)),l[o.id]={id:C(o.id,t),node:o}):(s.info("Node - the non recursive path",c,o.id,o),await _(m,t.node(c),d))})),t.edges().forEach(function(c){const o=t.edge(c.v,c.w,c.name);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c)),s.info("Edge "+c.v+" -> "+c.w+": ",c," ",JSON.stringify(t.edge(c))),s.info("Fix",l,"ids:",c.v,c.w,"Translating: ",l[c.v],l[c.w]),z(w,o)}),t.edges().forEach(function(c){s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c))}),s.info("#############################################"),s.info("### Layout ###"),s.info("#############################################"),s.info(t),H(t),s.info("Graph after layout:",y(t));let v=0;const{subGraphTitleTotalMargin:x}=D(a);return rt(t).forEach(function(c){const o=t.node(c);s.info("Position "+c+": "+JSON.stringify(t.node(c))),s.info("Position "+c+": ("+o.x,","+o.y,") width: ",o.width," height: ",o.height),o&&o.clusterNode?(o.y+=x,O(o)):t.children(c).length>0?(o.height+=x,dt(f,o),l[o.id].node=o):(o.y+=x/2,O(o))}),t.edges().forEach(function(c){const o=t.edge(c);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(o),o),o.points.forEach(E=>E.y+=x/2);const b=K(h,c,o,l,n,t,r);Q(o,b)}),t.nodes().forEach(function(c){const o=t.node(c);s.info(c,o.type,o.diff),o.type==="group"&&(v=o.diff)}),{elem:u,diff:v}},Nt=async(e,t,n,r,i)=>{q(e,n,r,i),Y(),Z(),ut(),nt(),s.warn("Graph at first:",JSON.stringify(y(t))),st(t),s.warn("Graph after:",JSON.stringify(y(t)));const a=T();await M(e,t,r,i,void 0,a)};export{Nt as r};
|
|
1
|
+
import{G as A}from"./graph-C7nn5gAF.js";import{l as H}from"./layout-D14yXSeC.js";import{i as N}from"./union-Cs-neO9A.js";import{c as V}from"./clone-_Vll1BLd.js";import{m as $}from"./zipObject-CW3NmqXn.js";import{i as q,u as U,s as W,a as _,b as z,f as D,e as O,d as K,p as Q,h as B,j as J,k as Y,m as Z}from"./edges-e0da2a9e-CCMBX5lb.js";import{l as s,g as T,q as S}from"./index-CoLRMCf6.js";import{c as I}from"./createText-2e5e7dd3-6ttRBJsO.js";import{e as L}from"./index-BhUVktMi.js";function y(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:tt(e),edges:et(e)};return N(e.graph())||(t.value=V(e.graph())),t}function tt(e){return $(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),i={v:t};return N(n)||(i.value=n),N(r)||(i.parent=r),i})}function et(e){return $(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return N(t.name)||(r.name=t.name),N(n)||(r.value=n),r})}let l={},g={},R={};const nt=()=>{g={},R={},l={}},p=(e,t)=>(s.trace("In isDescendant",t," ",e," = ",g[t].includes(e)),!!g[t].includes(e)),it=(e,t)=>(s.info("Descendants of ",t," is ",g[t]),s.info("Edge is ",e),e.v===t||e.w===t?!1:g[t]?g[t].includes(e.v)||p(e.v,t)||p(e.w,t)||g[t].includes(e.w):(s.debug("Tilt, ",t,",not in descendants"),!1)),P=(e,t,n,r)=>{s.warn("Copying children of ",e,"root",r,"data",t.node(e),r);const i=t.children(e)||[];e!==r&&i.push(e),s.warn("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)P(a,t,n,r);else{const d=t.node(a);s.info("cp ",a," to ",r," with parent ",e),n.setNode(a,d),r!==t.parent(a)&&(s.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==r&&a!==e?(s.debug("Setting parent",a,e),n.setParent(a,e)):(s.info("In copy ",e,"root",r,"data",t.node(e),r),s.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));const u=t.edges(a);s.debug("Copying Edges",u),u.forEach(f=>{s.info("Edge",f);const h=t.edge(f.v,f.w,f.name);s.info("Edge data",h,r);try{it(f,r)?(s.info("Copying as ",f.v,f.w,h,f.name),n.setEdge(f.v,f.w,h,f.name),s.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):s.info("Skipping copy of edge ",f.v,"-->",f.w," rootId: ",r," clusterId:",e)}catch(w){s.error(w)}})}s.debug("Removing node",a),t.removeNode(a)})},k=(e,t)=>{const n=t.children(e);let r=[...n];for(const i of n)R[i]=e,r=[...r,...k(i,t)];return r},C=(e,t)=>{s.trace("Searching",e);const n=t.children(e);if(s.trace("Searching children of id ",e,n),n.length<1)return s.trace("This is a valid node",e),e;for(const r of n){const i=C(r,t);if(i)return s.trace("Found replacement for",e," => ",i),i}},X=e=>!l[e]||!l[e].externalConnections?e:l[e]?l[e].id:e,st=(e,t)=>{if(!e||t>10){s.debug("Opting out, no graph ");return}else s.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(s.warn("Cluster identified",n," Replacement id in edges: ",C(n,e)),g[n]=k(n,e),l[n]={id:C(n,e),clusterData:e.node(n)})}),e.nodes().forEach(function(n){const r=e.children(n),i=e.edges();r.length>0?(s.debug("Cluster identified",n,g),i.forEach(a=>{if(a.v!==n&&a.w!==n){const d=p(a.v,n),u=p(a.w,n);d^u&&(s.warn("Edge: ",a," leaves cluster ",n),s.warn("Descendants of XXX ",n,": ",g[n]),l[n].externalConnections=!0)}})):s.debug("Not a cluster ",n,g)});for(let n of Object.keys(l)){const r=l[n].id,i=e.parent(r);i!==n&&l[i]&&!l[i].externalConnections&&(l[n].id=i)}e.edges().forEach(function(n){const r=e.edge(n);s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let i=n.v,a=n.w;if(s.warn("Fix XXX",l,"ids:",n.v,n.w,"Translating: ",l[n.v]," --- ",l[n.w]),l[n.v]&&l[n.w]&&l[n.v]===l[n.w]){s.warn("Fixing and trixing link to self - removing XXX",n.v,n.w,n.name),s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name);const d=n.w+"---"+n.v;e.setNode(d,{domId:d,id:d,labelStyle:"",labelText:r.label,padding:0,shape:"labelRect",style:""});const u=structuredClone(r),f=structuredClone(r);u.label="",u.arrowTypeEnd="none",f.label="",u.fromCluster=n.v,f.toCluster=n.v,e.setEdge(i,d,u,n.name+"-cyclic-special"),e.setEdge(d,a,f,n.name+"-cyclic-special")}else if(l[n.v]||l[n.w]){if(s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name),i!==n.v){const d=e.parent(i);l[d].externalConnections=!0,r.fromCluster=n.v}if(a!==n.w){const d=e.parent(a);l[d].externalConnections=!0,r.toCluster=n.w}s.warn("Fix Replacing with XXX",i,a,n.name),e.setEdge(i,a,r,n.name)}}),s.warn("Adjusted Graph",y(e)),F(e,0),s.trace(l)},F=(e,t)=>{if(s.warn("extractor - ",t,y(e),e.children("D")),t>10){s.error("Bailing out");return}let n=e.nodes(),r=!1;for(const i of n){const a=e.children(i);r=r||a.length>0}if(!r){s.debug("Done, no node has children",e.nodes());return}s.debug("Nodes = ",n,t);for(const i of n)if(s.debug("Extracting node",i,l,l[i]&&!l[i].externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!l[i])s.debug("Not a cluster",i,t);else if(!l[i].externalConnections&&e.children(i)&&e.children(i).length>0){s.warn("Cluster without external connections, without a parent and with children",i,t);let d=e.graph().rankdir==="TB"?"LR":"TB";l[i]&&l[i].clusterData&&l[i].clusterData.dir&&(d=l[i].clusterData.dir,s.warn("Fixing dir",l[i].clusterData.dir,d));const u=new A({multigraph:!0,compound:!0}).setGraph({rankdir:d,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});s.warn("Old graph before copy",y(e)),P(i,e,u,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:l[i].clusterData,labelText:l[i].labelText,graph:u}),s.warn("New graph after copy node: (",i,")",y(u)),s.debug("Old graph after copy",y(e))}else s.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!l[i].externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),s.debug(l);n=e.nodes(),s.warn("New list of nodes",n);for(const i of n){const a=e.node(i);s.warn(" Now next level",i,a),a.clusterNode&&F(a.graph,t+1)}},G=(e,t)=>{if(t.length===0)return[];let n=Object.assign(t);return t.forEach(r=>{const i=e.children(r),a=G(e,i);n=[...n,...a]}),n},rt=e=>G(e,e.children()),at=(e,t)=>{s.info("Creating subgraph rect for ",t.id,t);const n=T(),r=e.insert("g").attr("class","cluster"+(t.class?" "+t.class:"")).attr("id",t.id),i=r.insert("rect",":first-child"),a=S(n.flowchart.htmlLabels),d=r.insert("g").attr("class","cluster-label"),u=t.labelType==="markdown"?I(d,t.labelText,{style:t.labelStyle,useHtmlLabels:a}):d.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}const h=0*t.padding,w=h/2,m=t.width<=f.width+h?f.width+h:t.width;t.width<=f.width+h?t.diff=(f.width-t.width)/2-t.padding/2:t.diff=-t.padding/2,s.trace("Data ",t,JSON.stringify(t)),i.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-m/2).attr("y",t.y-t.height/2-w).attr("width",m).attr("height",t.height+h);const{subGraphTitleTopMargin:v}=D(n);a?d.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2+v})`):d.attr("transform",`translate(${t.x}, ${t.y-t.height/2+v})`);const x=i.node().getBBox();return t.width=x.width,t.height=x.height,t.intersect=function(c){return B(t,c)},r},ct=(e,t)=>{const n=e.insert("g").attr("class","note-cluster").attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+i).attr("height",t.height+i).attr("fill","none");const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.intersect=function(u){return B(t,u)},n},ot=(e,t)=>{const n=T(),r=e.insert("g").attr("class",t.classes).attr("id",t.id),i=r.insert("rect",":first-child"),a=r.insert("g").attr("class","cluster-label"),d=r.append("rect"),u=a.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}f=u.getBBox();const h=0*t.padding,w=h/2,m=t.width<=f.width+t.padding?f.width+t.padding:t.width;t.width<=f.width+t.padding?t.diff=(f.width+t.padding*0-t.width)/2:t.diff=-t.padding/2,i.attr("class","outer").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w).attr("width",m+h).attr("height",t.height+h),d.attr("class","inner").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w+f.height-1).attr("width",m+h).attr("height",t.height+h-f.height-3);const{subGraphTitleTopMargin:v}=D(n);a.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2-t.padding/3+(S(n.flowchart.htmlLabels)?5:3)+v})`);const x=i.node().getBBox();return t.height=x.height,t.intersect=function(c){return B(t,c)},r},lt=(e,t)=>{const n=e.insert("g").attr("class",t.classes).attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("class","divider").attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2).attr("width",t.width+i).attr("height",t.height+i);const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.diff=-t.padding/2,t.intersect=function(u){return B(t,u)},n},ft={rect:at,roundedWithTitle:ot,noteGroup:ct,divider:lt};let j={};const dt=(e,t)=>{s.trace("Inserting cluster");const n=t.shape||"rect";j[t.id]=ft[n](e,t)},ut=()=>{j={}},M=async(e,t,n,r,i,a)=>{s.info("Graph in recursive render: XXX",y(t),i);const d=t.graph().rankdir;s.trace("Dir in recursive render - dir:",d);const u=e.insert("g").attr("class","root");t.nodes()?s.info("Recursive render XXX",t.nodes()):s.info("No nodes found for",t),t.edges().length>0&&s.trace("Recursive edges",t.edge(t.edges()[0]));const f=u.insert("g").attr("class","clusters"),h=u.insert("g").attr("class","edgePaths"),w=u.insert("g").attr("class","edgeLabels"),m=u.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(c){const o=t.node(c);if(i!==void 0){const b=JSON.parse(JSON.stringify(i.clusterData));s.info("Setting data for cluster XXX (",c,") ",b,i),t.setNode(i.id,b),t.parent(c)||(s.trace("Setting parent",c,i.id),t.setParent(c,i.id,b))}if(s.info("(Insert) Node XXX"+c+": "+JSON.stringify(t.node(c))),o&&o.clusterNode){s.info("Cluster identified",c,o.width,t.node(c));const b=await M(m,o.graph,n,r,t.node(c),a),E=b.elem;U(o,E),o.diff=b.diff||0,s.info("Node bounds (abc123)",c,o,o.width,o.x,o.y),W(E,o),s.warn("Recursive render complete ",E,o)}else t.children(c).length>0?(s.info("Cluster - the non recursive path XXX",c,o.id,o,t),s.info(C(o.id,t)),l[o.id]={id:C(o.id,t),node:o}):(s.info("Node - the non recursive path",c,o.id,o),await _(m,t.node(c),d))})),t.edges().forEach(function(c){const o=t.edge(c.v,c.w,c.name);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c)),s.info("Edge "+c.v+" -> "+c.w+": ",c," ",JSON.stringify(t.edge(c))),s.info("Fix",l,"ids:",c.v,c.w,"Translating: ",l[c.v],l[c.w]),z(w,o)}),t.edges().forEach(function(c){s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c))}),s.info("#############################################"),s.info("### Layout ###"),s.info("#############################################"),s.info(t),H(t),s.info("Graph after layout:",y(t));let v=0;const{subGraphTitleTotalMargin:x}=D(a);return rt(t).forEach(function(c){const o=t.node(c);s.info("Position "+c+": "+JSON.stringify(t.node(c))),s.info("Position "+c+": ("+o.x,","+o.y,") width: ",o.width," height: ",o.height),o&&o.clusterNode?(o.y+=x,O(o)):t.children(c).length>0?(o.height+=x,dt(f,o),l[o.id].node=o):(o.y+=x/2,O(o))}),t.edges().forEach(function(c){const o=t.edge(c);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(o),o),o.points.forEach(E=>E.y+=x/2);const b=K(h,c,o,l,n,t,r);Q(o,b)}),t.nodes().forEach(function(c){const o=t.node(c);s.info(c,o.type,o.diff),o.type==="group"&&(v=o.diff)}),{elem:u,diff:v}},Nt=async(e,t,n,r,i)=>{q(e,n,r,i),Y(),Z(),ut(),nt(),s.warn("Graph at first:",JSON.stringify(y(t))),st(t),s.warn("Graph after:",JSON.stringify(y(t)));const a=T();await M(e,t,r,i,void 0,a)};export{Nt as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as A}from"./graph-Mzuu2QFH.js";import{l as H}from"./layout-D1hl6oKi.js";import{i as N}from"./union-DQ7m6Pel.js";import{c as V}from"./clone-CMl85WSi.js";import{m as $}from"./zipObject-Db5-6vIz.js";import{i as U,u as W,s as _,a as q,b as z,f as D,e as O,d as K,p as Q,h as B,j as J,k as Y,m as Z}from"./edges-332bd1c7-C5qM1sDU.js";import{l as s,g as T,G as S,e as L}from"./index-Bd-8869C.js";import{c as I}from"./createText-d213de94-DvJeLlQX.js";function y(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:tt(e),edges:et(e)};return N(e.graph())||(t.value=V(e.graph())),t}function tt(e){return $(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),i={v:t};return N(n)||(i.value=n),N(r)||(i.parent=r),i})}function et(e){return $(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return N(t.name)||(r.name=t.name),N(n)||(r.value=n),r})}let l={},g={},R={};const nt=()=>{g={},R={},l={}},p=(e,t)=>(s.trace("In isDescendant",t," ",e," = ",g[t].includes(e)),!!g[t].includes(e)),it=(e,t)=>(s.info("Descendants of ",t," is ",g[t]),s.info("Edge is ",e),e.v===t||e.w===t?!1:g[t]?g[t].includes(e.v)||p(e.v,t)||p(e.w,t)||g[t].includes(e.w):(s.debug("Tilt, ",t,",not in descendants"),!1)),P=(e,t,n,r)=>{s.warn("Copying children of ",e,"root",r,"data",t.node(e),r);const i=t.children(e)||[];e!==r&&i.push(e),s.warn("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)P(a,t,n,r);else{const d=t.node(a);s.info("cp ",a," to ",r," with parent ",e),n.setNode(a,d),r!==t.parent(a)&&(s.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==r&&a!==e?(s.debug("Setting parent",a,e),n.setParent(a,e)):(s.info("In copy ",e,"root",r,"data",t.node(e),r),s.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));const u=t.edges(a);s.debug("Copying Edges",u),u.forEach(f=>{s.info("Edge",f);const h=t.edge(f.v,f.w,f.name);s.info("Edge data",h,r);try{it(f,r)?(s.info("Copying as ",f.v,f.w,h,f.name),n.setEdge(f.v,f.w,h,f.name),s.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):s.info("Skipping copy of edge ",f.v,"-->",f.w," rootId: ",r," clusterId:",e)}catch(w){s.error(w)}})}s.debug("Removing node",a),t.removeNode(a)})},k=(e,t)=>{const n=t.children(e);let r=[...n];for(const i of n)R[i]=e,r=[...r,...k(i,t)];return r},C=(e,t)=>{s.trace("Searching",e);const n=t.children(e);if(s.trace("Searching children of id ",e,n),n.length<1)return s.trace("This is a valid node",e),e;for(const r of n){const i=C(r,t);if(i)return s.trace("Found replacement for",e," => ",i),i}},X=e=>!l[e]||!l[e].externalConnections?e:l[e]?l[e].id:e,st=(e,t)=>{if(!e||t>10){s.debug("Opting out, no graph ");return}else s.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(s.warn("Cluster identified",n," Replacement id in edges: ",C(n,e)),g[n]=k(n,e),l[n]={id:C(n,e),clusterData:e.node(n)})}),e.nodes().forEach(function(n){const r=e.children(n),i=e.edges();r.length>0?(s.debug("Cluster identified",n,g),i.forEach(a=>{if(a.v!==n&&a.w!==n){const d=p(a.v,n),u=p(a.w,n);d^u&&(s.warn("Edge: ",a," leaves cluster ",n),s.warn("Descendants of XXX ",n,": ",g[n]),l[n].externalConnections=!0)}})):s.debug("Not a cluster ",n,g)});for(let n of Object.keys(l)){const r=l[n].id,i=e.parent(r);i!==n&&l[i]&&!l[i].externalConnections&&(l[n].id=i)}e.edges().forEach(function(n){const r=e.edge(n);s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let i=n.v,a=n.w;if(s.warn("Fix XXX",l,"ids:",n.v,n.w,"Translating: ",l[n.v]," --- ",l[n.w]),l[n.v]&&l[n.w]&&l[n.v]===l[n.w]){s.warn("Fixing and trixing link to self - removing XXX",n.v,n.w,n.name),s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name);const d=n.w+"---"+n.v;e.setNode(d,{domId:d,id:d,labelStyle:"",labelText:r.label,padding:0,shape:"labelRect",style:""});const u=structuredClone(r),f=structuredClone(r);u.label="",u.arrowTypeEnd="none",f.label="",u.fromCluster=n.v,f.toCluster=n.v,e.setEdge(i,d,u,n.name+"-cyclic-special"),e.setEdge(d,a,f,n.name+"-cyclic-special")}else if(l[n.v]||l[n.w]){if(s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name),i!==n.v){const d=e.parent(i);l[d].externalConnections=!0,r.fromCluster=n.v}if(a!==n.w){const d=e.parent(a);l[d].externalConnections=!0,r.toCluster=n.w}s.warn("Fix Replacing with XXX",i,a,n.name),e.setEdge(i,a,r,n.name)}}),s.warn("Adjusted Graph",y(e)),G(e,0),s.trace(l)},G=(e,t)=>{if(s.warn("extractor - ",t,y(e),e.children("D")),t>10){s.error("Bailing out");return}let n=e.nodes(),r=!1;for(const i of n){const a=e.children(i);r=r||a.length>0}if(!r){s.debug("Done, no node has children",e.nodes());return}s.debug("Nodes = ",n,t);for(const i of n)if(s.debug("Extracting node",i,l,l[i]&&!l[i].externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!l[i])s.debug("Not a cluster",i,t);else if(!l[i].externalConnections&&e.children(i)&&e.children(i).length>0){s.warn("Cluster without external connections, without a parent and with children",i,t);let d=e.graph().rankdir==="TB"?"LR":"TB";l[i]&&l[i].clusterData&&l[i].clusterData.dir&&(d=l[i].clusterData.dir,s.warn("Fixing dir",l[i].clusterData.dir,d));const u=new A({multigraph:!0,compound:!0}).setGraph({rankdir:d,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});s.warn("Old graph before copy",y(e)),P(i,e,u,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:l[i].clusterData,labelText:l[i].labelText,graph:u}),s.warn("New graph after copy node: (",i,")",y(u)),s.debug("Old graph after copy",y(e))}else s.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!l[i].externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),s.debug(l);n=e.nodes(),s.warn("New list of nodes",n);for(const i of n){const a=e.node(i);s.warn(" Now next level",i,a),a.clusterNode&&G(a.graph,t+1)}},F=(e,t)=>{if(t.length===0)return[];let n=Object.assign(t);return t.forEach(r=>{const i=e.children(r),a=F(e,i);n=[...n,...a]}),n},rt=e=>F(e,e.children()),at=(e,t)=>{s.info("Creating subgraph rect for ",t.id,t);const n=T(),r=e.insert("g").attr("class","cluster"+(t.class?" "+t.class:"")).attr("id",t.id),i=r.insert("rect",":first-child"),a=S(n.flowchart.htmlLabels),d=r.insert("g").attr("class","cluster-label"),u=t.labelType==="markdown"?I(d,t.labelText,{style:t.labelStyle,useHtmlLabels:a}):d.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}const h=0*t.padding,w=h/2,m=t.width<=f.width+h?f.width+h:t.width;t.width<=f.width+h?t.diff=(f.width-t.width)/2-t.padding/2:t.diff=-t.padding/2,s.trace("Data ",t,JSON.stringify(t)),i.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-m/2).attr("y",t.y-t.height/2-w).attr("width",m).attr("height",t.height+h);const{subGraphTitleTopMargin:v}=D(n);a?d.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2+v})`):d.attr("transform",`translate(${t.x}, ${t.y-t.height/2+v})`);const x=i.node().getBBox();return t.width=x.width,t.height=x.height,t.intersect=function(c){return B(t,c)},r},ct=(e,t)=>{const n=e.insert("g").attr("class","note-cluster").attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+i).attr("height",t.height+i).attr("fill","none");const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.intersect=function(u){return B(t,u)},n},ot=(e,t)=>{const n=T(),r=e.insert("g").attr("class",t.classes).attr("id",t.id),i=r.insert("rect",":first-child"),a=r.insert("g").attr("class","cluster-label"),d=r.append("rect"),u=a.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}f=u.getBBox();const h=0*t.padding,w=h/2,m=t.width<=f.width+t.padding?f.width+t.padding:t.width;t.width<=f.width+t.padding?t.diff=(f.width+t.padding*0-t.width)/2:t.diff=-t.padding/2,i.attr("class","outer").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w).attr("width",m+h).attr("height",t.height+h),d.attr("class","inner").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w+f.height-1).attr("width",m+h).attr("height",t.height+h-f.height-3);const{subGraphTitleTopMargin:v}=D(n);a.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2-t.padding/3+(S(n.flowchart.htmlLabels)?5:3)+v})`);const x=i.node().getBBox();return t.height=x.height,t.intersect=function(c){return B(t,c)},r},lt=(e,t)=>{const n=e.insert("g").attr("class",t.classes).attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("class","divider").attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2).attr("width",t.width+i).attr("height",t.height+i);const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.diff=-t.padding/2,t.intersect=function(u){return B(t,u)},n},ft={rect:at,roundedWithTitle:ot,noteGroup:ct,divider:lt};let j={};const dt=(e,t)=>{s.trace("Inserting cluster");const n=t.shape||"rect";j[t.id]=ft[n](e,t)},ut=()=>{j={}},M=async(e,t,n,r,i,a)=>{s.info("Graph in recursive render: XXX",y(t),i);const d=t.graph().rankdir;s.trace("Dir in recursive render - dir:",d);const u=e.insert("g").attr("class","root");t.nodes()?s.info("Recursive render XXX",t.nodes()):s.info("No nodes found for",t),t.edges().length>0&&s.trace("Recursive edges",t.edge(t.edges()[0]));const f=u.insert("g").attr("class","clusters"),h=u.insert("g").attr("class","edgePaths"),w=u.insert("g").attr("class","edgeLabels"),m=u.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(c){const o=t.node(c);if(i!==void 0){const b=JSON.parse(JSON.stringify(i.clusterData));s.info("Setting data for cluster XXX (",c,") ",b,i),t.setNode(i.id,b),t.parent(c)||(s.trace("Setting parent",c,i.id),t.setParent(c,i.id,b))}if(s.info("(Insert) Node XXX"+c+": "+JSON.stringify(t.node(c))),o&&o.clusterNode){s.info("Cluster identified",c,o.width,t.node(c));const b=await M(m,o.graph,n,r,t.node(c),a),E=b.elem;W(o,E),o.diff=b.diff||0,s.info("Node bounds (abc123)",c,o,o.width,o.x,o.y),_(E,o),s.warn("Recursive render complete ",E,o)}else t.children(c).length>0?(s.info("Cluster - the non recursive path XXX",c,o.id,o,t),s.info(C(o.id,t)),l[o.id]={id:C(o.id,t),node:o}):(s.info("Node - the non recursive path",c,o.id,o),await q(m,t.node(c),d))})),t.edges().forEach(function(c){const o=t.edge(c.v,c.w,c.name);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c)),s.info("Edge "+c.v+" -> "+c.w+": ",c," ",JSON.stringify(t.edge(c))),s.info("Fix",l,"ids:",c.v,c.w,"Translating: ",l[c.v],l[c.w]),z(w,o)}),t.edges().forEach(function(c){s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c))}),s.info("#############################################"),s.info("### Layout ###"),s.info("#############################################"),s.info(t),H(t),s.info("Graph after layout:",y(t));let v=0;const{subGraphTitleTotalMargin:x}=D(a);return rt(t).forEach(function(c){const o=t.node(c);s.info("Position "+c+": "+JSON.stringify(t.node(c))),s.info("Position "+c+": ("+o.x,","+o.y,") width: ",o.width," height: ",o.height),o&&o.clusterNode?(o.y+=x,O(o)):t.children(c).length>0?(o.height+=x,dt(f,o),l[o.id].node=o):(o.y+=x/2,O(o))}),t.edges().forEach(function(c){const o=t.edge(c);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(o),o),o.points.forEach(E=>E.y+=x/2);const b=K(h,c,o,l,n,t,r);Q(o,b)}),t.nodes().forEach(function(c){const o=t.node(c);s.info(c,o.type,o.diff),o.type==="group"&&(v=o.diff)}),{elem:u,diff:v}},Et=async(e,t,n,r,i)=>{U(e,n,r,i),Y(),Z(),ut(),nt(),s.warn("Graph at first:",JSON.stringify(y(t))),st(t),s.warn("Graph after:",JSON.stringify(y(t)));const a=T();await M(e,t,r,i,void 0,a)};export{Et as r};
|
|
1
|
+
import{G as A}from"./graph-CNR0SPWy.js";import{l as H}from"./layout-BvE2dc7G.js";import{i as N}from"./union-Cs-neO9A.js";import{c as V}from"./clone-_Vll1BLd.js";import{m as $}from"./zipObject-CW3NmqXn.js";import{i as U,u as W,s as _,a as q,b as z,f as D,e as O,d as K,p as Q,h as B,j as J,k as Y,m as Z}from"./edges-332bd1c7-EpC_kh1k.js";import{l as s,g as T,G as S,e as L}from"./index-BhUVktMi.js";import{c as I}from"./createText-d213de94-JzWc24xd.js";function y(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:tt(e),edges:et(e)};return N(e.graph())||(t.value=V(e.graph())),t}function tt(e){return $(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),i={v:t};return N(n)||(i.value=n),N(r)||(i.parent=r),i})}function et(e){return $(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return N(t.name)||(r.name=t.name),N(n)||(r.value=n),r})}let l={},g={},R={};const nt=()=>{g={},R={},l={}},p=(e,t)=>(s.trace("In isDescendant",t," ",e," = ",g[t].includes(e)),!!g[t].includes(e)),it=(e,t)=>(s.info("Descendants of ",t," is ",g[t]),s.info("Edge is ",e),e.v===t||e.w===t?!1:g[t]?g[t].includes(e.v)||p(e.v,t)||p(e.w,t)||g[t].includes(e.w):(s.debug("Tilt, ",t,",not in descendants"),!1)),P=(e,t,n,r)=>{s.warn("Copying children of ",e,"root",r,"data",t.node(e),r);const i=t.children(e)||[];e!==r&&i.push(e),s.warn("Copying (nodes) clusterId",e,"nodes",i),i.forEach(a=>{if(t.children(a).length>0)P(a,t,n,r);else{const d=t.node(a);s.info("cp ",a," to ",r," with parent ",e),n.setNode(a,d),r!==t.parent(a)&&(s.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==r&&a!==e?(s.debug("Setting parent",a,e),n.setParent(a,e)):(s.info("In copy ",e,"root",r,"data",t.node(e),r),s.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));const u=t.edges(a);s.debug("Copying Edges",u),u.forEach(f=>{s.info("Edge",f);const h=t.edge(f.v,f.w,f.name);s.info("Edge data",h,r);try{it(f,r)?(s.info("Copying as ",f.v,f.w,h,f.name),n.setEdge(f.v,f.w,h,f.name),s.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):s.info("Skipping copy of edge ",f.v,"-->",f.w," rootId: ",r," clusterId:",e)}catch(w){s.error(w)}})}s.debug("Removing node",a),t.removeNode(a)})},k=(e,t)=>{const n=t.children(e);let r=[...n];for(const i of n)R[i]=e,r=[...r,...k(i,t)];return r},C=(e,t)=>{s.trace("Searching",e);const n=t.children(e);if(s.trace("Searching children of id ",e,n),n.length<1)return s.trace("This is a valid node",e),e;for(const r of n){const i=C(r,t);if(i)return s.trace("Found replacement for",e," => ",i),i}},X=e=>!l[e]||!l[e].externalConnections?e:l[e]?l[e].id:e,st=(e,t)=>{if(!e||t>10){s.debug("Opting out, no graph ");return}else s.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(s.warn("Cluster identified",n," Replacement id in edges: ",C(n,e)),g[n]=k(n,e),l[n]={id:C(n,e),clusterData:e.node(n)})}),e.nodes().forEach(function(n){const r=e.children(n),i=e.edges();r.length>0?(s.debug("Cluster identified",n,g),i.forEach(a=>{if(a.v!==n&&a.w!==n){const d=p(a.v,n),u=p(a.w,n);d^u&&(s.warn("Edge: ",a," leaves cluster ",n),s.warn("Descendants of XXX ",n,": ",g[n]),l[n].externalConnections=!0)}})):s.debug("Not a cluster ",n,g)});for(let n of Object.keys(l)){const r=l[n].id,i=e.parent(r);i!==n&&l[i]&&!l[i].externalConnections&&(l[n].id=i)}e.edges().forEach(function(n){const r=e.edge(n);s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),s.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let i=n.v,a=n.w;if(s.warn("Fix XXX",l,"ids:",n.v,n.w,"Translating: ",l[n.v]," --- ",l[n.w]),l[n.v]&&l[n.w]&&l[n.v]===l[n.w]){s.warn("Fixing and trixing link to self - removing XXX",n.v,n.w,n.name),s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name);const d=n.w+"---"+n.v;e.setNode(d,{domId:d,id:d,labelStyle:"",labelText:r.label,padding:0,shape:"labelRect",style:""});const u=structuredClone(r),f=structuredClone(r);u.label="",u.arrowTypeEnd="none",f.label="",u.fromCluster=n.v,f.toCluster=n.v,e.setEdge(i,d,u,n.name+"-cyclic-special"),e.setEdge(d,a,f,n.name+"-cyclic-special")}else if(l[n.v]||l[n.w]){if(s.warn("Fixing and trixing - removing XXX",n.v,n.w,n.name),i=X(n.v),a=X(n.w),e.removeEdge(n.v,n.w,n.name),i!==n.v){const d=e.parent(i);l[d].externalConnections=!0,r.fromCluster=n.v}if(a!==n.w){const d=e.parent(a);l[d].externalConnections=!0,r.toCluster=n.w}s.warn("Fix Replacing with XXX",i,a,n.name),e.setEdge(i,a,r,n.name)}}),s.warn("Adjusted Graph",y(e)),G(e,0),s.trace(l)},G=(e,t)=>{if(s.warn("extractor - ",t,y(e),e.children("D")),t>10){s.error("Bailing out");return}let n=e.nodes(),r=!1;for(const i of n){const a=e.children(i);r=r||a.length>0}if(!r){s.debug("Done, no node has children",e.nodes());return}s.debug("Nodes = ",n,t);for(const i of n)if(s.debug("Extracting node",i,l,l[i]&&!l[i].externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),!l[i])s.debug("Not a cluster",i,t);else if(!l[i].externalConnections&&e.children(i)&&e.children(i).length>0){s.warn("Cluster without external connections, without a parent and with children",i,t);let d=e.graph().rankdir==="TB"?"LR":"TB";l[i]&&l[i].clusterData&&l[i].clusterData.dir&&(d=l[i].clusterData.dir,s.warn("Fixing dir",l[i].clusterData.dir,d));const u=new A({multigraph:!0,compound:!0}).setGraph({rankdir:d,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});s.warn("Old graph before copy",y(e)),P(i,e,u,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:l[i].clusterData,labelText:l[i].labelText,graph:u}),s.warn("New graph after copy node: (",i,")",y(u)),s.debug("Old graph after copy",y(e))}else s.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!l[i].externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),s.debug(l);n=e.nodes(),s.warn("New list of nodes",n);for(const i of n){const a=e.node(i);s.warn(" Now next level",i,a),a.clusterNode&&G(a.graph,t+1)}},F=(e,t)=>{if(t.length===0)return[];let n=Object.assign(t);return t.forEach(r=>{const i=e.children(r),a=F(e,i);n=[...n,...a]}),n},rt=e=>F(e,e.children()),at=(e,t)=>{s.info("Creating subgraph rect for ",t.id,t);const n=T(),r=e.insert("g").attr("class","cluster"+(t.class?" "+t.class:"")).attr("id",t.id),i=r.insert("rect",":first-child"),a=S(n.flowchart.htmlLabels),d=r.insert("g").attr("class","cluster-label"),u=t.labelType==="markdown"?I(d,t.labelText,{style:t.labelStyle,useHtmlLabels:a}):d.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}const h=0*t.padding,w=h/2,m=t.width<=f.width+h?f.width+h:t.width;t.width<=f.width+h?t.diff=(f.width-t.width)/2-t.padding/2:t.diff=-t.padding/2,s.trace("Data ",t,JSON.stringify(t)),i.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-m/2).attr("y",t.y-t.height/2-w).attr("width",m).attr("height",t.height+h);const{subGraphTitleTopMargin:v}=D(n);a?d.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2+v})`):d.attr("transform",`translate(${t.x}, ${t.y-t.height/2+v})`);const x=i.node().getBBox();return t.width=x.width,t.height=x.height,t.intersect=function(c){return B(t,c)},r},ct=(e,t)=>{const n=e.insert("g").attr("class","note-cluster").attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+i).attr("height",t.height+i).attr("fill","none");const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.intersect=function(u){return B(t,u)},n},ot=(e,t)=>{const n=T(),r=e.insert("g").attr("class",t.classes).attr("id",t.id),i=r.insert("rect",":first-child"),a=r.insert("g").attr("class","cluster-label"),d=r.append("rect"),u=a.node().appendChild(J(t.labelText,t.labelStyle,void 0,!0));let f=u.getBBox();if(S(n.flowchart.htmlLabels)){const c=u.children[0],o=L(u);f=c.getBoundingClientRect(),o.attr("width",f.width),o.attr("height",f.height)}f=u.getBBox();const h=0*t.padding,w=h/2,m=t.width<=f.width+t.padding?f.width+t.padding:t.width;t.width<=f.width+t.padding?t.diff=(f.width+t.padding*0-t.width)/2:t.diff=-t.padding/2,i.attr("class","outer").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w).attr("width",m+h).attr("height",t.height+h),d.attr("class","inner").attr("x",t.x-m/2-w).attr("y",t.y-t.height/2-w+f.height-1).attr("width",m+h).attr("height",t.height+h-f.height-3);const{subGraphTitleTopMargin:v}=D(n);a.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2-t.padding/3+(S(n.flowchart.htmlLabels)?5:3)+v})`);const x=i.node().getBBox();return t.height=x.height,t.intersect=function(c){return B(t,c)},r},lt=(e,t)=>{const n=e.insert("g").attr("class",t.classes).attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("class","divider").attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2).attr("width",t.width+i).attr("height",t.height+i);const d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.diff=-t.padding/2,t.intersect=function(u){return B(t,u)},n},ft={rect:at,roundedWithTitle:ot,noteGroup:ct,divider:lt};let j={};const dt=(e,t)=>{s.trace("Inserting cluster");const n=t.shape||"rect";j[t.id]=ft[n](e,t)},ut=()=>{j={}},M=async(e,t,n,r,i,a)=>{s.info("Graph in recursive render: XXX",y(t),i);const d=t.graph().rankdir;s.trace("Dir in recursive render - dir:",d);const u=e.insert("g").attr("class","root");t.nodes()?s.info("Recursive render XXX",t.nodes()):s.info("No nodes found for",t),t.edges().length>0&&s.trace("Recursive edges",t.edge(t.edges()[0]));const f=u.insert("g").attr("class","clusters"),h=u.insert("g").attr("class","edgePaths"),w=u.insert("g").attr("class","edgeLabels"),m=u.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(c){const o=t.node(c);if(i!==void 0){const b=JSON.parse(JSON.stringify(i.clusterData));s.info("Setting data for cluster XXX (",c,") ",b,i),t.setNode(i.id,b),t.parent(c)||(s.trace("Setting parent",c,i.id),t.setParent(c,i.id,b))}if(s.info("(Insert) Node XXX"+c+": "+JSON.stringify(t.node(c))),o&&o.clusterNode){s.info("Cluster identified",c,o.width,t.node(c));const b=await M(m,o.graph,n,r,t.node(c),a),E=b.elem;W(o,E),o.diff=b.diff||0,s.info("Node bounds (abc123)",c,o,o.width,o.x,o.y),_(E,o),s.warn("Recursive render complete ",E,o)}else t.children(c).length>0?(s.info("Cluster - the non recursive path XXX",c,o.id,o,t),s.info(C(o.id,t)),l[o.id]={id:C(o.id,t),node:o}):(s.info("Node - the non recursive path",c,o.id,o),await q(m,t.node(c),d))})),t.edges().forEach(function(c){const o=t.edge(c.v,c.w,c.name);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c)),s.info("Edge "+c.v+" -> "+c.w+": ",c," ",JSON.stringify(t.edge(c))),s.info("Fix",l,"ids:",c.v,c.w,"Translating: ",l[c.v],l[c.w]),z(w,o)}),t.edges().forEach(function(c){s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(c))}),s.info("#############################################"),s.info("### Layout ###"),s.info("#############################################"),s.info(t),H(t),s.info("Graph after layout:",y(t));let v=0;const{subGraphTitleTotalMargin:x}=D(a);return rt(t).forEach(function(c){const o=t.node(c);s.info("Position "+c+": "+JSON.stringify(t.node(c))),s.info("Position "+c+": ("+o.x,","+o.y,") width: ",o.width," height: ",o.height),o&&o.clusterNode?(o.y+=x,O(o)):t.children(c).length>0?(o.height+=x,dt(f,o),l[o.id].node=o):(o.y+=x/2,O(o))}),t.edges().forEach(function(c){const o=t.edge(c);s.info("Edge "+c.v+" -> "+c.w+": "+JSON.stringify(o),o),o.points.forEach(E=>E.y+=x/2);const b=K(h,c,o,l,n,t,r);Q(o,b)}),t.nodes().forEach(function(c){const o=t.node(c);s.info(c,o.type,o.diff),o.type==="group"&&(v=o.diff)}),{elem:u,diff:v}},Et=async(e,t,n,r,i)=>{U(e,n,r,i),Y(),Z(),ut(),nt(),s.warn("Graph at first:",JSON.stringify(y(t))),st(t),s.warn("Graph after:",JSON.stringify(y(t)));const a=T();await M(e,t,r,i,void 0,a)};export{Et as r};
|