erdbpro 3.4.7-rc.6 → 3.4.7-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/assets/AdminRoute-DST_3IUP.js +2 -0
  2. package/dist/assets/{Combination-DfHVVKYv.js → Combination-BREwCNuY.js} +1 -1
  3. package/dist/assets/ConfirmModal-td6IXKfM.js +1 -0
  4. package/dist/assets/{DataViewerModeToolbar-BqpDPrEJ.js → DataViewerModeToolbar-CLMZaq1D.js} +5 -5
  5. package/dist/assets/{DbClientEditorRoute-Btou3rtA.js → DbClientEditorRoute-Ci38MHkA.js} +1 -1
  6. package/dist/assets/{DiagramEditorRoute-Ba4Ht8L4.js → DiagramEditorRoute-BybThU4k.js} +1 -1
  7. package/dist/assets/DialogTrigger-t3YEWzZ3.js +12 -0
  8. package/dist/assets/DrawingEditorRoute-ByGHmRNT.js +2 -0
  9. package/dist/assets/{DrawingsView-k3XfZUBu.js → DrawingsView-D8glDkzo.js} +1 -1
  10. package/dist/assets/{ExcalidrawEditor-84AU-tN8.js → ExcalidrawEditor-Bpc4if6_.js} +8 -8
  11. package/dist/assets/{FlowchartEditorRoute-cx531yrn.js → FlowchartEditorRoute-CwCbs8Ge.js} +1 -1
  12. package/dist/assets/FlowchartView-bCG777et.js +37 -0
  13. package/dist/assets/JumpToNode-CsIEfKOc.js +1 -0
  14. package/dist/assets/NoteEditorRoute-_O40AM2L.js +2 -0
  15. package/dist/assets/NotesCompanionPane-BgmhMr03.js +2 -0
  16. package/dist/assets/NotesView-Bc1M73hO.js +174 -0
  17. package/dist/assets/{ProjectFileTabs-Csl84RbG.js → ProjectFileTabs-l0uAfLaH.js} +1 -1
  18. package/dist/assets/TeamInventoryRoute-aDYYSWRp.js +1 -0
  19. package/dist/assets/TeamManagementRoute-N1HbNo94.js +1 -0
  20. package/dist/assets/TrashView-DVF3jCHE.js +1 -0
  21. package/dist/assets/UserManagementRoute-BvqHtAAE.js +1 -0
  22. package/dist/assets/{WorkspaceProvider-B3JYfKkD.js → WorkspaceProvider-DRRcvif2.js} +3 -3
  23. package/dist/assets/{abnfDiagram-N423BO3Z-B8Poce6s.js → abnfDiagram-N423BO3Z-Bj1hwXhu.js} +1 -1
  24. package/dist/assets/{ar-SA-G6X2FPQ2-uZyS78H5.js → ar-SA-G6X2FPQ2-C3Z-nQuo.js} +1 -1
  25. package/dist/assets/{architectureDiagram-T3A2C74G-OTPxwMWp.js → architectureDiagram-T3A2C74G-D1XF7so6.js} +1 -1
  26. package/dist/assets/{az-AZ-76LH7QW2-DNRNnmaR.js → az-AZ-76LH7QW2-D1hq5LzZ.js} +1 -1
  27. package/dist/assets/{bg-BG-XCXSNQG7-CsORNyHV.js → bg-BG-XCXSNQG7-DDz26IRu.js} +1 -1
  28. package/dist/assets/{blockDiagram-VBNYF7ZC-VXiwoRfN.js → blockDiagram-VBNYF7ZC-BjrXf4Lx.js} +1 -1
  29. package/dist/assets/{bn-BD-2XOGV67Q-hM96dt-r.js → bn-BD-2XOGV67Q-DntJZuNN.js} +1 -1
  30. package/dist/assets/{c4Diagram-5PPSVZJV-Cgs3txCD.js → c4Diagram-5PPSVZJV-SJjATZxH.js} +1 -1
  31. package/dist/assets/{ca-ES-6MX7JW3Y-B_ovxJyb.js → ca-ES-6MX7JW3Y-HyKozy7T.js} +1 -1
  32. package/dist/assets/{calendar-BYCNAstj.js → calendar-Buen4kc1.js} +1 -1
  33. package/dist/assets/channel-PiqH2EIA.js +1 -0
  34. package/dist/assets/checkbox-Duz4tSop.js +1 -0
  35. package/dist/assets/{chunk-2GRJ4B5K-Bye0eI2Y.js → chunk-2GRJ4B5K-DxmnKQWO.js} +1 -1
  36. package/dist/assets/{chunk-4I5QYGJK-B8Tgn6yw.js → chunk-4I5QYGJK-CjtQRcsg.js} +1 -1
  37. package/dist/assets/{chunk-5RXB4S5H-CI4fcf8Q.js → chunk-5RXB4S5H-DndcRZlm.js} +1 -1
  38. package/dist/assets/{chunk-6Q2QTUOP-BxuMdiuP.js → chunk-6Q2QTUOP-Dzgr_4Ox.js} +1 -1
  39. package/dist/assets/{chunk-7Z6QIM7H-BD350yf2.js → chunk-7Z6QIM7H-DZHhMbeE.js} +1 -1
  40. package/dist/assets/{chunk-EIO257PC-a0G_QG8j.js → chunk-EIO257PC-BXmQMfy6.js} +1 -1
  41. package/dist/assets/{chunk-GF5L2VYU-D473UThd.js → chunk-GF5L2VYU-C_pjsgY5.js} +1 -1
  42. package/dist/assets/{chunk-I66GZJ75-BIkVtXXD.js → chunk-I66GZJ75-Du-egtlL.js} +1 -1
  43. package/dist/assets/{chunk-JQJVKLGR-BxDUGuJE.js → chunk-JQJVKLGR-D-es_GWU.js} +1 -1
  44. package/dist/assets/{chunk-KBJHAD2P-D-zXbjec.js → chunk-KBJHAD2P-BrVpNf_H.js} +1 -1
  45. package/dist/assets/{chunk-NSK5VX7P-BY8H2Bg5.js → chunk-NSK5VX7P-Cktj7w1S.js} +1 -1
  46. package/dist/assets/{chunk-QR6OTTB3-CRFb0R8N.js → chunk-QR6OTTB3-CuTncP5h.js} +1 -1
  47. package/dist/assets/{chunk-UBXNYLIW-C-e9-tg-.js → chunk-UBXNYLIW-3WmxOIwF.js} +1 -1
  48. package/dist/assets/{chunk-W5SLKNZC-DIQsCYPT.js → chunk-W5SLKNZC-DAcGTqwB.js} +1 -1
  49. package/dist/assets/{chunk-WRU74C26-BYtaW156.js → chunk-WRU74C26-lYPpjwnu.js} +1 -1
  50. package/dist/assets/classDiagram-JCYQIIEL-DOwiLxIp.js +1 -0
  51. package/dist/assets/classDiagram-v2-OCEON4UE-DOwiLxIp.js +1 -0
  52. package/dist/assets/composite-DpzKouN6.js +1 -0
  53. package/dist/assets/context-menu-CyVj69uQ.js +1 -0
  54. package/dist/assets/{cs-CZ-2BRQDIVT-D_3lRgm5.js → cs-CZ-2BRQDIVT-BaU2cgs_.js} +1 -1
  55. package/dist/assets/{cynefinDiagram-MW4NZA55-BcVvSIrc.js → cynefinDiagram-MW4NZA55-DgJ_7Npa.js} +1 -1
  56. package/dist/assets/{da-DK-5WZEPLOC-hUIpQFTa.js → da-DK-5WZEPLOC-CZPXvkUA.js} +1 -1
  57. package/dist/assets/{dagre-VZM6K2ZE-B1DdWiGT.js → dagre-VZM6K2ZE-DExKyNn2.js} +1 -1
  58. package/dist/assets/{de-DE-XR44H4JA-XmoqRynw.js → de-DE-XR44H4JA-C42bAW9l.js} +1 -1
  59. package/dist/assets/{diagram-7IWD3JNH-BrskQoKQ.js → diagram-7IWD3JNH-CYfYVInc.js} +1 -1
  60. package/dist/assets/{diagram-B4RE2ZJO-9CTmqywL.js → diagram-B4RE2ZJO-DAbTkPkl.js} +1 -1
  61. package/dist/assets/{diagram-LBJQPF4R-CieNw6hs.js → diagram-LBJQPF4R-DPt9FtMx.js} +1 -1
  62. package/dist/assets/{diagram-Q27KOJAE-B7LYHpal.js → diagram-Q27KOJAE-C1xebg4P.js} +1 -1
  63. package/dist/assets/{diagram-UB23O5K3-CWpQ2HS_.js → diagram-UB23O5K3-DWuhvwdK.js} +1 -1
  64. package/dist/assets/dialog-C4O82yNc.js +1 -0
  65. package/dist/assets/{dist-8gSbz68F.js → dist-DWm32btd.js} +4 -4
  66. package/dist/assets/{ebnfDiagram-BXEA7PRR-nQtXTcSF.js → ebnfDiagram-BXEA7PRR-BppQvfxv.js} +1 -1
  67. package/dist/assets/{el-GR-BZB4AONW-Ek4X3AN9.js → el-GR-BZB4AONW-DlMr1QNv.js} +1 -1
  68. package/dist/assets/{en-B4ZKOASM-DfCZOgwO.js → en-B4ZKOASM-CsR0DoS7.js} +1 -1
  69. package/dist/assets/{erDiagram-JOGREHBK-ChjAgCy0.js → erDiagram-JOGREHBK-DBAQqy4y.js} +1 -1
  70. package/dist/assets/erd-edge-style-NJXJJ5ej.js +1 -0
  71. package/dist/assets/{es-ES-U4NZUMDT-B0FgI9DS.js → es-ES-U4NZUMDT-WHSxMHnk.js} +1 -1
  72. package/dist/assets/{eu-ES-A7QVB2H4-Dhx0jTLu.js → eu-ES-A7QVB2H4-Bdeyw7dK.js} +1 -1
  73. package/dist/assets/{fa-IR-HGAKTJCU-C_UUI3y2.js → fa-IR-HGAKTJCU-CDbJ-TYj.js} +1 -1
  74. package/dist/assets/{fi-FI-Z5N7JZ37-BOHzAFWq.js → fi-FI-Z5N7JZ37-BWh-3CKN.js} +1 -1
  75. package/dist/assets/flowDiagram-UKHOOZJN-BJrbFSFd.js +1 -0
  76. package/dist/assets/{fr-FR-RHASNOE6-B78bLODE.js → fr-FR-RHASNOE6-GVGP0zmf.js} +1 -1
  77. package/dist/assets/{ganttDiagram-PKOTCBZU-D0OuRRjW.js → ganttDiagram-PKOTCBZU-CrBWGVDD.js} +1 -1
  78. package/dist/assets/{gitGraphDiagram-DS77QQ5N-lgmkGZar.js → gitGraphDiagram-DS77QQ5N-CQZHGqeL.js} +1 -1
  79. package/dist/assets/{gl-ES-HMX3MZ6V-BIdFIavW.js → gl-ES-HMX3MZ6V-Ck1Vmu8P.js} +1 -1
  80. package/dist/assets/{he-IL-6SHJWFNN-46Kf0BOj.js → he-IL-6SHJWFNN-5-9PhciM.js} +1 -1
  81. package/dist/assets/{hi-IN-IWLTKZ5I-CjiFeOvD.js → hi-IN-IWLTKZ5I-DG0US0FK.js} +1 -1
  82. package/dist/assets/{hu-HU-A5ZG7DT2-D_8-D6TC.js → hu-HU-A5ZG7DT2-CbSegLDJ.js} +1 -1
  83. package/dist/assets/{id-ID-SAP4L64H-B4GbkzfA.js → id-ID-SAP4L64H-VZzWpNg-.js} +1 -1
  84. package/dist/assets/image-GAAHSSAO-DEEriWi-.js +1 -0
  85. package/dist/assets/index-DjmEvvxm.css +1 -0
  86. package/dist/assets/{index-BBzr-Z2e.js → index-eaTZrxyp.js} +64 -64
  87. package/dist/assets/{infoDiagram-6WML65LV-yazkY6JU.js → infoDiagram-6WML65LV-CM4ntjpv.js} +1 -1
  88. package/dist/assets/input-CluuKyQT.js +1 -0
  89. package/dist/assets/{ishikawaDiagram-WSZJBQD7-DMPUC_68.js → ishikawaDiagram-WSZJBQD7-SfCNBhvc.js} +1 -1
  90. package/dist/assets/{it-IT-JPQ66NNP-CPLsTQ5y.js → it-IT-JPQ66NNP-B2ZchUfh.js} +1 -1
  91. package/dist/assets/{ja-JP-DBVTYXUO-Doc0RbSe.js → ja-JP-DBVTYXUO-Bv1UlT27.js} +1 -1
  92. package/dist/assets/{journeyDiagram-NVQOT4AX-DiJC4EDC.js → journeyDiagram-NVQOT4AX-BTt_pEMU.js} +1 -1
  93. package/dist/assets/{kaa-6HZHGXH3-D_1HR2j0.js → kaa-6HZHGXH3-8npzSm2a.js} +1 -1
  94. package/dist/assets/{kab-KAB-ZGHBKWFO-hXyrYvIl.js → kab-KAB-ZGHBKWFO-CaZcRM83.js} +1 -1
  95. package/dist/assets/{kanban-definition-27J2QSJJ-D-pYxMJP.js → kanban-definition-27J2QSJJ-D-G3OBet.js} +1 -1
  96. package/dist/assets/{kk-KZ-P5N5QNE5-D9q73ipv.js → kk-KZ-P5N5QNE5-CxQyKSyv.js} +1 -1
  97. package/dist/assets/{km-KH-HSX4SM5Z-BmUFAFXs.js → km-KH-HSX4SM5Z-V8OjL1Bl.js} +1 -1
  98. package/dist/assets/{ko-KR-MTYHY66A-DuQV-1LX.js → ko-KR-MTYHY66A-B0wXD7N4.js} +1 -1
  99. package/dist/assets/{ku-TR-6OUDTVRD-DVbJzfBx.js → ku-TR-6OUDTVRD-CMBKccMT.js} +1 -1
  100. package/dist/assets/{line-NOpRPczA.js → line-CrpWAl76.js} +1 -1
  101. package/dist/assets/{lt-LT-XHIRWOB4-B0V73KbQ.js → lt-LT-XHIRWOB4-DbvMd7cf.js} +1 -1
  102. package/dist/assets/{lv-LV-5QDEKY6T-DK_FQ972.js → lv-LV-5QDEKY6T-CcVyKrXT.js} +1 -1
  103. package/dist/assets/{message-scroller-yHGBqWZ5.js → message-scroller-C9C6EycB.js} +2 -2
  104. package/dist/assets/{mindmap-definition-FAOFIHXS-O4q16nFu.js → mindmap-definition-FAOFIHXS-mqp4ZTYN.js} +1 -1
  105. package/dist/assets/{mr-IN-CRQNXWMA-DUbjnE6q.js → mr-IN-CRQNXWMA-CNOOlQht.js} +1 -1
  106. package/dist/assets/{my-MM-5M5IBNSE-Bb-N1ZbE.js → my-MM-5M5IBNSE-DjkiaDat.js} +1 -1
  107. package/dist/assets/{nb-NO-T6EIAALU-FK3Stajy.js → nb-NO-T6EIAALU-Bd44Suvp.js} +1 -1
  108. package/dist/assets/{nl-NL-IS3SIHDZ-C_fFDL_A.js → nl-NL-IS3SIHDZ-SM_SkVLB.js} +1 -1
  109. package/dist/assets/{nn-NO-6E72VCQL-BjmE1AFr.js → nn-NO-6E72VCQL-DSKLyYDg.js} +1 -1
  110. package/dist/assets/{note-importer-498p1oiJ.js → note-importer-Dw1ql6-a.js} +2 -2
  111. package/dist/assets/{oc-FR-POXYY2M6-Ce4VN0G4.js → oc-FR-POXYY2M6-B4iIFHGK.js} +1 -1
  112. package/dist/assets/{pa-IN-N4M65BXN-CzFOISdV.js → pa-IN-N4M65BXN-Ds8L6qNK.js} +1 -1
  113. package/dist/assets/{pegDiagram-VL7TDLO6-BL1ArKqM.js → pegDiagram-VL7TDLO6-UgkfsYgb.js} +1 -1
  114. package/dist/assets/percentages-BXMCSKIN-CrLpL8B7.js +1 -0
  115. package/dist/assets/{pieDiagram-7S7Q4E2Y-pfHL1fE_.js → pieDiagram-7S7Q4E2Y-CuunvjrY.js} +1 -1
  116. package/dist/assets/{pl-PL-T2D74RX3-BDRXJ5M4.js → pl-PL-T2D74RX3-BMKppRd4.js} +1 -1
  117. package/dist/assets/{pt-BR-5N22H2LF-CUxI0q9p.js → pt-BR-5N22H2LF-CI8WUlHK.js} +1 -1
  118. package/dist/assets/{pt-PT-UZXXM6DQ-mHhGSsDB.js → pt-PT-UZXXM6DQ-Df5hggGE.js} +1 -1
  119. package/dist/assets/{quadrantDiagram-CIZ2JOQS-HkTCnqgb.js → quadrantDiagram-CIZ2JOQS-yEBOYISm.js} +1 -1
  120. package/dist/assets/{railroadDiagram-AXF67PYL-BdY7OFwC.js → railroadDiagram-AXF67PYL-Ln_Y4jCv.js} +1 -1
  121. package/dist/assets/{requirementDiagram-LRYGKXZP-aaUGPeby.js → requirementDiagram-LRYGKXZP-EA30r3fZ.js} +1 -1
  122. package/dist/assets/{ro-RO-JPDTUUEW-DEyx9WXx.js → ro-RO-JPDTUUEW-P3tfRtvz.js} +1 -1
  123. package/dist/assets/{ru-RU-B4JR7IUQ-D-d3GBgx.js → ru-RU-B4JR7IUQ-CA3cEi50.js} +1 -1
  124. package/dist/assets/{sankeyDiagram-W5VNT64P-CmQIo1u9.js → sankeyDiagram-W5VNT64P-CNKrECEO.js} +1 -1
  125. package/dist/assets/{scroll-area-CId4LtFA.js → scroll-area-BZW9Wzp1.js} +2 -2
  126. package/dist/assets/select-D-sac3DW.js +1 -0
  127. package/dist/assets/{sequenceDiagram-SI44F4Z6-CF97djWf.js → sequenceDiagram-SI44F4Z6-BvdjVQbA.js} +1 -1
  128. package/dist/assets/{si-LK-N5RQ5JYF-TSbFMf6t.js → si-LK-N5RQ5JYF-tM-3UppH.js} +1 -1
  129. package/dist/assets/{sk-SK-C5VTKIMK-D8NM5Gf_.js → sk-SK-C5VTKIMK-DC2X7DTF.js} +1 -1
  130. package/dist/assets/{sl-SI-NN7IZMDC-C8ZnYSLO.js → sl-SI-NN7IZMDC-jq0SAevq.js} +1 -1
  131. package/dist/assets/{stateDiagram-OKZ733FA-BeAY0pDU.js → stateDiagram-OKZ733FA-BZu09Xf-.js} +1 -1
  132. package/dist/assets/stateDiagram-v2-UEYNNEHI-ZjumyB9f.js +1 -0
  133. package/dist/assets/subset-shared.chunk-C1F3agk-.js +1 -0
  134. package/dist/assets/{subset-worker.chunk-Ba3BY_QD.js → subset-worker.chunk-MHoUNfZZ.js} +1 -1
  135. package/dist/assets/{sv-SE-XGPEYMSR-DWVcmsmU.js → sv-SE-XGPEYMSR-CkPEItbe.js} +1 -1
  136. package/dist/assets/{swimlanes-SLNWSIFB-DWAxqEjC.js → swimlanes-SLNWSIFB-DlZcUIAu.js} +1 -1
  137. package/dist/assets/swimlanesDiagram-ULZ7WXOC-D3f1dajS.js +8 -0
  138. package/dist/assets/{ta-IN-2NMHFXQM-DBWGbkTM.js → ta-IN-2NMHFXQM-DsTCk6yJ.js} +1 -1
  139. package/dist/assets/table-wBdalafB.js +1 -0
  140. package/dist/assets/{th-TH-HPSO5L25-aE9DQOfn.js → th-TH-HPSO5L25-BmHnp2Ey.js} +1 -1
  141. package/dist/assets/{timeline-definition-Z64GVDOM-CW0Ra74V.js → timeline-definition-Z64GVDOM-GE_aq93q.js} +1 -1
  142. package/dist/assets/{tr-TR-DEFEU3FU-LCkz0EyL.js → tr-TR-DEFEU3FU-e7sJYlFU.js} +1 -1
  143. package/dist/assets/{uk-UA-QMV73CPH-B_akEaRc.js → uk-UA-QMV73CPH-wkU-bdqU.js} +1 -1
  144. package/dist/assets/{useControlled-DHoxCuAI.js → useBaseUiId-zhXTYtFh.js} +1 -1
  145. package/dist/assets/useCompositeItem-Z-x4Q9MP.js +1 -0
  146. package/dist/assets/useControlled-CwUHqyRq.js +1 -0
  147. package/dist/assets/user-cog-plxf2Kur.js +1 -0
  148. package/dist/assets/{vennDiagram-T6HMQDX7-B5jw9VK4.js → vennDiagram-T6HMQDX7-CR6fe_9D.js} +1 -1
  149. package/dist/assets/{vi-VN-M7AON7JQ-DTs0NRuO.js → vi-VN-M7AON7JQ-DT02JT2G.js} +1 -1
  150. package/dist/assets/{wardleyDiagram-T6FBY63Y-C0VEr8Iu.js → wardleyDiagram-T6FBY63Y-BeUX_fEe.js} +1 -1
  151. package/dist/assets/{xychartDiagram-ELKLHX3M-dj3tPKgf.js → xychartDiagram-ELKLHX3M-7kum3OGb.js} +1 -1
  152. package/dist/assets/{zh-CN-LNUGB5OW-Ci0Ycvl1.js → zh-CN-LNUGB5OW-xn033ol4.js} +1 -1
  153. package/dist/assets/{zh-HK-E62DVLB3-o-wKsLux.js → zh-HK-E62DVLB3-DuJInGme.js} +1 -1
  154. package/dist/assets/{zh-TW-RAJ6MFWO-BieNHsDh.js → zh-TW-RAJ6MFWO-2tKoLdwh.js} +1 -1
  155. package/dist/index.html +18 -15
  156. package/dist-server/index.js +166 -166
  157. package/package.json +1 -1
  158. package/dist/assets/AdminRoute-B8TV02_x.js +0 -2
  159. package/dist/assets/ConfirmModal-BgBvZ2aq.js +0 -1
  160. package/dist/assets/DrawingEditorRoute-Cp189nIh.js +0 -2
  161. package/dist/assets/FlowchartView-DkrOsiGa.js +0 -37
  162. package/dist/assets/JumpToNode-DYDkCwXT.js +0 -1
  163. package/dist/assets/NoteEditorRoute-C286twjh.js +0 -2
  164. package/dist/assets/NotesCompanionPane-D-rWpsuf.js +0 -2
  165. package/dist/assets/NotesView-Dz5oFoYv.js +0 -172
  166. package/dist/assets/TeamManagementRoute-C1HSkjCo.js +0 -1
  167. package/dist/assets/TrashView-CpE54XLB.js +0 -1
  168. package/dist/assets/UserManagementRoute-B-Hlhc8X.js +0 -1
  169. package/dist/assets/channel-Ci94Sh82.js +0 -1
  170. package/dist/assets/checkbox-Tsi3FADL.js +0 -1
  171. package/dist/assets/classDiagram-JCYQIIEL-B-toy8Zz.js +0 -1
  172. package/dist/assets/classDiagram-v2-OCEON4UE-B-toy8Zz.js +0 -1
  173. package/dist/assets/context-menu-CRU3t6Gq.js +0 -1
  174. package/dist/assets/dialog-BDJ53r24.js +0 -12
  175. package/dist/assets/erd-edge-style-DHS651hG.js +0 -1
  176. package/dist/assets/flowDiagram-UKHOOZJN-CULYN8bf.js +0 -1
  177. package/dist/assets/image-GAAHSSAO-Bz4CdzJ_.js +0 -1
  178. package/dist/assets/index-CZCB8_YM.css +0 -1
  179. package/dist/assets/input-Cr-mF_hd.js +0 -1
  180. package/dist/assets/percentages-BXMCSKIN-D_eLW0KX.js +0 -1
  181. package/dist/assets/select-C3bXpw6O.js +0 -1
  182. package/dist/assets/stateDiagram-v2-UEYNNEHI-BYR69ghn.js +0 -1
  183. package/dist/assets/subset-shared.chunk-IRYoWIpm.js +0 -1
  184. package/dist/assets/swimlanesDiagram-ULZ7WXOC-eJuZnkcX.js +0 -8
  185. package/dist/assets/table-DCsJJ7Zs.js +0 -1
  186. package/dist/assets/useCompositeItem-dSQJByV3.js +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{u as r}from"./chunk-BV7QT456-CCzugQp2.js";import"./WorkspaceProvider-B3JYfKkD.js";import{n as i}from"./WorkspaceContext-O7njKDwj.js";import{fn as a}from"./index-BBzr-Z2e.js";import{FlowchartView as o}from"./FlowchartView-DkrOsiGa.js";import{t as s}from"./ProjectFileTabs-Csl84RbG.js";var c=e(t(),1),l=n();function u(){let e=i(),{id:t}=r(),{activeFlowchart:n,activeFlowchartId:u,handleFlowchartChange:d,isPublicView:f,isLoading:p,isFlowchartItemLoading:m,handleFlowchartSelect:h,saveFlowchart:g,triggerDebouncedSync:_}=e,v=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(!(f||!t)&&!v.current){if(String(u)===t){v.current=!0;return}u||(v.current=!0,h(t))}},[t,u,f,h]),!f&&!u?t&&!v.current?(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,l.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]}):(0,l.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,l.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a flowchart to view`})}):!n&&!m?(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(a,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,l.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Flowchart not found`}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This flowchart may have been deleted or is no longer available.`})]}):n?(0,l.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,l.jsx)(s,{currentView:`flowchart`}),(0,l.jsx)(o,{isLoading:m,activeFlowchartId:u,activeFlowchart:n,handleFlowchartChange:d,isReadOnly:f,saveFlowchart:g,triggerDebouncedSync:_})]}):(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,l.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]})}export{u as FlowchartEditorRoute};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{u as r}from"./chunk-BV7QT456-CCzugQp2.js";import"./WorkspaceProvider-DRRcvif2.js";import{n as i}from"./WorkspaceContext-O7njKDwj.js";import{fn as a}from"./index-eaTZrxyp.js";import{FlowchartView as o}from"./FlowchartView-bCG777et.js";import{t as s}from"./ProjectFileTabs-l0uAfLaH.js";var c=e(t(),1),l=n();function u(){let e=i(),{id:t}=r(),{activeFlowchart:n,activeFlowchartId:u,handleFlowchartChange:d,isPublicView:f,isLoading:p,isFlowchartItemLoading:m,handleFlowchartSelect:h,saveFlowchart:g,triggerDebouncedSync:_}=e,v=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(!(f||!t)&&!v.current){if(String(u)===t){v.current=!0;return}u||(v.current=!0,h(t))}},[t,u,f,h]),!f&&!u?t&&!v.current?(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,l.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]}):(0,l.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,l.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a flowchart to view`})}):!n&&!m?(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(a,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,l.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Flowchart not found`}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This flowchart may have been deleted or is no longer available.`})]}):n?(0,l.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,l.jsx)(s,{currentView:`flowchart`}),(0,l.jsx)(o,{isLoading:m,activeFlowchartId:u,activeFlowchart:n,handleFlowchartChange:d,isReadOnly:f,saveFlowchart:g,triggerDebouncedSync:_})]}):(0,l.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,l.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,l.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]})}export{u as FlowchartEditorRoute};
