decocms 3.36.5 → 3.36.7
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-CHkhp8BT.js → AlertCircle-Ed8WT4Gj.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-BLDnDQA4.js → ArrowUpRight-C-Lwk46I.js} +1 -1
- package/dist/client/assets/{Check-g3DB8Y79.js → Check-hOMWkijh.js} +1 -1
- package/dist/client/assets/{CheckCircle-CaqJ0h8v.js → CheckCircle-DaXMnsEo.js} +1 -1
- package/dist/client/assets/{ChevronDown-2xes5oAP.js → ChevronDown-D6Zecsff.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DoZaWCdC.js → ChevronLeft-D-XrQc44.js} +1 -1
- package/dist/client/assets/{ChevronRight-BAb1spam.js → ChevronRight-DVoYZuHq.js} +1 -1
- package/dist/client/assets/{ChevronUp-D1fwNmdw.js → ChevronUp-Dl9jzSxx.js} +1 -1
- package/dist/client/assets/{Container-SX43EreL.js → Container-B5dlvIhN.js} +1 -1
- package/dist/client/assets/{DotsVertical-BJVJdITZ.js → DotsVertical-DaPu-BjL.js} +1 -1
- package/dist/client/assets/{Eye-B6_-sQMR.js → Eye-BKIYBCFX.js} +1 -1
- package/dist/client/assets/{FilterLines-Bppcas54.js → FilterLines-ClAdcVIA.js} +1 -1
- package/dist/client/assets/{Globe01-BaaIcJuv.js → Globe01-IHgKWLQG.js} +1 -1
- package/dist/client/assets/{HardDrive-DCOTq5uv.js → HardDrive-D-m2ZipN.js} +1 -1
- package/dist/client/assets/{Key01-WyguyLzq.js → Key01-BdHvOh_e.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DFTfTIl4.js → LayoutLeft-BK03sAXS.js} +1 -1
- package/dist/client/assets/{LinkExternal01-C4yAqYts.js → LinkExternal01-Dnhttb39.js} +1 -1
- package/dist/client/assets/{Monitor01-rl2bcoeM.js → Monitor01-Dcp9PrZz.js} +1 -1
- package/dist/client/assets/{Palette-VBLL4nJC.js → Palette-NCjk3FGG.js} +1 -1
- package/dist/client/assets/{Play-Cjs1Q-Aw.js → Play-BpEe0tlc.js} +1 -1
- package/dist/client/assets/{Plus-C5heVoJ6.js → Plus-p5ww31iK.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-BZry-3Kg.js → RefreshCcw01-BFs2Qz_9.js} +1 -1
- package/dist/client/assets/{SearchMd-qFqO3CC6.js → SearchMd-Ds9YnLOw.js} +1 -1
- package/dist/client/assets/{Settings02-CLIbq_7z.js → Settings02-CecILrtY.js} +1 -1
- package/dist/client/assets/{Shield01-Bo6JmLSx.js → Shield01-vLzXztr0.js} +1 -1
- package/dist/client/assets/{Star01-2SOe9QD-.js → Star01-CZv8qd6s.js} +1 -1
- package/dist/client/assets/{Stars01-C-iKmdEF.js → Stars01-Ch5iJcxR.js} +1 -1
- package/dist/client/assets/{Stars02-CEd2BxY_.js → Stars02-BJ8W7Y3C.js} +1 -1
- package/dist/client/assets/{Sun-jizGeY2D.js → Sun-Cwmha-a2.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-CUtzfg9y.js → SwitchHorizontal01-FJhkXGab.js} +1 -1
- package/dist/client/assets/{Tool01-IpmKT80v.js → Tool01-iIvrrn5i.js} +1 -1
- package/dist/client/assets/{Trash01-DM00_xyO.js → Trash01-DwmURdtf.js} +1 -1
- package/dist/client/assets/{Upload01-D0E7TXXq.js → Upload01-oRevAfqv.js} +1 -1
- package/dist/client/assets/{User01-ga9dWIix.js → User01-h8GKw08y.js} +1 -1
- package/dist/client/assets/{Users01-lGeZPP0U.js → Users01-CFNaA2uI.js} +1 -1
- package/dist/client/assets/{Users03-1mzpWPfB.js → Users03-OjZAoe5s.js} +1 -1
- package/dist/client/assets/{X-C_bQSA-d.js → X-BgKKVHlr.js} +1 -1
- package/dist/client/assets/{XCircle-D9AGwgGK.js → XCircle-4DVMD60R.js} +1 -1
- package/dist/client/assets/{XClose-dBx0FEAe.js → XClose-DCqhWNaS.js} +1 -1
- package/dist/client/assets/{Zap-BJCyzigO.js → Zap-CPTWGjTM.js} +1 -1
- package/dist/client/assets/{ZapSquare-CJ6AZAbk.js → ZapSquare-BvMNCS-J.js} +1 -1
- package/dist/client/assets/{ZoomOut-B2ojfl-A.js → ZoomOut-CW29g7dT.js} +1 -1
- package/dist/client/assets/{access-gate-DR6xMqvH.js → access-gate-pr0ODfb7.js} +1 -1
- package/dist/client/assets/{accordion-CQcOq9Y1.js → accordion-CU40J33b.js} +1 -1
- package/dist/client/assets/{add-section-modal-55MbBlme.js → add-section-modal-BWm2AJ0q.js} +1 -1
- package/dist/client/assets/{agent-capabilities-CtOghWTY.js → agent-capabilities-yZ8XaTX2.js} +1 -1
- package/dist/client/assets/{agent-icon-BIiUgn6T.js → agent-icon-BFDCs9_Z.js} +1 -1
- package/dist/client/assets/{agents-list-BC6bGl1F.js → agents-list-BKJtJMvc.js} +1 -1
- package/dist/client/assets/{ai-providers-CF2sNVXk.js → ai-providers-CJkHlX6K.js} +1 -1
- package/dist/client/assets/{alert-C0EsYqWw.js → alert-DiRsUmKf.js} +1 -1
- package/dist/client/assets/{alert-dialog-DH_8ED2c.js → alert-dialog-CC8Nrrwj.js} +1 -1
- package/dist/client/assets/app-editor-B5OzMkUT.js +1 -0
- package/dist/client/assets/{auth-DMsnFrvi.js → auth-DJSYPeCk.js} +1 -1
- package/dist/client/assets/{auth-catchall-B3-iMOVk.js → auth-catchall-Dx2KpvhV.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DUkVa1zJ.js → auth-split-layout-BV7u2yqx.js} +1 -1
- package/dist/client/assets/{automation-list-row-H0j7w0mf.js → automation-list-row-Cjxizj0b.js} +1 -1
- package/dist/client/assets/{automation-runs-iFgQkQtG.js → automation-runs-DNXo6gXs.js} +1 -1
- package/dist/client/assets/{automations-C6K_k2_u.js → automations-rHCkM3Cy.js} +1 -1
- package/dist/client/assets/{avatar-D47Jk04K.js → avatar-UnU39lqG.js} +1 -1
- package/dist/client/assets/{badge-B4Q3Kugn.js → badge-CXi-6wCL.js} +1 -1
- package/dist/client/assets/{brand-context-BflLJViw.js → brand-context-B1jHlQ7w.js} +1 -1
- package/dist/client/assets/{buckets-Cer0snSA.js → buckets-CahkUhkJ.js} +1 -1
- package/dist/client/assets/{calendar-BOtLk06o.js → calendar-Cn9BXXgq.js} +1 -1
- package/dist/client/assets/{capability-load-error-CXdwr2J6.js → capability-load-error-CvEelInB.js} +1 -1
- package/dist/client/assets/{card-LUxcXBOp.js → card-Cq52ff9r.js} +1 -1
- package/dist/client/assets/{chat-context-BJ1vdoQm.js → chat-context-nmnUXp-5.js} +1 -1
- package/dist/client/assets/{checkbox-CHqLn2TQ.js → checkbox-ACcWh1Vf.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CjN24BgV.js → cli-auth-success-8DGAcvK3.js} +1 -1
- package/dist/client/assets/{collection-detail-Ba7yJUvR.js → collection-detail-Dc0wdNuQ.js} +1 -1
- package/dist/client/assets/{collection-display-button-DuPg0P2z.js → collection-display-button-C-bIStw0.js} +1 -1
- package/dist/client/assets/{collection-search-BJmgl3qg.js → collection-search-DJZ5WWKp.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BpQMr64m.js → collection-table-wrapper-2_d3hKf_.js} +1 -1
- package/dist/client/assets/{collection-tabs-BjDLPumD.js → collection-tabs-Bx2Va-P2.js} +1 -1
- package/dist/client/assets/{collections-_vOvxoxw.js → collections-Cz3-h9U0.js} +1 -1
- package/dist/client/assets/{command-DEfANLSd.js → command-CCjZZZ4C.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-D5KjXYkQ.js → connect-desktop-dialog-yl6ZKtjx.js} +1 -1
- package/dist/client/assets/{connection-card-CmfMbikw.js → connection-card-BOpbcSN7.js} +1 -1
- package/dist/client/assets/{connection-detail-vdtWGKC_.js → connection-detail-BhNOEOgd.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-BzM5voPg.js → connection-form-helpers-Dxk2MmY9.js} +1 -1
- package/dist/client/assets/{connections-CUS_xbnw.js → connections-DXtBWmBY.js} +1 -1
- package/dist/client/assets/{decopilot-DdFCWM0M.js → decopilot-BGmtBq14.js} +1 -1
- package/dist/client/assets/decopilot-sse-pool-BFcQnN53.js +1 -0
- package/dist/client/assets/{dialog-DNvA-MUO.js → dialog-CzGAAvWN.js} +1 -1
- package/dist/client/assets/{domain-settings-DZsGHi4R.js → domain-settings-Cn4mDY1P.js} +1 -1
- package/dist/client/assets/{drawer-DaOnsuqJ.js → drawer-zoczdkVe.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BWTWFWGo.js → dropdown-menu-BkH8Xao7.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-ExZGsuej.js → dynamic-plugin-layout-vWV7hloc.js} +1 -1
- package/dist/client/assets/{empty-state-D4NUg8rC.js → empty-state-MVVoQnYY.js} +1 -1
- package/dist/client/assets/{empty-state-DDEvpq3s.js → empty-state-R63U5s81.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CkRoghUt.js → extract-connection-data-CmNoGcFu.js} +1 -1
- package/dist/client/assets/{features-BongOf8c.js → features-Cs6PsxeC.js} +1 -1
- package/dist/client/assets/{file-explorer-XfexYTEx.js → file-explorer-gLI4K_v7.js} +2 -2
- package/dist/client/assets/{file-type-icon-BkDt79pr.js → file-type-icon-gUlR8IWW.js} +1 -1
- package/dist/client/assets/{files-Bz4E67nD.js → files-BWYIjwc8.js} +1 -1
- package/dist/client/assets/{form-DrzcdlAc.js → form-CnR2V-ks.js} +1 -1
- package/dist/client/assets/{general-BVm3ASTD.js → general-GgcXrTtw.js} +1 -1
- package/dist/client/assets/{generate-id-CGijBPI-.js → generate-id-DGlkxVc2.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BeWTfzSO.js → github-repo-picker-C2KzUb3w.js} +1 -1
- package/dist/client/assets/{header-tab-button-zS78j2W5.js → header-tab-button-VslXzF2w.js} +1 -1
- package/dist/client/assets/{hover-card-B-GHi_m9.js → hover-card-CGVQKCuw.js} +1 -1
- package/dist/client/assets/{image-field-BSr72dUp.js → image-field-Jp564yvH.js} +1 -1
- package/dist/client/assets/{index-CATx2LDP.js → index-3A6UoYVV.js} +3 -3
- package/dist/client/assets/{index-ixf29u8o.js → index-B1ijey2B.js} +1 -1
- package/dist/client/assets/{index-DFVJVQA2.js → index-BfXyqNW3.js} +1 -1
- package/dist/client/assets/{index-C8Pyar_y.js → index-BiXwc5E0.js} +1 -1
- package/dist/client/assets/{index-BAd8YgC5.js → index-ByQPX0vL.js} +14 -14
- package/dist/client/assets/{index-CFFL2KPG.js → index-C39hLJ_E.js} +1 -1
- package/dist/client/assets/{index-DaZw25FU.js → index-CJXn_sOp.js} +1 -1
- package/dist/client/assets/{index-CYO3Ph9A.js → index-CPnOXYJR.js} +1 -1
- package/dist/client/assets/{index-BawfkDKi.js → index-CRvVErLg.js} +1 -1
- package/dist/client/assets/{index-N4G3Aj63.js → index-CuPmOMX1.js} +1 -1
- package/dist/client/assets/{index-BAj1MLDn.js → index-E1qbbJGV.js} +1 -1
- package/dist/client/assets/{index-ZvvZYF8M.js → index-HPKXkHKk.js} +1 -1
- package/dist/client/assets/{index-XrBr9Z6q.js → index-Oh8yJO5F.js} +1 -1
- package/dist/client/assets/{index-uJwxtRre.js → index-SIlwv3wO.js} +1 -1
- package/dist/client/assets/{index-CkRC9R0g.js → index-crwG5WD5.js} +1 -1
- package/dist/client/assets/{index-redirect-DVr8CNux.js → index-redirect-CtpwDDqx.js} +1 -1
- package/dist/client/assets/index-x1oWiCfZ.css +1 -0
- package/dist/client/assets/{input-mRhCdgaG.js → input-BO5qrDqG.js} +1 -1
- package/dist/client/assets/{integration-icon-BT5xGQIC.js → integration-icon-BOYFJ8DV.js} +1 -1
- package/dist/client/assets/{label-CfV-PYxa.js → label-BwpjeHse.js} +1 -1
- package/dist/client/assets/{layout-D1aQgp35.js → layout-kjQxtKiH.js} +1 -1
- package/dist/client/assets/{login-CZLccZp8.js → login-GrPo3thm.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CrqBOcGb.js → mcp-oauth-DQ0PJisw.js} +1 -1
- package/dist/client/assets/{members-7Zc6z3Rq.js → members-CaNyMEcY.js} +1 -1
- package/dist/client/assets/{monaco-editor-DEShyEoY.js → monaco-editor-CK8BXc9B.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BM39sgKM.js → monitoring-stats-row-BCMekdum.js} +1 -1
- package/dist/client/assets/{oauth-callback-Deog_8B9.js → oauth-callback-M9pqKkZ6.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-xndj3XhW.js → oauth-callback-ai-provider-C8VMML4x.js} +1 -1
- package/dist/client/assets/{onboarding-CIa5WJ8X.js → onboarding-DwMXPcr0.js} +1 -1
- package/dist/client/assets/{org-install-BzEXj1P0.js → org-install-CV4ZHpDg.js} +1 -1
- package/dist/client/assets/{org-layout-CKQErl_L.js → org-layout-DVQuykzD.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-C8fcylb0.js → org-plugin-layout-BtoR2QTw.js} +1 -1
- package/dist/client/assets/{page-seo-form-Bsto7oKw.js → page-seo-form-B7D3v3nU.js} +1 -1
- package/dist/client/assets/page-seo-sheet-DTNpeh0h.js +1 -0
- package/dist/client/assets/{pair-GelmpgQ4.js → pair-Dil5_pcO.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-DmX9NQ0c.js → plugin-empty-state-BzVqu6TN.js} +1 -1
- package/dist/client/assets/{plugin-header-CwlC7555.js → plugin-header-DWPYLa_u.js} +1 -1
- package/dist/client/assets/{plugin-layout-DXTE_nWx.js → plugin-layout-B5zr5ZNJ.js} +1 -1
- package/dist/client/assets/{popover-Djx3eehK.js → popover-LSofc-Ht.js} +1 -1
- package/dist/client/assets/{post-editor-vgnxCwvH.js → post-editor-D44H33Ev.js} +1 -1
- package/dist/client/assets/{primitives-CzBbBQlZ.js → primitives-B-tCjIZY.js} +1 -1
- package/dist/client/assets/{profile-CfZAUHfV.js → profile-CTOXeyrM.js} +1 -1
- package/dist/client/assets/project-app-view-BqNP4BqO.js +1 -0
- package/dist/client/assets/record-editor-DKxdQpOd.js +1 -0
- package/dist/client/assets/registry-fugAH1SF.js +2 -0
- package/dist/client/assets/{registry-layout-dZaBo1gQ.js → registry-layout-Ch3aq8dl.js} +1 -1
- package/dist/client/assets/{require-capability-BG1IhctK.js → require-capability-BxAO3wIs.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BIu6_zGe.js → required-auth-layout-DSM_VKs3.js} +1 -1
- package/dist/client/assets/{reset-password-CKpvPCzb.js → reset-password-D-GqFQGk.js} +1 -1
- package/dist/client/assets/{resizable-Cv_aeq4n.js → resizable-B4l6iV43.js} +1 -1
- package/dist/client/assets/{roles-C5F1SkRZ.js → roles-o1zt3GvN.js} +1 -1
- package/dist/client/assets/save-referenced-block-D3oE4sNG.js +1 -0
- package/dist/client/assets/{save-status-BBW-EIin.js → save-status-D6x5ygDT.js} +1 -1
- package/dist/client/assets/schema-form-DMYKUxBP.js +1 -0
- package/dist/client/assets/{scroll-area--D79tEKR.js → scroll-area-C_2w27J_.js} +1 -1
- package/dist/client/assets/{search-input-Bxn-rqNj.js → search-input-DVgXRiZR.js} +1 -1
- package/dist/client/assets/{secrets-ehDiMfv8.js → secrets-B0-mRRFx.js} +1 -1
- package/dist/client/assets/{sections-editor-DYjunrSM.js → sections-editor-C8bLzbs2.js} +1 -1
- package/dist/client/assets/{select-Cgf1CYEw.js → select-ZTWu_v20.js} +1 -1
- package/dist/client/assets/{select-model-C_VkZ9VQ.js → select-model-5lUJdDoI.js} +1 -1
- package/dist/client/assets/{seo-editor-BNfgWkza.js → seo-editor-BsQ-irXW.js} +1 -1
- package/dist/client/assets/{settings-layout-9tbfb6nK.js → settings-layout-DgPXs3pz.js} +1 -1
- package/dist/client/assets/{settings-section-DKCuI8RI.js → settings-section-Codz-oCA.js} +1 -1
- package/dist/client/assets/{sheet-BBLc_qUy.js → sheet-B0-Ak1q5.js} +1 -1
- package/dist/client/assets/{shell-controls-CiQQboR4.js → shell-controls-DeSD3a6S.js} +1 -1
- package/dist/client/assets/{shell-layout-uIwUEFHm.js → shell-layout-tz0do_YA.js} +1 -1
- package/dist/client/assets/{shell-route-loading-znYPD3vX.js → shell-route-loading-CelzgtUw.js} +1 -1
- package/dist/client/assets/{sidebar-BuWHGfqc.js → sidebar-BFHf_5hi.js} +1 -1
- package/dist/client/assets/{skeleton-BRChPnS2.js → skeleton-B67EiDJp.js} +1 -1
- package/dist/client/assets/{sortable.esm-BSN8qWvt.js → sortable.esm-MNP5qK3e.js} +1 -1
- package/dist/client/assets/{spinner-uDki_7Z8.js → spinner-DlDtfq8X.js} +1 -1
- package/dist/client/assets/{sso-Bpk5jRgU.js → sso-Bsbzg72v.js} +1 -1
- package/dist/client/assets/{store-DUo-qH8F.js → store-IInyfase.js} +1 -1
- package/dist/client/assets/store-registry-CsakCxO1.js +2 -0
- package/dist/client/assets/{studio-tools-Av8VgprY.js → studio-tools-5svO8SUS.js} +1 -1
- package/dist/client/assets/{switch-BCvTAJSU.js → switch-DeHeN4cz.js} +1 -1
- package/dist/client/assets/{tab-id-B-5zrrfX.js → tab-id-DbWeeC0G.js} +1 -1
- package/dist/client/assets/{table-CoPsT_qq.js → table-BsR0J7GU.js} +1 -1
- package/dist/client/assets/{tabs-DevQrGCr.js → tabs-giJtwkTu.js} +1 -1
- package/dist/client/assets/{task-status-DfBkdT3D.js → task-status-Dn4t1RRN.js} +1 -1
- package/dist/client/assets/{textarea-QDTInyWb.js → textarea-DzhddUkP.js} +1 -1
- package/dist/client/assets/{toggle-group-BJNcAi1V.js → toggle-group-CxFiGMEf.js} +1 -1
- package/dist/client/assets/{toolbar-n5eK8Q5W.js → toolbar-CLFrtQQ_.js} +1 -1
- package/dist/client/assets/{tools-list-DRP2WIO_.js → tools-list-Dl7cbDhm.js} +1 -1
- package/dist/client/assets/{tooltip-1mt0C65x.js → tooltip-DQDMg1b1.js} +1 -1
- package/dist/client/assets/{types-C-U3Ts-j.js → types-UvP9C7p3.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DrMdym73.js → use-ai-providers-Cr46upMo.js} +1 -1
- package/dist/client/assets/{use-automations-CcLdI8uN.js → use-automations-BBUkUQ8G.js} +1 -1
- package/dist/client/assets/{use-capability-Ctju3DPP.js → use-capability-CGkc4knN.js} +1 -1
- package/dist/client/assets/{use-clock-tick-C75wEYcQ.js → use-clock-tick-CzJnQlQG.js} +1 -1
- package/dist/client/assets/{use-collections-ByNVa1P1.js → use-collections-BLfqGVtV.js} +1 -1
- package/dist/client/assets/{use-connection-5fAWFRJ_.js → use-connection-BfMAeb_Q.js} +1 -1
- package/dist/client/assets/{use-copy-xQaZthc_.js → use-copy-9Wdzru7Q.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-K5P4r7gs.js → use-create-virtual-mcp-wvSq76wx.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-B6us4Px1.js → use-debounced-autosave-u9qG0ZTU.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BRozsEjt.js → use-delete-connection-Bn5bXVXX.js} +1 -1
- package/dist/client/assets/{use-file-configs-nuDPJJdx.js → use-file-configs-mXTuB2DX.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CzLnKKRE.js → use-infinite-scroll-DYawWhKj.js} +1 -1
- package/dist/client/assets/{use-list-state-DUnsuQSl.js → use-list-state-B2iOzg-i.js} +1 -1
- package/dist/client/assets/{use-mcp-client-SlmBrgfs.js → use-mcp-client-BMnsqIXj.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BS6YGKJi.js → use-mcp-prompts-DL4LuXlA.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DJTjDxAS.js → use-mcp-tools-CKRfS_sl.js} +1 -1
- package/dist/client/assets/{use-members-Ceh2no3q.js → use-members-U0leyacB.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CSNmmW1c.js → use-navigate-to-agent-BlOVhScz.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CNwi-nzI.js → use-org-auth-client-CoUwF4oC.js} +1 -1
- package/dist/client/assets/{use-org-sso-DJ7AQqIg.js → use-org-sso-BGuT9jdE.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DMeQF3Y-.js → use-organization-roles-DTKSy2kY.js} +1 -1
- package/dist/client/assets/{use-organization-settings-D0hAXIi9.js → use-organization-settings-CAAXrkPr.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CUSj2SXo.js → use-registry-connections-Df7awY3K.js} +1 -1
- package/dist/client/assets/{use-secrets-BPqsqJsG.js → use-secrets-Bu639qz1.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DiIUarno.js → use-status-sounds-5hLXwCVP.js} +1 -1
- package/dist/client/assets/{use-view-mode-40X1ior9.js → use-view-mode-C9kxudo3.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CU7uEJL7.js → use-virtual-mcp-eosOOizO.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CWjuZK4m.js +1 -0
- package/dist/client/assets/{useRouterState-CFGs8v1R.js → useRouterState-DDFrbGVN.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-9Cg4OZk0.js +1 -0
- package/dist/client/assets/{user-CW9-suBt.js → user-CtUl632O.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CRuQE6Gp.js → view-mode-toggle-CfpE5tGI.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-Dk5ELrHR.js → watch-sse-pool-BIuphsPs.js} +1 -1
- package/dist/client/assets/{workflow-yvNNhsP9.js → workflow-DaKB0r8h.js} +1 -1
- package/dist/client/assets/workflow-detail-CVZkvgvJ.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/app-editor-iZwP6h8z.js +0 -1
- package/dist/client/assets/decopilot-sse-pool-Bxs_zfqE.js +0 -1
- package/dist/client/assets/index-DfYyH4IW.css +0 -1
- package/dist/client/assets/page-seo-sheet-DgBZvqMn.js +0 -1
- package/dist/client/assets/project-app-view-CWx732eY.js +0 -1
- package/dist/client/assets/record-editor-YgNVDF0i.js +0 -1
- package/dist/client/assets/registry-DsHjSNw5.js +0 -2
- package/dist/client/assets/save-referenced-block-BFfdfLwW.js +0 -1
- package/dist/client/assets/schema-form-e-mnDCXf.js +0 -1
- package/dist/client/assets/store-registry-DUOhtiaZ.js +0 -2
- package/dist/client/assets/useInfiniteQuery-Dj9YLZ3r.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CACV_JG8.js +0 -1
- package/dist/client/assets/workflow-detail-DkjxBQfg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as $,p as Se,K as re,b8 as dt,m as Re,j as s,c as K,l as fe,B as ne,e as H,P as Pe,aE as Ie,R as se,aG as De,aH as ke,F as $e,G as mt,H as ut,a as Fe,n as he,t as Oe,D as Ke,s as ft,E as ht,f as gt,d as xt}from"./index-CATx2LDP.js";import{u as pt}from"./use-organization-roles-DMeQF3Y-.js";import{u as je}from"./use-org-auth-client-CNwi-nzI.js";import{B as ge}from"./badge-B4Q3Kugn.js";import{A as Qe,a as He,b as qe,c as Ze,d as Xe,f as Je,e as We,g as et}from"./alert-dialog-DH_8ED2c.js";import{D as bt,a as Et,b as Tt,c as _t}from"./dropdown-menu-BWTWFWGo.js";import{i as It}from"./DotsVertical-BJVJdITZ.js";import{s as Ae}from"./Plus-C5heVoJ6.js";import{s as St}from"./Trash01-DM00_xyO.js";import{C as Nt}from"./collection-table-wrapper-BpQMr64m.js";import{P as te}from"./index-BawfkDKi.js";import{E as Ge}from"./empty-state-DDEvpq3s.js";import{S as ve}from"./search-input-Bxn-rqNj.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-BT5xGQIC.js";import{u as Ct}from"./use-infinite-scroll-CzLnKKRE.js";import{C as we}from"./checkbox-CHqLn2TQ.js";import{i as At}from"./RefreshCcw01-BZry-3Kg.js";import{u as Rt}from"./useSuspenseInfiniteQuery-CACV_JG8.js";import{u as Ot,a as jt}from"./use-mcp-client-SlmBrgfs.js";import{C as vt}from"./collection-search-BJmgl3qg.js";import{u as nt}from"./use-members-Ceh2no3q.js";import{u as yt}from"./use-connection-5fAWFRJ_.js";import{u as wt,d as Lt}from"./use-ai-providers-DrMdym73.js";import{A as lt}from"./avatar-D47Jk04K.js";import{S as xe}from"./switch-BCvTAJSU.js";import{c as pe,b as be,T as Ee,a as Te}from"./tooltip-1mt0C65x.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-DKCuI8RI.js";import{t as Mt}from"./ChevronDown-2xes5oAP.js";import{i as Pt}from"./ChevronRight-BAb1spam.js";import{i as ze}from"./X-C_bQSA-d.js";import{a as Dt}from"./use-capability-Ctju3DPP.js";import{A as kt}from"./access-gate-DR6xMqvH.js";import"./Check-g3DB8Y79.js";import"./table-CoPsT_qq.js";import"./SwitchHorizontal01-CUtzfg9y.js";import"./sidebar-BuWHGfqc.js";import"./LayoutLeft-DFTfTIl4.js";import"./sheet-BBLc_qUy.js";import"./SearchMd-qFqO3CC6.js";import"./Container-SX43EreL.js";import"./agent-icon-BIiUgn6T.js";import"./AlertCircle-CHkhp8BT.js";import"./Tool01-IpmKT80v.js";import"./XCircle-D9AGwgGK.js";import"./ArrowUpRight-BLDnDQA4.js";import"./ZapSquare-CJ6AZAbk.js";import"./Users03-1mzpWPfB.js";import"./CheckCircle-CaqJ0h8v.js";import"./ChevronLeft-DoZaWCdC.js";import"./ChevronUp-D1fwNmdw.js";import"./Eye-B6_-sQMR.js";import"./ZoomOut-B2ojfl-A.js";import"./Globe01-BaaIcJuv.js";import"./FilterLines-Bppcas54.js";import"./Star01-2SOe9QD-.js";import"./Palette-VBLL4nJC.js";import"./HardDrive-DCOTq5uv.js";import"./Stars02-CEd2BxY_.js";import"./Key01-WyguyLzq.js";import"./LinkExternal01-C4yAqYts.js";import"./Monitor01-rl2bcoeM.js";import"./Sun-jizGeY2D.js";import"./Play-Cjs1Q-Aw.js";import"./Settings02-CLIbq_7z.js";import"./Shield01-Bo6JmLSx.js";import"./Stars01-C-iKmdEF.js";import"./Upload01-D0E7TXXq.js";import"./User01-ga9dWIix.js";import"./Users01-lGeZPP0U.js";import"./XClose-dBx0FEAe.js";import"./Zap-BJCyzigO.js";import"./auth-DMsnFrvi.js";import"./use-collections-ByNVa1P1.js";import"./card-LUxcXBOp.js";import"./capability-load-error-CXdwr2J6.js";const Le="basic-usage",Me=[{id:Le,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Me.find(t=>t.id===Le)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===Le)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=H.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(we,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Se(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,T=h.trim(),E=T?{operator:"or",conditions:[{field:["title"],operator:"contains",value:T},{field:["description"],operator:"contains",value:T}]}:void 0,N=!!n,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:R,hasNextPage:p,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(R,p??!1,O),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,w=x.current,A=[...w.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!w.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[L,z]=$.useState(G[0]?.id??null),y=L?G.find(b=>b.id===L)??null:null,{data:M,isFetching:Y}=Re({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",L??""),queryFn:async()=>L?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:L}})).structuredContent?.item??null:null,enabled:!!L,staleTime:3e4}),F=M?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===L?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=L===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:X(y.id,b.name),onToggle:()=>J(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Ne=["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"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ht(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??Ne[0]}function qt(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=H.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const R=x.flatMap(es).flatMap(Wt);i(!1),r(R.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:R}=v;return{section:_,capabilities:R.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Jt);let T;e[12]!==n||e[13]!==i||e[14]!==r?(T=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=T):T=e[15];let E;e[16]!==n||e[17]!==c||e[18]!==T?(E=Ye(n,c,T),e[16]=n,e[17]=c,e[18]=T,e[19]=E):E=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==E||e[26]!==N?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:E,onClick:N})})}),e[25]=E,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:R}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:R.map(p=>{const O=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(O,c,()=>o(p,O)),onClick:c?void 0:()=>o(p,O)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Jt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=H.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[S,T]=$.useState(m),E=m||S,N=T,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const R=_;let p;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],p=d.filter(j),e[4]=R,e[5]=d,e[6]=p}else p=e[6];const O=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=()=>N(cs),e[24]=w):w=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==O||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let L;e[36]!==E?(L=E?s.jsx(Mt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,e[37]=L):L=e[37];let z;e[38]!==L||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,L]}),e[38]=L,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:w,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(M=>{const Y=R(M.id),F=()=>{if(!o){if(g){x(n,h,M.id);return}a(n,M.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=O,e[13]=E,e[14]=r,e[15]=R,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Lt(n.id);let a,x,o,m,S;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){S=null;break e}const R=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=R.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),R.set(k,G)}const p=Array.from(R.entries()).map(fs).sort(us),O=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let w;e[21]!==u?(w=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=w):w=e[22],e[23]!==w||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,w]}),e[23]=w,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:O},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let T;e[26]!==a||e[27]!==x?(T=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=T):T=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==T?(E=s.jsxs("div",{className:o,children:[m,T]}),e[29]=o,e[30]=m,e[31]=T,e[32]=E):E=e[32],E}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=H.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=wt();let a;e[0]!==l||e[1]!==r?(a=(p,O)=>{const I=l[p]??[],j={...l};if(I.includes(O)){const u=I.filter(w=>w!==O);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,O];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,O,I)=>{i(!1),r({...l,[p]:O.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let T;e[7]!==S?(T=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=T):T=e[8];let E;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==T||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:T,onClick:E,children:[N,C]}),e[20]=T,e[21]=E,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let R;return e[32]!==_||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=R):R=e[34],R}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,S,T,E,N,C,v,_,R,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const M=c.toLowerCase();return y.user?.name?.toLowerCase().includes(M)||y.user?.email?.toLowerCase().includes(M)},e[20]=c,e[21]=B):B=e[21];const L=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],S=z,m=Qe,R=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Xe,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],N="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],T="flex-1 overflow-auto",E=L.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:L.map(y=>{const M=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!M||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!M||Y}),s.jsx(lt,{url:y.user?.image??void 0,fallback:ot(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!M&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=S,e[12]=T,e[13]=E,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=R,e[19]=p}else o=e[9],m=e[10],S=e[11],T=e[12],E=e[13],N=e[14],C=e[15],v=e[16],_=e[17],R=e[18],p=e[19];let O;e[29]!==T||e[30]!==E?(O=s.jsx("div",{className:T,children:E}),e[29]=T,e[30]=E,e[31]=O):O=e[31];let I;e[32]!==O||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,O]}),e[32]=O,e[33]=N,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,w=f.length>0&&`(${f.length})`;let A;e[37]!==S||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",w]})]}),e[37]=S,e[38]=u,e[39]=w,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==R||e[50]!==p?(G=s.jsx(m,{open:R,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=p,e[51]=G):G=e[51],G}function Es(t){const e=H.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,S;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const R=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const O=R.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:O.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:I.user?.image??void 0,fallback:ot(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=S}else o=e[7],m=e[8],S=e[9];let T;e[14]!==o||e[15]!==m?(T=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=T):T=e[16];let E;e[17]!==n||e[18]!==l?(E=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=E):E=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==E?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:E}),e[20]=h,e[21]=n,e[22]=c,e[23]=E,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==T||e[27]!==N?(C=s.jsxs("div",{className:S,children:[T,N]}),e[25]=S,e[26]=T,e[27]=N,e[28]=C):C=e[28],C}function Ts(t){const e=H.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Es,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ss(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ns(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ss(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=H.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Te,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Rs(t){const e=H.c(14),{locator:n}=Se(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Re(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Os,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Os({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,S=o.formState.isDirty,T=Fe({mutationFn:async u=>{const w=Ns(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const L=l.filter(M=>M.role===(B??U)).map(M=>M.id),z=u.memberIds.filter(M=>!L.includes(M)),y=L.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of y){const Y=await d.organization.updateMemberRole({memberId:M,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,L=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...L?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(L?U:B,L?B:void 0),L?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:w});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const L=await d.organization.updateMemberRole({memberId:B,role:[A]});if(L?.error)throw new Error(L.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,w)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!w.role.id&&!w.role.slug,k=w.role.slug==="owner"&&!w.role.id;Oe(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:w.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}T.mutate(u)}),N=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,R]=$.useState(""),[p,O]=$.useState(!1),I=u=>{x(u),R("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:T.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:E,disabled:T.isPending||!m||!S,children:T.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?qt(t.role):Ht(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Xt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Ts,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:O})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["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"];function ws(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const Ls={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ms(t,e){return e?Ls[t]??"bg-neutral-400":ws(t)}function Ps(){const t=H.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Se(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);S=V?{kind:"custom",role:V}:null}const T=S;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==E||t[10]!==N?(C={queryKey:E,queryFn:N},t[9]=E,t[10]=N,t[11]=C):C=t[11];const{data:v}=Re(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const R=_;let p;t[14]!==R?(p=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=p):p=t[15];const O=p;let I;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=O,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Oe("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),T?.kind==="custom"&&T.role.id===V&&m(void 0)},onError:zs});let w,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},w={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=w,t[27]=A,t[28]=k,t[29]=G):(w=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,w,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(bt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(It,{size:16})})}),s.jsx(Tt,{align:"end",onClick:Ds,children:s.jsxs(_t,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let L;t[31]!==m?(L=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=L):L=t[32];const z=L;if(T){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Rs,{target:T,onBack:P,onSaved:V},js(T))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let X;t[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Ae,{size:16}),t[44]=X):X=t[44];let J;t[45]!==F?(J=s.jsxs(ne,{onClick:F,children:[X,"Create Role"]}),t[45]=F,t[46]=J):J=t[46];let le;t[47]!==Y||t[48]!==J?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,J]}),t[47]=Y,t[48]=J,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(Nt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,s.jsxs(Xe,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(He,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ms(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Oe("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{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 roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function fl(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{fl as default};
|
|
1
|
+
import{r as $,p as Se,K as re,b8 as dt,m as Re,j as s,c as K,l as fe,B as ne,e as H,P as Pe,aE as Ie,R as se,aG as De,aH as ke,F as $e,G as mt,H as ut,a as Fe,n as he,t as Oe,D as Ke,s as ft,E as ht,f as gt,d as xt}from"./index-3A6UoYVV.js";import{u as pt}from"./use-organization-roles-DTKSy2kY.js";import{u as je}from"./use-org-auth-client-CoUwF4oC.js";import{B as ge}from"./badge-CXi-6wCL.js";import{A as Qe,a as He,b as qe,c as Ze,d as Xe,f as Je,e as We,g as et}from"./alert-dialog-CC8Nrrwj.js";import{D as bt,a as Et,b as Tt,c as _t}from"./dropdown-menu-BkH8Xao7.js";import{i as It}from"./DotsVertical-DaPu-BjL.js";import{s as Ae}from"./Plus-p5ww31iK.js";import{s as St}from"./Trash01-DwmURdtf.js";import{C as Nt}from"./collection-table-wrapper-2_d3hKf_.js";import{P as te}from"./index-CRvVErLg.js";import{E as Ge}from"./empty-state-R63U5s81.js";import{S as ve}from"./search-input-DVgXRiZR.js";import{P as tt,D as st}from"./ai-providers-logos-DD3qZ33J.js";import{I as ye}from"./integration-icon-BOYFJ8DV.js";import{u as Ct}from"./use-infinite-scroll-DYawWhKj.js";import{C as we}from"./checkbox-ACcWh1Vf.js";import{i as At}from"./RefreshCcw01-BFs2Qz_9.js";import{u as Rt}from"./useSuspenseInfiniteQuery-9Cg4OZk0.js";import{u as Ot,a as jt}from"./use-mcp-client-BMnsqIXj.js";import{C as vt}from"./collection-search-DJZ5WWKp.js";import{u as nt}from"./use-members-U0leyacB.js";import{u as yt}from"./use-connection-BfMAeb_Q.js";import{u as wt,d as Lt}from"./use-ai-providers-Cr46upMo.js";import{A as lt}from"./avatar-UnU39lqG.js";import{S as xe}from"./switch-DeHeN4cz.js";import{c as pe,b as be,T as Ee,a as Te}from"./tooltip-DQDMg1b1.js";import{S as Ue,a as Be,b as Ve}from"./settings-section-Codz-oCA.js";import{t as Mt}from"./ChevronDown-D6Zecsff.js";import{i as Pt}from"./ChevronRight-DVoYZuHq.js";import{i as ze}from"./X-BgKKVHlr.js";import{a as Dt}from"./use-capability-CGkc4knN.js";import{A as kt}from"./access-gate-pr0ODfb7.js";import"./Check-hOMWkijh.js";import"./table-BsR0J7GU.js";import"./SwitchHorizontal01-FJhkXGab.js";import"./sidebar-BFHf_5hi.js";import"./LayoutLeft-BK03sAXS.js";import"./sheet-B0-Ak1q5.js";import"./SearchMd-Ds9YnLOw.js";import"./Container-B5dlvIhN.js";import"./agent-icon-BFDCs9_Z.js";import"./AlertCircle-Ed8WT4Gj.js";import"./Tool01-iIvrrn5i.js";import"./XCircle-4DVMD60R.js";import"./ArrowUpRight-C-Lwk46I.js";import"./ZapSquare-BvMNCS-J.js";import"./Users03-OjZAoe5s.js";import"./CheckCircle-DaXMnsEo.js";import"./ChevronLeft-D-XrQc44.js";import"./ChevronUp-Dl9jzSxx.js";import"./Eye-BKIYBCFX.js";import"./ZoomOut-CW29g7dT.js";import"./Globe01-IHgKWLQG.js";import"./FilterLines-ClAdcVIA.js";import"./Star01-CZv8qd6s.js";import"./Palette-NCjk3FGG.js";import"./HardDrive-D-m2ZipN.js";import"./Stars02-BJ8W7Y3C.js";import"./Key01-BdHvOh_e.js";import"./LinkExternal01-Dnhttb39.js";import"./Monitor01-Dcp9PrZz.js";import"./Sun-Cwmha-a2.js";import"./Play-BpEe0tlc.js";import"./Settings02-CecILrtY.js";import"./Shield01-vLzXztr0.js";import"./Stars01-Ch5iJcxR.js";import"./Upload01-oRevAfqv.js";import"./User01-h8GKw08y.js";import"./Users01-CFNaA2uI.js";import"./XClose-DCqhWNaS.js";import"./Zap-CPTWGjTM.js";import"./auth-DJSYPeCk.js";import"./use-collections-BLfqGVtV.js";import"./card-Cq52ff9r.js";import"./capability-load-error-CvEelInB.js";const Le="basic-usage",Me=[{id:Le,label:"Basic Usage",description:"Tools all org members can access by default",section:"Basic Usage",tools:["COLLECTION_CONNECTIONS_LIST","COLLECTION_CONNECTIONS_GET","CONNECTION_TEST","COLLECTION_VIRTUAL_MCP_LIST","COLLECTION_VIRTUAL_MCP_GET","VIRTUAL_MCP_PLUGIN_CONFIG_GET","VIRTUAL_MCP_LAST_USED_LIST","AUTOMATION_GET","AUTOMATION_LIST","AUTOMATION_RUN_STATS","AI_PROVIDERS_LIST","AI_PROVIDERS_LIST_MODELS","AI_PROVIDERS_ACTIVE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_CREDITS","AI_PROVIDER_TOPUP_URL","LIST_OBJECTS","GET_OBJECT_METADATA","GET_PRESIGNED_URL","PUT_PRESIGNED_URL","FILE_OBJECTS_LIST","SANDBOX_START","SANDBOX_DELETE","GLOBAL_SEARCH","ORGANIZATION_SETTINGS_GET","USER_GET","LINK_CURRENT_GET","LINK_DISCONNECT","BRAND_CONTEXT_LIST","COLLECTION_THREADS_CREATE","COLLECTION_THREADS_LIST","COLLECTION_THREADS_GET","COLLECTION_THREADS_UPDATE","COLLECTION_THREADS_DELETE","COLLECTION_THREAD_MESSAGES_LIST"]},{id:"org:manage",label:"Manage organization",description:"Edit organization settings, brand context, and domain configuration",section:"Organization",tools:["ORGANIZATION_GET","ORGANIZATION_LIST","ORGANIZATION_UPDATE","ORGANIZATION_SETTINGS_GET","ORGANIZATION_SETTINGS_UPDATE","BRAND_CONTEXT_LIST","BRAND_CONTEXT_GET","BRAND_CONTEXT_CREATE","BRAND_CONTEXT_UPDATE","BRAND_CONTEXT_DELETE","BRAND_CONTEXT_EXTRACT","BRAND_GET","BRAND_LIST","ORGANIZATION_DOMAIN_GET","ORGANIZATION_DOMAIN_SET","ORGANIZATION_DOMAIN_UPDATE","ORGANIZATION_DOMAIN_CLEAR"]},{id:"members:manage",label:"Manage members",description:"Invite members, remove them, and change their roles",section:"Organization",tools:["ORGANIZATION_MEMBER_LIST","ORGANIZATION_MEMBER_ADD","ORGANIZATION_MEMBER_REMOVE","ORGANIZATION_MEMBER_UPDATE_ROLE"],dangerous:!0},{id:"connections:manage",label:"Manage connections",description:"Create, update, and delete connections",section:"Connections & Agents",tools:["COLLECTION_CONNECTIONS_CREATE","COLLECTION_CONNECTIONS_UPDATE","COLLECTION_CONNECTIONS_DELETE"],dangerous:!0},{id:"agents:manage",label:"Manage agents",description:"Create, configure, and delete agents",section:"Connections & Agents",tools:["COLLECTION_VIRTUAL_MCP_CREATE","COLLECTION_VIRTUAL_MCP_UPDATE","COLLECTION_VIRTUAL_MCP_DELETE","VIRTUAL_MCP_PLUGIN_CONFIG_UPDATE","VIRTUAL_MCP_PINNED_VIEWS_UPDATE"],dangerous:!0},{id:"automations:manage",label:"Manage automations",description:"Create, update, run, and delete automations",section:"Automations",tools:["AUTOMATION_CREATE","AUTOMATION_UPDATE","AUTOMATION_DELETE","AUTOMATION_TRIGGER_ADD","AUTOMATION_TRIGGER_REMOVE","AUTOMATION_TRIGGER_ROTATE_TOKEN","AUTOMATION_RUN"],dangerous:!0},{id:"monitoring:view",label:"View monitoring",description:"Access logs and usage statistics",section:"Monitoring",tools:["MONITORING_LOG_GET","MONITORING_LOGS_LIST","MONITORING_STATS","MONITORING_THREAD_USAGE"]},{id:"secrets:manage",label:"Manage secrets",description:"Create and list secrets stored in the credential vault",section:"Organization",tools:["SECRET_CREATE","SECRET_LIST"]},{id:"file-configs:manage",label:"Manage file configs",description:"Create, list, update and delete S3 bucket configurations",section:"Organization",tools:["FILE_CONFIG_CREATE","FILE_CONFIG_LIST","FILE_CONFIG_UPDATE","FILE_CONFIG_DELETE","FILE_OBJECTS_LIST"]},{id:"ai-providers:manage",label:"Manage AI providers",description:"Add or remove API keys and provision provider credentials",section:"AI Providers",tools:["AI_PROVIDER_KEY_CREATE","AI_PROVIDER_KEY_LIST","AI_PROVIDER_KEY_DELETE","AI_PROVIDER_KEY_UPDATE","AI_PROVIDER_KEY_PREVIEW","AI_PROVIDER_OAUTH_URL","AI_PROVIDER_OAUTH_EXCHANGE","AI_PROVIDER_PROVISION_KEY","AI_PROVIDER_TOPUP_URL","AI_PROVIDER_CREDITS"]},{id:"tags:manage",label:"Manage tags",description:"Create, assign, and delete organization tags",section:"Organization",tools:["TAGS_LIST","TAGS_CREATE","TAGS_DELETE","MEMBER_TAGS_GET","MEMBER_TAGS_SET"]},{id:"registry:manage",label:"Manage registry",description:"Browse, publish, and manage items in the registry",section:"Store & Registry",tools:["COLLECTION_REGISTRY_APP_LIST","COLLECTION_REGISTRY_APP_GET","COLLECTION_REGISTRY_APP_VERSIONS","COLLECTION_REGISTRY_APP_FILTERS","REGISTRY_ITEM_LIST","REGISTRY_ITEM_SEARCH","REGISTRY_ITEM_GET","REGISTRY_ITEM_VERSIONS","REGISTRY_ITEM_FILTERS","REGISTRY_DISCOVER_TOOLS","REGISTRY_ITEM_CREATE","REGISTRY_ITEM_BULK_CREATE","REGISTRY_ITEM_UPDATE","REGISTRY_ITEM_DELETE","REGISTRY_AI_GENERATE","REGISTRY_PUBLISH_REQUEST_LIST","REGISTRY_PUBLISH_REQUEST_REVIEW","REGISTRY_PUBLISH_REQUEST_COUNT","REGISTRY_PUBLISH_REQUEST_DELETE","REGISTRY_PUBLISH_API_KEY_GENERATE","REGISTRY_PUBLISH_API_KEY_LIST","REGISTRY_PUBLISH_API_KEY_REVOKE"],dangerous:!0},{id:"registry:monitor",label:"Monitor registry health",description:"Run health checks on registry connections and view results",section:"Store & Registry",tools:["REGISTRY_MONITOR_RUN_START","REGISTRY_MONITOR_RUN_LIST","REGISTRY_MONITOR_RUN_GET","REGISTRY_MONITOR_RUN_CANCEL","REGISTRY_MONITOR_RESULT_LIST","REGISTRY_MONITOR_CONNECTION_LIST","REGISTRY_MONITOR_CONNECTION_SYNC","REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH","REGISTRY_MONITOR_SCHEDULE_SET","REGISTRY_MONITOR_SCHEDULE_CANCEL"]},{id:"api-keys:manage",label:"Manage API keys",description:"Create, update, and revoke API keys",section:"Developer",tools:["API_KEY_CREATE","API_KEY_LIST","API_KEY_UPDATE","API_KEY_DELETE"]},{id:"event-bus:use",label:"Use event bus",description:"Publish events and manage subscriptions",section:"Developer",tools:["EVENT_PUBLISH","EVENT_SUBSCRIBE","EVENT_UNSUBSCRIBE","EVENT_CANCEL","EVENT_ACK","EVENT_SUBSCRIPTION_LIST","EVENT_SYNC_SUBSCRIPTIONS"]},{id:"storage:delete",label:"Delete from storage",description:"Permanently delete files from object storage",section:"Developer",tools:["DELETE_OBJECT","DELETE_OBJECTS"],dangerous:!0},{id:"connections:sql",label:"Run SQL queries",description:"Execute raw SQL against connected databases",section:"Developer",tools:["DATABASES_RUN_SQL"],dangerous:!0}];[...Me.find(t=>t.id===Le)?.tools??[]];const Gt=["agents:manage","connections:manage"];new Set(Me.filter(t=>Gt.includes(t.id)).flatMap(t=>t.tools));function Ut(){const t=new Map;for(const e of Me){if(e.id===Le)continue;const n=t.get(e.section)??[];n.push(e),t.set(e.section,n)}return Array.from(t.entries()).map(([e,n])=>({section:e,capabilities:n}))}function Bt(t,e,n){return n?!0:t.tools.every(l=>e.includes(l))}function Vt(t,e,n){if(n){const i=new Set(e);for(const r of t.tools)i.add(r);return Array.from(i)}const l=new Set(e);for(const i of t.tools)l.delete(i);return Array.from(l)}function zt(t){const e=H.c(21),{connection:n,isSelected:l,hasToolsEnabled:i,activeToolsCount:r,totalToolsCount:d,onSelect:h,onToggle:c}=t,g=l?"bg-accent/50":"hover:bg-muted/50";let f;e[0]!==g?(f=K("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",g),e[0]=g,e[1]=f):f=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(ye,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let x;e[5]!==n.title?(x=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=x):x=e[6];let o;e[7]!==h||e[8]!==a||e[9]!==x?(o=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:h,children:[a,x]}),e[7]=h,e[8]=a,e[9]=x,e[10]=o):o=e[10];let m;e[11]!==r||e[12]!==n.tools||e[13]!==i||e[14]!==c||e[15]!==d?(m=n.tools&&n.tools.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[r,"/",d]}),s.jsx(we,{checked:i,onCheckedChange:c,onClick:Yt})]}),e[11]=r,e[12]=n.tools,e[13]=i,e[14]=c,e[15]=d,e[16]=m):m=e[16];let S;return e[17]!==f||e[18]!==o||e[19]!==m?(S=s.jsxs("div",{className:f,children:[o,m]}),e[17]=f,e[18]=o,e[19]=m,e[20]=S):S=e[20],S}function Yt(t){return t.stopPropagation()}function $t(t){const e=H.c(18),{connectionId:n,tool:l,isSelected:i,onToggle:r}=t,d=`tool-${n}-${l.name}`,h=i?"text-foreground":"text-muted-foreground";let c;e[0]!==h?(c=K("text-sm font-medium",h),e[0]=h,e[1]=c):c=e[1];let g;e[2]!==c||e[3]!==l.name?(g=s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:c,children:l.name})}),e[2]=c,e[3]=l.name,e[4]=g):g=e[4];let f;e[5]!==l.description?(f=l.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:l.description}),e[5]=l.description,e[6]=f):f=e[6];let a;e[7]!==g||e[8]!==f?(a=s.jsxs("div",{className:"flex-1 min-w-0",children:[g,f]}),e[7]=g,e[8]=f,e[9]=a):a=e[9];const x=`tool-${n}-${l.name}`;let o;e[10]!==i||e[11]!==r||e[12]!==x?(o=s.jsx("div",{className:"flex items-center shrink-0",children:s.jsx(we,{id:x,checked:i,onCheckedChange:r,onClick:Ft})}),e[10]=i,e[11]=r,e[12]=x,e[13]=o):o=e[13];let m;return e[14]!==d||e[15]!==a||e[16]!==o?(m=s.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:d,children:[a,o]}),e[14]=d,e[15]=a,e[16]=o,e[17]=m):m=e[17],m}function Ft(t){return t.stopPropagation()}function Kt({toolSet:t,onToolSetChange:e,excludeVirtualMcpId:n,searchQuery:l}){const[i,r]=$.useState(""),d=l!==void 0?l:i,h=$.useDeferredValue(d),[c,g]=$.useState("all"),[f,a]=$.useState(!1),x=$.useRef(new Set(Object.keys(t))),{org:o}=Se(),m=Ot({connectionId:jt,orgId:o.id,orgSlug:o.slug}),S=100,T=h.trim(),E=T?{operator:"or",conditions:[{field:["title"],operator:"contains",value:T},{field:["description"],operator:"contains",value:T}]}:void 0,N=!!n,C={...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:0,...N&&{include_virtual:!0}},v=JSON.stringify(C),{data:_,fetchNextPage:R,hasNextPage:p,isFetchingNextPage:O}=Rt({queryKey:re.collectionListInfinite(m,o.id,"","CONNECTIONS",v),queryFn:async({pageParam:b=0})=>(await m.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...E&&{where:E},orderBy:[{field:["updated_at"],direction:"asc"}],limit:S,offset:b,...N&&{include_virtual:!0}}})).structuredContent,initialPageParam:0,getNextPageParam:(b,D)=>{if(b?.hasMore)return D.reduce((Q,q)=>Q+(q?.items?.length??0),0)},staleTime:3e4}),I=_?.pages.flatMap(b=>b?.items??[])??[],j=Ct(R,p??!1,O),u=n?I.filter(b=>b.connection_type!=="VIRTUAL"?!0:dt(b.connection_url)!==n):I,w=x.current,A=[...w.values()].map(b=>u.find(D=>D.id===b)).filter(b=>b!==void 0),k=u.filter(b=>!w.has(b.id)),G=[...A,...k],U=b=>{const D=t[b];return D!==void 0&&D.length>0},B=G.filter(b=>{if(c==="all")return!0;const D=U(b.id);return c==="selected"?D:c==="unselected"?!D:!0}),[L,z]=$.useState(G[0]?.id??null),y=L?G.find(b=>b.id===L)??null:null,{data:M,isFetching:Y}=Re({queryKey:re.collectionItem(m,o.id,"","CONNECTIONS",L??""),queryFn:async()=>L?(await m.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:L}})).structuredContent?.item??null:null,enabled:!!L,staleTime:3e4}),F=M?.tools??[],X=(b,D)=>t[b]?.includes(D)??!1,J=(b,D)=>{const Q=t[b]??[],q=Q.includes(D),W={...t};if(q){const Z=Q.filter(ee=>ee!==D);Z.length===0?delete W[b]:W[b]=Z}else W[b]=[...Q,D];e(W)},le=b=>{const D=b===L?F:[];if(!D.length)return;const Q=t[b]??[],q=D.map(ee=>ee.name),W=Q.length>0&&q.every(ee=>Q.includes(ee)),Z={...t};W?delete Z[b]:(Z[b]=q,z(b)),e(Z)},oe=b=>{z(b),a(!0)},ie=()=>{a(!1)};return s.jsxs("div",{className:"flex h-full",children:[s.jsxs("div",{className:K("w-full md:w-80 border-r border-border flex flex-col",f&&"hidden md:flex"),children:[l===void 0&&s.jsx(vt,{value:i,onChange:r,placeholder:"Search MCP Servers..."}),s.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[s.jsx("button",{onClick:()=>g("all"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),s.jsx("button",{onClick:()=>g("selected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),s.jsx("button",{onClick:()=>g("unselected"),className:K("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:B.length===0?s.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:d?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):s.jsxs("div",{className:"p-2 space-y-1",children:[B.map(b=>{const D=L===b.id,Q=D?F.length:0,q=t[b.id]?.length??0;return s.jsx(zt,{connection:{...b,tools:D?F:b.tools},isSelected:D,hasToolsEnabled:U(b.id),activeToolsCount:q,totalToolsCount:Q,onSelect:()=>oe(b.id),onToggle:()=>le(b.id)},b.id)}),s.jsx("div",{ref:j,className:"h-4"}),O&&s.jsx("div",{className:"flex justify-center py-3",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})})]})})]}),s.jsx("div",{className:K("flex-1 flex-col",f?"flex":"hidden md:flex"),children:y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:ie,className:"h-8 w-8 p-0 shrink-0",children:s.jsx(At,{size:20})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(ye,{icon:y.icon,name:y.title,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:y.title}),y.description&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.description})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto p-4",children:Y?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(fe,{size:18,className:"animate-spin text-muted-foreground"})}):F.length===0?s.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):s.jsx("div",{className:"space-y-2",children:F.map(b=>s.jsx($t,{connectionId:y.id,tool:b,isSelected:X(y.id,b.name),onToggle:()=>J(y.id,b.name)},b.name))})})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}const Ne=["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"],Qt={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ht(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ne.length;return Ne[n]??Ne[0]}function qt(t,e){return Qt[t]??"bg-neutral-400"}const Zt=Pe({role:Pe({id:se().optional(),slug:se().optional(),label:se()}),allowAllStaticPermissions:ke(),staticPermissions:Ie(se()),toolSet:De(se(),Ie(se())),allowAllModels:ke(),modelSet:De(se(),Ie(se())),memberIds:Ie(se())});function ot(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function Ye(t,e,n){const l=s.jsx(xe,{checked:t,disabled:e,onCheckedChange:n});return e?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:l})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):l}function Xt(t){const e=H.c(28),{allowAllStaticPermissions:n,staticPermissions:l,onAllowAllChange:i,onPermissionsChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d;let g;e[0]!==h?(g=h.trim().toLowerCase(),e[0]=h,e[1]=g):g=e[1];const f=$.useDeferredValue(g);let a;if(e[2]!==n||e[3]!==f||e[4]!==i||e[5]!==r||e[6]!==c||e[7]!==h||e[8]!==l){const x=Ut(),o=(v,_)=>{if(!c){if(n&&_){const R=x.flatMap(es).flatMap(Wt);i(!1),r(R.filter(p=>!v.tools.includes(p)));return}n||r(Vt(v,l,!_))}};let m;e[10]!==f?(m=v=>{const{section:_,capabilities:R}=v;return{section:_,capabilities:R.filter(p=>!f||p.label.toLowerCase().includes(f)||p.description.toLowerCase().includes(f))}},e[10]=f,e[11]=m):m=e[11];const S=x.map(m).filter(Jt);let T;e[12]!==n||e[13]!==i||e[14]!==r?(T=()=>{i(!n),r([])},e[12]=n,e[13]=i,e[14]=r,e[15]=T):T=e[15];let E;e[16]!==n||e[17]!==c||e[18]!==T?(E=Ye(n,c,T),e[16]=n,e[17]=c,e[18]=T,e[19]=E):E=e[19];let N;e[20]!==n||e[21]!==i||e[22]!==r||e[23]!==c?(N=c?void 0:()=>{i(!n),r([])},e[20]=n,e[21]=i,e[22]=r,e[23]=c,e[24]=N):N=e[24];let C;e[25]!==E||e[26]!==N?(C=s.jsx(Ue,{title:"General",children:s.jsx(Be,{children:s.jsx(Ve,{title:"All organization permissions",description:"Grant full access to all features below",action:E,onClick:N})})}),e[25]=E,e[26]=N,e[27]=C):C=e[27],a=s.jsx("div",{children:s.jsxs("div",{className:"flex flex-col gap-10 py-4",children:[C,S.length===0&&f?s.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:["No permissions match “",h,"”"]}):S.map(v=>{const{section:_,capabilities:R}=v;return s.jsx(Ue,{title:_,children:s.jsx(Be,{children:R.map(p=>{const O=Bt(p,l,n);return s.jsx(Ve,{title:s.jsxs("span",{className:"flex items-center gap-1.5",children:[p.label,p.dangerous&&s.jsx(ft,{size:12,className:"text-amber-500 shrink-0"})]}),description:p.description,action:Ye(O,c,()=>o(p,O)),onClick:c?void 0:()=>o(p,O)},p.id)})})},_)})]})}),e[2]=n,e[3]=f,e[4]=i,e[5]=r,e[6]=c,e[7]=h,e[8]=l,e[9]=a}else a=e[9];return a}function Jt(t){return t.capabilities.length>0}function Wt(t){return t.tools}function es(t){return t.capabilities}const it={anthropic:"Anthropic",openrouter:"OpenRouter"},ts={openai:"OpenAI",anthropic:"Anthropic",google:"Google","meta-llama":"Meta",mistralai:"Mistral","x-ai":"xAI",deepseek:"DeepSeek",qwen:"Qwen",moonshotai:"MoonshotAI",nvidia:"NVIDIA",perplexity:"Perplexity",cohere:"Cohere",amazon:"Amazon",microsoft:"Microsoft","z-ai":"Z.ai","ibm-granite":"IBM Granite",alibaba:"Alibaba",baidu:"Baidu",bytedance:"ByteDance",tencent:"Tencent",minimax:"MiniMax",nousresearch:"Nous Research",allenai:"Allen AI",inception:"Inception"};function ss(t,e){const n=t.indexOf("/"),l=n>0?t.slice(0,n):e;return l.startsWith("~")?l.slice(1):l}function ns(t){return ts[t]??it[t]??t}function ls(t){const e=t.indexOf(": ");return e>0&&e<32?t.slice(e+2):t}const rt=30;function os(t){const e=H.c(44),{connectionId:n,subProviderId:l,subProviderName:i,groupLogo:r,models:d,allConnectionModelIds:h,selectedModels:c,allowAllModels:g,allConnectionModelsSelected:f,onToggleModel:a,onExitAllowAll:x,readOnly:o,defaultExpanded:m}=t,[S,T]=$.useState(m),E=m||S,N=T,[C,v]=$.useState(rt);let _;e[0]!==f||e[1]!==g||e[2]!==c?(_=j=>g||f||c.includes("*")||c.includes(j),e[0]=f,e[1]=g,e[2]=c,e[3]=_):_=e[3];const R=_;let p;if(e[4]!==R||e[5]!==d){let j;e[7]!==R?(j=u=>R(u.id),e[7]=R,e[8]=j):j=e[8],p=d.filter(j),e[4]=R,e[5]=d,e[6]=p}else p=e[6];const O=p.length;let I;if(e[9]!==h||e[10]!==g||e[11]!==n||e[12]!==O||e[13]!==E||e[14]!==r||e[15]!==R||e[16]!==d||e[17]!==x||e[18]!==a||e[19]!==o||e[20]!==l||e[21]!==i||e[22]!==C){const j=d.slice(0,C),u=d.length>C;let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=()=>N(cs),e[24]=w):w=e[24];const A=r??tt[l]??st;let k;e[25]!==i||e[26]!==A?(k=s.jsx(ye,{icon:A,name:i,size:"sm"}),e[25]=i,e[26]=A,e[27]=k):k=e[27];let G;e[28]!==i?(G=s.jsx("span",{className:"text-sm font-medium truncate",children:i}),e[28]=i,e[29]=G):G=e[29];let U;e[30]!==k||e[31]!==G?(U=s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[k,G]}),e[30]=k,e[31]=G,e[32]=U):U=e[32];let B;e[33]!==O||e[34]!==d.length?(B=s.jsxs(ge,{variant:"secondary",className:"text-xs text-muted-foreground",children:[O,"/",d.length," enabled"]}),e[33]=O,e[34]=d.length,e[35]=B):B=e[35];let L;e[36]!==E?(L=E?s.jsx(Mt,{size:16,className:"text-muted-foreground shrink-0"}):s.jsx(Pt,{size:16,className:"text-muted-foreground shrink-0"}),e[36]=E,e[37]=L):L=e[37];let z;e[38]!==L||e[39]!==B?(z=s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[B,L]}),e[38]=L,e[39]=B,e[40]=z):z=e[40];let y;e[41]!==z||e[42]!==U?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 hover:bg-muted/50 cursor-pointer",onClick:w,children:[U,z]}),e[41]=z,e[42]=U,e[43]=y):y=e[43],I=s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[y,E&&s.jsxs("div",{className:"border-t border-border bg-muted/20",children:[j.map(M=>{const Y=R(M.id),F=()=>{if(!o){if(g){x(n,h,M.id);return}a(n,M.id)}};return s.jsxs("div",{className:K("flex items-center justify-between gap-3 px-4 py-3 border-b border-border last:border-b-0",!o&&"hover:bg-muted/50 cursor-pointer"),onClick:F,children:[s.jsx("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:s.jsx("span",{className:"text-sm truncate",children:M.title})}),s.jsx("div",{onClick:as,children:o?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:Y,disabled:!0,onCheckedChange:rs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:Y,onCheckedChange:F})})]},M.id)}),u&&s.jsxs("button",{type:"button",className:"w-full px-4 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",onClick:()=>v(is),children:["Show more (",d.length-C," remaining)"]})]})]}),e[9]=h,e[10]=g,e[11]=n,e[12]=O,e[13]=E,e[14]=r,e[15]=R,e[16]=d,e[17]=x,e[18]=a,e[19]=o,e[20]=l,e[21]=i,e[22]=C,e[23]=I}else I=e[23];return I}function is(t){return t+rt}function rs(){}function as(t){return t.stopPropagation()}function cs(t){return!t}function ds(t){const e=H.c(33),{connection:n,selectedModels:l,allowAllModels:i,onToggleModel:r,onExitAllowAll:d,allConnectionModelsSelected:h,searchQuery:c,readOnly:g}=t,f=Lt(n.id);let a,x,o,m,S;if(e[0]!==h||e[1]!==i||e[2]!==n.id||e[3]!==n.label||e[4]!==n.providerId||e[5]!==d||e[6]!==r||e[7]!==f||e[8]!==g||e[9]!==c||e[10]!==l){S=Symbol.for("react.early_return_sentinel");e:{let N;e[16]!==n.label?(N=A=>({...A,id:A.modelId,provider:n.label}),e[16]=n.label,e[17]=N):N=e[17];const C=f.filter(hs).map(N),v=c.trim().toLowerCase(),_=v?C.filter(A=>A.title.toLowerCase().includes(v)||A.id.toLowerCase().includes(v)||A.provider?.toLowerCase().includes(v)):C;if(_.length===0){S=null;break e}const R=new Map;for(const A of _){const k=ss(A.id,n.providerId),G=R.get(k)??{models:[],logo:null};G.models.push({id:A.id,title:ls(A.title),logo:A.logo}),!G.logo&&A.logo&&(G.logo=A.logo),R.set(k,G)}const p=Array.from(R.entries()).map(fs).sort(us),O=p.length===1||v.length>0;o="flex flex-col gap-3";const I=tt[n.providerId]??st;let j;e[18]!==n.providerId||e[19]!==I?(j=s.jsx("img",{src:I,alt:n.providerId,className:"w-4 h-4 rounded-sm dark:bg-white dark:rounded-sm dark:p-px"}),e[18]=n.providerId,e[19]=I,e[20]=j):j=e[20];const u=it[n.providerId]??n.providerId;let w;e[21]!==u?(w=s.jsx("h4",{className:"text-sm font-medium",children:u}),e[21]=u,e[22]=w):w=e[22],e[23]!==w||e[24]!==j?(m=s.jsxs("div",{className:"flex items-center gap-2",children:[j,w]}),e[23]=w,e[24]=j,e[25]=m):m=e[25],a="flex flex-col gap-3",x=p.map(A=>s.jsx(os,{connectionId:n.id,subProviderId:A.id,subProviderName:A.name,groupLogo:A.logo,models:A.models,allConnectionModelIds:C.map(ms),selectedModels:l,allowAllModels:i,allConnectionModelsSelected:h,onToggleModel:r,onExitAllowAll:d,readOnly:g,defaultExpanded:O},A.id))}e[0]=h,e[1]=i,e[2]=n.id,e[3]=n.label,e[4]=n.providerId,e[5]=d,e[6]=r,e[7]=f,e[8]=g,e[9]=c,e[10]=l,e[11]=a,e[12]=x,e[13]=o,e[14]=m,e[15]=S}else a=e[11],x=e[12],o=e[13],m=e[14],S=e[15];if(S!==Symbol.for("react.early_return_sentinel"))return S;let T;e[26]!==a||e[27]!==x?(T=s.jsx("div",{className:a,children:x}),e[26]=a,e[27]=x,e[28]=T):T=e[28];let E;return e[29]!==o||e[30]!==m||e[31]!==T?(E=s.jsxs("div",{className:o,children:[m,T]}),e[29]=o,e[30]=m,e[31]=T,e[32]=E):E=e[32],E}function ms(t){return t.id}function us(t,e){return t.name.localeCompare(e.name)}function fs(t){const[e,n]=t;return{id:e,name:ns(e),logo:n.logo,models:n.models}}function hs(t,e,n){return n.findIndex(l=>l.modelId===t.modelId)===e}function gs(t){const e=H.c(35),{allowAllModels:n,modelSet:l,onAllowAllChange:i,onModelSetChange:r,readOnly:d,searchQuery:h}=t,c=d===void 0?!1:d,g=$.useDeferredValue(h),f=wt();let a;e[0]!==l||e[1]!==r?(a=(p,O)=>{const I=l[p]??[],j={...l};if(I.includes(O)){const u=I.filter(w=>w!==O);u.length===0?delete j[p]:j[p]=u}else j[p]=[...I,O];r(j)},e[0]=l,e[1]=r,e[2]=a):a=e[2];const x=a;let o;e[3]!==l||e[4]!==i||e[5]!==r?(o=(p,O,I)=>{i(!1),r({...l,[p]:O.filter(j=>j!==I)})},e[3]=l,e[4]=i,e[5]=r,e[6]=o):o=e[6];const m=o,S=!c&&"hover:bg-muted/50 cursor-pointer";let T;e[7]!==S?(T=K("flex items-center justify-between px-4 py-3 rounded-lg border border-border bg-card",S),e[7]=S,e[8]=T):T=e[8];let E;e[9]!==n||e[10]!==i||e[11]!==r||e[12]!==c?(E=()=>{if(c)return;const p=!n;i(p),p&&r({})},e[9]=n,e[10]=i,e[11]=r,e[12]=c,e[13]=E):E=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"text-sm font-medium",children:"All models"}),e[14]=N):N=e[14];let C;e[15]!==n||e[16]!==i||e[17]!==r||e[18]!==c?(C=s.jsx("div",{onClick:ps,children:c?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(xe,{checked:n,disabled:!0,onCheckedChange:xs})})}),s.jsx(Te,{children:s.jsx("p",{children:"Built-in role permissions cannot be changed"})})]})}):s.jsx(xe,{checked:n,onCheckedChange:p=>{i(p),p&&r({})}})}),e[15]=n,e[16]=i,e[17]=r,e[18]=c,e[19]=C):C=e[19];let v;e[20]!==T||e[21]!==E||e[22]!==C?(v=s.jsxs("div",{className:T,onClick:E,children:[N,C]}),e[20]=T,e[21]=E,e[22]=C,e[23]=v):v=e[23];let _;e[24]!==f||e[25]!==n||e[26]!==g||e[27]!==m||e[28]!==l||e[29]!==c||e[30]!==x?(_=f.length===0?s.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No LLM connections configured"}):f.map(p=>s.jsx($.Suspense,{fallback:s.jsxs("div",{className:"px-4 py-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(fe,{className:"size-4 animate-spin"}),"Loading models..."]}),children:s.jsx(ds,{connection:p,selectedModels:l[p.id]??[],allowAllModels:n,onToggleModel:x,onExitAllowAll:m,allConnectionModelsSelected:(l[p.id]??[]).includes("*"),searchQuery:g,readOnly:c})},p.id)),e[24]=f,e[25]=n,e[26]=g,e[27]=m,e[28]=l,e[29]=c,e[30]=x,e[31]=_):_=e[31];let R;return e[32]!==_||e[33]!==v?(R=s.jsxs("div",{className:"flex flex-col h-full overflow-auto gap-6 pb-6",children:[v,_]}),e[32]=_,e[33]=v,e[34]=R):R=e[34],R}function xs(){}function ps(t){return t.stopPropagation()}function bs(t){const e=H.c(52),{open:n,onOpenChange:l,selectedMemberIds:i,onAddMembers:r}=t,[d,h]=$.useState(""),c=$.useDeferredValue(d);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[0]=g):g=e[0];const[f,a]=$.useState(g),{data:x}=nt();let o,m,S,T,E,N,C,v,_,R,p;if(e[1]!==x?.data?.members||e[2]!==c||e[3]!==r||e[4]!==l||e[5]!==n||e[6]!==f||e[7]!==d||e[8]!==i){const U=x?.data?.members??[];let B;e[20]!==c?(B=y=>{const M=c.toLowerCase();return y.user?.name?.toLowerCase().includes(M)||y.user?.email?.toLowerCase().includes(M)},e[20]=c,e[21]=B):B=e[21];const L=U.filter(B);let z;e[22]!==r||e[23]!==l||e[24]!==f?(z=()=>{r(f),a([]),l(!1)},e[22]=r,e[23]=l,e[24]=f,e[25]=z):z=e[25],S=z,m=Qe,R=n,p=l,o=He,v="sm:max-w-md p-0",e[26]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsxs(qe,{className:"px-6 pt-6",children:[s.jsx(Ze,{children:"Add Members to Role"}),s.jsx(Xe,{children:"Select members to add to this role."})]}),e[26]=_):_=e[26],N="flex flex-col h-80",e[27]!==d?(C=s.jsx("div",{className:"border-b border-border px-4 py-3",children:s.jsx(ve,{value:d,onChange:h,placeholder:"Search members...",className:"w-full"})}),e[27]=d,e[28]=C):C=e[28],T="flex-1 overflow-auto",E=L.length===0?s.jsx("div",{className:"flex items-center justify-center h-full px-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:d?"No members found":"No members available"})}):s.jsx("div",{className:"px-6 py-2 space-y-1",children:L.map(y=>{const M=y.role!=="owner",Y=i.includes(y.id),F=f.includes(y.id);return s.jsxs("label",{className:K("flex items-center gap-3 p-2 rounded-lg",!M||Y?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-muted/50"),children:[s.jsx(we,{checked:F||Y,onCheckedChange:()=>{!M||Y||a(X=>X.includes(y.id)?X.filter(J=>J!==y.id):[...X,y.id])},disabled:!M||Y}),s.jsx(lt,{url:y.user?.image??void 0,fallback:ot(y.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.user?.email})]}),!M&&s.jsx(ge,{variant:"secondary",className:"shrink-0",children:"Owner"}),Y&&M&&s.jsx(ge,{variant:"outline",className:"shrink-0",children:"Added"})]},y.id)})}),e[1]=x?.data?.members,e[2]=c,e[3]=r,e[4]=l,e[5]=n,e[6]=f,e[7]=d,e[8]=i,e[9]=o,e[10]=m,e[11]=S,e[12]=T,e[13]=E,e[14]=N,e[15]=C,e[16]=v,e[17]=_,e[18]=R,e[19]=p}else o=e[9],m=e[10],S=e[11],T=e[12],E=e[13],N=e[14],C=e[15],v=e[16],_=e[17],R=e[18],p=e[19];let O;e[29]!==T||e[30]!==E?(O=s.jsx("div",{className:T,children:E}),e[29]=T,e[30]=E,e[31]=O):O=e[31];let I;e[32]!==O||e[33]!==N||e[34]!==C?(I=s.jsxs("div",{className:N,children:[C,O]}),e[32]=O,e[33]=N,e[34]=C,e[35]=I):I=e[35];let j;e[36]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Je,{children:"Cancel"}),e[36]=j):j=e[36];const u=f.length===0,w=f.length>0&&`(${f.length})`;let A;e[37]!==S||e[38]!==u||e[39]!==w?(A=s.jsxs(We,{className:"px-6 pb-6",children:[j,s.jsxs(et,{onClick:S,disabled:u,children:["Add ",w]})]}),e[37]=S,e[38]=u,e[39]=w,e[40]=A):A=e[40];let k;e[41]!==o||e[42]!==I||e[43]!==A||e[44]!==v||e[45]!==_?(k=s.jsxs(o,{className:v,children:[_,I,A]}),e[41]=o,e[42]=I,e[43]=A,e[44]=v,e[45]=_,e[46]=k):k=e[46];let G;return e[47]!==m||e[48]!==k||e[49]!==R||e[50]!==p?(G=s.jsx(m,{open:R,onOpenChange:p,children:k}),e[47]=m,e[48]=k,e[49]=R,e[50]=p,e[51]=G):G=e[51],G}function Es(t){const e=H.c(29),{memberIds:n,onMemberIdsChange:l,readOnly:i,readOnlyMessage:r,searchQuery:d,addMemberDialogOpen:h,onAddMemberDialogOpenChange:c}=t,g=i===void 0?!1:i,f=r===void 0?"Owner membership cannot be changed":r,a=$.useDeferredValue(d),{data:x}=nt();let o,m,S;if(e[0]!==x?.data?.members||e[1]!==a||e[2]!==n||e[3]!==l||e[4]!==g||e[5]!==f||e[6]!==d){const v=x?.data?.members??[];let _;e[10]!==n?(_=I=>n.includes(I.id),e[10]=n,e[11]=_):_=e[11];const R=v.filter(_);let p;e[12]!==a?(p=I=>{const j=a.toLowerCase();return I.user?.name?.toLowerCase().includes(j)||I.user?.email?.toLowerCase().includes(j)},e[12]=a,e[13]=p):p=e[13];const O=R.filter(p);S="flex flex-col h-full",o="flex-1 overflow-auto",m=R.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h3",{className:"text-base font-medium mb-1",children:"No members"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add members to grant them the configured permissions."})]})}):O.length===0?s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No members match "',d,'"']})}):s.jsx("div",{className:"p-4 space-y-2",children:O.map(I=>s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/30",children:[s.jsx(lt,{url:I.user?.image??void 0,fallback:ot(I.user?.name),shape:"circle",size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:I.user?.name||"Unknown"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.user?.email})]}),g?s.jsx(pe,{children:s.jsxs(be,{children:[s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsx(ne,{variant:"ghost",size:"sm",disabled:!0,children:s.jsx(ze,{size:16})})})}),s.jsx(Te,{children:s.jsx("p",{children:f})})]})}):s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>l(n.filter(j=>j!==I.id)),children:s.jsx(ze,{size:16})})]},I.id))}),e[0]=x?.data?.members,e[1]=a,e[2]=n,e[3]=l,e[4]=g,e[5]=f,e[6]=d,e[7]=o,e[8]=m,e[9]=S}else o=e[7],m=e[8],S=e[9];let T;e[14]!==o||e[15]!==m?(T=s.jsx("div",{className:o,children:m}),e[14]=o,e[15]=m,e[16]=T):T=e[16];let E;e[17]!==n||e[18]!==l?(E=v=>l([...n,...v]),e[17]=n,e[18]=l,e[19]=E):E=e[19];let N;e[20]!==h||e[21]!==n||e[22]!==c||e[23]!==E?(N=s.jsx(bs,{open:h,onOpenChange:c,selectedMemberIds:n,onAddMembers:E}),e[20]=h,e[21]=n,e[22]=c,e[23]=E,e[24]=N):N=e[24];let C;return e[25]!==S||e[26]!==T||e[27]!==N?(C=s.jsxs("div",{className:S,children:[T,N]}),e[25]=S,e[26]=T,e[27]=N,e[28]=C):C=e[28],C}function Ts(t){const e=H.c(3);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:24,className:"animate-spin text-muted-foreground"})}),e[0]=n):n=e[0];let l;return e[1]!==t?(l=s.jsx($.Suspense,{fallback:n,children:s.jsx(Es,{...t})}),e[1]=t,e[2]=l):l=e[2],l}const _s={owner:[],admin:[],user:[]};function Is(t,e,n,l){const i=t==="owner"||t==="admin";return{role:{id:n?.id,slug:t,label:t.charAt(0).toUpperCase()+t.slice(1)},allowAllStaticPermissions:i,staticPermissions:_s[t],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:e.filter(r=>r.role===t).map(r=>r.id)}}function Ss(t,e,n){const l=t.permission||{},i=l.self||[],r=i.includes("*"),d=r?[]:i.filter(a=>a!=="*"),h={};for(const[a,x]of Object.entries(l))if(!(a==="self"||a==="models"))if(a==="*")for(const o of n)h[o.id]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x;else{const o=n.find(m=>m.id===a);o&&(h[a]=x.includes("*")?o.tools?.map(m=>m.name)??[]:x)}const c=l.models||[],g=c.length===0||c.includes("*:*"),f={};if(!g)for(const a of c){const x=a.indexOf(":");if(x===-1)continue;const o=a.slice(0,x),m=a.slice(x+1);f[o]||(f[o]=[]),f[o].push(m)}return{role:{id:t.id,slug:t.role,label:t.label},allowAllStaticPermissions:r,staticPermissions:d,toolSet:h,allowAllModels:g,modelSet:f,memberIds:e.filter(a=>a.role===t.role).map(a=>a.id)}}function Ns(t,e){const n={};t.allowAllStaticPermissions?n.self=["*"]:t.staticPermissions.length>0&&(n.self=t.staticPermissions);for(const[l,i]of Object.entries(t.toolSet))if(i.length>0){const d=e.find(h=>h.id===l)?.tools?.map(h=>h.name)??[];n[l]=d.length>0&&d.every(h=>i.includes(h))?["*"]:i}if(t.allowAllModels)n.models=["*:*"];else{const l=[];for(const[i,r]of Object.entries(t.modelSet))for(const d of r)l.push(`${i}:${d}`);l.length>0&&(n.models=l)}return n}function Cs(t,e,n){return t.kind==="builtin"?Is(t.role,e,void 0):t.kind==="custom"?Ss(t.role,e,n):{role:{id:void 0,slug:void 0,label:""},allowAllStaticPermissions:!1,staticPermissions:[],toolSet:{},allowAllModels:!0,modelSet:{},memberIds:[]}}function As(t){const e=H.c(6),{readOnly:n,readOnlyMessage:l,onOpen:i}=t,r=l===void 0?"Owner membership cannot be changed":l;if(n){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ee,{asChild:!0,children:s.jsx("div",{children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:!0,children:[s.jsx(Ae,{size:16}),"Add Member"]})})}),e[0]=c):c=e[0];let g;return e[1]!==r?(g=s.jsx(pe,{children:s.jsxs(be,{children:[c,s.jsx(Te,{children:s.jsx("p",{children:r})})]})}),e[1]=r,e[2]=g):g=e[2],g}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ae,{size:16}),e[3]=d):d=e[3];let h;return e[4]!==i?(h=s.jsxs(ne,{variant:"outline",size:"sm",onClick:i,children:[d,"Add Member"]}),e[4]=i,e[5]=h):h=e[5],h}function Rs(t){const e=H.c(14),{locator:n}=Se(),l=je(),i=yt();let r;e[0]!==n?(r=re.members(n),e[0]=n,e[1]=r):r=e[1];let d;e[2]!==l?(d=()=>l.organization.listMembers(),e[2]=l,e[3]=d):d=e[3];let h;e[4]!==r||e[5]!==d?(h={queryKey:r,queryFn:d},e[4]=r,e[5]=d,e[6]=h):h=e[6];const{data:c,isPending:g}=Re(h);if(g||!i){let o;return e[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),e[7]=o):o=e[7],o}let f;e[8]!==c?.data?.members?(f=c?.data?.members??[],e[8]=c?.data?.members,e[9]=f):f=e[9];const a=f;let x;return e[10]!==i||e[11]!==a||e[12]!==t?(x=s.jsx(Os,{...t,members:a,connections:i}),e[10]=i,e[11]=a,e[12]=t,e[13]=x):x=e[13],x}function Os({target:t,onBack:e,onSaved:n,members:l,connections:i}){const{locator:r}=Se(),d=je(),h=$e(),c=t.kind==="builtin",g=t.kind==="builtin"&&t.role==="owner",f=t.kind==="new",[a,x]=$.useState(c?"org":"mcp"),o=mt({resolver:ut(Zt),defaultValues:Cs(t,l,i)}),m=o.formState.isValid,S=o.formState.isDirty,T=Fe({mutationFn:async u=>{const w=Ns(u,i),A=u.role.slug||u.role.label.toLowerCase().replace(/\s+/g,"-"),k=(u.role.slug==="owner"||u.role.slug==="admin"||u.role.slug==="user")&&!u.role.id,G=async(U,B)=>{const L=l.filter(M=>M.role===(B??U)).map(M=>M.id),z=u.memberIds.filter(M=>!L.includes(M)),y=L.filter(M=>!u.memberIds.includes(M));for(const M of z){const Y=await d.organization.updateMemberRole({memberId:M,role:[U]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}for(const M of y){const Y=await d.organization.updateMemberRole({memberId:M,role:["user"]});if(Y?.error)throw new Error(Y.error.message??"Something went wrong")}};if(k)return await G(u.role.slug),u;if(u.role.id){const U=u.role.label.toLowerCase().replace(/\s+/g,"-"),B=u.role.slug,L=U!==B,z=await d.organization.updateRole({roleId:u.role.id,data:{permission:w,...L?{roleName:U}:{}}});if(z?.error)throw new Error(z.error.message??"Something went wrong");return await G(L?U:B,L?B:void 0),L?{...u,role:{...u.role,slug:U}}:u}else{const U=await d.organization.createRole({role:A,permission:w});if(U?.error)throw new Error(U.error.message??"Something went wrong");for(const B of u.memberIds){const L=await d.organization.updateMemberRole({memberId:B,role:[A]});if(L?.error)throw new Error(L.error.message)}return{...u,role:{...u.role,id:U.data?.roleData?.id,slug:A}}}},onSuccess:(u,w)=>{h.invalidateQueries({queryKey:re.members(r)}),h.invalidateQueries({queryKey:re.organizationRoles(r)});const A=!w.role.id&&!w.role.slug,k=w.role.slug==="owner"&&!w.role.id;Oe(k?"role_members_updated":A?"role_created":"role_updated",{role_slug:w.role.slug??null}),he.success(k?"Members updated successfully!":A?"Role created successfully!":"Role updated successfully!"),o.reset(u),n(u.role.id)},onError:u=>{he.error(u instanceof Error?u.message:"Failed to save role")}}),E=o.handleSubmit(u=>{if(!u.role.label.trim()){he.error("Role name is required"),o.setFocus("role.label");return}T.mutate(u)}),N=!g,C=t.kind==="builtin"?t.role.charAt(0).toUpperCase()+t.role.slice(1):t.kind==="custom"?t.role.label:"",v=[...g?[]:[{id:"mcp",label:"MCP Permissions"}],{id:"org",label:"Organization Permissions"},{id:"models",label:"Models"},{id:"members",label:"Members"}],[_,R]=$.useState(""),[p,O]=$.useState(!1),I=u=>{x(u),R("")},j={mcp:"Search MCP servers...",org:"Search permissions...",models:"Search models...",members:"Search members..."};return s.jsx(te,{children:s.jsxs(te.Content,{className:K("flex flex-col",a!=="org"&&"overflow-hidden"),children:[s.jsx("div",{className:"shrink-0 mx-auto w-full max-w-[1200px] px-4 md:px-10 pt-8 md:pt-12 pb-4",children:s.jsxs("div",{className:"flex flex-col gap-5",children:[s.jsx(te.Title,{actions:N&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:e,disabled:T.isPending,children:"Cancel"}),s.jsx(ne,{size:"sm",onClick:E,disabled:T.isPending||!m||!S,children:T.isPending?"Saving...":f?"Create Role":"Save Changes"})]}),children:s.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",t.kind==="builtin"?qt(t.role):Ht(o.watch("role.label")))}),g&&s.jsx(Ke,{size:16,className:"text-muted-foreground shrink-0"}),f||t.kind==="custom"?s.jsx("input",{...o.register("role.label"),placeholder:"Role name",className:"leading-tight text-foreground bg-transparent border-none outline-none px-1 -mx-1 rounded hover:bg-input/25 focus:bg-input/25 transition-colors w-64 placeholder:text-muted-foreground/50",autoFocus:f}):s.jsx("span",{className:"truncate",children:C})]})}),s.jsx("div",{className:"flex items-center gap-2",children:v.map(u=>s.jsx("button",{type:"button",onClick:()=>I(u.id),className:K("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex items-center",a===u.id?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:u.label},u.id))}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(ve,{value:_,onChange:R,placeholder:j[a]??"Search...",className:"w-full md:w-[375px]"}),a==="members"&&s.jsx(As,{readOnly:t.kind==="builtin"&&t.role==="owner",onOpen:()=>O(!0)})]})]})}),s.jsx("div",{className:K("mx-auto w-full max-w-[1200px] px-4 md:px-10 pb-6",a!=="org"&&"flex-1 min-h-0"),children:s.jsxs("div",{className:K(a!=="org"&&"h-full overflow-hidden",a!=="models"&&a!=="org"&&"border border-border rounded-xl bg-card"),children:[a==="mcp"&&!g&&s.jsx(Kt,{toolSet:o.watch("toolSet"),onToolSetChange:u=>o.setValue("toolSet",u,{shouldDirty:!0}),searchQuery:_}),a==="org"&&s.jsx(Xt,{allowAllStaticPermissions:o.watch("allowAllStaticPermissions"),staticPermissions:o.watch("staticPermissions"),onAllowAllChange:u=>o.setValue("allowAllStaticPermissions",u,{shouldDirty:!0}),onPermissionsChange:u=>o.setValue("staticPermissions",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="models"&&s.jsx(gs,{allowAllModels:o.watch("allowAllModels"),modelSet:o.watch("modelSet"),onAllowAllChange:u=>o.setValue("allowAllModels",u,{shouldDirty:!0}),onModelSetChange:u=>o.setValue("modelSet",u,{shouldDirty:!0}),readOnly:g,searchQuery:_}),a==="members"&&s.jsx(Ts,{memberIds:o.watch("memberIds"),onMemberIdsChange:u=>o.setValue("memberIds",u,{shouldDirty:!0}),readOnly:t.kind==="builtin"&&(t.role==="owner"||t.role==="user"),readOnlyMessage:t.kind==="builtin"&&t.role==="user"?"User is the default role — members can't be removed from it; assign another role to change their access":"Owner membership cannot be changed",searchQuery:_,addMemberDialogOpen:p,onAddMemberDialogOpenChange:O})]})})]})})}function js(t){return t.kind==="builtin"?`builtin-${t.role}`:t.kind==="custom"?`custom-${t.role.id}`:"new"}function vs(t){const e=H.c(6),{area:n,children:l}=t,{isPrivileged:i,loading:r,error:d}=Dt();let h;return e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==r?(h=s.jsx(kt,{granted:i,loading:r,error:d,area:n,children:l}),e[0]=n,e[1]=l,e[2]=d,e[3]=i,e[4]=r,e[5]=h):h=e[5],h}const ys=[{role:"owner",label:"Owner",color:"bg-red-500"},{role:"admin",label:"Admin",color:"bg-blue-500"},{role:"user",label:"User",color:"bg-green-500"}],Ce=["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"];function ws(t){if(!t)return"bg-neutral-400";let e=0;for(let l=0;l<t.length;l++){const i=t.charCodeAt(l);e=(e<<5)-e+i,e=e&e}const n=Math.abs(e)%Ce.length;return Ce[n]??Ce[0]}const Ls={owner:"bg-red-500",admin:"bg-blue-500",user:"bg-green-500"};function Ms(t,e){return e?Ls[t]??"bg-neutral-400":ws(t)}function Ps(){const t=H.c(77),[e,n]=$.useState(""),[l,i]=$.useState(null),r=gt();let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},t[0]=d):d=t[0];const{role:h}=xt(d),{locator:c}=Se(),g=je(),f=$e(),{customRoles:a,refetch:x}=pt();let o;t[1]!==r?(o=P=>r({to:".",search:V=>({...V,role:P})}),t[1]=r,t[2]=o):o=t[2];const m=o;let S;e:{if(!h){S=null;break e}if(h==="new"){S={kind:"new"};break e}if(h.startsWith("builtin-")){S={kind:"builtin",role:h.slice(8)};break e}let P;t[3]!==h?(P=ae=>ae.id===h,t[3]=h,t[4]=P):P=t[4];const V=a.find(P);S=V?{kind:"custom",role:V}:null}const T=S;let E;t[5]!==c?(E=re.members(c),t[5]=c,t[6]=E):E=t[6];let N;t[7]!==g?(N=()=>g.organization.listMembers(),t[7]=g,t[8]=N):N=t[8];let C;t[9]!==E||t[10]!==N?(C={queryKey:E,queryFn:N},t[9]=E,t[10]=N,t[11]=C):C=t[11];const{data:v}=Re(C);let _;t[12]!==v?.data?.members?(_=v?.data?.members??[],t[12]=v?.data?.members,t[13]=_):_=t[13];const R=_;let p;t[14]!==R?(p=P=>R.filter(V=>V.role===P).length,t[14]=R,t[15]=p):p=t[15];const O=p;let I;if(t[16]!==a||t[17]!==O||t[18]!==e){let P;t[20]!==O?(P=ce=>({kind:"builtin",role:{...ce,memberCount:O(ce.role)}}),t[20]=O,t[21]=P):P=t[21];const V=ys.map(P);let ae;t[22]!==O?(ae=ce=>({kind:"custom",role:{...ce,memberCount:O(ce.role)}}),t[22]=O,t[23]=ae):ae=t[23];const at=a.map(ae);if(I=[...V,...at],e){const ce=e.toLowerCase();I=I.filter(ct=>ct.role.label.toLowerCase().includes(ce))}t[16]=a,t[17]=O,t[18]=e,t[19]=I}else I=t[19];let j;t[24]!==g?(j=async P=>{const V=await g.organization.deleteRole({roleId:P});if(V?.error)throw new Error(V.error.message);return V?.data},t[24]=g,t[25]=j):j=t[25];const u=Fe({mutationFn:j,onSuccess:(P,V)=>{Oe("role_deleted",{role_id:V}),f.invalidateQueries({queryKey:re.members(c)}),f.invalidateQueries({queryKey:re.organizationRoles(c)}),he.success("Role deleted successfully!"),x(),T?.kind==="custom"&&T.role.id===V&&m(void 0)},onError:zs});let w,A,k,G;t[26]===Symbol.for("react.memo_cache_sentinel")?(G={id:"role",header:"Role",render:Vs,cellClassName:"flex-1 min-w-0",sortable:!0},w={id:"type",header:"Type",render:Bs,cellClassName:"w-28 shrink-0"},A={id:"permissions",header:"Permissions",render:Us,cellClassName:"flex-1 min-w-0"},k={id:"members",header:"Members",render:Gs,cellClassName:"w-24 shrink-0"},t[26]=w,t[27]=A,t[28]=k,t[29]=G):(w=t[26],A=t[27],k=t[28],G=t[29]);let U;t[30]===Symbol.for("react.memo_cache_sentinel")?(U=[G,w,A,k,{id:"actions",header:"",render:P=>P.kind==="builtin"?null:s.jsxs(bt,{children:[s.jsx(Et,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:ks,children:s.jsx(It,{size:16})})}),s.jsx(Tt,{align:"end",onClick:Ds,children:s.jsxs(_t,{variant:"destructive",onClick:()=>{const V=P.role;V.id&&i({id:V.id,label:V.label})},children:[s.jsx(St,{size:16}),"Delete"]})})]}),cellClassName:"w-12 shrink-0"}],t[30]=U):U=t[30];const B=U;let L;t[31]!==m?(L=P=>{if(P.kind==="builtin")m(`builtin-${P.role.role}`);else{const V=P.role;m(V.id)}},t[31]=m,t[32]=L):L=t[32];const z=L;if(T){let P;t[33]!==m?(P=()=>m(void 0),t[33]=m,t[34]=P):P=t[34];let V;return t[35]!==x||t[36]!==m?(V=()=>{x(),m(void 0)},t[35]=x,t[36]=m,t[37]=V):V=t[37],s.jsx(Rs,{target:T,onBack:P,onSaved:V},js(T))}let y;t[38]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(te.Title,{children:"Roles"}),t[38]=y):y=t[38];let M;t[39]===Symbol.for("react.memo_cache_sentinel")?(M=P=>{P.key==="Escape"&&(n(""),P.target.blur())},t[39]=M):M=t[39];let Y;t[40]!==e?(Y=s.jsx(ve,{value:e,onChange:n,placeholder:"Search roles...",className:"w-full md:w-[375px]",onKeyDown:M}),t[40]=e,t[41]=Y):Y=t[41];let F;t[42]!==m?(F=()=>m("new"),t[42]=m,t[43]=F):F=t[43];let X;t[44]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsx(Ae,{size:16}),t[44]=X):X=t[44];let J;t[45]!==F?(J=s.jsxs(ne,{onClick:F,children:[X,"Create Role"]}),t[45]=F,t[46]=J):J=t[46];let le;t[47]!==Y||t[48]!==J?(le=s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[Y,J]}),t[47]=Y,t[48]=J,t[49]=le):le=t[49];let oe;t[50]!==e?(oe=e?s.jsx(Ge,{title:"No roles found",description:`No roles match "${e}"`}):s.jsx(Ge,{title:"No roles",description:"Create a role to get started."}),t[50]=e,t[51]=oe):oe=t[51];let ie;t[52]!==I||t[53]!==B||t[54]!==z||t[55]!==oe?(ie=s.jsx(Nt,{columns:B,data:I,isLoading:!1,onRowClick:z,emptyState:oe}),t[52]=I,t[53]=B,t[54]=z,t[55]=oe,t[56]=ie):ie=t[56];let b;t[57]!==le||t[58]!==ie?(b=s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[y,le,ie]})})}),t[57]=le,t[58]=ie,t[59]=b):b=t[59];const D=l!==null;let Q;t[60]===Symbol.for("react.memo_cache_sentinel")?(Q=P=>!P&&i(null),t[60]=Q):Q=t[60];let q;t[61]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ze,{children:"Delete Role"}),t[61]=q):q=t[61];const W=l?.label;let Z;t[62]!==W?(Z=s.jsxs(qe,{children:[q,s.jsxs(Xe,{children:['Are you sure you want to delete the "',W,'" role? This action cannot be undone.']})]}),t[62]=W,t[63]=Z):Z=t[63];let ee;t[64]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Je,{children:"Cancel"}),t[64]=ee):ee=t[64];let de;t[65]!==u||t[66]!==l?(de=s.jsxs(We,{children:[ee,s.jsx(et,{onClick:()=>{l?.id&&u.mutate(l.id),i(null)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[65]=u,t[66]=l,t[67]=de):de=t[67];let me;t[68]!==Z||t[69]!==de?(me=s.jsxs(He,{children:[Z,de]}),t[68]=Z,t[69]=de,t[70]=me):me=t[70];let ue;t[71]!==D||t[72]!==me?(ue=s.jsx(Qe,{open:D,onOpenChange:Q,children:me}),t[71]=D,t[72]=me,t[73]=ue):ue=t[73];let _e;return t[74]!==b||t[75]!==ue?(_e=s.jsxs(te,{children:[b,ue]}),t[74]=b,t[75]=ue,t[76]=_e):_e=t[76],_e}function Ds(t){return t.stopPropagation()}function ks(t){return t.stopPropagation()}function Gs(t){return s.jsx("span",{className:"text-sm text-foreground",children:t.role.memberCount})}function Us(t){if(t.kind==="builtin")return t.role.role==="owner"||t.role.role==="admin"?s.jsx("span",{className:"text-sm text-muted-foreground",children:"Full access"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Basic access"});const e=t.role,n=[];return e.allowsAllStaticPermissions?n.push("Full org access"):e.staticPermissionCount&&e.staticPermissionCount>0&&n.push(`${e.staticPermissionCount} org perm${e.staticPermissionCount!==1?"s":""}`),e.allowsAllConnections?n.push("All connections"):e.connectionCount&&e.connectionCount>0&&n.push(`${e.connectionCount} connection${e.connectionCount!==1?"s":""}`),s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.length>0?n.join(", "):"No permissions"})}function Bs(t){return t.kind==="builtin"?s.jsx(ge,{variant:"secondary",className:"text-xs",children:"Built-in"}):s.jsx(ge,{variant:"outline",className:"text-xs",children:"Custom"})}function Vs(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:K("size-2.5 rounded-full shrink-0",Ms(t.role.role,t.kind==="builtin"))}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:t.role.label}),t.kind==="builtin"&&s.jsx(Ke,{size:12,className:"text-muted-foreground shrink-0"})]})}function zs(t,e){Oe("role_delete_failed",{role_id:e,error:t instanceof Error?t.message:String(t)}),he.error(t instanceof Error?t.message:"Failed to delete role")}function Ys(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{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 roles"})})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ht,{fallback:e,children:s.jsx($.Suspense,{fallback:s.jsx(te,{children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(fe,{size:32,className:"animate-spin text-muted-foreground"})})}),children:s.jsx(Ps,{})})}),t[1]=n):n=t[1],n}function fl(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(vs,{area:"roles",children:s.jsx(Ys,{})}),t[0]=e):e=t[0],e}export{fl as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as c}from"./header-tab-button-VslXzF2w.js";function t(r){return(e,a)=>{c(e),r(e,a)}}export{t as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as m,j as s,l as o}from"./index-
|
|
1
|
+
import{e as m,j as s,l as o}from"./index-3A6UoYVV.js";import{i as c}from"./AlertCircle-Ed8WT4Gj.js";import{i as l}from"./Check-hOMWkijh.js";function u(i){const e=m.c(3),{isPending:a,isError:n}=i;if(n){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[s.jsx(c,{size:13}),"Couldn't save"]}),e[0]=t):t=e[0],t}if(a){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(o,{size:13,className:"animate-spin"}),"Saving…"]}),e[1]=t):t=e[1],t}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[s.jsx(l,{size:13}),"Saved"]}),e[2]=r):r=e[2],r}export{u as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as J,c as Se,j as s,e as V,B as De,n as Ae}from"./index-3A6UoYVV.js";import{ar as Ft,as as Bt,at as Dt,au as Lt,av as Et,aw as zt,ab as Pt,v as Mt,ax as Ze,H as Qe}from"./agent-icon-BFDCs9_Z.js";import{C as Ut}from"./calendar-Cn9BXXgq.js";import{I as ge}from"./input-BO5qrDqG.js";import{L as ce}from"./label-BwpjeHse.js";import{a as Vt,b as Kt,P as Ht}from"./popover-LSofc-Ht.js";import{T as Wt}from"./textarea-DzhddUkP.js";import{b as Yt}from"./XCircle-4DVMD60R.js";import{b as Gt}from"./SwitchHorizontal01-FJhkXGab.js";import{u as qt,i as Xt,d as Zt}from"./scroll-area-C_2w27J_.js";import{S as Qt}from"./switch-DeHeN4cz.js";import{c as mt,S as ht,a as yt,b as gt,d as xt}from"./select-ZTWu_v20.js";import{a as Jt,b as Je,K as en,P as tn,D as nn,c as rn,S as sn,v as on,f as ln,e as et,d as an,C as cn,s as un}from"./sortable.esm-MNP5qK3e.js";import{d as vt}from"./ZoomOut-CW29g7dT.js";import{s as fn}from"./Plus-p5ww31iK.js";import{s as bt}from"./Trash01-DwmURdtf.js";import{a as dn,b as pn,c as mn,D as hn}from"./dropdown-menu-BkH8Xao7.js";import{i as Ie,a as ze,X as tt,n as Ke,l as He,S as jt,P as yn,Y as Pe,Z as Le,_ as gn,$ as nt,a0 as xn,a1 as vn}from"./index-ByQPX0vL.js";import{e as kt,u as bn,L as jn,F as kn,I as rt}from"./image-field-Jp564yvH.js";import{t as Nt}from"./ChevronDown-D6Zecsff.js";import{i as Tt}from"./ChevronRight-DVoYZuHq.js";import{i as Nn}from"./Globe01-IHgKWLQG.js";import{T as Tn,b as Sn,a as _n}from"./tooltip-DQDMg1b1.js";import{i as An}from"./Upload01-oRevAfqv.js";import{c as Cn}from"./use-file-configs-mXTuB2DX.js";function We(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Ie(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function wn(t){return t.includes("flags/multivariate")}function In(t){return He(t)}function Rn(t,e){const n=[...t],r=new Set(n.map(l=>l.resolveType)),i=(l,o)=>{!l||r.has(l)||(r.add(l),n.push({resolveType:l,title:o??In(l)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const l=We(e.editorValue);l?.includes("/")&&i(l)}return n}function On(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const i=t,l=i.__resolveType;if(typeof l=="string"){if(ze(l)){const m=e.find(h=>h.resolveType===l);return m?m.resolveType:l}const u=e.find(m=>tt(m.resolveType,l));if(u)return u.resolveType;const d=e.find(m=>m.resolveType===l);if(d)return d.resolveType;if(l.includes("/"))return l}const o=typeof i.type=="string"?i.type:void 0;if(o){const u=e.find(d=>d.discriminatorValue===o||d.resolveType===o||tt(d.resolveType,o));if(u)return u.resolveType}let a=r,c=-1;for(const u of e){if(!u.schema?.properties)continue;const m=Object.keys(u.schema.properties).filter(h=>!h.startsWith("__")&&h!=="@type"&&h!=="action"&&h!=="alt").filter(h=>i[h]!==void 0).length;m>0&&m>c&&(c=m,a=u.resolveType)}return c>0,a}function st(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=We(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const i=Ke(r,e);return i||(r.includes("/")?null:n??null)}function $n(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const n={...t.properties};return delete n[e],{...t,properties:n}}function St(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Ie(e.__resolveType))return null;const n=e.section;return!n||typeof n!="object"||Array.isArray(n)?null:n}function Fn(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=We(n);return r&&wn(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function Bn(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Dn(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(i=>typeof i.value=="string");if(r)return r.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function _t(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(_t);const e=t;return e.__resolveType?Dn(e)??t:At(e)}function At(t){const e={};for(const[n,r]of Object.entries(t))e[n]=_t(r);return e}function Ln(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function Ct(t){return t==null?"":Array.isArray(t)?t.map(Ct).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Ye(t,e){if(!t.includes("{"))return;const n=At(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,l,o)=>{const a=(l??o??"").trim();return Ct(Ln(n,a))}).trim()||void 0}function En(t){return t.replace(/<[^>]*>/g,"").trim()}function zn(t,e){if(e.includes("{"))return Ye(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(r)return r}}function Te(t,e,n){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;const i=St(r);if(i&&(r=i),n?.titleBy){const o=zn(r,n.titleBy);if(o)return o}for(const o of["name","label","title","alt","text","href","id","key"]){const a=r[o];if(typeof a=="string"&&a.trim()){const c=n?.properties?.[o]?.format;if(c==="rich-text"||c==="html"){const u=En(a);if(u)return u;continue}return a}if(Array.isArray(a)){const c=a.map(u=>u==null?"":String(u)).filter(Boolean).join(",");if(c)return c}}const l=r.__resolveType;if(typeof l=="string"&&l)return He(l);if(n?.title){const o=Ye(n.title,r);if(o)return o;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function Pn(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function it(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=Pn(e);if(!n)return;const r=Ye(n,t);if(!r)return;const i=kt(r)||r;return Bn(i)}function wt(t){return t===jt||t===yn}function Me(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function Ee(t,e){const n=t.__resolveType??"";if(!n)return null;if(Ie(n)){const r=t.section??{};return It(r,e)}if(wt(n)){const r=t.variants?.[0]?.value;return r?Ee(r,e):null}return!ze(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Me(n,e)}function It(t,e){const n=t.__resolveType??"";if(!n)return null;if(wt(n)){const r=t.variants?.[0]?.value;return r?Ee(r,e):null}return!ze(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Me(n,e)}function Mn(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!ze(r)||!Object.hasOwn(e,r))return null;const i=Me(r,e);return i?{blockKey:r,...i}:null}function ms(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Me(r,n)}if(e.isHidden){const l=(Ie(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return Ee(l,n)}if(e.isLazy||Ie(t.__resolveType)){const r=t.section??{};return It(r,n)}return Ee(t,n)}const Un=new Set(["http:","https:","mailto:","tel:","ftp:"]);function Vn(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return Un.has(e.protocol)}catch{return!1}}function pe(t){const e=V.c(8),{active:n,label:r,onClick:i,children:l}=t,o=n?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==o?(a=Se("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",o),e[0]=o,e[1]=a):a=e[1];let c;return e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==i||e[6]!==a?(c=s.jsx("button",{type:"button","aria-label":r,"aria-pressed":n,onMouseDown:Kn,onClick:i,className:a,children:l}),e[2]=n,e[3]=l,e[4]=r,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function Kn(t){return t.preventDefault()}function Hn({schema:t,value:e,onChange:n,path:r,label:i}){const l=typeof e=="string"?e:"",o=J.useRef(n);o.current=n;const a=qt({extensions:[Xt.configure({heading:{levels:[1,2,3]}})],content:l||"",editorProps:{attributes:{class:Se("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:c})=>{const u=c.getHTML();o.current(u==="<p></p>"?"":u)}});return a?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ce,{htmlFor:r,children:i}),t.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:t.description})]}),s.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[s.jsx(pe,{active:a.isActive("bold"),label:"Bold",onClick:()=>a.chain().focus().toggleBold().run(),children:s.jsx(Ft,{size:14})}),s.jsx(pe,{active:a.isActive("italic"),label:"Italic",onClick:()=>a.chain().focus().toggleItalic().run(),children:s.jsx(Bt,{size:14})}),s.jsx(pe,{active:a.isActive("underline"),label:"Underline",onClick:()=>a.chain().focus().toggleUnderline().run(),children:s.jsx(Dt,{size:14})}),s.jsx(pe,{active:a.isActive("strike"),label:"Strikethrough",onClick:()=>a.chain().focus().toggleStrike().run(),children:s.jsx(Lt,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(pe,{active:a.isActive("heading",{level:1}),label:"Heading 1",onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),children:s.jsx(Et,{size:14})}),s.jsx(pe,{active:a.isActive("heading",{level:2}),label:"Heading 2",onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),children:s.jsx(zt,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(pe,{active:a.isActive("bulletList"),label:"Bullet list",onClick:()=>a.chain().focus().toggleBulletList().run(),children:s.jsx(Gt,{size:14})}),s.jsx(pe,{active:a.isActive("orderedList"),label:"Ordered list",onClick:()=>a.chain().focus().toggleOrderedList().run(),children:s.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(pe,{active:a.isActive("link"),label:"Link",onClick:()=>{const c=a.getAttributes("link").href,u=window.prompt("Link URL",c??"https://");u!==null&&(u===""?a.chain().focus().unsetLink().run():Vn(u)&&a.chain().focus().setLink({href:u}).run())},children:s.jsx(Yt,{size:14})})]}),s.jsx(Zt,{editor:a})]})]}):null}const Ne=t=>String(t).padStart(2,"0"),Wn="1900-01-01",Yn="2099-12-31",Gn="1900-01-01T00:00",qn="2099-12-31T23:59";function Xn(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${Ne(n.getUTCMonth()+1)}-${Ne(n.getUTCDate())}`}function Zn(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function Qn(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Ne(e.getMonth()+1)}-${Ne(e.getDate())}T${Ne(e.getHours())}:${Ne(e.getMinutes())}`}function Jn(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function er(t){const e=V.c(29),{id:n,withTime:r,value:i,onChange:l}=t,[o,a]=J.useState(!1);let c;e[0]!==i||e[1]!==r?(c=r?Qn(i):Xn(i),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;let d;e[3]!==l||e[4]!==r?(d=k=>{l(r?Jn(k.target.value):Zn(k.target.value))},e[3]=l,e[4]=r,e[5]=d):d=e[5];const m=d;let h;if(e[6]!==i){const k=i?new Date(i):null;h=k&&!Number.isNaN(k.getTime())?k:null,e[6]=i,e[7]=h}else h=e[7];const y=h;let v;e[8]!==l||e[9]!==y||e[10]!==r?(v=k=>{k&&(r&&y?k.setHours(y.getHours(),y.getMinutes(),0,0):k.setHours(0,0,0,0),l(k.toISOString()),a(!1))},e[8]=l,e[9]=y,e[10]=r,e[11]=v):v=e[11];const p=v,x=r?"datetime-local":"date",f=r?Gn:Wn,g=r?qn:Yn;let b;e[12]!==m||e[13]!==n||e[14]!==u||e[15]!==x||e[16]!==f||e[17]!==g?(b=s.jsx(ge,{id:n,type:x,min:f,max:g,value:u,onChange:m,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=m,e[13]=n,e[14]=u,e[15]=x,e[16]=f,e[17]=g,e[18]=b):b=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(Vt,{asChild:!0,children:s.jsx(De,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:s.jsx(Pt,{className:"h-4 w-4"})})}),e[19]=N):N=e[19];const T=y??void 0;let j;e[20]!==p||e[21]!==T?(j=s.jsx(Kt,{className:"w-auto p-0",align:"end",children:s.jsx(Ut,{mode:"single",selected:T,onSelect:p,initialFocus:!0})}),e[20]=p,e[21]=T,e[22]=j):j=e[22];let S;e[23]!==o||e[24]!==j?(S=s.jsxs(Ht,{open:o,onOpenChange:a,children:[N,j]}),e[23]=o,e[24]=j,e[25]=S):S=e[25];let w;return e[26]!==S||e[27]!==b?(w=s.jsxs("div",{className:"flex gap-1",children:[b,S]}),e[26]=S,e[27]=b,e[28]=w):w=e[28],w}function Oe(t){const e=V.c(8),{htmlFor:n,label:r,description:i}=t;let l;e[0]!==n||e[1]!==r?(l=s.jsx(ce,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=l):l=e[2];let o;e[3]!==i?(o=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs("div",{className:"space-y-0.5",children:[l,o]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function $e(t){const e=V.c(67),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="string"?r:"",c=n.format;if(c==="rich-text"||c==="rich-text-inline"||c==="html"){let p;return e[0]!==o||e[1]!==i||e[2]!==l||e[3]!==n||e[4]!==r?(p=s.jsx(Hn,{schema:n,value:r,onChange:i,path:l,label:o}),e[0]=o,e[1]=i,e[2]=l,e[3]=n,e[4]=r,e[5]=p):p=e[5],p}if(c==="textarea"||c==="markdown"){let p;e[6]!==o||e[7]!==l||e[8]!==n.description?(p=s.jsx(Oe,{htmlFor:l,label:o,description:n.description}),e[6]=o,e[7]=l,e[8]=n.description,e[9]=p):p=e[9];let x;e[10]!==i?(x=b=>i(b.target.value),e[10]=i,e[11]=x):x=e[11];let f;e[12]!==l||e[13]!==a||e[14]!==x?(f=s.jsx(Wt,{id:l,value:a,onChange:x,rows:4}),e[12]=l,e[13]=a,e[14]=x,e[15]=f):f=e[15];let g;return e[16]!==p||e[17]!==f?(g=s.jsxs("div",{className:"space-y-2",children:[p,f]}),e[16]=p,e[17]=f,e[18]=g):g=e[18],g}if(c==="date"||c==="date-time"){let p;e[19]!==o||e[20]!==l||e[21]!==n.description?(p=s.jsx(Oe,{htmlFor:l,label:o,description:n.description}),e[19]=o,e[20]=l,e[21]=n.description,e[22]=p):p=e[22];const x=c==="date-time";let f;e[23]!==i||e[24]!==l||e[25]!==a||e[26]!==x?(f=s.jsx(er,{id:l,withTime:x,value:a,onChange:i}),e[23]=i,e[24]=l,e[25]=a,e[26]=x,e[27]=f):f=e[27];let g;return e[28]!==p||e[29]!==f?(g=s.jsxs("div",{className:"space-y-2",children:[p,f]}),e[28]=p,e[29]=f,e[30]=g):g=e[30],g}if(c==="color-input"){let p;e[31]!==o||e[32]!==l||e[33]!==n.description?(p=s.jsx(Oe,{htmlFor:l,label:o,description:n.description}),e[31]=o,e[32]=l,e[33]=n.description,e[34]=p):p=e[34];const x=a||"#000000";let f;e[35]!==i?(f=S=>i(S.target.value),e[35]=i,e[36]=f):f=e[36];let g;e[37]!==x||e[38]!==f?(g=s.jsx("input",{type:"color",value:x,onChange:f,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[37]=x,e[38]=f,e[39]=g):g=e[39];let b;e[40]!==i?(b=S=>i(S.target.value),e[40]=i,e[41]=b):b=e[41];let N;e[42]!==l||e[43]!==a||e[44]!==b?(N=s.jsx(ge,{id:l,value:a,onChange:b,placeholder:"#000000",className:"h-10 flex-1"}),e[42]=l,e[43]=a,e[44]=b,e[45]=N):N=e[45];let T;e[46]!==g||e[47]!==N?(T=s.jsxs("div",{className:"flex items-center gap-2",children:[g,N]}),e[46]=g,e[47]=N,e[48]=T):T=e[48];let j;return e[49]!==p||e[50]!==T?(j=s.jsxs("div",{className:"space-y-2",children:[p,T]}),e[49]=p,e[50]=T,e[51]=j):j=e[51],j}let u;e[52]!==o||e[53]!==l||e[54]!==n.description?(u=s.jsx(Oe,{htmlFor:l,label:o,description:n.description}),e[52]=o,e[53]=l,e[54]=n.description,e[55]=u):u=e[55];const d=c==="url"?"url":"text";let m;e[56]!==i?(m=p=>i(p.target.value),e[56]=i,e[57]=m):m=e[57];const h=n.default!=null?String(n.default):void 0;let y;e[58]!==l||e[59]!==a||e[60]!==d||e[61]!==m||e[62]!==h?(y=s.jsx(ge,{id:l,type:d,value:a,onChange:m,placeholder:h,className:"h-10"}),e[58]=l,e[59]=a,e[60]=d,e[61]=m,e[62]=h,e[63]=y):y=e[63];let v;return e[64]!==u||e[65]!==y?(v=s.jsxs("div",{className:"space-y-2",children:[u,y]}),e[64]=u,e[65]=y,e[66]=v):v=e[66],v}function tr(t){const e=V.c(17),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="number"?r:"";let c;e[0]!==o||e[1]!==l?(c=s.jsx(ce,{htmlFor:l,children:o}),e[0]=o,e[1]=l,e[2]=c):c=e[2];let u;e[3]!==n.description?(u=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=d):d=e[7];let m;e[8]!==i?(m=v=>{const p=v.target.value;i(p===""?void 0:Number(p))},e[8]=i,e[9]=m):m=e[9];let h;e[10]!==a||e[11]!==l||e[12]!==m?(h=s.jsx(ge,{id:l,type:"number",value:a,onChange:m,className:"h-10"}),e[10]=a,e[11]=l,e[12]=m,e[13]=h):h=e[13];let y;return e[14]!==d||e[15]!==h?(y=s.jsxs("div",{className:"space-y-2",children:[d,h]}),e[14]=d,e[15]=h,e[16]=y):y=e[16],y}function nr(t){const e=V.c(17),{value:n,onChange:r,path:i,label:l,schema:o}=t,a=typeof n=="boolean"?n:!1;let c;e[0]!==l||e[1]!==i?(c=s.jsx(ce,{htmlFor:i,children:l}),e[0]=l,e[1]=i,e[2]=c):c=e[2];let u;e[3]!==o.description?(u=o.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=d):d=e[7];let m;e[8]!==r?(m=v=>r(v),e[8]=r,e[9]=m):m=e[9];let h;e[10]!==a||e[11]!==i||e[12]!==m?(h=s.jsx(Qt,{id:i,checked:a,onCheckedChange:m}),e[10]=a,e[11]=i,e[12]=m,e[13]=h):h=e[13];let y;return e[14]!==d||e[15]!==h?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[d,h]}),e[14]=d,e[15]=h,e[16]=y):y=e[16],y}const Ge="__enum_empty__";function qe(t){return t===""?Ge:String(t)}function rr(t,e){if(t===Ge)return"";const n=e.find(r=>qe(r)===t);return n!==void 0?n:t}function sr(t,e){return t==null?e.some(n=>n==="")?Ge:void 0:qe(t)}function ir(t){return t===""?"":String(t)}function or(t){const e=V.c(28),{schema:n,value:r,onChange:i,path:l,label:o}=t;let a;e[0]!==n.enum?(a=n.enum??[],e[0]=n.enum,e[1]=a):a=e[1];const c=a;let u;e[2]!==c||e[3]!==r?(u=sr(r,c),e[2]=c,e[3]=r,e[4]=u):u=e[4];const d=u;let m;e[5]!==o||e[6]!==l?(m=s.jsx(ce,{htmlFor:l,children:o}),e[5]=o,e[6]=l,e[7]=m):m=e[7];let h;e[8]!==n.description?(h=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=h):h=e[9];let y;e[10]!==m||e[11]!==h?(y=s.jsxs("div",{className:"space-y-0.5",children:[m,h]}),e[10]=m,e[11]=h,e[12]=y):y=e[12];let v;e[13]!==i||e[14]!==c?(v=N=>i(rr(N,c)),e[13]=i,e[14]=c,e[15]=v):v=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ht,{className:"h-10",children:s.jsx(yt,{placeholder:"Select..."})}),e[16]=p):p=e[16];let x;e[17]!==c?(x=c.map(lr),e[17]=c,e[18]=x):x=e[18];let f;e[19]!==x?(f=s.jsx(gt,{children:x}),e[19]=x,e[20]=f):f=e[20];let g;e[21]!==d||e[22]!==v||e[23]!==f?(g=s.jsxs(xt,{value:d,onValueChange:v,children:[p,f]}),e[21]=d,e[22]=v,e[23]=f,e[24]=g):g=e[24];let b;return e[25]!==g||e[26]!==y?(b=s.jsxs("div",{className:"space-y-2",children:[y,g]}),e[25]=g,e[26]=y,e[27]=b):b=e[27],b}function lr(t){const e=qe(t);return s.jsx(mt,{value:e,children:ir(t)},e)}function Rt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function ve(t){return t.normalize("NFC").trim()}function H(t,e){return ve(t)===ve(e)}function ot(t,e){return ve(t).replace(/\s+/g,"").toLowerCase()===ve(e).replace(/\s+/g,"").toLowerCase()}function Fe(t,e,n){const r=ve(n);if(t.some(o=>H(o,r)||H(o,n)))return t;const i=[...t];return i.some(o=>H(o,e))||i.push(e),i.push(n),i}function ar(t,e,n){if(n.length===0)return n;const r=Ce(t,e),i=n[0];return H(i,r)||H(i,t)?n.slice(1):n}function Ce(t,e){return e.title??Rt(t)}function hs(t,e){return e<=0?[]:t.slice(0,e)}function lt(t,e){const n=ve(e);return t.findIndex(r=>ve(r)===n)}function at(t,e){return t.type==="array"&&t.items||Pe(t)?!0:Array.isArray(e)}function cr(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Re(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const o of t){const a=e[o];if(!a||!at(a,n[o]))continue;const c=Ce(o,a);if(H(i,c)||H(i,o)||r.some(u=>H(u,c)||H(u,o)))return o}for(const o of t){const a=e[o];if(!a||!at(a,n[o]))continue;const c=n[o];if(!Array.isArray(c))continue;const u=a.items;for(let d=0;d<c.length;d++){const m=Te(c[d],d,u);if(H(m,i))return o}}for(const o of t){const a=e[o];if(a?.type!=="object"||!a.properties)continue;const c=Object.keys(a.properties),u=cr(n[o]),d=Ce(o,a);if(Re(c,a.properties,u,r)||(H(i,d)||H(i,o))&&Re(c,a.properties,u,r.slice(1)))return o}let l=null;for(const o of t){const a=e[o];if(a?.type!=="block-ref")continue;const c=Ce(o,a);if(!(i!==c&&i!==o)){if(r.length>1){const u=n[o];if(u&&typeof u=="object"&&!Array.isArray(u)){const d=r[1];if(Object.keys(u).some(h=>!h.startsWith("__")&&(ot(Rt(h),d)||ot(h,d))))return o}}l||(l=o)}}return l||null}function ur(t,e,n,r){return Re(t,e,n,r)}function fr(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const l=Object.keys(n.properties);if(Re(l,n.properties,r,i))return!0;const o=i[0];return!H(o,e)&&!H(o,t)?!1:i.length>1||Re(l,n.properties,r,i.slice(1))!==null}function dr(t,e,n,r){if(e.length===0)return null;for(let l=0;l<e.length;l++){const o=e[l],a=n.findIndex((c,u)=>H(Te(c,u,r),o));if(a>=0)return{index:a,innerPath:e.slice(l+1)}}const i=e.findIndex(l=>H(l,t));if(i>=0&&e.length>i+1){const l=e[i+1],o=n.findIndex((a,c)=>H(Te(a,c,r),l));if(o>=0)return{index:o,innerPath:e.slice(i+2)}}return null}function Ue(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===jt}function pr(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ue(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ue(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>Ue(n.resolveType)):!1}function mr(t,e){if(e==="global"||e==="sections"||Pe(t))return!0;const n=t.type==="array"?t.items:void 0;return n?pr(n):!1}function ct(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function hr(t,e,n,r,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const l=t.__resolveType;if(typeof l=="string"&&n){const o=Ke(l,n);if(o?.properties&&Object.keys(o.properties).length>0)return o}}if(n&&r&&i){const o=Ke(r,n)?.properties?.[i]?.items;if(o?.properties&&Object.keys(o.properties).length>0)return{...o,titleBy:o.titleBy??e?.titleBy}}return e}function yr(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function Ot(t){return t.map((e,n)=>({...e,index:n}))}function gr(t,e){if(e===t.length)return t;if(e<t.length)return Ot(t.slice(0,e));const n=Array.from({length:e-t.length},(r,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...n]}function xr(t){const e=V.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(vt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let l;e[1]!==r?(l=r&&s.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=l):l=e[2];let o;e[3]!==n?(o=s.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs(s.Fragment,{children:[i,s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[l,o]})]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function vr(t){const e=V.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:l,onRemove:o}=t;let a;e[0]!==n?(a={id:n,animateLayoutChanges:kr},e[0]=n,e[1]=a):a=e[1];const{attributes:c,listeners:u,setNodeRef:d,transform:m,isDragging:h}=an(a);let y;e[2]!==m?(y=cn.Transform.toString(m?{...m,x:0}:null),e[2]=m,e[3]=y):y=e[3];const v=h?0:void 0;let p;e[4]!==y||e[5]!==v?(p={transform:y,opacity:v},e[4]=y,e[5]=v,e[6]=p):p=e[6];const x=p;let f;e[7]!==l?(f=F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),l())},e[7]=l,e[8]=f):f=e[8];const g=h?"cursor-grabbing":"cursor-pointer";let b;e[9]!==g?(b=Se("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",g),e[9]=g,e[10]=b):b=e[10];let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(vt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=N):N=e[11];let T;e[12]!==i?(T=i&&s.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=T):T=e[13];let j;e[14]!==r?(j=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:r}),e[14]=r,e[15]=j):j=e[15];const S=`Open actions for ${r}`;let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Mt,{size:14}),e[16]=w):w=e[16];let k;e[17]!==S?(k=s.jsx(dn,{asChild:!0,children:s.jsx(De,{type:"button",variant:"ghost",size:"icon","aria-label":S,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:jr,onPointerDown:br,children:w})}),e[17]=S,e[18]=k):k=e[18];let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(bt,{size:14}),e[19]=_):_=e[19];let C;e[20]!==o?(C=s.jsx(pn,{align:"end",children:s.jsxs(mn,{className:"text-destructive focus:text-destructive",onClick:o,children:[_,"Delete"]})}),e[20]=o,e[21]=C):C=e[21];let I;e[22]!==k||e[23]!==C?(I=s.jsxs(hn,{children:[k,C]}),e[22]=k,e[23]=C,e[24]=I):I=e[24];let O;return e[25]!==c||e[26]!==r||e[27]!==u||e[28]!==l||e[29]!==d||e[30]!==x||e[31]!==j||e[32]!==I||e[33]!==f||e[34]!==b||e[35]!==T?(O=s.jsxs("div",{ref:d,style:x,...c,...u,role:"button",tabIndex:0,onClick:l,onKeyDown:f,className:b,title:r,children:[N,T,j,I]}),e[25]=c,e[26]=r,e[27]=u,e[28]=l,e[29]=d,e[30]=x,e[31]=j,e[32]=I,e[33]=f,e[34]=b,e[35]=T,e[36]=O):O=e[36],O}function br(t){return t.stopPropagation()}function jr(t){return t.stopPropagation()}function kr(){return!1}function Be(t){const e=V.c(24),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:m,containerResolveType:h,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:p}=t,x=a===void 0?[]:a,f=Array.isArray(r)?r:[],g=n.items,b=yr(l),N=mr(n,b),T=dr(o,x,f,g),j=T?.index??null,[S,w]=J.useState(()=>ct(f.length)),[k,_]=J.useState(null),[C,I]=J.useState(l),[O,F]=J.useState(f.length),W=J.useRef(!1);C!==l?(I(l),F(f.length),w(ct(f.length))):O!==f.length&&(F(f.length),w(A=>gr(A,f.length)));let L;e[0]!==g?(L=(A,R)=>Te(A,R,g),e[0]=g,e[1]=L):L=e[1];const $=L,ee=A=>{if(W.current)return;const R=$(f[A],A);c?.(Fe(x,o,R))},G=A=>{const R=[...f,A];i(R);const D=R.length-1,M=Te(A,D,g);c?.(Fe(x,o,M))},te=()=>{const A=g?.type,R=g?.default!==void 0?g.default:A==="object"?{}:A==="block-ref"?(()=>{const ye=g?.anyOfRefs?.[0]?.resolveType;return typeof ye!="string"||Le(ye)?{}:{__resolveType:ye}})():A==="number"||A==="integer"?0:A==="boolean"?!1:A==="array"?[]:"",D=[...f,R];i(D);const M=D.length-1,de=Te(R,M,g);c?.(Fe(x,o,de))},K=()=>{if(N){if(!y){Ae.error("Start the preview dev server to add sections.");return}if(p){p({append:G});return}Ae.error("Section picker is not available in this editor.");return}te()},q=A=>{if(i(f.filter((R,D)=>D!==A)),j===A){const R=$(f[A],A),D=lt(x,R);c?.(D>=0?x.slice(0,D):[])}},ne=(A,R)=>{const D=[...f];D[A]=R,i(D)};let E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E={activationConstraint:{distance:8}},e[2]=E):E=e[2];let Y;e[3]===Symbol.for("react.memo_cache_sentinel")?(Y={coordinateGetter:un},e[3]=Y):Y=e[3];const oe=Jt(Je(tn,E),Je(en,Y)),re=S.map(Nr);let X;e[4]===Symbol.for("react.memo_cache_sentinel")?(X=A=>{_(String(A.active.id))},e[4]=X):X=e[4];const Z=X,me=A=>{_(null);const{active:R,over:D}=A;if(!D||R.id===D.id)return;const M=re.indexOf(String(R.id)),de=re.indexOf(String(D.id));M===-1||de===-1||(w(ye=>Ot(et([...ye],M,de))),i(et([...f],M,de)),W.current=!0,requestAnimationFrame(()=>{W.current=!1}))};let U;e[5]===Symbol.for("react.memo_cache_sentinel")?(U=()=>{_(null)},e[5]=U):U=e[5];const z=U,P=k?S.find(A=>A.id===k):null,Q=P!=null?f[P.index]:void 0,ue=P!=null&&Q!==void 0?$(Q,P.index):null,fe=P!=null&&Q!==void 0?it(Q,g):void 0;if(j!==null&&j<f.length){const A=f[j],R=hr(A,g,u,h,b),D=()=>{const M=$(A,j),de=Fe(x,o,M),ye=lt(de,M);return ye>=0?de.slice(0,ye+1):de};return s.jsx("div",{className:"min-w-0",children:R?.type==="object"&&R.properties?s.jsx(Xe,{schema:R,value:A,onChange:M=>ne(j,M),basePath:`${l}.${j}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:M=>{c?.([...D(),...M])},meta:u,decofile:d,onSaveReferencedBlock:m,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:p}):R?$t({schema:R,value:A,onChange:M=>ne(j,M),path:`${l}.${j}`,label:R.title??`Item ${j+1}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:M=>{c?.([...D(),...M])},meta:u,decofile:d,onSaveReferencedBlock:m,previewBaseUrl:y,onAddSectionItem:v,onRequestAddSection:p}):null})}const be="space-y-2";let le;e[6]!==o?(le=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[6]=o,e[7]=le):le=e[7];const B=f.length>0&&s.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:f.length});let se;e[8]!==le||e[9]!==B?(se=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[le,B]}),e[8]=le,e[9]=B,e[10]=se):se=e[10];let ae;e[11]!==n.description?(ae=n.description&&s.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=ae):ae=e[12];let he;e[13]!==se||e[14]!==ae?(he=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[se,ae]}),e[13]=se,e[14]=ae,e[15]=he):he=e[15];const _e=f.length>0&&s.jsx("div",{className:Se(k&&"cursor-grabbing"),children:s.jsxs(nn,{sensors:oe,collisionDetection:rn,onDragStart:Z,onDragEnd:me,onDragCancel:z,children:[s.jsx(sn,{items:re,strategy:on,children:s.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:S.map(A=>{const R=f[A.index];if(R===void 0)return null;const D=$(R,A.index),M=it(R,g);return s.jsx(vr,{sortableId:A.id,labelText:D,imageSrc:M,onOpen:()=>ee(A.index),onRemove:()=>q(A.index)},A.id)})})}),s.jsx(ln,{dropAnimation:null,children:ue?s.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:s.jsx(xr,{labelText:ue,imageSrc:fe})}):null})]})});let je;e[16]===Symbol.for("react.memo_cache_sentinel")?(je=s.jsx(fn,{size:14}),e[16]=je):je=e[16];const xe=N?"Add section":"Add item";let ie;e[17]!==K||e[18]!==xe?(ie=s.jsxs("button",{type:"button",onClick:K,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[je,xe]}),e[17]=K,e[18]=xe,e[19]=ie):ie=e[19];let ke;return e[20]!==he||e[21]!==_e||e[22]!==ie?(ke=s.jsxs("div",{className:be,children:[he,_e,ie]}),e[20]=he,e[21]=_e,e[22]=ie,e[23]=ke):ke=e[23],ke}function Nr(t){return t.id}function Tr(t){const e=V.c(43),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:m,previewBaseUrl:h,onAddSectionItem:y,onRequestAddSection:v}=t;let p;e[0]!==a?(p=a===void 0?[]:a,e[0]=a,e[1]=p):p=e[1];const x=p,[f,g]=J.useState(!1);let b;e[2]!==r?(b=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=b):b=e[3];const N=b;if(!n.properties)return null;let T;e[4]!==l?(T=l.split(".").pop()??l,e[4]=l,e[5]=T):T=e[5];const j=T;let S;e[6]!==x||e[7]!==j||e[8]!==o||e[9]!==N||e[10]!==n?(S=fr(j,o,n,N,x),e[6]=x,e[7]=j,e[8]=o,e[9]=N,e[10]=n,e[11]=S):S=e[11];const k=f||S,_=`${l}-fields`;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=()=>g(Sr),e[12]=C):C=e[12];let I;e[13]!==k?(I=s.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:k?s.jsx(Nt,{size:16}):s.jsx(Tt,{size:16})}),e[13]=k,e[14]=I):I=e[14];let O;e[15]!==o?(O=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[15]=o,e[16]=O):O=e[16];let F;e[17]!==_||e[18]!==k||e[19]!==I||e[20]!==O?(F=s.jsxs("button",{type:"button","aria-expanded":k,"aria-controls":_,onClick:C,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[I,O]}),e[17]=_,e[18]=k,e[19]=I,e[20]=O,e[21]=F):F=e[21];let W;e[22]!==n.description?(W=n.description&&s.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=W):W=e[23];let L;e[24]!==x||e[25]!==_||e[26]!==d||e[27]!==k||e[28]!==u||e[29]!==N||e[30]!==y||e[31]!==c||e[32]!==i||e[33]!==v||e[34]!==m||e[35]!==l||e[36]!==h||e[37]!==n?(L=k&&s.jsx("div",{id:_,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:s.jsx(Xe,{schema:n,value:N,onChange:i,basePath:l,breadcrumbPath:x,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:m,previewBaseUrl:h,onAddSectionItem:y,onRequestAddSection:v})}),e[24]=x,e[25]=_,e[26]=d,e[27]=k,e[28]=u,e[29]=N,e[30]=y,e[31]=c,e[32]=i,e[33]=v,e[34]=m,e[35]=l,e[36]=h,e[37]=n,e[38]=L):L=e[38];let $;return e[39]!==W||e[40]!==L||e[41]!==F?($=s.jsxs("div",{className:"min-w-0 space-y-2",children:[F,W,L]}),e[39]=W,e[40]=L,e[41]=F,e[42]=$):$=e[42],$}function Sr(t){return!t}function _r(t){if(!t?.properties)return{};const e={};for(const[n,r]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(r.default!==void 0?e[n]=r.default:r.type==="boolean"?e[n]=!1:r.type==="string"?e[n]="":r.type==="number"||r.type==="integer"?e[n]=0:r.type==="object"&&(e[n]={}));return e}function Ar(t){const e=V.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Tn,{asChild:!0,children:s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[s.jsx(Nn,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs(Sn,{children:[r,s.jsxs(_n,{side:"top",className:"max-w-[260px]",children:["Edits the saved block “",n,"”. Changes apply everywhere this loader is referenced on your site."]})]}),e[1]=n,e[2]=i):i=e[2],i}function Cr(t){const e=V.c(28),{path:n,open:r,onOpenChange:i,title:l,nested:o,nestedBlockRef:a,globalBlockKey:c}=t,u=`${n}-loader-config`,d=a&&"ml-1";let m;e[0]!==d?(m=Se("rounded-lg border border-border/80 bg-muted/30",d),e[0]=d,e[1]=m):m=e[1];let h;e[2]!==i||e[3]!==r?(h=()=>i(!r),e[2]=i,e[3]=r,e[4]=h):h=e[4];let y;e[5]!==r?(y=s.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?s.jsx(Nt,{size:16}):s.jsx(Tt,{size:16})}),e[5]=r,e[6]=y):y=e[6];let v;e[7]!==l?(v=s.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:l}),e[7]=l,e[8]=v):v=e[8];let p;e[9]!==c?(p=c&&s.jsx(Ar,{blockKey:c}),e[9]=c,e[10]=p):p=e[10];let x;e[11]!==v||e[12]!==p?(x=s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[v,p]}),e[11]=v,e[12]=p,e[13]=x):x=e[13];let f;e[14]!==u||e[15]!==r||e[16]!==h||e[17]!==y||e[18]!==x?(f=s.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":u,onClick:h,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[y,x]}),e[14]=u,e[15]=r,e[16]=h,e[17]=y,e[18]=x,e[19]=f):f=e[19];let g;e[20]!==u||e[21]!==o||e[22]!==r?(g=r&&s.jsx("div",{id:u,className:"border-t border-border/60 px-4 pb-4 pt-3",children:s.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[20]=u,e[21]=o,e[22]=r,e[23]=g):g=e[23];let b;return e[24]!==m||e[25]!==f||e[26]!==g?(b=s.jsxs("div",{className:m,children:[f,g]}),e[24]=m,e[25]=f,e[26]=g,e[27]=b):b=e[27],b}function ut(t){const e=V.c(35),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:d,onSaveReferencedBlock:m}=t,h=(n.anyOfRefs??[]).filter(Rr),y=d&&r?Mn(r,d):null,v=y?.data??r,p=y?null:St(v),x=p??v,f=Rn(h,{savedBlockKey:y?.blockKey,editorValue:v}),g=f.length>0?On(v,f,y?.blockKey):f[0]?.resolveType??"",N=n.type==="block-ref"&&f.some(Ir);let T;e[0]!==o||e[1]!==l?(T=o??(l.includes(".")?l.split(".")[0]:l),e[0]=o,e[1]=l,e[2]=T):T=e[2];const j=T;let S;e[3]!==a?(S=a??[],e[3]=a,e[4]=S):S=e[4];const w=S,k=N&&w[0]===j?w.slice(1):w,_=N?E=>{c?.([j,...E])}:c,[C,I]=J.useState(g),[O,F]=J.useState(g);O!==g&&(F(g),I(g));const[W,L]=J.useState(()=>Fn(v,y?.blockKey));if(f.length>0){const E=C||g;let Y;e[5]!==E?(Y=B=>B.resolveType===E,e[5]=E,e[6]=Y):Y=e[6];const oe=f.find(Y),re=st(v,u,oe?.schema),X=$n(re??oe?.schema??null,n.discriminatorKey),Z=n.discriminatorKey,me=B=>{I(B);const se=f.find(ie=>ie.resolveType===B),ae=st(v,u,se?.schema),he=new Set(Object.keys((ae??se?.schema)?.properties??{})),_e=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},je=Object.fromEntries(Object.entries(_e).filter(ie=>{const[ke]=ie;return he.has(ke)})),xe={..._r(se?.schema),...je};if(Z){const ie=se?.discriminatorValue??B;i({...xe,[Z]:ie});return}if(Le(B)){i(xe);return}i({...xe,__resolveType:B})};let U;e[7]!==E||e[8]!==Z||e[9]!==i?(U=B=>{if(Z||!Le(E)||B===null||typeof B!="object"||Array.isArray(B)){i(B);return}const{__resolveType:se,...ae}=B;i(ae)},e[7]=E,e[8]=Z,e[9]=i,e[10]=U):U=e[10];const z=U,P=X?.properties?s.jsx(Xe,{schema:X,value:x,onChange:B=>{if(y&&m){m(y.blockKey,B);return}if(p){i({...v,section:B});return}z(B)},basePath:l,breadcrumbPath:k,onBreadcrumbChange:_,meta:u,decofile:d,onSaveReferencedBlock:m}):null;let Q;e[11]!==l?(Q=l.includes("."),e[11]=l,e[12]=Q):Q=e[12];const ue=Q;let fe;e[13]!==o||e[14]!==l?(fe=s.jsx(ce,{htmlFor:l,children:o}),e[13]=o,e[14]=l,e[15]=fe):fe=e[15];let be;e[16]===Symbol.for("react.memo_cache_sentinel")?(be=s.jsx(ht,{children:s.jsx(yt,{placeholder:"Select..."})}),e[16]=be):be=e[16];let le;return e[17]!==n.description?(le=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[17]=n.description,e[18]=le):le=e[18],s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[fe,s.jsxs(xt,{value:E||void 0,onValueChange:me,children:[be,s.jsx(gt,{children:f.map(wr)})]}),le]}),P&&(N?s.jsx(Cr,{path:l,open:W,onOpenChange:L,title:ue?"Configuration":"Loader configuration",nested:P,nestedBlockRef:ue,globalBlockKey:y?.blockKey}):P)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let $;e[19]!==o||e[20]!==l?($=s.jsx(ce,{htmlFor:l,children:o}),e[19]=o,e[20]=l,e[21]=$):$=e[21];const ee=r!=null?String(r):"";let G;e[22]!==i?(G=E=>i(E.target.value),e[22]=i,e[23]=G):G=e[23];const te=n.description??"";let K;e[24]!==l||e[25]!==ee||e[26]!==G||e[27]!==te?(K=s.jsx("input",{id:l,type:"text",value:ee,onChange:G,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:te}),e[24]=l,e[25]=ee,e[26]=G,e[27]=te,e[28]=K):K=e[28];let q;e[29]!==n.description?(q=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=q):q=e[30];let ne;return e[31]!==$||e[32]!==K||e[33]!==q?(ne=s.jsxs("div",{className:"space-y-1.5",children:[$,K,q]}),e[31]=$,e[32]=K,e[33]=q,e[34]=ne):ne=e[34],ne}function wr(t){const e=t.title&&!t.title.includes("/")?t.title:gn(t.resolveType)??He(t.resolveType);return s.jsx(mt,{value:t.resolveType,children:e},t.resolveType)}function Ir(t){return t.resolveType.includes("/")&&!Le(t.resolveType)}function Rr(t){return t.resolveType!==""}function ft(t){const e=V.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=s.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Or(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function $r(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function dt(t){const e=V.c(72),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=n.format==="video-uri",c=kt(r),[u,d]=J.useState(!1),[m,h]=J.useState(!1),y=c?Or(c):"",v=y?$r(y):"",p=Cn(),x=bn();let f;e[0]!==p.data?.configs?(f=function(){const z=p.data?.configs??[];if(z.length===1)return z[0].id;if(z.length===0)return null;const P=typeof window<"u"?window.localStorage.getItem(jn):null;return z.some(Q=>Q.id===P)?P:null},e[0]=p.data?.configs,e[1]=f):f=e[1];const g=f;let b;e[2]!==a||e[3]!==i||e[4]!==g||e[5]!==d||e[6]!==x?(b=async function(z){if(!z)return;let P=Array.from(z);if(P.length===0)return;if(a&&(P=P.filter(Fr),P.length===0)){Ae.error("Please drop a video file (mp4, webm, …).");return}const Q=g();if(!Q){d(!0);return}try{const ue=await x.mutateAsync({configId:Q,file:P[0]});i(ue.publicUrl),P.length>1&&Ae.info(`Uploaded ${P[0].name}; extra files were ignored (single-select field).`)}catch(ue){const fe=ue;Ae.error(fe instanceof Error?fe.message:"Upload failed")}},e[2]=a,e[3]=i,e[4]=g,e[5]=d,e[6]=x,e[7]=b):b=e[7];const N=b;let T;e[8]!==h?(T=function(z){z.preventDefault(),z.dataTransfer.types.includes("Files")&&h(!0)},e[8]=h,e[9]=T):T=e[9];const j=T;let S;e[10]!==h?(S=function(z){z.currentTarget===z.target&&h(!1)},e[10]=h,e[11]=S):S=e[11];const w=S;let k;e[12]!==N||e[13]!==h?(k=function(z){z.preventDefault(),h(!1),N(z.dataTransfer.files)},e[12]=N,e[13]=h,e[14]=k):k=e[14];const _=k;let C;e[15]!==o||e[16]!==l?(C=s.jsx(ce,{htmlFor:l,className:"text-muted-foreground",children:o}),e[15]=o,e[16]=l,e[17]=C):C=e[17];let I;e[18]!==n.description?(I=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=I):I=e[19];let O;e[20]!==C||e[21]!==I?(O=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[C,I]}),e[20]=C,e[21]=I,e[22]=O):O=e[22];const F=m&&"border-primary ring-2 ring-primary/30",W=x.isPending&&"pointer-events-none opacity-60";let L;e[23]!==W||e[24]!==F?(L=Se("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",F,W),e[23]=W,e[24]=F,e[25]=L):L=e[25];let $;e[26]!==v||e[27]!==y||e[28]!==a||e[29]!==d||e[30]!==c||e[31]!==x.isPending?($=c?a?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:s.jsx("video",{src:c,preload:"metadata",className:"h-full w-full object-contain"},c)}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[s.jsx(Ze,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:y}),s.jsx(ft,{ext:v})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[s.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:s.jsx(Qe,{size:18,className:"text-muted-foreground"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:y}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:c})]}),s.jsx(ft,{ext:v})]}):s.jsxs("button",{type:"button",onClick:()=>d(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[a?s.jsx(Ze,{size:20}):s.jsx(Qe,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:x.isPending?"Uploading…":a?"Drop a video here or click to browse":"Drop a file or click to browse"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[26]=v,e[27]=y,e[28]=a,e[29]=d,e[30]=c,e[31]=x.isPending,e[32]=$):$=e[32];let ee;e[33]!==m?(ee=m&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:s.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[33]=m,e[34]=ee):ee=e[34];let G;e[35]!==w||e[36]!==j||e[37]!==_||e[38]!==L||e[39]!==$||e[40]!==ee?(G=s.jsxs("div",{onDragOver:j,onDragLeave:w,onDrop:_,className:L,children:[$,ee]}),e[35]=w,e[36]=j,e[37]=_,e[38]=L,e[39]=$,e[40]=ee,e[41]=G):G=e[41];let te;e[42]!==i?(te=U=>i(U.target.value),e[42]=i,e[43]=te):te=e[43];let K;e[44]!==l||e[45]!==c||e[46]!==te?(K=s.jsx(ge,{id:l,type:"url",value:c,onChange:te,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[44]=l,e[45]=c,e[46]=te,e[47]=K):K=e[47];let q;e[48]!==d?(q=()=>d(!0),e[48]=d,e[49]=q):q=e[49];let ne;e[50]===Symbol.for("react.memo_cache_sentinel")?(ne=s.jsx(An,{size:14}),e[50]=ne):ne=e[50];const E=c?"Replace":"Browse";let Y;e[51]!==q||e[52]!==E?(Y=s.jsxs(De,{type:"button",variant:"outline",size:"sm",onClick:q,className:"h-9 shrink-0",children:[ne,E]}),e[51]=q,e[52]=E,e[53]=Y):Y=e[53];let oe;e[54]!==i||e[55]!==c?(oe=c&&s.jsx(De,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:s.jsx(bt,{size:14})}),e[54]=i,e[55]=c,e[56]=oe):oe=e[56];let re;e[57]!==K||e[58]!==Y||e[59]!==oe?(re=s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[K,Y,oe]}),e[57]=K,e[58]=Y,e[59]=oe,e[60]=re):re=e[60];let X;e[61]!==i?(X=U=>i(U),e[61]=i,e[62]=X):X=e[62];let Z;e[63]!==u||e[64]!==d||e[65]!==X?(Z=s.jsx(kn,{open:u,onOpenChange:d,mode:"any",onSelect:X}),e[63]=u,e[64]=d,e[65]=X,e[66]=Z):Z=e[66];let me;return e[67]!==G||e[68]!==re||e[69]!==Z||e[70]!==O?(me=s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[O,G,re,Z]}),e[67]=G,e[68]=re,e[69]=Z,e[70]=O,e[71]=me):me=e[71],me}function Fr(t){return t.type.startsWith("video/")}const Br="website/loaders/secret.ts";function we(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Dr(){return{__resolveType:Br,name:"",encrypted:""}}function Lr(t){const{value:e,...n}=t;return n}function Ve(t){const e=V.c(45),{schema:n,value:r,onChange:i,label:l,path:o}=t;if(typeof r=="string"||r==null&&!we(r)){const S=typeof r=="string"?r:"";let w;e[0]!==l||e[1]!==o?(w=s.jsx(ce,{htmlFor:o,className:"text-sm font-medium",children:l}),e[0]=l,e[1]=o,e[2]=w):w=e[2];let k;e[3]!==n.description?(k=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=k):k=e[4];let _;e[5]!==i?(_=O=>i(O.target.value),e[5]=i,e[6]=_):_=e[6];let C;e[7]!==o||e[8]!==S||e[9]!==_?(C=s.jsx(ge,{id:o,type:"password",value:S,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:_,className:"h-10"}),e[7]=o,e[8]=S,e[9]=_,e[10]=C):C=e[10];let I;return e[11]!==w||e[12]!==k||e[13]!==C?(I=s.jsxs("div",{className:"space-y-2",children:[w,k,C]}),e[11]=w,e[12]=k,e[13]=C,e[14]=I):I=e[14],I}let a;e[15]!==r?(a=we(r)?r:Dr(),e[15]=r,e[16]=a):a=e[16];const c=a,u=typeof c.name=="string"?c.name:"",d=typeof c.encrypted=="string"&&c.encrypted,m=`${o}-name`;let h;e[17]!==l||e[18]!==m?(h=s.jsx(ce,{htmlFor:m,className:"text-sm font-medium",children:l}),e[17]=l,e[18]=m,e[19]=h):h=e[19];let y;e[20]!==n.description?(y=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=y):y=e[21];const v=`${o}-name`;let p;e[22]!==c||e[23]!==i?(p=S=>i({...c,name:S.target.value}),e[22]=c,e[23]=i,e[24]=p):p=e[24];let x;e[25]!==u||e[26]!==v||e[27]!==p?(x=s.jsx(ge,{id:v,value:u,placeholder:"Secret name",onChange:p,className:"h-10"}),e[25]=u,e[26]=v,e[27]=p,e[28]=x):x=e[28];const f=`${o}-value`,g=d?"Leave blank to keep current value":"Secret value";let b;e[29]!==c||e[30]!==d||e[31]!==i?(b=S=>{const w=S.target.value;if(!w){i(d?Lr(c):c);return}i({...c,value:w})},e[29]=c,e[30]=d,e[31]=i,e[32]=b):b=e[32];let N;e[33]!==b||e[34]!==f||e[35]!==g?(N=s.jsx(ge,{id:f,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:g,onChange:b,className:"h-10"}),e[33]=b,e[34]=f,e[35]=g,e[36]=N):N=e[36];let T;e[37]!==d?(T=d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=d,e[38]=T):T=e[38];let j;return e[39]!==N||e[40]!==T||e[41]!==h||e[42]!==y||e[43]!==x?(j=s.jsxs("div",{className:"space-y-2",children:[h,y,x,N,T]}),e[39]=N,e[40]=T,e[41]=h,e[42]=y,e[43]=x,e[44]=j):j=e[44],j}function Er(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const n={};for(const[r,i]of Object.entries(e))r.startsWith("__")||(typeof i=="string"?n[r]={type:"string"}:typeof i=="number"?n[r]={type:"number"}:typeof i=="boolean"&&(n[r]={type:"boolean"}));return Object.keys(n).length>0?{type:"object",properties:n}:void 0}const zr=new Set(["__resolveType","@type"]);function Pr(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function Mr(t){if(Pe(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function pt(t){if(t.type==="array"&&t.items)return t;const e=t.items??Mr(t);return e?{...t,type:"array",items:e}:null}function Ur(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function $t(t){const{schema:e,value:n}=t;if(nt(n)){const o=xn(n),a=pt(e);if(o!==null&&a)return s.jsx(Be,{...t,schema:a,value:o,onChange:c=>t.onChange(vn(n,c))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&Pe(e)){const o=pt(e);if(o)return s.jsx(Be,{...t,schema:o,value:n,onChange:t.onChange},t.path)}if(Array.isArray(n)&&!nt(n)&&e.type==="block-ref"){const o=Er(n);if(o){const a={...e,type:"array",items:o};return s.jsx(Be,{...t,schema:a,value:n,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){const o=Pr(e);return o==="image"?s.jsx(rt,{...t},t.path):o==="file"?s.jsx(dt,{...t},t.path):e.anyOfRefs?s.jsx(ut,{...t},t.path):null}if(e.format==="image-uri")return s.jsx(rt,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return s.jsx(dt,{...t},t.path);if(e.enum&&e.enum.length>0)return s.jsx(or,{...t},t.path);if(e.type==="anyOf")return s.jsx(ut,{...t},t.path);if(we(n)||e.format==="password"||n==null&&e.format==="password")return s.jsx(Ve,{...t},t.path);const r=n??Ur(e.type,e.default);if(r==null)return we(n)?s.jsx(Ve,{...t},t.path):null;if(we(r))return s.jsx(Ve,{...t,value:r},t.path);const i={...t,value:r},l=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(l==="array"||Array.isArray(r))return s.jsx(Be,{...i},t.path);switch(l){case"boolean":return s.jsx(nr,{...i},t.path);case"number":case"integer":return s.jsx(tr,{...i},t.path);case"string":{const o=e.format;return o==="color-input"?s.jsx($e,{...i},t.path):o==="textarea"||o==="rich-text"||o==="html"?s.jsx($e,{...i},t.path):s.jsx($e,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?s.jsx(Tr,{...i},t.path):null;default:return s.jsx($e,{...i},t.path)}}function Xe(t){const e=V.c(15),{schema:n,value:r,onChange:i,basePath:l,breadcrumbPath:o,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:d,previewBaseUrl:m,onAddSectionItem:h,onRequestAddSection:y}=t;let v,p;if(e[0]!==l||e[1]!==u||e[2]!==c||e[3]!==h||e[4]!==a||e[5]!==i||e[6]!==y||e[7]!==d||e[8]!==m||e[9]!==n.properties||e[10]!==o||e[11]!==r){p=Symbol.for("react.early_return_sentinel");e:{const x=o===void 0?[]:o,f=n.properties;if(!f){p=null;break e}const g=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},b=Object.keys(f).filter(_=>!zr.has(_)&&f[_]?.hidden!==!0);if(b.length===0){let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[14]=_):_=e[14],p=_;break e}const N=(_,C)=>{i({...g,[_]:C})},T=typeof g.__resolveType=="string"?g.__resolveType:void 0,j=x.length>0?ur(b,f,g,x):null,S=j?f[j]:null,w=j&&S?[j]:b,k=j&&S?ar(j,S,x):x;v=s.jsx("div",{className:"min-w-0 space-y-6",children:w.map(_=>{const C=f[_];if(!C)return null;const I=l?`${l}.${_}`:_,O=Ce(_,C);return $t({schema:C,value:g[_],onChange:F=>N(_,F),path:I,label:O,breadcrumbPath:k,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:d,containerResolveType:T,previewBaseUrl:m,onAddSectionItem:h,onRequestAddSection:y})})})}e[0]=l,e[1]=u,e[2]=c,e[3]=h,e[4]=a,e[5]=i,e[6]=y,e[7]=d,e[8]=m,e[9]=n.properties,e[10]=o,e[11]=r,e[12]=v,e[13]=p}else v=e[12],p=e[13];return p!==Symbol.for("react.early_return_sentinel")?p:v}export{Xe as S,$t as a,hs as b,$e as c,Ye as r,Bn as s,ms as u};
|