erdbpro 3.5.0 → 3.5.1
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-CDcnXmoO.js → AdminRoute-C4n6uBac.js} +2 -2
- package/dist/assets/{Combination-9NQ5IcZ8.js → Combination-C5kxx2aj.js} +1 -1
- package/dist/assets/{DataViewerModeToolbar-BBTbHEum.js → DataViewerModeToolbar-D0lLz_tp.js} +1 -1
- package/dist/assets/{DbClientEditorRoute-NJDqtnhM.js → DbClientEditorRoute-CQo9lrHS.js} +1 -1
- package/dist/assets/{DiagramEditorRoute-DpnoOA-z.js → DiagramEditorRoute-Dq0-Y9v7.js} +1 -1
- package/dist/assets/{DrawingEditorRoute-BHHJfim7.js → DrawingEditorRoute-B5BGZk_C.js} +2 -2
- package/dist/assets/{DrawingsView-DXfn4Ryc.js → DrawingsView-CXwWPqj1.js} +8 -8
- package/dist/assets/{ERDComments-LpzCPCMv.js → ERDComments-Dru4ZWIi.js} +1 -1
- package/dist/assets/{FlowchartEditorRoute-BPmTNLds.js → FlowchartEditorRoute-Bj7cb11W.js} +1 -1
- package/dist/assets/{LibraryRoute-CWa9btFV.js → LibraryRoute-BphX_ytR.js} +1 -1
- package/dist/assets/{NoteEditorRoute-kiHlN8VV.js → NoteEditorRoute-W97hLIHR.js} +2 -2
- package/dist/assets/{NotesView-CX14CsGe.js → NotesView-QHPMGuWq.js} +1 -1
- package/dist/assets/{TeamInventoryRoute-CEfQspDg.js → TeamInventoryRoute-DzzS21IV.js} +1 -1
- package/dist/assets/{TeamManagementRoute-CQtAgq5N.js → TeamManagementRoute-CybuL6Bv.js} +1 -1
- package/dist/assets/{TrashView-3CLR_2x0.js → TrashView-sy-mub6l.js} +1 -1
- package/dist/assets/{UserManagementRoute-ClTxPc7H.js → UserManagementRoute-0YK0heh7.js} +1 -1
- package/dist/assets/{WorkspaceProvider-B_DMxpr4.js → WorkspaceProvider-Bm1NbsXB.js} +3 -3
- package/dist/assets/{abnfDiagram-VCTEODGH-BnMVJIBw.js → abnfDiagram-VCTEODGH-DOtZU5Nb.js} +1 -1
- package/dist/assets/{ar-SA-G6X2FPQ2-DXDJE-vb.js → ar-SA-G6X2FPQ2-DqtqTxEx.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-CvO7_LEy.js → architectureDiagram-5GKGNRK7-DrUiY6jc.js} +1 -1
- package/dist/assets/{az-AZ-76LH7QW2-BwLvJZO7.js → az-AZ-76LH7QW2-DotSs0Hq.js} +1 -1
- package/dist/assets/{bg-BG-XCXSNQG7-C8xf2Yy2.js → bg-BG-XCXSNQG7-C5ORB72o.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-0ko4u7-8.js → blockDiagram-I7D4REHJ-DeZbBDFA.js} +1 -1
- package/dist/assets/{bn-BD-2XOGV67Q-JepQbiG8.js → bn-BD-2XOGV67Q-CHxO5Fim.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-BYrDT5bT.js → c4Diagram-7LVT6UL2-FcZ0teHU.js} +1 -1
- package/dist/assets/{ca-ES-6MX7JW3Y-Zt9JRkj_.js → ca-ES-6MX7JW3Y-C67oxAcI.js} +1 -1
- package/dist/assets/channel-CLD2bXma.js +1 -0
- package/dist/assets/{chunk-4HAMMTFA-CXNvrh6O.js → chunk-4HAMMTFA-Chm4zhxj.js} +1 -1
- package/dist/assets/{chunk-75Z2AOVW-hLnP6zKG.js → chunk-75Z2AOVW-wy_Cqyla.js} +1 -1
- package/dist/assets/{chunk-DU6HZSFF-rDJID9_O.js → chunk-DU6HZSFF-CHqCHMpT.js} +1 -1
- package/dist/assets/{chunk-EIO257PC-BAAid2ZM.js → chunk-EIO257PC-CorEnyx7.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-BiLztkqY.js → chunk-F27PBJKO-CrgRL0gI.js} +1 -1
- package/dist/assets/{chunk-GMAD6QVW-DASHJdRu.js → chunk-GMAD6QVW-RKo7-tkO.js} +1 -1
- package/dist/assets/{chunk-GVQU2GXP-CmsXQt-0.js → chunk-GVQU2GXP-BCVv6SI3.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-Bsla_VLo.js → chunk-IMKFNOWR-DqkvOSI9.js} +1 -1
- package/dist/assets/{chunk-L3NEJ4N5-DUXjOGSZ.js → chunk-L3NEJ4N5-B3XndYom.js} +1 -1
- package/dist/assets/{chunk-OSK3NFVY-D9Lan-tQ.js → chunk-OSK3NFVY-DO4sBSS4.js} +1 -1
- package/dist/assets/{chunk-P2QGCYS3-BI04i-jf.js → chunk-P2QGCYS3-W-YlVzO5.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-BJ-9dKJ0.js → chunk-POPQ4Y6H-CCd-yox5.js} +1 -1
- package/dist/assets/{chunk-PWAF6VOD-DIs1WnYW.js → chunk-PWAF6VOD-v9qQeo_G.js} +1 -1
- package/dist/assets/{chunk-SHT3W25Y-DiM7HsXD.js → chunk-SHT3W25Y-C30cTDpL.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-Bef_Q9ai.js → chunk-SVP7TREG-BA0pL9L_.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-2KXQ0vMe.js → chunk-TICWLB2K-BwKJ8eCU.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-DTFBs_mV.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-DTFBs_mV.js +1 -0
- package/dist/assets/{cs-CZ-2BRQDIVT-C51A9US0.js → cs-CZ-2BRQDIVT-uI_SVnol.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-CaYemrKy.js → cynefinDiagram-5FMLGOSQ-DDNsw6xT.js} +1 -1
- package/dist/assets/{da-DK-5WZEPLOC-CjIiInG0.js → da-DK-5WZEPLOC-DwzCkvlb.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-MJK9o2Zv.js → dagre-GXQ25YYZ-Bsn2S_jo.js} +1 -1
- package/dist/assets/{de-DE-XR44H4JA-Cj6CUihn.js → de-DE-XR44H4JA-Cs9L81ZF.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-utPfDE-k.js → diagram-S7CK7UJ4-4Ln5UnqV.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-LLSbkvu5.js → diagram-UQ7AKVKN-SZep28mv.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-CFBzVyA4.js → diagram-VSXAHHWV-BAzfI8V_.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-CixBtUbX.js → diagram-VX7I27RA-BNCAb8um.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-LCX8V34J.js → diagram-Z3DM3KII-COu5bvF9.js} +1 -1
- package/dist/assets/{dist-Bx4s2XYp.js → dist-DYLYsHMA.js} +4 -4
- package/dist/assets/{ebnfDiagram-PWID7BFC-CtXSGo6F.js → ebnfDiagram-PWID7BFC-PtQPQDee.js} +1 -1
- package/dist/assets/{el-GR-BZB4AONW-BszOYSpb.js → el-GR-BZB4AONW-DBkTWNjf.js} +1 -1
- package/dist/assets/{en-B4ZKOASM-BzxRi3ms.js → en-B4ZKOASM-JQKOa1vH.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-BoKl0Odq.js → erDiagram-RLTQ6QDP-DY3xod3B.js} +1 -1
- package/dist/assets/{erdActions-DJACvAwL.js → erdActions-CfROifYD.js} +1 -1
- package/dist/assets/{es-ES-U4NZUMDT-jBkN83UA.js → es-ES-U4NZUMDT-Dvkff06W.js} +1 -1
- package/dist/assets/{eu-ES-A7QVB2H4-BmhAJKMT.js → eu-ES-A7QVB2H4-BvoY7UbS.js} +1 -1
- package/dist/assets/{fa-IR-HGAKTJCU-BAtucQDD.js → fa-IR-HGAKTJCU-B6qqoacu.js} +1 -1
- package/dist/assets/{fi-FI-Z5N7JZ37-wYS7C_FE.js → fi-FI-Z5N7JZ37-CogZXQOh.js} +1 -1
- package/dist/assets/flowDiagram-HODETNUW-gixb7-4-.js +1 -0
- package/dist/assets/{fr-FR-RHASNOE6-w-WVXBvh.js → fr-FR-RHASNOE6-BKXJj1_2.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-DfEZ67oh.js → ganttDiagram-EL5Y4UJY-BMTkP1y8.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-DjuikJzA.js → gitGraphDiagram-WWUBYQGX-DXFqBm0H.js} +1 -1
- package/dist/assets/{gl-ES-HMX3MZ6V-Dsyoigf_.js → gl-ES-HMX3MZ6V-B7EEp_IE.js} +1 -1
- package/dist/assets/{he-IL-6SHJWFNN-kblM5BXF.js → he-IL-6SHJWFNN-BkMbZtBm.js} +1 -1
- package/dist/assets/{hi-IN-IWLTKZ5I-CbdojclK.js → hi-IN-IWLTKZ5I-KTIjCp7l.js} +1 -1
- package/dist/assets/{hu-HU-A5ZG7DT2-B0aljhuo.js → hu-HU-A5ZG7DT2-DZlJFAtn.js} +1 -1
- package/dist/assets/{id-ID-SAP4L64H-D3LFUW4H.js → id-ID-SAP4L64H-Dv09SrSw.js} +1 -1
- package/dist/assets/{image-GAAHSSAO-CUI2Ka8k.js → image-GAAHSSAO-uaQCl--o.js} +1 -1
- package/dist/assets/{index-CNURTlUS.js → index-CpB0lOgn.js} +4 -4
- package/dist/assets/{infoDiagram-27XIBGKW-DQbhYmeJ.js → infoDiagram-27XIBGKW-BIXbati1.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-BTNIxIEA.js → ishikawaDiagram-5VMMS53U-C0BcqReJ.js} +1 -1
- package/dist/assets/{it-IT-JPQ66NNP-DFRZaYie.js → it-IT-JPQ66NNP-BqqDBJ6_.js} +1 -1
- package/dist/assets/{ja-JP-DBVTYXUO-Cxifg62Z.js → ja-JP-DBVTYXUO-Ct9NbEYM.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-Ca3WNu9V.js → journeyDiagram-3NMN7TZE-Z_-0yXkP.js} +1 -1
- package/dist/assets/{kaa-6HZHGXH3-D1AwjAjw.js → kaa-6HZHGXH3-D_9uIx1G.js} +1 -1
- package/dist/assets/{kab-KAB-ZGHBKWFO-CVkL8t98.js → kab-KAB-ZGHBKWFO-MKGgiBOc.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-Rtd2bj64.js → kanban-definition-UXKFOSKX-D_j8h2uP.js} +1 -1
- package/dist/assets/{kk-KZ-P5N5QNE5-CQUPghdo.js → kk-KZ-P5N5QNE5-CsuOCv98.js} +1 -1
- package/dist/assets/{km-KH-HSX4SM5Z-DU0FCv1S.js → km-KH-HSX4SM5Z-CCNsJdJ6.js} +1 -1
- package/dist/assets/{ko-KR-MTYHY66A-NJ2az76Q.js → ko-KR-MTYHY66A-CYVbTNR_.js} +1 -1
- package/dist/assets/{ku-TR-6OUDTVRD-4juvUQjR.js → ku-TR-6OUDTVRD-MyMbccVq.js} +1 -1
- package/dist/assets/{line-C66W_AZZ.js → line-D3CFHrPA.js} +1 -1
- package/dist/assets/{lt-LT-XHIRWOB4-C8sgJ633.js → lt-LT-XHIRWOB4-DvOlZnjX.js} +1 -1
- package/dist/assets/{lv-LV-5QDEKY6T-Bxq6FF6x.js → lv-LV-5QDEKY6T-DPMTU6N-.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-DJYnFo9V.js → mindmap-definition-YA3MSWOX-DmBsjzR-.js} +1 -1
- package/dist/assets/{mr-IN-CRQNXWMA-CJFrmFUl.js → mr-IN-CRQNXWMA-1FM5zD8M.js} +1 -1
- package/dist/assets/{my-MM-5M5IBNSE-C7lHhzOa.js → my-MM-5M5IBNSE-C7JVSIxM.js} +1 -1
- package/dist/assets/{nb-NO-T6EIAALU-MWB2_EGw.js → nb-NO-T6EIAALU-IztH5NCQ.js} +1 -1
- package/dist/assets/{nl-NL-IS3SIHDZ-DvelnxIi.js → nl-NL-IS3SIHDZ-0r7pFynB.js} +1 -1
- package/dist/assets/{nn-NO-6E72VCQL-DG9ASL00.js → nn-NO-6E72VCQL-B1tx-4h5.js} +1 -1
- package/dist/assets/{note-importer-zX3CI6Gc.js → note-importer-C-5L9Dpp.js} +2 -2
- package/dist/assets/{oc-FR-POXYY2M6-OwVwDi9i.js → oc-FR-POXYY2M6-CQ2V0S4P.js} +1 -1
- package/dist/assets/{pa-IN-N4M65BXN-C5Er_AAc.js → pa-IN-N4M65BXN-D3dOpQuS.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-BtP5ocW2.js → pegDiagram-XKGWAZYB-FO2S-qBJ.js} +1 -1
- package/dist/assets/percentages-BXMCSKIN-mWO2uOW_.js +1 -0
- package/dist/assets/{pieDiagram-E7YTZNPT-C3d16Zw6.js → pieDiagram-E7YTZNPT-Cixo6wre.js} +1 -1
- package/dist/assets/{pl-PL-T2D74RX3-BI8iHJyA.js → pl-PL-T2D74RX3-DBmTKZoc.js} +1 -1
- package/dist/assets/{popover-DtXwNixb.js → popover-CrlaGEPE.js} +1 -1
- package/dist/assets/{pt-BR-5N22H2LF-B7PJaui0.js → pt-BR-5N22H2LF-wXo1hSTA.js} +1 -1
- package/dist/assets/{pt-PT-UZXXM6DQ-DIxB_lIK.js → pt-PT-UZXXM6DQ-Dm32FOLJ.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-WbTaEeUe.js → quadrantDiagram-AXDQQJYC-BofOvLVL.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-DZTKbUfF.js → railroadDiagram-O6MQD6OU-UopxAjLb.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-BMdMglgn.js → requirementDiagram-BXWQKSXE-Dg_Pvahc.js} +1 -1
- package/dist/assets/{ro-RO-JPDTUUEW-CUFUhdEW.js → ro-RO-JPDTUUEW-BIA08fKU.js} +1 -1
- package/dist/assets/{ru-RU-B4JR7IUQ-20RQouu1.js → ru-RU-B4JR7IUQ-CkO1K-8z.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-C4ZAhrfy.js → sankeyDiagram-P5KCCOFB-BDXdr9dw.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-DDq2iz2i.js → sequenceDiagram-WJ2MYXX4-MjZdwDfh.js} +1 -1
- package/dist/assets/{si-LK-N5RQ5JYF-DsOoOtcZ.js → si-LK-N5RQ5JYF-CBY_k3J6.js} +1 -1
- package/dist/assets/{sk-SK-C5VTKIMK-DcS3r1ZI.js → sk-SK-C5VTKIMK-CCSQxtsI.js} +1 -1
- package/dist/assets/{sl-SI-NN7IZMDC-Dnoi_lNY.js → sl-SI-NN7IZMDC-q2YDsz7M.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-B3-UWPIS.js → stateDiagram-D77RDMKH-BXVF1gxo.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-B7fXmEAR.js +1 -0
- package/dist/assets/subset-shared.chunk-D7PWpV9W.js +1 -0
- package/dist/assets/{subset-worker.chunk-D_6Z0_-W.js → subset-worker.chunk-j1SqC8uo.js} +1 -1
- package/dist/assets/{sv-SE-XGPEYMSR-DngDMSEl.js → sv-SE-XGPEYMSR-DiKVpHsE.js} +1 -1
- package/dist/assets/{swimlanes-42K2YHIH-C4pZcjta.js → swimlanes-42K2YHIH-M1Ibpun0.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-BKk_XHfA.js +8 -0
- package/dist/assets/{ta-IN-2NMHFXQM-Cr7s761c.js → ta-IN-2NMHFXQM-Db76abSQ.js} +1 -1
- package/dist/assets/{th-TH-HPSO5L25-intWZGds.js → th-TH-HPSO5L25-BrrrY1Ls.js} +1 -1
- package/dist/assets/{timeline-definition-24CTP7MA-lFzYrsus.js → timeline-definition-24CTP7MA-BVwfQtNW.js} +1 -1
- package/dist/assets/{tr-TR-DEFEU3FU-DzEhJXMY.js → tr-TR-DEFEU3FU-EtIM-6wx.js} +1 -1
- package/dist/assets/{uk-UA-QMV73CPH-nUIxWl61.js → uk-UA-QMV73CPH-iuXJfluD.js} +1 -1
- package/dist/assets/{useLeaveGuard-olA4moBm.js → useLeaveGuard-kL35z0QR.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-3IXC2ero.js → vennDiagram-4TSXK5OY-BHcYW2jv.js} +1 -1
- package/dist/assets/{vi-VN-M7AON7JQ-AhXRC0ad.js → vi-VN-M7AON7JQ-DX8YIVOB.js} +1 -1
- package/dist/assets/{w3c-keyname-D5OrDgUl.js → w3c-keyname-BOFX7yv3.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-CNh3_Ko-.js → wardleyDiagram-VM6X3IG4-6q3zR8_U.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-BUZOCB-h.js → xychartDiagram-S5SC5T6Z-BLJzJ2Hl.js} +1 -1
- package/dist/assets/{zh-CN-LNUGB5OW-BCs_roRW.js → zh-CN-LNUGB5OW-CFsQWjsF.js} +1 -1
- package/dist/assets/{zh-HK-E62DVLB3-Dpv00PMS.js → zh-HK-E62DVLB3-Dd2j_EBM.js} +1 -1
- package/dist/assets/{zh-TW-RAJ6MFWO-DZBirUCx.js → zh-TW-RAJ6MFWO-BXD0MhO3.js} +1 -1
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/channel-C-0q9rtV.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-DvI3OjtI.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-DvI3OjtI.js +0 -1
- package/dist/assets/flowDiagram-HODETNUW-BsIIW8Uc.js +0 -1
- package/dist/assets/percentages-BXMCSKIN-DhBdHkaC.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-TgNYsTid.js +0 -1
- package/dist/assets/subset-shared.chunk-XG49n-Nu.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-CzFaDhHm.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{i as r}from"./createLucideIcon-DCn6SI1F.js";import{l as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as a}from"./button-CYI0LXM3.js";import{n as o,t as s}from"./refresh-cw-DyBeWpoi.js";import{t as c}from"./ConfirmModal-pEN41Kyx.js";import{n as l}from"./api-DuV0sTuY.js";import{n as u}from"./useAuth-splnWP_7.js";import{B as d,F as f,I as p,L as m,R as h,U as g,z as _}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{i as r}from"./createLucideIcon-DCn6SI1F.js";import{l as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as a}from"./button-CYI0LXM3.js";import{n as o,t as s}from"./refresh-cw-DyBeWpoi.js";import{t as c}from"./ConfirmModal-pEN41Kyx.js";import{n as l}from"./api-DuV0sTuY.js";import{n as u}from"./useAuth-splnWP_7.js";import{B as d,F as f,I as p,L as m,R as h,U as g,z as _}from"./index-CpB0lOgn.js";var v=e(t(),1),y=n(),b=e=>e===`active`?`default`:e===`quarantined`?`destructive`:`secondary`,x=e=>e===`quarantined`?`Quarantined`:e.charAt(0).toUpperCase()+e.slice(1);function S(){let e=i(),{user:t}=u(),n=!!(t?.isSuperAdmin||t?.is_super_admin),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(!0),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(null),M=(0,v.useCallback)(async()=>{T(!0),D(``);try{let e=await l(`/api/teams/inventory`),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||`Unable to load Team workspaces.`);C(t)}catch(e){D(e?.message||`Unable to load Team workspaces.`)}finally{T(!1)}},[]),N=async e=>{let t=e.status===`active`?`inactive`:`active`;j(e.id);try{let n=await l(`/api/teams/${encodeURIComponent(e.id)}/status`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(i.error||`Team status could not be changed.`);window.dispatchEvent(new CustomEvent(`team-status-changed`,{detail:{teamId:e.id,status:t}})),r.success(t===`active`?`Team activated`:`Team deactivated; its data was retained.`),await M()}catch(e){r.error(e?.message||`Team status could not be changed.`)}finally{j(null)}},P=S?.license&&(S.license.maxTeams!==null&&S.usage.teamCount>S.license.maxTeams||S.license.maxMembers!==null&&S.usage.memberCount>S.license.maxMembers),F=P?`License capacity exceeded. Deactivate Teams or memberships until active usage fits; data remains stored.`:S&&!S.license?`Check or activate the instance license in Settings to change Team status.`:`Review status and manage local Team workspaces.`;return(0,v.useEffect)(()=>{n&&M()},[n,M]),n?(0,y.jsxs)(`main`,{className:`-m-4 flex-1 overflow-auto bg-background`,children:[(0,y.jsxs)(`div`,{className:`flex w-full flex-col gap-6 p-6 lg:p-8`,children:[(0,y.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(a,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),"aria-label":`Back to dashboard`,children:(0,y.jsx)(o,{})}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Team Workspaces`}),(0,y.jsx)(`p`,{role:P?`alert`:void 0,className:`mt-1 text-sm ${P?`text-destructive`:`text-muted-foreground`}`,children:F})]})]}),(0,y.jsxs)(a,{variant:`outline`,onClick:()=>void M(),disabled:w,children:[(0,y.jsx)(s,{className:w?`animate-spin`:``}),` Refresh`]})]}),E&&(0,y.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:E}),(0,y.jsx)(`div`,{className:`rounded-lg border`,children:(0,y.jsxs)(f,{children:[(0,y.jsx)(_,{children:(0,y.jsxs)(d,{children:[(0,y.jsx)(h,{children:`Team`}),(0,y.jsx)(h,{children:`Status`}),(0,y.jsx)(h,{children:`Memberships`}),(0,y.jsx)(h,{children:`Created`}),(0,y.jsx)(h,{className:`w-52 text-right`,children:`Action`})]})}),(0,y.jsx)(p,{children:w?(0,y.jsx)(d,{children:(0,y.jsx)(m,{colSpan:5,className:`h-24 text-center text-muted-foreground`,children:`Loading Team workspaces…`})}):E?(0,y.jsx)(d,{children:(0,y.jsx)(m,{colSpan:5,className:`h-24 text-center text-muted-foreground`,children:`Team workspaces could not be loaded.`})}):S?.teams.length?S.teams.map(t=>(0,y.jsxs)(d,{children:[(0,y.jsx)(m,{className:`font-medium`,children:t.name}),(0,y.jsx)(m,{children:(0,y.jsx)(g,{variant:b(t.status),children:x(t.status)})}),(0,y.jsxs)(m,{children:[t.activeMemberCount,` active / `,t.memberCount,` total`]}),(0,y.jsx)(m,{className:`text-muted-foreground`,children:new Date(t.createdAt).toLocaleDateString()}),(0,y.jsx)(m,{children:(0,y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[t.canChangeStatus&&(0,y.jsx)(a,{variant:`outline`,size:`sm`,disabled:A!==null||!S?.license,onClick:()=>k(t),children:t.status===`active`?`Deactivate`:`Activate`}),(0,y.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>e(`/teams/${encodeURIComponent(t.id)}?from=team-workspaces`),children:`Review`})]})})]},t.id)):(0,y.jsx)(d,{children:(0,y.jsx)(m,{colSpan:5,className:`h-24 text-center text-muted-foreground`,children:`No Team workspaces found.`})})})]})})]}),(0,y.jsx)(c,{isOpen:!!O,title:O?.status===`active`?`Deactivate this Team?`:`Activate this Team?`,message:O?.status===`active`?`${O.name} will stop accepting Team access. Its documents and memberships will be retained; inactive Teams do not use an active Team slot.`:`${O?.name||`This Team`} will become available to its active members if active Team and member limits allow it.`,confirmText:O?.status===`active`?`Deactivate`:`Activate`,cancelText:`Cancel`,variant:`warning`,onCancel:()=>k(null),onConfirm:()=>{let e=O;k(null),e&&N(e)}})]}):(0,y.jsx)(`main`,{className:`flex flex-1 items-start p-6`,children:(0,y.jsx)(`p`,{children:`Only the SuperAdmin can view Team workspaces.`})})}export{S as TeamInventoryRoute,S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{i as r}from"./createLucideIcon-DCn6SI1F.js";import{d as i,f as a,l as o,r as s}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as c}from"./button-CYI0LXM3.js";import{a as l,f as u,i as d,o as f,r as p,t as m}from"./dropdown-menu-BoXeiuAZ.js";import{n as h,t as g}from"./refresh-cw-DyBeWpoi.js";import{i as _,n as v,o as y,r as b,s as x,t as S}from"./select-CdQCv8yP.js";import{t as C}from"./ConfirmModal-pEN41Kyx.js";import{t as w}from"./ellipsis-CfqIMSId.js";import{i as T,n as E,o as D,t as O}from"./field-BXvmJTfd.js";import{a as k,d as A,f as j,g as ee,h as te,i as M,l as ne,n as N,o as P,p as re,s as F,t as ie,v as I}from"./dialog-BIk9Y-3N.js";import{i as ae,n as oe,r as se,t as ce}from"./user-x-Cas_SoSK.js";import{n as L}from"./api-DuV0sTuY.js";import{t as R}from"./input-CMgoax5D.js";import{n as le}from"./useAuth-splnWP_7.js";import{n as ue}from"./WorkspaceContext-CitlpD55.js";import{t as z}from"./label-CfaCFYRS.js";import{$ as de,B,F as fe,H as V,I as pe,L as H,Mt as me,R as U,U as W,ln as G,on as K,sn as he,z as ge}from"./index-CNURTlUS.js";var q=e(t(),1),J=n(),_e=`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%`;function ve(){let e=new Uint32Array(18);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>_e[e%62]).join(``)}async function Y(e,t){let n=await e.json().catch(()=>({}));return Error(typeof n.error==`string`?n.error:t)}function ye({teamId:e,open:t,onOpenChange:n,onAdded:i}){let[a,o]=(0,q.useState)(null),[s,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(``),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(`staff`),[C,w]=(0,q.useState)(!1),A=C&&m.length>0&&f!==m,j=()=>{n(!1),l(``),d(``),p(``),h(``),v(!1),b(!1),w(!1),S(`staff`)},ee=()=>{p(ve()),h(``),v(!1),b(!1)},te=e=>{w(e),e?ee():(p(``),h(``),v(!1),b(!1))};return(0,J.jsx)(ie,{open:t,onOpenChange:e=>e?n(!0):j(),children:(0,J.jsx)(M,{size:`md`,children:(0,J.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),e&&s.trim()){if(C&&f!==m)r.error(`Passwords do not match.`);else{o(`add-member`);try{let t=await L(`/api/teams/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:s.trim(),...C?{name:u.trim(),password:f,confirmPassword:m}:{},role:x})});if(!t.ok)throw await Y(t,`Member could not be added.`);i(await t.json()),j(),r.success(`Member added`)}catch(e){r.error(e?.message||`Member could not be added.`)}finally{o(null)}}}},children:[(0,J.jsxs)(F,{children:[(0,J.jsx)(ne,{children:`Add member`}),(0,J.jsx)(k,{children:`Add an existing account, or create a new account for this Team.`})]}),(0,J.jsxs)(N,{className:`space-y-4`,children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{htmlFor:`team-member-email`,children:`Email`}),(0,J.jsx)(R,{id:`team-member-email`,type:`email`,value:s,onChange:e=>l(e.target.value),placeholder:`member@example.com`,required:!0,autoFocus:!0})]}),(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{children:`Role`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`Member role`,className:`grid gap-2 sm:grid-cols-2`,children:[`manager`,`staff`].map(e=>(0,J.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg border p-3 has-checked:border-primary has-checked:bg-primary/5`,children:[(0,J.jsx)(`input`,{type:`radio`,name:`team-member-role`,value:e,checked:x===e,onChange:()=>S(e),className:`mt-0.5 size-4 accent-primary`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium capitalize`,children:e}),(0,J.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e===`manager`?`Can manage this Team and its members.`:`Can collaborate on this Team's work.`})]})]},e))})]}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,J.jsx)(V,{checked:C,onCheckedChange:e=>te(e===!0)}),`Create a new account`]}),C&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{htmlFor:`team-member-name`,children:`Name`}),(0,J.jsx)(R,{id:`team-member-name`,value:u,onChange:e=>d(e.target.value),required:!0})]}),(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{htmlFor:`team-member-password`,children:`Temporary password`}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,J.jsx)(R,{id:`team-member-password`,type:_?`text`:`password`,value:f,readOnly:!0,"aria-readonly":`true`,minLength:8,required:!0,className:`pr-10`}),(0,J.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute right-1 top-1/2 -translate-y-1/2`,onClick:()=>v(e=>!e),"aria-label":_?`Hide temporary password`:`Show temporary password`,"aria-pressed":_,children:_?(0,J.jsx)(D,{}):(0,J.jsx)(K,{})})]}),(0,J.jsxs)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:ee,children:[(0,J.jsx)(g,{"data-icon":`inline-start`}),` Generate new`]})]}),(0,J.jsx)(E,{children:`Generated automatically. Share it securely; changing this password after signing in is optional.`})]}),(0,J.jsxs)(O,{"data-invalid":A,children:[(0,J.jsx)(T,{htmlFor:`team-member-confirm-password`,children:`Confirm password`}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(R,{id:`team-member-confirm-password`,type:y?`text`:`password`,value:m,onChange:e=>h(e.target.value),minLength:8,required:!0,"aria-invalid":A,className:`pr-10`}),(0,J.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute right-1 top-1/2 -translate-y-1/2`,onClick:()=>b(e=>!e),"aria-label":y?`Hide confirm password`:`Show confirm password`,"aria-pressed":y,children:y?(0,J.jsx)(D,{}):(0,J.jsx)(K,{})})]}),A?(0,J.jsx)(E,{className:`text-destructive`,children:`Passwords do not match.`}):(0,J.jsx)(E,{children:`Enter the same password again.`})]})]})]}),(0,J.jsxs)(P,{children:[(0,J.jsx)(c,{type:`button`,variant:`outline`,onClick:j,disabled:a!==null,children:`Cancel`}),(0,J.jsxs)(c,{type:`submit`,disabled:a!==null||!s.trim()||C&&(!u.trim()||f.length<8||m.length<8||f!==m),children:[a===`add-member`&&(0,J.jsx)(me,{className:`animate-spin`}),` Add member`]})]})]})})})}var X=e=>`${e.type}:${e.id}`;function Z(e){let[t,n]=(0,q.useState)(null),[i,a]=(0,q.useState)(!0),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(new Set),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!1),m=(0,q.useRef)(crypto.randomUUID()),h=(0,q.useRef)(!1),g=(0,q.useCallback)(async()=>{a(!0),s(``);try{let t=await L(`/api/teams/${encodeURIComponent(e)}/recovery`),r=await t.json();if(!t.ok)throw Error(r.error||`Files could not be loaded.`);n(r),l(e=>new Set([...e].filter(e=>r.files.some(t=>X(t)===e)))),d(e=>r.destinations.some(t=>t.id===e)?e:null)}catch(e){n(null),l(new Set),d(null),s(e instanceof Error?e.message:`Files could not be loaded.`)}finally{a(!1)}},[e]);return(0,q.useEffect)(()=>{g()},[g]),{inventory:t,loading:i,error:o,selected:c,targetTeamId:u,processing:f,load:g,select:(e,t)=>{m.current=crypto.randomUUID(),l(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r})},chooseTarget:e=>{m.current=crypto.randomUUID(),d(e)},recover:async()=>{if(!h.current&&u&&c.size!==0){h.current=!0,p(!0);try{let n=(t?.files||[]).filter(e=>c.has(X(e))).map(({id:e,type:t})=>({id:e,type:t})),i=await L(`/api/teams/${encodeURIComponent(e)}/recovery`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({operationId:m.current,targetTeamId:u,files:n})}),a=await i.json();if(!i.ok)throw Error(a.error||`Files could not be recovered.`);r.success(`${a.fileCount} ${a.fileCount===1?`file`:`files`} recovered into ${a.projectCount} ${a.projectCount===1?`project`:`projects`}.`),l(new Set),m.current=crypto.randomUUID(),window.dispatchEvent(new CustomEvent(`team-files-recovered`,{detail:{teamId:u}})),await g()}catch(e){r.error(e instanceof Error?e.message:`Files could not be recovered.`)}finally{h.current=!1,p(!1)}}}}}var Q={erd:{label:`ERD Builder`,color:`bg-sky-100 text-sky-900 dark:bg-sky-950 dark:text-sky-200`},notes:{label:`Notes`,color:`bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-200`},drawings:{label:`Drawings`,color:`bg-violet-100 text-violet-900 dark:bg-violet-950 dark:text-violet-200`},flowchart:{label:`Flowchart`,color:`bg-emerald-100 text-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`}},be=e=>e?new Date(e).toLocaleDateString():`—`;function xe({teamId:e}){let t=Z(e),[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(`all`),[o,s]=(0,q.useState)(!1),l=(0,q.useMemo)(()=>(t.inventory?.files||[]).filter(e=>(i===`all`||i===e.type)&&`${e.name} ${e.projectName}`.toLowerCase().includes(n.toLowerCase())),[t.inventory,n,i]),u=l.map(X),d=u.filter(e=>t.selected.has(e)).length,f=t.selected.size-d,p=t.inventory?.destinations.find(e=>e.id===t.targetTeamId),m=t.loading||t.processing;return(0,J.jsxs)(`section`,{className:`space-y-4`,"aria-labelledby":`recovery-title`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{id:`recovery-title`,className:`text-lg font-semibold`,children:`Recover files`}),(0,J.jsxs)(c,{variant:`outline`,onClick:()=>void t.load(),disabled:m,children:[(0,J.jsx)(g,{className:t.loading?`animate-spin`:``}),` Refresh`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,J.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,J.jsx)(I,{className:`pointer-events-none absolute top-2.5 left-3 size-4 text-muted-foreground`}),(0,J.jsx)(R,{value:n,onChange:e=>r(e.target.value),placeholder:`Search files or projects`,"aria-label":`Search recovery files`,className:`pl-9`,disabled:t.processing})]}),(0,J.jsxs)(S,{value:i,onValueChange:a,disabled:t.processing,children:[(0,J.jsx)(y,{className:`w-full sm:w-44`,"aria-label":`Filter by file type`,children:(0,J.jsx)(x,{children:i===`all`?`All file types`:Q[i]?.label})}),(0,J.jsx)(v,{children:(0,J.jsxs)(b,{children:[(0,J.jsx)(_,{value:`all`,children:`All file types`}),Object.entries(Q).map(([e,t])=>(0,J.jsx)(_,{value:e,children:t.label},e))]})})]})]}),t.error&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:t.error}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,J.jsxs)(fe,{children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(B,{children:[(0,J.jsx)(U,{className:`w-12 pl-4`,children:(0,J.jsx)(V,{className:`border-muted-foreground`,"aria-label":`Select all visible files`,checked:u.length>0&&d===u.length,indeterminate:d>0&&d<u.length,onCheckedChange:e=>t.select(u,e),disabled:m||u.length===0})}),(0,J.jsx)(U,{children:`File`}),(0,J.jsx)(U,{children:`File type`}),(0,J.jsx)(U,{children:`Project`}),(0,J.jsx)(U,{children:`Updated`}),(0,J.jsx)(U,{children:`Recovery`})]})}),(0,J.jsx)(pe,{children:t.loading?(0,J.jsx)(B,{children:(0,J.jsx)(H,{colSpan:6,className:`h-32 text-center`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted-foreground`,children:[(0,J.jsx)(me,{className:`size-4 animate-spin`}),` Loading files…`]})})}):l.length===0?(0,J.jsx)(B,{children:(0,J.jsx)(H,{colSpan:6,className:`h-32 text-center text-muted-foreground`,children:t.error?`Refresh to load the file list again.`:n||i!==`all`?`No files match these filters.`:`This Team has no available files to recover.`})}):l.map(e=>(0,J.jsxs)(B,{"data-state":t.selected.has(X(e))?`selected`:void 0,children:[(0,J.jsx)(H,{className:`pl-4`,children:(0,J.jsx)(V,{className:`border-muted-foreground`,"aria-label":`Select ${e.name} in ${e.projectName}`,checked:t.selected.has(X(e)),onCheckedChange:n=>t.select([X(e)],n),disabled:t.processing})}),(0,J.jsx)(H,{className:`max-w-80 whitespace-normal font-medium`,children:e.name}),(0,J.jsx)(H,{children:(0,J.jsx)(W,{variant:`secondary`,className:Q[e.type].color,children:Q[e.type].label})}),(0,J.jsx)(H,{className:`max-w-64 whitespace-normal text-muted-foreground`,children:e.projectName}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:be(e.updatedAt)}),(0,J.jsx)(H,{children:e.recovery?(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(W,{variant:`outline`,children:`Recovered`}),(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.recovery.teamName,` · `,be(e.recovery.at)]})]}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Not copied`})})]},X(e)))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`w-full space-y-2 sm:max-w-sm`,children:[(0,J.jsx)(z,{htmlFor:`recovery-team`,children:`Destination Team`}),(0,J.jsxs)(S,{value:t.targetTeamId,onValueChange:t.chooseTarget,disabled:m||!t.inventory?.destinations.length,children:[(0,J.jsx)(y,{id:`recovery-team`,children:(0,J.jsx)(x,{children:p?.name||`Choose an active Team`})}),(0,J.jsx)(v,{children:(0,J.jsx)(b,{children:t.inventory?.destinations.map(e=>(0,J.jsx)(_,{value:e.id,children:e.name},e.id))})})]}),!t.loading&&t.inventory&&t.inventory.destinations.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create an active Team before recovering files.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsxs)(`p`,{"aria-live":`polite`,className:`text-sm text-muted-foreground`,children:[t.selected.size,` selected`,f>0&&` · ${f} hidden by filters`]}),t.selected.size>0&&(0,J.jsx)(c,{variant:`ghost`,size:`sm`,disabled:t.processing,onClick:()=>t.select([...t.selected],!1),children:`Clear selection`}),(0,J.jsxs)(c,{onClick:()=>s(!0),disabled:m||!p||t.selected.size===0||t.selected.size>500,children:[(0,J.jsx)(G,{}),` `,t.processing?`Recovering…`:`Recover selected files`]})]})]}),t.selected.size>500&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose up to 500 files per recovery.`}),(0,J.jsxs)(`details`,{className:`text-sm text-muted-foreground`,children:[(0,J.jsx)(`summary`,{className:`w-fit cursor-pointer rounded focus-visible:outline-2 focus-visible:outline-ring`,children:`What will be copied?`}),(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl`,children:`File contents and ERD structure are copied into new projects. Existing media references are kept. Copies start private and are owned by you; discussion, comment and AI histories stay with the source.`})]}),(0,J.jsx)(C,{isOpen:o,title:`Recover selected files?`,message:`Copy ${t.selected.size} files into new projects in ${p?.name||`the destination Team`}? Members of that Team will be able to access the copies. The quarantined originals will stay stored.`,confirmText:`Recover files`,variant:`info`,onCancel:()=>s(!1),onConfirm:()=>{s(!1),t.recover()}})]})}function Se({review:e,busy:t,onQuarantine:n}){let r=o(),i=e.team.status===`quarantined`,a=e.members.filter(e=>e.status===`active`&&!e.signatureValid);return(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-6 p-6 lg:p-8`,children:[(0,J.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>r(`/team-workspaces`),"aria-label":`Back to Team Workspaces`,children:(0,J.jsx)(h,{})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e.team.name}),(0,J.jsx)(W,{variant:i?`destructive`:`secondary`,children:i?`Quarantined`:`Review required`})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i?`Select files to copy to an active Team.`:`Resolve access issues for this Team.`})]})]}),!e.teamSignatureValid&&!i&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-lg border p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`font-medium`,children:`Team verification failed`}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Quarantine this Team to block access and retain its files.`})]}),(0,J.jsx)(c,{variant:`destructive`,disabled:t,onClick:()=>n({kind:`team`,name:e.team.name}),children:`Quarantine Team`})]}),i&&(0,J.jsx)(xe,{teamId:e.team.id}),e.teamSignatureValid&&a.length>0&&(0,J.jsxs)(`section`,{className:`space-y-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Unverified memberships`}),(0,J.jsx)(`div`,{className:`rounded-lg border`,children:(0,J.jsxs)(fe,{children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(B,{children:[(0,J.jsx)(U,{children:`Member`}),(0,J.jsx)(U,{children:`Email`}),(0,J.jsx)(U,{className:`text-right`,children:`Action`})]})}),(0,J.jsx)(pe,{children:a.map(r=>(0,J.jsxs)(B,{children:[(0,J.jsx)(H,{className:`font-medium`,children:r.name||`Unnamed member`}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:r.email||`—`}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsx)(c,{variant:`destructive`,size:`sm`,disabled:t||e.team.status!==`active`,onClick:()=>n({kind:`member`,userId:r.userId,name:r.name||r.email||`this member`}),children:`Quarantine membership`})})]},r.id))})]})})]}),!i&&e.teamSignatureValid&&a.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No membership issues were found. Check the instance license and capacity limits.`})]})}var Ce={manager:`Manager`,staff:`Staff`};function we(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString()}async function $(e,t){let n=await e.json().catch(()=>({}));return Error(typeof n.error==`string`?n.error:t)}function Te(){let{id:e}=i(),t=o(),[n]=a(),g=n.get(`from`)===`team-workspaces`?`/team-workspaces`:`/`,{user:b}=le(),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(null),[k,M]=(0,q.useState)(``),[ne,N]=(0,q.useState)(!0),[P,F]=(0,q.useState)(null),[ie,I]=(0,q.useState)(!1),[z,V]=(0,q.useState)(null),[G,K]=(0,q.useState)(null),[_e,ve]=(0,q.useState)(``),Y=!!b?.isSso,X=!!(b?.isSuperAdmin||b?.is_super_admin),{setBreadcrumbLabel:Z}=ue(),Q=(0,q.useCallback)(async()=>{if(e){N(!0),ve(``),E(null),O(null);try{let t=await L(`/api/teams/${encodeURIComponent(e)}`);if(!t.ok){let n=await t.json().catch(()=>({}));if(X&&n.code===`TEAM_INTEGRITY_UNAVAILABLE`){let t=await L(`/api/teams/${encodeURIComponent(e)}/integrity-review`);if(t.ok){O(await t.json());return}}throw Error(typeof n.error==`string`?n.error:`Team could not be loaded.`)}E(await t.json())}catch(e){ve(e?.message||`Team could not be loaded.`)}finally{N(!1)}}},[e,X]);if((0,q.useEffect)(()=>{Q()},[Q]),(0,q.useEffect)(()=>{if(!Y)return;let t=t=>{t.detail?.teamId===e&&Q()};return window.addEventListener(`cloud-workspace-sync`,t),()=>window.removeEventListener(`cloud-workspace-sync`,t)},[Q,e,Y]),(0,q.useEffect)(()=>(Z(T?.name||D?.team.name||`Team management`),()=>Z(null)),[Z,T?.name,D?.team.name]),(0,q.useEffect)(()=>{M(T?.name||``)},[T?.name]),!X&&T&&!T.canManage)return(0,J.jsx)(s,{to:`/`,replace:!0});let be=async(t,n)=>{if(e){F(`role:${t}`);try{let i=await L(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({role:n})});if(!i.ok)throw await $(i,`Member role could not be updated.`);E(await i.json()),r.success(`Member role updated`)}catch(e){r.error(e?.message||`Member role could not be updated.`)}finally{F(null)}}},xe=async()=>{if(e&&k.trim()&&k.trim()!==T?.name){F(`rename-team`);try{let t=await L(`/api/teams/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:k.trim()})});if(!t.ok)throw await $(t,`Team name could not be updated.`);E(await t.json()),r.success(`Team name updated`)}catch(e){r.error(e?.message||`Team name could not be updated.`)}finally{F(null)}}},Te=async(t,n)=>{if(e){F(`remove:${t}`);try{let n=await L(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`DELETE`});if(!n.ok)throw await $(n,`Member could not be removed.`);await Q(),r.success(`Member deactivated`)}catch(e){r.error(e?.message||`Member could not be removed.`)}finally{F(null)}}},Ee=async(t,n)=>{if(e){F(`ban:${t}`);try{let n=await L(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}/ban`,{method:`POST`});if(!n.ok)throw await $(n,`Member could not be banned.`);await Q(),r.success(`Member banned`)}catch(e){r.error(e?.message||`Member could not be banned.`)}finally{F(null)}}},De=async t=>{if(e){F(`quarantine:${t.kind}`);try{let n=t.kind===`team`?`/api/teams/${encodeURIComponent(e)}/integrity/quarantine`:`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t.userId)}/integrity/quarantine`,i=await L(n,{method:`POST`});if(!i.ok)throw await $(i,`Integrity issue could not be quarantined.`);K(null),r.success(t.kind===`team`?`Team quarantined; its data was retained.`:`Membership quarantined; its data was retained.`),t.kind===`team`&&window.dispatchEvent(new CustomEvent(`team-quarantined`,{detail:{teamId:e}})),await Q()}catch(e){r.error(e?.message||`Integrity issue could not be quarantined.`)}finally{F(null)}}},Oe=async t=>{if(e){F(`reactivate:${t}`);try{let n=await L(`/api/teams/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:t})});if(!n.ok)throw await $(n,`Member could not be reactivated.`);E(await n.json()),r.success(`Member reactivated`)}catch(e){r.error(e?.message||`Member could not be reactivated.`)}finally{F(null)}}};if(ne)return(0,J.jsx)(`main`,{className:`flex flex-1 items-center justify-center`,children:(0,J.jsx)(me,{className:`size-5 animate-spin`,"aria-label":`Loading Team`})});if(!T&&D)return(0,J.jsxs)(`main`,{className:`-m-4 flex-1 overflow-auto bg-background`,children:[(0,J.jsx)(Se,{review:D,busy:P!==null,onQuarantine:K}),(0,J.jsx)(C,{isOpen:!!G,title:G?.kind===`team`?`Quarantine this Team?`:`Quarantine this membership?`,message:`${G?.name||`This record`} will lose access. Its data will stay stored and the action will be recorded.`,confirmText:`Quarantine`,cancelText:`Cancel`,variant:`danger`,onCancel:()=>K(null),onConfirm:()=>{let e=G;K(null),e&&De(e)}})]});if(!T)return(0,J.jsxs)(`main`,{className:`flex flex-1 flex-col items-start gap-4 p-6`,children:[(0,J.jsxs)(c,{variant:`ghost`,onClick:()=>t(g),children:[(0,J.jsx)(h,{}),` Back`]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Team unavailable`}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_e||`This Team does not exist or is not accessible.`})]})]});if(Y){let e=T.manageUrl;return(0,J.jsxs)(`main`,{className:`flex flex-1 flex-col items-start gap-4 p-6`,children:[(0,J.jsxs)(c,{variant:`ghost`,onClick:()=>t(g),children:[(0,J.jsx)(h,{}),` Back`]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Team management is in ERDBPro SaaS`}),(0,J.jsxs)(`p`,{className:`mt-1 max-w-xl text-sm text-muted-foreground`,children:[T.name,` is managed from your ERDBPro SaaS account. This workspace stays available here for collaboration.`]})]}),e&&(0,J.jsxs)(c,{onClick:()=>window.location.assign(e),children:[(0,J.jsx)(he,{}),` Open ERDBPro SaaS`]})]})}return(0,J.jsxs)(`main`,{className:`-m-4 flex-1 overflow-auto bg-background`,children:[(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-6 p-6 lg:p-8`,children:[(0,J.jsx)(`header`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>t(g),"aria-label":g===`/team-workspaces`?`Back to Team workspaces`:`Back to dashboard`,children:(0,J.jsx)(h,{})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(R,{value:k,onChange:e=>M(e.target.value),className:`h-9 w-64 text-xl font-semibold`,"aria-label":`Team name`}),(0,J.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>void xe(),disabled:P!==null||!k.trim()||k.trim()===T.name,children:`Save name`})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage members, roles, and this Team's projects.`})]})]})}),T.capacity?.exceeded&&(0,J.jsx)(`p`,{role:`alert`,className:`rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm`,children:`License capacity exceeded. Deactivate excess Teams or members to bring active usage within the limit. Data remains stored.`}),T.status===`inactive`&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This Team is inactive. Its documents and memberships remain stored; its members count again if the Team is reactivated.`}),(0,J.jsx)(`div`,{className:`grid gap-4`,children:(0,J.jsxs)(A,{className:`min-w-0`,children:[(0,J.jsxs)(te,{className:`flex flex-row items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(ee,{className:`flex items-center gap-2`,children:[(0,J.jsx)(de,{className:`size-4`}),` Members`]}),(0,J.jsxs)(re,{children:[T.memberCount||0,` active memberships. Unique members count once across active Teams.`]})]}),(0,J.jsxs)(c,{disabled:T.status===`inactive`||T.capacity?.exceeded,onClick:()=>I(!0),children:[(0,J.jsx)(se,{}),` Add member`]})]}),(0,J.jsx)(j,{className:`space-y-4`,children:(0,J.jsx)(`div`,{className:`rounded-lg border`,children:(0,J.jsxs)(fe,{children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(B,{children:[(0,J.jsx)(U,{children:`Member`}),(0,J.jsx)(U,{children:`Email`}),(0,J.jsx)(U,{children:`Role`}),(0,J.jsx)(U,{children:`Status`}),(0,J.jsx)(U,{children:`Joined`}),(0,J.jsx)(U,{className:`w-16 text-right`,children:`Action`})]})}),(0,J.jsxs)(pe,{children:[T.members.length===0&&(0,J.jsx)(B,{children:(0,J.jsx)(H,{colSpan:6,className:`h-24 text-center text-muted-foreground`,children:`No members have been added.`})}),T.members.map(e=>(0,J.jsxs)(B,{children:[(0,J.jsx)(H,{className:`font-medium`,children:e.name||`Unnamed member`}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:e.email||`—`}),(0,J.jsx)(H,{children:(0,J.jsxs)(S,{value:e.role,onValueChange:t=>t&&void be(e.id,t),disabled:P!==null||e.status!==`active`||T.status===`inactive`,children:[(0,J.jsx)(y,{size:`sm`,className:`w-28`,children:(0,J.jsx)(x,{children:Ce[e.role]})}),(0,J.jsxs)(v,{children:[(0,J.jsx)(_,{value:`manager`,children:Ce.manager}),(0,J.jsx)(_,{value:`staff`,children:Ce.staff})]})]})}),(0,J.jsx)(H,{children:(0,J.jsx)(W,{variant:`secondary`,children:e.status===`active`?`Active`:e.status===`quarantined`?`Quarantined`:e.status})}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:we(e.joinedAt)}),(0,J.jsx)(H,{className:`text-right`,children:(X||e.id!==b?.id)&&(0,J.jsxs)(m,{children:[(0,J.jsx)(u,{render:(0,J.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Actions for ${e.name||e.email||`member`}`,disabled:P!==null,children:(0,J.jsx)(w,{})})}),(0,J.jsx)(p,{align:`end`,className:`w-48`,children:(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{children:`Member actions`}),e.status===`active`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(l,{onClick:()=>V({kind:`remove`,userId:e.id,name:e.name||e.email}),children:[(0,J.jsx)(oe,{}),` Deactivate member`]}),X&&(0,J.jsxs)(l,{variant:`destructive`,onClick:()=>V({kind:`ban`,userId:e.id,name:e.name||e.email}),children:[(0,J.jsx)(ce,{}),` Ban member`]})]}):e.status===`quarantined`?(0,J.jsxs)(l,{disabled:!0,children:[(0,J.jsx)(ce,{}),` Quarantined`]}):(0,J.jsxs)(l,{disabled:!e.email||T.status===`inactive`||T.capacity?.exceeded,onClick:()=>e.email&&void Oe(e.email),children:[(0,J.jsx)(ae,{}),` Reactivate member`]})]})})]})})]},e.id))]})]})})})]})})]}),(0,J.jsx)(ye,{teamId:e,open:ie,onOpenChange:I,onAdded:E}),(0,J.jsx)(C,{isOpen:!!z,title:z?.kind===`ban`?`Ban member?`:`Deactivate member?`,message:z?.kind===`ban`?`${z.name||`This member`} cannot be added to this Team again.`:`${z?.name||`This member`} will lose access to this Team.`,confirmText:z?.kind===`ban`?`Ban member`:`Deactivate member`,cancelText:`Cancel`,variant:`danger`,onCancel:()=>V(null),onConfirm:()=>{let e=z;V(null),e&&(e.kind===`ban`?Ee(e.userId,e.name):Te(e.userId,e.name))}})]})}export{Te as TeamManagementRoute,Te as default};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{i as r}from"./createLucideIcon-DCn6SI1F.js";import{d as i,f as a,l as o,r as s}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as c}from"./button-CYI0LXM3.js";import{a as l,f as u,i as d,o as f,r as p,t as m}from"./dropdown-menu-BoXeiuAZ.js";import{n as h,t as g}from"./refresh-cw-DyBeWpoi.js";import{i as _,n as v,o as y,r as b,s as x,t as S}from"./select-CdQCv8yP.js";import{t as C}from"./ConfirmModal-pEN41Kyx.js";import{t as w}from"./ellipsis-CfqIMSId.js";import{i as T,n as E,o as D,t as O}from"./field-BXvmJTfd.js";import{a as k,d as A,f as j,g as ee,h as te,i as M,l as ne,n as N,o as P,p as re,s as F,t as ie,v as I}from"./dialog-BIk9Y-3N.js";import{i as ae,n as oe,r as se,t as ce}from"./user-x-Cas_SoSK.js";import{n as L}from"./api-DuV0sTuY.js";import{t as R}from"./input-CMgoax5D.js";import{n as le}from"./useAuth-splnWP_7.js";import{n as ue}from"./WorkspaceContext-CitlpD55.js";import{t as z}from"./label-CfaCFYRS.js";import{$ as de,B,F as fe,H as V,I as pe,L as H,Mt as me,R as U,U as W,ln as G,on as K,sn as he,z as ge}from"./index-CpB0lOgn.js";var q=e(t(),1),J=n(),_e=`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%`;function ve(){let e=new Uint32Array(18);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>_e[e%62]).join(``)}async function Y(e,t){let n=await e.json().catch(()=>({}));return Error(typeof n.error==`string`?n.error:t)}function ye({teamId:e,open:t,onOpenChange:n,onAdded:i}){let[a,o]=(0,q.useState)(null),[s,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(``),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(`staff`),[C,w]=(0,q.useState)(!1),A=C&&m.length>0&&f!==m,j=()=>{n(!1),l(``),d(``),p(``),h(``),v(!1),b(!1),w(!1),S(`staff`)},ee=()=>{p(ve()),h(``),v(!1),b(!1)},te=e=>{w(e),e?ee():(p(``),h(``),v(!1),b(!1))};return(0,J.jsx)(ie,{open:t,onOpenChange:e=>e?n(!0):j(),children:(0,J.jsx)(M,{size:`md`,children:(0,J.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),e&&s.trim()){if(C&&f!==m)r.error(`Passwords do not match.`);else{o(`add-member`);try{let t=await L(`/api/teams/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:s.trim(),...C?{name:u.trim(),password:f,confirmPassword:m}:{},role:x})});if(!t.ok)throw await Y(t,`Member could not be added.`);i(await t.json()),j(),r.success(`Member added`)}catch(e){r.error(e?.message||`Member could not be added.`)}finally{o(null)}}}},children:[(0,J.jsxs)(F,{children:[(0,J.jsx)(ne,{children:`Add member`}),(0,J.jsx)(k,{children:`Add an existing account, or create a new account for this Team.`})]}),(0,J.jsxs)(N,{className:`space-y-4`,children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{htmlFor:`team-member-email`,children:`Email`}),(0,J.jsx)(R,{id:`team-member-email`,type:`email`,value:s,onChange:e=>l(e.target.value),placeholder:`member@example.com`,required:!0,autoFocus:!0})]}),(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{children:`Role`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-label":`Member role`,className:`grid gap-2 sm:grid-cols-2`,children:[`manager`,`staff`].map(e=>(0,J.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg border p-3 has-checked:border-primary has-checked:bg-primary/5`,children:[(0,J.jsx)(`input`,{type:`radio`,name:`team-member-role`,value:e,checked:x===e,onChange:()=>S(e),className:`mt-0.5 size-4 accent-primary`}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium capitalize`,children:e}),(0,J.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e===`manager`?`Can manage this Team and its members.`:`Can collaborate on this Team's work.`})]})]},e))})]}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,J.jsx)(V,{checked:C,onCheckedChange:e=>te(e===!0)}),`Create a new account`]}),C&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{htmlFor:`team-member-name`,children:`Name`}),(0,J.jsx)(R,{id:`team-member-name`,value:u,onChange:e=>d(e.target.value),required:!0})]}),(0,J.jsxs)(O,{children:[(0,J.jsx)(T,{htmlFor:`team-member-password`,children:`Temporary password`}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,J.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,J.jsx)(R,{id:`team-member-password`,type:_?`text`:`password`,value:f,readOnly:!0,"aria-readonly":`true`,minLength:8,required:!0,className:`pr-10`}),(0,J.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute right-1 top-1/2 -translate-y-1/2`,onClick:()=>v(e=>!e),"aria-label":_?`Hide temporary password`:`Show temporary password`,"aria-pressed":_,children:_?(0,J.jsx)(D,{}):(0,J.jsx)(K,{})})]}),(0,J.jsxs)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:ee,children:[(0,J.jsx)(g,{"data-icon":`inline-start`}),` Generate new`]})]}),(0,J.jsx)(E,{children:`Generated automatically. Share it securely; changing this password after signing in is optional.`})]}),(0,J.jsxs)(O,{"data-invalid":A,children:[(0,J.jsx)(T,{htmlFor:`team-member-confirm-password`,children:`Confirm password`}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(R,{id:`team-member-confirm-password`,type:y?`text`:`password`,value:m,onChange:e=>h(e.target.value),minLength:8,required:!0,"aria-invalid":A,className:`pr-10`}),(0,J.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute right-1 top-1/2 -translate-y-1/2`,onClick:()=>b(e=>!e),"aria-label":y?`Hide confirm password`:`Show confirm password`,"aria-pressed":y,children:y?(0,J.jsx)(D,{}):(0,J.jsx)(K,{})})]}),A?(0,J.jsx)(E,{className:`text-destructive`,children:`Passwords do not match.`}):(0,J.jsx)(E,{children:`Enter the same password again.`})]})]})]}),(0,J.jsxs)(P,{children:[(0,J.jsx)(c,{type:`button`,variant:`outline`,onClick:j,disabled:a!==null,children:`Cancel`}),(0,J.jsxs)(c,{type:`submit`,disabled:a!==null||!s.trim()||C&&(!u.trim()||f.length<8||m.length<8||f!==m),children:[a===`add-member`&&(0,J.jsx)(me,{className:`animate-spin`}),` Add member`]})]})]})})})}var X=e=>`${e.type}:${e.id}`;function Z(e){let[t,n]=(0,q.useState)(null),[i,a]=(0,q.useState)(!0),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(new Set),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!1),m=(0,q.useRef)(crypto.randomUUID()),h=(0,q.useRef)(!1),g=(0,q.useCallback)(async()=>{a(!0),s(``);try{let t=await L(`/api/teams/${encodeURIComponent(e)}/recovery`),r=await t.json();if(!t.ok)throw Error(r.error||`Files could not be loaded.`);n(r),l(e=>new Set([...e].filter(e=>r.files.some(t=>X(t)===e)))),d(e=>r.destinations.some(t=>t.id===e)?e:null)}catch(e){n(null),l(new Set),d(null),s(e instanceof Error?e.message:`Files could not be loaded.`)}finally{a(!1)}},[e]);return(0,q.useEffect)(()=>{g()},[g]),{inventory:t,loading:i,error:o,selected:c,targetTeamId:u,processing:f,load:g,select:(e,t)=>{m.current=crypto.randomUUID(),l(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r})},chooseTarget:e=>{m.current=crypto.randomUUID(),d(e)},recover:async()=>{if(!h.current&&u&&c.size!==0){h.current=!0,p(!0);try{let n=(t?.files||[]).filter(e=>c.has(X(e))).map(({id:e,type:t})=>({id:e,type:t})),i=await L(`/api/teams/${encodeURIComponent(e)}/recovery`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({operationId:m.current,targetTeamId:u,files:n})}),a=await i.json();if(!i.ok)throw Error(a.error||`Files could not be recovered.`);r.success(`${a.fileCount} ${a.fileCount===1?`file`:`files`} recovered into ${a.projectCount} ${a.projectCount===1?`project`:`projects`}.`),l(new Set),m.current=crypto.randomUUID(),window.dispatchEvent(new CustomEvent(`team-files-recovered`,{detail:{teamId:u}})),await g()}catch(e){r.error(e instanceof Error?e.message:`Files could not be recovered.`)}finally{h.current=!1,p(!1)}}}}}var Q={erd:{label:`ERD Builder`,color:`bg-sky-100 text-sky-900 dark:bg-sky-950 dark:text-sky-200`},notes:{label:`Notes`,color:`bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-200`},drawings:{label:`Drawings`,color:`bg-violet-100 text-violet-900 dark:bg-violet-950 dark:text-violet-200`},flowchart:{label:`Flowchart`,color:`bg-emerald-100 text-emerald-900 dark:bg-emerald-950 dark:text-emerald-200`}},be=e=>e?new Date(e).toLocaleDateString():`—`;function xe({teamId:e}){let t=Z(e),[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(`all`),[o,s]=(0,q.useState)(!1),l=(0,q.useMemo)(()=>(t.inventory?.files||[]).filter(e=>(i===`all`||i===e.type)&&`${e.name} ${e.projectName}`.toLowerCase().includes(n.toLowerCase())),[t.inventory,n,i]),u=l.map(X),d=u.filter(e=>t.selected.has(e)).length,f=t.selected.size-d,p=t.inventory?.destinations.find(e=>e.id===t.targetTeamId),m=t.loading||t.processing;return(0,J.jsxs)(`section`,{className:`space-y-4`,"aria-labelledby":`recovery-title`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsx)(`h2`,{id:`recovery-title`,className:`text-lg font-semibold`,children:`Recover files`}),(0,J.jsxs)(c,{variant:`outline`,onClick:()=>void t.load(),disabled:m,children:[(0,J.jsx)(g,{className:t.loading?`animate-spin`:``}),` Refresh`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,J.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,J.jsx)(I,{className:`pointer-events-none absolute top-2.5 left-3 size-4 text-muted-foreground`}),(0,J.jsx)(R,{value:n,onChange:e=>r(e.target.value),placeholder:`Search files or projects`,"aria-label":`Search recovery files`,className:`pl-9`,disabled:t.processing})]}),(0,J.jsxs)(S,{value:i,onValueChange:a,disabled:t.processing,children:[(0,J.jsx)(y,{className:`w-full sm:w-44`,"aria-label":`Filter by file type`,children:(0,J.jsx)(x,{children:i===`all`?`All file types`:Q[i]?.label})}),(0,J.jsx)(v,{children:(0,J.jsxs)(b,{children:[(0,J.jsx)(_,{value:`all`,children:`All file types`}),Object.entries(Q).map(([e,t])=>(0,J.jsx)(_,{value:e,children:t.label},e))]})})]})]}),t.error&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:t.error}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,J.jsxs)(fe,{children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(B,{children:[(0,J.jsx)(U,{className:`w-12 pl-4`,children:(0,J.jsx)(V,{className:`border-muted-foreground`,"aria-label":`Select all visible files`,checked:u.length>0&&d===u.length,indeterminate:d>0&&d<u.length,onCheckedChange:e=>t.select(u,e),disabled:m||u.length===0})}),(0,J.jsx)(U,{children:`File`}),(0,J.jsx)(U,{children:`File type`}),(0,J.jsx)(U,{children:`Project`}),(0,J.jsx)(U,{children:`Updated`}),(0,J.jsx)(U,{children:`Recovery`})]})}),(0,J.jsx)(pe,{children:t.loading?(0,J.jsx)(B,{children:(0,J.jsx)(H,{colSpan:6,className:`h-32 text-center`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted-foreground`,children:[(0,J.jsx)(me,{className:`size-4 animate-spin`}),` Loading files…`]})})}):l.length===0?(0,J.jsx)(B,{children:(0,J.jsx)(H,{colSpan:6,className:`h-32 text-center text-muted-foreground`,children:t.error?`Refresh to load the file list again.`:n||i!==`all`?`No files match these filters.`:`This Team has no available files to recover.`})}):l.map(e=>(0,J.jsxs)(B,{"data-state":t.selected.has(X(e))?`selected`:void 0,children:[(0,J.jsx)(H,{className:`pl-4`,children:(0,J.jsx)(V,{className:`border-muted-foreground`,"aria-label":`Select ${e.name} in ${e.projectName}`,checked:t.selected.has(X(e)),onCheckedChange:n=>t.select([X(e)],n),disabled:t.processing})}),(0,J.jsx)(H,{className:`max-w-80 whitespace-normal font-medium`,children:e.name}),(0,J.jsx)(H,{children:(0,J.jsx)(W,{variant:`secondary`,className:Q[e.type].color,children:Q[e.type].label})}),(0,J.jsx)(H,{className:`max-w-64 whitespace-normal text-muted-foreground`,children:e.projectName}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:be(e.updatedAt)}),(0,J.jsx)(H,{children:e.recovery?(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(W,{variant:`outline`,children:`Recovered`}),(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.recovery.teamName,` · `,be(e.recovery.at)]})]}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Not copied`})})]},X(e)))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`w-full space-y-2 sm:max-w-sm`,children:[(0,J.jsx)(z,{htmlFor:`recovery-team`,children:`Destination Team`}),(0,J.jsxs)(S,{value:t.targetTeamId,onValueChange:t.chooseTarget,disabled:m||!t.inventory?.destinations.length,children:[(0,J.jsx)(y,{id:`recovery-team`,children:(0,J.jsx)(x,{children:p?.name||`Choose an active Team`})}),(0,J.jsx)(v,{children:(0,J.jsx)(b,{children:t.inventory?.destinations.map(e=>(0,J.jsx)(_,{value:e.id,children:e.name},e.id))})})]}),!t.loading&&t.inventory&&t.inventory.destinations.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create an active Team before recovering files.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsxs)(`p`,{"aria-live":`polite`,className:`text-sm text-muted-foreground`,children:[t.selected.size,` selected`,f>0&&` · ${f} hidden by filters`]}),t.selected.size>0&&(0,J.jsx)(c,{variant:`ghost`,size:`sm`,disabled:t.processing,onClick:()=>t.select([...t.selected],!1),children:`Clear selection`}),(0,J.jsxs)(c,{onClick:()=>s(!0),disabled:m||!p||t.selected.size===0||t.selected.size>500,children:[(0,J.jsx)(G,{}),` `,t.processing?`Recovering…`:`Recover selected files`]})]})]}),t.selected.size>500&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose up to 500 files per recovery.`}),(0,J.jsxs)(`details`,{className:`text-sm text-muted-foreground`,children:[(0,J.jsx)(`summary`,{className:`w-fit cursor-pointer rounded focus-visible:outline-2 focus-visible:outline-ring`,children:`What will be copied?`}),(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl`,children:`File contents and ERD structure are copied into new projects. Existing media references are kept. Copies start private and are owned by you; discussion, comment and AI histories stay with the source.`})]}),(0,J.jsx)(C,{isOpen:o,title:`Recover selected files?`,message:`Copy ${t.selected.size} files into new projects in ${p?.name||`the destination Team`}? Members of that Team will be able to access the copies. The quarantined originals will stay stored.`,confirmText:`Recover files`,variant:`info`,onCancel:()=>s(!1),onConfirm:()=>{s(!1),t.recover()}})]})}function Se({review:e,busy:t,onQuarantine:n}){let r=o(),i=e.team.status===`quarantined`,a=e.members.filter(e=>e.status===`active`&&!e.signatureValid);return(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-6 p-6 lg:p-8`,children:[(0,J.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>r(`/team-workspaces`),"aria-label":`Back to Team Workspaces`,children:(0,J.jsx)(h,{})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e.team.name}),(0,J.jsx)(W,{variant:i?`destructive`:`secondary`,children:i?`Quarantined`:`Review required`})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i?`Select files to copy to an active Team.`:`Resolve access issues for this Team.`})]})]}),!e.teamSignatureValid&&!i&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-lg border p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`font-medium`,children:`Team verification failed`}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Quarantine this Team to block access and retain its files.`})]}),(0,J.jsx)(c,{variant:`destructive`,disabled:t,onClick:()=>n({kind:`team`,name:e.team.name}),children:`Quarantine Team`})]}),i&&(0,J.jsx)(xe,{teamId:e.team.id}),e.teamSignatureValid&&a.length>0&&(0,J.jsxs)(`section`,{className:`space-y-3`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Unverified memberships`}),(0,J.jsx)(`div`,{className:`rounded-lg border`,children:(0,J.jsxs)(fe,{children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(B,{children:[(0,J.jsx)(U,{children:`Member`}),(0,J.jsx)(U,{children:`Email`}),(0,J.jsx)(U,{className:`text-right`,children:`Action`})]})}),(0,J.jsx)(pe,{children:a.map(r=>(0,J.jsxs)(B,{children:[(0,J.jsx)(H,{className:`font-medium`,children:r.name||`Unnamed member`}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:r.email||`—`}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsx)(c,{variant:`destructive`,size:`sm`,disabled:t||e.team.status!==`active`,onClick:()=>n({kind:`member`,userId:r.userId,name:r.name||r.email||`this member`}),children:`Quarantine membership`})})]},r.id))})]})})]}),!i&&e.teamSignatureValid&&a.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No membership issues were found. Check the instance license and capacity limits.`})]})}var Ce={manager:`Manager`,staff:`Staff`};function we(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString()}async function $(e,t){let n=await e.json().catch(()=>({}));return Error(typeof n.error==`string`?n.error:t)}function Te(){let{id:e}=i(),t=o(),[n]=a(),g=n.get(`from`)===`team-workspaces`?`/team-workspaces`:`/`,{user:b}=le(),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(null),[k,M]=(0,q.useState)(``),[ne,N]=(0,q.useState)(!0),[P,F]=(0,q.useState)(null),[ie,I]=(0,q.useState)(!1),[z,V]=(0,q.useState)(null),[G,K]=(0,q.useState)(null),[_e,ve]=(0,q.useState)(``),Y=!!b?.isSso,X=!!(b?.isSuperAdmin||b?.is_super_admin),{setBreadcrumbLabel:Z}=ue(),Q=(0,q.useCallback)(async()=>{if(e){N(!0),ve(``),E(null),O(null);try{let t=await L(`/api/teams/${encodeURIComponent(e)}`);if(!t.ok){let n=await t.json().catch(()=>({}));if(X&&n.code===`TEAM_INTEGRITY_UNAVAILABLE`){let t=await L(`/api/teams/${encodeURIComponent(e)}/integrity-review`);if(t.ok){O(await t.json());return}}throw Error(typeof n.error==`string`?n.error:`Team could not be loaded.`)}E(await t.json())}catch(e){ve(e?.message||`Team could not be loaded.`)}finally{N(!1)}}},[e,X]);if((0,q.useEffect)(()=>{Q()},[Q]),(0,q.useEffect)(()=>{if(!Y)return;let t=t=>{t.detail?.teamId===e&&Q()};return window.addEventListener(`cloud-workspace-sync`,t),()=>window.removeEventListener(`cloud-workspace-sync`,t)},[Q,e,Y]),(0,q.useEffect)(()=>(Z(T?.name||D?.team.name||`Team management`),()=>Z(null)),[Z,T?.name,D?.team.name]),(0,q.useEffect)(()=>{M(T?.name||``)},[T?.name]),!X&&T&&!T.canManage)return(0,J.jsx)(s,{to:`/`,replace:!0});let be=async(t,n)=>{if(e){F(`role:${t}`);try{let i=await L(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({role:n})});if(!i.ok)throw await $(i,`Member role could not be updated.`);E(await i.json()),r.success(`Member role updated`)}catch(e){r.error(e?.message||`Member role could not be updated.`)}finally{F(null)}}},xe=async()=>{if(e&&k.trim()&&k.trim()!==T?.name){F(`rename-team`);try{let t=await L(`/api/teams/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:k.trim()})});if(!t.ok)throw await $(t,`Team name could not be updated.`);E(await t.json()),r.success(`Team name updated`)}catch(e){r.error(e?.message||`Team name could not be updated.`)}finally{F(null)}}},Te=async(t,n)=>{if(e){F(`remove:${t}`);try{let n=await L(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`DELETE`});if(!n.ok)throw await $(n,`Member could not be removed.`);await Q(),r.success(`Member deactivated`)}catch(e){r.error(e?.message||`Member could not be removed.`)}finally{F(null)}}},Ee=async(t,n)=>{if(e){F(`ban:${t}`);try{let n=await L(`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}/ban`,{method:`POST`});if(!n.ok)throw await $(n,`Member could not be banned.`);await Q(),r.success(`Member banned`)}catch(e){r.error(e?.message||`Member could not be banned.`)}finally{F(null)}}},De=async t=>{if(e){F(`quarantine:${t.kind}`);try{let n=t.kind===`team`?`/api/teams/${encodeURIComponent(e)}/integrity/quarantine`:`/api/teams/${encodeURIComponent(e)}/members/${encodeURIComponent(t.userId)}/integrity/quarantine`,i=await L(n,{method:`POST`});if(!i.ok)throw await $(i,`Integrity issue could not be quarantined.`);K(null),r.success(t.kind===`team`?`Team quarantined; its data was retained.`:`Membership quarantined; its data was retained.`),t.kind===`team`&&window.dispatchEvent(new CustomEvent(`team-quarantined`,{detail:{teamId:e}})),await Q()}catch(e){r.error(e?.message||`Integrity issue could not be quarantined.`)}finally{F(null)}}},Oe=async t=>{if(e){F(`reactivate:${t}`);try{let n=await L(`/api/teams/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:t})});if(!n.ok)throw await $(n,`Member could not be reactivated.`);E(await n.json()),r.success(`Member reactivated`)}catch(e){r.error(e?.message||`Member could not be reactivated.`)}finally{F(null)}}};if(ne)return(0,J.jsx)(`main`,{className:`flex flex-1 items-center justify-center`,children:(0,J.jsx)(me,{className:`size-5 animate-spin`,"aria-label":`Loading Team`})});if(!T&&D)return(0,J.jsxs)(`main`,{className:`-m-4 flex-1 overflow-auto bg-background`,children:[(0,J.jsx)(Se,{review:D,busy:P!==null,onQuarantine:K}),(0,J.jsx)(C,{isOpen:!!G,title:G?.kind===`team`?`Quarantine this Team?`:`Quarantine this membership?`,message:`${G?.name||`This record`} will lose access. Its data will stay stored and the action will be recorded.`,confirmText:`Quarantine`,cancelText:`Cancel`,variant:`danger`,onCancel:()=>K(null),onConfirm:()=>{let e=G;K(null),e&&De(e)}})]});if(!T)return(0,J.jsxs)(`main`,{className:`flex flex-1 flex-col items-start gap-4 p-6`,children:[(0,J.jsxs)(c,{variant:`ghost`,onClick:()=>t(g),children:[(0,J.jsx)(h,{}),` Back`]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Team unavailable`}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_e||`This Team does not exist or is not accessible.`})]})]});if(Y){let e=T.manageUrl;return(0,J.jsxs)(`main`,{className:`flex flex-1 flex-col items-start gap-4 p-6`,children:[(0,J.jsxs)(c,{variant:`ghost`,onClick:()=>t(g),children:[(0,J.jsx)(h,{}),` Back`]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Team management is in ERDBPro SaaS`}),(0,J.jsxs)(`p`,{className:`mt-1 max-w-xl text-sm text-muted-foreground`,children:[T.name,` is managed from your ERDBPro SaaS account. This workspace stays available here for collaboration.`]})]}),e&&(0,J.jsxs)(c,{onClick:()=>window.location.assign(e),children:[(0,J.jsx)(he,{}),` Open ERDBPro SaaS`]})]})}return(0,J.jsxs)(`main`,{className:`-m-4 flex-1 overflow-auto bg-background`,children:[(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-6 p-6 lg:p-8`,children:[(0,J.jsx)(`header`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>t(g),"aria-label":g===`/team-workspaces`?`Back to Team workspaces`:`Back to dashboard`,children:(0,J.jsx)(h,{})}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(R,{value:k,onChange:e=>M(e.target.value),className:`h-9 w-64 text-xl font-semibold`,"aria-label":`Team name`}),(0,J.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>void xe(),disabled:P!==null||!k.trim()||k.trim()===T.name,children:`Save name`})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage members, roles, and this Team's projects.`})]})]})}),T.capacity?.exceeded&&(0,J.jsx)(`p`,{role:`alert`,className:`rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm`,children:`License capacity exceeded. Deactivate excess Teams or members to bring active usage within the limit. Data remains stored.`}),T.status===`inactive`&&(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This Team is inactive. Its documents and memberships remain stored; its members count again if the Team is reactivated.`}),(0,J.jsx)(`div`,{className:`grid gap-4`,children:(0,J.jsxs)(A,{className:`min-w-0`,children:[(0,J.jsxs)(te,{className:`flex flex-row items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(ee,{className:`flex items-center gap-2`,children:[(0,J.jsx)(de,{className:`size-4`}),` Members`]}),(0,J.jsxs)(re,{children:[T.memberCount||0,` active memberships. Unique members count once across active Teams.`]})]}),(0,J.jsxs)(c,{disabled:T.status===`inactive`||T.capacity?.exceeded,onClick:()=>I(!0),children:[(0,J.jsx)(se,{}),` Add member`]})]}),(0,J.jsx)(j,{className:`space-y-4`,children:(0,J.jsx)(`div`,{className:`rounded-lg border`,children:(0,J.jsxs)(fe,{children:[(0,J.jsx)(ge,{children:(0,J.jsxs)(B,{children:[(0,J.jsx)(U,{children:`Member`}),(0,J.jsx)(U,{children:`Email`}),(0,J.jsx)(U,{children:`Role`}),(0,J.jsx)(U,{children:`Status`}),(0,J.jsx)(U,{children:`Joined`}),(0,J.jsx)(U,{className:`w-16 text-right`,children:`Action`})]})}),(0,J.jsxs)(pe,{children:[T.members.length===0&&(0,J.jsx)(B,{children:(0,J.jsx)(H,{colSpan:6,className:`h-24 text-center text-muted-foreground`,children:`No members have been added.`})}),T.members.map(e=>(0,J.jsxs)(B,{children:[(0,J.jsx)(H,{className:`font-medium`,children:e.name||`Unnamed member`}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:e.email||`—`}),(0,J.jsx)(H,{children:(0,J.jsxs)(S,{value:e.role,onValueChange:t=>t&&void be(e.id,t),disabled:P!==null||e.status!==`active`||T.status===`inactive`,children:[(0,J.jsx)(y,{size:`sm`,className:`w-28`,children:(0,J.jsx)(x,{children:Ce[e.role]})}),(0,J.jsxs)(v,{children:[(0,J.jsx)(_,{value:`manager`,children:Ce.manager}),(0,J.jsx)(_,{value:`staff`,children:Ce.staff})]})]})}),(0,J.jsx)(H,{children:(0,J.jsx)(W,{variant:`secondary`,children:e.status===`active`?`Active`:e.status===`quarantined`?`Quarantined`:e.status})}),(0,J.jsx)(H,{className:`text-muted-foreground`,children:we(e.joinedAt)}),(0,J.jsx)(H,{className:`text-right`,children:(X||e.id!==b?.id)&&(0,J.jsxs)(m,{children:[(0,J.jsx)(u,{render:(0,J.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Actions for ${e.name||e.email||`member`}`,disabled:P!==null,children:(0,J.jsx)(w,{})})}),(0,J.jsx)(p,{align:`end`,className:`w-48`,children:(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{children:`Member actions`}),e.status===`active`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(l,{onClick:()=>V({kind:`remove`,userId:e.id,name:e.name||e.email}),children:[(0,J.jsx)(oe,{}),` Deactivate member`]}),X&&(0,J.jsxs)(l,{variant:`destructive`,onClick:()=>V({kind:`ban`,userId:e.id,name:e.name||e.email}),children:[(0,J.jsx)(ce,{}),` Ban member`]})]}):e.status===`quarantined`?(0,J.jsxs)(l,{disabled:!0,children:[(0,J.jsx)(ce,{}),` Quarantined`]}):(0,J.jsxs)(l,{disabled:!e.email||T.status===`inactive`||T.capacity?.exceeded,onClick:()=>e.email&&void Oe(e.email),children:[(0,J.jsx)(ae,{}),` Reactivate member`]})]})})]})})]},e.id))]})]})})})]})})]}),(0,J.jsx)(ye,{teamId:e,open:ie,onOpenChange:I,onAdded:E}),(0,J.jsx)(C,{isOpen:!!z,title:z?.kind===`ban`?`Ban member?`:`Deactivate member?`,message:z?.kind===`ban`?`${z.name||`This member`} cannot be added to this Team again.`:`${z?.name||`This member`} will lose access to this Team.`,confirmText:z?.kind===`ban`?`Ban member`:`Deactivate member`,cancelText:`Cancel`,variant:`danger`,onCancel:()=>V(null),onConfirm:()=>{let e=z;V(null),e&&(e.kind===`ban`?Ee(e.userId,e.name):Te(e.userId,e.name))}})]})}export{Te as TeamManagementRoute,Te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-BCiCTKAo.js";import{n as e,t}from"./jsx-runtime-Cl3nUQcN.js";import{i as n}from"./createLucideIcon-DCn6SI1F.js";import{t as r}from"./button-CYI0LXM3.js";import{i,n as a,r as o,t as s}from"./pen-tool-CoHyO7pC.js";import{t as c}from"./refresh-ccw-CWK4vSVV.js";import{t as l}from"./trash-2-CV7XVyhd.js";import{C as u,a as d,c as ee,d as te,i as f,n as p,o as m,s as h,t as g,u as _}from"./alert-dialog-DXnJdv-M.js";import{n as v}from"./api-DuV0sTuY.js";import{n as y}from"./fileOwnership-CF3Bm_pU.js";import{n as b}from"./useAuth-splnWP_7.js";import{A as x,B as S,F as C,I as w,L as T,M as ne,Mt as re,N as E,R as D,U as O,Yt as k,ct as A,it as j,j as M,z as N}from"./index-CNURTlUS.js";e();var P=t();function F({clients:e,restore:t,permanentlyDelete:n}){return(0,P.jsxs)(`section`,{children:[(0,P.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,P.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,P.jsx)(i,{size:18,className:`text-cyan-400`}),` DB Clients`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.length,` Items`]})]}),e.length===0?(0,P.jsx)(`div`,{className:`rounded-lg border border-dashed py-12 text-center text-muted-foreground`,children:`No deleted DB Clients`}):(0,P.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`DB Client Name`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`flex items-center gap-2 font-medium`,children:[(0,P.jsx)(i,{size:14}),e.name]}),(0,P.jsx)(T,{className:`text-xs font-semibold text-muted-foreground`,children:e.project?.name||`-`}),(0,P.jsx)(T,{className:`text-xs text-muted-foreground`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,P.jsx)(T,{className:`text-right`,children:(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:()=>t(e),children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),`Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>n(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),`Delete`]})]})})]},e.id))})]})})]})}function I({trashData:e,restoreProject:t,restoreDiagram:i,restoreNote:I,restoreDrawing:L,restoreFlowchart:R,restoreDbClient:z,fetchTrash:B,handleProjectPermanentDelete:V,handleDiagramPermanentDelete:H,handleNotePermanentDelete:U,handleDrawingPermanentDelete:W,handleFlowchartPermanentDelete:G,handleDbClientPermanentDelete:K,isLoading:q=!1}){let{user:J,isGuest:Y}=b(),X=e=>y(e,J?.id,Y),Z=J?.isSso&&e.retentionDays||0,Q=[e.projects,e.diagrams,e.notes,e.drawings,e.flowcharts||[]].flat().filter(X).length,$=e=>{let t=new Date(e.deleted_at||e.updated_at||e.created_at),n=Z>0&&e.deleted_at?new Date(t.getTime()+Z*864e5):null;return(0,P.jsxs)(P.Fragment,{children:[t.toLocaleString(),n&&(0,P.jsxs)(`span`,{className:`block text-[11px]`,children:[`Deleted permanently on `,n.toLocaleDateString()]})]})};return(0,P.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 border rounded-xl bg-background overflow-hidden relative`,children:[q&&e.projects.length===0&&(0,P.jsxs)(`div`,{className:`absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/60 backdrop-blur-[1px]`,children:[(0,P.jsx)(re,{className:`w-8 h-8 text-primary animate-spin opacity-60`}),(0,P.jsx)(`p`,{className:`mt-2 text-xs font-medium text-muted-foreground`,children:`Loading trash...`})]}),(0,P.jsxs)(`div`,{className:`p-6 border-b shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,P.jsx)(j,{size:24,className:`text-muted-foreground`}),`Trash Bin`]}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage your deleted files and projects. Items can be restored or permanently deleted.`})]}),Z>0&&Q>0&&(0,P.jsxs)(g,{children:[(0,P.jsxs)(te,{render:(0,P.jsx)(r,{variant:`destructive`,size:`sm`}),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Empty Trash`]}),(0,P.jsxs)(d,{children:[(0,P.jsxs)(ee,{children:[(0,P.jsx)(_,{children:`Empty Trash?`}),(0,P.jsxs)(m,{children:[Q,` item`,Q===1?``:`s`,` you created will be permanently deleted and can no longer be restored. Items created by others stay.`]})]}),(0,P.jsxs)(h,{children:[(0,P.jsx)(f,{children:`Cancel`}),(0,P.jsx)(p,{onClick:async()=>{(await v(`/api/trash`,{method:`DELETE`})).ok?(n.success(`Trash emptied`),B()):n.error(`Failed to empty Trash`)},children:`Delete permanently`})]})]})]})]}),Z>0&&(0,P.jsxs)(`div`,{role:`note`,className:`mt-4 flex items-start gap-2 rounded-lg border border-amber-500/50 bg-amber-500/10 p-3 text-sm text-amber-900 dark:text-amber-200`,children:[(0,P.jsx)(u,{size:16,className:`mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,P.jsxs)(`p`,{children:[(0,P.jsx)(`span`,{className:`font-semibold`,children:`Warning: `}),`Files in the Trash are permanently deleted after `,Z,` days and can no longer be restored. Restore a file before then if you still need it.`]})]})]}),(0,P.jsxs)(x,{defaultValue:`projects`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`shrink-0 overflow-x-auto border-b px-6 py-3 custom-scrollbar`,children:(0,P.jsxs)(ne,{className:`w-max`,children:[(0,P.jsxs)(E,{value:`projects`,children:[`Projects (`,e.projects.length,`)`]}),(0,P.jsxs)(E,{value:`diagrams`,children:[`ERD (`,e.diagrams.length,`)`]}),(0,P.jsxs)(E,{value:`db-clients`,children:[`DB Client (`,e.dbClients?.length||0,`)`]}),(0,P.jsxs)(E,{value:`notes`,children:[`Notes (`,e.notes.length,`)`]}),(0,P.jsxs)(E,{value:`drawings`,children:[`Drawings (`,e.drawings.length,`)`]}),(0,P.jsxs)(E,{value:`flowcharts`,children:[`Flowcharts (`,e.flowcharts?.length||0,`)`]})]})}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar`,children:(0,P.jsxs)(`div`,{className:`p-6`,children:[(0,P.jsxs)(M,{value:`projects`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(k,{size:18,className:`text-orange-400`}),`Projects`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.projects.length,` Items`]})]}),e.projects.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted projects`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Project Name`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.projects.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(k,{size:14,className:`text-muted-foreground`}),e.name]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await t(e.id),B()},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>V(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsxs)(M,{value:`diagrams`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(o,{size:18,className:`text-blue-400`}),`Diagrams`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.diagrams.length,` Items`]})]}),e.diagrams.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted diagrams`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Diagram Name`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.diagrams.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(o,{size:14,className:`text-muted-foreground`}),e.name]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await i(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>H(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsx)(M,{value:`db-clients`,className:`mt-0`,children:(0,P.jsx)(F,{clients:e.dbClients||[],restore:z,permanentlyDelete:K})}),(0,P.jsxs)(M,{value:`notes`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(A,{size:18,className:`text-yellow-400`}),`Notes`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.notes.length,` Items`]})]}),e.notes.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted notes`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Note Title`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.notes.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(A,{size:14,className:`text-muted-foreground`}),e.title]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await I(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>U(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsxs)(M,{value:`drawings`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(s,{size:18,className:`text-purple-400`}),`Drawings`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.drawings.length,` Items`]})]}),e.drawings.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted drawings`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Drawing Title`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.drawings.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(s,{size:14,className:`text-muted-foreground`}),e.title]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await L(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>W(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsxs)(M,{value:`flowcharts`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(a,{size:18,className:`text-green-400`}),`Flowcharts`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.flowcharts?.length||0,` Items`]})]}),!e.flowcharts||e.flowcharts.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted flowcharts`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Flowchart Title`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.flowcharts.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(a,{size:14,className:`text-muted-foreground`}),e.title]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await R(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>G(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]})]})})]})]})}export{I as TrashView};
|
|
1
|
+
import"./rolldown-runtime-BCiCTKAo.js";import{n as e,t}from"./jsx-runtime-Cl3nUQcN.js";import{i as n}from"./createLucideIcon-DCn6SI1F.js";import{t as r}from"./button-CYI0LXM3.js";import{i,n as a,r as o,t as s}from"./pen-tool-CoHyO7pC.js";import{t as c}from"./refresh-ccw-CWK4vSVV.js";import{t as l}from"./trash-2-CV7XVyhd.js";import{C as u,a as d,c as ee,d as te,i as f,n as p,o as m,s as h,t as g,u as _}from"./alert-dialog-DXnJdv-M.js";import{n as v}from"./api-DuV0sTuY.js";import{n as y}from"./fileOwnership-CF3Bm_pU.js";import{n as b}from"./useAuth-splnWP_7.js";import{A as x,B as S,F as C,I as w,L as T,M as ne,Mt as re,N as E,R as D,U as O,Yt as k,ct as A,it as j,j as M,z as N}from"./index-CpB0lOgn.js";e();var P=t();function F({clients:e,restore:t,permanentlyDelete:n}){return(0,P.jsxs)(`section`,{children:[(0,P.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,P.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,P.jsx)(i,{size:18,className:`text-cyan-400`}),` DB Clients`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.length,` Items`]})]}),e.length===0?(0,P.jsx)(`div`,{className:`rounded-lg border border-dashed py-12 text-center text-muted-foreground`,children:`No deleted DB Clients`}):(0,P.jsx)(`div`,{className:`overflow-hidden rounded-lg border`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`DB Client Name`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`flex items-center gap-2 font-medium`,children:[(0,P.jsx)(i,{size:14}),e.name]}),(0,P.jsx)(T,{className:`text-xs font-semibold text-muted-foreground`,children:e.project?.name||`-`}),(0,P.jsx)(T,{className:`text-xs text-muted-foreground`,children:new Date(e.deleted_at||e.updated_at).toLocaleString()}),(0,P.jsx)(T,{className:`text-right`,children:(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:()=>t(e),children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),`Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>n(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),`Delete`]})]})})]},e.id))})]})})]})}function I({trashData:e,restoreProject:t,restoreDiagram:i,restoreNote:I,restoreDrawing:L,restoreFlowchart:R,restoreDbClient:z,fetchTrash:B,handleProjectPermanentDelete:V,handleDiagramPermanentDelete:H,handleNotePermanentDelete:U,handleDrawingPermanentDelete:W,handleFlowchartPermanentDelete:G,handleDbClientPermanentDelete:K,isLoading:q=!1}){let{user:J,isGuest:Y}=b(),X=e=>y(e,J?.id,Y),Z=J?.isSso&&e.retentionDays||0,Q=[e.projects,e.diagrams,e.notes,e.drawings,e.flowcharts||[]].flat().filter(X).length,$=e=>{let t=new Date(e.deleted_at||e.updated_at||e.created_at),n=Z>0&&e.deleted_at?new Date(t.getTime()+Z*864e5):null;return(0,P.jsxs)(P.Fragment,{children:[t.toLocaleString(),n&&(0,P.jsxs)(`span`,{className:`block text-[11px]`,children:[`Deleted permanently on `,n.toLocaleDateString()]})]})};return(0,P.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 border rounded-xl bg-background overflow-hidden relative`,children:[q&&e.projects.length===0&&(0,P.jsxs)(`div`,{className:`absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/60 backdrop-blur-[1px]`,children:[(0,P.jsx)(re,{className:`w-8 h-8 text-primary animate-spin opacity-60`}),(0,P.jsx)(`p`,{className:`mt-2 text-xs font-medium text-muted-foreground`,children:`Loading trash...`})]}),(0,P.jsxs)(`div`,{className:`p-6 border-b shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`h2`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,P.jsx)(j,{size:24,className:`text-muted-foreground`}),`Trash Bin`]}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage your deleted files and projects. Items can be restored or permanently deleted.`})]}),Z>0&&Q>0&&(0,P.jsxs)(g,{children:[(0,P.jsxs)(te,{render:(0,P.jsx)(r,{variant:`destructive`,size:`sm`}),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Empty Trash`]}),(0,P.jsxs)(d,{children:[(0,P.jsxs)(ee,{children:[(0,P.jsx)(_,{children:`Empty Trash?`}),(0,P.jsxs)(m,{children:[Q,` item`,Q===1?``:`s`,` you created will be permanently deleted and can no longer be restored. Items created by others stay.`]})]}),(0,P.jsxs)(h,{children:[(0,P.jsx)(f,{children:`Cancel`}),(0,P.jsx)(p,{onClick:async()=>{(await v(`/api/trash`,{method:`DELETE`})).ok?(n.success(`Trash emptied`),B()):n.error(`Failed to empty Trash`)},children:`Delete permanently`})]})]})]})]}),Z>0&&(0,P.jsxs)(`div`,{role:`note`,className:`mt-4 flex items-start gap-2 rounded-lg border border-amber-500/50 bg-amber-500/10 p-3 text-sm text-amber-900 dark:text-amber-200`,children:[(0,P.jsx)(u,{size:16,className:`mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,P.jsxs)(`p`,{children:[(0,P.jsx)(`span`,{className:`font-semibold`,children:`Warning: `}),`Files in the Trash are permanently deleted after `,Z,` days and can no longer be restored. Restore a file before then if you still need it.`]})]})]}),(0,P.jsxs)(x,{defaultValue:`projects`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`shrink-0 overflow-x-auto border-b px-6 py-3 custom-scrollbar`,children:(0,P.jsxs)(ne,{className:`w-max`,children:[(0,P.jsxs)(E,{value:`projects`,children:[`Projects (`,e.projects.length,`)`]}),(0,P.jsxs)(E,{value:`diagrams`,children:[`ERD (`,e.diagrams.length,`)`]}),(0,P.jsxs)(E,{value:`db-clients`,children:[`DB Client (`,e.dbClients?.length||0,`)`]}),(0,P.jsxs)(E,{value:`notes`,children:[`Notes (`,e.notes.length,`)`]}),(0,P.jsxs)(E,{value:`drawings`,children:[`Drawings (`,e.drawings.length,`)`]}),(0,P.jsxs)(E,{value:`flowcharts`,children:[`Flowcharts (`,e.flowcharts?.length||0,`)`]})]})}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar`,children:(0,P.jsxs)(`div`,{className:`p-6`,children:[(0,P.jsxs)(M,{value:`projects`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(k,{size:18,className:`text-orange-400`}),`Projects`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.projects.length,` Items`]})]}),e.projects.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted projects`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Project Name`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.projects.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(k,{size:14,className:`text-muted-foreground`}),e.name]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await t(e.id),B()},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>V(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsxs)(M,{value:`diagrams`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(o,{size:18,className:`text-blue-400`}),`Diagrams`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.diagrams.length,` Items`]})]}),e.diagrams.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted diagrams`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Diagram Name`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.diagrams.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(o,{size:14,className:`text-muted-foreground`}),e.name]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await i(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>H(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsx)(M,{value:`db-clients`,className:`mt-0`,children:(0,P.jsx)(F,{clients:e.dbClients||[],restore:z,permanentlyDelete:K})}),(0,P.jsxs)(M,{value:`notes`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(A,{size:18,className:`text-yellow-400`}),`Notes`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.notes.length,` Items`]})]}),e.notes.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted notes`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Note Title`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.notes.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(A,{size:14,className:`text-muted-foreground`}),e.title]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await I(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>U(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsxs)(M,{value:`drawings`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(s,{size:18,className:`text-purple-400`}),`Drawings`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.drawings.length,` Items`]})]}),e.drawings.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted drawings`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Drawing Title`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.drawings.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(s,{size:14,className:`text-muted-foreground`}),e.title]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await L(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>W(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]}),(0,P.jsxs)(M,{value:`flowcharts`,className:`mt-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,P.jsx)(a,{size:18,className:`text-green-400`}),`Flowcharts`]}),(0,P.jsxs)(O,{variant:`outline`,children:[e.flowcharts?.length||0,` Items`]})]}),!e.flowcharts||e.flowcharts.length===0?(0,P.jsx)(`div`,{className:`text-center py-12 border rounded-lg border-dashed text-muted-foreground`,children:`No deleted flowcharts`}):(0,P.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,P.jsxs)(C,{children:[(0,P.jsx)(N,{children:(0,P.jsxs)(S,{children:[(0,P.jsx)(D,{children:`Flowchart Title`}),(0,P.jsx)(D,{children:`Project`}),(0,P.jsx)(D,{children:`Deleted At`}),(0,P.jsx)(D,{className:`text-right`,children:`Actions`})]})}),(0,P.jsx)(w,{children:e.flowcharts.map(e=>(0,P.jsxs)(S,{children:[(0,P.jsxs)(T,{className:`font-medium flex items-center gap-2`,children:[(0,P.jsx)(a,{size:14,className:`text-muted-foreground`}),e.title]}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs font-semibold`,children:e.projects?.name||`-`}),(0,P.jsx)(T,{className:`text-muted-foreground text-xs`,children:$(e)}),(0,P.jsx)(T,{className:`text-right`,children:X(e)?(0,P.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,P.jsxs)(r,{variant:`outline`,size:`sm`,onClick:async()=>{await R(e)},children:[(0,P.jsx)(c,{size:14,className:`mr-1`}),` Restore`]}),(0,P.jsxs)(r,{variant:`destructive`,size:`sm`,onClick:()=>G(e),children:[(0,P.jsx)(l,{size:14,className:`mr-1`}),` Delete`]})]}):(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Creator only`})})]},e.id))})]})})]})]})})]})]})}export{I as TrashView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{i as r}from"./createLucideIcon-DCn6SI1F.js";import{l as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as a}from"./button-CYI0LXM3.js";import{s as o}from"./useField-E2Vk7I_Z.js";import{n as s,t as c}from"./refresh-cw-DyBeWpoi.js";import{t as l}from"./chevron-left-D_Hf28gP.js";import{t as u}from"./ConfirmModal-pEN41Kyx.js";import{a as d,d as f,f as p,i as m,l as h,n as g,o as _,s as v,t as y,v as b}from"./dialog-BIk9Y-3N.js";import{t as x}from"./user-cog-hquByiKk.js";import{n as S}from"./api-DuV0sTuY.js";import{t as C}from"./input-CMgoax5D.js";import{n as w}from"./useAuth-splnWP_7.js";import{A as T,B as E,F as D,I as O,L as k,M as A,Mt as j,N as M,R as N,U as P,j as F,ln as I,z as L}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{n as t,t as n}from"./jsx-runtime-Cl3nUQcN.js";import{i as r}from"./createLucideIcon-DCn6SI1F.js";import{l as i}from"./chunk-BV7QT456-B3UxAK3W.js";import{t as a}from"./button-CYI0LXM3.js";import{s as o}from"./useField-E2Vk7I_Z.js";import{n as s,t as c}from"./refresh-cw-DyBeWpoi.js";import{t as l}from"./chevron-left-D_Hf28gP.js";import{t as u}from"./ConfirmModal-pEN41Kyx.js";import{a as d,d as f,f as p,i as m,l as h,n as g,o as _,s as v,t as y,v as b}from"./dialog-BIk9Y-3N.js";import{t as x}from"./user-cog-hquByiKk.js";import{n as S}from"./api-DuV0sTuY.js";import{t as C}from"./input-CMgoax5D.js";import{n as w}from"./useAuth-splnWP_7.js";import{A as T,B as E,F as D,I as O,L as k,M as A,Mt as j,N as M,R as N,U as P,j as F,ln as I,z as L}from"./index-CpB0lOgn.js";var R=e(t(),1),z=n(),B=e=>{let t=e?Date.parse(e):NaN;return Number.isNaN(t)?`—`:new Date(t).toLocaleDateString()},V=e=>{let t=Array.isArray(e.teamMemberships)?e.teamMemberships:[];return t.length?t.map(e=>`${e.team?.name||`Unknown Team`} (Team: ${e.team?.status||`unknown`}; membership: ${e.status})`).join(`, `):`No Team`},H={page:1,pageSize:20,total:0,totalPages:1},U=e=>({...e,createdAt:e.createdAt??e.created_at??null,teamMemberships:e.teamMemberships??e.team_memberships??[]});function W(){let e=i(),{user:t}=w(),[n,o]=(0,R.useState)(`all`),[c,l]=(0,R.useState)([]),[E,D]=(0,R.useState)([]),[O,k]=(0,R.useState)(H),[j,N]=(0,R.useState)(``),[P,L]=(0,R.useState)(!0),[B,V]=(0,R.useState)(``),[W,q]=(0,R.useState)(null),[J,Y]=(0,R.useState)(null),[X,Z]=(0,R.useState)(null),Q=(0,R.useCallback)(async(e,t,n)=>{L(!0),V(``);try{if(e===`invitations`){let e=await S(`/api/users/invitations`),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||`Unable to load invitations.`);D(Array.isArray(t.data)?t.data:[])}else{let r=new URLSearchParams({kind:e,page:String(t),pageSize:`20`});n.trim()&&r.set(`search`,n.trim());let i=await S(`/api/users?${r.toString()}`),a=await i.json().catch(()=>({}));if(!i.ok)throw Error(a.error||`Unable to load users.`);l(Array.isArray(a.data)?a.data.map(U):[]),k(a.pagination||H)}}catch(e){let t=e?.message||`Unable to load user management.`;V(t),r.error(t)}finally{L(!1)}},[]);if((0,R.useEffect)(()=>{let e=window.setTimeout(()=>void Q(n,O.page,j),j?250:0);return()=>window.clearTimeout(e)},[Q,O.page,j,n]),!(t?.isSuperAdmin||t?.is_super_admin))return null;if(B&&!P)return(0,z.jsxs)(`main`,{className:`flex flex-1 flex-col items-start gap-4 p-6`,children:[(0,z.jsxs)(a,{variant:`ghost`,onClick:()=>e(`/`),children:[(0,z.jsx)(s,{}),` Back`]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`User Management unavailable`}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:B})]})]});let $=async e=>{q(e.id);try{let t=await S(`/api/users/${encodeURIComponent(e.id)}/reset-password`,{method:`POST`}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||`Unable to reset password.`);let i=[n.temporaryPassword,n.temporary_password,n.data?.temporaryPassword,n.data?.temporary_password].find(e=>typeof e==`string`&&e.length>0);if(!i)throw Error(`The temporary password was not returned. Restart the server and reset the password again.`);Y(i),r.success(`Temporary password generated`)}catch(e){r.error(e?.message||`Unable to reset password.`)}finally{q(null)}},ee=async()=>{J&&(await navigator.clipboard.writeText(J),r.success(`Temporary password copied`))};return(0,z.jsxs)(`main`,{className:`-m-4 flex-1 overflow-auto bg-background`,children:[(0,z.jsxs)(`div`,{className:`flex w-full flex-col gap-6 p-6 lg:p-8`,children:[(0,z.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(a,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),"aria-label":`Back to dashboard`,children:(0,z.jsx)(s,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`h1`,{className:`flex items-center gap-2 text-2xl font-semibold`,children:[(0,z.jsx)(x,{className:`size-5`}),` User Management`]}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage Team accounts, memberships, and invitations.`})]})]}),(0,z.jsx)(f,{children:(0,z.jsx)(p,{children:(0,z.jsxs)(T,{value:n,onValueChange:e=>{o(e),k(e=>({...e,page:1}))},children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(M,{value:`all`,children:`All users`}),(0,z.jsx)(M,{value:`no-team`,children:`No Team`}),(0,z.jsx)(M,{value:`former`,children:`Former members`}),(0,z.jsx)(M,{value:`invitations`,children:`Invitations`})]}),n!==`invitations`&&(0,z.jsxs)(`div`,{className:`relative w-full sm:ml-auto sm:w-72`,children:[(0,z.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(C,{value:j,onChange:e=>{N(e.target.value),k(e=>({...e,page:1}))},placeholder:`Search name or email`,"aria-label":`Search users by name or email`,className:`pl-9`})]})]}),[`all`,`no-team`,`former`].map(e=>(0,z.jsx)(F,{value:e,className:`mt-4`,children:(0,z.jsx)(G,{users:c,loading:P,action:W,onReset:e=>Z(e),pagination:O,onPageChange:e=>k(t=>({...t,page:e}))})},e)),(0,z.jsx)(F,{value:`invitations`,className:`mt-4`,children:(0,z.jsx)(K,{invitations:E,loading:P})})]})})})]}),(0,z.jsx)(y,{open:!!J,onOpenChange:e=>!e&&Y(null),children:(0,z.jsxs)(m,{size:`sm`,children:[(0,z.jsxs)(v,{children:[(0,z.jsx)(h,{children:`Temporary password`}),(0,z.jsx)(d,{children:`Copy and share this once through a secure channel. It will not be shown again.`})]}),(0,z.jsx)(g,{children:(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,z.jsx)(C,{value:J||``,readOnly:!0}),(0,z.jsx)(a,{type:`button`,variant:`outline`,size:`icon`,onClick:()=>void ee(),"aria-label":`Copy temporary password`,children:(0,z.jsx)(I,{})})]})}),(0,z.jsx)(_,{children:(0,z.jsx)(a,{onClick:()=>Y(null),children:`Done`})})]})}),(0,z.jsx)(u,{isOpen:!!X,title:`Reset member password?`,message:`A new temporary password will be created for ${X?.email||`this member`}. Existing sessions will be signed out.`,confirmText:`Reset password`,cancelText:`Cancel`,variant:`warning`,onCancel:()=>Z(null),onConfirm:()=>{let e=X;Z(null),e&&$(e)}})]})}function G({users:e,loading:t,action:n,onReset:r,pagination:i,onPageChange:s}){let u=i.total===0?0:(i.page-1)*i.pageSize+1,d=Math.min(i.page*i.pageSize,i.total);return(0,z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(L,{children:(0,z.jsxs)(E,{children:[(0,z.jsx)(N,{children:`User`}),(0,z.jsx)(N,{children:`Team history`}),(0,z.jsx)(N,{children:`Created`}),(0,z.jsx)(N,{className:`w-36 text-right`,children:`Action`})]})}),(0,z.jsx)(O,{children:t?(0,z.jsx)(E,{children:(0,z.jsx)(k,{colSpan:4,className:`h-24 text-center`,children:(0,z.jsx)(j,{className:`mx-auto size-4 animate-spin`})})}):e.length===0?(0,z.jsx)(E,{children:(0,z.jsx)(k,{colSpan:4,className:`h-24 text-center text-muted-foreground`,children:`No users found.`})}):e.map(e=>(0,z.jsxs)(E,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(`div`,{className:`font-medium`,children:e.name||`Unnamed member`}),(0,z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.email})]}),(0,z.jsx)(k,{className:`text-muted-foreground`,children:V(e)}),(0,z.jsx)(k,{className:`text-muted-foreground`,children:B(e.createdAt)}),(0,z.jsx)(k,{className:`text-right`,children:(0,z.jsxs)(a,{variant:`outline`,size:`sm`,disabled:n!==null,onClick:()=>r(e),children:[n===e.id?(0,z.jsx)(j,{className:`animate-spin`}):(0,z.jsx)(c,{}),` Reset password`]})})]},e.id))})]}),i.totalPages>1&&(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t px-3 py-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{children:[u,`–`,d,` of `,i.total]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Previous page`,disabled:t||i.page<=1,onClick:()=>s(i.page-1),children:(0,z.jsx)(l,{})}),(0,z.jsxs)(`span`,{className:`min-w-20 text-center`,children:[`Page `,i.page,` of `,i.totalPages]}),(0,z.jsx)(a,{variant:`outline`,size:`icon-xs`,"aria-label":`Next page`,disabled:t||i.page>=i.totalPages,onClick:()=>s(i.page+1),children:(0,z.jsx)(o,{})})]})]})]})}function K({invitations:e,loading:t}){return(0,z.jsx)(`div`,{className:`rounded-lg border`,children:(0,z.jsxs)(D,{children:[(0,z.jsx)(L,{children:(0,z.jsxs)(E,{children:[(0,z.jsx)(N,{children:`Email`}),(0,z.jsx)(N,{children:`Team`}),(0,z.jsx)(N,{children:`Status`}),(0,z.jsx)(N,{children:`Sent`})]})}),(0,z.jsx)(O,{children:t?(0,z.jsx)(E,{children:(0,z.jsx)(k,{colSpan:4,className:`h-24 text-center`,children:(0,z.jsx)(j,{className:`mx-auto size-4 animate-spin`})})}):e.length===0?(0,z.jsx)(E,{children:(0,z.jsx)(k,{colSpan:4,className:`h-24 text-center text-muted-foreground`,children:`No invitations found.`})}):e.map(e=>(0,z.jsxs)(E,{children:[(0,z.jsx)(k,{children:e.email}),(0,z.jsx)(k,{children:e.team.name}),(0,z.jsx)(k,{children:(0,z.jsx)(P,{variant:`secondary`,children:e.acceptedAt?`Accepted`:new Date(e.expiresAt)<new Date?`Expired`:`Pending`})}),(0,z.jsx)(k,{className:`text-muted-foreground`,children:B(e.createdAt)})]},e.id))})]})})}export{W as UserManagementRoute,W as default};
|