@@ -0,0 +1,37 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{a as r,c as i,h as a,i as o,l as s,m as c,n as l,p as u,r as d,s as f,t as p}from"./downloadSVG-CdP2B3Gf.js";import{a as m,h as ee,r as te}from"./esm-B1WURL1q.js";import{a as h,c as ne,d as g,i as _,l as v,n as y,o as b,s as x,t as S}from"./dialog-C4O82yNc.js";import{_ as C}from"./composite-DpzKouN6.js";import{i as w,n as T,o as E,s as D,t as O}from"./select-D-sac3DW.js";import{n as k}from"./dist-DDYEjsV2.js";import{t as A}from"./check-DcrFpa6g.js";import{d as re,p as j}from"./scroll-area-BZW9Wzp1.js";import{n as M,t as ie}from"./move-BlLS6EPB.js";import{n as ae,r as oe,t as se}from"./undo-2-DSs-RD2B.js";import{t as ce}from"./plus-CSlTmvRo.js";import{t as le}from"./trash-2-eV2xsHmQ.js";import{t as ue}from"./card-Dy6p8t6g.js";import{t as N}from"./input-CluuKyQT.js";import{n as de}from"./WorkspaceContext-O7njKDwj.js";import{t as P}from"./label-Co-it7VP.js";import{A as fe,C as pe,D as me,E as he,M as F,N as ge,P as _e,T as ve,Xt as ye,fn as be,j as xe,k as Se,w as Ce}from"./index-eaTZrxyp.js";/* empty css */import{t as we}from"./JumpToNode-CsIEfKOc.js";var I=e(t(),1),L=n(),R=(0,I.memo)(({data:e,selected:t})=>{let[n,r]=(0,I.useState)(!1),a=`!w-1.5 !h-1.5 !bg-white !border-none opacity-0 group-hover:opacity-100 transition-opacity z-20 cursor-crosshair`,o=(0,I.useMemo)(()=>{switch(e.shape){case`diamond`:return`min-w-[130px] min-h-[130px] p-8`;case`circle`:return`min-w-[110px] min-h-[110px] p-4`;case`cloud`:return`min-w-[160px] max-w-[240px] min-h-[90px] px-10 py-6`;case`database`:return`min-w-[140px] max-w-[220px] min-h-[100px] px-6 pt-10 pb-6`;case`parallelogram`:return`min-w-[160px] max-w-[240px] min-h-[80px] px-12 py-4`;case`oval`:return`min-w-[140px] max-w-[240px] min-h-[80px] px-10 py-4`;case`document`:return`min-w-[140px] max-w-[220px] min-h-[90px] px-8 pt-4 pb-10`;default:return`min-w-[140px] max-w-[240px] min-h-[80px] px-8 py-4`}},[e.shape]),s=(0,I.useMemo)(()=>{switch(e.shape){case`diamond`:return{width:100,height:100};case`circle`:return{width:80,height:80};default:return{width:100,height:60}}},[e.shape]),c=(0,I.useMemo)(()=>{let t={background:`linear-gradient(135deg, ${e.color}40 0%, ${e.color}10 100%)`,borderColor:e.color,borderWidth:`2px`,borderStyle:`solid`,boxShadow:`none`,transition:`all 0.3s cubic-bezier(0.4, 0, 0.2, 1)`},n=`${e.color}20`,r=e.color,i={filter:`none`,transition:`all 0.3s`};switch(e.shape){case`diamond`:return(0,L.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,L.jsx)(`path`,{d:`M50,2 L98,50 L50,98 L2,50 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i})});case`parallelogram`:return(0,L.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,L.jsx)(`path`,{d:`M20,2 L98,2 L80,98 L2,98 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i})});case`oval`:return(0,L.jsx)(`div`,{className:`absolute inset-0 rounded-[50px] pointer-events-none`,style:t});case`circle`:return(0,L.jsx)(`div`,{className:`absolute inset-0 rounded-full pointer-events-none flex items-center justify-center`,style:{...t,background:`radial-gradient(circle at 30% 30%, ${e.color}40 0%, ${e.color}10 100%)`}});case`database`:return(0,L.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,L.jsx)(`path`,{d:`M2,15 L2,85 C2,95 98,95 98,85 L98,15`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i}),(0,L.jsx)(`path`,{d:`M2,15 C2,5 98,5 98,15 C98,25 2,25 2,15 Z`,fill:`${e.color}35`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),(0,L.jsx)(`path`,{d:`M2,50 C2,60 98,60 98,50`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,opacity:`0.3`})]});case`document`:return(0,L.jsxs)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:[(0,L.jsx)(`path`,{d:`M2,2 L70,2 L98,30 L98,85 C98,93 90,98 85,98 L15,98 C7,98 2,93 2,85 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`,style:i}),(0,L.jsx)(`path`,{d:`M70,2 V30 H98`,fill:`none`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinejoin:`round`})]});case`cloud`:return(0,L.jsx)(`svg`,{className:`absolute inset-0 w-full h-full pointer-events-none overflow-visible`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,children:(0,L.jsx)(`path`,{d:`M20,80 C5,80 5,60 15,50 C10,20 40,15 55,25 C65,5 95,10 95,40 C105,50 105,80 80,80 Z`,fill:n,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,style:i})});default:return(0,L.jsx)(`div`,{className:`absolute inset-0 rounded-md pointer-events-none`,style:t})}},[e.color,e.shape,t]);return(0,L.jsxs)(`div`,{className:`relative group flex items-center justify-center cursor-pointer transition-all duration-300 hover:scale-[1.02] ${o}`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{aspectRatio:e.shape===`circle`?`1 / 1`:`auto`},children:[(0,L.jsx)(i,{isVisible:t||n,keepAspectRatio:e.shape===`circle`,minWidth:s.width,minHeight:s.height,handleStyle:{width:8,height:8,borderRadius:0,backgroundColor:`#0f0f14`,border:`1.5px solid ${e.color}`,zIndex:50},lineStyle:{border:`1px dashed ${e.color}80`}}),c,(0,L.jsx)(f,{id:`top`,type:`target`,position:m.Top,className:a}),(0,L.jsx)(f,{id:`top`,type:`source`,position:m.Top,className:a}),(0,L.jsx)(f,{id:`bottom`,type:`target`,position:m.Bottom,className:a}),(0,L.jsx)(f,{id:`bottom`,type:`source`,position:m.Bottom,className:a}),(0,L.jsx)(f,{id:`right`,type:`target`,position:m.Right,className:a}),(0,L.jsx)(f,{id:`right`,type:`source`,position:m.Right,className:a}),(0,L.jsx)(f,{id:`left`,type:`target`,position:m.Left,className:a}),(0,L.jsx)(f,{id:`left`,type:`source`,position:m.Left,className:a}),(0,L.jsx)(`div`,{className:`relative z-10 text-center text-sm font-semibold text-foreground wrap-break-word whitespace-pre-wrap max-w-full flex-1`,children:e.label}),e.section&&(0,L.jsx)(`div`,{className:`absolute -top-7 left-1/2 -translate-x-1/2 z-20 whitespace-nowrap text-[9px] font-medium text-muted-foreground/60 tracking-wider uppercase px-2 py-0.5 rounded-full bg-background/50 backdrop-blur-sm border border-border/30`,children:e.section})]})}),z=e=>e.trim().toLowerCase().includes(`start`);function Te({isOpen:e,onOpenChange:t,nodeData:n,onNodeDataChange:r,onConfirm:i}){let a=z(n.label);return(0,L.jsx)(S,{open:e,onOpenChange:t,children:(0,L.jsxs)(_,{className:`sm:max-w-sm`,children:[(0,L.jsxs)(x,{children:[(0,L.jsx)(v,{children:`Create New Symbol`}),(0,L.jsx)(h,{children:`Configure the symbol before placing it on the canvas.`})]}),(0,L.jsxs)(y,{className:`space-y-6`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Label`}),(0,L.jsx)(N,{value:n.label,onChange:e=>r({...n,label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted border-border text-foreground`})]}),a&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Group Title`}),(0,L.jsx)(N,{value:n.section||``,onChange:e=>r({...n,section:e.target.value||void 0}),placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted border-border text-foreground`}),(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Shape Type`}),(0,L.jsxs)(O,{value:n.shape,onValueChange:e=>r({...n,shape:e||n.shape}),children:[(0,L.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,L.jsx)(D,{placeholder:`Select a shape`,children:n.shape?F[n.shape]:`Select a shape`})}),(0,L.jsxs)(T,{className:`bg-popover border-border text-popover-foreground`,children:[(0,L.jsx)(w,{value:`rectangle`,children:`Rectangle (Process)`}),(0,L.jsx)(w,{value:`oval`,children:`Oval (Start/End)`}),(0,L.jsx)(w,{value:`diamond`,children:`Diamond (Decision)`}),(0,L.jsx)(w,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,L.jsx)(w,{value:`database`,children:`Cylinder (Database)`}),(0,L.jsx)(w,{value:`document`,children:`Document`}),(0,L.jsx)(w,{value:`cloud`,children:`Cloud (External System)`}),(0,L.jsx)(w,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Color`}),(0,L.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:fe.map(e=>(0,L.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.color===e?`border-white scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({...n,color:e})},e))})]})]}),(0,L.jsxs)(b,{children:[(0,L.jsx)(C,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,L.jsx)(C,{onClick:i,className:`bg-primary text-primary-foreground`,children:`Add to Flowchart`})]})]})})}function B(e){return e.data.label.trim().toLowerCase().includes(`start`)}function Ee({selectedNodeId:e,onClose:t,selectedNode:n,onUpdateNodeData:r,onDeleteNode:i,onDeleteGroup:a,onValidateSection:o}){let s=n?B(n):!1,[c,l]=(0,I.useState)(()=>n?n.data.code?n.data.code:n.data.shape===`diamond`?`return context.amount > 100 ? 'Yes' : 'No';`:`context.status = 'Approved';`:``),u=e=>{l(e),r({code:e})};return(0,L.jsx)(S,{open:!!e,onOpenChange:e=>{e||t()},children:(0,L.jsxs)(_,{className:`sm:max-w-sm`,children:[(0,L.jsxs)(x,{children:[(0,L.jsx)(v,{children:`Symbol Properties`}),(0,L.jsx)(h,{children:`Customize the name, shape, and color of this symbol.`})]}),n&&(0,L.jsxs)(y,{className:`space-y-6`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Label`}),(0,L.jsx)(N,{value:n.data.label,onChange:e=>r({label:e.target.value}),placeholder:`Enter symbol label`,className:`bg-muted/50 border-border text-foreground`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{className:`text-xs font-bold text-zinc-300`,children:`Code Logic (JavaScript)`}),(0,L.jsx)(`textarea`,{value:c,onChange:e=>u(e.target.value),placeholder:n.data.shape===`diamond`?`e.g. return context.amount > 100 ? 'Yes' : 'No';`:`e.g. context.status = 'Approved'; context.tries += 1;`,className:`w-full h-24 bg-muted border border-border rounded-md p-2 text-xs font-mono text-foreground placeholder:text-muted-foreground/50 resize-none focus:outline-none focus:border-ring`}),(0,L.jsxs)(`p`,{className:`text-[9px] text-muted-foreground/50 leading-normal`,children:[`Attached sandbox logic. For Decision diamonds, return the matching branch label (case-sensitive). Process symbols can mutate variables in the `,(0,L.jsx)(`code`,{children:`context`}),` object.`]})]}),s&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Group Title`}),(0,L.jsx)(N,{value:n.data.section||``,onChange:e=>r({section:e.target.value||void 0}),onBlur:e=>{let t=e.target.value;t&&o&&!o(t)&&r({section:void 0})},placeholder:`e.g. Pengajuan Cuti`,className:`bg-muted/50 border-border text-foreground`}),(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50`,children:`Nama grup untuk alur yang dimulai dari sini.`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Shape Type`}),(0,L.jsxs)(O,{value:n.data.shape,onValueChange:e=>e&&r({shape:e}),children:[(0,L.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,L.jsx)(D,{placeholder:`Select a shape`,children:n.data.shape?F[n.data.shape]:`Select a shape`})}),(0,L.jsxs)(T,{className:`bg-popover border-border text-popover-foreground`,children:[(0,L.jsx)(w,{value:`rectangle`,children:`Rectangle (Process)`}),(0,L.jsx)(w,{value:`oval`,children:`Oval (Start/End)`}),(0,L.jsx)(w,{value:`diamond`,children:`Diamond (Decision)`}),(0,L.jsx)(w,{value:`parallelogram`,children:`Parallelogram (Input/Output)`}),(0,L.jsx)(w,{value:`database`,children:`Cylinder (Database)`}),(0,L.jsx)(w,{value:`document`,children:`Document`}),(0,L.jsx)(w,{value:`cloud`,children:`Cloud (External System)`}),(0,L.jsx)(w,{value:`circle`,children:`Circle (Connector)`})]})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Color`}),(0,L.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:fe.map(e=>(0,L.jsx)(`button`,{className:`w-8 h-8 rounded-full border-2 transition-transform hover:scale-110 ${n.data.color===e?`border-white scale-110`:`border-transparent`}`,style:{backgroundColor:e},onClick:()=>r({color:e})},e))})]}),(0,L.jsxs)(`div`,{className:`pt-2 border-t border-border space-y-2`,children:[(0,L.jsxs)(C,{variant:`destructive`,size:`sm`,className:`w-full gap-2`,onClick:()=>{i(),t()},children:[(0,L.jsx)(le,{className:`size-4`}),`Delete Symbol`]}),s&&n.data.section&&a&&(0,L.jsxs)(C,{variant:`outline`,size:`sm`,className:`w-full gap-2 text-destructive border-destructive/30 hover:bg-destructive/10`,onClick:()=>{a(),t()},children:[(0,L.jsx)(le,{className:`size-4`}),`Delete Group "`,n.data.section,`"`]})]})]},e)]})})}function De({selectedEdgeId:e,onClose:t,selectedEdge:n,isDashed:r,arrowType:i,onEdgeTypeChange:a,onArrowChange:o,onLabelChange:s,onDeleteEdge:c}){return(0,L.jsx)(S,{open:!!e,onOpenChange:e=>{e||t()},children:(0,L.jsxs)(_,{className:`sm:max-w-sm`,children:[(0,L.jsx)(x,{children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,L.jsxs)(`div`,{className:`space-y-1 text-left`,children:[(0,L.jsx)(v,{children:`Connector Properties`}),(0,L.jsx)(h,{children:`Format the line style and arrows.`})]}),(0,L.jsx)(C,{variant:`ghost`,size:`icon`,onClick:c,className:`text-destructive hover:bg-destructive/10 -mr-2 shadow-none`,title:`Delete Connector`,children:(0,L.jsx)(le,{className:`w-4 h-4`})})]})}),n&&(0,L.jsxs)(y,{className:`space-y-6`,children:[(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Text Label`}),(0,L.jsx)(N,{value:typeof n.label==`string`?n.label:``,onChange:e=>s(e.target.value),placeholder:`e.g. Yes, No, 1, 2...`,className:`bg-muted border-border text-foreground`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Line Style`}),(0,L.jsxs)(O,{value:r?`dashed`:`solid`,onValueChange:e=>a(e||``),children:[(0,L.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,L.jsx)(D,{placeholder:`Select line style`,children:xe[r?`dashed`:`solid`]})}),(0,L.jsxs)(T,{className:`bg-popover border-border text-popover-foreground`,children:[(0,L.jsx)(w,{value:`solid`,children:`Solid Line`}),(0,L.jsx)(w,{value:`dashed`,children:`Dashed Line`})]})]})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(P,{children:`Arrow Style`}),(0,L.jsxs)(O,{value:i,onValueChange:e=>o(e||``),children:[(0,L.jsx)(E,{className:`w-full bg-muted border-border text-foreground`,children:(0,L.jsx)(D,{placeholder:`Select arrow style`,children:Se[i]})}),(0,L.jsxs)(T,{className:`bg-popover border-border text-popover-foreground`,children:[(0,L.jsx)(w,{value:`end`,children:`Arrow at End`}),(0,L.jsx)(w,{value:`start`,children:`Arrow at Start (Reverse)`}),(0,L.jsx)(w,{value:`both`,children:`Arrows Both Ends`}),(0,L.jsx)(w,{value:`none`,children:`No Arrows (Line only)`})]})]})]})]})]})})}function Oe({nodes:e,edges:t,onConfirm:n,onCancel:r,confirmLabel:i=`Confirm Append`,canvasGroups:a=[],existingNodes:o=[],existingEdges:s=[]}){let[c,l]=(0,I.useState)(null),u=(0,I.useMemo)(()=>{if(!o.length||!e.length)return null;let n=new Map;for(let e of o)n.set((e.data.label||``).toLowerCase(),e);let r=new Map;for(let t of e)r.set((t.data.label||``).toLowerCase(),t);let i=[];for(let t of e){let e=t.data.label||`Untitled`,r=n.get(e.toLowerCase());if(!r)i.push({type:`header`,label:e,isNew:!0}),i.push({type:`add`,prefix:`+`,field:`shape`,newVal:t.data.shape}),i.push({type:`add`,prefix:`+`,field:`label`,newVal:e}),t.data.color&&i.push({type:`add`,prefix:`+`,field:`color`,newVal:t.data.color});else{let n=r.data.shape!==t.data.shape,a=r.data.color!==t.data.color,o=(r.data.label||``)!==e;(n||a||o)&&(i.push({type:`header`,label:e}),o&&i.push({type:`change`,prefix:`~`,field:`label`,oldVal:r.data.label,newVal:e}),n&&i.push({type:`change`,prefix:`~`,field:`shape`,oldVal:r.data.shape,newVal:t.data.shape}),a&&i.push({type:`change`,prefix:`~`,field:`color`,oldVal:r.data.color,newVal:t.data.color}))}}for(let e of o){let t=e.data.label||``;r.has(t.toLowerCase())||(i.push({type:`header`,label:t,isNew:!1}),i.push({type:`remove`,prefix:`-`,field:`shape`,oldVal:e.data.shape}),i.push({type:`remove`,prefix:`-`,field:`removed`,oldVal:`entire node`}))}let a=new Set(s.map(e=>{let t=o.find(t=>t.id===e.source)?.data.label||e.source,n=o.find(t=>t.id===e.target)?.data.label||e.target;return`${t.toLowerCase()}→${n.toLowerCase()}`})),c=new Set(t.map(t=>{let n=e.find(e=>e.id===t.source)?.data.label||t.source,r=e.find(e=>e.id===t.target)?.data.label||t.target;return`${n.toLowerCase()}→${r.toLowerCase()}`})),l=[...c].filter(e=>!a.has(e)),u=[...a].filter(e=>!c.has(e));if(l.length>0||u.length>0){i.push({type:`header`,label:`Connections`});for(let e of l)i.push({type:`add`,prefix:`+`,field:`connection`,newVal:e});for(let e of u)i.push({type:`remove`,prefix:`-`,field:`connection`,oldVal:e})}return i.length>0?i:null},[o,s,e,t]);return(0,L.jsxs)(S,{open:!0,onOpenChange:e=>{e||r()},children:[(0,L.jsx)(ne,{}),(0,L.jsxs)(_,{size:`2xl`,showCloseButton:!0,children:[(0,L.jsx)(x,{children:(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`size-8 rounded-lg bg-indigo-500/10 flex items-center justify-center`,children:(0,L.jsx)(be,{className:`size-4 text-indigo-400`})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(v,{children:`Preview Changes`})})]})}),(0,L.jsx)(y,{children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.length>0&&(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsxs)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:[`New Symbols (`,e.length,`)`]}),(0,L.jsx)(`div`,{className:`max-h-75 overflow-y-auto custom-scrollbar space-y-2`,children:e.map(e=>(0,L.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-muted overflow-hidden`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-2 border-b border-border/20 bg-muted/50`,children:[(0,L.jsx)(be,{className:`size-3 text-indigo-400 shrink-0`}),(0,L.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.data.label}),(0,L.jsx)(`span`,{className:`text-[9px] text-muted-foreground ml-auto`,children:e.data.shape})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono`,children:[(0,L.jsx)(`span`,{className:`text-gray-500`,children:`Shape:`}),(0,L.jsx)(`span`,{className:`text-gray-300`,children:e.data.shape}),e.data.color&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`text-gray-500 ml-2`,children:`Color:`}),(0,L.jsx)(`span`,{className:`text-gray-300`,children:e.data.color})]})]})]},e.id))})]}),u&&(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsx)(`label`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Changes`}),(0,L.jsx)(`div`,{className:`rounded-lg border border-border/40 overflow-hidden max-h-75 overflow-y-auto custom-scrollbar text-[10px] font-mono leading-relaxed`,children:(0,L.jsx)(`div`,{className:`divide-y divide-border/10`,children:u.map((e,t)=>{if(e.type===`header`)return(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-muted border-b border-border/30`,children:[e.isNew&&(0,L.jsx)(`span`,{className:`text-[8px] font-semibold px-1 py-0.5 rounded bg-emerald-500/15 text-emerald-400 border border-emerald-500/30 shrink-0`,children:`NEW`}),(0,L.jsx)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.label})]},t);let n=e.type===`add`,r=e.type===`remove`,i=e.type===`change`,a=n?`bg-emerald-900/20`:r?`bg-red-900/20`:i?`bg-amber-900/20`:``,o=n?`text-emerald-400`:r?`text-red-400`:`text-amber-400`,s=n?`text-emerald-300`:r?`text-red-400`:`text-amber-300`,c=n?`text-emerald-400/60`:r?`text-red-400/60`:`text-amber-400/60`;return(0,L.jsxs)(`div`,{className:`flex items-center gap-1 px-3 py-0.5 ${a}`,children:[(0,L.jsx)(`span`,{className:`w-4 shrink-0 select-none ${o}`,children:e.prefix}),(0,L.jsx)(`span`,{className:`w-20 shrink-0 ${c}`,children:e.field}),e.oldVal&&(0,L.jsx)(`span`,{className:`text-red-400/70 line-through`,children:e.oldVal}),e.oldVal&&e.newVal&&(0,L.jsx)(`span`,{className:`text-gray-600`,children:`→`}),e.newVal&&(0,L.jsx)(`span`,{className:s,children:e.newVal})]},t)})})})]}),!u&&!e.length&&(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No changes detected.`})]})}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-6 pt-4 pb-6`,children:[(0,L.jsx)(`div`,{className:`flex items-center gap-3`,children:a.length>0&&(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(M,{className:`size-3.5 text-muted-foreground shrink-0`}),(0,L.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Replace:`}),(0,L.jsxs)(O,{value:c??``,onValueChange:e=>l(e||null),children:[(0,L.jsx)(E,{className:`h-7 text-[12px]`,children:(0,L.jsx)(D,{placeholder:`All Symbols`})}),(0,L.jsxs)(T,{children:[(0,L.jsx)(w,{value:``,children:`All Symbols`}),a.map(e=>(0,L.jsx)(w,{value:e,children:e},e))]})]})]})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsxs)(C,{variant:`outline`,size:`sm`,onClick:r,className:`gap-2`,children:[(0,L.jsx)(g,{className:`size-4`}),`Cancel`]}),(0,L.jsxs)(C,{size:`sm`,onClick:()=>n(c||void 0),className:`gap-2`,children:[(0,L.jsx)(A,{className:`size-4`}),i]})]})]})]})]})}function V(e){return[{x:e.x+80,y:e.y},{x:e.x+80,y:e.y+70},{x:e.x,y:e.y+35},{x:e.x+160,y:e.y+35}]}function H(e,t){return V(e)[[`top`,`bottom`,`left`,`right`].indexOf(t)]}function ke(e,t){let n=[`top`,`bottom`,`left`,`right`],r=V(e.position),i=V(t.position),a=1/0,o=0,s=0;for(let e=0;e<4;e++)for(let t=0;t<4;t++){let n=r[e].x-i[t].x,c=r[e].y-i[t].y,l=n*n+c*c;l<a&&(a=l,o=e,s=t)}return{sourceHandle:n[o],targetHandle:n[s]}}function Ae(e,t,n,r){if(t===`bottom`||t===`top`||r===`bottom`||r===`top`){let t=(e.y+n.y)/2;return`M${e.x},${e.y} L${e.x},${t} L${n.x},${t} L${n.x},${n.y}`}let i=(e.x+n.x)/2;return`M${e.x},${e.y} L${i},${e.y} L${i},${n.y} L${n.x},${n.y}`}function U(e,t,n){switch(e){case`diamond`:return`<polygon points="80,2 158,35 80,68 2,35" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`parallelogram`:return`<polygon points="32,2 158,2 128,68 2,68" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />`;case`oval`:return`<ellipse cx="80" cy="35" rx="78" ry="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`circle`:return`<circle cx="80" cy="35" r="33" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`;case`database`:return`<g>
2
+ <path d="M2,14 L2,56 C2,68 158,68 158,56 L158,14" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" filter="url(#shadow)" />
3
+ <ellipse cx="80" cy="14" rx="78" ry="10.5" fill="${t}30" stroke="${t}" stroke-width="2" filter="url(#shadow)" />
4
+ <path d="M2,35 C2,45.5 158,45.5 158,35" fill="none" stroke="${t}" stroke-width="2" opacity="0.3" />
5
+ </g>`;case`document`:return`<g filter="url(#shadow)">
6
+ <path d="M2,2 L112,2 L158,21 L158,68 L2,68 Z" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linejoin="round" />
7
+ <path d="M112,2 V21 H158" fill="none" stroke="${t}" stroke-width="2" stroke-linejoin="round" />
8
+ </g>`;case`cloud`:return`<path d="M40,68 Q2,66 2,38.5 Q2,14 72,17.5 Q64,2 104,14 Q158,10.5 158,31.5 Q158,52.5 120,56 Q112,68 40,68 Z" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" filter="url(#shadow)" />`;default:return`<rect x="2" y="2" width="156" height="66" rx="6" ry="6" fill="url(#grad-${n})" stroke="${t}" stroke-width="2" filter="url(#shadow)" />`}}function je(e,t){if(e.length===0)return``;let n=e.map(e=>e.position.x),r=e.map(e=>e.position.y),i=Math.min(...n),a=Math.min(...r),o=Math.max(...n)+160,s=Math.max(...r)+70,c=o-i+80,l=s-a+80,u=i-40,d=a-40,f=new Map(e.map(e=>[e.id,e])),p=t.map(e=>{let t=f.get(e.source),n=f.get(e.target);if(!t||!n)return``;let r=e.sourceHandle&&e.targetHandle?{sourceHandle:e.sourceHandle,targetHandle:e.targetHandle}:ke(t,n),i=H(t.position,r.sourceHandle),a=H(n.position,r.targetHandle),o=Ae(i,r.sourceHandle,a,r.targetHandle),s=(i.x+a.x)/2,c=(i.y+a.y)/2,l=``;return e.label&&(l=`<text x="${s}" y="${c-8}" text-anchor="middle" fill="#e8e8ec" stroke="#0f0f14" stroke-width="3" paint-order="stroke" font-size="11" font-weight="600">${W(String(e.label))}</text>`),`<g>
9
+ <path d="${o}" fill="none" stroke="#6b6b73" stroke-width="2" stroke-linejoin="round" marker-end="url(#arrow)" />
10
+ ${l}
11
+ </g>`}).join(`
12
+ `);return`<?xml version="1.0" encoding="UTF-8"?>
13
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="${u} ${d} ${c} ${l}" width="${c}" height="${l}">
14
+ <defs>
15
+ <marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto">
16
+ <path d="M0,0 L10,5 L0,10 Z" fill="#6b6b73" />
17
+ </marker>
18
+ <filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
19
+ <feDropShadow dx="0" dy="4" stdDeviation="10" flood-color="#000" flood-opacity="0.3" />
20
+ </filter>
21
+ ${[...new Set(e.map(e=>e.data.color||`#8b5cf6`))].map(e=>`<linearGradient id="grad-${e.replace(`#`,``)}" x1="0" y1="0" x2="1" y2="1">
22
+ <stop offset="0%" stop-color="${e}" stop-opacity="0.15" />
23
+ <stop offset="100%" stop-color="${e}" stop-opacity="0.06" />
24
+ </linearGradient>`).join(`
25
+ `)}
26
+ </defs>
27
+ <rect x="${u}" y="${d}" width="${c}" height="${l}" fill="#0f0f14" />
28
+ ${p}
29
+ ${e.map(e=>{let t=e.position.x,n=e.position.y,r=e.data.color||`#8b5cf6`,i=e.data.shape||`rectangle`,a=r.replace(`#`,``),o=[`top`,`bottom`,`left`,`right`].map(e=>{let r=H({x:t,y:n},e);return`<circle cx="${r.x}" cy="${r.y}" r="2.5" fill="#888" opacity="0.5" />`}).join(`
30
+ `),s=e.data.section?`<text x="${t+80}" y="${n-12}" text-anchor="middle" fill="#9ca3af" font-size="9" font-weight="500" letter-spacing="1" text-transform="uppercase">${W(e.data.section)}</text>`:``;return`<g>
31
+ ${o}
32
+ ${U(i,r,a)}
33
+ <text x="${t+80}" y="${n+35+5}" text-anchor="middle" fill="#e8e8ec" font-size="13" font-weight="600">${W(e.data.label)}</text>
34
+ ${s}
35
+ </g>`}).join(`
36
+ `)}
37
+ </svg>`}function W(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`)}var Me={custom:R},Ne={type:`smoothstep`,style:{stroke:`#b1b1b7`},markerEnd:{type:te.ArrowClosed,color:`#b1b1b7`}};function Pe({nodes:e,edges:t,filename:n,onCancel:r}){let{resolvedTheme:i}=de(),a=i===`dark`?`#222`:`#ccc`,[c]=(0,I.useState)(e),[l]=(0,I.useState)(t),f=(0,I.useCallback)(()=>{},[]),m=(0,I.useCallback)(()=>{},[]),ee=(0,I.useCallback)(()=>{let e=je(c,l);if(!e){k.error(`No nodes to export`);return}p(e,n),k.success(`Flowchart exported as SVG`),r()},[c,l,n,r]);return(0,L.jsx)(S,{open:!0,onOpenChange:e=>{e||r()},children:(0,L.jsxs)(_,{className:`sm:max-w-3xl h-[600px]`,children:[(0,L.jsx)(x,{children:(0,L.jsx)(v,{children:`Export Flowchart`})}),(0,L.jsxs)(y,{className:`flex-1 flex flex-col min-h-0`,children:[(0,L.jsx)(`div`,{className:`flex-1 rounded-lg border border-border overflow-hidden bg-muted/10 mb-4 relative`,children:(0,L.jsx)(s,{children:(0,L.jsx)(u,{nodes:c,edges:l,onNodesChange:f,onEdgesChange:m,nodeTypes:Me,defaultEdgeOptions:Ne,fitView:!0,colorMode:i,onlyRenderVisibleElements:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,minZoom:.1,maxZoom:2.5,panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,children:(0,L.jsx)(d,{variant:o.Lines,gap:50,size:1,color:a})})})}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:`Preview`})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsxs)(C,{variant:`outline`,onClick:r,className:`gap-2`,children:[(0,L.jsx)(g,{className:`size-4`}),`Cancel`]}),(0,L.jsxs)(C,{onClick:ee,className:`gap-2`,children:[(0,L.jsx)(j,{className:`size-4`}),`Download SVG`]})]})]})]})]})})}var Fe=80,G=80,K=240,Ie=150,q=64,Le=72;function J(e){return(e||``).trim().toLowerCase()}function Y(e){let t=J(e.data.label);return t.includes(`start`)||t.includes(`begin`)}function Re(e){let t=J(e.data.label);return t.includes(`end`)||t.includes(`finish`)||t.includes(`done`)||t.includes(`stop`)}function X(e){return e.data.shape===`diamond`}function ze(e){let t=(e.data.label||``).trim().length,n=e.data.shape,r=(()=>{switch(n){case`diamond`:return{width:130,height:130,wrap:12};case`circle`:return{width:110,height:110,wrap:10};case`cloud`:return{width:170,height:96,wrap:16};case`database`:return{width:150,height:104,wrap:16};case`parallelogram`:return{width:170,height:86,wrap:16};case`document`:return{width:150,height:96,wrap:16};case`oval`:return{width:150,height:84,wrap:15};default:return{width:150,height:84,wrap:16}}})(),i=Math.max(0,Math.ceil(t/r.wrap)-1)*18,a=n===`diamond`?Math.min(48,Math.max(0,t-r.wrap)*3):Math.min(64,Math.max(0,t-r.wrap*1.5)*2.5);return{width:r.width+a,height:r.height+i}}function Be(e){let t=ze(e);return{x:e.position.x+t.width/2,y:e.position.y+t.height/2}}function Ve(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`}}function He(e,t,n){let r=J(n);if(X(e)){if(r===`yes`)return`right`;if(r===`no`)return`left`}let i=Be(e),a=Be(t),o=a.x-i.x,s=a.y-i.y;return Math.abs(o)>Math.abs(s)*1.05?o>=0?`right`:`left`:s>=0?`bottom`:`top`}function Ue(e,t,n){let r=He(e,t,n);return{sourceHandle:r,targetHandle:Ve(r)}}function We(e,t,n,r){let i=[...t];return X(e)?(i.sort((t,i)=>{let a=J(n.get(`${e.id}->${t}`)),o=J(n.get(`${e.id}->${i}`)),s=a===`yes`?0:a===`no`?1:2,c=o===`yes`?0:o===`no`?1:2;if(s!==c)return s-c;let l=r.get(t),u=r.get(i),d=Y(l)?-1:+!!Re(l),f=Y(u)?-1:+!!Re(u);return d===f?(l?.data.label||``).localeCompare(u?.data.label||``):d-f}),i):(i.sort((e,t)=>{let n=r.get(e),i=r.get(t),a=Y(n)?-1:+!!Re(n),o=Y(i)?-1:+!!Re(i);return a===o?(n?.data.label||``).localeCompare(i?.data.label||``):a-o}),i)}function Ge(e,t,n,r){let i=Math.round(n),a=n=>{let r=e.get(t);return!r||!r.has(n)?n:null},o=r===0?1:r,s=[0];for(let e=1;e<=40;e++)r===0?s.push(e,-e):s.push(e*o,-e*o);for(let e of s){let t=a(i+e);if(t!=null)return t}return i}function Ke(e){let t=[];for(let n=0;n<e;n++)if(n===0)t.push(1);else if(n===1)t.push(-1);else{let e=Math.ceil(n/2);t.push(n%2==0?e+1:-(e+1))}return t}function qe(e,t){if(e.length===0)return{nodes:[],edges:[]};let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=new Map,a=new Map;for(let t of e)r.set(t.id,[]),i.set(t.id,[]);for(let e of t){let t=e.source,n=e.target;!r.has(t)||!i.has(n)||(r.get(t).push(n),i.get(n).push(t),a.set(`${t}->${n}`,e.label?String(e.label):``))}let o=e.filter(e=>i.get(e.id)?.length===0&&Y(e)).map(e=>e.id);if(o.length===0){let t=e.filter(e=>i.get(e.id)?.length===0).map(e=>e.id);t.length>0&&o.push(...t)}o.length===0&&e.length>0&&o.push(e[0].id);let s=new Set,c=new Set,l=new Set;function u(e){s.add(e),c.add(e);for(let t of r.get(e)||[])c.has(t)?l.add(`${e}->${t}`):s.has(t)||u(t);c.delete(e)}for(let e of o)s.has(e)||u(e);for(let t of e)s.has(t.id)||u(t.id);let d=new Map;function f(e){if(d.has(e))return d.get(e);let t=(i.get(e)||[]).filter(t=>!l.has(`${t}->${e}`));if(t.length===0)return d.set(e,0),0;let n=Math.max(...t.map(f))+1;return d.set(e,n),n}let p=new Map;for(let t of e){let e=f(t.id);p.has(e)||p.set(e,[]),p.get(e).push(t.id)}let m=new Map,ee=0;for(let t of e){let e=ze(t);ee=Math.max(ee,e.width);let n=f(t.id),r=m.get(n)||0;m.set(n,Math.max(r,e.height))}let h=Math.max(ee+q,K),ne=new Map,g=[...p.keys()].sort((e,t)=>e-t);for(let e of g){let t=m.get(e)||0;ne.set(e,Math.max(t+Le,Ie))}let _=new Map,v=new Map,y=new Map;function b(e,t){v.has(e)||v.set(e,new Set),v.get(e).add(t)}function x(e,t,n=0){let r=f(e),i=Ge(v,r,t,n);return _.set(e,i),b(r,i),i}function S(e,t,i=0){if(_.has(e))return;let o=x(e,t,y.get(e)??i),s=n.get(e);if(!s)return;let c=(r.get(e)||[]).filter(t=>!l.has(`${e}->${t}`));if(c.length===0)return;let u=We(s,c,a,n);if(X(s)){let t=u.find(t=>J(a.get(`${e}->${t}`))===`yes`),n=u.find(t=>J(a.get(`${e}->${t}`))===`no`),r=u.filter(e=>e!==t&&e!==n);t&&(y.set(t,1),S(t,o+1,1)),n&&(y.set(n,-1),S(n,o-1,-1));let i=r,s=Ke(i.length);i.forEach((e,t)=>{let n=s[t],r=n>0?1:n<0?-1:0;y.set(e,r),S(e,o+n,r)});return}if(u.length===1){let e=u[0];y.has(e)||y.set(e,0),S(e,o,y.get(e)??0);return}let d=Ke(u.length);u.forEach((e,t)=>{let n=d[t],r=n>0?1:n<0?-1:0;y.has(e)||y.set(e,r),S(e,o+n,r)})}let C=[...o].sort((e,t)=>{let r=n.get(e)?.data.label||``,i=n.get(t)?.data.label||``,a=Y(n.get(e))?-1:0,o=Y(n.get(t))?-1:0;return a===o?r.localeCompare(i):a-o}),w=C.length===1?[0]:[0,1,-1,2,-2,3,-3];C.forEach((e,t)=>{let n=w[t]??0;y.has(e)||y.set(e,0),S(e,n*2,0)});for(let t of e)if(!_.has(t.id)){let e=(i.get(t.id)||[]).filter(e=>_.has(e)),n=e.length>0?e.reduce((e,t)=>e+(_.get(t)||0),0)/e.length:0,r=e.length>0?Math.sign(e.reduce((e,t)=>e+(y.get(t)||0),0)):0;S(t.id,n,r)}for(let t of e){let e=(i.get(t.id)||[]).filter(e=>_.has(e));if(e.length>=2){let n=e.map(e=>_.get(e)||0),r=n.reduce((e,t)=>e+t,0)/n.length,i=Math.round(r),a=f(t.id),o=_.get(t.id);o!=null&&o!==i&&!v.get(a)?.has(i)&&(v.get(a)?.delete(o),b(a,i),_.set(t.id,i))}}let T=Math.min(..._.values(),0),E=new Map;for(let[e,t]of _)E.set(e,t-T);let D=G,O=new Map;for(let e of g)O.set(e,D),D+=(ne.get(e)||Ie)+18;let k=e.map(e=>{let t=f(e.id),n=ze(e),r=E.get(e.id)??0;return{...e,position:{x:Fe+r*h,y:O.get(t)??G},style:{...e.style,width:n.width,height:n.height}}}),A=new Map(k.map(e=>[e.id,e]));return{nodes:k,edges:t.map((e,t)=>{let n=A.get(e.source),r=A.get(e.target);if(!n||!r)return e;let i=Ue(n,r,e.label?String(e.label):``);return{...e,id:e.id||`flowchart_edge_${t}`,sourceHandle:i.sourceHandle,targetHandle:i.targetHandle,type:e.type||`smoothstep`,markerEnd:e.markerEnd||{type:te.ArrowClosed,color:`#b1b1b7`}}})}}var Je={custom:R},Ye=I.memo(({activeFlowchartId:e,activeFlowchart:t,handleFlowchartChange:n,isReadOnly:i=!1,isLoading:s=!1,saveFlowchart:f,triggerDebouncedSync:p,companionMode:m=!1})=>{let{registerContentHandler:h,setActionContextData:ne}=re(),[g,_,v]=a([]),[y,b,x]=c([]),[S,A]=(0,I.useState)(null),[j,M]=(0,I.useState)(null),[le,N]=(0,I.useState)(null),[P,fe]=(0,I.useState)(null),[F,be]=(0,I.useState)({x:0,y:0,zoom:1}),[xe,Se]=(0,I.useState)(!1),[R,z]=(0,I.useState)(null),[B,V]=(0,I.useState)(null),[H,ke]=(0,I.useState)({label:`New Symbol`,shape:`rectangle`,color:`#8b5cf6`}),Ae=I.useRef(!0),U=I.useRef(!1),je=I.useRef(!1),W=I.useRef(!1),Me=I.useRef(e),Ne=I.useRef(!1),Fe=I.useRef(!1),G=I.useRef(g),K=I.useRef(y),Ie=I.useRef(new Set),{takeSnapshot:q,undo:Le,redo:J,canUndo:Y,canRedo:Re}=l(),X=I.useRef(`append`),ze=(0,I.useCallback)(()=>{if(g.length===0)return;let e=qe(g,y);q(G.current,K.current),_(e.nodes),b(e.edges)},[g,y,_,b,q]);G.current=g,K.current=y;let Be=e=>{if(!e)return null;if(typeof e==`object`)return e;if(typeof e!=`string`)return null;try{return JSON.parse(e)}catch{return null}},Ve=s&&(!t||!t.data);(0,I.useEffect)(()=>{U.current=!0,Ae.current=!0;try{let n=Be(t.data)||{nodes:[],edges:[]},r=localStorage.getItem(`pending_create_flowchart_json`)||localStorage.getItem(`pending_update_flowchart_json`),i=n.nodes&&n.nodes.length>0?n.nodes:r||W.current?[]:_e,a=n.edges&&n.edges.length>0?n.edges:r||W.current?[]:ge;W.current||(_(i),b(a)),Me.current!==e&&(Me.current=e,W.current=!1,A(null),M(null))}catch{let e=localStorage.getItem(`pending_create_flowchart_json`)||localStorage.getItem(`pending_update_flowchart_json`);W.current||(_(e?[]:_e),b(e?[]:ge))}let n=setTimeout(()=>{U.current=!1,Ae.current=!1},2e3);return()=>{clearTimeout(n),U.current=!1}},[e,t.data]);let He=I.useRef(n);(0,I.useEffect)(()=>{He.current=n},[n]),(0,I.useEffect)(()=>{Ae.current||U.current||je.current||Ne.current||Fe.current||(g.length>0||y.length>0)&&He.current(g,y)},[g,y]);let Ue=(0,I.useCallback)(()=>{je.current=!0},[]),We=(0,I.useCallback)(()=>{je.current=!1,(G.current.length>0||K.current.length>0)&&He.current(G.current,K.current)},[]),Ge=(0,I.useMemo)(()=>({type:`smoothstep`,reconnectable:!0,style:{stroke:`#b1b1b7`},markerEnd:{type:te.ArrowClosed,color:`#b1b1b7`}}),[]),Ke=(0,I.useCallback)(e=>{q(G.current,K.current),b(t=>ee({...e,type:`smoothstep`,style:{stroke:`#b1b1b7`},markerEnd:{type:te.ArrowClosed,color:`#b1b1b7`},animated:!1},t))},[b,q]),Ye=(0,I.useCallback)((e,t)=>{b(n=>n.map(n=>n.id===e.id?{...n,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}:n)),q(G.current,K.current)},[b,q]),Xe=()=>{q(G.current,K.current);let e=Math.random().toString(36).substring(2,11),t={...H};t.label.trim().toLowerCase()===`start`&&!t.groupId&&(t.groupId=`grp_${Math.random().toString(36).substring(2,8)}`);let n={id:e,type:`custom`,position:{x:window.innerWidth/2-200,y:window.innerHeight/2-100},data:t};_(e=>e.concat(n)),Se(!1)},Ze=e=>{S&&(q(G.current,K.current),_(t=>t.map(t=>t.id===S?{...t,data:{...t.data,...e}}:t)))},Qe=(0,I.useCallback)(e=>{let t=e.trim();return!t||!g.some(e=>e.id!==S&&e.data.section?.toLowerCase()===t.toLowerCase())||(k.error(`Group title already exists`,{description:`Another group is already named "${t}". Each group must have a unique title.`}),!1)},[g,S]),Z=e=>{j&&(q(G.current,K.current),b(t=>t.map(t=>t.id===j?{...t,...e}:t)))},$e=()=>{if(!S)return;q(G.current,K.current);let e=[S];_(t=>t.filter(t=>!e.includes(t.id))),b(t=>t.filter(t=>!e.includes(t.source)&&!e.includes(t.target))),A(null)},et=()=>{let e=g.find(e=>e.id===S);if(!e||!e.data.section)return;q(G.current,K.current);let t=e.data.section,n=g.filter(e=>e.data.section===t).map(e=>e.id);if(n.length===0)return;let r=new Set(n),i=[...n];for(;i.length>0;){let e=i.shift();for(let t of y)t.source===e&&!r.has(t.target)&&(r.add(t.target),i.push(t.target))}let a=[...r];_(e=>e.filter(e=>!a.includes(e.id))),b(e=>e.filter(e=>!a.includes(e.source)&&!a.includes(e.target))),A(null)},tt=()=>{j&&(q(G.current,K.current),b(e=>e.filter(e=>e.id!==j)),M(null))},nt=I.useRef(j),rt=I.useRef(S);(0,I.useEffect)(()=>{Ne.current=j!==null,Fe.current=S!==null;let e=nt.current!==null&&j===null,t=rt.current!==null&&S===null;nt.current=j,rt.current=S,(e||t)&&!Ae.current&&!U.current&&(g.length>0||y.length>0)&&He.current(g,y)},[j,S]),(0,I.useEffect)(()=>{let e=e=>{if(i)return;let t=e.target;if(!(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)&&!t.hasAttribute?.(`data-keyboard-trap`)&&(e.key===`Delete`||e.key===`Backspace`)){if(S){$e();return}if(j){tt();return}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,j,i]);let it=g.find(e=>e.id===S),Q=y.find(e=>e.id===j),at=Q?.animated===!0||Q?.style?.strokeDasharray===`5,5`,ot=`end`;Q?.markerStart&&Q?.markerEnd?ot=`both`:Q?.markerStart&&!Q?.markerEnd?ot=`start`:!Q?.markerStart&&!Q?.markerEnd&&(ot=`none`);let st=e=>{Z(e===`dashed`?{animated:!1,style:{...Q?.style,strokeDasharray:`5,5`}}:{animated:!1,style:{...Q?.style,strokeDasharray:void 0}})},ct=e=>{let t=Q?.style?.stroke||`#b1b1b7`,n={type:te.ArrowClosed,color:t};e===`none`?Z({markerStart:void 0,markerEnd:void 0}):e===`start`?Z({markerStart:n,markerEnd:void 0}):e===`end`?Z({markerStart:void 0,markerEnd:n}):e===`both`&&Z({markerStart:n,markerEnd:n})},lt=e=>{e.trim()===``?Z({label:void 0}):Z({label:e,labelBgStyle:{fill:`var(--popover)`},labelStyle:{fill:`var(--popover-foreground)`}})},{setFlowchartExportHandler:ut,resolvedTheme:dt}=de(),ft=dt===`dark`?`#222`:`#ccc`,pt=e=>{let n=t?.title?.replace(/[^a-zA-Z0-9_-]/g,`_`)||`flowchart`;return e?`${n}-${e}`:n},mt=(0,I.useCallback)(()=>{let e=G.current,t=K.current;if(e.length===0){k.error(`No nodes to export`);return}V({nodes:e,edges:t,filename:pt()})},[]),ht=(0,I.useCallback)(e=>{let t=new Set(G.current.filter(t=>t.data.section===e).map(e=>e.id));if(t.size===0){k.error(`No nodes found in group "${e}"`);return}let n=[...t],r=new Set(n),i=[...n];for(;i.length>0;){let e=i.shift();for(let t of K.current)t.source===e&&!r.has(t.target)&&(r.add(t.target),i.push(t.target))}let a=G.current.filter(e=>r.has(e.id)),o=K.current.filter(e=>r.has(e.source)&&r.has(e.target));if(a.length===0){k.error(`No nodes to export`);return}V({nodes:a,edges:o,filename:pt(e)})},[]),gt=(0,I.useMemo)(()=>g.map(e=>e.data.section).filter(e=>!!e).filter((e,t,n)=>n.indexOf(e)===t),[g]);(0,I.useEffect)(()=>{if(!m)return ut({exportAll:mt,exportGroup:ht,groups:gt}),()=>ut(null)},[m,mt,ht,gt,ut]);let _t=(0,I.useMemo)(()=>{if(!P)return Ie.current;let e=g.filter(e=>e.data.section===P).map(e=>e.id);if(e.length===0)return Ie.current;let t=new Set(e),n=[...e],r=0;for(;r<n.length;){let e=n[r++];for(let r of y)r.source===e&&!t.has(r.target)&&(t.add(r.target),n.push(r.target))}return t},[P,g,y]),vt=(0,I.useMemo)(()=>{if(_t.size===0)return null;let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let i of g)if(_t.has(i.id)){let a=i.position.x,o=i.position.y;e=Math.min(e,a),t=Math.min(t,o),n=Math.max(n,a+160),r=Math.max(r,o+70)}return e===1/0?null:{x:e-14,y:t-14,width:n-e+28,height:r-t+28}},[_t,g]),yt=(0,I.useMemo)(()=>g.map(e=>{let t=e.id===S,n=_t.has(e.id),r=t||n;return!!e.selected===r?e:{...e,selected:r}}),[g,S,_t]),bt=(0,I.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(t)},[v]),xt=(0,I.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&x(t)},[x]);(0,I.useEffect)(()=>{if(m||je.current)return;let e=setTimeout(()=>{ne({nodes:G.current,edges:K.current})},500);return()=>clearTimeout(e)},[m,g,y,ne]);let $=I.useRef(null),St=I.useRef(null);(0,I.useEffect)(()=>{if(!m)return h((e,t,n)=>{try{if(St.current=n||null,n===`flowchart-insert`){let t=pe(G.current,K.current,e);if(t&&t.nodes.length>0){$.current=e,X.current=`insert`,z(t);return}}if(n===`flowchart-import`){let t=me(e);if(t&&t.nodes.length>0){$.current=e,X.current=`replace`,z(t);return}}if(t===`append`){let t=me(e);if(t&&t.nodes.length>0){$.current=e,X.current=`append`,z(t);return}}if(t===`replace`){let t=me(e);if(t&&t.nodes.length>0){$.current=e,X.current=`replace`,z(t);return}}$.current||k.error(`Could not parse flowchart data. The response may be too large or in an unsupported format.`)}catch(e){console.error(`Flowchart content handler error:`,e),k.error(`Failed to apply AI content to flowchart`)}},[`append`,`replace`])},[m,h,_,b,q]),(0,I.useEffect)(()=>{if(m)return;let e=localStorage.getItem(`pending_create_flowchart_json`);if(e){localStorage.removeItem(`pending_create_flowchart_json`);let r=me(e);if(r&&r.nodes.length>0){W.current=!0,q(G.current,K.current),_(r.nodes),b(r.edges);let e=JSON.stringify({nodes:r.nodes,edges:r.edges});f&&t?f({...t,data:e}).then(()=>{p?.()}).catch(e=>{console.error(`Error saving generated flowchart:`,e)}):n(r.nodes,r.edges),k.success(`Applied generated architecture Flowchart to new canvas`)}}let r=localStorage.getItem(`pending_update_flowchart_json`);if(r){localStorage.removeItem(`pending_update_flowchart_json`);let e=me(r);if(e&&e.nodes.length>0){W.current=!0,q(G.current,K.current),_(e.nodes),b(e.edges);let r=JSON.stringify({nodes:e.nodes,edges:e.edges});f&&t?f({...t,data:r}).then(()=>{p?.()}).catch(e=>{console.error(`Error updating flowchart:`,e)}):n(e.nodes,e.edges),k.success(`Updated Flowchart with AI-generated content`)}}},[m,_,b,q,n,f,t,p]);let Ct=(0,I.useCallback)(e=>{let t=$.current;if(t){if(q(G.current,K.current),e){let n=G.current.filter(t=>t.data.section===e).map(e=>e.id),r=new Set(n),i=[...n];for(;i.length>0;){let e=i.shift();for(let t of K.current)t.source===e&&!r.has(t.target)&&(r.add(t.target),i.push(t.target))}let a=[...r];_(e=>{let n=e.filter(e=>!a.includes(e.id)),r=Ce(t);return r?[...n,...r.nodes]:e}),b(e=>{let n=e.filter(e=>!a.includes(e.source)&&!a.includes(e.target)),r=Ce(t);return r?[...n,...r.edges]:e})}else if(X.current===`replace`){let e=Ce(t);e&&(_(e.nodes),b(e.edges))}else if(X.current===`insert`){let e=pe(G.current,K.current,t);e&&(_(e.nodes),b(e.edges))}else{let e=ve(G.current,K.current,t);e&&(_(e.nodes),b(e.edges))}z(null),$.current=null,he()}},[_,b,q]),wt=(0,I.useMemo)(()=>y.map(e=>{let t=e.id===le,n=e.id===j,r=e;if(!t&&!n)return r;let i=e=>{if(e)return typeof e==`string`?e:{...e,color:`#ffffff`,width:14,height:14}},a=n?{...r.style||{},stroke:`#ffffff`,strokeWidth:2.5}:r.style;return{...r,style:a,markerEnd:n?i(r.markerEnd):r.markerEnd,markerStart:n?i(r.markerStart):r.markerStart}}),[y,le,j]);return Ve?(0,L.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,L.jsx)(ye,{className:`w-6 h-6 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading flowchart...`})]}):(0,L.jsxs)(ue,{className:`w-full h-full border rounded-xl bg-muted/20 flex flex-col overflow-hidden relative py-0`,children:[!i&&(0,L.jsx)(`div`,{className:`absolute top-6 inset-x-0 z-10 flex justify-center pointer-events-none`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 p-1.5 bg-background/95 backdrop-blur-md border border-border/50 rounded-2xl shadow-2xl pointer-events-auto max-w-[95vw] overflow-x-auto no-scrollbar`,children:[(0,L.jsx)(we,{nodes:g,label:`Symbol`}),gt.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`w-px h-6 bg-border mx-0.5`}),(0,L.jsxs)(O,{value:P??``,onValueChange:e=>{fe(e||null),A(null)},children:[(0,L.jsxs)(E,{className:`h-9 min-w-[130px] border-none bg-transparent hover:bg-muted px-2 text-xs font-medium cursor-pointer [&>svg]:text-muted-foreground`,title:`Select a group to move`,children:[(0,L.jsx)(ie,{className:`w-3.5 h-3.5 mr-1 text-muted-foreground shrink-0`}),(0,L.jsx)(D,{placeholder:`Move Group`})]}),(0,L.jsx)(T,{className:`bg-popover border-border text-popover-foreground min-w-[150px]`,children:gt.map(e=>(0,L.jsx)(w,{value:e,className:`focus:bg-muted text-xs`,children:e},e))})]})]}),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`w-px h-6 bg-border mx-0.5`}),(0,L.jsxs)(C,{onClick:ze,variant:`outline`,size:`sm`,className:`h-9 px-3 border-border hover:bg-muted bg-muted/50 text-xs font-semibold cursor-pointer`,children:[(0,L.jsx)(oe,{className:`w-3.5 h-3.5 sm:mr-1.5`}),(0,L.jsx)(`span`,{className:`hidden sm:inline`,children:`Auto Layout`})]}),(0,L.jsx)(`div`,{className:`w-px h-6 bg-border mx-0.5`}),(0,L.jsxs)(C,{onClick:()=>Se(!0),size:`sm`,className:`h-9 px-3 sm:px-4 font-bold shadow-lg shadow-primary/20 cursor-pointer`,children:[(0,L.jsx)(ce,{className:`w-4 h-4 sm:mr-2`}),(0,L.jsx)(`span`,{className:`hidden sm:inline`,children:`Add Symbol`})]})]}),(0,L.jsx)(`div`,{className:`w-px h-6 bg-border mx-0.5`}),(0,L.jsx)(C,{onClick:()=>Le(G.current,K.current),disabled:!Y,size:`sm`,variant:`ghost`,className:`h-9 w-9 p-0 cursor-pointer`,title:`Undo`,children:(0,L.jsx)(se,{className:`w-4 h-4`})}),(0,L.jsx)(C,{onClick:()=>J(G.current,K.current),disabled:!Re,size:`sm`,variant:`ghost`,className:`h-9 w-9 p-0 cursor-pointer`,title:`Redo`,children:(0,L.jsx)(ae,{className:`w-4 h-4`})})]})}),(0,L.jsxs)(`div`,{className:`flex-1 w-full h-full relative`,children:[(0,L.jsxs)(u,{nodes:yt,edges:wt,onNodesChange:bt,onEdgesChange:xt,onConnect:Ke,onReconnect:Ye,defaultEdgeOptions:Ge,onNodeDragStart:Ue,onNodeDragStop:We,nodeTypes:Je,onNodeClick:(e,t)=>A(t.id),onEdgeClick:(e,t)=>M(t.id),onEdgeMouseEnter:(e,t)=>N(t.id),onEdgeMouseLeave:()=>N(null),onPaneClick:()=>{A(null),M(null),fe(null)},fitView:!0,colorMode:dt,onlyRenderVisibleElements:!0,nodesDraggable:!i,nodesConnectable:!i,elementsSelectable:!i,minZoom:.1,maxZoom:2.5,onMove:(e,t)=>be(t),children:[(0,L.jsx)(r,{className:`bg-background/95 border-border shadow-md`,showInteractive:!i}),(0,L.jsx)(d,{variant:o.Lines,gap:50,size:1,color:ft})]}),vt&&(0,L.jsx)(`svg`,{className:`absolute inset-0 pointer-events-none`,style:{overflow:`visible`},children:(0,L.jsx)(`g`,{transform:`translate(${F.x}, ${F.y}) scale(${F.zoom})`,children:(0,L.jsx)(`rect`,{x:vt.x,y:vt.y,width:vt.width,height:vt.height,fill:`rgba(99, 102, 241, 0.04)`,stroke:`#6366f1`,strokeWidth:1.5/F.zoom,strokeDasharray:`${6/F.zoom} ${3/F.zoom}`,rx:8/F.zoom,ry:8/F.zoom})})})]}),!i&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Te,{isOpen:xe,onOpenChange:Se,nodeData:H,onNodeDataChange:ke,onConfirm:Xe}),(0,L.jsx)(Ee,{selectedNodeId:S,onClose:()=>A(null),selectedNode:it,onUpdateNodeData:Ze,onDeleteNode:$e,onDeleteGroup:et,onValidateSection:Qe}),(0,L.jsx)(De,{selectedEdgeId:j,onClose:()=>M(null),selectedEdge:Q,isDashed:at,arrowType:ot,onEdgeTypeChange:st,onArrowChange:ct,onLabelChange:lt,onDeleteEdge:tt})]}),R&&(0,L.jsx)(Oe,{nodes:R.nodes,edges:R.edges,existingNodes:g,existingEdges:y,onConfirm:Ct,onCancel:()=>{z(null),$.current=null},confirmLabel:X.current===`insert`?`Confirm Insert`:X.current===`replace`?`Confirm Replace`:`Confirm Append`,canvasGroups:X.current===`replace`?g.map(e=>e.data.section).filter(e=>!!e).filter((e,t,n)=>n.indexOf(e)===t):[]}),B&&(0,L.jsx)(Pe,{nodes:B.nodes,edges:B.edges,filename:B.filename,onCancel:()=>V(null)})]})});export{Ye as FlowchartView};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{g as r}from"./downloadSVG-CdP2B3Gf.js";import{_ as i}from"./composite-DpzKouN6.js";import{B as a,S as o,_ as s,f as c,g as l,h as u,m as d,v as f}from"./select-D-sac3DW.js";import{r as p}from"./utils-TcK2FSyg.js";import{t as m}from"./scroll-area-BZW9Wzp1.js";import{t as h}from"./search-hNBtHxSg.js";import{t as g}from"./input-CluuKyQT.js";import{Kt as _}from"./index-eaTZrxyp.js";var v=e(t(),1),y=n();function b({nodes:e,className:t,label:n=`Symbol`}){let{fitView:b}=r(),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(``),T=v.useRef(null);v.useEffect(()=>{x&&setTimeout(()=>T.current?.focus(),100)},[x]);let E=e=>{e.stopPropagation(),e.key===`Escape`&&S(!1)},D=(0,v.useMemo)(()=>{let t=C.trim().toLowerCase();return t?e.filter(e=>{let n=e.data;return(n.name||n.label||``).toLowerCase().includes(t)}):e},[e,C]),O=e=>{S(!1),w(``),e.position.x+(e.measured?.width??200)/2,e.position.y+(e.measured?.height??100)/2,setTimeout(()=>{b({nodes:[{id:e.id}],duration:0,padding:1.5,minZoom:1.2,maxZoom:1.2})},100)};return(0,y.jsxs)(c,{open:x,onOpenChange:S,children:[(0,y.jsx)(o,{render:(0,y.jsxs)(i,{variant:`outline`,size:`sm`,className:p(`h-9 px-3 text-xs font-bold border-border/50 bg-muted/20 hover:bg-muted text-muted-foreground transition-all`,t),children:[(0,y.jsx)(_,{className:`w-3.5 h-3.5 mr-2`}),(0,y.jsxs)(`span`,{className:`hidden sm:inline`,children:[`Jump to `,n]}),(0,y.jsx)(`span`,{className:`sm:hidden`,children:`Jump`}),(0,y.jsx)(a,{className:`w-3 h-3 ml-2 opacity-50`})]})}),(0,y.jsxs)(d,{align:`start`,className:`w-[280px] p-0 shadow-2xl border-border/50 bg-background/95 backdrop-blur-xl`,children:[(0,y.jsx)(`div`,{className:`p-3 pb-2`,onPointerDown:e=>e.stopPropagation(),children:(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(h,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground`}),(0,y.jsx)(g,{ref:T,placeholder:`Search ${n.toLowerCase()}s...`,className:`h-8 pl-8 text-xs bg-muted/50 border-none focus-visible:ring-1 focus-visible:ring-primary/50`,value:C,onChange:e=>w(e.target.value),onKeyDown:E,autoComplete:`off`})]})}),(0,y.jsx)(f,{className:`bg-border/50`}),(0,y.jsxs)(u,{children:[(0,y.jsxs)(s,{className:`px-3 pt-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/70`,children:[`Showing `,D.length,` of `,e.length,` `,n.toLowerCase(),`s`]}),(0,y.jsx)(m,{className:`h-[250px] px-1 pb-1`,children:D.length===0?(0,y.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted-foreground italic`,children:`No matching items found`}):D.map(e=>{let t=e.data,n=t.name||t.label||`Unnamed component`;return(0,y.jsxs)(l,{onClick:()=>O(e),className:`flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors focus:bg-accent focus:text-accent-foreground rounded-lg mx-1`,children:[(0,y.jsx)(`div`,{className:`w-2 h-2 rounded-full`,style:{backgroundColor:e.data.color||`#8b5cf6`}}),(0,y.jsx)(`span`,{className:`text-[13px] font-medium truncate tracking-tight`,children:n})]},e.id)})})]})]})]})}export{b as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-Bc1M73hO.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/react-dom-CGnP4YFq.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/with-selector-v0oZM3OS.js","assets/dialog-C4O82yNc.js","assets/useBaseUiId-zhXTYtFh.js","assets/floating-ui.utils.dom-B_-bZDGP.js","assets/DialogTrigger-t3YEWzZ3.js","assets/composite-DpzKouN6.js","assets/floating-ui.utils-DrtUanoU.js","assets/utils-TcK2FSyg.js","assets/createLucideIcon-CyJfQrak.js","assets/select-D-sac3DW.js","assets/floating-ui.react-dom-C3qLYNxV.js","assets/useCompositeItem-Z-x4Q9MP.js","assets/check-DcrFpa6g.js","assets/input-CluuKyQT.js","assets/useControlled-CwUHqyRq.js","assets/dist-DDYEjsV2.js","assets/context-menu-CyVj69uQ.js","assets/search-hNBtHxSg.js","assets/link-2-DBo-eQZM.js","assets/arrow-left-sRwyfx9m.js","assets/calendar-Buen4kc1.js","assets/scroll-area-BZW9Wzp1.js","assets/note-importer-Dw1ql6-a.js","assets/api-D87lw-98.js","assets/image-compression-COYPhRs3.js","assets/index-eaTZrxyp.js","assets/downloadSVG-CdP2B3Gf.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/vanilla--C5Lp_AM.js","assets/triangle-alert-Hn6Bso_Y.js","assets/wand-sparkles-QRKwIO4L.js","assets/copy-BasccFFL.js","assets/minus-DU5tWN1g.js","assets/plus-CSlTmvRo.js","assets/trash-2-eV2xsHmQ.js","assets/card-Dy6p8t6g.js","assets/checkbox-Duz4tSop.js","assets/table-wBdalafB.js","assets/WorkspaceProvider-DRRcvif2.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/WorkspaceContext-O7njKDwj.js","assets/ConfirmModal-td6IXKfM.js","assets/message-scroller-C9C6EycB.js","assets/extends-CvVTau-c.js","assets/label-Co-it7VP.js","assets/index-DjmEvvxm.css","assets/image-vqz7pCPE.js","assets/move-BlLS6EPB.js","assets/undo-2-DSs-RD2B.js","assets/refresh-ccw-DFj0g7WT.js","assets/users-DyYyhq63.js","assets/user-cog-plxf2Kur.js","assets/Combination-BREwCNuY.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{u as i}from"./chunk-BV7QT456-CCzugQp2.js";import{t as a}from"./createLucideIcon-CyJfQrak.js";import"./WorkspaceProvider-DRRcvif2.js";import{n as o}from"./WorkspaceContext-O7njKDwj.js";import{t as s}from"./ProjectFileTabs-l0uAfLaH.js";var c=a(`file-question-mark`,[[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z`,key:`1mlx9k`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),l=e(t(),1),u=n(),d=l.lazy(()=>r(()=>import(`./NotesView-Bc1M73hO.js`).then(e=>({default:e.NotesView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62])));function f(){let e=o(),{id:t}=i(),{activeNote:n,activeNoteUid:r,saveNote:a,handleNoteChange:f,deleteNote:p,isPublicView:m,isLoading:h,isNoteItemLoading:g,handleNoteSelect:_}=e,v=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{if(!(m||!t)&&!v.current){if(r===t){v.current=!0;return}r||(v.current=!0,_(t))}},[t,r,m,_]),!m&&!r?t&&!v.current?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]}):(0,u.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Select a note to view`})}):!n&&!g?(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(c,{className:`w-12 h-12 text-muted-foreground/40 mb-4`}),(0,u.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`Note not found`}),(0,u.jsx)(`p`,{className:`text-xs text-muted-foreground/60 mt-1`,children:`This note may have been deleted or is no longer available.`})]}):n?(0,u.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,children:[(0,u.jsx)(s,{currentView:`notes`}),(0,u.jsx)(l.Suspense,{fallback:(0,u.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,u.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`span`,{className:`text-xs text-muted-foreground/60 animate-pulse`,children:`Loading note...`})]})}),children:(0,u.jsx)(d,{isLoading:g,activeNoteUid:m?null:r,activeNote:n,saveNote:a,handleNoteChange:f,deleteNote:p,isReadOnly:m})})]}):(0,u.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center border rounded-xl bg-muted/10`,children:[(0,u.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary/30 border-t-primary rounded-full animate-spin`}),(0,u.jsx)(`p`,{className:`mt-4 text-sm font-medium text-muted-foreground animate-pulse`,children:`Loading note...`})]})}export{f as NoteEditorRoute,c as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-bCG777et.js","assets/rolldown-runtime-C0FnF6B9.js","assets/jsx-runtime-DSr1VPkp.js","assets/downloadSVG-CdP2B3Gf.js","assets/react-dom-CGnP4YFq.js","assets/esm-B1WURL1q.js","assets/src-B-DeWB10.js","assets/value-Cwm0ChEK.js","assets/with-selector-v0oZM3OS.js","assets/vanilla--C5Lp_AM.js","assets/dialog-C4O82yNc.js","assets/useBaseUiId-zhXTYtFh.js","assets/floating-ui.utils.dom-B_-bZDGP.js","assets/DialogTrigger-t3YEWzZ3.js","assets/composite-DpzKouN6.js","assets/floating-ui.utils-DrtUanoU.js","assets/utils-TcK2FSyg.js","assets/createLucideIcon-CyJfQrak.js","assets/select-D-sac3DW.js","assets/floating-ui.react-dom-C3qLYNxV.js","assets/useCompositeItem-Z-x4Q9MP.js","assets/check-DcrFpa6g.js","assets/input-CluuKyQT.js","assets/useControlled-CwUHqyRq.js","assets/dist-DDYEjsV2.js","assets/scroll-area-BZW9Wzp1.js","assets/move-BlLS6EPB.js","assets/undo-2-DSs-RD2B.js","assets/plus-CSlTmvRo.js","assets/trash-2-eV2xsHmQ.js","assets/card-Dy6p8t6g.js","assets/WorkspaceContext-O7njKDwj.js","assets/label-Co-it7VP.js","assets/index-eaTZrxyp.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/context-menu-CyVj69uQ.js","assets/search-hNBtHxSg.js","assets/link-2-DBo-eQZM.js","assets/arrow-left-sRwyfx9m.js","assets/triangle-alert-Hn6Bso_Y.js","assets/wand-sparkles-QRKwIO4L.js","assets/copy-BasccFFL.js","assets/minus-DU5tWN1g.js","assets/api-D87lw-98.js","assets/checkbox-Duz4tSop.js","assets/table-wBdalafB.js","assets/note-importer-Dw1ql6-a.js","assets/image-compression-COYPhRs3.js","assets/WorkspaceProvider-DRRcvif2.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/ConfirmModal-td6IXKfM.js","assets/message-scroller-C9C6EycB.js","assets/extends-CvVTau-c.js","assets/index-DjmEvvxm.css","assets/JumpToNode-CsIEfKOc.js","assets/style-CHpVij2M.css","assets/ExcalidrawEditor-Bpc4if6_.js","assets/Combination-BREwCNuY.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-DSr1VPkp.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{a as i,d as a,f as o,i as s,l as c,p as l,r as u}from"./downloadSVG-CdP2B3Gf.js";import{ct as d,h as ee,r as te,t as ne}from"./esm-B1WURL1q.js";import{_ as f}from"./composite-DpzKouN6.js";import{n as p}from"./dist-DDYEjsV2.js";import{n as re}from"./calendar-Buen4kc1.js";import{t as m}from"./triangle-alert-Hn6Bso_Y.js";import{r as h}from"./undo-2-DSs-RD2B.js";import{t as g}from"./plus-CSlTmvRo.js";import{n as _}from"./api-D87lw-98.js";import{E as v,O as y,a as b}from"./note-importer-Dw1ql6-a.js";import{v as x}from"./WorkspaceProvider-DRRcvif2.js";import{n as S}from"./WorkspaceContext-O7njKDwj.js";import{R as ie,Xt as C,v as ae}from"./index-eaTZrxyp.js";/* empty css */import{a as oe,i as w,n as T,o as E,r as D,s as O,t as k}from"./erd-edge-style-NJXJJ5ej.js";var A=e(t(),1);function j(e){if(!e)return null;try{return typeof e==`string`?JSON.parse(e):e}catch{return null}}function M(e){return{...e,id:String(e.id),is_pk:e.is_pk??e.isPk??!1,is_nullable:e.is_nullable??e.isNullable??!0,is_unique:e.is_unique??e.isUnique??!1,default_value:e.default_value??e.defaultValue??null,enum_values:e.enum_values??e.enumValues??``,max_length:e.max_length??e.maxLength??null,numeric_precision:e.numeric_precision??e.numericPrecision??null,numeric_scale:e.numeric_scale??e.numericScale??null,sort_order:e.sort_order??e.sortOrder??0}}function N(e){let t=e.data??e,n=String(e.id??t.id),r=e.position?.x??e.x??t.x??0,i=e.position?.y??e.y??t.y??0;return{id:n,type:`entity`,position:{x:r,y:i},data:{...t,_notesCompanion:!0,id:n,name:t.name??e.name??`Untitled`,x:r,y:i,color:t.color??e.color??`#6366f1`,columns:(t.columns??e.columns??[]).map(M)}}}function se(e){let t=j(e.data),n=Array.isArray(e.entities)&&e.entities.length?e.entities:Array.isArray(t?.nodes)?t.nodes:[],r=Array.isArray(e.relationships)&&e.relationships.length?e.relationships:Array.isArray(t?.edges)?t.edges:[],i=n.map(N),a=new Map(i.map(e=>[e.id,e]));return{nodes:i,edges:r.map(e=>{let t=String(e.source??e.source_entity_id??e.sourceEntityId??``),n=String(e.target??e.target_entity_id??e.targetEntityId??``),r=e.sourceHandle??e.source_handle??e.sourceColumnId??e.source_column_id,i=e.targetHandle??e.target_handle??e.targetColumnId??e.target_column_id,o=a.get(t),s=a.get(n),c=(o?.position.x??0)<(s?.position.x??0),l=String(r||``).startsWith(`col-`)?r:r?`col-${r}-${c?`source`:`source-l`}`:void 0,u=String(i||``).startsWith(`col-`)?i:i?`col-${i}-${c?`target`:`target-r`}`:void 0;return{...e,id:String(e.id),source:t,target:n,sourceHandle:l,targetHandle:u,label:e.label,type:e.type??`smoothstep`,data:{...e.data||{},on_delete:e.on_delete??e.onDelete,on_update:e.on_update??e.onUpdate,constraint_name:e.constraint_name??e.constraintName}}})}}function P(e,t){return k(e,t?[t]:[])}var F=n(),ce={entity:E},I=(0,A.lazy)(()=>r(()=>import(`./FlowchartView-bCG777et.js`).then(e=>({default:e.FlowchartView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58]))),L=(0,A.lazy)(()=>r(()=>import(`./ExcalidrawEditor-Bpc4if6_.js`),__vite__mapDeps([59,1,2,4,34,8,9,19,12,15,44,48,31,55,60,33,35,3,5,6,7,11,13,14,16,10,17,18,20,21,22,23,24,36,37,38,39,40,41,42,25,43,28,29,30,45,46,47,49,50,51,52,53,54,32,56])));async function R(e,t,n){if(n){let n=e===`erd`?`erd`:e===`flowchart`?`flowchart`:`drawings`;return await y.getResource(t)||((await y.getAllResources(n)).find(e=>String(e.uid??e.id)===t)??null)}let r=await _(`/api/${e===`erd`?`diagrams`:e===`flowchart`?`flowcharts`:`drawings`}/${t}`);return r.ok?r.json():null}function z({document:e,previewSchema:t,previewKey:n}){let r=(0,A.useMemo)(()=>se(e),[e]),{isGuest:c,resolvedTheme:m}=S(),[C,E]=(0,A.useState)(r.nodes),[k,j]=(0,A.useState)(r.edges),[M,N]=(0,A.useState)(null),[I,L]=(0,A.useState)(null),[R,z]=(0,A.useState)(null),[B,V]=(0,A.useState)([]),[H,U]=(0,A.useState)(!1),W=(0,A.useRef)(C),G=(0,A.useRef)(k),K=(0,A.useRef)(null),q=(0,A.useMemo)(()=>x(e),[e]),J=q??{x:0,y:0,zoom:1},Y=(0,A.useRef)(J);W.current=C,G.current=k;let X=(0,A.useCallback)((t,n)=>{K.current&&clearTimeout(K.current),K.current=setTimeout(async()=>{let r=t.map(e=>({...e.data,x:e.position.x,y:e.position.y})),i=n.map(v),a=b(t,n);try{if(c){let t=await y.getResource(e.uid??e.id);t&&await y.saveResource({...t,entities:r,relationships:i,data:null,dbml_source:a,viewport_x:Y.current.x,viewport_y:Y.current.y,viewport_zoom:Y.current.zoom,updated_at:new Date().toISOString()})}else if(!(await _(`/api/diagrams/save/${e.uid??e.id}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entities:r,relationships:i,viewport:Y.current,data:null,dbmlSource:a})})).ok)throw Error()}catch{p.error(`Could not save ERD changes`)}},350)},[e.id,e.uid,c]);(0,A.useEffect)(()=>{if(!(!t||!n))try{let e=re(W.current,G.current,`erd-generate-sql`,t);if(!e)throw Error();let n=w(W.current,G.current,e.nodes,e.edges);if(n.changes.length===0){z(null),p.success(`No schema changes found`);return}N(null),L(null),V(n.changes.map(e=>e.id)),U(!1),z({originalNodes:W.current,originalEdges:G.current,proposedNodes:e.nodes,proposedEdges:e.edges,result:n})}catch{p.error(`Could not parse the schema for diff`)}},[n,t]);let le=(0,A.useCallback)(()=>{if(!R)return;let e=D(R.originalNodes,R.originalEdges,R.proposedNodes,R.proposedEdges,R.result,B);E(e.nodes),j(e.edges),z(null),X(e.nodes,e.edges),p.success(`Schema changes merged successfully`)},[B,R,X]),ue=(0,A.useCallback)(e=>{let t=o(e,W.current);E(t),e.some(e=>e.type!==`select`&&e.type!==`dimensions`)&&X(t,G.current)},[X]),de=(0,A.useCallback)(e=>{let t=a(e,G.current);j(t),e.some(e=>e.type!==`select`)&&X(W.current,t)},[X]),fe=(0,A.useCallback)(e=>{let t=ee({...e,id:crypto.randomUUID(),type:`smoothstep`,label:`1:N`},G.current);j(t),X(W.current,t)},[X]),pe=(0,A.useCallback)((e,t)=>{let n=typeof t==`string`?{label:t}:t,r=G.current.map(t=>t.id===e?{...t,...n,data:{...t.data||{},...n.data||{}}}:t);j(r),X(W.current,r)},[X]),me=(0,A.useCallback)(e=>{let t=e=>e&&(e.endsWith(`-source`)?e.replace(/-source$/,`-source-l`):e.endsWith(`-source-l`)?e.replace(/-source-l$/,`-source`):e.endsWith(`-target`)?e.replace(/-target$/,`-target-r`):e.endsWith(`-target-r`)?e.replace(/-target-r$/,`-target`):e),n=G.current.map(n=>n.id===e?{...n,sourceHandle:t(n.sourceHandle),targetHandle:t(n.targetHandle)}:n);j(n),X(W.current,n)},[X]),he=(0,A.useCallback)(e=>{let t=G.current.filter(t=>t.id!==e);j(t),L(null),X(W.current,t)},[X]),ge=(0,A.useCallback)((e,t)=>{let n=e=>e?.replace(/^col-/,``).replace(/-(source|target)(-(l|r))?$/,``);if(!t.sourceHandle||!t.targetHandle)return;if(String(t.source)!==String(e.source)||String(t.target)!==String(e.target)||n(t.sourceHandle)!==n(e.sourceHandle)||n(t.targetHandle)!==n(e.targetHandle)){p.info(`Only the connector position can be changed`);return}let r=(e,t)=>{let r=n(t);return W.current.find(t=>String(t.id)===String(e))?.data.columns.find(e=>String(e.id)===String(r))},i=r(t.source,t.sourceHandle),a=r(t.target,t.targetHandle);if(i&&a&&i.type!==a.type){p.error(`Type Mismatch`,{description:`Cannot reconnect ${i.type} to ${a.type}`});return}let o=d(e,t,G.current);j(o),X(W.current,o)},[X]),_e=(0,A.useCallback)(e=>{let t=W.current.map(t=>t.id===e.id?{...t,data:e}:t);E(t),X(t,G.current)},[X]),ve=(0,A.useCallback)(e=>{let t=W.current.filter(t=>t.id!==e),n=G.current.filter(t=>t.source!==e&&t.target!==e);E(t),j(n),N(null),X(t,n)},[X]),ye=(0,A.useCallback)(()=>{let e=crypto.randomUUID(),t={id:e,name:`new_table`,x:80,y:80,color:`#6366f1`,columns:[]},n=[...W.current,{id:e,type:`entity`,position:{x:80,y:80},data:t}];E(n),N(e),X(n,G.current)},[X]),be=(0,A.useCallback)(()=>{if(W.current.length===0)return;let e=oe(W.current,G.current);E(e),X(e,G.current)},[X]),xe=(0,A.useCallback)((e,t)=>{Y.current=t},[]),Z=(0,A.useCallback)((e,t)=>{Y.current=t,e&&X(W.current,G.current)},[X]);(0,A.useEffect)(()=>{let e=e=>N(e.detail?.id??null);return window.addEventListener(O,e),()=>window.removeEventListener(O,e)},[]);let Q=C.find(e=>e.id===M)?.data??null,Se=k.find(e=>e.id===I)??null,Ce=m===`dark`?`#222`:`#ccc`,$=(0,A.useMemo)(()=>({type:`smoothstep`,animated:!1,reconnectable:!0,style:{stroke:`var(--edge-color)`,strokeWidth:2},markerEnd:{type:te.Arrow,color:`var(--edge-color)`,width:10,height:10}}),[]),we=(0,A.useMemo)(()=>C.map(e=>{let t=e.id===M;return!!e.selected===t?e:{...e,selected:t}}),[C,M]),Te=(0,A.useMemo)(()=>P(k,M),[k,M]),Ee=(0,A.useMemo)(()=>R?P(R.result.edges,null):[],[R]),De=(0,A.useMemo)(()=>R?.result.nodes.map(e=>({...e,data:{...e.data,isDiffMode:!0}}))??[],[R]);return(0,F.jsxs)(`div`,{className:`relative h-full min-h-0 overflow-hidden bg-background`,children:[(0,F.jsxs)(l,{nodes:R?De:we,edges:R?Ee:Te,nodeTypes:ce,onNodesChange:ue,onEdgesChange:de,onConnect:fe,onReconnect:ge,nodesDraggable:!R,nodesConnectable:!R,elementsSelectable:!R,edgesReconnectable:!R,defaultEdgeOptions:$,onNodeClick:(e,t)=>{L(null),N(t.id)},onNodeDoubleClick:(e,t)=>{L(null),N(t.id)},onEdgeClick:(e,t)=>{N(null),L(t.id)},onPaneClick:()=>{N(null),L(null)},onMove:xe,onMoveEnd:Z,colorMode:m,connectionLineType:ne.SmoothStep,connectionLineStyle:$.style,onlyRenderVisibleElements:!0,defaultViewport:J,fitView:!q,children:[(0,F.jsx)(u,{variant:s.Lines,gap:50,size:1,color:Ce}),(0,F.jsx)(i,{position:`bottom-left`,showInteractive:!1})]}),!R&&(0,F.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center`,children:(0,F.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-1 rounded-lg border bg-background/95 p-1 shadow-sm backdrop-blur`,children:[(0,F.jsxs)(f,{size:`sm`,onClick:ye,children:[(0,F.jsx)(g,{}),` Table`]}),(0,F.jsxs)(f,{variant:`outline`,size:`sm`,onClick:be,disabled:C.length===0,title:`Automatically arrange tables`,children:[(0,F.jsx)(h,{}),` Auto Layout`]})]})}),!R&&Q&&(0,F.jsx)(`aside`,{className:`absolute inset-y-0 right-0 z-20 w-[min(22rem,82%)] border-l bg-background shadow-xl`,children:(0,F.jsx)(ae,{selectedEntity:Q,onUpdateEntity:_e,onDeleteEntity:ve,onBackToTables:()=>N(null),propertiesOnly:!0})}),(0,F.jsx)(ie,{isOpen:!R&&!!I,onOpenChange:e=>{e||L(null)},selectedEdge:Se,nodes:C,handleEdgeUpdate:pe,handleEdgeFlip:me,deleteEdge:he}),R&&(0,F.jsx)(T,{diff:R.result,approvedIds:B,showChecklist:H,onApprovedIdsChange:V,onShowChecklistChange:U,onReject:()=>{z(null),p.info(`Schema update rejected`)},onMerge:le})]})}function B({pane:e,document:t}){let{saveFlowchart:n,saveDrawing:r,triggerDebouncedSync:i}=S();return e.type===`erd`?(0,F.jsx)(c,{children:(0,F.jsx)(z,{document:t,previewSchema:e.previewSchema,previewKey:e.previewKey},t.uid??t.id)}):e.type===`flowchart`?(0,F.jsx)(I,{companionMode:!0,activeFlowchartId:t.uid??t.id,activeFlowchart:t,handleFlowchartChange:(e,r)=>void n({...t,data:JSON.stringify({nodes:e,edges:r})}).then(()=>i()),saveFlowchart:n,triggerDebouncedSync:i}):(0,F.jsx)(L,{compact:!0,drawing:t,onSave:r,onChange:e=>void r({...t,data:e}).then(()=>i()),onDelete:()=>{}})}function V({pane:e}){let{isGuest:t}=S(),[n,r]=(0,A.useState)(),[i,a]=(0,A.useState)(`loading`);return(0,A.useEffect)(()=>{let n=!0;return a(`loading`),r(void 0),R(e.type,e.uid,t).then(e=>{n&&(r(e),a(e?`ready`:`missing`))}).catch(()=>{n&&a(`missing`)}),()=>{n=!1}},[t,e.type,e.uid]),i===`loading`?(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:(0,F.jsx)(C,{className:`size-4 animate-spin`})}):i===`missing`?(0,F.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,F.jsx)(m,{className:`size-5`}),`File unavailable`]}):(0,F.jsx)(B,{pane:e,document:n})}export{V as NotesCompanionPane};