decocms 2.306.7 → 2.306.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-Cb7fTEMa.js → AlertCircle-BTzXzMwa.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-tcEBzg5K.js → ArrowNarrowLeft-D2yH9wXQ.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-Ds7CgDkL.js → ArrowUpRight-Oalb5bG5.js} +1 -1
- package/dist/client/assets/{Check-Dgq0jjpz.js → Check-D4yu1L9M.js} +1 -1
- package/dist/client/assets/{CheckCircle-rZ5sDOOP.js → CheckCircle-Ce90skz0.js} +1 -1
- package/dist/client/assets/{ChevronDown-CH5lQohM.js → ChevronDown-BqGwceCn.js} +1 -1
- package/dist/client/assets/{ChevronRight-DfFDUpKj.js → ChevronRight-BRV7Tdzz.js} +1 -1
- package/dist/client/assets/{ChevronUp-DCsRkih0.js → ChevronUp-pbRiDYbB.js} +1 -1
- package/dist/client/assets/{Container-zeFPXb1Q.js → Container-Cf08ks6f.js} +1 -1
- package/dist/client/assets/{DotsVertical-BljfGuhu.js → DotsVertical-Cb1IeswQ.js} +1 -1
- package/dist/client/assets/{LinkExternal01-MvI2bZbP.js → LinkExternal01-DfeIVyGK.js} +1 -1
- package/dist/client/assets/{Lock01-CidilFiJ.js → Lock01-B6CuPSqy.js} +1 -1
- package/dist/client/assets/{Palette-CURRsupy.js → Palette-6MGVk9XZ.js} +1 -1
- package/dist/client/assets/{Play-DLW6aJFn.js → Play-Z9TLXhXZ.js} +1 -1
- package/dist/client/assets/{Plus-28zZOE9T.js → Plus-BWFmeYbA.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-CCzpYBs0.js → RefreshCcw01-DdNBG9uq.js} +1 -1
- package/dist/client/assets/{SearchMd-BpRj1P2W.js → SearchMd-Bk2WMaal.js} +1 -1
- package/dist/client/assets/{Settings02-CE5ZLw2I.js → Settings02-DV_JgL_i.js} +1 -1
- package/dist/client/assets/{Shield01-Dtb2_AeI.js → Shield01-DabBYOJe.js} +1 -1
- package/dist/client/assets/{Star01-ChekdAzX.js → Star01-EsNS3h_Z.js} +1 -1
- package/dist/client/assets/{Sun-TuktgENq.js → Sun-BSBNF16W.js} +1 -1
- package/dist/client/assets/{Tool01-Cu4I31F8.js → Tool01-BLP2PhNo.js} +1 -1
- package/dist/client/assets/{Trash01-4Dq6ympL.js → Trash01-BrCWXUwU.js} +1 -1
- package/dist/client/assets/{User01-DKnZn118.js → User01-YnNa4o8H.js} +1 -1
- package/dist/client/assets/{Users03-rbWg-6tV.js → Users03-ju7GWCNc.js} +1 -1
- package/dist/client/assets/{X-CAquUT--.js → X-Bwb7_m5v.js} +1 -1
- package/dist/client/assets/{XCircle-B-00qJpY.js → XCircle-CH3QyMaX.js} +1 -1
- package/dist/client/assets/{XClose-_Y5VAjW5.js → XClose-CWzVSlUZ.js} +1 -1
- package/dist/client/assets/{Zap-B8xnzkap.js → Zap-ByRL5ggZ.js} +1 -1
- package/dist/client/assets/{ZapSquare-Cpo7Z7gP.js → ZapSquare-DwXwFOB5.js} +1 -1
- package/dist/client/assets/{accordion-CyIKHcCT.js → accordion-DEfiI4_u.js} +1 -1
- package/dist/client/assets/{agent-icon-D9odI-qh.js → agent-icon-BWW-_spm.js} +1 -1
- package/dist/client/assets/{agents-list-CLJAN1rm.js → agents-list-DtSKcauO.js} +1 -1
- package/dist/client/assets/ai-providers-Dmv17i-r.js +1 -0
- package/dist/client/assets/{alert-dialog-DCT4MTMH.js → alert-dialog-CIRyCiSh.js} +1 -1
- package/dist/client/assets/{auth-catchall-DoKHQvfb.js → auth-catchall-DM2HSAyx.js} +1 -1
- package/dist/client/assets/{automation-list-row-C0fNHM9j.js → automation-list-row-BZQnmXsD.js} +1 -1
- package/dist/client/assets/{automations-CVam3JT8.js → automations-BpoAkXQ6.js} +1 -1
- package/dist/client/assets/{avatar-JoKAxyik.js → avatar-O6nD_RVH.js} +1 -1
- package/dist/client/assets/{badge-BXVtVPzt.js → badge-1GzX8YfJ.js} +1 -1
- package/dist/client/assets/{brand-context-B00HyWuJ.js → brand-context-pSsdhU7u.js} +1 -1
- package/dist/client/assets/{card-CkFfla-m.js → card-YRPYO7rK.js} +1 -1
- package/dist/client/assets/{chat-context-C4lTxfjV.js → chat-context-BXGy7Agh.js} +1 -1
- package/dist/client/assets/{checkbox-Baro7Q1f.js → checkbox-BtvQbCay.js} +1 -1
- package/dist/client/assets/{collection-detail-CvBw6hsJ.js → collection-detail--ucxh4J-.js} +1 -1
- package/dist/client/assets/{collection-display-button-BSv13jEo.js → collection-display-button-CMOfNtao.js} +1 -1
- package/dist/client/assets/{collection-search-BHyuqRiT.js → collection-search-CYChlQpy.js} +1 -1
- package/dist/client/assets/{collection-search-jhKWbxqo.js → collection-search-mbr97YEK.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-hR7H16-N.js → collection-table-wrapper-BnAWIjfr.js} +1 -1
- package/dist/client/assets/{collection-tabs-BPF8fjT2.js → collection-tabs-CkdgJkBV.js} +1 -1
- package/dist/client/assets/{collections-B60eBxX4.js → collections-BFntmLot.js} +1 -1
- package/dist/client/assets/{command-CJRvOxZ7.js → command-Cbz_0bPm.js} +1 -1
- package/dist/client/assets/{connection-card-ugyEg8FF.js → connection-card-BLDKB8T1.js} +1 -1
- package/dist/client/assets/{connection-detail-EgRvIktM.js → connection-detail-BFIdeQRn.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CYrNbtwl.js → connection-form-helpers-CSJOop0l.js} +1 -1
- package/dist/client/assets/{connections-I35i0t7r.js → connections-BW08Tw6P.js} +1 -1
- package/dist/client/assets/{constants-CMPjFkrZ.js → constants-CyYXtNQt.js} +1 -1
- package/dist/client/assets/{constants-XGFAnuHn.js → constants-O6TOd6Fi.js} +1 -1
- package/dist/client/assets/{dialog-sfEBwtz9.js → dialog-BapANLA4.js} +1 -1
- package/dist/client/assets/{domain-settings-BEv8OnaD.js → domain-settings-BiGD_AWa.js} +1 -1
- package/dist/client/assets/{drawer--MluJNWl.js → drawer-DXfcxG35.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BpPFRti7.js → dropdown-menu-8r0P5O89.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-JwST599m.js → dynamic-plugin-layout-88jqqJ-n.js} +1 -1
- package/dist/client/assets/{empty-state-Vlkqr5Ha.js → empty-state-CxaKSceI.js} +1 -1
- package/dist/client/assets/{empty-state-Be0FdXg2.js → empty-state-D31vnJxY.js} +1 -1
- package/dist/client/assets/{extract-connection-data-B9BMTKgA.js → extract-connection-data-BAmE4x-0.js} +1 -1
- package/dist/client/assets/{features-ymCT4sQe.js → features-Zs1cJ0se.js} +1 -1
- package/dist/client/assets/{form-DpB6tHPK.js → form-vm22t8bs.js} +1 -1
- package/dist/client/assets/{general-Bi8iKo_s.js → general-DOQdXWNJ.js} +1 -1
- package/dist/client/assets/{index-CGKwbcyW.js → index-4ADaRsb3.js} +1 -1
- package/dist/client/assets/{index-BWMPhdit.js → index-B1K3k56c.js} +1 -1
- package/dist/client/assets/{index-BAl-Vlym.js → index-BZSJm92U.js} +1 -1
- package/dist/client/assets/{index-B_IvwEkx.js → index-C3KqPz7f.js} +1 -1
- package/dist/client/assets/{index-JYp8Y8Zk.js → index-CDWEA7tA.js} +17 -17
- package/dist/client/assets/{index-uTY5VsaX.js → index-CHlpZld0.js} +1 -1
- package/dist/client/assets/{index-BG0omYxu.js → index-COg7cSsl.js} +1 -1
- package/dist/client/assets/{index-B-PMmlqs.js → index-CZoa5Voq.js} +1 -1
- package/dist/client/assets/{index-0dtUnOR1.js → index-CtJ1_vQP.js} +2 -2
- package/dist/client/assets/{index-Bzh6y1DZ.js → index-DCtZqQ0W.js} +1 -1
- package/dist/client/assets/{index-DE4jOyEe.js → index-DSEbXUmT.js} +1 -1
- package/dist/client/assets/{index-mKsCyZ2c.js → index-DnMFHGHl.js} +1 -1
- package/dist/client/assets/{index-Cav3nFoE.js → index-Dy9FasiB.js} +1 -1
- package/dist/client/assets/{index-DqWmbGe9.js → index-Irwc0F9z.js} +1 -1
- package/dist/client/assets/{index-DlEDBVDU.js → index-cMeVTxue.js} +1 -1
- package/dist/client/assets/index-sD08ZTU7.js +1 -0
- package/dist/client/assets/{infiniteQueryObserver-D69C8aZS.js → infiniteQueryObserver-BORSReP2.js} +1 -1
- package/dist/client/assets/{input-Dh3J6cxA.js → input-DzKH4IoC.js} +1 -1
- package/dist/client/assets/{integration-icon-CDE9CENl.js → integration-icon-DZ1DDayM.js} +1 -1
- package/dist/client/assets/{label-BGhcnROH.js → label-B1j7QJO9.js} +1 -1
- package/dist/client/assets/{layout-DMQieMve.js → layout-CgSQP9Dz.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-DZfH4ZaB.js → lean-canvas-recruit-modal-CkuRnY-q.js} +1 -1
- package/dist/client/assets/{login-HZPNR9xd.js → login-BFVakp9W.js} +1 -1
- package/dist/client/assets/{members-DXQFXjq8.js → members-BvtGRXTq.js} +1 -1
- package/dist/client/assets/{monaco-editor-BaDnBAIf.js → monaco-editor-DbLGolnd.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CQqHcgiv.js → monitoring-stats-row-Bs9q7htN.js} +1 -1
- package/dist/client/assets/{oauth-callback-Du4eDSpz.js → oauth-callback-C2IfOXdE.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BhxrV53q.js → oauth-callback-ai-provider-DjdeIGJy.js} +1 -1
- package/dist/client/assets/{onboarding-HMRjmRyP.js → onboarding-qQL2AHJp.js} +1 -1
- package/dist/client/assets/{org-layout-DoqHSWQn.js → org-layout-r-dIMXY7.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-DXqded6M.js → org-plugin-layout-BdbYhknE.js} +1 -1
- package/dist/client/assets/{pair-D1MIu7ah.js → pair-BeVk0nw4.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BSfCLmcP.js → plugin-empty-state-tnsMkLWl.js} +1 -1
- package/dist/client/assets/{plugin-header-2Ks_trAw.js → plugin-header-DlR3Hsv1.js} +1 -1
- package/dist/client/assets/{plugin-layout-CdtsQwFc.js → plugin-layout-j_5ixQWh.js} +1 -1
- package/dist/client/assets/{popover-D4Clv1Kb.js → popover-BoJSCjqj.js} +1 -1
- package/dist/client/assets/{profile-CjGu4VCE.js → profile-DJw46v6U.js} +1 -1
- package/dist/client/assets/{project-app-view-Cr2YOe9x.js → project-app-view-CqGwq86p.js} +1 -1
- package/dist/client/assets/registry-CRDkHUvw.js +2 -0
- package/dist/client/assets/{registry-layout-DGUmz1QL.js → registry-layout-CKKMYc0F.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DMKD_TV3.js → required-auth-layout-BOqEO0UW.js} +1 -1
- package/dist/client/assets/{reset-password-Bn__ApCp.js → reset-password-DC2CZqgK.js} +1 -1
- package/dist/client/assets/{roles-C4lGMFwb.js → roles-B7M_sNQI.js} +1 -1
- package/dist/client/assets/{scroll-area-yWZqBKom.js → scroll-area-CVP2hanW.js} +1 -1
- package/dist/client/assets/{search-input-UA1Jjc1m.js → search-input-DBJx5Puk.js} +1 -1
- package/dist/client/assets/{select-CG0rwGUX.js → select-BL-3WYG3.js} +1 -1
- package/dist/client/assets/{select-model-DcRnjECr.js → select-model-CBeAOuD4.js} +1 -1
- package/dist/client/assets/{settings-layout-ePFy_Zf4.js → settings-layout-D4-CafDE.js} +1 -1
- package/dist/client/assets/{settings-section-HkZRSntL.js → settings-section-sY44gYa3.js} +1 -1
- package/dist/client/assets/{shell-layout-CtEV3YzW.js → shell-layout-BRqsQqla.js} +1 -1
- package/dist/client/assets/{skeleton-BxQRt9FI.js → skeleton-BWfslVYc.js} +1 -1
- package/dist/client/assets/{sso-DElvxw59.js → sso-CqR7Oikv.js} +1 -1
- package/dist/client/assets/{store-CQloMsrY.js → store-QjnVaNvS.js} +1 -1
- package/dist/client/assets/store-registry-CEd7y-Xb.js +2 -0
- package/dist/client/assets/{switch-DydlPJmA.js → switch-ClIsCuo0.js} +1 -1
- package/dist/client/assets/{table-Cg2S62iB.js → table-DLr2fSXp.js} +1 -1
- package/dist/client/assets/{tabs-BArWG_lg.js → tabs-CEhOvCGw.js} +1 -1
- package/dist/client/assets/{task-status-Bi6NGRuA.js → task-status-C-SQfZZK.js} +1 -1
- package/dist/client/assets/{textarea-Dkmw6W4u.js → textarea-BQD2K7xE.js} +1 -1
- package/dist/client/assets/{toggle-group-BdQafmUc.js → toggle-group-i71R22i3.js} +1 -1
- package/dist/client/assets/{tools-list-C0MslVQp.js → tools-list-CPm-Mx4D.js} +1 -1
- package/dist/client/assets/{tooltip-XW5rFMNu.js → tooltip-BTEnXfpw.js} +1 -1
- package/dist/client/assets/{types-BU1oqgjO.js → types-lb3PNUQc.js} +1 -1
- package/dist/client/assets/{use-ai-providers-ClmB64W8.js → use-ai-providers-BKH_isZv.js} +1 -1
- package/dist/client/assets/{use-collections-BLOTVIAP.js → use-collections-VlH2NrqV.js} +1 -1
- package/dist/client/assets/{use-connection-DGPnnQz6.js → use-connection-M1xDmD9i.js} +1 -1
- package/dist/client/assets/{use-copy-BquaY5FR.js → use-copy-DEJBJAsZ.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-gYa1vYVG.js → use-create-virtual-mcp-BL0xa08p.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BFE3ZeG7.js → use-debounced-autosave-DJj5fuFt.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-nw-lJk37.js → use-decopilot-events-Bb2NleBN.js} +1 -1
- package/dist/client/assets/{use-delete-connection-MTPofM5f.js → use-delete-connection-Bib86QGR.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-KzNu752x.js → use-infinite-scroll-D8nIolCd.js} +1 -1
- package/dist/client/assets/{use-list-state-BMUfPc5P.js → use-list-state-BYi_uUtE.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DkxVTDC9.js → use-mcp-tools-CtUqFvLD.js} +1 -1
- package/dist/client/assets/{use-members-DadnCd-C.js → use-members-CdkSabwq.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-zDaGGVEB.js → use-navigate-to-agent-D91A1ehg.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CPZNMqkZ.js → use-org-auth-client-CANxngbZ.js} +1 -1
- package/dist/client/assets/{use-org-sso-DMUwA_K8.js → use-org-sso-KaCvgTMV.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CJVol15S.js → use-organization-roles-BXlhN5BZ.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CoHf1k_t.js → use-organization-settings-CCxU4osF.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DWMBdekg.js → use-registry-connections-CcXpK-ys.js} +1 -1
- package/dist/client/assets/{use-status-sounds-j2IA-viC.js → use-status-sounds-Cwi7Sfh7.js} +1 -1
- package/dist/client/assets/{use-tasks-DqkYGNHa.js → use-tasks-D03EtFvf.js} +1 -1
- package/dist/client/assets/{use-view-mode-Bc5J1h4b.js → use-view-mode-CQIRYhjw.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Dndzl8Kr.js → use-virtual-mcp-CX5iadV3.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CgSxuvH6.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-CH8re_uO.js +1 -0
- package/dist/client/assets/{user-Df7A58iD.js → user-C8zZ-7QW.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DoidsjaP.js → view-mode-toggle-Cw5HKJog.js} +1 -1
- package/dist/client/assets/{workflow-DgvsxaIb.js → workflow-Det6DT4b.js} +1 -1
- package/dist/client/assets/workflow-detail-BeFzNTls.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +27 -2
- package/dist/server/node_modules/ansi-styles/index.d.ts +236 -0
- package/dist/server/node_modules/ansi-styles/index.js +223 -0
- package/dist/server/node_modules/ansi-styles/package.json +54 -0
- package/dist/server/node_modules/ansi-styles/readme.md +173 -0
- package/dist/server/node_modules/environment/index.d.ts +74 -0
- package/dist/server/node_modules/environment/index.js +47 -0
- package/dist/server/node_modules/environment/package.json +74 -0
- package/dist/server/node_modules/environment/readme.md +94 -0
- package/dist/server/node_modules/escape-string-regexp/index.d.ts +18 -0
- package/dist/server/node_modules/escape-string-regexp/index.js +11 -0
- package/dist/server/node_modules/escape-string-regexp/license +9 -0
- package/dist/server/node_modules/escape-string-regexp/package.json +43 -0
- package/dist/server/node_modules/escape-string-regexp/readme.md +29 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/dist/server/node_modules/is-fullwidth-code-point/index.js +12 -0
- package/dist/server/node_modules/is-fullwidth-code-point/license +9 -0
- package/dist/server/node_modules/is-fullwidth-code-point/package.json +53 -0
- package/dist/server/node_modules/is-fullwidth-code-point/readme.md +31 -0
- package/dist/server/node_modules/is-unicode-supported/index.d.ts +12 -0
- package/dist/server/node_modules/is-unicode-supported/index.js +21 -0
- package/dist/server/node_modules/is-unicode-supported/license +9 -0
- package/dist/server/node_modules/is-unicode-supported/package.json +47 -0
- package/dist/server/node_modules/is-unicode-supported/readme.md +35 -0
- package/dist/server/node_modules/mimic-fn/index.d.ts +54 -0
- package/dist/server/node_modules/mimic-fn/index.js +13 -0
- package/dist/server/node_modules/mimic-fn/license +9 -0
- package/dist/server/node_modules/mimic-fn/package.json +42 -0
- package/dist/server/node_modules/mimic-fn/readme.md +69 -0
- package/dist/server/node_modules/pg-int8/LICENSE +13 -0
- package/dist/server/node_modules/pg-int8/README.md +16 -0
- package/dist/server/node_modules/pg-int8/index.js +100 -0
- package/dist/server/node_modules/pg-int8/package.json +24 -0
- package/dist/server/node_modules/postgres-array/index.d.ts +4 -0
- package/dist/server/node_modules/postgres-array/index.js +97 -0
- package/dist/server/node_modules/{stack-utils/LICENSE.md → postgres-array/license} +1 -1
- package/dist/server/node_modules/postgres-array/package.json +35 -0
- package/dist/server/node_modules/postgres-array/readme.md +43 -0
- package/dist/server/node_modules/postgres-bytea/index.js +33 -0
- package/dist/server/node_modules/postgres-bytea/license +21 -0
- package/dist/server/node_modules/postgres-bytea/package.json +34 -0
- package/dist/server/node_modules/postgres-bytea/readme.md +34 -0
- package/dist/server/node_modules/postgres-date/index.js +116 -0
- package/dist/server/node_modules/postgres-date/license +21 -0
- package/dist/server/node_modules/postgres-date/package.json +33 -0
- package/dist/server/node_modules/postgres-date/readme.md +49 -0
- package/dist/server/node_modules/postgres-interval/index.d.ts +20 -0
- package/dist/server/node_modules/postgres-interval/index.js +125 -0
- package/dist/server/node_modules/postgres-interval/license +21 -0
- package/dist/server/node_modules/postgres-interval/package.json +36 -0
- package/dist/server/node_modules/postgres-interval/readme.md +48 -0
- package/dist/server/node_modules/restore-cursor/index.d.ts +11 -0
- package/dist/server/node_modules/restore-cursor/index.js +11 -0
- package/dist/server/node_modules/restore-cursor/license +9 -0
- package/dist/server/node_modules/restore-cursor/package.json +55 -0
- package/dist/server/node_modules/restore-cursor/readme.md +31 -0
- package/dist/server/node_modules/split2/LICENSE +13 -0
- package/dist/server/node_modules/split2/README.md +85 -0
- package/dist/server/node_modules/split2/bench.js +27 -0
- package/dist/server/node_modules/split2/index.js +141 -0
- package/dist/server/node_modules/split2/package.json +39 -0
- package/dist/server/node_modules/split2/test.js +409 -0
- package/dist/server/node_modules/string-width/index.d.ts +39 -0
- package/dist/server/node_modules/string-width/index.js +82 -0
- package/dist/server/node_modules/string-width/license +9 -0
- package/dist/server/node_modules/string-width/package.json +64 -0
- package/dist/server/node_modules/string-width/readme.md +66 -0
- package/dist/server/node_modules/xtend/.jshintrc +30 -0
- package/dist/server/node_modules/xtend/LICENSE +20 -0
- package/dist/server/node_modules/xtend/README.md +32 -0
- package/dist/server/node_modules/xtend/immutable.js +19 -0
- package/dist/server/node_modules/xtend/mutable.js +17 -0
- package/dist/server/node_modules/xtend/package.json +55 -0
- package/dist/server/node_modules/xtend/test.js +103 -0
- package/dist/server/server.js +26 -1
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-28dSCs53.js +0 -1
- package/dist/client/assets/index-BkJIlnCh.js +0 -1
- package/dist/client/assets/registry-YuZMNy-0.js +0 -2
- package/dist/client/assets/store-registry-h--qJyio.js +0 -2
- package/dist/client/assets/useInfiniteQuery-BzvZ_TDh.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-ZnAzp1qO.js +0 -1
- package/dist/client/assets/workflow-detail-Bebyclsh.js +0 -1
- package/dist/server/node_modules/cli-boxes/boxes.json +0 -82
- package/dist/server/node_modules/cli-boxes/index.d.ts +0 -127
- package/dist/server/node_modules/cli-boxes/index.js +0 -6
- package/dist/server/node_modules/cli-boxes/package.json +0 -42
- package/dist/server/node_modules/cli-boxes/readme.md +0 -115
- package/dist/server/node_modules/cli-spinners/index.d.ts +0 -139
- package/dist/server/node_modules/cli-spinners/index.js +0 -11
- package/dist/server/node_modules/cli-spinners/package.json +0 -56
- package/dist/server/node_modules/cli-spinners/readme.md +0 -74
- package/dist/server/node_modules/cli-spinners/spinners.json +0 -1697
- package/dist/server/node_modules/stack-utils/index.js +0 -344
- package/dist/server/node_modules/stack-utils/package.json +0 -39
- package/dist/server/node_modules/stack-utils/readme.md +0 -143
- /package/dist/server/node_modules/{cli-boxes → ansi-styles}/license +0 -0
- /package/dist/server/node_modules/{cli-spinners → environment}/license +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as k,j as t,s as $,o as je,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Xe,F as Ze,v as ve,P as et,l as Ne,w as tt,f as nt}from"./index-0dtUnOR1.js";import{S as ce,u as V,d as Ae,W as qe,a as be}from"./constants-CMPjFkrZ.js";import{a as _e}from"./use-navigate-to-agent-zDaGGVEB.js";import{a as le,b as de,c as ue,d as me,D as st}from"./dialog-sfEBwtz9.js";import{i as Ee}from"./RefreshCcw01-CCzpYBs0.js";import{C as Qe}from"./collection-search-jhKWbxqo.js";import{C as it}from"./checkbox-Baro7Q1f.js";import{b as Se,u as ot}from"./use-connection-DGPnnQz6.js";import{i as at}from"./Lock01-CidilFiJ.js";import{n as rt}from"./agent-icon-D9odI-qh.js";import{e as ct}from"./extract-connection-data-B9BMTKgA.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer--MluJNWl.js";import{u as ke}from"./tooltip-XW5rFMNu.js";import{I as Ue}from"./integration-icon-CDE9CENl.js";import{u as lt,d as Ke}from"./use-mcp-tools-DkxVTDC9.js";import{a as Pe,b as dt}from"./use-virtual-mcp-Dndzl8Kr.js";function re(i){const e=k.c(4),{size:s,className:a}=i;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=l):l=e[0];let n;return e[1]!==a||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:a,children:l}),e[1]=a,e[2]=s,e[3]=n):n=e[3],n}function ut(i){return i.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function mt(i){const e=await fetch(`/api/${i}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Xt(i){const e=k.c(70),{open:s,onOpenChange:a,onBack:l}=i,{org:n}=$(),r=_e(),u=je(),{data:d}=Fe.useSession(),[_,c]=O.useState(null),[h,C]=O.useState("");let f;e[0]!==n.id||e[1]!==n.slug?(f={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=f):f=e[2];const p=V(f);let m;e[3]!==d?.user?.email?(m=ne.decoSites(d?.user?.email),e[3]=d?.user?.email,e[4]=m):m=e[4];let g;e[5]!==n.slug?(g=()=>mt(n.slug),e[5]=n.slug,e[6]=g):g=e[6];const x=s&&!!d?.user?.email;let I;e[7]!==m||e[8]!==g||e[9]!==x?(I={queryKey:m,queryFn:g,enabled:x,staleTime:6e4,retry:!1},e[7]=m,e[8]=g,e[9]=x,e[10]=I):I=e[10];const{data:b,isLoading:N,error:y}=He(I),o=b?.sites??[];let T;e[11]!==a?(T=j=>{j||(c(null),C("")),a(j)},e[11]=a,e[12]=T):T=e[12];const w=T;let v;e[13]!==h?(v=j=>j.name.toLowerCase().includes(h.toLowerCase())||j.domains?.[0]?.domain.toLowerCase().includes(h.toLowerCase()),e[13]=h,e[14]=v):v=e[14];const A=o.filter(v),E=!_||A.some(j=>j.name===_);let S;e[15]!==p||e[16]!==n.id||e[17]!==n.slug?(S=async j=>{D("deco_site_import_started",{site_name:j});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:j,orgId:n.id})}),G=await P.json().catch(pt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=ut(j),Ge=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:j,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=p,e[16]=n.id,e[17]=n.slug,e[18]=S):S=e[18];let R;e[19]!==p||e[20]!==w||e[21]!==r||e[22]!==n.id||e[23]!==u?(R=j=>{const{slug:P,virtualMcpId:G,item:M}=j;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(p,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),w(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),r(G)},e[19]=p,e[20]=w,e[21]=r,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==S||e[26]!==R?(z={mutationFn:S,onSuccess:R,onError:gt},e[25]=S,e[26]=R,e[27]=z):z=e[27];const U=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==l?(H=l&&t.jsx("button",{type:"button",onClick:l,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ee,{size:18})}),e[29]=l,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=j=>{j.key==="Escape"&&C("")},e[34]=ge):ge=e[34];let q;e[35]!==h?(q=t.jsx("div",{children:t.jsx(Qe,{value:h,onChange:C,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=h,e[36]=q):q=e[36];const Je="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&o.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Te=!N&&o.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[A.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",h,"”"]}),A.map(j=>{const P=j.domains?.find(ft)?.domain??j.domains?.[0]?.domain,G=_===j.name;return t.jsxs("button",{type:"button",onClick:()=>c(j.name),className:xe("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",G?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:j.thumb_url?t.jsx("img",{src:j.thumb_url,alt:j.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:j.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},j.name)})]});let K;e[39]!==Q||e[40]!==Ce||e[41]!==Te?(K=t.jsxs("div",{className:Je,children:[Q,Ce,Te]}),e[39]=Q,e[40]=Ce,e[41]=Te,e[42]=K):K=e[42];let Y;e[43]!==w?(Y=()=>w(!1),e[43]=w,e[44]=Y):Y=e[44];let W;e[45]!==U.isPending||e[46]!==Y?(W=t.jsx(ae,{variant:"outline",onClick:Y,disabled:U.isPending,children:"Cancel"}),e[45]=U.isPending,e[46]=Y,e[47]=W):W=e[47];const Ie=!_||!E||U.isPending||N;let J;e[48]!==U||e[49]!==_?(J=()=>_&&U.mutate(_),e[48]=U,e[49]=_,e[50]=J):J=e[50];const ye=U.isPending?"Importing...":"Import";let X;e[51]!==Ie||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Ie,onClick:J,children:ye}),e[51]=Ie,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(st,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==K||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,K,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=K,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==w||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:w,children:ee}),e[65]=se,e[66]=w,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function ft(i){return i.production}function gt(i){D("deco_site_import_failed",{error:i instanceof Error?i.message:"Unknown error"}),oe.error("Import failed: "+(i instanceof Error?i.message:"Unknown error"))}function pt(){return{}}function Ye(i,e){const s=k.c(12),{org:a}=$();let l;s[0]!==a.id?(l=Ae.REGISTRY(a.id),s[0]=a.id,s[1]=l):l=s[1];const n=l;let r;s[2]!==a.id||s[3]!==a.slug||s[4]!==n?(r={connectionId:n,orgId:a.id,orgSlug:a.slug},s[2]=a.id,s[3]=a.slug,s[4]=n,s[5]=r):r=s[5];const u=V(r);let d;s[6]!==i?(d={name:i},s[6]=i,s[7]=d):d=s[7];const _=e?.enabled??!0;let c;return s[8]!==u||s[9]!==d||s[10]!==_?(c={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:d,enabled:_,staleTime:3e5,select:ht},s[8]=u,s[9]=d,s[10]=_,s[11]=c):c=s[11],lt(c)}function ht(i){return i.structuredContent?.item??null}const xt="deco/mcp-github";function Nt(i){const{org:e}=$(),{data:s}=Fe.useSession(),a=Se(),l=je(),[n,r]=O.useState("idle"),[u,d]=O.useState(null),[_,c]=O.useState(null),{data:h,isLoading:C}=Ye(xt,{enabled:i.enabled}),f=O.useRef(!1);i.enabled&&h&&!C&&!f.current&&s?.user?.id&&n==="idle"&&(f.current=!0,p());async function p(){if(!(!h||!s?.user?.id||!e))try{r("installing"),d(null);const g=ct(h,e.id,s.user.id,{remoteIndex:0});if(!g.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:I}=await a.create.mutateAsync(g);r("authenticating");const b=new URL(`/api/${e.slug}/mcp/${I}`,window.location.origin),N=await Xe({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:o,error:T}=await Ze({connectionId:I,orgSlug:e.slug,scope:"offline_access"});if(T||!y){try{await a.delete.mutateAsync(I)}catch{}throw new Error(T??"No token received from GitHub")}if(o)try{(await fetch(`/api/${e.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:o.accessToken,refreshToken:o.refreshToken,expiresIn:o.expiresIn,scope:o.scope,clientId:o.clientId,clientSecret:o.clientSecret,tokenEndpoint:o.tokenEndpoint})})).ok||await a.update.mutateAsync({id:I,data:{connection_token:y}})}catch{await a.update.mutateAsync({id:I,data:{connection_token:y}})}}ve(l,e.id),c(g),r("ready")}catch(g){d(g instanceof Error?g.message:String(g)),r("error")}}function m(){r("idle"),d(null),c(null),f.current=!1}return i.enabled&&C&&n==="idle"?{status:"installing",error:null,connection:null,retry:m}:{status:n,error:u,connection:_,retry:m}}function Zt(i){const e=k.c(21),{open:s,onOpenChange:a,title:l,hideAutoRespondCheckbox:n,onImportComplete:r}=i,u=l===void 0?"Import from GitHub":l,d=n===void 0?!1:n,[_]=et(),[c,h]=O.useState(null);if(!_.experimental_vibecode)return null;let C;e[0]!==u?(C=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=C):C=e[1];let f;e[2]!==c||e[3]!==u?(f=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:c?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ee,{size:16})}),t.jsx("img",{src:c.avatarUrl,alt:c.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:c.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=c,e[3]=u,e[4]=f):f=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=p):p=e[5];let m;e[6]!==a?(m=()=>a(!1),e[6]=a,e[7]=m):m=e[7];let g;e[8]!==d||e[9]!==r||e[10]!==c||e[11]!==m?(g=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:p,children:t.jsx(_t,{onComplete:m,selectedInstallation:c,onSelectInstallation:h,hideAutoRespondCheckbox:d,onImportComplete:r})})}),e[8]=d,e[9]=r,e[10]=c,e[11]=m,e[12]=g):g=e[12];let x;e[13]!==C||e[14]!==f||e[15]!==g?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[C,f,g]}),e[13]=C,e[14]=f,e[15]=g,e[16]=x):x=e[16];let I;return e[17]!==a||e[18]!==s||e[19]!==x?(I=t.jsx(de,{open:s,onOpenChange:a,children:x}),e[17]=a,e[18]=s,e[19]=x,e[20]=I):I=e[20],I}function _t({onComplete:i,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:a,onImportComplete:l}){const{org:n}=$(),r=je(),u=_e(),[d,_]=O.useState(null),[c,h]=O.useState(!0),C=a?!0:c,f=ot({slug:"mcp-github"}),p=Nt({enabled:f.length===0}),m=f.length===1?f[0]??null:d,g=V({connectionId:m?.id??"",orgId:n.id,orgSlug:n.slug}),x=V({connectionId:ce,orgId:n.id,orgSlug:n.slug}),I=async(o,T)=>{try{const v=await g.callTool({name:"get_file_contents",arguments:{owner:o.owner,repo:o.name,path:T}});if(v.isError)return null;const E=v.content?.find(S=>S.type==="resource")?.resource?.text;if(!E)return null;try{const S=JSON.parse(E);return typeof S=="string"?S:JSON.stringify(S)}catch{return E}}catch{return null}},b=(o,T)=>{Promise.all([I(T,"AGENTS.md"),I(T,"CLAUDE.md")]).then(async([w,v])=>{const A=w??v??null;A&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:o,data:{metadata:{instructions:A}}}}),ve(r,n.id))}).catch(w=>{console.error("GitHub instructions fetch failed:",w)})},N=async({virtualMcpId:o,repo:T,connectionId:w})=>{const v=await g.callTool({name:"TRIGGER_LIST",arguments:{}}),A=v.structuredContent??v,E=A.triggers?.find(L=>L.type==="github.issues.opened")??A.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!E)throw new Error("No issue-created trigger exposed by GitHub connection");const S=new Set;if(Array.isArray(E.params))for(const L of E.params)S.add(L.name);else if(E.params&&typeof E.params=="object")for(const L of Object.keys(E.params))S.add(L);if(E.paramsSchema)for(const L of Object.keys(E.paramsSchema))S.add(L);const R={};S.has("repo")?R.repo=`${T.owner}/${T.name}`:(S.has("owner")&&(R.owner=T.owner),S.has("name")&&(R.name=T.name),S.has("repository")&&(R.repository=`${T.owner}/${T.name}`));const z=`A new GitHub issue has been opened in ${T.owner}/${T.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,U=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${T.name}: auto-respond to issues`,virtual_mcp_id:o,messages:z,active:!0}}),se=U.structuredContent??U;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:w,event_type:E.type,params:R}})},y=Be({mutationFn:async o=>{if(!m||!e)throw new Error("No GitHub connection or installation");const T=m.id,w=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o.name,description:o.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:o.owner,name:o.name,url:o.url,installationId:e.installationId,connectionId:T},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:T}]}}}),v=w.structuredContent??w,A=v.item.id;return C&&await N({virtualMcpId:A,repo:o,connectionId:T}).catch(E=>{console.error("Failed to set up issue automation:",E),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:A,repo:o,connectionId:T,item:v.item}},onSuccess:({virtualMcpId:o,repo:T,connectionId:w,item:v})=>{if(r.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",o),{item:v}),ve(r,n.id),b(o,T),l){l({virtualMcpId:o,repo:T,connectionId:w});return}oe.success(`Imported ${T.name} from GitHub`),i(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(o)},onError:o=>{oe.error("Failed to import repo: "+(o instanceof Error?o.message:"Unknown error"))}});return p.status==="installing"||p.status==="authenticating"?t.jsx(we,{status:p.status,error:null,retry:p.retry}):p.status==="error"?t.jsx(we,{status:"error",error:p.error,retry:p.retry}):f.length===0&&p.status==="idle"?t.jsx(we,{status:"installing",error:null,retry:p.retry}):f.length>1&&!m?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),f.map(o=>t.jsxs("button",{type:"button",onClick:()=>_(o),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?t.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}):m?e?t.jsx(Tt,{connectionId:m.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:o=>y.mutate(o),isSaving:y.isPending,autoRespondToIssues:c,onAutoRespondChange:h,hideAutoRespondCheckbox:a}):t.jsx(Ct,{connectionId:m.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:f.length>1,onBack:()=>_(null)}):null}function Ct(i){const e=k.c(31),{connectionId:s,orgId:a,orgSlug:l,onSelect:n,showBackButton:r,onBack:u}=i;let d;e[0]!==a||e[1]!==l?(d={connectionId:ce,orgId:a,orgSlug:l},e[0]=a,e[1]=l,e[2]=d):d=e[2];const _=V(d);let c;e[3]!==s||e[4]!==a?(c=ne.githubUserOrgs(a,s),e[3]=s,e[4]=a,e[5]=c):c=e[5];let h;e[6]!==s||e[7]!==_?(h=async()=>{const T=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!T)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(T)},e[6]=s,e[7]=_,e[8]=h):h=e[8];let C;e[9]!==c||e[10]!==h?(C={queryKey:c,queryFn:h},e[9]=c,e[10]=h,e[11]=C):C=e[11];const f=He(C);if(f.isLoading){let o;return e[12]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=o):o=e[12],o}if(f.isError){let o;return e[13]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=o):o=e[13],o}const p=f.data;if(!p)return null;let m;e[14]!==u||e[15]!==r?(m=r&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ee,{size:12}),"Change connection"]})}),e[14]=u,e[15]=r,e[16]=m):m=e[16];let g;if(e[17]!==p.installations||e[18]!==n){let o;e[20]!==n?(o=T=>t.jsxs("button",{type:"button",onClick:()=>n(T),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:T.avatarUrl,alt:T.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:T.login}),T.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},T.installationId),e[20]=n,e[21]=o):o=e[21],g=p.installations.map(o),e[17]=p.installations,e[18]=n,e[19]=g}else g=e[19];let x;e[22]!==g?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:g}),e[22]=g,e[23]=x):x=e[23];const I=p.appSlug?`https://github.com/apps/${p.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==I?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=I,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==m||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,x,N]}),e[27]=N,e[28]=m,e[29]=x,e[30]=y):y=e[30],y}function Tt(i){const e=k.c(25),{connectionId:s,orgId:a,orgSlug:l,installation:n,onSelectRepo:r,isSaving:u,autoRespondToIssues:d,onAutoRespondChange:_,hideAutoRespondCheckbox:c}=i,[h,C]=O.useState(""),f=O.useDeferredValue(h),p=h!==f;let m;e[0]!==p||e[1]!==h?(m=t.jsx(Qe,{placeholder:"Search repositories...",value:h,onChange:C,isSearching:p}),e[0]=p,e[1]=h,e[2]=m):m=e[2];const g=p?"opacity-40":"opacity-100";let x;e[3]!==g?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",g),e[3]=g,e[4]=x):x=e[4];let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=I):I=e[5];let b;e[6]!==s||e[7]!==f||e[8]!==n||e[9]!==u||e[10]!==r||e[11]!==a||e[12]!==l?(b=t.jsx(O.Suspense,{fallback:I,children:t.jsx(It,{connectionId:s,orgId:a,orgSlug:l,installation:n,query:f,onSelectRepo:r,isSaving:u})}),e[6]=s,e[7]=f,e[8]=n,e[9]=u,e[10]=r,e[11]=a,e[12]=l,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==d||e[18]!==c||e[19]!==_?(y=!c&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(it,{checked:d,onCheckedChange:T=>_(T===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=d,e[18]=c,e[19]=_,e[20]=y):y=e[20];let o;return e[21]!==m||e[22]!==N||e[23]!==y?(o=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,N,y]}),e[21]=m,e[22]=N,e[23]=y,e[24]=o):o=e[24],o}function It(i){const e=k.c(29),{connectionId:s,orgId:a,orgSlug:l,installation:n,query:r,onSelectRepo:u,isSaving:d}=i;let _;e[0]!==s||e[1]!==a||e[2]!==l?(_={connectionId:s,orgId:a,orgSlug:l},e[0]=s,e[1]=a,e[2]=l,e[3]=_):_=e[3];const c=V(_),h=n.type==="User"?"user":"org",C=r?`${h}:${n.login} ${r} in:name`:`${h}:${n.login}`;let f;e[4]!==s||e[5]!==n.login||e[6]!==a||e[7]!==r?(f=ne.githubOrgRepos(a,s,n.login,r),e[4]=s,e[5]=n.login,e[6]=a,e[7]=r,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==C?(p=async()=>{const N=(await c.callTool({name:"search_repositories",arguments:{query:C,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(yt)},e[9]=c,e[10]=C,e[11]=p):p=e[11];let m;e[12]!==f||e[13]!==p?(m={queryKey:f,queryFn:p},e[12]=f,e[13]=p,e[14]=m):m=e[14];const{data:g}=tt(m);if(g.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==r?(N=r&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=r,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==d||e[21]!==u||e[22]!==g){let b;e[24]!==d||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:d,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(at,{size:10}):t.jsx(rt,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=d,e[25]=u,e[26]=b):b=e[26],x=g.map(b),e[20]=d,e[21]=u,e[22]=g,e[23]=x}else x=e[23];let I;return e[27]!==x?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=I):I=e[28],I}function yt(i){return{name:i.name,fullName:i.full_name,owner:i.full_name.split("/")[0]??"",url:i.html_url,private:i.private,description:i.description,updatedAt:i.updated_at}}function we(i){const e=k.c(33),{status:s,error:a,retry:l}=i;if(s==="error"){let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=o):o=e[0];let T;e[1]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=T):T=e[1];const w=a??"Something went wrong while connecting to GitHub.";let v;e[2]!==w?(v=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[T,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:w})]}),e[2]=w,e[3]=v):v=e[3];let A;e[4]!==l?(A=t.jsx("button",{type:"button",onClick:l,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=l,e[5]=A):A=e[5];let E;return e[6]!==v||e[7]!==A?(E=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[o,v,A]}),e[6]=v,e[7]=A,e[8]=E):E=e[8],E}const n=s==="authenticating";let r;e[9]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=r):r=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[r,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const d=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==d?(_=t.jsx("p",{className:"text-sm font-medium",children:d}),e[11]=d,e[12]=_):_=e[12];const c=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let h;e[13]!==c?(h=t.jsx("p",{className:"text-xs text-muted-foreground",children:c}),e[13]=c,e[14]=h):h=e[14];let C;e[15]!==_||e[16]!==h?(C=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,h]}),e[15]=_,e[16]=h,e[17]=C):C=e[17];const f=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let p;e[18]!==f?(p=xe("size-1.5 rounded-full",f),e[18]=f,e[19]=p):p=e[19];let m;e[20]!==p?(m=t.jsx("span",{className:p}),e[20]=p,e[21]=m):m=e[21];const g=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==g?(x=xe("size-1.5 rounded-full",g),e[22]=g,e[23]=x):x=e[23];let I;e[24]!==x?(I=t.jsx("span",{className:x}),e[24]=x,e[25]=I):I=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==m||e[28]!==I?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[m,I,b]}),e[27]=m,e[28]=I,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==C?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,C,N]}),e[30]=N,e[31]=C,e[32]=y):y=e[32],y}const bt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function Ve(i){const e=k.c(7),{onRecruit:s,isRecruiting:a,isLoading:l}=i;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=r):r=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[r,t.jsx("ul",{className:"space-y-1.5",children:bt.map(wt)})]}),e[2]=u):u=e[2];const d=a||l,_=a?"Setting up...":"Add Site Diagnostics";let c;return e[3]!==s||e[4]!==d||e[5]!==_?(c=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:d,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=d,e[5]=_,e[6]=c):c=e[6],c}function wt(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function en({open:i,onOpenChange:e,existingAgent:s}){const a=ke(),{org:l}=$(),n=_e(),r=Se(),u=Pe(),d=V({connectionId:ce,orgId:l.id,orgSlug:l.slug}),_=Ke({client:d}),[c,h]=O.useState(!1),C=qe.find(y=>y.id==="site-diagnostics"),{data:f,isLoading:p}=Ye(C.appId,{enabled:i}),m=f?.title||f?.server?.title||f?.server?.name||C.title,g=f?.server?.icons?.[0]?.src??C.icon,x=f?.server?.description??null,I=t.jsx(Ue,{icon:g,name:m,size:"sm"}),b=async()=>{if(f){if(s){e(!1),n(s.id);return}h(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:C.appId},limit:1,offset:0}});let o;const w=y?.structuredContent?.items?.find(A=>A.app_id===C.appId);if(w)o=w.id;else{const A=f.server?.remotes?.[0]?.url;if(!A)throw new Error("Registry item is missing a remote URL for site-diagnostics");o=(await r.create.mutateAsync({title:m,description:x,icon:f.server?.icons?.[0]?.src??C.icon,connection_type:"HTTP",connection_url:A,app_name:f.server?.name??"site-diagnostics",app_id:C.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:C.appId,verified:!0}})).id}const v=await u.create.mutateAsync({title:m,description:x,icon:g,status:"active",connections:[{connection_id:o,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:o,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:o,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:v.id}),e(!1),n(v.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{h(!1)}}},N=`Add ${m}`;return a?t.jsx(Oe,{open:i,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[I,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(Ve,{onRecruit:b,isRecruiting:c,isLoading:p})})]})}):t.jsx(de,{open:i,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[I,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx(Ve,{onRecruit:b,isRecruiting:c,isLoading:p})]})})}const vt=`<role>
|
|
1
|
+
import{e as k,j as t,s as $,o as je,b as Fe,r as O,K as ne,n as He,a as Be,c as xe,B as ae,t as D,x as oe,G as Xe,F as Ze,v as ve,P as et,l as Ne,w as tt,f as nt}from"./index-CtJ1_vQP.js";import{S as ce,u as V,d as Ae,W as qe,a as be}from"./constants-CyYXtNQt.js";import{a as _e}from"./use-navigate-to-agent-D91A1ehg.js";import{a as le,b as de,c as ue,d as me,D as st}from"./dialog-BapANLA4.js";import{i as Ee}from"./RefreshCcw01-DdNBG9uq.js";import{C as Qe}from"./collection-search-mbr97YEK.js";import{C as it}from"./checkbox-BtvQbCay.js";import{b as Se,u as ot}from"./use-connection-M1xDmD9i.js";import{i as at}from"./Lock01-B6CuPSqy.js";import{n as rt}from"./agent-icon-BWW-_spm.js";import{e as ct}from"./extract-connection-data-BAmE4x-0.js";import{b as Oe,a as Le,c as Re,D as Me}from"./drawer-DXfcxG35.js";import{u as ke}from"./tooltip-BTEnXfpw.js";import{I as Ue}from"./integration-icon-DZ1DDayM.js";import{u as lt,d as Ke}from"./use-mcp-tools-CtUqFvLD.js";import{a as Pe,b as dt}from"./use-virtual-mcp-CX5iadV3.js";function re(i){const e=k.c(4),{size:s,className:a}=i;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=l):l=e[0];let n;return e[1]!==a||e[2]!==s?(n=t.jsx("svg",{width:s,height:s,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:a,children:l}),e[1]=a,e[2]=s,e[3]=n):n=e[3],n}function ut(i){return i.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function mt(i){const e=await fetch(`/api/${i}/deco-sites`);if(!e.ok){const s=await e.json().catch(()=>({}));throw new Error(s.error??`Failed to load sites (${e.status})`)}return e.json()}function Xt(i){const e=k.c(70),{open:s,onOpenChange:a,onBack:l}=i,{org:n}=$(),r=_e(),u=je(),{data:d}=Fe.useSession(),[_,c]=O.useState(null),[h,C]=O.useState("");let f;e[0]!==n.id||e[1]!==n.slug?(f={connectionId:ce,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=f):f=e[2];const p=V(f);let m;e[3]!==d?.user?.email?(m=ne.decoSites(d?.user?.email),e[3]=d?.user?.email,e[4]=m):m=e[4];let g;e[5]!==n.slug?(g=()=>mt(n.slug),e[5]=n.slug,e[6]=g):g=e[6];const x=s&&!!d?.user?.email;let I;e[7]!==m||e[8]!==g||e[9]!==x?(I={queryKey:m,queryFn:g,enabled:x,staleTime:6e4,retry:!1},e[7]=m,e[8]=g,e[9]=x,e[10]=I):I=e[10];const{data:b,isLoading:N,error:y}=He(I),o=b?.sites??[];let T;e[11]!==a?(T=j=>{j||(c(null),C("")),a(j)},e[11]=a,e[12]=T):T=e[12];const w=T;let v;e[13]!==h?(v=j=>j.name.toLowerCase().includes(h.toLowerCase())||j.domains?.[0]?.domain.toLowerCase().includes(h.toLowerCase()),e[13]=h,e[14]=v):v=e[14];const A=o.filter(v),E=!_||A.some(j=>j.name===_);let S;e[15]!==p||e[16]!==n.id||e[17]!==n.slug?(S=async j=>{D("deco_site_import_started",{site_name:j});const P=await fetch(`/api/${n.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:j,orgId:n.id})}),G=await P.json().catch(pt);if(!P.ok)throw new Error(G.error??`Failed to create connection (${P.status})`);const M=G.connId;if(!M)throw new Error("Server did not return a connection ID");const he=G.icon??null,te=ut(j),Ge=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:j,description:"Imported from deco.cx",pinned:!0,icon:he??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:he,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:M,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:M,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:M,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:M,toolName:"file_explorer"}}}},connections:[{connection_id:M}]}}}),De=Ge.structuredContent??Ge;return{slug:te,virtualMcpId:De.item.id,connId:M,item:De.item}},e[15]=p,e[16]=n.id,e[17]=n.slug,e[18]=S):S=e[18];let R;e[19]!==p||e[20]!==w||e[21]!==r||e[22]!==n.id||e[23]!==u?(R=j=>{const{slug:P,virtualMcpId:G,item:M}=j;D("deco_site_import_succeeded",{site_name:M.title,virtual_mcp_id:G,slug:P}),u.setQueryData(ne.collectionItem(p,n.id,"","VIRTUAL_MCP",G),{item:M}),u.invalidateQueries({predicate:he=>{const te=he.queryKey;return te[1]===n.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),u.invalidateQueries({queryKey:ne.projects(n.id)}),oe.success(`Imported ${P} from deco.cx`),w(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),r(G)},e[19]=p,e[20]=w,e[21]=r,e[22]=n.id,e[23]=u,e[24]=R):R=e[24];let z;e[25]!==S||e[26]!==R?(z={mutationFn:S,onSuccess:R,onError:gt},e[25]=S,e[26]=R,e[27]=z):z=e[27];const U=Be(z),se=de,L=le,ie="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let F;e[28]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:"Import from deco.cx"})}),e[28]=F):F=e[28];let H;e[29]!==l?(H=l&&t.jsx("button",{type:"button",onClick:l,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ee,{size:18})}),e[29]=l,e[30]=H):H=e[30];let fe;e[31]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[31]=fe):fe=e[31];let B;e[32]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,fe]}),e[32]=H,e[33]=B):B=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=j=>{j.key==="Escape"&&C("")},e[34]=ge):ge=e[34];let q;e[35]!==h?(q=t.jsx("div",{children:t.jsx(Qe,{value:h,onChange:C,placeholder:"Search sites...",onKeyDown:ge})}),e[35]=h,e[36]=q):q=e[36];const Je="pb-0 min-h-[300px]";let Q;e[37]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[37]=N,e[38]=Q):Q=e[38];const Ce=!N&&!y&&o.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Te=!N&&o.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[A.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",h,"”"]}),A.map(j=>{const P=j.domains?.find(ft)?.domain??j.domains?.[0]?.domain,G=_===j.name;return t.jsxs("button",{type:"button",onClick:()=>c(j.name),className:xe("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",G?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:j.thumb_url?t.jsx("img",{src:j.thumb_url,alt:j.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:j.name}),P&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:P})]})]},j.name)})]});let K;e[39]!==Q||e[40]!==Ce||e[41]!==Te?(K=t.jsxs("div",{className:Je,children:[Q,Ce,Te]}),e[39]=Q,e[40]=Ce,e[41]=Te,e[42]=K):K=e[42];let Y;e[43]!==w?(Y=()=>w(!1),e[43]=w,e[44]=Y):Y=e[44];let W;e[45]!==U.isPending||e[46]!==Y?(W=t.jsx(ae,{variant:"outline",onClick:Y,disabled:U.isPending,children:"Cancel"}),e[45]=U.isPending,e[46]=Y,e[47]=W):W=e[47];const Ie=!_||!E||U.isPending||N;let J;e[48]!==U||e[49]!==_?(J=()=>_&&U.mutate(_),e[48]=U,e[49]=_,e[50]=J):J=e[50];const ye=U.isPending?"Importing...":"Import";let X;e[51]!==Ie||e[52]!==J||e[53]!==ye?(X=t.jsx(ae,{disabled:Ie,onClick:J,children:ye}),e[51]=Ie,e[52]=J,e[53]=ye,e[54]=X):X=e[54];let Z;e[55]!==W||e[56]!==X?(Z=t.jsxs(st,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[55]=W,e[56]=X,e[57]=Z):Z=e[57];let ee;e[58]!==L||e[59]!==F||e[60]!==B||e[61]!==q||e[62]!==K||e[63]!==Z?(ee=t.jsxs(L,{className:ie,children:[F,B,q,K,Z]}),e[58]=L,e[59]=F,e[60]=B,e[61]=q,e[62]=K,e[63]=Z,e[64]=ee):ee=e[64];let pe;return e[65]!==se||e[66]!==w||e[67]!==s||e[68]!==ee?(pe=t.jsx(se,{open:s,onOpenChange:w,children:ee}),e[65]=se,e[66]=w,e[67]=s,e[68]=ee,e[69]=pe):pe=e[69],pe}function ft(i){return i.production}function gt(i){D("deco_site_import_failed",{error:i instanceof Error?i.message:"Unknown error"}),oe.error("Import failed: "+(i instanceof Error?i.message:"Unknown error"))}function pt(){return{}}function Ye(i,e){const s=k.c(12),{org:a}=$();let l;s[0]!==a.id?(l=Ae.REGISTRY(a.id),s[0]=a.id,s[1]=l):l=s[1];const n=l;let r;s[2]!==a.id||s[3]!==a.slug||s[4]!==n?(r={connectionId:n,orgId:a.id,orgSlug:a.slug},s[2]=a.id,s[3]=a.slug,s[4]=n,s[5]=r):r=s[5];const u=V(r);let d;s[6]!==i?(d={name:i},s[6]=i,s[7]=d):d=s[7];const _=e?.enabled??!0;let c;return s[8]!==u||s[9]!==d||s[10]!==_?(c={client:u,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:d,enabled:_,staleTime:3e5,select:ht},s[8]=u,s[9]=d,s[10]=_,s[11]=c):c=s[11],lt(c)}function ht(i){return i.structuredContent?.item??null}const xt="deco/mcp-github";function Nt(i){const{org:e}=$(),{data:s}=Fe.useSession(),a=Se(),l=je(),[n,r]=O.useState("idle"),[u,d]=O.useState(null),[_,c]=O.useState(null),{data:h,isLoading:C}=Ye(xt,{enabled:i.enabled}),f=O.useRef(!1);i.enabled&&h&&!C&&!f.current&&s?.user?.id&&n==="idle"&&(f.current=!0,p());async function p(){if(!(!h||!s?.user?.id||!e))try{r("installing"),d(null);const g=ct(h,e.id,s.user.id,{remoteIndex:0});if(!g.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:I}=await a.create.mutateAsync(g);r("authenticating");const b=new URL(`/api/${e.slug}/mcp/${I}`,window.location.origin),N=await Xe({url:b.href,token:null,orgId:e.id});if(N.supportsOAuth&&!N.isAuthenticated){const{token:y,tokenInfo:o,error:T}=await Ze({connectionId:I,orgSlug:e.slug,scope:"offline_access"});if(T||!y){try{await a.delete.mutateAsync(I)}catch{}throw new Error(T??"No token received from GitHub")}if(o)try{(await fetch(`/api/${e.slug}/connections/${I}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:o.accessToken,refreshToken:o.refreshToken,expiresIn:o.expiresIn,scope:o.scope,clientId:o.clientId,clientSecret:o.clientSecret,tokenEndpoint:o.tokenEndpoint})})).ok||await a.update.mutateAsync({id:I,data:{connection_token:y}})}catch{await a.update.mutateAsync({id:I,data:{connection_token:y}})}}ve(l,e.id),c(g),r("ready")}catch(g){d(g instanceof Error?g.message:String(g)),r("error")}}function m(){r("idle"),d(null),c(null),f.current=!1}return i.enabled&&C&&n==="idle"?{status:"installing",error:null,connection:null,retry:m}:{status:n,error:u,connection:_,retry:m}}function Zt(i){const e=k.c(21),{open:s,onOpenChange:a,title:l,hideAutoRespondCheckbox:n,onImportComplete:r}=i,u=l===void 0?"Import from GitHub":l,d=n===void 0?!1:n,[_]=et(),[c,h]=O.useState(null);if(!_.experimental_vibecode)return null;let C;e[0]!==u?(C=t.jsx(ue,{className:"sr-only",children:t.jsx(me,{children:u})}),e[0]=u,e[1]=C):C=e[1];let f;e[2]!==c||e[3]!==u?(f=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:c?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Ee,{size:16})}),t.jsx("img",{src:c.avatarUrl,alt:c.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:c.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(re,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:u})]})}),e[2]=c,e[3]=u,e[4]=f):f=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=p):p=e[5];let m;e[6]!==a?(m=()=>a(!1),e[6]=a,e[7]=m):m=e[7];let g;e[8]!==d||e[9]!==r||e[10]!==c||e[11]!==m?(g=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(O.Suspense,{fallback:p,children:t.jsx(_t,{onComplete:m,selectedInstallation:c,onSelectInstallation:h,hideAutoRespondCheckbox:d,onImportComplete:r})})}),e[8]=d,e[9]=r,e[10]=c,e[11]=m,e[12]=g):g=e[12];let x;e[13]!==C||e[14]!==f||e[15]!==g?(x=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[C,f,g]}),e[13]=C,e[14]=f,e[15]=g,e[16]=x):x=e[16];let I;return e[17]!==a||e[18]!==s||e[19]!==x?(I=t.jsx(de,{open:s,onOpenChange:a,children:x}),e[17]=a,e[18]=s,e[19]=x,e[20]=I):I=e[20],I}function _t({onComplete:i,selectedInstallation:e,onSelectInstallation:s,hideAutoRespondCheckbox:a,onImportComplete:l}){const{org:n}=$(),r=je(),u=_e(),[d,_]=O.useState(null),[c,h]=O.useState(!0),C=a?!0:c,f=ot({slug:"mcp-github"}),p=Nt({enabled:f.length===0}),m=f.length===1?f[0]??null:d,g=V({connectionId:m?.id??"",orgId:n.id,orgSlug:n.slug}),x=V({connectionId:ce,orgId:n.id,orgSlug:n.slug}),I=async(o,T)=>{try{const v=await g.callTool({name:"get_file_contents",arguments:{owner:o.owner,repo:o.name,path:T}});if(v.isError)return null;const E=v.content?.find(S=>S.type==="resource")?.resource?.text;if(!E)return null;try{const S=JSON.parse(E);return typeof S=="string"?S:JSON.stringify(S)}catch{return E}}catch{return null}},b=(o,T)=>{Promise.all([I(T,"AGENTS.md"),I(T,"CLAUDE.md")]).then(async([w,v])=>{const A=w??v??null;A&&(await x.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:o,data:{metadata:{instructions:A}}}}),ve(r,n.id))}).catch(w=>{console.error("GitHub instructions fetch failed:",w)})},N=async({virtualMcpId:o,repo:T,connectionId:w})=>{const v=await g.callTool({name:"TRIGGER_LIST",arguments:{}}),A=v.structuredContent??v,E=A.triggers?.find(L=>L.type==="github.issues.opened")??A.triggers?.find(L=>{const ie=L.type.toLowerCase();return/\bissues?\./.test(ie)&&(ie.endsWith(".opened")||ie.endsWith(".created"))});if(!E)throw new Error("No issue-created trigger exposed by GitHub connection");const S=new Set;if(Array.isArray(E.params))for(const L of E.params)S.add(L.name);else if(E.params&&typeof E.params=="object")for(const L of Object.keys(E.params))S.add(L);if(E.paramsSchema)for(const L of Object.keys(E.paramsSchema))S.add(L);const R={};S.has("repo")?R.repo=`${T.owner}/${T.name}`:(S.has("owner")&&(R.owner=T.owner),S.has("name")&&(R.name=T.name),S.has("repository")&&(R.repository=`${T.owner}/${T.name}`));const z=`A new GitHub issue has been opened in ${T.owner}/${T.name}. Read the issue details, explore the relevant code in the repository, create a new branch, implement the fix or feature requested, and open a pull request that resolves the issue. Reference the issue number in the PR description.`,U=await x.callTool({name:"AUTOMATION_CREATE",arguments:{name:`${T.name}: auto-respond to issues`,virtual_mcp_id:o,messages:z,active:!0}}),se=U.structuredContent??U;await x.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:se.id,type:"event",connection_id:w,event_type:E.type,params:R}})},y=Be({mutationFn:async o=>{if(!m||!e)throw new Error("No GitHub connection or installation");const T=m.id,w=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:o.name,description:o.description||"Imported from GitHub",pinned:!0,icon:null,metadata:{githubRepo:{owner:o.owner,name:o.name,url:o.url,installationId:e.installationId,connectionId:T},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"}}}},connections:[{connection_id:T}]}}}),v=w.structuredContent??w,A=v.item.id;return C&&await N({virtualMcpId:A,repo:o,connectionId:T}).catch(E=>{console.error("Failed to set up issue automation:",E),oe.warning("Imported repo, but failed to set up issue auto-response. You can add the trigger manually from the automations view.")}),{virtualMcpId:A,repo:o,connectionId:T,item:v.item}},onSuccess:({virtualMcpId:o,repo:T,connectionId:w,item:v})=>{if(r.setQueryData(ne.collectionItem(x,n.id,"","VIRTUAL_MCP",o),{item:v}),ve(r,n.id),b(o,T),l){l({virtualMcpId:o,repo:T,connectionId:w});return}oe.success(`Imported ${T.name} from GitHub`),i(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),u(o)},onError:o=>{oe.error("Failed to import repo: "+(o instanceof Error?o.message:"Unknown error"))}});return p.status==="installing"||p.status==="authenticating"?t.jsx(we,{status:p.status,error:null,retry:p.retry}):p.status==="error"?t.jsx(we,{status:"error",error:p.error,retry:p.retry}):f.length===0&&p.status==="idle"?t.jsx(we,{status:"installing",error:null,retry:p.retry}):f.length>1&&!m?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),f.map(o=>t.jsxs("button",{type:"button",onClick:()=>_(o),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[o.icon?t.jsx("img",{src:o.icon,alt:o.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(re,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:o.title})]},o.id))]}):m?e?t.jsx(Tt,{connectionId:m.id,orgId:n.id,orgSlug:n.slug,installation:e,onSelectRepo:o=>y.mutate(o),isSaving:y.isPending,autoRespondToIssues:c,onAutoRespondChange:h,hideAutoRespondCheckbox:a}):t.jsx(Ct,{connectionId:m.id,orgId:n.id,orgSlug:n.slug,onSelect:s,showBackButton:f.length>1,onBack:()=>_(null)}):null}function Ct(i){const e=k.c(31),{connectionId:s,orgId:a,orgSlug:l,onSelect:n,showBackButton:r,onBack:u}=i;let d;e[0]!==a||e[1]!==l?(d={connectionId:ce,orgId:a,orgSlug:l},e[0]=a,e[1]=l,e[2]=d):d=e[2];const _=V(d);let c;e[3]!==s||e[4]!==a?(c=ne.githubUserOrgs(a,s),e[3]=s,e[4]=a,e[5]=c):c=e[5];let h;e[6]!==s||e[7]!==_?(h=async()=>{const T=(await _.callTool({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:s}})).content?.[0]?.text;if(!T)throw new Error("No response from GITHUB_LIST_USER_ORGS");return JSON.parse(T)},e[6]=s,e[7]=_,e[8]=h):h=e[8];let C;e[9]!==c||e[10]!==h?(C={queryKey:c,queryFn:h},e[9]=c,e[10]=h,e[11]=C):C=e[11];const f=He(C);if(f.isLoading){let o;return e[12]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=o):o=e[12],o}if(f.isError){let o;return e[13]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=o):o=e[13],o}const p=f.data;if(!p)return null;let m;e[14]!==u||e[15]!==r?(m=r&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ee,{size:12}),"Change connection"]})}),e[14]=u,e[15]=r,e[16]=m):m=e[16];let g;if(e[17]!==p.installations||e[18]!==n){let o;e[20]!==n?(o=T=>t.jsxs("button",{type:"button",onClick:()=>n(T),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:T.avatarUrl,alt:T.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:T.login}),T.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},T.installationId),e[20]=n,e[21]=o):o=e[21],g=p.installations.map(o),e[17]=p.installations,e[18]=n,e[19]=g}else g=e[19];let x;e[22]!==g?(x=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:g}),e[22]=g,e[23]=x):x=e[23];const I=p.appSlug?`https://github.com/apps/${p.appSlug}/installations/new`:"https://github.com/settings/installations";let b;e[24]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=b):b=e[24];let N;e[25]!==I?(N=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",b]})}),e[25]=I,e[26]=N):N=e[26];let y;return e[27]!==N||e[28]!==m||e[29]!==x?(y=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,x,N]}),e[27]=N,e[28]=m,e[29]=x,e[30]=y):y=e[30],y}function Tt(i){const e=k.c(25),{connectionId:s,orgId:a,orgSlug:l,installation:n,onSelectRepo:r,isSaving:u,autoRespondToIssues:d,onAutoRespondChange:_,hideAutoRespondCheckbox:c}=i,[h,C]=O.useState(""),f=O.useDeferredValue(h),p=h!==f;let m;e[0]!==p||e[1]!==h?(m=t.jsx(Qe,{placeholder:"Search repositories...",value:h,onChange:C,isSearching:p}),e[0]=p,e[1]=h,e[2]=m):m=e[2];const g=p?"opacity-40":"opacity-100";let x;e[3]!==g?(x=xe("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",g),e[3]=g,e[4]=x):x=e[4];let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=I):I=e[5];let b;e[6]!==s||e[7]!==f||e[8]!==n||e[9]!==u||e[10]!==r||e[11]!==a||e[12]!==l?(b=t.jsx(O.Suspense,{fallback:I,children:t.jsx(It,{connectionId:s,orgId:a,orgSlug:l,installation:n,query:f,onSelectRepo:r,isSaving:u})}),e[6]=s,e[7]=f,e[8]=n,e[9]=u,e[10]=r,e[11]=a,e[12]=l,e[13]=b):b=e[13];let N;e[14]!==x||e[15]!==b?(N=t.jsx("div",{className:x,children:b}),e[14]=x,e[15]=b,e[16]=N):N=e[16];let y;e[17]!==d||e[18]!==c||e[19]!==_?(y=!c&&t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0 cursor-pointer select-none",children:[t.jsx(it,{checked:d,onCheckedChange:T=>_(T===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Auto-respond to new issues with a PR"})]}),e[17]=d,e[18]=c,e[19]=_,e[20]=y):y=e[20];let o;return e[21]!==m||e[22]!==N||e[23]!==y?(o=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m,N,y]}),e[21]=m,e[22]=N,e[23]=y,e[24]=o):o=e[24],o}function It(i){const e=k.c(29),{connectionId:s,orgId:a,orgSlug:l,installation:n,query:r,onSelectRepo:u,isSaving:d}=i;let _;e[0]!==s||e[1]!==a||e[2]!==l?(_={connectionId:s,orgId:a,orgSlug:l},e[0]=s,e[1]=a,e[2]=l,e[3]=_):_=e[3];const c=V(_),h=n.type==="User"?"user":"org",C=r?`${h}:${n.login} ${r} in:name`:`${h}:${n.login}`;let f;e[4]!==s||e[5]!==n.login||e[6]!==a||e[7]!==r?(f=ne.githubOrgRepos(a,s,n.login,r),e[4]=s,e[5]=n.login,e[6]=a,e[7]=r,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==C?(p=async()=>{const N=(await c.callTool({name:"search_repositories",arguments:{query:C,page:1,perPage:30}})).content?.[0]?.text;if(!N)throw new Error("No response from search_repositories");return(JSON.parse(N).items??[]).map(yt)},e[9]=c,e[10]=C,e[11]=p):p=e[11];let m;e[12]!==f||e[13]!==p?(m={queryKey:f,queryFn:p},e[12]=f,e[13]=p,e[14]=m):m=e[14];const{data:g}=tt(m);if(g.length===0){let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=b):b=e[15];let N;e[16]!==r?(N=r&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=r,e[17]=N):N=e[17];let y;return e[18]!==N?(y=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[b,N]}),e[18]=N,e[19]=y):y=e[19],y}let x;if(e[20]!==d||e[21]!==u||e[22]!==g){let b;e[24]!==d||e[25]!==u?(b=N=>t.jsxs("button",{type:"button",onClick:()=>u(N),disabled:d,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(re,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:N.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[N.private?t.jsx(at,{size:10}):t.jsx(rt,{size:10}),N.private?"Private":"Public"]})]},N.fullName),e[24]=d,e[25]=u,e[26]=b):b=e[26],x=g.map(b),e[20]=d,e[21]=u,e[22]=g,e[23]=x}else x=e[23];let I;return e[27]!==x?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:x}),e[27]=x,e[28]=I):I=e[28],I}function yt(i){return{name:i.name,fullName:i.full_name,owner:i.full_name.split("/")[0]??"",url:i.html_url,private:i.private,description:i.description,updatedAt:i.updated_at}}function we(i){const e=k.c(33),{status:s,error:a,retry:l}=i;if(s==="error"){let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-destructive"})}),e[0]=o):o=e[0];let T;e[1]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=T):T=e[1];const w=a??"Something went wrong while connecting to GitHub.";let v;e[2]!==w?(v=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[T,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:w})]}),e[2]=w,e[3]=v):v=e[3];let A;e[4]!==l?(A=t.jsx("button",{type:"button",onClick:l,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=l,e[5]=A):A=e[5];let E;return e[6]!==v||e[7]!==A?(E=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[o,v,A]}),e[6]=v,e[7]=A,e[8]=E):E=e[8],E}const n=s==="authenticating";let r;e[9]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(re,{className:"size-5 text-foreground"})}),e[9]=r):r=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"relative size-10",children:[r,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=u):u=e[10];const d=n?"Authenticating with GitHub":"Setting up GitHub";let _;e[11]!==d?(_=t.jsx("p",{className:"text-sm font-medium",children:d}),e[11]=d,e[12]=_):_=e[12];const c=n?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let h;e[13]!==c?(h=t.jsx("p",{className:"text-xs text-muted-foreground",children:c}),e[13]=c,e[14]=h):h=e[14];let C;e[15]!==_||e[16]!==h?(C=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[_,h]}),e[15]=_,e[16]=h,e[17]=C):C=e[17];const f=n?"bg-muted-foreground/30":"bg-foreground animate-pulse";let p;e[18]!==f?(p=xe("size-1.5 rounded-full",f),e[18]=f,e[19]=p):p=e[19];let m;e[20]!==p?(m=t.jsx("span",{className:p}),e[20]=p,e[21]=m):m=e[21];const g=n?"bg-foreground animate-pulse":"bg-muted-foreground/30";let x;e[22]!==g?(x=xe("size-1.5 rounded-full",g),e[22]=g,e[23]=x):x=e[23];let I;e[24]!==x?(I=t.jsx("span",{className:x}),e[24]=x,e[25]=I):I=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=b):b=e[26];let N;e[27]!==m||e[28]!==I?(N=t.jsxs("div",{className:"flex items-center gap-1.5",children:[m,I,b]}),e[27]=m,e[28]=I,e[29]=N):N=e[29];let y;return e[30]!==N||e[31]!==C?(y=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[u,C,N]}),e[30]=N,e[31]=C,e[32]=y):y=e[32],y}const bt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function Ve(i){const e=k.c(7),{onRecruit:s,isRecruiting:a,isLoading:l}=i;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=n):n=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=r):r=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"space-y-2",children:[r,t.jsx("ul",{className:"space-y-1.5",children:bt.map(wt)})]}),e[2]=u):u=e[2];const d=a||l,_=a?"Setting up...":"Add Site Diagnostics";let c;return e[3]!==s||e[4]!==d||e[5]!==_?(c=t.jsxs("div",{className:"flex flex-col gap-6",children:[n,u,t.jsx(ae,{onClick:s,disabled:d,className:"w-full cursor-pointer",children:_})]}),e[3]=s,e[4]=d,e[5]=_,e[6]=c):c=e[6],c}function wt(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function en({open:i,onOpenChange:e,existingAgent:s}){const a=ke(),{org:l}=$(),n=_e(),r=Se(),u=Pe(),d=V({connectionId:ce,orgId:l.id,orgSlug:l.slug}),_=Ke({client:d}),[c,h]=O.useState(!1),C=qe.find(y=>y.id==="site-diagnostics"),{data:f,isLoading:p}=Ye(C.appId,{enabled:i}),m=f?.title||f?.server?.title||f?.server?.name||C.title,g=f?.server?.icons?.[0]?.src??C.icon,x=f?.server?.description??null,I=t.jsx(Ue,{icon:g,name:m,size:"sm"}),b=async()=>{if(f){if(s){e(!1),n(s.id);return}h(!0);try{const y=await _.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:C.appId},limit:1,offset:0}});let o;const w=y?.structuredContent?.items?.find(A=>A.app_id===C.appId);if(w)o=w.id;else{const A=f.server?.remotes?.[0]?.url;if(!A)throw new Error("Registry item is missing a remote URL for site-diagnostics");o=(await r.create.mutateAsync({title:m,description:x,icon:f.server?.icons?.[0]?.src??C.icon,connection_type:"HTTP",connection_url:A,app_name:f.server?.name??"site-diagnostics",app_id:C.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:C.appId,verified:!0}})).id}const v=await u.create.mutateAsync({title:m,description:x,icon:g,status:"active",connections:[{connection_id:o,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:o,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:o,toolName:"diagnose"}}}}});D("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:v.id}),e(!1),n(v.id)}catch(y){D("agent_recruit_failed",{template_id:"site-diagnostics",error:y instanceof Error?y.message:String(y)}),console.error("Failed to create Site Diagnostics agent:",y)}finally{h(!1)}}},N=`Add ${m}`;return a?t.jsx(Oe,{open:i,onOpenChange:e,children:t.jsxs(Le,{className:"h-[70dvh]",children:[t.jsx(Re,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[I,t.jsx(Me,{className:"text-xl font-semibold",children:N})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(Ve,{onRecruit:b,isRecruiting:c,isLoading:p})})]})}):t.jsx(de,{open:i,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-[500px] p-8",children:[t.jsx(ue,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[I,t.jsx(me,{className:"text-xl font-semibold",children:N})]})}),t.jsx(Ve,{onRecruit:b,isRecruiting:c,isLoading:p})]})})}const vt=`<role>
|
|
2
2
|
You are the Agent Manager. You create, configure, and maintain agents (Virtual MCPs) in this workspace.
|
|
3
3
|
</role>
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-0dtUnOR1.js";import{I}from"./input-Dh3J6cxA.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};
|
|
1
|
+
import{u as X,r as x,a as V,t as P,b as p,j as e,B as f,c as T,d as ae,S as $,N as ie,e as oe}from"./index-CtJ1_vQP.js";import{I}from"./input-DzKH4IoC.js";function le({redirectUrl:s,callbackUrl:r="/"}){const{emailAndPassword:l,resetPassword:u,emailOtp:i,socialProviders:d}=X(),[n,j]=x.useState(""),[y,D]=x.useState(""),[b,C]=x.useState(""),[O,A]=x.useState(""),[L,R]=x.useState(!1),[z,N]=x.useState(()=>!l.enabled&&i.enabled?"emailOtp":globalThis.localStorage?.getItem("hasLoggedIn")!=="true"?"signUp":"signIn"),[c,S]=x.useState(""),[Y,G]=x.useState(!1),m=z==="signUp",h=z==="forgotPassword",w=z==="emailOtp",F=V({mutationFn:async({email:t,password:a,name:q})=>{try{if(m){const g=await p.signUp.email({email:t,password:a,name:q||""});if(g.error)throw new Error(g.error.message||"Sign up failed");return g}else{const g=await p.signIn.email({email:t,password:a});if(g.error)throw new Error(g.error.message||"Sign in failed");return g}}catch(g){throw g instanceof Error?g:new Error("Authentication failed")}},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P(m?"user_signup_failed":"user_signin_failed",{error:t instanceof Error?t.message:String(t)})}}),U=V({mutationFn:async({email:t})=>{const a=await p.requestPasswordReset({email:t,redirectTo:"/reset-password"});if(a.error)throw new Error(a.error.message||"Failed to send reset email");return a},onSuccess:()=>{P("password_reset_requested"),G(!0)},onError:t=>{P("password_reset_request_failed",{error:t instanceof Error?t.message:String(t)})}}),E=V({mutationFn:async({email:t})=>{const a=await p.emailOtp.sendVerificationOtp({email:t,type:"sign-in"});if(a.error)throw new Error(a.error.message||"Failed to send code");return a},onSuccess:()=>{P("email_otp_sent"),R(!0)},onError:t=>{P("email_otp_send_failed",{error:t instanceof Error?t.message:String(t)})}}),_=V({mutationFn:async({email:t,otp:a})=>{const q=await p.signIn.emailOtp({email:t,otp:a});if(q.error)throw new Error(q.error.message||"Invalid code");return q},onSuccess:()=>{globalThis.localStorage?.setItem("hasLoggedIn","true"),window.location.href=s??r},onError:t=>{P("email_otp_verify_failed",{error:t instanceof Error?t.message:String(t)})}}),B=t=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t),W=()=>{n.trim()&&!B(n)&&S("Invalid email address")},Z=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}F.mutate({email:n,password:y,name:b})},ee=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}U.mutate({email:n})},te=t=>{if(t.preventDefault(),!B(n)){S("Invalid email address");return}E.mutate({email:n})},se=t=>{t.preventDefault(),_.mutate({email:n,otp:O})},k=t=>a=>{t(a.target.value),H&&F.reset(),J&&U.reset(),K&&(E.reset(),_.reset()),t===j&&c&&S("")},M=t=>{N(t),C(""),A(""),R(!1),S(""),G(!1),F.reset(),U.reset(),E.reset(),_.reset()},o=F.isPending||U.isPending||E.isPending||_.isPending,H=F.error,J=U.error,K=E.error||_.error,v=m?n.trim()&&y.trim()&&b.trim():h?n.trim():w?L?O.trim():n.trim():n.trim()&&y.trim(),re=t=>{if(!t)return null;const a=t.message.toLowerCase();return a.includes("unauthorized")||a.includes("401")?"Invalid email or password. Please try again.":a.includes("already exists")||a.includes("409")?"An account with this email already exists. Try signing in instead.":a.includes("network")||a.includes("fetch")?"Network error. Please check your connection and try again.":a.includes("rate limit")||a.includes("429")?"Too many attempts. Please wait a moment and try again.":a.includes("invalid")&&a.includes("otp")?"Invalid or expired code. Please try again.":t.message||"An error occurred. Please try again."},Q=H||J||K,ne=h?"Reset your password":w?L?"Enter verification code":"Sign in with email code":m?"Create your account":"Login or signup below";return e.jsxs("div",{className:"mx-auto w-full min-h-full md:min-h-0 md:min-w-[400px] max-w-md grid gap-6 content-center bg-card p-6 md:p-10 border border-primary-foreground/20",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12"})}),e.jsx("div",{className:"text-center space-y-1",children:e.jsx("p",{className:"text-sm text-foreground/70",children:ne})}),Q&&e.jsx("div",{className:"rounded-xl bg-destructive/10 p-3 text-sm text-destructive text-center",children:re(Q)}),Y&&e.jsx("div",{className:"rounded-xl bg-emerald-500/10 p-3 text-sm text-emerald-600 dark:text-emerald-400 text-center",children:"Check your email for a password reset link."}),!h&&d.enabled&&e.jsx("div",{className:"grid gap-3",children:d.providers.map(t=>e.jsxs(f,{type:"button",variant:"outline",size:"lg",className:"w-full font-medium",disabled:o,onClick:()=>{p.signIn.social({provider:t.name,callbackURL:s??r})},children:[t.icon&&e.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5","aria-hidden":"true"}),"Continue with"," ",t.name.charAt(0).toUpperCase()+t.name.slice(1)]},t.name))}),!h&&d.enabled&&(l.enabled||i.enabled)&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),w&&i.enabled&&e.jsx(e.Fragment,{children:L?e.jsxs("form",{onSubmit:se,className:"grid gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground text-center",children:["Code sent to ",n]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Verification code"}),e.jsx(I,{type:"text",placeholder:"Enter code",value:O,onChange:k(A),required:!0,disabled:o,autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code"})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Verifying...":"Verify"}),e.jsx(f,{type:"button",variant:"ghost",onClick:()=>{R(!1),A(""),E.reset(),_.reset()},disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Use a different email"})]}):e.jsxs("form",{onSubmit:te,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send code"})]})}),h&&l.enabled&&!Y&&e.jsxs("form",{onSubmit:ee,className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsx(f,{type:"submit",disabled:o||!v,className:"w-full font-semibold",size:"lg",children:o?"Sending...":"Send reset link"})]}),!h&&!w&&l.enabled&&e.jsxs("form",{onSubmit:Z,className:"grid gap-4",children:[e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",m?"max-h-[200px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsxs("div",{className:T("p-1",!m&&"pointer-events-none"),children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Name"}),e.jsx(I,{type:"text",placeholder:"Your name",value:b,onChange:k(C),required:!0,disabled:o||!m,"aria-hidden":!m})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Email"}),e.jsx(I,{type:"email",placeholder:"you@example.com",value:n,onChange:k(j),onBlur:W,required:!0,disabled:o,"aria-invalid":!!c}),c&&e.jsx("p",{className:"text-xs text-destructive mt-1.5",children:c})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground",children:"Password"}),!m&&u.enabled&&e.jsx("button",{type:"button",onClick:()=>M("forgotPassword"),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})]}),e.jsx(I,{type:"password",placeholder:"••••••••",value:y,onChange:k(D),required:!0,disabled:o})]}),e.jsx("div",{className:T("overflow-hidden transition-all duration-300 ease-[cubic-bezier(0.075,0.82,0.165,1)]",v?"max-h-[100px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2"),children:e.jsx("div",{className:T("p-1",!v&&"pointer-events-none"),children:e.jsx(f,{type:"submit",disabled:o||!v,className:T("w-full font-semibold"),size:"lg","aria-hidden":!v,children:o?m?"Creating account...":"Signing in...":"Continue"})})})]}),!h&&i.enabled&&l.enabled&&!w&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("emailOtp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with email code instead"})}),w&&l.enabled&&e.jsx("div",{className:"text-center",children:e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Sign in with password instead"})}),e.jsx("div",{className:"text-center",children:h?e.jsx(f,{type:"button",variant:"link",onClick:()=>M("signIn"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Back to sign in"}):!w&&l.enabled?e.jsx(f,{type:"button",variant:"link",onClick:()=>M(m?"signIn":"signUp"),disabled:o,className:"text-sm text-muted-foreground hover:text-foreground",children:m?"Already have an account? Sign in":"Don't have an account? Sign up"}):null}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground pt-4",children:[e.jsx("a",{href:"https://www.decocms.com/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Terms of Service"}),e.jsx("a",{href:"https://www.decocms.com/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Privacy Policy"})]})]})}function de({redirectTo:s}){const[r,l]=x.useState(null);return x.useEffect(()=>{let u=!1;return(async()=>{try{let i;for(let d=0;d<5&&(i=await fetch("/api/auth/custom/local-session",{method:"POST",credentials:"include"}),!(i.ok||i.status<500));d++)await new Promise(n=>setTimeout(n,Math.min(1e3*2**d,1e4)));if(!i?.ok){const d=await i?.json().catch(()=>({}));throw new Error(d?.error||"Auto-login failed")}if(!u){const d=s.startsWith("/")&&!s.startsWith("//")?s:"/";window.location.href=d}}catch(i){u||l(i instanceof Error?i.message:"Auto-login failed")}})(),()=>{u=!0}},[s]),r?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-destructive mb-2",children:["Auto-login failed: ",r]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try restarting the server."})]})}):e.jsx($,{})}function ce(s){if(!s.client_id||s.response_type!=="code")return null;const r=new URLSearchParams;return s.client_id&&r.set("client_id",s.client_id),s.redirect_uri&&r.set("redirect_uri",s.redirect_uri),s.response_type&&r.set("response_type",s.response_type),s.state&&r.set("state",s.state),s.scope&&r.set("scope",s.scope),s.code_challenge&&r.set("code_challenge",s.code_challenge),s.code_challenge_method&&r.set("code_challenge_method",s.code_challenge_method),`/api/auth/mcp/authorize?${r.toString()}`}function ue(s){const r=oe.c(5),{callbackURL:l,providerId:u}=s;let i,d;r[0]!==l||r[1]!==u?(i=()=>{(async()=>await p.signIn.sso({providerId:u,callbackURL:l}))()},d=[u,l],r[0]=l,r[1]=u,r[2]=i,r[3]=d):(i=r[2],d=r[3]),x.useEffect(i,d);let n;return r[4]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx($,{}),r[4]=n):n=r[4],n}function ge(){const s=p.useSession(),r=ae({from:"/login"}),{next:l="/",client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}=r,b=l.startsWith("/")&&!l.startsWith("//")?l:"/",{sso:C,emailAndPassword:O,magicLink:A,emailOtp:L,socialProviders:R,localMode:z}=X(),N=ce({client_id:u,redirect_uri:i,response_type:d,state:n,scope:j,code_challenge:y,code_challenge_method:D}),c=N||b;return s.data?N?(window.location.href=N,e.jsx($,{})):e.jsx(ie,{to:b}):z?e.jsx(de,{redirectTo:c}):C.enabled?e.jsx(ue,{callbackURL:c,providerId:C.providerId}):O.enabled||A.enabled||L.enabled||R.enabled?e.jsxs("main",{className:"relative flex min-h-screen items-stretch md:items-center justify-center bg-gradient-to-br from-brand to-brand/75 p-1 md:p-4",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle, var(--brand-foreground) 1px, transparent 1px)",backgroundSize:"16px 16px",opacity:.15}}),e.jsxs("div",{className:"relative z-10 w-full md:w-auto",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-screen h-px bg-brand-foreground/15"}),e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-px h-screen bg-brand-foreground/15"}),e.jsx(le,{redirectUrl:N,callbackUrl:b})]})]}):e.jsx("div",{children:"No login options available"})}export{ge as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{J as Dt,r as ce,s as fe,o as De,b as $t,z as kt,a as pe,t as ue,x as G,K as ie,j as s,B as Pe,e as Y,w as Ft,n as Tt,c as ze,l as Xe,E as Lt}from"./index-
|
|
1
|
+
import{J as Dt,r as ce,s as fe,o as De,b as $t,z as kt,a as pe,t as ue,x as G,K as ie,j as s,B as Pe,e as Y,w as Ft,n as Tt,c as ze,l as Xe,E as Lt}from"./index-CtJ1_vQP.js";import{C as Ot}from"./collection-display-button-CMOfNtao.js";import{S as qt}from"./search-input-DBJx5Puk.js";import{P as Ee}from"./index-4ADaRsb3.js";import{C as Bt}from"./collection-table-wrapper-BnAWIjfr.js";import{E as We}from"./empty-state-D31vnJxY.js";import{b as Kt,h as Vt,a as Qt,c as Ut,d as Gt,D as Jt}from"./dialog-BapANLA4.js";import{a as Ht,F as rt,b as ct,c as Wt,d as mt,f as dt}from"./form-vm22t8bs.js";import{S as et,a as tt,b as st,c as nt,d as it}from"./select-BL-3WYG3.js";import{T as Yt}from"./textarea-BQD2K7xE.js";import{u as at}from"./use-org-auth-client-CANxngbZ.js";import{u as It}from"./use-organization-roles-BXlhN5BZ.js";import{u as Zt}from"./use-members-CdkSabwq.js";import{S as $e,u as ke}from"./constants-CyYXtNQt.js";import{a as Xt,b as es,c as ts,T as ss}from"./tooltip-BTEnXfpw.js";import{a as ut,e as ft,g as gt,b as ht,c as pt,d as xt,f as bt,A as jt}from"./alert-dialog-CIRyCiSh.js";import{A as Ve}from"./avatar-O6nD_RVH.js";import{B as Ue}from"./badge-1GzX8YfJ.js";import{C as vt}from"./card-YRPYO7rK.js";import{D as At,a as Mt,b as Et,e as ns,d as is,f as ls,c as lt,i as as}from"./dropdown-menu-8r0P5O89.js";import{i as Pt}from"./DotsVertical-Cb1IeswQ.js";import{a as os}from"./SearchMd-Bk2WMaal.js";import{i as rs}from"./Shield01-DabBYOJe.js";import{s as _t,a as cs}from"./XClose-CWzVSlUZ.js";import{s as ms}from"./Trash01-BrCWXUwU.js";import{C as Ct}from"./checkbox-BtvQbCay.js";import{a as Ye,b as Ze,c as yt,C as ds,e as us,f as fs,d as gs}from"./command-Cbz_0bPm.js";import{a as hs,b as ps,P as xs}from"./popover-BoJSCjqj.js";import{t as bs}from"./ChevronDown-BqGwceCn.js";import{s as js}from"./Plus-BWFmeYbA.js";import"./Check-D4yu1L9M.js";import"./view-mode-toggle-Cw5HKJog.js";import"./X-Bwb7_m5v.js";import"./table-DLr2fSXp.js";import"./label-B1j7QJO9.js";import"./ChevronUp-pbRiDYbB.js";import"./User01-YnNa4o8H.js";import"./ChevronRight-BRV7Tdzz.js";import"./index-B1K3k56c.js";const vs=Dt().email("Invalid email address");function Cs(t){if(!t.trim())return[];const e=t.split(/[,;\n]/).map(n=>n.trim().toLowerCase()).filter(n=>n.length>0);return Array.from(new Set(e))}function ys({trigger:t}){const[e,n]=ce.useState(!1),{locator:o}=fe(),r=at(),l=De(),{data:i}=$t.useSession(),a=i?.user?.email,{roles:m,isLoading:g}=It(),h=m.filter(d=>d.role!=="owner"),p=kt({mode:"onChange",defaultValues:{emailsText:"",role:"user"}}),j=p.watch("emailsText"),I=p.watch("role"),v=Cs(j).filter(d=>{const c=vs.safeParse(d).success,x=!a||d!==a.toLowerCase();return c&&x}),N=pe({mutationFn:async({emails:d,role:c})=>{if(!c)throw new Error("Please select a role");const x=await Promise.allSettled(d.map(async w=>{const M=await r.organization.inviteMember({email:w,role:c});if(M.error)throw new Error(M.error.message);return M.data})),A=x.filter(w=>w.status==="rejected");if(A.length>0)throw new Error(`Failed to invite ${A.length} member${A.length>1?"s":""}`);return x},onSuccess:(d,{emails:c,role:x})=>{ue("member_invited",{count:c.length,role:x}),l.invalidateQueries({queryKey:ie.members(o)}),l.invalidateQueries({queryKey:ie.invitations(o)}),G.success(c.length===1?"Member invited successfully!":`${c.length} members invited successfully!`),p.reset({emailsText:"",role:"user"}),n(!1)},onError:(d,{emails:c,role:x})=>{ue("member_invite_failed",{count:c.length,role:x,error:d instanceof Error?d.message:String(d)}),G.error(d instanceof Error?d.message:"Failed to invite members")}}),y=d=>{if(v.length===0){G.error("Please enter at least one valid email address");return}if(!d.role){G.error("Please select a role");return}N.mutate({emails:v,role:d.role})},D=v.length>0&&!!I;return s.jsxs(Kt,{open:e,onOpenChange:n,children:[s.jsx(Vt,{asChild:!0,children:t}),s.jsxs(Qt,{className:"sm:max-w-lg",children:[s.jsx(Ut,{children:s.jsx(Gt,{children:"Invite members"})}),s.jsx(Ht,{...p,children:s.jsxs("form",{onSubmit:p.handleSubmit(y),className:"space-y-4",children:[s.jsx(rt,{control:p.control,name:"emailsText",render:({field:d})=>s.jsxs(ct,{children:[s.jsx(Wt,{children:"Email addresses"}),s.jsx(mt,{children:s.jsx(Yt,{...d,disabled:N.isPending,placeholder:`Enter email addresses separated by commas or new lines
|
|
2
2
|
e.g. user1@example.com, user2@example.com
|
|
3
3
|
or one per line`,className:"min-h-[120px] resize-none"})}),s.jsx(dt,{})]})}),s.jsx(rt,{control:p.control,name:"role",render:({field:d})=>s.jsxs(ct,{children:[s.jsx(mt,{children:s.jsxs(et,{value:d.value,onValueChange:d.onChange,disabled:N.isPending||g,children:[s.jsx(tt,{className:"w-full",children:s.jsx(st,{placeholder:"Select a role"})}),s.jsx(nt,{children:h.map(c=>{const x=[];return c.isBuiltin||(c.allowsAllStaticPermissions?x.push("Full org access"):c.staticPermissionCount&&c.staticPermissionCount>0&&x.push(`${c.staticPermissionCount} org perm${c.staticPermissionCount!==1?"s":""}`),c.allowsAllConnections?x.push("All connections"):c.connectionCount&&c.connectionCount>0&&x.push(`${c.connectionCount} connection${c.connectionCount!==1?"s":""}`),(c.connectionCount!==0||c.allowsAllConnections)&&(c.allowsAllTools?x.push("all tools"):c.toolCount&&c.toolCount>0&&x.push(`${c.toolCount} tool${c.toolCount!==1?"s":""}`))),s.jsx(it,{value:c.role,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:c.label}),!c.isBuiltin&&x.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:x.join(", ")})]})},c.role)})})]})}),s.jsx(dt,{})]})}),s.jsxs(Jt,{children:[s.jsx(Pe,{variant:"outline",onClick:()=>{p.reset({emailsText:"",role:"user"}),n(!1)},type:"button",disabled:N.isPending,children:"Cancel"}),s.jsx(Pe,{type:"submit",disabled:N.isPending||!D,children:N.isPending?"Inviting...":`Invite ${v.length||0} Member${v.length!==1?"s":""}`})]})]})})]})]})}function Ss(){const t=Y.c(10),{org:e,locator:n}=fe();let o;t[0]!==e.id||t[1]!==e.slug?(o={connectionId:$e,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=o):o=t[2];const r=ke(o);let l;t[3]!==n?(l=ie.invitations(n),t[3]=n,t[4]=l):l=t[4];let i;t[5]!==r?(i=async()=>{const m=await r.callTool({name:"ORGANIZATION_GET",arguments:{}});return(m.structuredContent??m)?.invitations??[]},t[5]=r,t[6]=i):i=t[6];let a;return t[7]!==l||t[8]!==i?(a={queryKey:l,queryFn:i},t[7]=l,t[8]=i,t[9]=a):a=t[9],Ft(a)}function ws(){const t=Y.c(10),{locator:e}=fe(),n=at(),o=De();let r;t[0]!==n?(r=async g=>{const h=await n.organization.cancelInvitation({invitationId:g});if(h?.error)throw new Error(h.error.message);return h.data},t[0]=n,t[1]=r):r=t[1];let l;t[2]!==e||t[3]!==o?(l=()=>{o.invalidateQueries({queryKey:ie.invitations(e)}),G.success("Invitation cancelled")},t[2]=e,t[3]=o,t[4]=l):l=t[4];let i;t[5]!==r||t[6]!==l?(i={mutationFn:r,onSuccess:l,onError:Ns},t[5]=r,t[6]=l,t[7]=i):i=t[7];const a=pe(i);let m;return t[8]!==a?(m={cancel:a},t[8]=a,t[9]=m):m=t[9],m}function Ns(t){G.error(t instanceof Error?t.message:"Failed to cancel invitation")}function Ts(){const t=Y.c(10),{org:e,locator:n}=fe();let o;t[0]!==e.id||t[1]!==e.slug?(o={connectionId:$e,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=o):o=t[2];const r=ke(o);let l;t[3]!==n?(l=ie.tags(n),t[3]=n,t[4]=l):l=t[4];let i;t[5]!==r?(i=async()=>{const m=await r.callTool({name:"TAGS_LIST",arguments:{}});return(m.structuredContent??m).tags},t[5]=r,t[6]=i):i=t[6];let a;return t[7]!==l||t[8]!==i?(a={queryKey:l,queryFn:i,staleTime:3e4},t[7]=l,t[8]=i,t[9]=a):a=t[9],Tt(a)}function Is(){const t=Y.c(11),e=De(),{org:n,locator:o}=fe();let r;t[0]!==n.id||t[1]!==n.slug?(r={connectionId:$e,orgId:n.id,orgSlug:n.slug},t[0]=n.id,t[1]=n.slug,t[2]=r):r=t[2];const l=ke(r);let i;t[3]!==l?(i=async g=>{const h=await l.callTool({name:"TAGS_CREATE",arguments:{name:g}});return(h.structuredContent??h).tag},t[3]=l,t[4]=i):i=t[4];let a;t[5]!==o||t[6]!==e?(a=()=>{e.invalidateQueries({queryKey:ie.tags(o)})},t[5]=o,t[6]=e,t[7]=a):a=t[7];let m;return t[8]!==i||t[9]!==a?(m={mutationFn:i,onSuccess:a,onError:As},t[8]=i,t[9]=a,t[10]=m):m=t[10],pe(m)}function As(t){G.error(t instanceof Error?t.message:"Failed to create tag")}function Ms(t){const e=Y.c(13),{org:n,locator:o}=fe();let r;e[0]!==n.id||e[1]!==n.slug?(r={connectionId:$e,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=r):r=e[2];const l=ke(r);let i;e[3]!==o||e[4]!==t?(i=ie.memberTags(o,t),e[3]=o,e[4]=t,e[5]=i):i=e[5];let a;e[6]!==l||e[7]!==t?(a=async()=>{const h=await l.callTool({name:"MEMBER_TAGS_GET",arguments:{memberId:t}});return(h.structuredContent??h).tags},e[6]=l,e[7]=t,e[8]=a):a=e[8];const m=!!t;let g;return e[9]!==i||e[10]!==a||e[11]!==m?(g={queryKey:i,queryFn:a,staleTime:3e4,enabled:m},e[9]=i,e[10]=a,e[11]=m,e[12]=g):g=e[12],Tt(g)}function Es(){const t=Y.c(11),e=De(),{org:n,locator:o}=fe();let r;t[0]!==n.id||t[1]!==n.slug?(r={connectionId:$e,orgId:n.id,orgSlug:n.slug},t[0]=n.id,t[1]=n.slug,t[2]=r):r=t[2];const l=ke(r);let i;t[3]!==l?(i=async g=>{const{memberId:h,tagIds:p}=g,j=await l.callTool({name:"MEMBER_TAGS_SET",arguments:{memberId:h,tagIds:p}});return j.structuredContent??j},t[3]=l,t[4]=i):i=t[4];let a;t[5]!==o||t[6]!==e?(a=(g,h)=>{e.invalidateQueries({queryKey:ie.memberTags(o,h.memberId)})},t[5]=o,t[6]=e,t[7]=a):a=t[7];let m;return t[8]!==i||t[9]!==a?(m={mutationFn:i,onSuccess:a,onError:Ps},t[8]=i,t[9]=a,t[10]=m):m=t[10],pe(m)}function Ps(t){G.error(t instanceof Error?t.message:"Failed to update member tags")}function Rt(t){const e=Y.c(44),{memberId:n,className:o,disabled:r,placeholder:l,maxDisplay:i}=t,a=r===void 0?!1:r,m=l===void 0?"Add tags...":l,g=i===void 0?2:i,[h,p]=ce.useState(!1),[j,I]=ce.useState(""),{data:R,isLoading:v}=Ts(),N=R===void 0?[]:R,{data:y,isLoading:D}=Ms(n),d=y===void 0?[]:y,c=Is(),x=Es(),A=v||D,w=d.map(Rs);let M;e[0]!==j?(M=S=>S.name.toLowerCase().includes(j.toLowerCase()),e[0]=j,e[1]=M):M=e[1];const z=N.filter(M);let T;e[2]!==j?(T=S=>S.name.toLowerCase()===j.toLowerCase(),e[2]=j,e[3]=T):T=e[3];const K=N.find(T),E=j.trim()&&!K,k=async S=>{const he=w.includes(S.id)?w.filter(je=>je!==S.id):[...w,S.id];await x.mutateAsync({memberId:n,tagIds:he})},P=async()=>{if(!j.trim())return;const S=await c.mutateAsync(j.trim());await x.mutateAsync({memberId:n,tagIds:[...w,S.id]}),I("")},u=async S=>{const ne=w.filter(he=>he!==S);await x.mutateAsync({memberId:n,tagIds:ne})},C=c.isPending||x.isPending,O=ps;let $;e[4]!==h?($=()=>p(!h),e[4]=h,e[5]=$):$=e[5];let F;e[6]!==o?(F=ze("h-auto min-h-8 px-2 py-1 justify-start font-normal","hover:bg-accent/50",o),e[6]=o,e[7]=F):F=e[7];const V=a||A,L=A?s.jsx(Xe,{size:14,className:"animate-spin text-muted-foreground"}):d.length>0?s.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[d.slice(0,g).map(_s),d.length>g&&s.jsxs(Ue,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:["+",d.length-g]})]}):s.jsx("span",{className:"text-muted-foreground text-xs",children:m});let Q;e[8]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsx(bs,{size:14,className:"ml-1 shrink-0 opacity-50"}),e[8]=Q):Q=e[8];let q;e[9]!==V||e[10]!==L||e[11]!==$||e[12]!==F?(q=s.jsx(xs,{asChild:!0,children:s.jsxs(Pe,{variant:"ghost",size:"sm",onClick:$,className:F,disabled:V,children:[L,Q]})}),e[9]=V,e[10]=L,e[11]=$,e[12]=F,e[13]=q):q=e[13];const U=hs,J="w-56 p-0",H="start";let W;e[14]===Symbol.for("react.memo_cache_sentinel")?(W=()=>p(!1),e[14]=W):W=e[14];const le=fs,xe=!1;let Z;e[15]!==j?(Z=s.jsx(gs,{placeholder:"Search or create...",value:j,onValueChange:I,className:"h-9"}),e[15]=j,e[16]=Z):Z=e[16];const ae=us,me=d.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(Ye,{heading:"Selected",children:d.map(S=>s.jsx(Ze,{onSelect:()=>k(S),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ct,{checked:!0,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:S.name})]}),s.jsx("button",{onClick:ne=>{ne.stopPropagation(),u(S.id)},className:"opacity-50 hover:opacity-100",disabled:C,children:s.jsx(_t,{size:14})})]})},S.id))}),s.jsx(yt,{})]}),_e=Ye,be="Available",Re=z.length===0&&!E&&s.jsx(ds,{children:"No tags found."}),ge=z.filter(S=>!w.includes(S.id)).map(S=>s.jsx(Ze,{onSelect:()=>k(S),className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ct,{checked:!1,className:"[&_svg]:!text-primary-foreground"}),s.jsx("span",{children:S.name})]})},S.id));let oe;e[17]!==_e||e[18]!==Re||e[19]!==ge?(oe=s.jsxs(_e,{heading:be,children:[Re,ge]}),e[17]=_e,e[18]=Re,e[19]=ge,e[20]=oe):oe=e[20];let re;e[21]!==P||e[22]!==C||e[23]!==j||e[24]!==E?(re=E&&s.jsxs(s.Fragment,{children:[s.jsx(yt,{}),s.jsx(Ye,{children:s.jsx(Ze,{onSelect:P,className:"cursor-pointer",disabled:C,children:s.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[C?s.jsx(Xe,{size:14,className:"animate-spin"}):s.jsx(js,{size:14}),s.jsxs("span",{children:['Create "',j.trim(),'"']})]})})})]}),e[21]=P,e[22]=C,e[23]=j,e[24]=E,e[25]=re):re=e[25];let X;e[26]!==ae||e[27]!==me||e[28]!==oe||e[29]!==re?(X=s.jsxs(ae,{children:[me,oe,re]}),e[26]=ae,e[27]=me,e[28]=oe,e[29]=re,e[30]=X):X=e[30];let ee;e[31]!==le||e[32]!==Z||e[33]!==X?(ee=s.jsxs(le,{shouldFilter:xe,children:[Z,X]}),e[31]=le,e[32]=Z,e[33]=X,e[34]=ee):ee=e[34];let te;e[35]!==U||e[36]!==W||e[37]!==ee?(te=s.jsx(U,{className:J,align:H,onEscapeKeyDown:W,children:ee}),e[35]=U,e[36]=W,e[37]=ee,e[38]=te):te=e[38];let se;return e[39]!==O||e[40]!==h||e[41]!==q||e[42]!==te?(se=s.jsxs(O,{open:h,onOpenChange:p,children:[q,te]}),e[39]=O,e[40]=h,e[41]=q,e[42]=te,e[43]=se):se=e[43],se}function _s(t){return s.jsx(Ue,{variant:"secondary",className:"text-xs px-1.5 py-0 h-5",children:t.name},t.id)}function Rs(t){return t.id}const St=["bg-neutral-400","bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500","bg-slate-500"],zs={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Qe(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ds(t){const e=new Map;for(const[n,o]of Object.entries(zs))e.set(n,o);for(let n=0;n<t.length;n++){const o=t[n];o&&!e.has(o.role)&&e.set(o.role,St[n%St.length]??"bg-neutral-400")}return e}function $s(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function Ke(t){const e=Y.c(79),{role:n,memberId:o,isOwner:r,roleColorMap:l,selectableRoles:i,onRoleChange:a,size:m,className:g}=t,h=m===void 0?"xs":m;let p,j,I,R,v,N,y,D,d,c,x;if(e[0]!==g||e[1]!==r||e[2]!==o||e[3]!==a||e[4]!==n||e[5]!==l||e[6]!==i||e[7]!==h){x=Symbol.for("react.early_return_sentinel");e:{const P=l.get(n)??"bg-neutral-400";if(r){let u;e[19]!==o||e[20]!==a?(u=J=>a(o,J),e[19]=o,e[20]=a,e[21]=u):u=e[21];let C;e[22]!==n?(C=s.jsx("span",{className:"capitalize truncate",children:n}),e[22]=n,e[23]=C):C=e[23];const O=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("div",{className:ze("size-2 rounded-full shrink-0",P)}),C]});let $;e[24]!==O?($=s.jsx(st,{children:O}),e[24]=O,e[25]=$):$=e[25];let F;e[26]!==g||e[27]!==h||e[28]!==$?(F=s.jsx(tt,{size:h,className:g,children:$}),e[26]=g,e[27]=h,e[28]=$,e[29]=F):F=e[29];let V;if(e[30]!==l||e[31]!==i){let J;e[33]!==l?(J=H=>{const W=l.get(H.role)??"bg-neutral-400";return s.jsx(it,{value:H.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ze("size-3 rounded-full",W)}),s.jsx("span",{className:"capitalize",children:H.label})]})},H.role)},e[33]=l,e[34]=J):J=e[34],V=i.map(J),e[30]=l,e[31]=i,e[32]=V}else V=e[32];let L;e[35]!==V?(L=s.jsx(nt,{children:V}),e[35]=V,e[36]=L):L=e[36];let Q;e[37]!==r||e[38]!==n||e[39]!==u||e[40]!==F||e[41]!==L?(Q=s.jsx(Xt,{asChild:!0,children:s.jsx("div",{className:"w-fit",children:s.jsxs(et,{value:n,onValueChange:u,disabled:r,children:[F,L]})})}),e[37]=r,e[38]=n,e[39]=u,e[40]=F,e[41]=L,e[42]=Q):Q=e[42];let q;e[43]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(es,{children:s.jsx("p",{children:"The owner role cannot be changed"})}),e[43]=q):q=e[43];let U;e[44]!==Q?(U=s.jsx(ts,{children:s.jsxs(ss,{children:[Q,q]})}),e[44]=Q,e[45]=U):U=e[45],x=U;break e}I=et,D=n,e[46]!==o||e[47]!==a?(d=u=>a(o,u),e[46]=o,e[47]=a,e[48]=d):d=e[48],c=r,j=tt,N=h,y=g,p=st,v="flex items-center gap-2 min-w-0",R=ze("size-2 rounded-full shrink-0",P)}e[0]=g,e[1]=r,e[2]=o,e[3]=a,e[4]=n,e[5]=l,e[6]=i,e[7]=h,e[8]=p,e[9]=j,e[10]=I,e[11]=R,e[12]=v,e[13]=N,e[14]=y,e[15]=D,e[16]=d,e[17]=c,e[18]=x}else p=e[8],j=e[9],I=e[10],R=e[11],v=e[12],N=e[13],y=e[14],D=e[15],d=e[16],c=e[17],x=e[18];if(x!==Symbol.for("react.early_return_sentinel"))return x;let A;e[49]!==R?(A=s.jsx("div",{className:R}),e[49]=R,e[50]=A):A=e[50];let w;e[51]!==n?(w=s.jsx("span",{className:"capitalize truncate",children:n}),e[51]=n,e[52]=w):w=e[52];let M;e[53]!==A||e[54]!==w||e[55]!==v?(M=s.jsxs("div",{className:v,children:[A,w]}),e[53]=A,e[54]=w,e[55]=v,e[56]=M):M=e[56];let z;e[57]!==p||e[58]!==M?(z=s.jsx(p,{children:M}),e[57]=p,e[58]=M,e[59]=z):z=e[59];let T;e[60]!==j||e[61]!==z||e[62]!==N||e[63]!==y?(T=s.jsx(j,{size:N,className:y,children:z}),e[60]=j,e[61]=z,e[62]=N,e[63]=y,e[64]=T):T=e[64];let K;if(e[65]!==l||e[66]!==i){let P;e[68]!==l?(P=u=>{const C=l.get(u.role)??"bg-neutral-400";return s.jsx(it,{value:u.role,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ze("size-3 rounded-full",C)}),s.jsx("span",{className:"capitalize",children:u.label})]})},u.role)},e[68]=l,e[69]=P):P=e[69],K=i.map(P),e[65]=l,e[66]=i,e[67]=K}else K=e[67];let E;e[70]!==K?(E=s.jsx(nt,{children:K}),e[70]=K,e[71]=E):E=e[71];let k;return e[72]!==I||e[73]!==T||e[74]!==E||e[75]!==D||e[76]!==d||e[77]!==c?(k=s.jsxs(I,{value:D,onValueChange:d,disabled:c,children:[T,E]}),e[72]=I,e[73]=T,e[74]=E,e[75]=D,e[76]=d,e[77]=c,e[78]=k):k=e[78],k}function wt(t){const e=Y.c(51),{member:n,roles:o,onChangeRole:r,onRemove:l,isUpdating:i}=t,a=i===void 0?!1:i,m=n.role==="owner";let g,h,p,j,I,R,v,N,y;if(e[0]!==m||e[1]!==a||e[2]!==n.id||e[3]!==n.role||e[4]!==r||e[5]!==o){let T;e[15]!==n.role?(T=u=>u.role!==n.role&&u.role!=="owner",e[15]=n.role,e[16]=T):T=e[16];const K=o.filter(T);j=At;let E;e[17]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx(Pt,{size:20}),e[17]=E):E=e[17],e[18]!==m?(y=s.jsx(Mt,{asChild:!0,children:s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:m,onClick:Fs,children:E})}),e[18]=m,e[19]=y):y=e[19],p=Et,v="end",N=ks,h=ns;let k;e[20]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(cs,{size:16}),e[20]=k):k=e[20],e[21]!==a?(R=s.jsxs(is,{disabled:a,children:[k,"Change Role"]}),e[21]=a,e[22]=R):R=e[22],g=ls;let P;e[23]!==a||e[24]!==n.id||e[25]!==r?(P=u=>{const C=[];return u.isBuiltin||(u.allowsAllStaticPermissions?C.push("Full org access"):u.staticPermissionCount&&u.staticPermissionCount>0&&C.push(`${u.staticPermissionCount} org perm${u.staticPermissionCount!==1?"s":""}`),u.allowsAllConnections?C.push("All connections"):u.connectionCount&&u.connectionCount>0&&C.push(`${u.connectionCount} connection${u.connectionCount!==1?"s":""}`),(u.connectionCount!==0||u.allowsAllConnections)&&(u.allowsAllTools?C.push("all tools"):u.toolCount&&u.toolCount>0&&C.push(`${u.toolCount} tool${u.toolCount!==1?"s":""}`))),s.jsxs(lt,{onClick:O=>{O.stopPropagation(),r(n.id,u.role)},disabled:a,children:[u.isBuiltin?s.jsx(rs,{size:16}):s.jsx(os,{size:16}),s.jsxs("span",{className:"flex flex-col",children:[s.jsx("span",{children:u.label}),!u.isBuiltin&&C.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:C.join(", ")})]})]},u.role)},e[23]=a,e[24]=n.id,e[25]=r,e[26]=P):P=e[26],I=K.map(P),e[0]=m,e[1]=a,e[2]=n.id,e[3]=n.role,e[4]=r,e[5]=o,e[6]=g,e[7]=h,e[8]=p,e[9]=j,e[10]=I,e[11]=R,e[12]=v,e[13]=N,e[14]=y}else g=e[6],h=e[7],p=e[8],j=e[9],I=e[10],R=e[11],v=e[12],N=e[13],y=e[14];let D;e[27]!==g||e[28]!==I?(D=s.jsx(g,{children:I}),e[27]=g,e[28]=I,e[29]=D):D=e[29];let d;e[30]!==h||e[31]!==R||e[32]!==D?(d=s.jsxs(h,{children:[R,D]}),e[30]=h,e[31]=R,e[32]=D,e[33]=d):d=e[33];let c;e[34]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(as,{}),e[34]=c):c=e[34];let x;e[35]!==n.id||e[36]!==l?(x=T=>{T.stopPropagation(),l(n.id)},e[35]=n.id,e[36]=l,e[37]=x):x=e[37];let A;e[38]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(ms,{size:16}),e[38]=A):A=e[38];let w;e[39]!==x?(w=s.jsxs(lt,{variant:"destructive",onClick:x,children:[A,"Remove Member"]}),e[39]=x,e[40]=w):w=e[40];let M;e[41]!==p||e[42]!==w||e[43]!==v||e[44]!==N||e[45]!==d?(M=s.jsxs(p,{align:v,onClick:N,children:[d,c,w]}),e[41]=p,e[42]=w,e[43]=v,e[44]=N,e[45]=d,e[46]=M):M=e[46];let z;return e[47]!==j||e[48]!==M||e[49]!==y?(z=s.jsxs(j,{children:[y,M]}),e[47]=j,e[48]=M,e[49]=y,e[50]=z):z=e[50],z}function ks(t){return t.stopPropagation()}function Fs(t){return t.stopPropagation()}function Nt(t){const e=Y.c(8),{invitationId:n,onCancel:o,isCancelling:r}=t,l=r===void 0?!1:r;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Mt,{asChild:!0,children:s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:Os,children:s.jsx(Pt,{size:20})})}),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==o?(a=h=>{h.stopPropagation(),o(n)},e[1]=n,e[2]=o,e[3]=a):a=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(_t,{size:16}),e[4]=m):m=e[4];let g;return e[5]!==l||e[6]!==a?(g=s.jsxs(At,{children:[i,s.jsx(Et,{align:"end",onClick:Ls,children:s.jsxs(lt,{variant:"destructive",onClick:a,disabled:l,children:[m,"Cancel Invitation"]})})]}),e[5]=l,e[6]=a,e[7]=g):g=e[7],g}function Ls(t){return t.stopPropagation()}function Os(t){return t.stopPropagation()}function qs(){const t=Y.c(101),{data:e}=Zt(),{data:n}=Ss(),o=ws(),r=De(),{locator:l}=fe(),i=at(),[a,m]=ce.useState(null),[g,h]=ce.useState(null),[p,j]=ce.useState(""),[I,R]=ce.useState("table"),[v,N]=ce.useState("member"),[y,D]=ce.useState("asc"),d=e?.data?.members;let c;t[0]!==v?(c=f=>{v===f?D(Zs):(N(f),D("asc"))},t[0]=v,t[1]=c):c=t[1];const x=c;let A=d??[],w=n??[];if(p){const f=p.toLowerCase();A=A.filter(b=>b.user?.name?.toLowerCase().includes(f)||b.user?.email?.toLowerCase().includes(f)||b.role?.toLowerCase().includes(f)),w=w.filter(b=>b.email?.toLowerCase().includes(f)||b.role?.toLowerCase().includes(f))}if(v&&y){let f;t[2]!==y||t[3]!==v?(f=(b,_)=>{let B,de;e:switch(v){case"member":{B=b.user?.name||"",de=_.user?.name||"";break e}case"role":{B=b.role||"",de=_.role||"";break e}case"joined":{B=b.createdAt?typeof b.createdAt=="string"?b.createdAt:b.createdAt.toISOString():"",de=_.createdAt?typeof _.createdAt=="string"?_.createdAt:_.createdAt.toISOString():"";break e}default:return 0}return y==="asc"?B.localeCompare(de):de.localeCompare(B)},t[2]=y,t[3]=v,t[4]=f):f=t[4],A=[...A].sort(f)}const M=A;let z;t[5]!==i?(z=async f=>{const b=await i.organization.removeMember({memberIdOrEmail:f});if(b?.error)throw new Error(b.error.message)},t[5]=i,t[6]=z):z=t[6];let T;t[7]!==l||t[8]!==r?(T=()=>{ue("member_removed"),r.invalidateQueries({queryKey:ie.members(l)}),G.success("Member has been removed from the organization"),m(null)},t[7]=l,t[8]=r,t[9]=T):T=t[9];let K;t[10]!==z||t[11]!==T?(K={mutationFn:z,onSuccess:T,onError:Ys},t[10]=z,t[11]=T,t[12]=K):K=t[12];const E=pe(K);let k;t[13]!==i?(k=async f=>{const{memberId:b,role:_}=f,B=await i.organization.updateMemberRole({memberId:b,role:[_]});if(B?.error)throw new Error(B.error.message)},t[13]=i,t[14]=k):k=t[14];let P;t[15]!==l||t[16]!==r?(P=(f,b)=>{ue("member_role_updated",{new_role:b.role}),r.invalidateQueries({queryKey:ie.members(l)}),G.success("Member's role has been updated")},t[15]=l,t[16]=r,t[17]=P):P=t[17];let u;t[18]!==k||t[19]!==P?(u={mutationFn:k,onSuccess:P,onError:Ws},t[18]=k,t[19]=P,t[20]=u):u=t[20];const C=pe(u);let O;t[21]!==i?(O=async f=>{const{invitationId:b,role:_,email:B}=f,de=await i.organization.cancelInvitation({invitationId:b});if(de?.error)throw new Error(de.error.message);const ot=await i.organization.inviteMember({email:B,role:_});if(ot?.error)throw new Error(ot.error.message)},t[21]=i,t[22]=O):O=t[22];let $;t[23]!==l||t[24]!==r?($=(f,b)=>{ue("invitation_role_updated",{new_role:b.role}),r.invalidateQueries({queryKey:ie.invitations(l)}),G.success("Invitation role has been updated")},t[23]=l,t[24]=r,t[25]=$):$=t[25];let F;t[26]!==O||t[27]!==$?(F={mutationFn:O,onSuccess:$,onError:Hs},t[26]=O,t[27]=$,t[28]=F):F=t[28];const V=pe(F),{roles:L,customRoles:Q}=It();let q;t[29]!==Q?(q=Ds(Q),t[29]=Q,t[30]=q):q=t[30];const U=q;let J;t[31]!==L?(J=L.filter(Js),t[31]=L,t[32]=J):J=t[32];const H=J;let W;t[33]===Symbol.for("react.memo_cache_sentinel")?(W={id:"member",header:"Member",render:Gs,cellClassName:"flex-1 min-w-0",sortable:!0},t[33]=W):W=t[33];let le;t[34]!==U||t[35]!==H||t[36]!==V||t[37]!==C?(le={id:"role",header:"Role",render:f=>f.type==="member"?s.jsx(Ke,{role:f.data.role,memberId:f.data.id,isOwner:f.data.role==="owner",roleColorMap:U,selectableRoles:H,onRoleChange:(b,_)=>C.mutate({memberId:b,role:_}),className:"w-36"}):s.jsx(Ke,{role:f.data.role,memberId:f.data.id,isOwner:!1,roleColorMap:U,selectableRoles:H,onRoleChange:(b,_)=>V.mutate({invitationId:b,role:_,email:f.data.email}),className:"w-36"}),cellClassName:"w-36 shrink-0",sortable:!0},t[34]=U,t[35]=H,t[36]=V,t[37]=C,t[38]=le):le=t[38];let xe,Z;t[39]===Symbol.for("react.memo_cache_sentinel")?(xe={id:"tags",header:"Tags",render:Us,cellClassName:"w-40 shrink-0"},Z={id:"joined",header:"Joined",render:Qs,cellClassName:"w-48 shrink-0",sortable:!0},t[39]=xe,t[40]=Z):(xe=t[39],Z=t[40]);let ae;t[41]!==o.cancel.isPending||t[42]!==L||t[43]!==C?(ae={id:"actions",header:"",render:f=>f.type==="member"?s.jsx(wt,{member:f.data,roles:L,onChangeRole:(b,_)=>C.mutate({memberId:b,role:_}),onRemove:m,isUpdating:C.isPending}):s.jsx(Nt,{invitationId:f.data.id,onCancel:h,isCancelling:o.cancel.isPending}),cellClassName:"w-12 shrink-0"},t[41]=o.cancel.isPending,t[42]=L,t[43]=C,t[44]=ae):ae=t[44];let me;t[45]!==le||t[46]!==ae?(me=[W,le,xe,Z,ae],t[45]=le,t[46]=ae,t[47]=me):me=t[47];const _e=me;let be;t[48]===Symbol.for("react.memo_cache_sentinel")?(be=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(ys,{trigger:s.jsx(Pe,{children:"Invite Member"})})}),t[48]=be):be=t[48];const Re=be,ge=[...M.map(Vs),...w.filter(Ks).map(Bs)],oe=Ee,re=!!g;let X;t[49]===Symbol.for("react.memo_cache_sentinel")?(X=()=>h(null),t[49]=X):X=t[49];let ee;t[50]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsxs(ht,{children:[s.jsx(pt,{children:"Cancel Invitation"}),s.jsx(xt,{children:"Are you sure you want to cancel this invitation? The invitee will no longer be able to join the organization with this invitation."})]}),t[50]=ee):ee=t[50];let te;t[51]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx(bt,{children:"Keep Invitation"}),t[51]=te):te=t[51];let se;t[52]!==o.cancel||t[53]!==g?(se=()=>{g&&(o.cancel.mutate(g),h(null))},t[52]=o.cancel,t[53]=g,t[54]=se):se=t[54];let S;t[55]!==o.cancel.isPending||t[56]!==se?(S=s.jsxs(ut,{children:[ee,s.jsxs(ft,{children:[te,s.jsx(gt,{onClick:se,disabled:o.cancel.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Invitation"})]})]}),t[55]=o.cancel.isPending,t[56]=se,t[57]=S):S=t[57];let ne;t[58]!==re||t[59]!==S?(ne=s.jsx(jt,{open:re,onOpenChange:X,children:S}),t[58]=re,t[59]=S,t[60]=ne):ne=t[60];const he=!!a;let je;t[61]===Symbol.for("react.memo_cache_sentinel")?(je=()=>m(null),t[61]=je):je=t[61];let Fe;t[62]===Symbol.for("react.memo_cache_sentinel")?(Fe=s.jsxs(ht,{children:[s.jsx(pt,{children:"Remove Member"}),s.jsx(xt,{children:"Are you sure you want to remove this member from the organization? This action cannot be undone."})]}),t[62]=Fe):Fe=t[62];let Le;t[63]===Symbol.for("react.memo_cache_sentinel")?(Le=s.jsx(bt,{children:"Cancel"}),t[63]=Le):Le=t[63];let ve;t[64]!==a||t[65]!==E?(ve=()=>a&&E.mutate(a),t[64]=a,t[65]=E,t[66]=ve):ve=t[66];let Ce;t[67]!==E.isPending||t[68]!==ve?(Ce=s.jsxs(ut,{children:[Fe,s.jsxs(ft,{children:[Le,s.jsx(gt,{onClick:ve,disabled:E.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),t[67]=E.isPending,t[68]=ve,t[69]=Ce):Ce=t[69];let ye;t[70]!==he||t[71]!==Ce?(ye=s.jsx(jt,{open:he,onOpenChange:je,children:Ce}),t[70]=he,t[71]=Ce,t[72]=ye):ye=t[72];const Ge=Ee,Je=Ee,zt="flex flex-col gap-6";let Se;t[73]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx(Ee.Title,{children:"Members"}),t[73]=Se):Se=t[73];let Oe;t[74]===Symbol.for("react.memo_cache_sentinel")?(Oe=f=>{f.key==="Escape"&&(j(""),f.target.blur())},t[74]=Oe):Oe=t[74];let we;t[75]!==p?(we=s.jsx(qt,{value:p,onChange:j,placeholder:"Search members...",className:"w-full md:w-[375px]",onKeyDown:Oe}),t[75]=p,t[76]=we):we=t[76];let qe;t[77]===Symbol.for("react.memo_cache_sentinel")?(qe=[{id:"member",label:"Name"},{id:"role",label:"Role"},{id:"joined",label:"Joined"}],t[77]=qe):qe=t[77];let Ne;t[78]!==x||t[79]!==y||t[80]!==v||t[81]!==I?(Ne=s.jsx(Ot,{viewMode:I,onViewModeChange:R,sortKey:v,sortDirection:y,onSort:x,sortOptions:qe}),t[78]=x,t[79]=y,t[80]=v,t[81]=I,t[82]=Ne):Ne=t[82];let Te;t[83]!==we||t[84]!==Ne?(Te=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[we,Ne]}),Re]}),t[83]=we,t[84]=Ne,t[85]=Te):Te=t[85];const He=I==="cards"?s.jsx("div",{children:ge.length===0?s.jsx(We,{title:"No members found",description:p?`No members match "${p}"`:"Invite members to get started."}):s.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:ge.map(f=>{if(f.type==="invitation")return s.jsxs(vt,{className:"transition-colors relative opacity-75",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(Nt,{invitationId:f.data.id,onCancel:h,isCancelling:o.cancel.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ve,{fallback:Qe(f.data.email),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:f.data.email}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Ue,{variant:"outline",className:"w-fit text-amber-600 border-amber-400",children:"Pending"})}),s.jsx(Ke,{role:f.data.role,memberId:f.data.id,isOwner:!1,roleColorMap:U,selectableRoles:H,onRoleChange:(_,B)=>V.mutate({invitationId:_,role:B,email:f.data.email}),className:"w-fit"})]})]})]},`inv-${f.data.id}`);const b=f.data;return s.jsxs(vt,{className:"transition-colors relative",children:[s.jsx("div",{className:"absolute top-4 right-4 z-10",children:s.jsx(wt,{member:b,roles:L,onChangeRole:(_,B)=>C.mutate({memberId:_,role:B}),onRemove:m,isUpdating:C.isPending})}),s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[s.jsx(Ve,{url:b.user?.image??void 0,fallback:Qe(b.user?.name),shape:"circle",size:"lg",className:"shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:b.user?.name||"Unknown"}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.user?.email}),s.jsx(Ke,{role:b.role,memberId:b.id,isOwner:b.role==="owner",roleColorMap:U,selectableRoles:H,onRoleChange:(_,B)=>C.mutate({memberId:_,role:B}),className:"w-fit"}),s.jsx(Rt,{memberId:b.id,maxDisplay:3})]})]})]},b.id)})})}):s.jsx(Bt,{columns:_e,data:ge,isLoading:!1,sortKey:v,sortDirection:y,onSort:x,emptyState:p?s.jsx(We,{title:"No members found",description:`No members match "${p}"`}):s.jsx(We,{title:"No members found",description:"Invite members to get started."})});let Ie;t[86]!==Se||t[87]!==Te||t[88]!==He?(Ie=s.jsxs("div",{className:zt,children:[Se,Te,He]}),t[86]=Se,t[87]=Te,t[88]=He,t[89]=Ie):Ie=t[89];let Ae;t[90]!==Je.Body||t[91]!==Ie?(Ae=s.jsx(Je.Body,{children:Ie}),t[90]=Je.Body,t[91]=Ie,t[92]=Ae):Ae=t[92];let Me;t[93]!==Ge.Content||t[94]!==Ae?(Me=s.jsx(Ge.Content,{children:Ae}),t[93]=Ge.Content,t[94]=Ae,t[95]=Me):Me=t[95];let Be;return t[96]!==oe||t[97]!==ne||t[98]!==ye||t[99]!==Me?(Be=s.jsxs(oe,{children:[ne,ye,Me]}),t[96]=oe,t[97]=ne,t[98]=ye,t[99]=Me,t[100]=Be):Be=t[100],Be}function Bs(t){return{type:"invitation",data:t}}function Ks(t){return t.status==="pending"}function Vs(t){return{type:"member",data:t}}function Qs(t){return t.type==="member"?s.jsx("span",{className:"text-sm text-foreground",children:t.data.createdAt?$s(t.data.createdAt):"N/A"}):s.jsx(Ue,{variant:"outline",children:"Pending"})}function Us(t){return t.type==="member"?s.jsx(Rt,{memberId:t.data.id,maxDisplay:2}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}function Gs(t){return t.type==="member"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ve,{url:t.data.user?.image??void 0,fallback:Qe(t.data.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.user?.name||"Unknown"}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:t.data.user?.email})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ve,{fallback:Qe(t.data.email),shape:"circle",size:"sm"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:t.data.email}),s.jsx("div",{className:"text-sm text-muted-foreground truncate",children:"Invitation sent"})]})]})}function Js(t){return t.role!=="owner"}function Hs(t,e){ue("invitation_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),G.error(t instanceof Error?t.message:"Failed to update invitation role")}function Ws(t,e){ue("member_role_update_failed",{new_role:e.role,error:t instanceof Error?t.message:String(t)}),G.error(t instanceof Error?t.message:"Failed to update role")}function Ys(t){ue("member_remove_failed",{error:t instanceof Error?t.message:String(t)}),G.error(t instanceof Error?t.message:"Failed to remove member")}function Zs(t){return t==="asc"?"desc":t==="desc"?null:"asc"}function Ln(){const t=Y.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed to load members"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Lt,{fallback:e,children:s.jsx(ce.Suspense,{fallback:s.jsx(Ee,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(Xe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(qs,{})})}),t[1]=n):n=t[1],n}export{Ln as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,bc as D,e as Me,j as _,_ as te}from"./index-
|
|
1
|
+
import{r as a,bc as D,e as Me,j as _,_ as te}from"./index-CtJ1_vQP.js";import{S as me}from"./index-DnMFHGHl.js";function ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Pe(e){if(Array.isArray(e))return e}function Re(e,t,r){return(t=Le(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Se(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,u,l=[],c=!0,g=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(O){g=!0,o=O}finally{try{if(!c&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(g)throw o}}return l}}function xe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ce(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Te(e,t){if(e==null)return{};var r,n,o=_e(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function _e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ce(e,t){return Pe(e)||Se(e,t)||Ve(e,t)||xe()}function Ie(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Le(e){var t=Ie(e,"string");return typeof t=="symbol"?t:t+""}function Ve(e,t){if(e){if(typeof e=="string")return ue(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(e,t):void 0}}function Ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?le(Object(r),!0).forEach(function(n){Ae(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):le(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $e(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function K(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Q(e){return{}.toString.call(e).includes("Object")}function De(e){return!Object.keys(e).length}function q(e){return typeof e=="function"}function Ne(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ze(e,t){return Q(t)||T("changeType"),Object.keys(t).some(function(r){return!Ne(e,r)})&&T("changeField"),t}function Ke(e){q(e)||T("selectorType")}function ke(e){q(e)||Q(e)||T("handlerType"),Q(e)&&Object.values(e).some(function(t){return!q(t)})&&T("handlersType")}function qe(e){e||T("initialIsRequired"),Q(e)||T("initialType"),De(e)&&T("initialContent")}function We(e,t){throw new Error(e[t]||e.default)}var Fe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},T=K(We)(Fe),J={changes:ze,selector:Ke,handler:ke,initial:qe};function Ue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};J.initial(e),J.handler(t);var r={current:e},n=K(He)(r,t),o=K(Be)(r),i=K(J.changes)(e),u=K(Je)(r);function l(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(O){return O};return J.selector(g),g(r.current)}function c(g){$e(n,o,i,u)(g)}return[l,c]}function Je(e,t){return q(t)?t(e.current):t}function Be(e,t){return e.current=fe(fe({},e.current),t),t}function He(e,t,r){return q(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Qe={create:Ue},Ge={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ye(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var u=arguments.length,l=new Array(u),c=0;c<u;c++)l[c]=arguments[c];return t.apply(r,[].concat(o,l))}}}function Xe(e){return{}.toString.call(e).includes("Object")}function Ze(e){return e||de("configIsRequired"),Xe(e)||de("configType"),e.urls?(et(),{paths:{vs:e.urls.monacoBase}}):e}function et(){console.warn(he.deprecation)}function tt(e,t){throw new Error(e[t]||e.default)}var he={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
3
|
You are using deprecated way of configuration.
|
|
4
4
|
|