erdbpro 3.4.7-rc.4 → 3.4.7-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AdminRoute-B3fF-o_k.js → AdminRoute-CSrMM5kT.js} +2 -2
- package/dist/assets/{Combination-CGAsbFvs.js → Combination-BfBlC5cu.js} +1 -1
- package/dist/assets/{DataViewerModeToolbar-F7XM0tWC.js → DataViewerModeToolbar-Cp00TafC.js} +1 -1
- package/dist/assets/{DbClientEditorRoute-DSE3nW3b.js → DbClientEditorRoute-BDogttFr.js} +1 -1
- package/dist/assets/{DiagramEditorRoute-Cuiz5qdS.js → DiagramEditorRoute-D32OwT82.js} +1 -1
- package/dist/assets/{DrawingEditorRoute-Bmv5oKQ-.js → DrawingEditorRoute-DvCth1pp.js} +2 -2
- package/dist/assets/{DrawingsView-eBCPqYwX.js → DrawingsView-DJui6EdX.js} +1 -1
- package/dist/assets/{ExcalidrawEditor-C5ViCJaK.js → ExcalidrawEditor-DaUnJZTI.js} +8 -8
- package/dist/assets/{FlowchartEditorRoute-Bcv7_SU4.js → FlowchartEditorRoute-BA9MZc63.js} +1 -1
- package/dist/assets/{FlowchartView-CNGIF3g5.js → FlowchartView-DkM-lVOG.js} +1 -1
- package/dist/assets/{JumpToNode-DiUpsDFt.js → JumpToNode-CZEVhDHd.js} +1 -1
- package/dist/assets/{NoteEditorRoute-Tdww3xJp.js → NoteEditorRoute-BZep3cWv.js} +2 -2
- package/dist/assets/{NotesCompanionPane-0_p6XA9k.js → NotesCompanionPane-D3pUhRa6.js} +2 -2
- package/dist/assets/{NotesView-HXcKpvHz.js → NotesView-Bp0lx_-F.js} +3 -3
- package/dist/assets/{ProjectFileTabs-CFa2c21-.js → ProjectFileTabs-Dd7YGTk9.js} +1 -1
- package/dist/assets/{TeamManagementRoute-DZ_3pJY0.js → TeamManagementRoute-DI-inwWM.js} +1 -1
- package/dist/assets/{TrashView-CAr3Vo8p.js → TrashView-DVwAG31W.js} +1 -1
- package/dist/assets/{UserManagementRoute-BiaRJkaZ.js → UserManagementRoute-Btr6futS.js} +1 -1
- package/dist/assets/{WorkspaceProvider-COhnFKM1.js → WorkspaceProvider-CPDM8Q21.js} +3 -3
- package/dist/assets/{abnfDiagram-N423BO3Z-8bS_psyH.js → abnfDiagram-N423BO3Z-C0RA0jTW.js} +1 -1
- package/dist/assets/{ar-SA-G6X2FPQ2-BDrngIw9.js → ar-SA-G6X2FPQ2-CtLn4--J.js} +1 -1
- package/dist/assets/{architectureDiagram-T3A2C74G-DebB1NiG.js → architectureDiagram-T3A2C74G-D7w5srlL.js} +1 -1
- package/dist/assets/{az-AZ-76LH7QW2-luRtr5rD.js → az-AZ-76LH7QW2-BWAuESpF.js} +1 -1
- package/dist/assets/{bg-BG-XCXSNQG7-BmJJCcs_.js → bg-BG-XCXSNQG7-CobvN8MU.js} +1 -1
- package/dist/assets/{blockDiagram-VBNYF7ZC-DfnWfvrb.js → blockDiagram-VBNYF7ZC-CQ1twUNo.js} +1 -1
- package/dist/assets/{bn-BD-2XOGV67Q-Bq44DZkF.js → bn-BD-2XOGV67Q-0Q68Ru4a.js} +1 -1
- package/dist/assets/{c4Diagram-5PPSVZJV-DjfGCYSB.js → c4Diagram-5PPSVZJV-DwbGo8sV.js} +1 -1
- package/dist/assets/{ca-ES-6MX7JW3Y-RnhBDsXi.js → ca-ES-6MX7JW3Y-MVHLjE7T.js} +1 -1
- package/dist/assets/{calendar-BXOaTonG.js → calendar-D8fpVeTp.js} +1 -1
- package/dist/assets/channel-B8Z8WJQe.js +1 -0
- package/dist/assets/{chunk-2GRJ4B5K-CzYfZDDJ.js → chunk-2GRJ4B5K-BBUiuGok.js} +1 -1
- package/dist/assets/{chunk-4I5QYGJK-DzE5Pq85.js → chunk-4I5QYGJK-ChX96Tz3.js} +1 -1
- package/dist/assets/{chunk-5RXB4S5H-BIsmGGgr.js → chunk-5RXB4S5H-BfrHePS_.js} +1 -1
- package/dist/assets/{chunk-6Q2QTUOP-DUNp8iwf.js → chunk-6Q2QTUOP-90a7W3yE.js} +1 -1
- package/dist/assets/{chunk-7Z6QIM7H-AzOt0IAq.js → chunk-7Z6QIM7H-Ctp9f7g9.js} +1 -1
- package/dist/assets/{chunk-EIO257PC-DAMD5lmb.js → chunk-EIO257PC-Dfl_N6MN.js} +1 -1
- package/dist/assets/{chunk-GF5L2VYU-B8XZD8Z5.js → chunk-GF5L2VYU-DZkPkajJ.js} +1 -1
- package/dist/assets/{chunk-I66GZJ75-BozRQO3U.js → chunk-I66GZJ75-CWhnAvjS.js} +1 -1
- package/dist/assets/{chunk-JQJVKLGR-BdG0gWe9.js → chunk-JQJVKLGR-BccXh0OU.js} +1 -1
- package/dist/assets/{chunk-KBJHAD2P-BzX5Fou-.js → chunk-KBJHAD2P-DXsy-CG-.js} +1 -1
- package/dist/assets/{chunk-NSK5VX7P-Dtc-wd24.js → chunk-NSK5VX7P-D5CjbRou.js} +1 -1
- package/dist/assets/{chunk-QR6OTTB3-8KgP3A19.js → chunk-QR6OTTB3-DEMWoMob.js} +1 -1
- package/dist/assets/{chunk-UBXNYLIW-BioLbsX6.js → chunk-UBXNYLIW-BzecF-sX.js} +1 -1
- package/dist/assets/{chunk-W5SLKNZC-aAdndcpZ.js → chunk-W5SLKNZC-BW_tt_Ns.js} +1 -1
- package/dist/assets/{chunk-WRU74C26-ha6khPWg.js → chunk-WRU74C26-llO1scXW.js} +1 -1
- package/dist/assets/classDiagram-JCYQIIEL-0AvzvqOj.js +1 -0
- package/dist/assets/classDiagram-v2-OCEON4UE-0AvzvqOj.js +1 -0
- package/dist/assets/{cs-CZ-2BRQDIVT-j0kGSpY9.js → cs-CZ-2BRQDIVT-D2JJmg9G.js} +1 -1
- package/dist/assets/{cynefinDiagram-MW4NZA55-CHDCjfKK.js → cynefinDiagram-MW4NZA55-Ce5jDMMz.js} +1 -1
- package/dist/assets/{da-DK-5WZEPLOC-CVXzCeeV.js → da-DK-5WZEPLOC-D6UMX8EL.js} +1 -1
- package/dist/assets/{dagre-VZM6K2ZE-DkEHoqG1.js → dagre-VZM6K2ZE-y6hqnUXf.js} +1 -1
- package/dist/assets/{de-DE-XR44H4JA-BVedich7.js → de-DE-XR44H4JA-c09B_uvN.js} +1 -1
- package/dist/assets/{diagram-7IWD3JNH-DeRinbrx.js → diagram-7IWD3JNH-CefxIsve.js} +1 -1
- package/dist/assets/{diagram-B4RE2ZJO-BGKLq-mA.js → diagram-B4RE2ZJO-ivgx-_6w.js} +1 -1
- package/dist/assets/{diagram-LBJQPF4R-BGt2AhYU.js → diagram-LBJQPF4R-B5yjUiuD.js} +1 -1
- package/dist/assets/{diagram-Q27KOJAE-BlcPHV9V.js → diagram-Q27KOJAE-Bav0EmED.js} +1 -1
- package/dist/assets/{diagram-UB23O5K3-Cjwe2Ndf.js → diagram-UB23O5K3-CjtARAWU.js} +1 -1
- package/dist/assets/{dist-BLKHX4Gi.js → dist-BLGhvUyO.js} +4 -4
- package/dist/assets/{ebnfDiagram-BXEA7PRR-CoYHpWzb.js → ebnfDiagram-BXEA7PRR-Cn6DG8KL.js} +1 -1
- package/dist/assets/{el-GR-BZB4AONW-GuUhVwVm.js → el-GR-BZB4AONW-WPriXr_y.js} +1 -1
- package/dist/assets/{en-B4ZKOASM-BzJoTEkl.js → en-B4ZKOASM-BTybY88I.js} +1 -1
- package/dist/assets/{erDiagram-JOGREHBK-C0852lY2.js → erDiagram-JOGREHBK-THgBTT-D.js} +1 -1
- package/dist/assets/erd-edge-style-CxzPKYj4.js +1 -0
- package/dist/assets/{es-ES-U4NZUMDT-BoIEO5rM.js → es-ES-U4NZUMDT-BAbfUzFl.js} +1 -1
- package/dist/assets/{eu-ES-A7QVB2H4-mOt3m4uI.js → eu-ES-A7QVB2H4-CHe2EtMV.js} +1 -1
- package/dist/assets/{fa-IR-HGAKTJCU-CZkSZDfX.js → fa-IR-HGAKTJCU-SGwOa_sr.js} +1 -1
- package/dist/assets/{fi-FI-Z5N7JZ37-BMu0xj98.js → fi-FI-Z5N7JZ37-Cr8yhV_8.js} +1 -1
- package/dist/assets/flowDiagram-UKHOOZJN-B5bEs8ii.js +1 -0
- package/dist/assets/{fr-FR-RHASNOE6-Bw4q0QZU.js → fr-FR-RHASNOE6-CBb8BJCR.js} +1 -1
- package/dist/assets/{ganttDiagram-PKOTCBZU-BPub267t.js → ganttDiagram-PKOTCBZU-Bjxvljvz.js} +1 -1
- package/dist/assets/{gitGraphDiagram-DS77QQ5N-B1y6rSYD.js → gitGraphDiagram-DS77QQ5N-Ce60FoaA.js} +1 -1
- package/dist/assets/{gl-ES-HMX3MZ6V-zOlTGxCp.js → gl-ES-HMX3MZ6V-D0Fig-rU.js} +1 -1
- package/dist/assets/{he-IL-6SHJWFNN-DWnvbH2_.js → he-IL-6SHJWFNN-CV4YOzik.js} +1 -1
- package/dist/assets/{hi-IN-IWLTKZ5I-CoR0eOPg.js → hi-IN-IWLTKZ5I-DfKc4RVX.js} +1 -1
- package/dist/assets/{hu-HU-A5ZG7DT2-BLeAJmTy.js → hu-HU-A5ZG7DT2-B4qFcDdU.js} +1 -1
- package/dist/assets/{id-ID-SAP4L64H-Bq3f8o2h.js → id-ID-SAP4L64H-D_BYkV1e.js} +1 -1
- package/dist/assets/image-GAAHSSAO-fk-6lFsY.js +1 -0
- package/dist/assets/{index-DebWn6pT.js → index-C6NttpSr.js} +4 -4
- package/dist/assets/{infoDiagram-6WML65LV-vdk1_fIH.js → infoDiagram-6WML65LV-D6h0tg2Q.js} +1 -1
- package/dist/assets/{ishikawaDiagram-WSZJBQD7-Drt6vUXg.js → ishikawaDiagram-WSZJBQD7-C9B6sXlW.js} +1 -1
- package/dist/assets/{it-IT-JPQ66NNP-3TtifHWc.js → it-IT-JPQ66NNP-l-U0FMkh.js} +1 -1
- package/dist/assets/{ja-JP-DBVTYXUO-D2bFEEyq.js → ja-JP-DBVTYXUO-BXlmwyMp.js} +1 -1
- package/dist/assets/{journeyDiagram-NVQOT4AX-5i8xqpt5.js → journeyDiagram-NVQOT4AX--P7qnQvU.js} +1 -1
- package/dist/assets/{kaa-6HZHGXH3-Bwd3rLB7.js → kaa-6HZHGXH3-jmDsjsEc.js} +1 -1
- package/dist/assets/{kab-KAB-ZGHBKWFO-CXJmW41l.js → kab-KAB-ZGHBKWFO-CbkHJbO4.js} +1 -1
- package/dist/assets/{kanban-definition-27J2QSJJ-hFNpHYsl.js → kanban-definition-27J2QSJJ-DOZGleBX.js} +1 -1
- package/dist/assets/{kk-KZ-P5N5QNE5-yAc6N3Ln.js → kk-KZ-P5N5QNE5-D1aRUCV1.js} +1 -1
- package/dist/assets/{km-KH-HSX4SM5Z-CjLM1O1m.js → km-KH-HSX4SM5Z-CHVdE3DE.js} +1 -1
- package/dist/assets/{ko-KR-MTYHY66A-BanW3q5p.js → ko-KR-MTYHY66A-CXbsfyl3.js} +1 -1
- package/dist/assets/{ku-TR-6OUDTVRD-6E3tq6x-.js → ku-TR-6OUDTVRD-FFSj-ZWy.js} +1 -1
- package/dist/assets/{line-CGlkvWK7.js → line-qzo2xmC_.js} +1 -1
- package/dist/assets/{lt-LT-XHIRWOB4-ouO5pDpQ.js → lt-LT-XHIRWOB4-DIHwjMvN.js} +1 -1
- package/dist/assets/{lv-LV-5QDEKY6T-BHaZNEH7.js → lv-LV-5QDEKY6T-CJEQm9hT.js} +1 -1
- package/dist/assets/{mindmap-definition-FAOFIHXS-kRbJTDlt.js → mindmap-definition-FAOFIHXS-DC8R9Y0e.js} +1 -1
- package/dist/assets/{mr-IN-CRQNXWMA-BjWYZVWn.js → mr-IN-CRQNXWMA-BLf0HWSs.js} +1 -1
- package/dist/assets/{my-MM-5M5IBNSE-CkP2AG1u.js → my-MM-5M5IBNSE-_uKpuG6S.js} +1 -1
- package/dist/assets/{nb-NO-T6EIAALU-C0YXnZoZ.js → nb-NO-T6EIAALU-Ck7KoJL4.js} +1 -1
- package/dist/assets/{nl-NL-IS3SIHDZ-BjOH2CyU.js → nl-NL-IS3SIHDZ-C5yxj1Sy.js} +1 -1
- package/dist/assets/{nn-NO-6E72VCQL-Dv0vMZuF.js → nn-NO-6E72VCQL-C9lJfz1T.js} +1 -1
- package/dist/assets/{note-importer-C0R8FnQQ.js → note-importer-Dm-EbLu1.js} +2 -2
- package/dist/assets/{oc-FR-POXYY2M6-BnrUq2-o.js → oc-FR-POXYY2M6-Cl3vZWmF.js} +1 -1
- package/dist/assets/{pa-IN-N4M65BXN-DoZcS9iB.js → pa-IN-N4M65BXN-CApDR5ax.js} +1 -1
- package/dist/assets/{pegDiagram-VL7TDLO6-SwS9zbd8.js → pegDiagram-VL7TDLO6-hXQpTG2b.js} +1 -1
- package/dist/assets/percentages-BXMCSKIN-BDllN6Y_.js +1 -0
- package/dist/assets/{pieDiagram-7S7Q4E2Y-DSMPFBZd.js → pieDiagram-7S7Q4E2Y-CczXfpAt.js} +1 -1
- package/dist/assets/{pl-PL-T2D74RX3-CsG9Pf8-.js → pl-PL-T2D74RX3-Qy2kQMsK.js} +1 -1
- package/dist/assets/{pt-BR-5N22H2LF-ChyPS39l.js → pt-BR-5N22H2LF-DT_RvM42.js} +1 -1
- package/dist/assets/{pt-PT-UZXXM6DQ-C76dgQnN.js → pt-PT-UZXXM6DQ-BDTividp.js} +1 -1
- package/dist/assets/{quadrantDiagram-CIZ2JOQS-B4MIrAbT.js → quadrantDiagram-CIZ2JOQS-DGbzVoX5.js} +1 -1
- package/dist/assets/{railroadDiagram-AXF67PYL-DH1uo8XU.js → railroadDiagram-AXF67PYL-CV1P2u58.js} +1 -1
- package/dist/assets/{requirementDiagram-LRYGKXZP-PcNwUHLb.js → requirementDiagram-LRYGKXZP-SOHnfUCo.js} +1 -1
- package/dist/assets/{ro-RO-JPDTUUEW-Cg45o12B.js → ro-RO-JPDTUUEW-BVXrBCQV.js} +1 -1
- package/dist/assets/{ru-RU-B4JR7IUQ-dndBmG6x.js → ru-RU-B4JR7IUQ-dH9apKhf.js} +1 -1
- package/dist/assets/{sankeyDiagram-W5VNT64P-CZMyYMF0.js → sankeyDiagram-W5VNT64P-DbGA74Kl.js} +1 -1
- package/dist/assets/{sequenceDiagram-SI44F4Z6-DUKYYfgZ.js → sequenceDiagram-SI44F4Z6-6ki3i9Ia.js} +1 -1
- package/dist/assets/{si-LK-N5RQ5JYF-D51b43mU.js → si-LK-N5RQ5JYF-BUHNpUV0.js} +1 -1
- package/dist/assets/{sk-SK-C5VTKIMK-bdRr2Uvi.js → sk-SK-C5VTKIMK-D6ZhrGeA.js} +1 -1
- package/dist/assets/{sl-SI-NN7IZMDC-B3TYHJz1.js → sl-SI-NN7IZMDC-B5fhl0cZ.js} +1 -1
- package/dist/assets/{stateDiagram-OKZ733FA-a0yJw5sZ.js → stateDiagram-OKZ733FA-DZKSQ9qi.js} +1 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-BvTZFK6A.js +1 -0
- package/dist/assets/subset-shared.chunk-Bq1KzdLj.js +1 -0
- package/dist/assets/{subset-worker.chunk-BXEr1ukc.js → subset-worker.chunk-BPTKqZZn.js} +1 -1
- package/dist/assets/{sv-SE-XGPEYMSR-Ci3Ml-c1.js → sv-SE-XGPEYMSR-CUCodm9X.js} +1 -1
- package/dist/assets/{swimlanes-SLNWSIFB-Cl79aFru.js → swimlanes-SLNWSIFB-DYTsu017.js} +1 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-CAzoNp5s.js +8 -0
- package/dist/assets/{ta-IN-2NMHFXQM-BcjYMU_6.js → ta-IN-2NMHFXQM-D24WXr93.js} +1 -1
- package/dist/assets/{th-TH-HPSO5L25-BMZ8UAWL.js → th-TH-HPSO5L25-HRXMDNcS.js} +1 -1
- package/dist/assets/{timeline-definition-Z64GVDOM-HV96X5BX.js → timeline-definition-Z64GVDOM-89QKVonk.js} +1 -1
- package/dist/assets/{tr-TR-DEFEU3FU-Dm4R5opc.js → tr-TR-DEFEU3FU-D5NRZ8mc.js} +1 -1
- package/dist/assets/{uk-UA-QMV73CPH-Dk2Mox79.js → uk-UA-QMV73CPH-CGkeDHJ2.js} +1 -1
- package/dist/assets/{vennDiagram-T6HMQDX7-BtumEYYE.js → vennDiagram-T6HMQDX7-BDhljTQ8.js} +1 -1
- package/dist/assets/{vi-VN-M7AON7JQ-VByXi1-h.js → vi-VN-M7AON7JQ-B09ZJ2h8.js} +1 -1
- package/dist/assets/{wardleyDiagram-T6FBY63Y-CjXi-XWp.js → wardleyDiagram-T6FBY63Y-3JUs1Bmb.js} +1 -1
- package/dist/assets/{xychartDiagram-ELKLHX3M-DuiRmC7w.js → xychartDiagram-ELKLHX3M-D02DMq0P.js} +1 -1
- package/dist/assets/{zh-CN-LNUGB5OW-Dl1mpU_p.js → zh-CN-LNUGB5OW-DZlfStYu.js} +1 -1
- package/dist/assets/{zh-HK-E62DVLB3-qoSJkXRo.js → zh-HK-E62DVLB3-D5gLP5l1.js} +1 -1
- package/dist/assets/{zh-TW-RAJ6MFWO-B7lGU67N.js → zh-TW-RAJ6MFWO-DaCRMg0w.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/channel-DWVLVHtI.js +0 -1
- package/dist/assets/classDiagram-JCYQIIEL-CjiYDvCP.js +0 -1
- package/dist/assets/classDiagram-v2-OCEON4UE-CjiYDvCP.js +0 -1
- package/dist/assets/erd-edge-style-DQ7dSHQA.js +0 -1
- package/dist/assets/flowDiagram-UKHOOZJN-mn4LXrGb.js +0 -1
- package/dist/assets/image-GAAHSSAO-B2SojC6-.js +0 -1
- package/dist/assets/percentages-BXMCSKIN-Cc_YAeHY.js +0 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-l_7RSzJ_.js +0 -1
- package/dist/assets/subset-shared.chunk-CpWePhko.js +0 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-CTSLoUag.js +0 -8
|
@@ -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-
|
|
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-CPDM8Q21.js";import{n as i}from"./WorkspaceContext-O7njKDwj.js";import{fn as a}from"./index-C6NttpSr.js";import{FlowchartView as o}from"./FlowchartView-DkM-lVOG.js";import{t as s}from"./ProjectFileTabs-Dd7YGTk9.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,4 +1,4 @@
|
|
|
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{E as ne,a as h,c as g,i as _,l as v,n as y,o as b,s as x,t as S}from"./dialog-BDJ53r24.js";import{x as C}from"./useCompositeItem-dSQJByV3.js";import{i as w,n as T,o as E,s as D,t as O}from"./select-C3bXpw6O.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-CId4LtFA.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-Cr-mF_hd.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-DebWn6pT.js";/* empty css */import{t as we}from"./JumpToNode-DiUpsDFt.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)(g,{}),(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)(ne,{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>
|
|
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{E as ne,a as h,c as g,i as _,l as v,n as y,o as b,s as x,t as S}from"./dialog-BDJ53r24.js";import{x as C}from"./useCompositeItem-dSQJByV3.js";import{i as w,n as T,o as E,s as D,t as O}from"./select-C3bXpw6O.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-CId4LtFA.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-Cr-mF_hd.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-C6NttpSr.js";/* empty css */import{t as we}from"./JumpToNode-CZEVhDHd.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)(g,{}),(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)(ne,{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
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
3
|
<ellipse cx="80" cy="14" rx="78" ry="10.5" fill="${t}30" stroke="${t}" stroke-width="2" filter="url(#shadow)" />
|
|
4
4
|
<path d="M2,35 C2,45.5 158,45.5 158,35" fill="none" stroke="${t}" stroke-width="2" opacity="0.3" />
|
|
@@ -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{g as r}from"./downloadSVG-CdP2B3Gf.js";import{x as i}from"./useCompositeItem-dSQJByV3.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-C3bXpw6O.js";import{r as p}from"./utils-TcK2FSyg.js";import{t as m}from"./scroll-area-CId4LtFA.js";import{t as h}from"./search-hNBtHxSg.js";import{t as g}from"./input-Cr-mF_hd.js";import{Kt as _}from"./index-
|
|
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{x as i}from"./useCompositeItem-dSQJByV3.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-C3bXpw6O.js";import{r as p}from"./utils-TcK2FSyg.js";import{t as m}from"./scroll-area-CId4LtFA.js";import{t as h}from"./search-hNBtHxSg.js";import{t as g}from"./input-Cr-mF_hd.js";import{Kt as _}from"./index-C6NttpSr.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-
|
|
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-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotesView-Bp0lx_-F.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-BDJ53r24.js","assets/useControlled-DHoxCuAI.js","assets/floating-ui.utils.dom-B_-bZDGP.js","assets/useCompositeItem-dSQJByV3.js","assets/floating-ui.utils-DrtUanoU.js","assets/utils-TcK2FSyg.js","assets/createLucideIcon-CyJfQrak.js","assets/select-C3bXpw6O.js","assets/floating-ui.react-dom-C3qLYNxV.js","assets/check-DcrFpa6g.js","assets/input-Cr-mF_hd.js","assets/dist-DDYEjsV2.js","assets/context-menu-CRU3t6Gq.js","assets/search-hNBtHxSg.js","assets/link-2-DBo-eQZM.js","assets/arrow-left-sRwyfx9m.js","assets/calendar-D8fpVeTp.js","assets/scroll-area-CId4LtFA.js","assets/note-importer-Dm-EbLu1.js","assets/api-D87lw-98.js","assets/image-compression-COYPhRs3.js","assets/index-C6NttpSr.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-Tsi3FADL.js","assets/table-DCsJJ7Zs.js","assets/WorkspaceProvider-CPDM8Q21.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/WorkspaceContext-O7njKDwj.js","assets/ConfirmModal-BgBvZ2aq.js","assets/message-scroller-yHGBqWZ5.js","assets/extends-CvVTau-c.js","assets/label-Co-it7VP.js","assets/index-CZCB8_YM.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/Combination-BfBlC5cu.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-CPDM8Q21.js";import{n as o}from"./WorkspaceContext-O7njKDwj.js";import{t as s}from"./ProjectFileTabs-Dd7YGTk9.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-Bp0lx_-F.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])));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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-
|
|
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{x as f}from"./useCompositeItem-dSQJByV3.js";import{n as p}from"./dist-DDYEjsV2.js";import{n as re}from"./calendar-BXOaTonG.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-C0R8FnQQ.js";import{v as x}from"./WorkspaceProvider-COhnFKM1.js";import{n as S}from"./WorkspaceContext-O7njKDwj.js";import{R as ie,Xt as C,v as ae}from"./index-DebWn6pT.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-DQ7dSHQA.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-CNGIF3g5.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]))),L=(0,A.lazy)(()=>r(()=>import(`./ExcalidrawEditor-C5ViCJaK.js`),__vite__mapDeps([56,1,2,4,31,8,9,18,12,14,41,45,28,52,57,30,32,3,5,6,7,11,10,13,15,16,17,19,20,21,33,34,35,36,37,38,39,22,40,25,26,27,42,43,44,46,47,48,49,50,51,29,53])));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};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowchartView-DkM-lVOG.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-BDJ53r24.js","assets/useControlled-DHoxCuAI.js","assets/floating-ui.utils.dom-B_-bZDGP.js","assets/useCompositeItem-dSQJByV3.js","assets/floating-ui.utils-DrtUanoU.js","assets/utils-TcK2FSyg.js","assets/createLucideIcon-CyJfQrak.js","assets/select-C3bXpw6O.js","assets/floating-ui.react-dom-C3qLYNxV.js","assets/check-DcrFpa6g.js","assets/input-Cr-mF_hd.js","assets/dist-DDYEjsV2.js","assets/scroll-area-CId4LtFA.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-C6NttpSr.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BV7QT456-CCzugQp2.js","assets/context-menu-CRU3t6Gq.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-Tsi3FADL.js","assets/table-DCsJJ7Zs.js","assets/note-importer-Dm-EbLu1.js","assets/image-compression-COYPhRs3.js","assets/WorkspaceProvider-CPDM8Q21.js","assets/useAuth-B8-lFzUV.js","assets/dist-js-DXG5pDMi.js","assets/core-DNaw6KYU.js","assets/ConfirmModal-BgBvZ2aq.js","assets/message-scroller-yHGBqWZ5.js","assets/extends-CvVTau-c.js","assets/index-CZCB8_YM.css","assets/JumpToNode-CZEVhDHd.js","assets/style-CHpVij2M.css","assets/ExcalidrawEditor-DaUnJZTI.js","assets/Combination-BfBlC5cu.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{x as f}from"./useCompositeItem-dSQJByV3.js";import{n as p}from"./dist-DDYEjsV2.js";import{n as re}from"./calendar-D8fpVeTp.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-Dm-EbLu1.js";import{v as x}from"./WorkspaceProvider-CPDM8Q21.js";import{n as S}from"./WorkspaceContext-O7njKDwj.js";import{R as ie,Xt as C,v as ae}from"./index-C6NttpSr.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-CxzPKYj4.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-DkM-lVOG.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]))),L=(0,A.lazy)(()=>r(()=>import(`./ExcalidrawEditor-DaUnJZTI.js`),__vite__mapDeps([56,1,2,4,31,8,9,18,12,14,41,45,28,52,57,30,32,3,5,6,7,11,10,13,15,16,17,19,20,21,33,34,35,36,37,38,39,22,40,25,26,27,42,43,44,46,47,48,49,50,51,29,53])));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};
|