decocms 2.443.3 → 2.443.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/dist/client/assets/{AlertCircle-CZUdxzu_.js → AlertCircle-C1fOwBkl.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-Ckf8qDoK.js → ArrowUpRight-BsrA4tbC.js} +1 -1
  3. package/dist/client/assets/{Check-xwts9G2J.js → Check-CsP_pvqo.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-CdtozJUx.js → CheckCircle-mDRTMVYu.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-C1vxQNd3.js → ChevronDown-Da6Jbs2A.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-D5DpowYO.js → ChevronRight-9O5_X961.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-CBggsaUA.js → ChevronUp-DnPjXbn4.js} +1 -1
  8. package/dist/client/assets/{Container-BCobWGsJ.js → Container-C9Kz0cwV.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-BGN9ibyU.js → DotsVertical-Dfjgq8zF.js} +1 -1
  10. package/dist/client/assets/{Eye-MHwkC0Bm.js → Eye-ajWxW8TA.js} +1 -1
  11. package/dist/client/assets/{FilterLines-MmWX7Ysm.js → FilterLines-PPD0xf3b.js} +1 -1
  12. package/dist/client/assets/{Globe01-ZT5vmTMf.js → Globe01-BwNaijNv.js} +1 -1
  13. package/dist/client/assets/{HardDrive-CiJMrXnz.js → HardDrive-BwX3ed8Q.js} +1 -1
  14. package/dist/client/assets/{Key01-6HahYsd8.js → Key01-B72Gy8BE.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-DyZjuYqx.js → LinkExternal01-BAdhV0q5.js} +1 -1
  16. package/dist/client/assets/{Monitor01-DQ4W7WkG.js → Monitor01-Cmkratd8.js} +1 -1
  17. package/dist/client/assets/{Palette-Bc5k-b6V.js → Palette-BPjy3HGF.js} +1 -1
  18. package/dist/client/assets/{Play-Dkm_MGgj.js → Play-Cwy1ezx1.js} +1 -1
  19. package/dist/client/assets/{Plus-CsnODh95.js → Plus-doXHkVHa.js} +1 -1
  20. package/dist/client/assets/{RefreshCcw01-B_9fKaFo.js → RefreshCcw01-CSpqWFa2.js} +1 -1
  21. package/dist/client/assets/{SearchMd-CTsuydPj.js → SearchMd-Bl17fAPU.js} +1 -1
  22. package/dist/client/assets/{Settings02-DSEzadZL.js → Settings02-SjRctAdp.js} +1 -1
  23. package/dist/client/assets/{Shield01-DOIioasK.js → Shield01-BrYiuS64.js} +1 -1
  24. package/dist/client/assets/{Star01-Ytz2fdRH.js → Star01-BlPilctm.js} +1 -1
  25. package/dist/client/assets/{Stars01-DxQPpWJA.js → Stars01-oDsL4ack.js} +1 -1
  26. package/dist/client/assets/{Stars02-qXelOgIp.js → Stars02-CCPVMnWn.js} +1 -1
  27. package/dist/client/assets/{Sun-pWEzytrr.js → Sun-B31oi4eI.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-BcpyEVy6.js → SwitchHorizontal01-D4Swb3JX.js} +1 -1
  29. package/dist/client/assets/{Tool01-B9i3jYjq.js → Tool01-G9WoiehH.js} +1 -1
  30. package/dist/client/assets/{Trash01-BIBfIkQ_.js → Trash01-CNj6fyzQ.js} +1 -1
  31. package/dist/client/assets/{Upload01-Dh5J3z7m.js → Upload01-8N4jWZ6D.js} +1 -1
  32. package/dist/client/assets/{User01-C_ID9x9E.js → User01-DfX22WyQ.js} +1 -1
  33. package/dist/client/assets/{Users01-DqbuPj9p.js → Users01-FEXDN87U.js} +1 -1
  34. package/dist/client/assets/{Users03-CNIYpSXa.js → Users03-B0HlZt2l.js} +1 -1
  35. package/dist/client/assets/{X-5JYlDYV-.js → X-BkK5F0Sb.js} +1 -1
  36. package/dist/client/assets/{XCircle-Cri1mHI7.js → XCircle-CIThxWcq.js} +1 -1
  37. package/dist/client/assets/{XClose-P7eY6MuP.js → XClose-BfGF8Yxq.js} +1 -1
  38. package/dist/client/assets/{Zap-DUKmeTe3.js → Zap-B3tBDVDH.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-D7KADoNB.js → ZapSquare-mNSHVqng.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-DMIdbERz.js → ZoomOut-BCow3TNO.js} +1 -1
  41. package/dist/client/assets/{access-gate-C1FV8QYc.js → access-gate-CRczzr4P.js} +1 -1
  42. package/dist/client/assets/{accordion-BMXhHTts.js → accordion-yqeQuLU4.js} +1 -1
  43. package/dist/client/assets/{add-section-modal-d3CpdDXX.js → add-section-modal-BT_KswF9.js} +1 -1
  44. package/dist/client/assets/{agent-capabilities-bZEKhzBa.js → agent-capabilities-CxcgDRMD.js} +1 -1
  45. package/dist/client/assets/{agent-icon-CoJ-1ofl.js → agent-icon-Zb_Azx6t.js} +1 -1
  46. package/dist/client/assets/{agent-icons-B57Rqcl6.js → agent-icons-KWqRTm0P.js} +1 -1
  47. package/dist/client/assets/{agents-list-Dd0msDR_.js → agents-list-BhCbhCOn.js} +1 -1
  48. package/dist/client/assets/{ai-providers-BNYyMuRI.js → ai-providers-C5AKZu-k.js} +1 -1
  49. package/dist/client/assets/{alert-CDRh4Kau.js → alert-DTs6-KlT.js} +1 -1
  50. package/dist/client/assets/{alert-dialog-ocZJkxTi.js → alert-dialog-C3vbBKla.js} +1 -1
  51. package/dist/client/assets/app-editor-B9flRJZ7.js +1 -0
  52. package/dist/client/assets/{auth-catchall-e5nsfg9D.js → auth-catchall-C19kC2TJ.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-BHMwDwvx.js → auth-split-layout-Db21e87k.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-BBu7Hfwo.js → automation-list-row-BhHCFlRH.js} +1 -1
  55. package/dist/client/assets/{automation-runs-PtDrWmE9.js → automation-runs-DyUpHu9_.js} +1 -1
  56. package/dist/client/assets/{automations-6ZDBE3Jn.js → automations-CsG52SAb.js} +1 -1
  57. package/dist/client/assets/{avatar-DjODigMT.js → avatar-L8DJpW_U.js} +1 -1
  58. package/dist/client/assets/{badge-Bxxp86rs.js → badge-CULf9W3U.js} +1 -1
  59. package/dist/client/assets/{brand-context-BrSVDylM.js → brand-context-DowAw2BS.js} +1 -1
  60. package/dist/client/assets/{buckets-COO92am2.js → buckets-eE9UE1PA.js} +1 -1
  61. package/dist/client/assets/{calendar-ClkUcJkH.js → calendar-EKmbv_og.js} +1 -1
  62. package/dist/client/assets/{capability-load-error-D3nKtpb_.js → capability-load-error-DmO-h2RY.js} +1 -1
  63. package/dist/client/assets/{card-Bz3pkcqs.js → card-U-k17Diu.js} +1 -1
  64. package/dist/client/assets/{chat-context-BYTcgj4I.js → chat-context-CZd894Di.js} +1 -1
  65. package/dist/client/assets/{checkbox-hvwQxR_d.js → checkbox-1faCCS0E.js} +1 -1
  66. package/dist/client/assets/{cli-auth-success-2K70KX-O.js → cli-auth-success-6CdbEB2F.js} +1 -1
  67. package/dist/client/assets/{collection-detail-BGQaXWxq.js → collection-detail-UfaxKn_0.js} +1 -1
  68. package/dist/client/assets/{collection-display-button-ZJqkj41W.js → collection-display-button-Dum3PfjE.js} +1 -1
  69. package/dist/client/assets/{collection-search-BY6XeZri.js → collection-search-BYGr0PdJ.js} +1 -1
  70. package/dist/client/assets/{collection-table-wrapper-DU08qPAI.js → collection-table-wrapper-YHwBIqnB.js} +1 -1
  71. package/dist/client/assets/{collection-tabs-CUc5H1eV.js → collection-tabs-Dig67Y8A.js} +1 -1
  72. package/dist/client/assets/{collections-r09uqGla.js → collections-FcT9OkSy.js} +1 -1
  73. package/dist/client/assets/{command-CNcDlPsG.js → command-B979TGJf.js} +1 -1
  74. package/dist/client/assets/{connect-desktop-dialog-BlU6WUFF.js → connect-desktop-dialog-Cb5SKSv_.js} +1 -1
  75. package/dist/client/assets/{connection-card-CwkQR1LL.js → connection-card-BRlLX0WC.js} +1 -1
  76. package/dist/client/assets/{connection-detail-DpNWzjtg.js → connection-detail-DB7UgBq7.js} +1 -1
  77. package/dist/client/assets/{connection-form-helpers-DaUUFujM.js → connection-form-helpers-CBg6u1Cc.js} +1 -1
  78. package/dist/client/assets/{connections-DozLnlLB.js → connections-CRH041D4.js} +1 -1
  79. package/dist/client/assets/{constants-DGbRKSQq.js → constants-C02sF-0z.js} +1 -1
  80. package/dist/client/assets/{decopilot-sse-pool-CmNJsqg-.js → decopilot-sse-pool-CVbXsCMM.js} +1 -1
  81. package/dist/client/assets/{dialog-Cr0Lqq3q.js → dialog-SqaK-j71.js} +1 -1
  82. package/dist/client/assets/{domain-settings-QixFLqWa.js → domain-settings-x-menkdC.js} +1 -1
  83. package/dist/client/assets/{drawer-BxQavFqW.js → drawer-B8OQuEmd.js} +1 -1
  84. package/dist/client/assets/{dropdown-menu-CvaGrQxV.js → dropdown-menu-Cjx6QPBx.js} +1 -1
  85. package/dist/client/assets/{dynamic-plugin-layout-Bji4PA81.js → dynamic-plugin-layout-mINeGn3t.js} +1 -1
  86. package/dist/client/assets/{empty-state-C5MMJv4e.js → empty-state-Bi6-IgTO.js} +1 -1
  87. package/dist/client/assets/{empty-state-BJq8Oiur.js → empty-state-k3G-PoLQ.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-BknkQ0Rk.js → extract-connection-data-C7sxnagI.js} +1 -1
  89. package/dist/client/assets/{features-DS--Lmoh.js → features-BTyPqjdh.js} +1 -1
  90. package/dist/client/assets/{file-explorer-xzLnx2_S.js → file-explorer-1OBLAdwK.js} +1 -1
  91. package/dist/client/assets/{file-preview-BJpkPGnT.js → file-preview-B6hUCqWd.js} +1 -1
  92. package/dist/client/assets/{file-type-icon-BCikryQ0.js → file-type-icon-BLDh61vl.js} +1 -1
  93. package/dist/client/assets/{files-eAmURTo1.js → files-Bcl5we9P.js} +1 -1
  94. package/dist/client/assets/{form-Cfexl65M.js → form-njYT4om-.js} +1 -1
  95. package/dist/client/assets/{general-DqvZ55ZS.js → general-CQMAkpGl.js} +1 -1
  96. package/dist/client/assets/{generate-id-D41sn45c.js → generate-id-CfUTd1Br.js} +1 -1
  97. package/dist/client/assets/{github-repo-picker-DQeiKwsx.js → github-repo-picker-BIu4mgOv.js} +1 -1
  98. package/dist/client/assets/{hover-card-gTPLI0_V.js → hover-card-Cc21hiA9.js} +1 -1
  99. package/dist/client/assets/{image-field-C5SDGvB8.js → image-field-BHDnaCiE.js} +1 -1
  100. package/dist/client/assets/{index-DIps7jWX.js → index-8hMvP2eh.js} +1 -1
  101. package/dist/client/assets/{index-ye4JP67x.js → index-BFmK6M2x.js} +1 -1
  102. package/dist/client/assets/{index-U4TtXBlU.js → index-BIxYfG0q.js} +1 -1
  103. package/dist/client/assets/{index-BnvhSRu1.js → index-C1tRtFS6.js} +1 -1
  104. package/dist/client/assets/{index-BhVL9dHA.js → index-C9wQvqbb.js} +1 -1
  105. package/dist/client/assets/{index-CVV0W9Wt.js → index-CRgzAb7v.js} +1 -1
  106. package/dist/client/assets/{index-C-GrIODL.js → index-CfO18SUs.js} +1 -1
  107. package/dist/client/assets/{index-BHvsdgtu.js → index-CsR8viyX.js} +1 -1
  108. package/dist/client/assets/{index-ClpqDc-J.js → index-CxxZMr4y.js} +4 -4
  109. package/dist/client/assets/{index-oTaALKXb.js → index-D1Eb6Kjo.js} +1 -1
  110. package/dist/client/assets/{index-DNUqrDcV.js → index-DE3zv20y.js} +1 -1
  111. package/dist/client/assets/{index-BZf7dLag.js → index-DROepM5e.js} +1 -1
  112. package/dist/client/assets/{index-CHwrxx2w.js → index-DiLEyBR7.js} +3 -3
  113. package/dist/client/assets/{index-CKjr19kh.js → index-DiPgTi8g.js} +1 -1
  114. package/dist/client/assets/{index-redirect-v3eWWKKh.js → index-redirect-CRoMzBpg.js} +1 -1
  115. package/dist/client/assets/{infiniteQueryObserver-DvfAuCaA.js → infiniteQueryObserver-BhbkmIyu.js} +1 -1
  116. package/dist/client/assets/{input-BsiCsTx_.js → input-qiotzcFP.js} +1 -1
  117. package/dist/client/assets/{integration-icon-D9uiqhUj.js → integration-icon-CT5y-vAU.js} +1 -1
  118. package/dist/client/assets/{label-CUurCsVU.js → label-7MXDwrE8.js} +1 -1
  119. package/dist/client/assets/{layout-BlkFnmnU.js → layout-ZEsgvFHi.js} +1 -1
  120. package/dist/client/assets/{login-CPLRxr0T.js → login-D4qQfiIF.js} +1 -1
  121. package/dist/client/assets/{members-By3Cdesg.js → members-DEn_xp5v.js} +1 -1
  122. package/dist/client/assets/{monaco-editor-ByyJd0JT.js → monaco-editor-DvbnyCRO.js} +1 -1
  123. package/dist/client/assets/{monitoring-stats-row-u1uu-TaR.js → monitoring-stats-row-f81WawPZ.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-BUCIPmWj.js → oauth-callback-DWZO-Vrx.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-ai-provider-CsLDW21C.js → oauth-callback-ai-provider-CBEfy0E8.js} +1 -1
  126. package/dist/client/assets/{onboarding-CUf9sMbB.js → onboarding-CXPgtIaD.js} +1 -1
  127. package/dist/client/assets/{org-install-n0EsvfUs.js → org-install-RWkuizr-.js} +1 -1
  128. package/dist/client/assets/{org-layout-BDsjAMwx.js → org-layout-BBPyWMLL.js} +1 -1
  129. package/dist/client/assets/{org-plugin-layout-pRKLHe9T.js → org-plugin-layout-DjxZsKj-.js} +1 -1
  130. package/dist/client/assets/{page-seo-form-BBa96MiF.js → page-seo-form-DlBdBwX4.js} +1 -1
  131. package/dist/client/assets/page-seo-sheet-BLrmP6fG.js +1 -0
  132. package/dist/client/assets/{pair-BhFm7zEp.js → pair-UmksH8uX.js} +1 -1
  133. package/dist/client/assets/{plugin-empty-state-DlqcueY-.js → plugin-empty-state-BQhTwyUq.js} +1 -1
  134. package/dist/client/assets/{plugin-header-BtB-4X-C.js → plugin-header-CHI_L_tP.js} +1 -1
  135. package/dist/client/assets/{plugin-layout-3wsU2ax3.js → plugin-layout-Ce-dYf68.js} +1 -1
  136. package/dist/client/assets/{popover-DRtmCV3Y.js → popover-CH0JIVxe.js} +1 -1
  137. package/dist/client/assets/{post-editor-DVSvtKmi.js → post-editor-BLtops1M.js} +1 -1
  138. package/dist/client/assets/{primitives-BRxEBOA1.js → primitives-1hL2QM0_.js} +1 -1
  139. package/dist/client/assets/{profile-CxkrbdC1.js → profile-CO63ZGfk.js} +1 -1
  140. package/dist/client/assets/{project-app-view-Bmw2vsjt.js → project-app-view-BklOwJ8t.js} +1 -1
  141. package/dist/client/assets/record-editor-DI0fQitx.js +1 -0
  142. package/dist/client/assets/registry-C3COlAk2.js +2 -0
  143. package/dist/client/assets/{registry-layout-CIYxyZOl.js → registry-layout-BtdCviXi.js} +1 -1
  144. package/dist/client/assets/{require-capability-BdEucscS.js → require-capability-CH-wAvYM.js} +1 -1
  145. package/dist/client/assets/{required-auth-layout-DWEjgRK5.js → required-auth-layout-xgajebzh.js} +1 -1
  146. package/dist/client/assets/{reset-password-figyTMz0.js → reset-password-BCc5WbVj.js} +1 -1
  147. package/dist/client/assets/{roles-BvcIr8kC.js → roles-DmWUTeoO.js} +1 -1
  148. package/dist/client/assets/{save-status-CMMknrm_.js → save-status-49P6O98I.js} +1 -1
  149. package/dist/client/assets/{schema-form-CZbxPq5Y.js → schema-form-CM-Fx78h.js} +1 -1
  150. package/dist/client/assets/{scroll-area-BkG2xMKa.js → scroll-area-ZNNKR2lN.js} +1 -1
  151. package/dist/client/assets/{search-input-DhDuFfgS.js → search-input-Di1njGkC.js} +1 -1
  152. package/dist/client/assets/{secrets-d_a7Pzer.js → secrets-D8OzhEZC.js} +1 -1
  153. package/dist/client/assets/{sections-editor-BWlb557B.js → sections-editor-BS3jd_I0.js} +1 -1
  154. package/dist/client/assets/{select-1w9zaIxM.js → select-BQQ3gr0O.js} +1 -1
  155. package/dist/client/assets/{select-model-CgDhZf6h.js → select-model-BK_pUIx2.js} +1 -1
  156. package/dist/client/assets/{seo-editor-V5U2wUF2.js → seo-editor-CLG3Ds6b.js} +1 -1
  157. package/dist/client/assets/{settings-layout-Cxm0nH91.js → settings-layout-BqSYBJZP.js} +1 -1
  158. package/dist/client/assets/{settings-section-eHpffAQC.js → settings-section-DSxCNScm.js} +1 -1
  159. package/dist/client/assets/{sheet-B_HwqFgT.js → sheet-DSOS1Yuo.js} +1 -1
  160. package/dist/client/assets/{shell-controls-bf-SKezU.js → shell-controls-bcxBBy_w.js} +1 -1
  161. package/dist/client/assets/{shell-layout-CIIJdxoP.js → shell-layout-D1NWDKVK.js} +1 -1
  162. package/dist/client/assets/{shell-route-loading-CMm4004V.js → shell-route-loading-D54Xgf_4.js} +1 -1
  163. package/dist/client/assets/{sidebar-dkkCYhm2.js → sidebar-BIPju_nM.js} +1 -1
  164. package/dist/client/assets/{skeleton-DIaIyZIy.js → skeleton-w9s8uxnB.js} +1 -1
  165. package/dist/client/assets/{sortable.esm-B7f4Alsc.js → sortable.esm-Bljnc1lQ.js} +1 -1
  166. package/dist/client/assets/{spinner-zDPMtPt5.js → spinner-BdeVoqtO.js} +1 -1
  167. package/dist/client/assets/{sso-Dmb_OPkP.js → sso-CFfgO9Au.js} +1 -1
  168. package/dist/client/assets/{store-DUqLAFED.js → store-jwPrMyzI.js} +1 -1
  169. package/dist/client/assets/store-registry-Bi2vrhFQ.js +2 -0
  170. package/dist/client/assets/{switch-DpyT-X6C.js → switch-d3yUK1tj.js} +1 -1
  171. package/dist/client/assets/{tab-id-CUycGir1.js → tab-id-q7-cQc3y.js} +1 -1
  172. package/dist/client/assets/{table-bDbiBDg8.js → table-CSzwwHB4.js} +1 -1
  173. package/dist/client/assets/{tabs-ClVghzr5.js → tabs-C99QcRQa.js} +1 -1
  174. package/dist/client/assets/{task-status-UME2YDCM.js → task-status-Bk4uV5nr.js} +1 -1
  175. package/dist/client/assets/{textarea-BUM6BzhG.js → textarea-qqK3HQff.js} +1 -1
  176. package/dist/client/assets/{toggle-group-B4qG6hF5.js → toggle-group-BpttAIdH.js} +1 -1
  177. package/dist/client/assets/{toolbar-QSFGKRF9.js → toolbar-D4yEFDPH.js} +1 -1
  178. package/dist/client/assets/{tools-list-CCyLWR8s.js → tools-list-C0fcVKD-.js} +1 -1
  179. package/dist/client/assets/{tooltip-lUpcIPGH.js → tooltip-B0tCRAZt.js} +1 -1
  180. package/dist/client/assets/{types-D_efEM4V.js → types-cXraKniu.js} +1 -1
  181. package/dist/client/assets/{use-ai-providers-DB7ojWtS.js → use-ai-providers-BTIs3dbQ.js} +1 -1
  182. package/dist/client/assets/{use-automations-DPQ-768f.js → use-automations-BjOT03it.js} +1 -1
  183. package/dist/client/assets/{use-capability-D50zF9Hp.js → use-capability-B0FDed6k.js} +1 -1
  184. package/dist/client/assets/{use-collections-Bf-v75yp.js → use-collections-B6VT7NnN.js} +1 -1
  185. package/dist/client/assets/{use-connection-fbegA2Sr.js → use-connection-CQsELyYh.js} +1 -1
  186. package/dist/client/assets/{use-copy-BbpDjfq3.js → use-copy-Ea3wOQ_g.js} +1 -1
  187. package/dist/client/assets/{use-create-virtual-mcp-D-SDzc8G.js → use-create-virtual-mcp-BT_FE1w-.js} +1 -1
  188. package/dist/client/assets/{use-debounced-autosave-DU89mAx9.js → use-debounced-autosave-Bq8ZStCd.js} +1 -1
  189. package/dist/client/assets/{use-delete-connection-DMToAmAx.js → use-delete-connection-DJ2dGzP8.js} +1 -1
  190. package/dist/client/assets/{use-file-configs-B1_NrtMR.js → use-file-configs-DXb8Ft09.js} +1 -1
  191. package/dist/client/assets/{use-infinite-scroll-DLszWpbX.js → use-infinite-scroll-Bw0_7vDF.js} +1 -1
  192. package/dist/client/assets/{use-list-state-DYP1ZGgm.js → use-list-state-BDn2INFV.js} +1 -1
  193. package/dist/client/assets/{use-mcp-prompts-C-3ONdzW.js → use-mcp-prompts-DHq-IxcX.js} +1 -1
  194. package/dist/client/assets/{use-mcp-tools-a5ty3etm.js → use-mcp-tools-CYddOSnN.js} +1 -1
  195. package/dist/client/assets/{use-members-BL8hEVLT.js → use-members-CUqPPBxj.js} +1 -1
  196. package/dist/client/assets/{use-navigate-to-agent-DxjoYFjz.js → use-navigate-to-agent-B24V_hDN.js} +1 -1
  197. package/dist/client/assets/{use-org-auth-client-DVJHDy7u.js → use-org-auth-client-DiZPz9Ew.js} +1 -1
  198. package/dist/client/assets/{use-org-sso-D7PsvUVV.js → use-org-sso-CzIgdWpv.js} +1 -1
  199. package/dist/client/assets/{use-organization-roles-CJX_27_B.js → use-organization-roles-B6KZaHs3.js} +1 -1
  200. package/dist/client/assets/{use-organization-settings-C79X-vTJ.js → use-organization-settings-BeptNVun.js} +1 -1
  201. package/dist/client/assets/{use-registry-connections-C3Lo4utR.js → use-registry-connections-qp8vdb0u.js} +1 -1
  202. package/dist/client/assets/{use-secrets-F04NffI6.js → use-secrets-DO861gPX.js} +1 -1
  203. package/dist/client/assets/{use-status-sounds-BTW-payM.js → use-status-sounds-CJFVV2DK.js} +1 -1
  204. package/dist/client/assets/{use-view-mode-q5qrXWBH.js → use-view-mode-sfLLq0lJ.js} +1 -1
  205. package/dist/client/assets/{use-virtual-mcp-gRD34dSD.js → use-virtual-mcp-kZ4ufgDR.js} +1 -1
  206. package/dist/client/assets/useInfiniteQuery-B5R8AWr_.js +1 -0
  207. package/dist/client/assets/{useRouterState-CE1pG0Ht.js → useRouterState-Bj46P4qX.js} +1 -1
  208. package/dist/client/assets/useSuspenseInfiniteQuery-Bll4beEM.js +1 -0
  209. package/dist/client/assets/{user-Co3OfX6G.js → user-BOlgGpH3.js} +1 -1
  210. package/dist/client/assets/{view-mode-toggle-BVeJGdmm.js → view-mode-toggle-Dyc-PgvY.js} +1 -1
  211. package/dist/client/assets/{workflow-CBHfDBlV.js → workflow-BrpD5ynx.js} +1 -1
  212. package/dist/client/assets/workflow-detail-BNT4OxQe.js +1 -0
  213. package/dist/client/index.html +1 -1
  214. package/dist/server/cli.js +377 -377
  215. package/dist/server/server.js +268 -268
  216. package/package.json +1 -1
  217. package/dist/client/assets/app-editor-DqRtvbIx.js +0 -1
  218. package/dist/client/assets/page-seo-sheet-BtMjZSEx.js +0 -1
  219. package/dist/client/assets/record-editor-BIAmKwnm.js +0 -1
  220. package/dist/client/assets/registry-D7NGwbmW.js +0 -2
  221. package/dist/client/assets/store-registry-BHROQShM.js +0 -2
  222. package/dist/client/assets/useInfiniteQuery-KmawUBeu.js +0 -1
  223. package/dist/client/assets/useSuspenseInfiniteQuery-BEuKSaeK.js +0 -1
  224. package/dist/client/assets/workflow-detail-Bnj68Okr.js +0 -1
@@ -1 +1 @@
1
- import{aq as st,ar as me,as as it,at as nt,au as Ae,F as pe,av as rt,aw as ot,r as L,ax as lt,ay as at,az as ct,aA as dt,aB as je,aC as mt,aD as ut,aE as ft,e as $,j as i,q as V,c as K,l as Me,aF as xe,o as W,K as oe,n as le,a as ht,v as pt,E as xt,b as gt,B as we}from"./index-CHwrxx2w.js";import{u as ge}from"./tooltip-lUpcIPGH.js";import{i as bt,u as ee,S as Le,g as yt}from"./constants-DGbRKSQq.js";import{a as vt,b as jt,v as wt,u as Nt}from"./use-virtual-mcp-gRD34dSD.js";import{i as St}from"./Check-xwts9G2J.js";import{_ as _t,A as Y,a0 as ze,a1 as Ct,s as Tt,c as Et}from"./agent-icon-CoJ-1ofl.js";import{s as be}from"./Plus-CsnODh95.js";import{i as Oe}from"./X-5JYlDYV-.js";import{u as kt,b as It,h as $t,C as ne}from"./agent-capabilities-bZEKhzBa.js";import{u as At,c as Mt}from"./chat-context-BYTcgj4I.js";import{N as Lt}from"./agent-icons-B57Rqcl6.js";import{u as Re,a as re,K as De,P as Pe,D as He,c as zt,S as Ot,v as Rt,b as Dt,C as Pt,s as Ht,d as Ut,e as Bt,f as Ft}from"./sortable.esm-B7f4Alsc.js";import{u as Ue,a as Be,o as Qt}from"./use-organization-settings-C79X-vTJ.js";import{c as ye,u as Wt,h as qt}from"./shell-layout-CIIJdxoP.js";import{I as Kt}from"./input-BsiCsTx_.js";import{S as Xt}from"./scroll-area-BkG2xMKa.js";import{S as Gt,c as Vt,d as Zt,a as Jt,b as Yt}from"./sheet-B_HwqFgT.js";import{S as H}from"./skeleton-DIaIyZIy.js";import{t as Fe}from"./ChevronDown-C1vxQNd3.js";import{g as es,M as ts}from"./types-D_efEM4V.js";import{I as ss}from"./integration-icon-D9uiqhUj.js";import{u as is}from"./unwrap-tool-result-BYXdCQMg.js";import{t as Qe,P as ns,e as rs,s as os,g as ls}from"./pair-BhFm7zEp.js";import{a as as}from"./XCircle-Cri1mHI7.js";import{g as cs}from"./use-mcp-prompts-C-3ONdzW.js";import{u as ds,w as ms}from"./tab-id-CUycGir1.js";import{D as us,a as fs,b as hs,h as ps,c as Ne,d as xs}from"./dropdown-menu-CvaGrQxV.js";import{s as gs}from"./Trash01-BIBfIkQ_.js";import{a as bs,u as ys}from"./use-ai-providers-DB7ojWtS.js";import{a as vs}from"./toolbar-QSFGKRF9.js";import"./use-collections-Bf-v75yp.js";import"./AlertCircle-CZUdxzu_.js";import"./Tool01-B9i3jYjq.js";import"./SwitchHorizontal01-BcpyEVy6.js";import"./RefreshCcw01-B_9fKaFo.js";import"./ArrowUpRight-Ckf8qDoK.js";import"./ZapSquare-D7KADoNB.js";import"./Users03-CNIYpSXa.js";import"./CheckCircle-CdtozJUx.js";import"./ChevronRight-D5DpowYO.js";import"./ChevronUp-CBggsaUA.js";import"./DotsVertical-BGN9ibyU.js";import"./Container-BCobWGsJ.js";import"./Eye-MHwkC0Bm.js";import"./Globe01-ZT5vmTMf.js";import"./FilterLines-MmWX7Ysm.js";import"./ZoomOut-DMIdbERz.js";import"./Star01-Ytz2fdRH.js";import"./Palette-Bc5k-b6V.js";import"./HardDrive-CiJMrXnz.js";import"./Stars02-qXelOgIp.js";import"./Key01-6HahYsd8.js";import"./LinkExternal01-DyZjuYqx.js";import"./Monitor01-DQ4W7WkG.js";import"./Sun-pWEzytrr.js";import"./Play-Dkm_MGgj.js";import"./SearchMd-CTsuydPj.js";import"./Settings02-DSEzadZL.js";import"./Shield01-DOIioasK.js";import"./Stars01-DxQPpWJA.js";import"./Upload01-Dh5J3z7m.js";import"./User01-C_ID9x9E.js";import"./Users01-DqbuPj9p.js";import"./XClose-P7eY6MuP.js";import"./Zap-DUKmeTe3.js";import"./spinner-zDPMtPt5.js";import"./dialog-Cr0Lqq3q.js";import"./drawer-BxQavFqW.js";import"./collection-search-BY6XeZri.js";import"./form-Cfexl65M.js";import"./label-CUurCsVU.js";import"./select-1w9zaIxM.js";import"./tabs-ClVghzr5.js";import"./toggle-group-B4qG6hF5.js";import"./popover-DRtmCV3Y.js";import"./command-CNcDlPsG.js";import"./index-CVV0W9Wt.js";import"./useInfiniteQuery-KmawUBeu.js";import"./infiniteQueryObserver-DvfAuCaA.js";import"./index-BHvsdgtu.js";import"./question-004-sINsf4GQ.js";import"./checkbox-hvwQxR_d.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-DjODigMT.js";import"./settings-section-eHpffAQC.js";import"./card-Bz3pkcqs.js";import"./connect-desktop-dialog-BlU6WUFF.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CwkQR1LL.js";import"./use-registry-connections-C3Lo4utR.js";import"./use-connection-fbegA2Sr.js";import"./extract-connection-data-BknkQ0Rk.js";import"./generate-id-D41sn45c.js";import"./collections-r09uqGla.js";import"./collection-tabs-CUc5H1eV.js";import"./badge-Bxxp86rs.js";import"./textarea-BUM6BzhG.js";import"./connection-form-helpers-DaUUFujM.js";import"./use-infinite-scroll-DLszWpbX.js";import"./useSuspenseInfiniteQuery-BEuKSaeK.js";import"./required-auth-layout-DWEjgRK5.js";import"./useRouterState-CE1pG0Ht.js";import"./use-org-sso-D7PsvUVV.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BbpDjfq3.js";import"./file-type-icon-BCikryQ0.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-DxjoYFjz.js";import"./decopilot-sse-pool-CmNJsqg-.js";import"./create-sse-subscription-BS5983N4.js";function Se(s,e){const t=new Set(e);return s.filter(r=>!t.has(r))}function js(s,e,t){const r=s.slice(0);return r[e]=t,r}var ws=class extends st{#n;#e;#r;#i;#t;#s;#o;#l;#a;#c=[];constructor(s,e,t){super(),this.#n=s,this.#i=t,this.#r=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(s=>{s.subscribe(e=>{this.#f(s,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(s=>{s.destroy()})}setQueries(s,e){this.#r=s,this.#i=e,me.batch(()=>{const t=this.#t,r=this.#u(this.#r);r.forEach(m=>m.observer.setOptions(m.defaultedQueryOptions));const n=r.map(m=>m.observer),l=n.map(m=>m.getCurrentResult()),o=t.length!==n.length,c=n.some((m,u)=>m!==t[u]),a=o||c,d=a?!0:l.some((m,u)=>{const p=this.#e[u];return!p||!it(m,p)});!a&&!d||(a&&(this.#c=r,this.#t=n),this.#e=l,this.hasListeners()&&(a&&(Se(t,n).forEach(m=>{m.destroy()}),Se(n,t).forEach(m=>{m.subscribe(u=>{this.#f(m,u)})})),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(s=>s.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(s,e){const t=this.#u(s),r=t.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),n=t.map(l=>l.defaultedQueryOptions.queryHash);return[r,l=>this.#m(l??r,e,n),()=>this.#d(r,t)]}#d(s,e){return e.map((t,r)=>{const n=s[r];return t.defaultedQueryOptions.notifyOnChangeProps?n:t.observer.trackResult(n,l=>{e.forEach(o=>{o.observer.trackProp(l)})})})}#m(s,e,t){if(e){const r=this.#a,n=t!==void 0&&r!==void 0&&(r.length!==t.length||t.some((l,o)=>l!==r[o]));return(!this.#s||this.#e!==this.#l||n||e!==this.#o)&&(this.#o=e,this.#l=this.#e,t!==void 0&&(this.#a=t),this.#s=nt(this.#s,e(s))),this.#s}return s}#p(){return this.#i?.combine!==void 0&&this.#t.some((s,e)=>s.options.suspense&&this.#e[e]?.data===void 0)}#u(s){const e=new Map;this.#t.forEach(r=>{const n=r.options.queryHash;if(!n)return;const l=e.get(n);l?l.push(r):e.set(n,[r])});const t=[];return s.forEach(r=>{const n=this.#n.defaultQueryOptions(r),o=e.get(n.queryHash)?.shift()??new Ae(this.#n,n);t.push({defaultedQueryOptions:n,observer:o})}),t}#f(s,e){const t=this.#t.indexOf(s);t!==-1&&(this.#e=js(this.#e,t,e),this.#h())}#h(){if(this.hasListeners()){const s=this.#d(this.#e,this.#c),e=this.#p(),t=this.#s,r=e?t:this.#m(s,this.#i?.combine);(e||t!==r)&&me.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function Ns({queries:s,...e},t){const r=pe(t),n=rt(),l=ot(),o=L.useMemo(()=>s.map(x=>{const f=r.defaultQueryOptions(x);return f._optimisticResults=n?"isRestoring":"optimistic",f}),[s,r,n]);o.forEach(x=>{lt(x);const f=r.getQueryCache().get(x.queryHash);at(x,l,f)}),ct(l);const[c]=L.useState(()=>new ws(r,o,e)),[a,d,m]=c.getOptimisticResult(o,e.combine),u=!n&&e.subscribed!==!1;L.useSyncExternalStore(L.useCallback(x=>u?c.subscribe(me.batchCalls(x)):dt,[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),L.useEffect(()=>{c.setQueries(o,e)},[o,e,c]);const g=a.some((x,f)=>je(o[f],x))?a.flatMap((x,f)=>{const h=o[f];if(h&&je(h,x)){const y=new Ae(r,h);return mt(h,y,l)}return[]}):[];if(g.length>0)throw Promise.all(g);const b=a.find((x,f)=>{const h=o[f];return h&&ut({result:x,errorResetBoundary:l,throwOnError:h.throwOnError,query:r.getQueryCache().get(h.queryHash),suspense:h.suspense})});if(b?.error)throw b.error;return d(m())}function Ss(s,e){return Ns({...s,queries:s.queries.map(t=>({...t,suspense:!0,throwOnError:ft,enabled:!0,placeholderData:void 0}))},e)}const te=8;function _s(s){const e=$.c(16),{open:t,onOpenChange:r}=s,[n,l]=L.useState("");let o,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Gt,{children:"Manage home"}),c=i.jsx(Vt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=o,e[1]=c):(o=e[0],c=e[1]);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(_t,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=a):a=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=x=>l(x.target.value),e[3]=d):d=e[3];let m;e[4]!==n?(m=i.jsxs(Zt,{className:"px-5 py-4 border-b border-border",children:[o,c,i.jsxs("div",{className:"relative mt-3",children:[a,i.jsx(Kt,{value:n,onChange:d,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=n,e[5]=m):m=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Ys,{}),e[6]=u):u=e[6];let p;e[7]!==n?(p=i.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3 flex flex-col gap-4",children:i.jsx(L.Suspense,{fallback:u,children:i.jsx(Ts,{search:n})})})}),e[7]=n,e[8]=p):p=e[8];let g;e[9]!==m||e[10]!==p?(g=i.jsxs(Jt,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[m,p]}),e[9]=m,e[10]=p,e[11]=g):g=e[11];let b;return e[12]!==r||e[13]!==t||e[14]!==g?(b=i.jsx(Yt,{open:t,onOpenChange:r,children:g}),e[12]=r,e[13]=t,e[14]=g,e[15]=b):b=e[15],b}function Cs(s){const e=$.c(32),{org:t}=V(),r=Ue();let n;e[0]!==r?.ids?(n=r?.ids??[],e[0]=r?.ids,e[1]=n):n=e[1];const l=n,o=Be(),c=jt(),a=pe();let d;e[2]!==t||e[3]!==a?(d=()=>a.refetchQueries({queryKey:oe.homeNextActions(t.slug),type:"active"}),e[2]=t,e[3]=a,e[4]=d):d=e[4];const m=d;let u;e[5]!==l?(u=S=>l.includes(S),e[5]=l,e[6]=u):u=e[6];const p=u;let g;e[7]!==l||e[8]!==s?(g=s?l.filter(S=>s.has(S)).length:l.length,e[7]=l,e[8]=s,e[9]=g):g=e[9];const x=g>=te;let f;e[10]!==x||e[11]!==p||e[12]!==o?(f=S=>p(S)||x?Promise.resolve():o.apply(E=>E.includes(S)?null:[...E,S]),e[10]=x,e[11]=p,e[12]=o,e[13]=f):f=e[13];const h=f;let y;e[14]!==o?(y=S=>o.apply(E=>E.filter(k=>k!==S)),e[14]=o,e[15]=y):y=e[15];const w=y;let v;e[16]!==o?(v=S=>o.apply(()=>S),e[16]=o,e[17]=v):v=e[17];const j=v;let N;e[18]!==c||e[19]!==x||e[20]!==p||e[21]!==m||e[22]!==o?(N=async(S,E)=>{await c.update.mutateAsync({id:S.id,data:{metadata:E}}),!p(S.id)&&!x&&await o.apply(k=>k.includes(S.id)?null:[...k,S.id]),await m()},e[18]=c,e[19]=x,e[20]=p,e[21]=m,e[22]=o,e[23]=N):N=e[23];const _=N;let T;return e[24]!==h||e[25]!==x||e[26]!==l||e[27]!==p||e[28]!==w||e[29]!==j||e[30]!==_?(T={homeIds:l,isOnHome:p,atLimit:x,addAgent:h,removeAgent:w,reorder:j,saveAgentMetadata:_},e[24]=h,e[25]=x,e[26]=l,e[27]=p,e[28]=w,e[29]=j,e[30]=_,e[31]=T):T=e[31],T}function Ts(s){const e=$.c(21),{search:t}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={pageSize:1e3},e[0]=r):r=e[0];const n=vt(r);let l;e[1]!==n?(l=new Set(n.map(As)),e[1]=n,e[2]=l):l=e[2];const o=Cs(l);let c,a,d;if(e[3]!==n||e[4]!==o||e[5]!==t){const x=new Map(n.map($s));c=t.trim().toLowerCase();const f=y=>!c||y.title?.toLowerCase().includes(c);a=o.homeIds.map(y=>x.get(y)).filter(Is).filter(f);let h;e[9]!==o?(h=y=>!o.isOnHome(y.id),e[9]=o,e[10]=h):h=e[10],d=n.filter(ks).filter(h).filter(f).sort(Es),e[3]=n,e[4]=o,e[5]=t,e[6]=c,e[7]=a,e[8]=d}else c=e[6],a=e[7],d=e[8];const m=d;let u;e[11]!==o||e[12]!==a?(u=i.jsx(Ms,{home:o,agents:a}),e[11]=o,e[12]=a,e[13]=u):u=e[13];const p=!!c;let g;e[14]!==m||e[15]!==o||e[16]!==p?(g=i.jsx(Os,{home:o,agents:m,hasSearch:p}),e[14]=m,e[15]=o,e[16]=p,e[17]=g):g=e[17];let b;return e[18]!==u||e[19]!==g?(b=i.jsxs(i.Fragment,{children:[u,g]}),e[18]=u,e[19]=g,e[20]=b):b=e[20],b}function Es(s,e){return(s.title??"").localeCompare(e.title??"")}function ks(s){return s.id&&!bt(s.id)}function Is(s){return!!s}function $s(s){return[s.id,s]}function As(s){return s.id}function We(s){const e=$.c(7),{title:t,hint:r}=s;let n;e[0]!==t?(n=i.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:t}),e[0]=t,e[1]=n):n=e[1];let l;e[2]!==r?(l=r&&i.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let o;return e[4]!==n||e[5]!==l?(o=i.jsxs("div",{className:"flex items-center justify-between px-1",children:[n,l]}),e[4]=n,e[5]=l,e[6]=o):o=e[6],o}function Ms(s){const e=$.c(14),{home:t,agents:r}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={activationConstraint:{distance:5}},e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={coordinateGetter:Ht},e[1]=l):l=e[1];const o=Re(re(Pe,n),re(De,l));let c;e[2]!==t?(c=g=>{const{active:b,over:x}=g;if(!x||b.id===x.id)return;const f=t.homeIds,h=f.indexOf(b.id),y=f.indexOf(x.id);h===-1||y===-1||t.reorder(Ut([...f],h,y)).catch(zs)},e[2]=t,e[3]=c):c=e[3];const a=c,d=`${t.homeIds.length}/${te}`;let m;e[4]!==d?(m=i.jsx(We,{title:"On home",hint:d}),e[4]=d,e[5]=m):m=e[5];let u;e[6]!==r||e[7]!==a||e[8]!==t||e[9]!==o?(u=r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):i.jsx(He,{sensors:o,collisionDetection:zt,onDragEnd:a,children:i.jsx(Ot,{items:r.map(Ls),strategy:Rt,children:i.jsx("div",{className:"flex flex-col gap-1",children:r.map(g=>i.jsx(Ds,{agent:g,home:t},g.id))})})}),e[6]=r,e[7]=a,e[8]=t,e[9]=o,e[10]=u):u=e[10];let p;return e[11]!==m||e[12]!==u?(p=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,u]}),e[11]=m,e[12]=u,e[13]=p):p=e[13],p}function Ls(s){return s.id}function zs(){return W.error("Couldn't reorder home — please try again.")}function Os(s){const e=$.c(6),{home:t,agents:r,hasSearch:n}=s,[l,o]=L.useState(20);let c;if(e[0]!==r||e[1]!==n||e[2]!==t||e[3]!==l){const a=r.slice(0,l);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(We,{title:"Add to home"}),e[5]=d):d=e[5],c=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:n?"No agents match.":"Every agent is on the home."}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex flex-col gap-1",children:a.map(m=>i.jsx(Us,{agent:m,home:t},m.id))}),r.length>l&&i.jsxs("button",{type:"button",onClick:()=>o(Rs),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",r.length-l,")"]})]})]}),e[0]=r,e[1]=n,e[2]=t,e[3]=l,e[4]=c}else c=e[4];return c}function Rs(s){return s+20}function qe(s){const e=xe(s.metadata?.ui).filter(l=>!!l.resourceUri).length,t=s.metadata?.ui?.homePrompts,r=Array.isArray(t)?t.length:null,n=[];return e>0&&n.push(`${e} tile${e===1?"":"s"}`),r!==null&&r>0&&n.push(`${r} prompt${r===1?"":"s"}`),r===0&&n.push("prompts off"),n.join(" · ")}function Ds(s){const e=$.c(57),{agent:t,home:r}=s,[n,l]=L.useState(!1);let o;e[0]!==t.id?(o={id:t.id},e[0]=t.id,e[1]=o):o=e[1];const{attributes:c,listeners:a,setNodeRef:d,transform:m,transition:u,isDragging:p}=Dt(o),g=qe(t)||"Quick access";let b;e[2]!==m?(b=Pt.Transform.toString(m),e[2]=m,e[3]=b):b=e[3];const x=p?.5:void 0,f=p?100:void 0;let h;e[4]!==b||e[5]!==x||e[6]!==f||e[7]!==u?(h={transform:b,transition:u,opacity:x,zIndex:f},e[4]=b,e[5]=x,e[6]=f,e[7]=u,e[8]=h):h=e[8];const y=h,w=p&&"shadow-lg";let v;e[9]!==w?(v=K("rounded-lg border border-border bg-card",w),e[9]=w,e[10]=v):v=e[10];const j=`Drag to reorder ${t.title??t.id}`;let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(ze,{size:14}),e[11]=N):N=e[11];let _;e[12]!==c||e[13]!==a||e[14]!==j?(_=i.jsx("button",{type:"button",...c,...a,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":j,children:N}),e[12]=c,e[13]=a,e[14]=j,e[15]=_):_=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=()=>l(Hs),e[16]=T):T=e[16];const S=t.title??t.id;let E;e[17]!==t.icon||e[18]!==S?(E=i.jsx(Y,{icon:t.icon,name:S,size:"sm"}),e[17]=t.icon,e[18]=S,e[19]=E):E=e[19];const k=t.title??t.id;let C;e[20]!==k?(C=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:k}),e[20]=k,e[21]=C):C=e[21];let I;e[22]!==g?(I=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:g}),e[22]=g,e[23]=I):I=e[23];let A;e[24]!==C||e[25]!==I?(A=i.jsxs("div",{className:"min-w-0 flex-1",children:[C,I]}),e[24]=C,e[25]=I,e[26]=A):A=e[26];const D=n&&"rotate-180";let z;e[27]!==D?(z=K("shrink-0 text-muted-foreground transition-transform",D),e[27]=D,e[28]=z):z=e[28];let O;e[29]!==z?(O=i.jsx(Fe,{size:16,className:z}),e[29]=z,e[30]=O):O=e[30];let Q;e[31]!==n||e[32]!==E||e[33]!==A||e[34]!==O?(Q=i.jsxs("button",{type:"button",onClick:T,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":n,children:[E,A,O]}),e[31]=n,e[32]=E,e[33]=A,e[34]=O,e[35]=Q):Q=e[35];let M;e[36]!==t.id||e[37]!==r?(M=()=>r.removeAgent(t.id).catch(Ps),e[36]=t.id,e[37]=r,e[38]=M):M=e[38];const F=`Remove ${t.title??t.id} from home`;let P;e[39]===Symbol.for("react.memo_cache_sentinel")?(P=i.jsx(Oe,{size:14}),e[39]=P):P=e[39];let R;e[40]!==M||e[41]!==F?(R=i.jsx("button",{type:"button",onClick:M,"aria-label":F,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:P}),e[40]=M,e[41]=F,e[42]=R):R=e[42];let U;e[43]!==_||e[44]!==Q||e[45]!==R?(U=i.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[_,Q,R]}),e[43]=_,e[44]=Q,e[45]=R,e[46]=U):U=e[46];let B;e[47]!==t||e[48]!==n||e[49]!==r?(B=n&&i.jsx(Ke,{agent:t,home:r}),e[47]=t,e[48]=n,e[49]=r,e[50]=B):B=e[50];let q;return e[51]!==d||e[52]!==y||e[53]!==U||e[54]!==B||e[55]!==v?(q=i.jsxs("div",{ref:d,style:y,className:v,children:[U,B]}),e[51]=d,e[52]=y,e[53]=U,e[54]=B,e[55]=v,e[56]=q):q=e[56],q}function Ps(){return W.error("Couldn't remove from home — please try again.")}function Hs(s){return!s}function Us({agent:s,home:e}){const[t,r]=L.useState(!1),[n,l]=L.useState(!1),o=qe(s),c=async()=>{if(!e.atLimit){l(!0);try{await e.addAgent(s.id)}catch{W.error("Couldn't add to home — please try again.")}finally{l(!1)}}};return i.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[i.jsxs("button",{type:"button",onClick:()=>r(a=>!a),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":t,children:[i.jsx(Y,{icon:s.icon,name:s.title??s.id,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.title??s.id}),o&&i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:o})]}),i.jsx(Fe,{size:16,className:K("shrink-0 text-muted-foreground transition-transform",t&&"rotate-180")})]}),i.jsx("button",{type:"button",onClick:c,disabled:n||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${te}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:n?i.jsx(Me,{size:12,className:"animate-spin"}):i.jsx(be,{size:14})})]}),t&&i.jsx(Ke,{agent:s,home:e})]})}function Ke(s){const e=$.c(26),{agent:t,home:r}=s;let n,l,o,c,a,d,m;if(e[0]!==t||e[1]!==r){const f=xe(t.metadata?.ui);let h;e[9]!==t.connections?(h=(t.connections??[]).map(Fs).sort(),e[9]=t.connections,e[10]=h):h=e[10];const y=h;l=t.metadata?.ui?.homePrompts,m="border-t border-border px-3 py-2 flex flex-col gap-3",n=Ws,o=t,c=r,a=y,d=new Set(f.map(Bs)),e[0]=t,e[1]=r,e[2]=n,e[3]=l,e[4]=o,e[5]=c,e[6]=a,e[7]=d,e[8]=m}else n=e[2],l=e[3],o=e[4],c=e[5],a=e[6],d=e[7],m=e[8];let u;e[11]!==n||e[12]!==o||e[13]!==c||e[14]!==a||e[15]!==d?(u=i.jsx(n,{agent:o,home:c,connectionIds:a,pinnedResourceUris:d}),e[11]=n,e[12]=o,e[13]=c,e[14]=a,e[15]=d,e[16]=u):u=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Qs,{}),e[17]=p):p=e[17];const g=l??null;let b;e[18]!==t||e[19]!==r||e[20]!==g?(b=i.jsx(L.Suspense,{fallback:p,children:i.jsx(Ks,{agent:t,home:r,curated:g})}),e[18]=t,e[19]=r,e[20]=g,e[21]=b):b=e[21];let x;return e[22]!==m||e[23]!==u||e[24]!==b?(x=i.jsxs("div",{className:m,children:[u,b]}),e[22]=m,e[23]=u,e[24]=b,e[25]=x):x=e[25],x}function Bs(s){return s.resourceUri}function Fs(s){return s.connection_id}function Qs(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[i.jsx(H,{className:"h-8 w-full"}),i.jsx(H,{className:"h-8 w-2/3"})]}),s[0]=e):e=s[0],e}function Ws({agent:s,home:e,connectionIds:t,pinnedResourceUris:r}){const{org:n}=V(),l=ee({connectionId:Le,orgId:n.id,orgSlug:n.slug}),{data:o,isLoading:c}=le({queryKey:oe.projectConnectionDetails(s.id,t),enabled:t.length>0,queryFn:async()=>(await Promise.all(t.map(async d=>{try{const m=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:d}}),{item:u}=is(m),p=(u?.tools??[]).flatMap(g=>{const b=es(g._meta);return b?[{name:g.name,description:g.description,resourceUri:b}]:[]});return{id:d,title:u?.title??d,icon:u?.icon??null,uiTools:p}}catch{return{id:d,title:d,icon:null,uiTools:[]}}}))).filter(d=>d.uiTools.length>0)});return t.length===0?null:c?i.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[i.jsx(H,{className:"h-7 w-full"}),i.jsx(H,{className:"h-7 w-2/3"})]}):!o||o.length===0?null:i.jsx("div",{className:"flex flex-col gap-0.5",children:o.map(a=>a.uiTools.map(d=>i.jsx(qs,{agent:s,home:e,connection:a,tool:d,isPinned:r.has(d.resourceUri)},`${a.id}:${d.name}`)))})}function qs({agent:s,home:e,connection:t,tool:r,isPinned:n}){const[l,o]=L.useState(!1),c=async()=>{if(!n&&!e.isOnHome(s.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=xe(s.metadata?.ui),d=n?a.filter(u=>u.resourceUri!==r.resourceUri):[...a,{connectionId:t.id,resourceUri:r.resourceUri}],m={...s.metadata??{},ui:{...s.metadata?.ui??{},homeTile:null,homeTiles:d}};await e.saveAgentMetadata(s,m)}catch(a){console.error("[home-tiles] failed to toggle tile",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx(ss,{icon:t.icon,name:t.title,size:"xs"}),i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:Qe(r.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Xe(s){const e=$.c(11),{isPinned:t,submitting:r,onClick:n,label:l}=s,o=t?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let c;e[0]!==o?(c=K("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",o),e[0]=o,e[1]=c):c=e[1];let a;e[2]!==t||e[3]!==r?(a=r?i.jsx(Me,{size:12,className:"animate-spin"}):t?i.jsx(Ct,{size:14}):i.jsx(be,{size:14}),e[2]=t,e[3]=r,e[4]=a):a=e[4];let d;return e[5]!==l||e[6]!==n||e[7]!==r||e[8]!==c||e[9]!==a?(d=i.jsx("button",{type:"button",onClick:n,disabled:r,"aria-label":l,title:l,className:c,children:a}),e[5]=l,e[6]=n,e[7]=r,e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Ks(s){const e=$.c(32),{agent:t,home:r,curated:n}=s,{org:l}=V();let o;e[0]!==t.id||e[1]!==l.id||e[2]!==l.slug?(o={connectionId:t.id,orgId:l.id,orgSlug:l.slug},e[0]=t.id,e[1]=l.id,e[2]=l.slug,e[3]=o):o=e[3];const c=ee(o);let a;e[4]!==t.id||e[5]!==l.id?(a=oe.agentPrompts(l.id,t.id),e[4]=t.id,e[5]=l.id,e[6]=a):a=e[6];let d;e[7]!==c?(d=async()=>{const{prompts:j}=await c.listPrompts();return j.map(Zs)},e[7]=c,e[8]=d):d=e[8];let m;e[9]!==a||e[10]!==d?(m={queryKey:a,queryFn:d,staleTime:3e4,retry:!1},e[9]=a,e[10]=d,e[11]=m):m=e[11];const{data:u,isLoading:p,error:g}=le(m),b=ye(l.slug);let x,f;if(e[12]!==t.id||e[13]!==u||e[14]!==b.prompts){let j;e[17]!==t.id?(j=_=>_.agentId===t.id&&_.promptName,e[17]=t.id,e[18]=j):j=e[18],x=b.prompts.filter(j).map(Vs);let N;e[19]!==u?(N=u??[],e[19]=u,e[20]=N):N=e[20],f=[...N];for(const _ of x)f.some(T=>T.name===_.name)||f.push(_);e[12]=t.id,e[13]=u,e[14]=b.prompts,e[15]=x,e[16]=f}else x=e[15],f=e[16];if(p&&x.length===0){let j;return e[21]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(H,{className:"h-7 w-full"}),i.jsx(H,{className:"h-7 w-2/3"})]}),e[21]=j):j=e[21],j}if(g&&x.length===0)return console.error("[home-tiles] listPrompts failed for agent",t.id,g),null;if(f.length===0)return null;let h;e[22]!==n||e[23]!==f?(h=n??f.map(Gs),e[22]=n,e[23]=f,e[24]=h):h=e[24];let y;e[25]!==h?(y=new Set(h),e[25]=h,e[26]=y):y=e[26];const w=y;let v;return e[27]!==t||e[28]!==r||e[29]!==f||e[30]!==w?(v=i.jsx("div",{className:"flex flex-col gap-0.5",children:f.map(j=>i.jsx(Js,{agent:t,home:r,prompt:j,allPromptNames:f.map(Xs),isPinned:w.has(j.name)},j.name))}),e[27]=t,e[28]=r,e[29]=f,e[30]=w,e[31]=v):v=e[31],v}function Xs(s){return s.name}function Gs(s){return s.name}function Vs(s){return{name:s.promptName,title:s.title,description:s.description}}function Zs(s){return{name:s.name,title:s.title,description:s.description}}function Js({agent:s,home:e,prompt:t,allPromptNames:r,isPinned:n}){const[l,o]=L.useState(!1),c=async()=>{if(!n&&!e.isOnHome(s.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=s.metadata?.ui?.homePrompts;let d;Array.isArray(a)?d=n?a.filter(u=>u!==t.name):[...a,t.name]:d=n?r.filter(u=>u!==t.name):r;const m={...s.metadata??{},ui:{...s.metadata?.ui??{},homePrompts:d}};await e.saveAgentMetadata(s,m)}catch(a){console.error("[home-tiles] failed to toggle prompt",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t.title??Qe(t.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Ys(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},ei)}),s[0]=e):e=s[0],e}function ei(s,e){return i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[i.jsx(H,{className:"size-8 rounded-md"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"h-2.5 w-1/3"})]})]},e)}const J=1,Ge=`home-board.layout.v${J}`;function Ve(s){return`home-board.layout.v${J}.${s}`}const Ze={version:J,tiles:{},hidden:[]};function ue(s){return!s||s.version!==J?Ze:{version:J,tiles:s.tiles??{},hidden:Array.isArray(s.hidden)?s.hidden:[]}}function ti(s){return Object.keys(s.tiles).length>0||s.hidden.length>0}function si(s){try{const e=localStorage.getItem(Ve(s));return e?ue(JSON.parse(e)):void 0}catch{return}}function _e(s,e){try{localStorage.setItem(Ve(s),JSON.stringify(e))}catch{}}async function Ce(s,e){if(!(await fetch(`/api/${s}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function ii(s){const e=$.c(24),t=pe();let r;e[0]!==s?(r=oe.boardLayout(s),e[0]=s,e[1]=r):r=e[1];const n=r;let l;e[2]!==s?(l=si(s),e[2]=s,e[3]=l):l=e[3];const o=l;let c;e[4]!==o||e[5]!==s?(c=async()=>{const h=await fetch(`/api/${s}/kv/${Ge}`);if(h.status===404)return o&&ti(o)?(await Ce(s,o),o):Ze;if(!h.ok)throw new Error("Failed to load board layout");const y=await h.json(),w=ue(y.value);return _e(s,w),w},e[4]=o,e[5]=s,e[6]=c):c=e[6];let a;e[7]!==o||e[8]!==n||e[9]!==c?(a={queryKey:n,queryFn:c,initialData:o,staleTime:0,refetchOnWindowFocus:!1},e[7]=o,e[8]=n,e[9]=c,e[10]=a):a=e[10];const{data:d,isLoading:m}=le(a);let u;e[11]!==s?(u={mutationFn:h=>Ce(s,h)},e[11]=s,e[12]=u):u=e[12];const p=ht(u);let g;e[13]!==p||e[14]!==s||e[15]!==t||e[16]!==n?(g=h=>{_e(s,h),t.setQueryData(n,h),p.mutate(h)},e[13]=p,e[14]=s,e[15]=t,e[16]=n,e[17]=g):g=e[17];const b=g;let x;e[18]!==d?(x=ue(d),e[18]=d,e[19]=x):x=e[19];let f;return e[20]!==m||e[21]!==b||e[22]!==x?(f={layout:x,isLoading:m,save:b},e[20]=m,e[21]=b,e[22]=x,e[23]=f):f=e[23],f}const Je=L.createContext(null);function ni(s){const e=$.c(24),{children:t}=s,{org:r}=V(),n=ii(r.slug),[l,o]=L.useState(!1),[c,a]=L.useState(null);let d;e[0]!==n.layout?(d=()=>{a(n.layout),o(!0)},e[0]=n.layout,e[1]=d):d=e[1];const m=d;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{a(null),o(!1)},e[2]=u):u=e[2];const p=u;let g;e[3]!==c||e[4]!==n?(g=()=>{c&&n.save(c),a(null),o(!1)},e[3]=c,e[4]=n,e[5]=g):g=e[5];const b=g,x=l&&c!==null,f=x?c:n.layout;let h;e[6]!==c||e[7]!==x||e[8]!==n.layout?(h=x?JSON.stringify(c)!==JSON.stringify(n.layout):!1,e[6]=c,e[7]=x,e[8]=n.layout,e[9]=h):h=e[9];const y=h;let w;e[10]!==l||e[11]!==n?(w=_=>{l?a(_):n.save(_)},e[10]=l,e[11]=n,e[12]=w):w=e[12];const v=w;let j;e[13]!==v||e[14]!==m||e[15]!==y||e[16]!==l||e[17]!==f||e[18]!==b||e[19]!==n.isLoading?(j={isEditMode:l,enter:m,cancel:p,save:b,hasChanges:y,layout:f,isLayoutLoading:n.isLoading,commitLayout:v},e[13]=v,e[14]=m,e[15]=y,e[16]=l,e[17]=f,e[18]=b,e[19]=n.isLoading,e[20]=j):j=e[20];let N;return e[21]!==t||e[22]!==j?(N=i.jsx(Je.Provider,{value:j,children:t}),e[21]=t,e[22]=j,e[23]=N):N=e[23],N}function Ye(){const s=L.useContext(Je);if(!s)throw new Error("useHomeEdit must be used within a HomeEditProvider");return s}function ri({agentId:s}){const{org:e,locator:t}=V(),r=ee({connectionId:s,orgId:e.id,orgSlug:e.slug}),{create:n}=ds(),{setTaskId:l}=Wt(),[o,c]=L.useState(null),[a,d]=L.useState(!1),m=L.useRef(!1),u=async(f,h)=>{if(!r){W.error("MCP client not available");return}if(!m.current){m.current=!0,d(!0);try{const y=await cs(r,f.name,h),w={type:"doc",content:[{type:"paragraph",content:[rs({id:f.name,name:os(f.name,ls(f._meta)),metadata:y.messages,char:"/",kind:"prompt",args:h}),{type:"text",text:" "}]}]},v=crypto.randomUUID();ms(sessionStorage,t,v,{tiptapDoc:w}),await n({id:v,virtual_mcp_id:s}),l(v,s,{autosend:!0})}catch(y){console.error("[start-thread-from-prompt] failed",y),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},p=async f=>{if(!m.current){if(f.arguments&&f.arguments.length>0){c(f);return}await u(f)}},g=async f=>{if(!o)return;const h=o;c(null),await u(h,f)};return{start:p,startBlank:async()=>{if(!m.current){m.current=!0,d(!0);try{const f=crypto.randomUUID();await n({id:f,virtual_mcp_id:s}),l(f,s)}catch(f){console.error("[start-thread-from-prompt] startBlank failed",f),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},dialog:i.jsx(ns,{prompt:o,setPrompt:f=>c(f),onSubmit:g}),dialogPrompt:o,starting:a}}const G=4,X=100,Te=12,ie={S:{w:1,h:1},M:{w:1,h:2},T:{w:1,h:3},L:{w:2,h:1},XL:{w:2,h:2},LT:{w:2,h:3},XLT:{w:2,h:4},XXLT:{w:2,h:5},W:{w:4,h:1},WT:{w:4,h:3}},oi={S:"Small",M:"Tall",T:"Column",L:"Wide",XL:"Large",LT:"Showcase",XLT:"Display",XXLT:"Tower",W:"Full width",WT:"Hero"},Ee=["S","M","T","L","XL","LT","XLT","XXLT","W","WT"],li=ie.XL;class fe extends L.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,t){console.error("[home-tiles] tile crashed:",e,t.componentStack)}render(){return this.state.hasError?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[i.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:i.jsx(pt,{size:16})}),i.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),i.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function ai(s){const e=$.c(72),{tiles:t,isEditMode:r,renderTile:n,onMove:l,onResize:o,onRemove:c}=s,a=ge(),d=L.useRef(null),[m,u]=L.useState(null),[p,g]=L.useState(null);let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={activationConstraint:{distance:4}},e[0]=b):b=e[0];const x=Re(re(Pe,b),re(De)),f=t.reduce(ci,0),h=r?Math.max(f+2,4):Math.max(f,1);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const M=d.current?.getBoundingClientRect();return M?{cellWidth:M.width/G,cellHeight:X}:null},e[1]=y):y=e[1];const w=y;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=M=>{u(String(M.active.id)),g(w())},e[2]=v):v=e[2];const j=v;let N;e[3]!==p||e[4]!==l||e[5]!==t?(N=M=>{const F=String(M.active.id),P=p??w();if(u(null),g(null),!P||P.cellWidth<=0)return;const R=t.find(q=>q.id===F);if(!R)return;const U=Math.round(M.delta.x/P.cellWidth),B=Math.round(M.delta.y/P.cellHeight);U===0&&B===0||l(F,{x:R.x+U,y:R.y+B})},e[3]=p,e[4]=l,e[5]=t,e[6]=N):N=e[6];const _=N;if(a){let M;if(e[7]!==n||e[8]!==t){let P;e[10]!==n?(P=R=>i.jsx("div",{className:"bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:X},children:i.jsx(fe,{children:n(R)})},R.id),e[10]=n,e[11]=P):P=e[11],M=t.map(P),e[7]=n,e[8]=t,e[9]=M}else M=e[9];let F;return e[12]!==M?(F=i.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:M}),e[12]=M,e[13]=F):F=e[13],F}let T,S,E,k,C,I,A,D,z;if(e[14]!==m||e[15]!==p||e[16]!==r||e[17]!==_||e[18]!==c||e[19]!==o||e[20]!==n||e[21]!==x||e[22]!==t||e[23]!==h){const M=m?t.find(Z=>Z.id===m):null;S=He,D=x,z=j,E=_;const F=h*X,P=r?X*4:X;let R;e[33]!==F||e[34]!==P?(R={height:F,minHeight:P},e[33]=F,e[34]=P,e[35]=R):R=e[35];let U;e[36]!==r||e[37]!==t||e[38]!==h?(U=r&&i.jsx(di,{rows:h,tiles:t}),e[36]=r,e[37]=t,e[38]=h,e[39]=U):U=e[39];let B;if(e[40]!==m||e[41]!==r||e[42]!==c||e[43]!==o||e[44]!==n||e[45]!==t){let Z;e[47]!==m||e[48]!==r||e[49]!==c||e[50]!==o||e[51]!==n?(Z=se=>i.jsx(ui,{tile:se,isEditMode:r,isDragging:m===se.id,onResize:o,onRemove:c,children:n(se)},se.id),e[47]=m,e[48]=r,e[49]=c,e[50]=o,e[51]=n,e[52]=Z):Z=e[52],B=t.map(Z),e[40]=m,e[41]=r,e[42]=c,e[43]=o,e[44]=n,e[45]=t,e[46]=B}else B=e[46];e[53]!==R||e[54]!==U||e[55]!==B?(k=i.jsxs("div",{ref:d,className:"relative w-full",style:R,children:[U,B]}),e[53]=R,e[54]=U,e[55]=B,e[56]=k):k=e[56],T=Bt,C=null;const q=M&&p?M.w*p.cellWidth-Te:void 0,ae=M&&p?M.h*p.cellHeight-Te:void 0;e[57]!==q||e[58]!==ae?(I={width:q,height:ae},e[57]=q,e[58]=ae,e[59]=I):I=e[59],A=M&&i.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:i.jsx(fe,{children:n(M)})}),e[14]=m,e[15]=p,e[16]=r,e[17]=_,e[18]=c,e[19]=o,e[20]=n,e[21]=x,e[22]=t,e[23]=h,e[24]=T,e[25]=S,e[26]=E,e[27]=k,e[28]=C,e[29]=I,e[30]=A,e[31]=D,e[32]=z}else T=e[24],S=e[25],E=e[26],k=e[27],C=e[28],I=e[29],A=e[30],D=e[31],z=e[32];let O;e[60]!==T||e[61]!==C||e[62]!==I||e[63]!==A?(O=i.jsx(T,{dropAnimation:C,style:I,children:A}),e[60]=T,e[61]=C,e[62]=I,e[63]=A,e[64]=O):O=e[64];let Q;return e[65]!==S||e[66]!==E||e[67]!==k||e[68]!==O||e[69]!==D||e[70]!==z?(Q=i.jsxs(S,{sensors:D,onDragStart:z,onDragEnd:E,children:[k,O]}),e[65]=S,e[66]=E,e[67]=k,e[68]=O,e[69]=D,e[70]=z,e[71]=Q):Q=e[71],Q}function ci(s,e){return Math.max(s,e.y+e.h)}function di(s){const e=$.c(7),{rows:t,tiles:r}=s;let n;e[0]!==r?(n=(a,d)=>r.some(m=>a>=m.x&&a<m.x+m.w&&d>=m.y&&d<m.y+m.h),e[0]=r,e[1]=n):n=e[1];const l=n;let o;if(e[2]!==l||e[3]!==t){o=[];for(let a=0;a<t;a++)for(let d=0;d<G;d++)l(d,a)||o.push({x:d,y:a});e[2]=l,e[3]=t,e[4]=o}else o=e[4];let c;return e[5]!==o?(c=i.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o.map(mi)}),e[5]=o,e[6]=c):c=e[6],c}function mi(s){return i.jsx("div",{className:"absolute p-1",style:{left:`${s.x/G*100}%`,top:s.y*X,width:`${1/G*100}%`,height:X},children:i.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${s.x}-${s.y}`)}function ui(s){const e=$.c(31),{tile:t,isEditMode:r,isDragging:n,onResize:l,onRemove:o,children:c}=s,a=!r;let d;e[0]!==a||e[1]!==t.id?(d={id:t.id,disabled:a},e[0]=a,e[1]=t.id,e[2]=d):d=e[2];const{setNodeRef:m,attributes:u,listeners:p,isDragging:g}=Ft(d),b=`${t.x/G*100}%`,x=`${t.w/G*100}%`,f=t.y*X,h=t.h*X,y=g||n,w=!y&&"transition-[left,top,width,height,opacity] duration-200 ease-out",v=y&&"opacity-30";let j;e[3]!==w||e[4]!==v?(j=K("absolute p-1 will-change-[left,top,width,height,opacity]",w,v),e[3]=w,e[4]=v,e[5]=j):j=e[5];let N;e[6]!==h||e[7]!==b||e[8]!==f||e[9]!==x?(N={left:b,top:f,width:x,height:h},e[6]=h,e[7]=b,e[8]=f,e[9]=x,e[10]=N):N=e[10];const _=r&&"outline outline-1 outline-transparent hover:outline-primary/40";let T;e[11]!==_?(T=K("relative h-full bg-card card-shadow rounded-2xl overflow-hidden",_),e[11]=_,e[12]=T):T=e[12];let S;e[13]!==u||e[14]!==r||e[15]!==p||e[16]!==o||e[17]!==l||e[18]!==t?(S=r&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",...u,...p,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:i.jsx(ze,{size:16})}),i.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:i.jsx(fi,{tile:t,onResize:l,onRemove:o})})]}),e[13]=u,e[14]=r,e[15]=p,e[16]=o,e[17]=l,e[18]=t,e[19]=S):S=e[19];let E;e[20]!==c?(E=i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(fe,{children:c})}),e[20]=c,e[21]=E):E=e[21];let k;e[22]!==E||e[23]!==T||e[24]!==S?(k=i.jsxs("div",{className:T,children:[S,E]}),e[22]=E,e[23]=T,e[24]=S,e[25]=k):k=e[25];let C;return e[26]!==m||e[27]!==k||e[28]!==j||e[29]!==N?(C=i.jsx("div",{ref:m,className:j,style:N,children:k}),e[26]=m,e[27]=k,e[28]=j,e[29]=N,e[30]=C):C=e[30],C}function fi(s){const e=$.c(43),{tile:t,onResize:r,onRemove:n}=s,l=t.minW??1,o=t.minH??1;let c,a,d,m,u,p,g;if(e[0]!==o||e[1]!==l||e[2]!==r||e[3]!==t.h||e[4]!==t.id||e[5]!==t.w){let v;e[13]!==o||e[14]!==l?(v=S=>{const E=ie[S];return E.w>=l&&E.h>=o},e[13]=o,e[14]=l,e[15]=v):v=e[15];const j=Ee.filter(v);let N;e[16]!==t.h||e[17]!==t.w?(N=(()=>{for(const E of Ee){const k=ie[E];if(k.w===t.w&&k.h===t.h)return E}return null})(),e[16]=t.h,e[17]=t.w,e[18]=N):N=e[18];const _=N;a=us,e[19]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx(fs,{asChild:!0,children:i.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:i.jsx(Tt,{size:16})})}),e[19]=g):g=e[19],c=hs,d="end",m="w-44",e[20]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(ps,{children:"Size"}),e[20]=u):u=e[20];let T;e[21]!==_||e[22]!==r||e[23]!==t.id?(T=S=>{const E=ie[S];return i.jsxs(Ne,{onSelect:()=>r(t.id,E),className:"flex items-center justify-between",children:[i.jsx("span",{children:oi[S]}),i.jsx("span",{className:"text-xs text-muted-foreground",children:_===S?"✓":`${E.w}×${E.h}`})]},S)},e[21]=_,e[22]=r,e[23]=t.id,e[24]=T):T=e[24],p=j.map(T),e[0]=o,e[1]=l,e[2]=r,e[3]=t.h,e[4]=t.id,e[5]=t.w,e[6]=c,e[7]=a,e[8]=d,e[9]=m,e[10]=u,e[11]=p,e[12]=g}else c=e[6],a=e[7],d=e[8],m=e[9],u=e[10],p=e[11],g=e[12];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(xs,{}),e[25]=b):b=e[25];let x;e[26]!==n||e[27]!==t.id?(x=()=>n(t.id),e[26]=n,e[27]=t.id,e[28]=x):x=e[28];let f;e[29]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(gs,{size:14,className:"mr-2"}),e[29]=f):f=e[29];let h;e[30]!==x?(h=i.jsxs(Ne,{onSelect:x,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[30]=x,e[31]=h):h=e[31];let y;e[32]!==c||e[33]!==d||e[34]!==m||e[35]!==u||e[36]!==p||e[37]!==h?(y=i.jsxs(c,{align:d,className:m,children:[u,p,b,h]}),e[32]=c,e[33]=d,e[34]=m,e[35]=u,e[36]=p,e[37]=h,e[38]=y):y=e[38];let w;return e[39]!==a||e[40]!==y||e[41]!==g?(w=i.jsxs(a,{children:[g,y]}),e[39]=a,e[40]=y,e[41]=g,e[42]=w):w=e[42],w}function hi(s,e,t){return s.some(r=>e>=r.x&&e<r.x+r.w&&t>=r.y&&t<r.y+r.h)}function he(s,e,t){for(let r=0;r<100;r++)for(let n=0;n<=G-e;n++){let l=!0;for(let o=0;o<t&&l;o++)for(let c=0;c<e&&l;c++)hi(s,n+c,r+o)&&(l=!1);if(l)return{x:n,y:r}}return{x:0,y:0}}function ce(s,e,t={w:1,h:1}){const r=Math.max(t.w,Math.min(G,s)),n=Math.max(t.h,Math.min(6,e));return{w:r,h:n}}function de(s,e,t){const r=Math.max(0,Math.min(G-t,s)),n=Math.max(0,e);return{x:r,y:n}}function pi(s,e,t){const r=s.find(a=>a.id===e);if(!r)return s;const n=s.filter(a=>a.id!==e),l=n.find(a=>t.x>=a.x&&t.x<a.x+a.w&&t.y>=a.y&&t.y<a.y+a.h);if(l&&l.w===r.w&&l.h===r.h)return s.map(a=>a.id===e?{...a,x:l.x,y:l.y}:a.id===l.id?{...a,x:r.x,y:r.y}:a);const c=[{...r,x:t.x,y:t.y}];for(const a of n){const d=he(c,a.w,a.h);c.push({...a,x:d.x,y:d.y})}return c}function xi(s){const e=$.c(35),{layout:t,isLayoutLoading:r,commitLayout:n}=Ye();let l;e[0]!==t.hidden?(l=new Set(t.hidden),e[0]=t.hidden,e[1]=l):l=e[1];const o=l;let c,a;if(e[2]!==s||e[3]!==o||e[4]!==t.tiles){a=[];let y;e[7]!==o?(y=v=>v.pinned||!o.has(v.id),e[7]=o,e[8]=y):y=e[8];const w=s.filter(y);c=new Map;for(const v of s)v.minSize&&c.set(v.id,v.minSize);for(const v of w){const j=t.tiles[v.id];if(!j)continue;const N=c.get(v.id),{w:_,h:T}=ce(j.w,j.h,N),{x:S,y:E}=de(j.x,j.y,_);a.push({id:v.id,x:S,y:E,w:_,h:T,minW:N?.w,minH:N?.h})}for(const v of w){if(a.some(E=>E.id===v.id))continue;const j=v.defaultSize??li,N=c.get(v.id),{w:_,h:T}=ce(j.w,j.h,N),S=he(a,_,T);a.push({id:v.id,x:S.x,y:S.y,w:_,h:T,minW:N?.w,minH:N?.h})}e[2]=s,e[3]=o,e[4]=t.tiles,e[5]=c,e[6]=a}else c=e[5],a=e[6];let d;e[9]!==s?(d=new Set(s.map(gi)),e[9]=s,e[10]=d):d=e[10];const m=d;let u;e[11]!==m||e[12]!==n?(u=(y,w)=>{const v={};for(const j of y)v[j.id]={x:j.x,y:j.y,w:j.w,h:j.h};n({version:J,tiles:v,hidden:w.filter(j=>m.has(j))})},e[11]=m,e[12]=n,e[13]=u):u=e[13];const p=u;let g;e[14]!==a?(g={visible:a},e[14]=a,e[15]=g):g=e[15];let b;e[16]!==p||e[17]!==t||e[18]!==a?(b=(y,w)=>{const v=a.find(_=>_.id===y);if(!v)return;const j=de(w.x,w.y,v.w);if(j.x===v.x&&j.y===v.y)return;const N=pi(a,y,j);p(N,t.hidden)},e[16]=p,e[17]=t,e[18]=a,e[19]=b):b=e[19];let x;e[20]!==p||e[21]!==t||e[22]!==c||e[23]!==a?(x=(y,w)=>{const v=a.find(k=>k.id===y);if(!v)return;const j=c.get(y),{w:N,h:_}=ce(w.w,w.h,j);if(N===v.w&&_===v.h)return;const T={...v,w:N,h:_,x:de(v.x,v.y,N).x},S=a.filter(k=>k.id!==y),E=[T];for(const k of S){const C=he(E,k.w,k.h);E.push({...k,x:C.x,y:C.y})}p(E,t.hidden)},e[20]=p,e[21]=t,e[22]=c,e[23]=a,e[24]=x):x=e[24];let f;e[25]!==p||e[26]!==t||e[27]!==a?(f=y=>{const w=a.filter(v=>v.id!==y);p(w,Array.from(new Set([...t.hidden,y])))},e[25]=p,e[26]=t,e[27]=a,e[28]=f):f=e[28];let h;return e[29]!==r||e[30]!==g||e[31]!==b||e[32]!==x||e[33]!==f?(h={snapshot:g,isLoading:r,moveTile:b,resizeTile:x,hideTile:f},e[29]=r,e[30]=g,e[31]=b,e[32]=x,e[33]=f,e[34]=h):h=e[34],h}function gi(s){return s.id}const bi={w:2,h:4},yi={w:1,h:2},vi={w:1,h:1};function ji(s){return`prompt:${s.agentId}:${s.promptName||"blank"}`}function wi(s){return`tile:${s.agentId}:${s.resourceUri}`}function Ni(s){return s.promptName?s.agentName:s.description}function Si(s){return{name:s.promptName,title:s.title,description:s.description,arguments:s.arguments,_meta:s._meta}}function ve(s){const e=$.c(10);let t;e[0]!==s?(t={agentId:s},e[0]=s,e[1]=t):t=e[1];const{start:r,startBlank:n,dialog:l,starting:o}=ri(t);let c;e[2]!==r||e[3]!==n?(c=m=>{if(!m.promptName){n();return}r(Si(m))},e[2]=r,e[3]=n,e[4]=c):c=e[4];const a=c;let d;return e[5]!==l||e[6]!==a||e[7]!==n||e[8]!==o?(d={open:a,startBlank:n,dialog:l,starting:o},e[5]=l,e[6]=a,e[7]=n,e[8]=o,e[9]=d):d=e[9],d}function _i(s){const e=$.c(32),{entry:t,isEditMode:r}=s,{open:n,dialog:l,starting:o}=ve(t.agentId);let c;e[0]!==t||e[1]!==n?(c=()=>n(t),e[0]=t,e[1]=n,e[2]=c):c=e[2];const a=o||r,d=!r&&"cursor-pointer transition-colors hover:bg-accent/40",m=r&&"cursor-default pl-12",u=o&&"opacity-60";let p;e[3]!==d||e[4]!==m||e[5]!==u?(p=K("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",d,m,u),e[3]=d,e[4]=m,e[5]=u,e[6]=p):p=e[6];let g;e[7]!==t.agentIcon||e[8]!==t.agentName?(g=i.jsx(Y,{icon:t.agentIcon,name:t.agentName,size:"sm+"}),e[7]=t.agentIcon,e[8]=t.agentName,e[9]=g):g=e[9];let b;e[10]!==t.title?(b=i.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:t.title}),e[10]=t.title,e[11]=b):b=e[11];let x;e[12]!==t?(x=Ni(t),e[12]=t,e[13]=x):x=e[13];let f;e[14]!==x?(f=i.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:x}),e[14]=x,e[15]=f):f=e[15];let h;e[16]!==f||e[17]!==b?(h=i.jsxs("div",{className:"min-w-0 flex-1",children:[b,f]}),e[16]=f,e[17]=b,e[18]=h):h=e[18];let y;e[19]!==r?(y=!r&&i.jsx(as,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=r,e[20]=y):y=e[20];let w;e[21]!==o||e[22]!==c||e[23]!==h||e[24]!==y||e[25]!==a||e[26]!==p||e[27]!==g?(w=i.jsxs("button",{type:"button",onClick:c,disabled:a,"aria-busy":o,className:p,children:[g,h,y]}),e[21]=o,e[22]=c,e[23]=h,e[24]=y,e[25]=a,e[26]=p,e[27]=g,e[28]=w):w=e[28];let v;return e[29]!==l||e[30]!==w?(v=i.jsxs(i.Fragment,{children:[w,l]}),e[29]=l,e[30]=w,e[31]=v):v=e[31],v}function Ci(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},Ti)}),s[0]=e):e=s[0],e}function Ti(s,e){return i.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[i.jsx(H,{className:"size-10 rounded-xl"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(H,{className:"h-3 w-2/3"}),i.jsx(H,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Ei(s){const e=$.c(59),{tile:t,prompts:r,isEditMode:n,tileWidth:l}=s,{org:o}=V();let c;e[0]!==o.id||e[1]!==o.slug||e[2]!==t.connectionId?(c={connectionId:t.connectionId,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=t.connectionId,e[3]=c):c=e[3];const a=ee(c),{open:d,startBlank:m,dialog:u,starting:p}=ve(t.agentId);let g,b,x,f,h;if(e[4]!==a||e[5]!==n||e[6]!==d||e[7]!==o.id||e[8]!==r||e[9]!==m||e[10]!==p||e[11]!==t.agentIcon||e[12]!==t.agentName||e[13]!==t.maxHeight||e[14]!==t.minHeight||e[15]!==t.resourceUri||e[16]!==l){const v=r.filter(ki);f="flex h-full w-full flex-col gap-3 p-3";let j;e[22]!==m?(j=()=>{m()},e[22]=m,e[23]=j):j=e[23];const N=p||n,_=n&&"pl-10 pr-10";let T;e[24]!==_?(T=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",_),e[24]=_,e[25]=T):T=e[25];let S;e[26]!==t.agentIcon||e[27]!==t.agentName?(S=i.jsx(Y,{icon:t.agentIcon,name:t.agentName,size:"sm+"}),e[26]=t.agentIcon,e[27]=t.agentName,e[28]=S):S=e[28];let E;e[29]!==t.agentName?(E=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.agentName}),e[29]=t.agentName,e[30]=E):E=e[30];const k=n?"Drag to rearrange":"Open chat";let C;e[31]!==k?(C=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:k}),e[31]=k,e[32]=C):C=e[32];let I;e[33]!==E||e[34]!==C?(I=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[E,C]}),e[33]=E,e[34]=C,e[35]=I):I=e[35],e[36]!==p||e[37]!==T||e[38]!==S||e[39]!==I||e[40]!==j||e[41]!==N?(h=i.jsxs("button",{type:"button",onClick:j,disabled:N,"aria-busy":p,className:T,children:[S,I]}),e[36]=p,e[37]=T,e[38]=S,e[39]=I,e[40]=j,e[41]=N,e[42]=h):h=e[42],g="flex min-h-0 flex-1 gap-3 overflow-hidden";let A;e[43]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(Ii,{}),e[43]=A):A=e[43];const D=t.minHeight??200,z=t.maxHeight??4e3;e[44]!==a||e[45]!==o.id||e[46]!==D||e[47]!==z||e[48]!==t.resourceUri?(b=i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:i.jsx(L.Suspense,{fallback:A,children:i.jsx(ts,{resourceURI:t.resourceUri,orgId:o.id,client:a,displayMode:"fullscreen",minHeight:D,maxHeight:z,className:"h-full"})})}),e[44]=a,e[45]=o.id,e[46]=D,e[47]=z,e[48]=t.resourceUri,e[49]=b):b=e[49],x=v.length>0&&!n&&l>=2&&i.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:v.map(O=>i.jsx("button",{type:"button",onClick:()=>d(O),disabled:p,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:i.jsx("span",{className:"line-clamp-2",children:O.title})},O.promptName))}),e[4]=a,e[5]=n,e[6]=d,e[7]=o.id,e[8]=r,e[9]=m,e[10]=p,e[11]=t.agentIcon,e[12]=t.agentName,e[13]=t.maxHeight,e[14]=t.minHeight,e[15]=t.resourceUri,e[16]=l,e[17]=g,e[18]=b,e[19]=x,e[20]=f,e[21]=h}else g=e[17],b=e[18],x=e[19],f=e[20],h=e[21];let y;e[50]!==g||e[51]!==b||e[52]!==x?(y=i.jsxs("div",{className:g,children:[b,x]}),e[50]=g,e[51]=b,e[52]=x,e[53]=y):y=e[53];let w;return e[54]!==u||e[55]!==f||e[56]!==h||e[57]!==y?(w=i.jsxs("div",{className:f,children:[h,y,u]}),e[54]=u,e[55]=f,e[56]=h,e[57]=y,e[58]=w):w=e[58],w}function ki(s){return!!s.promptName}function Ii(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[i.jsx(H,{className:"h-3 w-2/3"}),i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"mt-1 h-full w-full rounded-md"})]}),s[0]=e):e=s[0],e}function $i(s){const e=$.c(14),{icon:t,name:r}=s;let n;e[0]!==t||e[1]!==r?(n=i.jsx(Y,{icon:t,name:r,size:"sm+"}),e[0]=t,e[1]=r,e[2]=n):n=e[2];let l;e[3]!==r?(l=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:r}),e[3]=r,e[4]=l):l=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=o):o=e[5];let c;e[6]!==l?(c=i.jsxs("div",{className:"min-w-0 flex-1",children:[l,o]}),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==n||e[9]!==c?(a=i.jsxs("div",{className:"flex items-center gap-2.5",children:[n,c]}),e[8]=n,e[9]=c,e[10]=a):a=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[i.jsx(H,{className:"h-3 w-3/4"}),i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"h-3 w-2/3"})]}),e[11]=d):d=e[11];let m;return e[12]!==a?(m=i.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[a,d]}),e[12]=a,e[13]=m):m=e[13],m}function Ai(s){const e=$.c(33),{tile:t,prompts:r,isEditMode:n}=s,{open:l,startBlank:o,dialog:c,starting:a}=ve(t.agentId);let d,m,u;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==o||e[4]!==a||e[5]!==t.agentIcon||e[6]!==t.agentName){const g=r.filter(Mi);d="flex h-full w-full flex-col gap-3 p-4";let b;e[10]!==o?(b=()=>{o()},e[10]=o,e[11]=b):b=e[11];const x=a||n,f=n&&"pl-10 pr-10";let h;e[12]!==f?(h=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",f),e[12]=f,e[13]=h):h=e[13];let y;e[14]!==t.agentIcon||e[15]!==t.agentName?(y=i.jsx(Y,{icon:t.agentIcon,name:t.agentName,size:"sm+"}),e[14]=t.agentIcon,e[15]=t.agentName,e[16]=y):y=e[16];let w;e[17]!==t.agentName?(w=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.agentName}),e[17]=t.agentName,e[18]=w):w=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"UI unavailable — open chat"}),e[19]=v):v=e[19];let j;e[20]!==w?(j=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[w,v]}),e[20]=w,e[21]=j):j=e[21],e[22]!==j||e[23]!==b||e[24]!==x||e[25]!==h||e[26]!==y?(m=i.jsxs("button",{type:"button",onClick:b,disabled:x,className:h,children:[y,j]}),e[22]=j,e[23]=b,e[24]=x,e[25]=h,e[26]=y,e[27]=m):m=e[27],u=g.length>0&&!n&&i.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:g.map(N=>i.jsx("button",{type:"button",onClick:()=>!n&&l(N),disabled:a,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:i.jsx("span",{className:"line-clamp-2",children:N.title})},N.promptName))}),e[0]=n,e[1]=l,e[2]=r,e[3]=o,e[4]=a,e[5]=t.agentIcon,e[6]=t.agentName,e[7]=d,e[8]=m,e[9]=u}else d=e[7],m=e[8],u=e[9];let p;return e[28]!==c||e[29]!==d||e[30]!==m||e[31]!==u?(p=i.jsxs("div",{className:d,children:[m,u,c]}),e[28]=c,e[29]=d,e[30]=m,e[31]=u,e[32]=p):p=e[32],p}function Mi(s){return!!s.promptName}function et(s){const e=$.c(36),{isEditMode:t}=s,{org:r}=V(),{isLoading:n,prompts:l,tiles:o}=ye(r.slug),c=Ue()?.ids??[];let a;e[0]!==c?(a=new Set(c),e[0]=c,e[1]=a):a=e[1];const d=a,m=Be();let u;e[2]!==o?(u=new Set(o.map(Di)),e[2]=o,e[3]=u):u=e[3];const p=u;let g;if(e[4]!==l){g=new Map;for(const C of l){const I=g.get(C.agentId);I?I.push(C):g.set(C.agentId,[C])}e[4]=l,e[5]=g}else g=e[5];let b;if(e[6]!==l||e[7]!==p||e[8]!==o){let C;e[10]!==p?(C=A=>!p.has(A.agentId),e[10]=p,e[11]=C):C=e[11];const I=l.filter(C);b=[...o.map(Ri),...I.map(Oi)],e[6]=l,e[7]=p,e[8]=o,e[9]=b}else b=e[9];const x=b;let f;e[12]!==x?(f=new Map(x.map(zi)),e[12]=x,e[13]=f):f=e[13];const h=f;let y;e[14]!==x||e[15]!==d?(y=x.map(C=>({id:C.id,defaultSize:C.kind==="tile"?bi:vi,minSize:C.kind==="tile"?yi:void 0,pinned:d.has(C.data.agentId)})),e[14]=x,e[15]=d,e[16]=y):y=e[16];const w=xi(y);let v;e[17]!==m?(v=C=>{m.apply(I=>I.filter(A=>A!==C)).catch(Li)},e[17]=m,e[18]=v):v=e[18];const j=v;let N;e[19]!==h||e[20]!==w||e[21]!==d||e[22]!==j?(N=C=>{const I=h.get(C);I&&d.has(I.data.agentId)?j(I.data.agentId):w.hideTile(C)},e[19]=h,e[20]=w,e[21]=d,e[22]=j,e[23]=N):N=e[23];const _=N;let T;e[24]!==h||e[25]!==t||e[26]!==g?(T=C=>{const I=h.get(C.id);if(!I)return null;if(I.kind==="tile"){const A=g.get(I.data.agentId)??[];return i.jsx(xt,{fallback:i.jsx(Ai,{tile:I.data,prompts:A,isEditMode:t}),children:i.jsx(L.Suspense,{fallback:i.jsx($i,{icon:I.data.agentIcon,name:I.data.agentName}),children:i.jsx(Ei,{tile:I.data,prompts:A,isEditMode:t,tileWidth:C.w})})})}return i.jsx(_i,{entry:I.data,isEditMode:t})},e[24]=h,e[25]=t,e[26]=g,e[27]=T):T=e[27];const S=T;if(n||w.isLoading){let C;return e[28]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ci,{}),e[28]=C):C=e[28],C}if(w.snapshot.visible.length===0&&!t)return null;let k;return e[29]!==t||e[30]!==w.moveTile||e[31]!==w.resizeTile||e[32]!==w.snapshot.visible||e[33]!==_||e[34]!==S?(k=i.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:i.jsx(ai,{tiles:w.snapshot.visible,isEditMode:t,renderTile:S,onMove:w.moveTile,onResize:w.resizeTile,onRemove:_})}),e[29]=t,e[30]=w.moveTile,e[31]=w.resizeTile,e[32]=w.snapshot.visible,e[33]=_,e[34]=S,e[35]=k):k=e[35],k}function Li(){return W.error("Couldn't remove from home — please try again.")}function zi(s){return[s.id,s]}function Oi(s){return{kind:"prompt",id:ji(s),data:s}}function Ri(s){return{kind:"tile",id:wi(s),data:s}}function Di(s){return s.agentId}function Pi(s){const e=$.c(2),{prompts:t,tiles:r}=ye(s),n=r.length>0||t.length>0;let l;return e[0]!==n?(l={hasVisibleTiles:n},e[0]=n,e[1]=l):l=e[1],l}const ke=420,Ie=305;function tt(){const s=$.c(4);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:ke}}),s[0]=e):e=s[0];let t;s[1]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:ke}}),s[1]=t):t=s[1];let r;s[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:Ie}}),s[2]=r):r=s[2];let n;return s[3]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,t,r,i.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Ie}})]}),s[3]=n):n=s[3],n}function $e(){const s=$.c(33),{data:e}=gt.useSession(),{org:t}=V(),r=ge(),n=At(),{selectedVirtualMcp:l}=Mt();let o;s[0]!==t.id?(o=yt(t.id),s[0]=t.id,s[1]=o):o=s[1];const a=l??o;let d;s[2]!==t.slug?(d=qt(t.slug),s[2]=t.slug,s[3]=d):d=s[3],le(d);let m;s[4]!==t.id||s[5]!==t.slug?(m={connectionId:Le,orgId:t.id,orgSlug:t.slug},s[4]=t.id,s[5]=t.slug,s[6]=m):m=s[6];const u=ee(m);let p;s[7]!==t.id||s[8]!==u?(p=bs(u,t.id),s[7]=t.id,s[8]=u,s[9]=p):p=s[9];let g;s[10]!==t.id||s[11]!==u?(g=Qt(u,t.id),s[10]=t.id,s[11]=u,s[12]=g):g=s[12];let b;s[13]!==a.id||s[14]!==t.id||s[15]!==u?(b=wt(t.id,a.id,u),s[13]=a.id,s[14]=t.id,s[15]=u,s[16]=b):b=s[16];let x;s[17]!==p||s[18]!==g||s[19]!==b?(x={queries:[p,g,b]},s[17]=p,s[18]=g,s[19]=b,s[20]=x):x=s[20],Ss(x);const f=ys(),h=Nt(a.id),{hasDecoKey:y,isZeroBalance:w,isInitialFreeCredit:v,balanceDollars:j,hasOnlyDecoProvider:N}=kt(),{hasVisibleTiles:_}=Pi(t.slug),T=It(h?.metadata);if(f.length===0&&!(T&&$t(n))){let O;return s[21]===Symbol.for("react.memo_cache_sentinel")?(O=i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:i.jsx(Lt,{})})}),s[21]=O):O=s[21],O}let E;s[22]!==e?.user?.name?(E=e?.user?.name?.split(" ")[0]||"there",s[22]=e?.user?.name,s[23]=E):E=s[23];const k=E,C=y&&v&&j!=null,I=y&&w&&N;let A;s[24]!==j||s[25]!==C||s[26]!==I?(A=C?i.jsx(ne.CreditsEyebrow,{balanceDollars:j}):I?i.jsx(ne.NoCreditsEyebrow,{}):null,s[24]=j,s[25]=C,s[26]=I,s[27]=A):A=s[27];const D=A;let z;return s[28]!==D||s[29]!==_||s[30]!==r||s[31]!==k?(z=i.jsx(ni,{children:r?i.jsx(Hi,{eyebrow:D,userName:k}):i.jsx(Ui,{eyebrow:D,userName:k,hasVisibleTiles:_})}),s[28]=D,s[29]=_,s[30]=r,s[31]=k,s[32]=z):z=s[32],z}function Hi(s){const e=$.c(12),{eyebrow:t,userName:r}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(tt,{}),e[0]=n):n=e[0];let l;e[1]!==t?(l=t&&i.jsx("div",{className:"mb-4",children:t}),e[1]=t,e[2]=l):l=e[2];let o;e[3]!==r?(o=i.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",r,"?"]}),e[3]=r,e[4]=o):o=e[4];let c;e[5]!==l||e[6]!==o?(c=i.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[l,o]}),e[5]=l,e[6]=o,e[7]=c):c=e[7];let a;e[8]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:i.jsx(ne.Input,{showConnectionsBanner:!0})}),e[8]=a):a=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("div",{className:"relative w-full px-4 pb-8",children:i.jsx(et,{isEditMode:!1})}),e[9]=d):d=e[9];let m;return e[10]!==c?(m=i.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[n,c,a,d]}),e[10]=c,e[11]=m):m=e[11],m}function Ui(s){const e=$.c(32),{eyebrow:t,userName:r,hasVisibleTiles:n}=s,{isEditMode:l,enter:o,save:c,cancel:a,hasChanges:d}=Ye(),[m,u]=L.useState(!1);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>u(!0),e[0]=p):p=e[0];let g;e[1]!==a||e[2]!==o||e[3]!==d||e[4]!==l||e[5]!==c?(g=i.jsx(vs.Right,{children:i.jsx(Bi,{isEditMode:l,hasChanges:d,onEnter:o,onSave:c,onCancel:a,onAddTile:p})}),e[1]=a,e[2]=o,e[3]=d,e[4]=l,e[5]=c,e[6]=g):g=e[6];let b;e[7]!==m?(b=i.jsx(_s,{open:m,onOpenChange:u}),e[7]=m,e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(tt,{}),e[9]=x):x=e[9];const f=n||l?"pt-32":"flex-1 justify-center";let h;e[10]!==f?(h=K("relative flex flex-col items-center px-10 pb-4",f),e[10]=f,e[11]=h):h=e[11];let y;e[12]!==t?(y=t&&i.jsx("div",{className:"mb-4",children:t}),e[12]=t,e[13]=y):y=e[13];let w;e[14]!==r?(w=i.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",r,"?"]}),e[14]=r,e[15]=w):w=e[15];let v;e[16]!==y||e[17]!==w?(v=i.jsxs("div",{className:"text-center mb-10",children:[y,w]}),e[16]=y,e[17]=w,e[18]=v):v=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsxs("div",{className:"relative w-full",children:[i.jsx(Fi,{}),i.jsx(ne.Input,{showConnectionsBanner:!0})]}),e[19]=j):j=e[19];let N;e[20]!==v?(N=i.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[v,j]}),e[20]=v,e[21]=N):N=e[21];let _;e[22]!==l?(_=i.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:i.jsx(et,{isEditMode:l})}),e[22]=l,e[23]=_):_=e[23];let T;e[24]!==N||e[25]!==_||e[26]!==h?(T=i.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[x,i.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:i.jsxs("div",{className:h,children:[N,_]})})]}),e[24]=N,e[25]=_,e[26]=h,e[27]=T):T=e[27];let S;return e[28]!==T||e[29]!==g||e[30]!==b?(S=i.jsxs(i.Fragment,{children:[g,b,T]}),e[28]=T,e[29]=g,e[30]=b,e[31]=S):S=e[31],S}function Bi(s){const e=$.c(17),{isEditMode:t,hasChanges:r,onEnter:n,onSave:l,onCancel:o,onAddTile:c}=s;if(t){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(be,{size:14}),e[0]=m):m=e[0];let u;e[1]!==c?(u=i.jsxs("button",{type:"button",onClick:c,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[m,"Add tile"]}),e[1]=c,e[2]=u):u=e[2];let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Oe,{size:14}),e[3]=p):p=e[3];let g;e[4]!==o?(g=i.jsxs(we,{size:"sm",variant:"ghost",onClick:o,className:"gap-1.5 h-7 text-xs",children:[p,"Cancel"]}),e[4]=o,e[5]=g):g=e[5];const b=!r;let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(St,{size:14}),e[6]=x):x=e[6];let f;e[7]!==l||e[8]!==b?(f=i.jsxs(we,{size:"sm",onClick:l,disabled:b,className:"gap-1.5 h-7 text-xs",children:[x,"Save"]}),e[7]=l,e[8]=b,e[9]=f):f=e[9];let h;return e[10]!==u||e[11]!==g||e[12]!==f?(h=i.jsxs(i.Fragment,{children:[u,g,f]}),e[10]=u,e[11]=g,e[12]=f,e[13]=h):h=e[13],h}let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(Et,{size:14}),e[14]=a):a=e[14];let d;return e[15]!==n?(d=i.jsxs("button",{type:"button",onClick:n,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[a,"Customize"]}),e[15]=n,e[16]=d):d=e[16],d}function Fi(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),s[0]=e):e=s[0],e}function Xr(){const s=$.c(2);if(ge()){let r;return s[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:i.jsx($e,{})}),s[0]=r):r=s[0],r}let t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:i.jsx("div",{className:"h-full p-0.5 pt-0.25",children:i.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:i.jsx($e,{})})})}),s[1]=t):t=s[1],t}export{Xr as default};
1
+ import{aq as st,ar as me,as as it,at as nt,au as Ae,F as pe,av as rt,aw as ot,r as L,ax as lt,ay as at,az as ct,aA as dt,aB as je,aC as mt,aD as ut,aE as ft,e as $,j as i,q as V,c as K,l as Me,aF as xe,o as W,K as oe,n as le,a as ht,v as pt,E as xt,b as gt,B as we}from"./index-DiLEyBR7.js";import{u as ge}from"./tooltip-B0tCRAZt.js";import{i as bt,u as ee,S as Le,g as yt}from"./constants-C02sF-0z.js";import{a as vt,b as jt,v as wt,u as Nt}from"./use-virtual-mcp-kZ4ufgDR.js";import{i as St}from"./Check-CsP_pvqo.js";import{_ as _t,A as Y,a0 as ze,a1 as Ct,s as Tt,c as Et}from"./agent-icon-Zb_Azx6t.js";import{s as be}from"./Plus-doXHkVHa.js";import{i as Oe}from"./X-BkK5F0Sb.js";import{u as kt,b as It,h as $t,C as ne}from"./agent-capabilities-CxcgDRMD.js";import{u as At,c as Mt}from"./chat-context-CZd894Di.js";import{N as Lt}from"./agent-icons-KWqRTm0P.js";import{u as Re,a as re,K as De,P as Pe,D as He,c as zt,S as Ot,v as Rt,b as Dt,C as Pt,s as Ht,d as Ut,e as Bt,f as Ft}from"./sortable.esm-Bljnc1lQ.js";import{u as Ue,a as Be,o as Qt}from"./use-organization-settings-BeptNVun.js";import{c as ye,u as Wt,h as qt}from"./shell-layout-D1NWDKVK.js";import{I as Kt}from"./input-qiotzcFP.js";import{S as Xt}from"./scroll-area-ZNNKR2lN.js";import{S as Gt,c as Vt,d as Zt,a as Jt,b as Yt}from"./sheet-DSOS1Yuo.js";import{S as H}from"./skeleton-w9s8uxnB.js";import{t as Fe}from"./ChevronDown-Da6Jbs2A.js";import{g as es,M as ts}from"./types-cXraKniu.js";import{I as ss}from"./integration-icon-CT5y-vAU.js";import{u as is}from"./unwrap-tool-result-BYXdCQMg.js";import{t as Qe,P as ns,e as rs,s as os,g as ls}from"./pair-UmksH8uX.js";import{a as as}from"./XCircle-CIThxWcq.js";import{g as cs}from"./use-mcp-prompts-DHq-IxcX.js";import{u as ds,w as ms}from"./tab-id-q7-cQc3y.js";import{D as us,a as fs,b as hs,h as ps,c as Ne,d as xs}from"./dropdown-menu-Cjx6QPBx.js";import{s as gs}from"./Trash01-CNj6fyzQ.js";import{a as bs,u as ys}from"./use-ai-providers-BTIs3dbQ.js";import{a as vs}from"./toolbar-D4yEFDPH.js";import"./use-collections-B6VT7NnN.js";import"./AlertCircle-C1fOwBkl.js";import"./Tool01-G9WoiehH.js";import"./SwitchHorizontal01-D4Swb3JX.js";import"./RefreshCcw01-CSpqWFa2.js";import"./ArrowUpRight-BsrA4tbC.js";import"./ZapSquare-mNSHVqng.js";import"./Users03-B0HlZt2l.js";import"./CheckCircle-mDRTMVYu.js";import"./ChevronRight-9O5_X961.js";import"./ChevronUp-DnPjXbn4.js";import"./DotsVertical-Dfjgq8zF.js";import"./Container-C9Kz0cwV.js";import"./Eye-ajWxW8TA.js";import"./Globe01-BwNaijNv.js";import"./FilterLines-PPD0xf3b.js";import"./ZoomOut-BCow3TNO.js";import"./Star01-BlPilctm.js";import"./Palette-BPjy3HGF.js";import"./HardDrive-BwX3ed8Q.js";import"./Stars02-CCPVMnWn.js";import"./Key01-B72Gy8BE.js";import"./LinkExternal01-BAdhV0q5.js";import"./Monitor01-Cmkratd8.js";import"./Sun-B31oi4eI.js";import"./Play-Cwy1ezx1.js";import"./SearchMd-Bl17fAPU.js";import"./Settings02-SjRctAdp.js";import"./Shield01-BrYiuS64.js";import"./Stars01-oDsL4ack.js";import"./Upload01-8N4jWZ6D.js";import"./User01-DfX22WyQ.js";import"./Users01-FEXDN87U.js";import"./XClose-BfGF8Yxq.js";import"./Zap-B3tBDVDH.js";import"./spinner-BdeVoqtO.js";import"./dialog-SqaK-j71.js";import"./drawer-B8OQuEmd.js";import"./collection-search-BYGr0PdJ.js";import"./form-njYT4om-.js";import"./label-7MXDwrE8.js";import"./select-BQQ3gr0O.js";import"./tabs-C99QcRQa.js";import"./toggle-group-BpttAIdH.js";import"./popover-CH0JIVxe.js";import"./command-B979TGJf.js";import"./index-CRgzAb7v.js";import"./useInfiniteQuery-B5R8AWr_.js";import"./infiniteQueryObserver-BhbkmIyu.js";import"./index-CsR8viyX.js";import"./question-004-sINsf4GQ.js";import"./checkbox-1faCCS0E.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-L8DJpW_U.js";import"./settings-section-DSxCNScm.js";import"./card-U-k17Diu.js";import"./connect-desktop-dialog-Cb5SKSv_.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-BRlLX0WC.js";import"./use-registry-connections-qp8vdb0u.js";import"./use-connection-CQsELyYh.js";import"./extract-connection-data-C7sxnagI.js";import"./generate-id-CfUTd1Br.js";import"./collections-FcT9OkSy.js";import"./collection-tabs-Dig67Y8A.js";import"./badge-CULf9W3U.js";import"./textarea-qqK3HQff.js";import"./connection-form-helpers-CBg6u1Cc.js";import"./use-infinite-scroll-Bw0_7vDF.js";import"./useSuspenseInfiniteQuery-Bll4beEM.js";import"./required-auth-layout-xgajebzh.js";import"./useRouterState-Bj46P4qX.js";import"./use-org-sso-CzIgdWpv.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Ea3wOQ_g.js";import"./file-type-icon-BLDh61vl.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-B24V_hDN.js";import"./decopilot-sse-pool-CVbXsCMM.js";import"./create-sse-subscription-BS5983N4.js";function Se(s,e){const t=new Set(e);return s.filter(r=>!t.has(r))}function js(s,e,t){const r=s.slice(0);return r[e]=t,r}var ws=class extends st{#n;#e;#r;#i;#t;#s;#o;#l;#a;#c=[];constructor(s,e,t){super(),this.#n=s,this.#i=t,this.#r=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(s=>{s.subscribe(e=>{this.#f(s,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(s=>{s.destroy()})}setQueries(s,e){this.#r=s,this.#i=e,me.batch(()=>{const t=this.#t,r=this.#u(this.#r);r.forEach(m=>m.observer.setOptions(m.defaultedQueryOptions));const n=r.map(m=>m.observer),l=n.map(m=>m.getCurrentResult()),o=t.length!==n.length,c=n.some((m,u)=>m!==t[u]),a=o||c,d=a?!0:l.some((m,u)=>{const p=this.#e[u];return!p||!it(m,p)});!a&&!d||(a&&(this.#c=r,this.#t=n),this.#e=l,this.hasListeners()&&(a&&(Se(t,n).forEach(m=>{m.destroy()}),Se(n,t).forEach(m=>{m.subscribe(u=>{this.#f(m,u)})})),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(s=>s.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(s,e){const t=this.#u(s),r=t.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),n=t.map(l=>l.defaultedQueryOptions.queryHash);return[r,l=>this.#m(l??r,e,n),()=>this.#d(r,t)]}#d(s,e){return e.map((t,r)=>{const n=s[r];return t.defaultedQueryOptions.notifyOnChangeProps?n:t.observer.trackResult(n,l=>{e.forEach(o=>{o.observer.trackProp(l)})})})}#m(s,e,t){if(e){const r=this.#a,n=t!==void 0&&r!==void 0&&(r.length!==t.length||t.some((l,o)=>l!==r[o]));return(!this.#s||this.#e!==this.#l||n||e!==this.#o)&&(this.#o=e,this.#l=this.#e,t!==void 0&&(this.#a=t),this.#s=nt(this.#s,e(s))),this.#s}return s}#p(){return this.#i?.combine!==void 0&&this.#t.some((s,e)=>s.options.suspense&&this.#e[e]?.data===void 0)}#u(s){const e=new Map;this.#t.forEach(r=>{const n=r.options.queryHash;if(!n)return;const l=e.get(n);l?l.push(r):e.set(n,[r])});const t=[];return s.forEach(r=>{const n=this.#n.defaultQueryOptions(r),o=e.get(n.queryHash)?.shift()??new Ae(this.#n,n);t.push({defaultedQueryOptions:n,observer:o})}),t}#f(s,e){const t=this.#t.indexOf(s);t!==-1&&(this.#e=js(this.#e,t,e),this.#h())}#h(){if(this.hasListeners()){const s=this.#d(this.#e,this.#c),e=this.#p(),t=this.#s,r=e?t:this.#m(s,this.#i?.combine);(e||t!==r)&&me.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function Ns({queries:s,...e},t){const r=pe(t),n=rt(),l=ot(),o=L.useMemo(()=>s.map(x=>{const f=r.defaultQueryOptions(x);return f._optimisticResults=n?"isRestoring":"optimistic",f}),[s,r,n]);o.forEach(x=>{lt(x);const f=r.getQueryCache().get(x.queryHash);at(x,l,f)}),ct(l);const[c]=L.useState(()=>new ws(r,o,e)),[a,d,m]=c.getOptimisticResult(o,e.combine),u=!n&&e.subscribed!==!1;L.useSyncExternalStore(L.useCallback(x=>u?c.subscribe(me.batchCalls(x)):dt,[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),L.useEffect(()=>{c.setQueries(o,e)},[o,e,c]);const g=a.some((x,f)=>je(o[f],x))?a.flatMap((x,f)=>{const h=o[f];if(h&&je(h,x)){const y=new Ae(r,h);return mt(h,y,l)}return[]}):[];if(g.length>0)throw Promise.all(g);const b=a.find((x,f)=>{const h=o[f];return h&&ut({result:x,errorResetBoundary:l,throwOnError:h.throwOnError,query:r.getQueryCache().get(h.queryHash),suspense:h.suspense})});if(b?.error)throw b.error;return d(m())}function Ss(s,e){return Ns({...s,queries:s.queries.map(t=>({...t,suspense:!0,throwOnError:ft,enabled:!0,placeholderData:void 0}))},e)}const te=8;function _s(s){const e=$.c(16),{open:t,onOpenChange:r}=s,[n,l]=L.useState("");let o,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Gt,{children:"Manage home"}),c=i.jsx(Vt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=o,e[1]=c):(o=e[0],c=e[1]);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(_t,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=a):a=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=x=>l(x.target.value),e[3]=d):d=e[3];let m;e[4]!==n?(m=i.jsxs(Zt,{className:"px-5 py-4 border-b border-border",children:[o,c,i.jsxs("div",{className:"relative mt-3",children:[a,i.jsx(Kt,{value:n,onChange:d,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=n,e[5]=m):m=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(Ys,{}),e[6]=u):u=e[6];let p;e[7]!==n?(p=i.jsx(Xt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3 flex flex-col gap-4",children:i.jsx(L.Suspense,{fallback:u,children:i.jsx(Ts,{search:n})})})}),e[7]=n,e[8]=p):p=e[8];let g;e[9]!==m||e[10]!==p?(g=i.jsxs(Jt,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[m,p]}),e[9]=m,e[10]=p,e[11]=g):g=e[11];let b;return e[12]!==r||e[13]!==t||e[14]!==g?(b=i.jsx(Yt,{open:t,onOpenChange:r,children:g}),e[12]=r,e[13]=t,e[14]=g,e[15]=b):b=e[15],b}function Cs(s){const e=$.c(32),{org:t}=V(),r=Ue();let n;e[0]!==r?.ids?(n=r?.ids??[],e[0]=r?.ids,e[1]=n):n=e[1];const l=n,o=Be(),c=jt(),a=pe();let d;e[2]!==t||e[3]!==a?(d=()=>a.refetchQueries({queryKey:oe.homeNextActions(t.slug),type:"active"}),e[2]=t,e[3]=a,e[4]=d):d=e[4];const m=d;let u;e[5]!==l?(u=S=>l.includes(S),e[5]=l,e[6]=u):u=e[6];const p=u;let g;e[7]!==l||e[8]!==s?(g=s?l.filter(S=>s.has(S)).length:l.length,e[7]=l,e[8]=s,e[9]=g):g=e[9];const x=g>=te;let f;e[10]!==x||e[11]!==p||e[12]!==o?(f=S=>p(S)||x?Promise.resolve():o.apply(E=>E.includes(S)?null:[...E,S]),e[10]=x,e[11]=p,e[12]=o,e[13]=f):f=e[13];const h=f;let y;e[14]!==o?(y=S=>o.apply(E=>E.filter(k=>k!==S)),e[14]=o,e[15]=y):y=e[15];const w=y;let v;e[16]!==o?(v=S=>o.apply(()=>S),e[16]=o,e[17]=v):v=e[17];const j=v;let N;e[18]!==c||e[19]!==x||e[20]!==p||e[21]!==m||e[22]!==o?(N=async(S,E)=>{await c.update.mutateAsync({id:S.id,data:{metadata:E}}),!p(S.id)&&!x&&await o.apply(k=>k.includes(S.id)?null:[...k,S.id]),await m()},e[18]=c,e[19]=x,e[20]=p,e[21]=m,e[22]=o,e[23]=N):N=e[23];const _=N;let T;return e[24]!==h||e[25]!==x||e[26]!==l||e[27]!==p||e[28]!==w||e[29]!==j||e[30]!==_?(T={homeIds:l,isOnHome:p,atLimit:x,addAgent:h,removeAgent:w,reorder:j,saveAgentMetadata:_},e[24]=h,e[25]=x,e[26]=l,e[27]=p,e[28]=w,e[29]=j,e[30]=_,e[31]=T):T=e[31],T}function Ts(s){const e=$.c(21),{search:t}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={pageSize:1e3},e[0]=r):r=e[0];const n=vt(r);let l;e[1]!==n?(l=new Set(n.map(As)),e[1]=n,e[2]=l):l=e[2];const o=Cs(l);let c,a,d;if(e[3]!==n||e[4]!==o||e[5]!==t){const x=new Map(n.map($s));c=t.trim().toLowerCase();const f=y=>!c||y.title?.toLowerCase().includes(c);a=o.homeIds.map(y=>x.get(y)).filter(Is).filter(f);let h;e[9]!==o?(h=y=>!o.isOnHome(y.id),e[9]=o,e[10]=h):h=e[10],d=n.filter(ks).filter(h).filter(f).sort(Es),e[3]=n,e[4]=o,e[5]=t,e[6]=c,e[7]=a,e[8]=d}else c=e[6],a=e[7],d=e[8];const m=d;let u;e[11]!==o||e[12]!==a?(u=i.jsx(Ms,{home:o,agents:a}),e[11]=o,e[12]=a,e[13]=u):u=e[13];const p=!!c;let g;e[14]!==m||e[15]!==o||e[16]!==p?(g=i.jsx(Os,{home:o,agents:m,hasSearch:p}),e[14]=m,e[15]=o,e[16]=p,e[17]=g):g=e[17];let b;return e[18]!==u||e[19]!==g?(b=i.jsxs(i.Fragment,{children:[u,g]}),e[18]=u,e[19]=g,e[20]=b):b=e[20],b}function Es(s,e){return(s.title??"").localeCompare(e.title??"")}function ks(s){return s.id&&!bt(s.id)}function Is(s){return!!s}function $s(s){return[s.id,s]}function As(s){return s.id}function We(s){const e=$.c(7),{title:t,hint:r}=s;let n;e[0]!==t?(n=i.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:t}),e[0]=t,e[1]=n):n=e[1];let l;e[2]!==r?(l=r&&i.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let o;return e[4]!==n||e[5]!==l?(o=i.jsxs("div",{className:"flex items-center justify-between px-1",children:[n,l]}),e[4]=n,e[5]=l,e[6]=o):o=e[6],o}function Ms(s){const e=$.c(14),{home:t,agents:r}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={activationConstraint:{distance:5}},e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={coordinateGetter:Ht},e[1]=l):l=e[1];const o=Re(re(Pe,n),re(De,l));let c;e[2]!==t?(c=g=>{const{active:b,over:x}=g;if(!x||b.id===x.id)return;const f=t.homeIds,h=f.indexOf(b.id),y=f.indexOf(x.id);h===-1||y===-1||t.reorder(Ut([...f],h,y)).catch(zs)},e[2]=t,e[3]=c):c=e[3];const a=c,d=`${t.homeIds.length}/${te}`;let m;e[4]!==d?(m=i.jsx(We,{title:"On home",hint:d}),e[4]=d,e[5]=m):m=e[5];let u;e[6]!==r||e[7]!==a||e[8]!==t||e[9]!==o?(u=r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):i.jsx(He,{sensors:o,collisionDetection:zt,onDragEnd:a,children:i.jsx(Ot,{items:r.map(Ls),strategy:Rt,children:i.jsx("div",{className:"flex flex-col gap-1",children:r.map(g=>i.jsx(Ds,{agent:g,home:t},g.id))})})}),e[6]=r,e[7]=a,e[8]=t,e[9]=o,e[10]=u):u=e[10];let p;return e[11]!==m||e[12]!==u?(p=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,u]}),e[11]=m,e[12]=u,e[13]=p):p=e[13],p}function Ls(s){return s.id}function zs(){return W.error("Couldn't reorder home — please try again.")}function Os(s){const e=$.c(6),{home:t,agents:r,hasSearch:n}=s,[l,o]=L.useState(20);let c;if(e[0]!==r||e[1]!==n||e[2]!==t||e[3]!==l){const a=r.slice(0,l);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(We,{title:"Add to home"}),e[5]=d):d=e[5],c=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,r.length===0?i.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:n?"No agents match.":"Every agent is on the home."}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex flex-col gap-1",children:a.map(m=>i.jsx(Us,{agent:m,home:t},m.id))}),r.length>l&&i.jsxs("button",{type:"button",onClick:()=>o(Rs),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",r.length-l,")"]})]})]}),e[0]=r,e[1]=n,e[2]=t,e[3]=l,e[4]=c}else c=e[4];return c}function Rs(s){return s+20}function qe(s){const e=xe(s.metadata?.ui).filter(l=>!!l.resourceUri).length,t=s.metadata?.ui?.homePrompts,r=Array.isArray(t)?t.length:null,n=[];return e>0&&n.push(`${e} tile${e===1?"":"s"}`),r!==null&&r>0&&n.push(`${r} prompt${r===1?"":"s"}`),r===0&&n.push("prompts off"),n.join(" · ")}function Ds(s){const e=$.c(57),{agent:t,home:r}=s,[n,l]=L.useState(!1);let o;e[0]!==t.id?(o={id:t.id},e[0]=t.id,e[1]=o):o=e[1];const{attributes:c,listeners:a,setNodeRef:d,transform:m,transition:u,isDragging:p}=Dt(o),g=qe(t)||"Quick access";let b;e[2]!==m?(b=Pt.Transform.toString(m),e[2]=m,e[3]=b):b=e[3];const x=p?.5:void 0,f=p?100:void 0;let h;e[4]!==b||e[5]!==x||e[6]!==f||e[7]!==u?(h={transform:b,transition:u,opacity:x,zIndex:f},e[4]=b,e[5]=x,e[6]=f,e[7]=u,e[8]=h):h=e[8];const y=h,w=p&&"shadow-lg";let v;e[9]!==w?(v=K("rounded-lg border border-border bg-card",w),e[9]=w,e[10]=v):v=e[10];const j=`Drag to reorder ${t.title??t.id}`;let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(ze,{size:14}),e[11]=N):N=e[11];let _;e[12]!==c||e[13]!==a||e[14]!==j?(_=i.jsx("button",{type:"button",...c,...a,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":j,children:N}),e[12]=c,e[13]=a,e[14]=j,e[15]=_):_=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=()=>l(Hs),e[16]=T):T=e[16];const S=t.title??t.id;let E;e[17]!==t.icon||e[18]!==S?(E=i.jsx(Y,{icon:t.icon,name:S,size:"sm"}),e[17]=t.icon,e[18]=S,e[19]=E):E=e[19];const k=t.title??t.id;let C;e[20]!==k?(C=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:k}),e[20]=k,e[21]=C):C=e[21];let I;e[22]!==g?(I=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:g}),e[22]=g,e[23]=I):I=e[23];let A;e[24]!==C||e[25]!==I?(A=i.jsxs("div",{className:"min-w-0 flex-1",children:[C,I]}),e[24]=C,e[25]=I,e[26]=A):A=e[26];const D=n&&"rotate-180";let z;e[27]!==D?(z=K("shrink-0 text-muted-foreground transition-transform",D),e[27]=D,e[28]=z):z=e[28];let O;e[29]!==z?(O=i.jsx(Fe,{size:16,className:z}),e[29]=z,e[30]=O):O=e[30];let Q;e[31]!==n||e[32]!==E||e[33]!==A||e[34]!==O?(Q=i.jsxs("button",{type:"button",onClick:T,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":n,children:[E,A,O]}),e[31]=n,e[32]=E,e[33]=A,e[34]=O,e[35]=Q):Q=e[35];let M;e[36]!==t.id||e[37]!==r?(M=()=>r.removeAgent(t.id).catch(Ps),e[36]=t.id,e[37]=r,e[38]=M):M=e[38];const F=`Remove ${t.title??t.id} from home`;let P;e[39]===Symbol.for("react.memo_cache_sentinel")?(P=i.jsx(Oe,{size:14}),e[39]=P):P=e[39];let R;e[40]!==M||e[41]!==F?(R=i.jsx("button",{type:"button",onClick:M,"aria-label":F,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:P}),e[40]=M,e[41]=F,e[42]=R):R=e[42];let U;e[43]!==_||e[44]!==Q||e[45]!==R?(U=i.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[_,Q,R]}),e[43]=_,e[44]=Q,e[45]=R,e[46]=U):U=e[46];let B;e[47]!==t||e[48]!==n||e[49]!==r?(B=n&&i.jsx(Ke,{agent:t,home:r}),e[47]=t,e[48]=n,e[49]=r,e[50]=B):B=e[50];let q;return e[51]!==d||e[52]!==y||e[53]!==U||e[54]!==B||e[55]!==v?(q=i.jsxs("div",{ref:d,style:y,className:v,children:[U,B]}),e[51]=d,e[52]=y,e[53]=U,e[54]=B,e[55]=v,e[56]=q):q=e[56],q}function Ps(){return W.error("Couldn't remove from home — please try again.")}function Hs(s){return!s}function Us({agent:s,home:e}){const[t,r]=L.useState(!1),[n,l]=L.useState(!1),o=qe(s),c=async()=>{if(!e.atLimit){l(!0);try{await e.addAgent(s.id)}catch{W.error("Couldn't add to home — please try again.")}finally{l(!1)}}};return i.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[i.jsxs("button",{type:"button",onClick:()=>r(a=>!a),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":t,children:[i.jsx(Y,{icon:s.icon,name:s.title??s.id,size:"sm"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:s.title??s.id}),o&&i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:o})]}),i.jsx(Fe,{size:16,className:K("shrink-0 text-muted-foreground transition-transform",t&&"rotate-180")})]}),i.jsx("button",{type:"button",onClick:c,disabled:n||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${te}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:n?i.jsx(Me,{size:12,className:"animate-spin"}):i.jsx(be,{size:14})})]}),t&&i.jsx(Ke,{agent:s,home:e})]})}function Ke(s){const e=$.c(26),{agent:t,home:r}=s;let n,l,o,c,a,d,m;if(e[0]!==t||e[1]!==r){const f=xe(t.metadata?.ui);let h;e[9]!==t.connections?(h=(t.connections??[]).map(Fs).sort(),e[9]=t.connections,e[10]=h):h=e[10];const y=h;l=t.metadata?.ui?.homePrompts,m="border-t border-border px-3 py-2 flex flex-col gap-3",n=Ws,o=t,c=r,a=y,d=new Set(f.map(Bs)),e[0]=t,e[1]=r,e[2]=n,e[3]=l,e[4]=o,e[5]=c,e[6]=a,e[7]=d,e[8]=m}else n=e[2],l=e[3],o=e[4],c=e[5],a=e[6],d=e[7],m=e[8];let u;e[11]!==n||e[12]!==o||e[13]!==c||e[14]!==a||e[15]!==d?(u=i.jsx(n,{agent:o,home:c,connectionIds:a,pinnedResourceUris:d}),e[11]=n,e[12]=o,e[13]=c,e[14]=a,e[15]=d,e[16]=u):u=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Qs,{}),e[17]=p):p=e[17];const g=l??null;let b;e[18]!==t||e[19]!==r||e[20]!==g?(b=i.jsx(L.Suspense,{fallback:p,children:i.jsx(Ks,{agent:t,home:r,curated:g})}),e[18]=t,e[19]=r,e[20]=g,e[21]=b):b=e[21];let x;return e[22]!==m||e[23]!==u||e[24]!==b?(x=i.jsxs("div",{className:m,children:[u,b]}),e[22]=m,e[23]=u,e[24]=b,e[25]=x):x=e[25],x}function Bs(s){return s.resourceUri}function Fs(s){return s.connection_id}function Qs(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[i.jsx(H,{className:"h-8 w-full"}),i.jsx(H,{className:"h-8 w-2/3"})]}),s[0]=e):e=s[0],e}function Ws({agent:s,home:e,connectionIds:t,pinnedResourceUris:r}){const{org:n}=V(),l=ee({connectionId:Le,orgId:n.id,orgSlug:n.slug}),{data:o,isLoading:c}=le({queryKey:oe.projectConnectionDetails(s.id,t),enabled:t.length>0,queryFn:async()=>(await Promise.all(t.map(async d=>{try{const m=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:d}}),{item:u}=is(m),p=(u?.tools??[]).flatMap(g=>{const b=es(g._meta);return b?[{name:g.name,description:g.description,resourceUri:b}]:[]});return{id:d,title:u?.title??d,icon:u?.icon??null,uiTools:p}}catch{return{id:d,title:d,icon:null,uiTools:[]}}}))).filter(d=>d.uiTools.length>0)});return t.length===0?null:c?i.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[i.jsx(H,{className:"h-7 w-full"}),i.jsx(H,{className:"h-7 w-2/3"})]}):!o||o.length===0?null:i.jsx("div",{className:"flex flex-col gap-0.5",children:o.map(a=>a.uiTools.map(d=>i.jsx(qs,{agent:s,home:e,connection:a,tool:d,isPinned:r.has(d.resourceUri)},`${a.id}:${d.name}`)))})}function qs({agent:s,home:e,connection:t,tool:r,isPinned:n}){const[l,o]=L.useState(!1),c=async()=>{if(!n&&!e.isOnHome(s.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=xe(s.metadata?.ui),d=n?a.filter(u=>u.resourceUri!==r.resourceUri):[...a,{connectionId:t.id,resourceUri:r.resourceUri}],m={...s.metadata??{},ui:{...s.metadata?.ui??{},homeTile:null,homeTiles:d}};await e.saveAgentMetadata(s,m)}catch(a){console.error("[home-tiles] failed to toggle tile",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx(ss,{icon:t.icon,name:t.title,size:"xs"}),i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:Qe(r.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Xe(s){const e=$.c(11),{isPinned:t,submitting:r,onClick:n,label:l}=s,o=t?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let c;e[0]!==o?(c=K("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",o),e[0]=o,e[1]=c):c=e[1];let a;e[2]!==t||e[3]!==r?(a=r?i.jsx(Me,{size:12,className:"animate-spin"}):t?i.jsx(Ct,{size:14}):i.jsx(be,{size:14}),e[2]=t,e[3]=r,e[4]=a):a=e[4];let d;return e[5]!==l||e[6]!==n||e[7]!==r||e[8]!==c||e[9]!==a?(d=i.jsx("button",{type:"button",onClick:n,disabled:r,"aria-label":l,title:l,className:c,children:a}),e[5]=l,e[6]=n,e[7]=r,e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Ks(s){const e=$.c(32),{agent:t,home:r,curated:n}=s,{org:l}=V();let o;e[0]!==t.id||e[1]!==l.id||e[2]!==l.slug?(o={connectionId:t.id,orgId:l.id,orgSlug:l.slug},e[0]=t.id,e[1]=l.id,e[2]=l.slug,e[3]=o):o=e[3];const c=ee(o);let a;e[4]!==t.id||e[5]!==l.id?(a=oe.agentPrompts(l.id,t.id),e[4]=t.id,e[5]=l.id,e[6]=a):a=e[6];let d;e[7]!==c?(d=async()=>{const{prompts:j}=await c.listPrompts();return j.map(Zs)},e[7]=c,e[8]=d):d=e[8];let m;e[9]!==a||e[10]!==d?(m={queryKey:a,queryFn:d,staleTime:3e4,retry:!1},e[9]=a,e[10]=d,e[11]=m):m=e[11];const{data:u,isLoading:p,error:g}=le(m),b=ye(l.slug);let x,f;if(e[12]!==t.id||e[13]!==u||e[14]!==b.prompts){let j;e[17]!==t.id?(j=_=>_.agentId===t.id&&_.promptName,e[17]=t.id,e[18]=j):j=e[18],x=b.prompts.filter(j).map(Vs);let N;e[19]!==u?(N=u??[],e[19]=u,e[20]=N):N=e[20],f=[...N];for(const _ of x)f.some(T=>T.name===_.name)||f.push(_);e[12]=t.id,e[13]=u,e[14]=b.prompts,e[15]=x,e[16]=f}else x=e[15],f=e[16];if(p&&x.length===0){let j;return e[21]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(H,{className:"h-7 w-full"}),i.jsx(H,{className:"h-7 w-2/3"})]}),e[21]=j):j=e[21],j}if(g&&x.length===0)return console.error("[home-tiles] listPrompts failed for agent",t.id,g),null;if(f.length===0)return null;let h;e[22]!==n||e[23]!==f?(h=n??f.map(Gs),e[22]=n,e[23]=f,e[24]=h):h=e[24];let y;e[25]!==h?(y=new Set(h),e[25]=h,e[26]=y):y=e[26];const w=y;let v;return e[27]!==t||e[28]!==r||e[29]!==f||e[30]!==w?(v=i.jsx("div",{className:"flex flex-col gap-0.5",children:f.map(j=>i.jsx(Js,{agent:t,home:r,prompt:j,allPromptNames:f.map(Xs),isPinned:w.has(j.name)},j.name))}),e[27]=t,e[28]=r,e[29]=f,e[30]=w,e[31]=v):v=e[31],v}function Xs(s){return s.name}function Gs(s){return s.name}function Vs(s){return{name:s.promptName,title:s.title,description:s.description}}function Zs(s){return{name:s.name,title:s.title,description:s.description}}function Js({agent:s,home:e,prompt:t,allPromptNames:r,isPinned:n}){const[l,o]=L.useState(!1),c=async()=>{if(!n&&!e.isOnHome(s.id)&&e.atLimit){W.error(`Home is full (${te}) — remove an agent first`);return}o(!0);try{const a=s.metadata?.ui?.homePrompts;let d;Array.isArray(a)?d=n?a.filter(u=>u!==t.name):[...a,t.name]:d=n?r.filter(u=>u!==t.name):r;const m={...s.metadata??{},ui:{...s.metadata?.ui??{},homePrompts:d}};await e.saveAgentMetadata(s,m)}catch(a){console.error("[home-tiles] failed to toggle prompt",a),W.error("Couldn't update home — please try again.")}finally{o(!1)}};return i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[i.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:t.title??Qe(t.name)}),i.jsx(Xe,{isPinned:n,submitting:l,onClick:c,label:n?"Remove from home":"Add to home"})]})}function Ys(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},ei)}),s[0]=e):e=s[0],e}function ei(s,e){return i.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[i.jsx(H,{className:"size-8 rounded-md"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"h-2.5 w-1/3"})]})]},e)}const J=1,Ge=`home-board.layout.v${J}`;function Ve(s){return`home-board.layout.v${J}.${s}`}const Ze={version:J,tiles:{},hidden:[]};function ue(s){return!s||s.version!==J?Ze:{version:J,tiles:s.tiles??{},hidden:Array.isArray(s.hidden)?s.hidden:[]}}function ti(s){return Object.keys(s.tiles).length>0||s.hidden.length>0}function si(s){try{const e=localStorage.getItem(Ve(s));return e?ue(JSON.parse(e)):void 0}catch{return}}function _e(s,e){try{localStorage.setItem(Ve(s),JSON.stringify(e))}catch{}}async function Ce(s,e){if(!(await fetch(`/api/${s}/kv/${Ge}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function ii(s){const e=$.c(24),t=pe();let r;e[0]!==s?(r=oe.boardLayout(s),e[0]=s,e[1]=r):r=e[1];const n=r;let l;e[2]!==s?(l=si(s),e[2]=s,e[3]=l):l=e[3];const o=l;let c;e[4]!==o||e[5]!==s?(c=async()=>{const h=await fetch(`/api/${s}/kv/${Ge}`);if(h.status===404)return o&&ti(o)?(await Ce(s,o),o):Ze;if(!h.ok)throw new Error("Failed to load board layout");const y=await h.json(),w=ue(y.value);return _e(s,w),w},e[4]=o,e[5]=s,e[6]=c):c=e[6];let a;e[7]!==o||e[8]!==n||e[9]!==c?(a={queryKey:n,queryFn:c,initialData:o,staleTime:0,refetchOnWindowFocus:!1},e[7]=o,e[8]=n,e[9]=c,e[10]=a):a=e[10];const{data:d,isLoading:m}=le(a);let u;e[11]!==s?(u={mutationFn:h=>Ce(s,h)},e[11]=s,e[12]=u):u=e[12];const p=ht(u);let g;e[13]!==p||e[14]!==s||e[15]!==t||e[16]!==n?(g=h=>{_e(s,h),t.setQueryData(n,h),p.mutate(h)},e[13]=p,e[14]=s,e[15]=t,e[16]=n,e[17]=g):g=e[17];const b=g;let x;e[18]!==d?(x=ue(d),e[18]=d,e[19]=x):x=e[19];let f;return e[20]!==m||e[21]!==b||e[22]!==x?(f={layout:x,isLoading:m,save:b},e[20]=m,e[21]=b,e[22]=x,e[23]=f):f=e[23],f}const Je=L.createContext(null);function ni(s){const e=$.c(24),{children:t}=s,{org:r}=V(),n=ii(r.slug),[l,o]=L.useState(!1),[c,a]=L.useState(null);let d;e[0]!==n.layout?(d=()=>{a(n.layout),o(!0)},e[0]=n.layout,e[1]=d):d=e[1];const m=d;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{a(null),o(!1)},e[2]=u):u=e[2];const p=u;let g;e[3]!==c||e[4]!==n?(g=()=>{c&&n.save(c),a(null),o(!1)},e[3]=c,e[4]=n,e[5]=g):g=e[5];const b=g,x=l&&c!==null,f=x?c:n.layout;let h;e[6]!==c||e[7]!==x||e[8]!==n.layout?(h=x?JSON.stringify(c)!==JSON.stringify(n.layout):!1,e[6]=c,e[7]=x,e[8]=n.layout,e[9]=h):h=e[9];const y=h;let w;e[10]!==l||e[11]!==n?(w=_=>{l?a(_):n.save(_)},e[10]=l,e[11]=n,e[12]=w):w=e[12];const v=w;let j;e[13]!==v||e[14]!==m||e[15]!==y||e[16]!==l||e[17]!==f||e[18]!==b||e[19]!==n.isLoading?(j={isEditMode:l,enter:m,cancel:p,save:b,hasChanges:y,layout:f,isLayoutLoading:n.isLoading,commitLayout:v},e[13]=v,e[14]=m,e[15]=y,e[16]=l,e[17]=f,e[18]=b,e[19]=n.isLoading,e[20]=j):j=e[20];let N;return e[21]!==t||e[22]!==j?(N=i.jsx(Je.Provider,{value:j,children:t}),e[21]=t,e[22]=j,e[23]=N):N=e[23],N}function Ye(){const s=L.useContext(Je);if(!s)throw new Error("useHomeEdit must be used within a HomeEditProvider");return s}function ri({agentId:s}){const{org:e,locator:t}=V(),r=ee({connectionId:s,orgId:e.id,orgSlug:e.slug}),{create:n}=ds(),{setTaskId:l}=Wt(),[o,c]=L.useState(null),[a,d]=L.useState(!1),m=L.useRef(!1),u=async(f,h)=>{if(!r){W.error("MCP client not available");return}if(!m.current){m.current=!0,d(!0);try{const y=await cs(r,f.name,h),w={type:"doc",content:[{type:"paragraph",content:[rs({id:f.name,name:os(f.name,ls(f._meta)),metadata:y.messages,char:"/",kind:"prompt",args:h}),{type:"text",text:" "}]}]},v=crypto.randomUUID();ms(sessionStorage,t,v,{tiptapDoc:w}),await n({id:v,virtual_mcp_id:s}),l(v,s,{autosend:!0})}catch(y){console.error("[start-thread-from-prompt] failed",y),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},p=async f=>{if(!m.current){if(f.arguments&&f.arguments.length>0){c(f);return}await u(f)}},g=async f=>{if(!o)return;const h=o;c(null),await u(h,f)};return{start:p,startBlank:async()=>{if(!m.current){m.current=!0,d(!0);try{const f=crypto.randomUUID();await n({id:f,virtual_mcp_id:s}),l(f,s)}catch(f){console.error("[start-thread-from-prompt] startBlank failed",f),W.error("Failed to start thread. Please try again.")}finally{m.current=!1,d(!1)}}},dialog:i.jsx(ns,{prompt:o,setPrompt:f=>c(f),onSubmit:g}),dialogPrompt:o,starting:a}}const G=4,X=100,Te=12,ie={S:{w:1,h:1},M:{w:1,h:2},T:{w:1,h:3},L:{w:2,h:1},XL:{w:2,h:2},LT:{w:2,h:3},XLT:{w:2,h:4},XXLT:{w:2,h:5},W:{w:4,h:1},WT:{w:4,h:3}},oi={S:"Small",M:"Tall",T:"Column",L:"Wide",XL:"Large",LT:"Showcase",XLT:"Display",XXLT:"Tower",W:"Full width",WT:"Hero"},Ee=["S","M","T","L","XL","LT","XLT","XXLT","W","WT"],li=ie.XL;class fe extends L.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,t){console.error("[home-tiles] tile crashed:",e,t.componentStack)}render(){return this.state.hasError?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[i.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:i.jsx(pt,{size:16})}),i.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),i.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function ai(s){const e=$.c(72),{tiles:t,isEditMode:r,renderTile:n,onMove:l,onResize:o,onRemove:c}=s,a=ge(),d=L.useRef(null),[m,u]=L.useState(null),[p,g]=L.useState(null);let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={activationConstraint:{distance:4}},e[0]=b):b=e[0];const x=Re(re(Pe,b),re(De)),f=t.reduce(ci,0),h=r?Math.max(f+2,4):Math.max(f,1);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{const M=d.current?.getBoundingClientRect();return M?{cellWidth:M.width/G,cellHeight:X}:null},e[1]=y):y=e[1];const w=y;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=M=>{u(String(M.active.id)),g(w())},e[2]=v):v=e[2];const j=v;let N;e[3]!==p||e[4]!==l||e[5]!==t?(N=M=>{const F=String(M.active.id),P=p??w();if(u(null),g(null),!P||P.cellWidth<=0)return;const R=t.find(q=>q.id===F);if(!R)return;const U=Math.round(M.delta.x/P.cellWidth),B=Math.round(M.delta.y/P.cellHeight);U===0&&B===0||l(F,{x:R.x+U,y:R.y+B})},e[3]=p,e[4]=l,e[5]=t,e[6]=N):N=e[6];const _=N;if(a){let M;if(e[7]!==n||e[8]!==t){let P;e[10]!==n?(P=R=>i.jsx("div",{className:"bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:X},children:i.jsx(fe,{children:n(R)})},R.id),e[10]=n,e[11]=P):P=e[11],M=t.map(P),e[7]=n,e[8]=t,e[9]=M}else M=e[9];let F;return e[12]!==M?(F=i.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:M}),e[12]=M,e[13]=F):F=e[13],F}let T,S,E,k,C,I,A,D,z;if(e[14]!==m||e[15]!==p||e[16]!==r||e[17]!==_||e[18]!==c||e[19]!==o||e[20]!==n||e[21]!==x||e[22]!==t||e[23]!==h){const M=m?t.find(Z=>Z.id===m):null;S=He,D=x,z=j,E=_;const F=h*X,P=r?X*4:X;let R;e[33]!==F||e[34]!==P?(R={height:F,minHeight:P},e[33]=F,e[34]=P,e[35]=R):R=e[35];let U;e[36]!==r||e[37]!==t||e[38]!==h?(U=r&&i.jsx(di,{rows:h,tiles:t}),e[36]=r,e[37]=t,e[38]=h,e[39]=U):U=e[39];let B;if(e[40]!==m||e[41]!==r||e[42]!==c||e[43]!==o||e[44]!==n||e[45]!==t){let Z;e[47]!==m||e[48]!==r||e[49]!==c||e[50]!==o||e[51]!==n?(Z=se=>i.jsx(ui,{tile:se,isEditMode:r,isDragging:m===se.id,onResize:o,onRemove:c,children:n(se)},se.id),e[47]=m,e[48]=r,e[49]=c,e[50]=o,e[51]=n,e[52]=Z):Z=e[52],B=t.map(Z),e[40]=m,e[41]=r,e[42]=c,e[43]=o,e[44]=n,e[45]=t,e[46]=B}else B=e[46];e[53]!==R||e[54]!==U||e[55]!==B?(k=i.jsxs("div",{ref:d,className:"relative w-full",style:R,children:[U,B]}),e[53]=R,e[54]=U,e[55]=B,e[56]=k):k=e[56],T=Bt,C=null;const q=M&&p?M.w*p.cellWidth-Te:void 0,ae=M&&p?M.h*p.cellHeight-Te:void 0;e[57]!==q||e[58]!==ae?(I={width:q,height:ae},e[57]=q,e[58]=ae,e[59]=I):I=e[59],A=M&&i.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:i.jsx(fe,{children:n(M)})}),e[14]=m,e[15]=p,e[16]=r,e[17]=_,e[18]=c,e[19]=o,e[20]=n,e[21]=x,e[22]=t,e[23]=h,e[24]=T,e[25]=S,e[26]=E,e[27]=k,e[28]=C,e[29]=I,e[30]=A,e[31]=D,e[32]=z}else T=e[24],S=e[25],E=e[26],k=e[27],C=e[28],I=e[29],A=e[30],D=e[31],z=e[32];let O;e[60]!==T||e[61]!==C||e[62]!==I||e[63]!==A?(O=i.jsx(T,{dropAnimation:C,style:I,children:A}),e[60]=T,e[61]=C,e[62]=I,e[63]=A,e[64]=O):O=e[64];let Q;return e[65]!==S||e[66]!==E||e[67]!==k||e[68]!==O||e[69]!==D||e[70]!==z?(Q=i.jsxs(S,{sensors:D,onDragStart:z,onDragEnd:E,children:[k,O]}),e[65]=S,e[66]=E,e[67]=k,e[68]=O,e[69]=D,e[70]=z,e[71]=Q):Q=e[71],Q}function ci(s,e){return Math.max(s,e.y+e.h)}function di(s){const e=$.c(7),{rows:t,tiles:r}=s;let n;e[0]!==r?(n=(a,d)=>r.some(m=>a>=m.x&&a<m.x+m.w&&d>=m.y&&d<m.y+m.h),e[0]=r,e[1]=n):n=e[1];const l=n;let o;if(e[2]!==l||e[3]!==t){o=[];for(let a=0;a<t;a++)for(let d=0;d<G;d++)l(d,a)||o.push({x:d,y:a});e[2]=l,e[3]=t,e[4]=o}else o=e[4];let c;return e[5]!==o?(c=i.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o.map(mi)}),e[5]=o,e[6]=c):c=e[6],c}function mi(s){return i.jsx("div",{className:"absolute p-1",style:{left:`${s.x/G*100}%`,top:s.y*X,width:`${1/G*100}%`,height:X},children:i.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${s.x}-${s.y}`)}function ui(s){const e=$.c(31),{tile:t,isEditMode:r,isDragging:n,onResize:l,onRemove:o,children:c}=s,a=!r;let d;e[0]!==a||e[1]!==t.id?(d={id:t.id,disabled:a},e[0]=a,e[1]=t.id,e[2]=d):d=e[2];const{setNodeRef:m,attributes:u,listeners:p,isDragging:g}=Ft(d),b=`${t.x/G*100}%`,x=`${t.w/G*100}%`,f=t.y*X,h=t.h*X,y=g||n,w=!y&&"transition-[left,top,width,height,opacity] duration-200 ease-out",v=y&&"opacity-30";let j;e[3]!==w||e[4]!==v?(j=K("absolute p-1 will-change-[left,top,width,height,opacity]",w,v),e[3]=w,e[4]=v,e[5]=j):j=e[5];let N;e[6]!==h||e[7]!==b||e[8]!==f||e[9]!==x?(N={left:b,top:f,width:x,height:h},e[6]=h,e[7]=b,e[8]=f,e[9]=x,e[10]=N):N=e[10];const _=r&&"outline outline-1 outline-transparent hover:outline-primary/40";let T;e[11]!==_?(T=K("relative h-full bg-card card-shadow rounded-2xl overflow-hidden",_),e[11]=_,e[12]=T):T=e[12];let S;e[13]!==u||e[14]!==r||e[15]!==p||e[16]!==o||e[17]!==l||e[18]!==t?(S=r&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",...u,...p,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:i.jsx(ze,{size:16})}),i.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:i.jsx(fi,{tile:t,onResize:l,onRemove:o})})]}),e[13]=u,e[14]=r,e[15]=p,e[16]=o,e[17]=l,e[18]=t,e[19]=S):S=e[19];let E;e[20]!==c?(E=i.jsx("div",{className:"h-full overflow-hidden",children:i.jsx(fe,{children:c})}),e[20]=c,e[21]=E):E=e[21];let k;e[22]!==E||e[23]!==T||e[24]!==S?(k=i.jsxs("div",{className:T,children:[S,E]}),e[22]=E,e[23]=T,e[24]=S,e[25]=k):k=e[25];let C;return e[26]!==m||e[27]!==k||e[28]!==j||e[29]!==N?(C=i.jsx("div",{ref:m,className:j,style:N,children:k}),e[26]=m,e[27]=k,e[28]=j,e[29]=N,e[30]=C):C=e[30],C}function fi(s){const e=$.c(43),{tile:t,onResize:r,onRemove:n}=s,l=t.minW??1,o=t.minH??1;let c,a,d,m,u,p,g;if(e[0]!==o||e[1]!==l||e[2]!==r||e[3]!==t.h||e[4]!==t.id||e[5]!==t.w){let v;e[13]!==o||e[14]!==l?(v=S=>{const E=ie[S];return E.w>=l&&E.h>=o},e[13]=o,e[14]=l,e[15]=v):v=e[15];const j=Ee.filter(v);let N;e[16]!==t.h||e[17]!==t.w?(N=(()=>{for(const E of Ee){const k=ie[E];if(k.w===t.w&&k.h===t.h)return E}return null})(),e[16]=t.h,e[17]=t.w,e[18]=N):N=e[18];const _=N;a=us,e[19]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx(fs,{asChild:!0,children:i.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:i.jsx(Tt,{size:16})})}),e[19]=g):g=e[19],c=hs,d="end",m="w-44",e[20]===Symbol.for("react.memo_cache_sentinel")?(u=i.jsx(ps,{children:"Size"}),e[20]=u):u=e[20];let T;e[21]!==_||e[22]!==r||e[23]!==t.id?(T=S=>{const E=ie[S];return i.jsxs(Ne,{onSelect:()=>r(t.id,E),className:"flex items-center justify-between",children:[i.jsx("span",{children:oi[S]}),i.jsx("span",{className:"text-xs text-muted-foreground",children:_===S?"✓":`${E.w}×${E.h}`})]},S)},e[21]=_,e[22]=r,e[23]=t.id,e[24]=T):T=e[24],p=j.map(T),e[0]=o,e[1]=l,e[2]=r,e[3]=t.h,e[4]=t.id,e[5]=t.w,e[6]=c,e[7]=a,e[8]=d,e[9]=m,e[10]=u,e[11]=p,e[12]=g}else c=e[6],a=e[7],d=e[8],m=e[9],u=e[10],p=e[11],g=e[12];let b;e[25]===Symbol.for("react.memo_cache_sentinel")?(b=i.jsx(xs,{}),e[25]=b):b=e[25];let x;e[26]!==n||e[27]!==t.id?(x=()=>n(t.id),e[26]=n,e[27]=t.id,e[28]=x):x=e[28];let f;e[29]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(gs,{size:14,className:"mr-2"}),e[29]=f):f=e[29];let h;e[30]!==x?(h=i.jsxs(Ne,{onSelect:x,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[30]=x,e[31]=h):h=e[31];let y;e[32]!==c||e[33]!==d||e[34]!==m||e[35]!==u||e[36]!==p||e[37]!==h?(y=i.jsxs(c,{align:d,className:m,children:[u,p,b,h]}),e[32]=c,e[33]=d,e[34]=m,e[35]=u,e[36]=p,e[37]=h,e[38]=y):y=e[38];let w;return e[39]!==a||e[40]!==y||e[41]!==g?(w=i.jsxs(a,{children:[g,y]}),e[39]=a,e[40]=y,e[41]=g,e[42]=w):w=e[42],w}function hi(s,e,t){return s.some(r=>e>=r.x&&e<r.x+r.w&&t>=r.y&&t<r.y+r.h)}function he(s,e,t){for(let r=0;r<100;r++)for(let n=0;n<=G-e;n++){let l=!0;for(let o=0;o<t&&l;o++)for(let c=0;c<e&&l;c++)hi(s,n+c,r+o)&&(l=!1);if(l)return{x:n,y:r}}return{x:0,y:0}}function ce(s,e,t={w:1,h:1}){const r=Math.max(t.w,Math.min(G,s)),n=Math.max(t.h,Math.min(6,e));return{w:r,h:n}}function de(s,e,t){const r=Math.max(0,Math.min(G-t,s)),n=Math.max(0,e);return{x:r,y:n}}function pi(s,e,t){const r=s.find(a=>a.id===e);if(!r)return s;const n=s.filter(a=>a.id!==e),l=n.find(a=>t.x>=a.x&&t.x<a.x+a.w&&t.y>=a.y&&t.y<a.y+a.h);if(l&&l.w===r.w&&l.h===r.h)return s.map(a=>a.id===e?{...a,x:l.x,y:l.y}:a.id===l.id?{...a,x:r.x,y:r.y}:a);const c=[{...r,x:t.x,y:t.y}];for(const a of n){const d=he(c,a.w,a.h);c.push({...a,x:d.x,y:d.y})}return c}function xi(s){const e=$.c(35),{layout:t,isLayoutLoading:r,commitLayout:n}=Ye();let l;e[0]!==t.hidden?(l=new Set(t.hidden),e[0]=t.hidden,e[1]=l):l=e[1];const o=l;let c,a;if(e[2]!==s||e[3]!==o||e[4]!==t.tiles){a=[];let y;e[7]!==o?(y=v=>v.pinned||!o.has(v.id),e[7]=o,e[8]=y):y=e[8];const w=s.filter(y);c=new Map;for(const v of s)v.minSize&&c.set(v.id,v.minSize);for(const v of w){const j=t.tiles[v.id];if(!j)continue;const N=c.get(v.id),{w:_,h:T}=ce(j.w,j.h,N),{x:S,y:E}=de(j.x,j.y,_);a.push({id:v.id,x:S,y:E,w:_,h:T,minW:N?.w,minH:N?.h})}for(const v of w){if(a.some(E=>E.id===v.id))continue;const j=v.defaultSize??li,N=c.get(v.id),{w:_,h:T}=ce(j.w,j.h,N),S=he(a,_,T);a.push({id:v.id,x:S.x,y:S.y,w:_,h:T,minW:N?.w,minH:N?.h})}e[2]=s,e[3]=o,e[4]=t.tiles,e[5]=c,e[6]=a}else c=e[5],a=e[6];let d;e[9]!==s?(d=new Set(s.map(gi)),e[9]=s,e[10]=d):d=e[10];const m=d;let u;e[11]!==m||e[12]!==n?(u=(y,w)=>{const v={};for(const j of y)v[j.id]={x:j.x,y:j.y,w:j.w,h:j.h};n({version:J,tiles:v,hidden:w.filter(j=>m.has(j))})},e[11]=m,e[12]=n,e[13]=u):u=e[13];const p=u;let g;e[14]!==a?(g={visible:a},e[14]=a,e[15]=g):g=e[15];let b;e[16]!==p||e[17]!==t||e[18]!==a?(b=(y,w)=>{const v=a.find(_=>_.id===y);if(!v)return;const j=de(w.x,w.y,v.w);if(j.x===v.x&&j.y===v.y)return;const N=pi(a,y,j);p(N,t.hidden)},e[16]=p,e[17]=t,e[18]=a,e[19]=b):b=e[19];let x;e[20]!==p||e[21]!==t||e[22]!==c||e[23]!==a?(x=(y,w)=>{const v=a.find(k=>k.id===y);if(!v)return;const j=c.get(y),{w:N,h:_}=ce(w.w,w.h,j);if(N===v.w&&_===v.h)return;const T={...v,w:N,h:_,x:de(v.x,v.y,N).x},S=a.filter(k=>k.id!==y),E=[T];for(const k of S){const C=he(E,k.w,k.h);E.push({...k,x:C.x,y:C.y})}p(E,t.hidden)},e[20]=p,e[21]=t,e[22]=c,e[23]=a,e[24]=x):x=e[24];let f;e[25]!==p||e[26]!==t||e[27]!==a?(f=y=>{const w=a.filter(v=>v.id!==y);p(w,Array.from(new Set([...t.hidden,y])))},e[25]=p,e[26]=t,e[27]=a,e[28]=f):f=e[28];let h;return e[29]!==r||e[30]!==g||e[31]!==b||e[32]!==x||e[33]!==f?(h={snapshot:g,isLoading:r,moveTile:b,resizeTile:x,hideTile:f},e[29]=r,e[30]=g,e[31]=b,e[32]=x,e[33]=f,e[34]=h):h=e[34],h}function gi(s){return s.id}const bi={w:2,h:4},yi={w:1,h:2},vi={w:1,h:1};function ji(s){return`prompt:${s.agentId}:${s.promptName||"blank"}`}function wi(s){return`tile:${s.agentId}:${s.resourceUri}`}function Ni(s){return s.promptName?s.agentName:s.description}function Si(s){return{name:s.promptName,title:s.title,description:s.description,arguments:s.arguments,_meta:s._meta}}function ve(s){const e=$.c(10);let t;e[0]!==s?(t={agentId:s},e[0]=s,e[1]=t):t=e[1];const{start:r,startBlank:n,dialog:l,starting:o}=ri(t);let c;e[2]!==r||e[3]!==n?(c=m=>{if(!m.promptName){n();return}r(Si(m))},e[2]=r,e[3]=n,e[4]=c):c=e[4];const a=c;let d;return e[5]!==l||e[6]!==a||e[7]!==n||e[8]!==o?(d={open:a,startBlank:n,dialog:l,starting:o},e[5]=l,e[6]=a,e[7]=n,e[8]=o,e[9]=d):d=e[9],d}function _i(s){const e=$.c(32),{entry:t,isEditMode:r}=s,{open:n,dialog:l,starting:o}=ve(t.agentId);let c;e[0]!==t||e[1]!==n?(c=()=>n(t),e[0]=t,e[1]=n,e[2]=c):c=e[2];const a=o||r,d=!r&&"cursor-pointer transition-colors hover:bg-accent/40",m=r&&"cursor-default pl-12",u=o&&"opacity-60";let p;e[3]!==d||e[4]!==m||e[5]!==u?(p=K("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",d,m,u),e[3]=d,e[4]=m,e[5]=u,e[6]=p):p=e[6];let g;e[7]!==t.agentIcon||e[8]!==t.agentName?(g=i.jsx(Y,{icon:t.agentIcon,name:t.agentName,size:"sm+"}),e[7]=t.agentIcon,e[8]=t.agentName,e[9]=g):g=e[9];let b;e[10]!==t.title?(b=i.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:t.title}),e[10]=t.title,e[11]=b):b=e[11];let x;e[12]!==t?(x=Ni(t),e[12]=t,e[13]=x):x=e[13];let f;e[14]!==x?(f=i.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:x}),e[14]=x,e[15]=f):f=e[15];let h;e[16]!==f||e[17]!==b?(h=i.jsxs("div",{className:"min-w-0 flex-1",children:[b,f]}),e[16]=f,e[17]=b,e[18]=h):h=e[18];let y;e[19]!==r?(y=!r&&i.jsx(as,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=r,e[20]=y):y=e[20];let w;e[21]!==o||e[22]!==c||e[23]!==h||e[24]!==y||e[25]!==a||e[26]!==p||e[27]!==g?(w=i.jsxs("button",{type:"button",onClick:c,disabled:a,"aria-busy":o,className:p,children:[g,h,y]}),e[21]=o,e[22]=c,e[23]=h,e[24]=y,e[25]=a,e[26]=p,e[27]=g,e[28]=w):w=e[28];let v;return e[29]!==l||e[30]!==w?(v=i.jsxs(i.Fragment,{children:[w,l]}),e[29]=l,e[30]=w,e[31]=v):v=e[31],v}function Ci(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},Ti)}),s[0]=e):e=s[0],e}function Ti(s,e){return i.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[i.jsx(H,{className:"size-10 rounded-xl"}),i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx(H,{className:"h-3 w-2/3"}),i.jsx(H,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Ei(s){const e=$.c(59),{tile:t,prompts:r,isEditMode:n,tileWidth:l}=s,{org:o}=V();let c;e[0]!==o.id||e[1]!==o.slug||e[2]!==t.connectionId?(c={connectionId:t.connectionId,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=t.connectionId,e[3]=c):c=e[3];const a=ee(c),{open:d,startBlank:m,dialog:u,starting:p}=ve(t.agentId);let g,b,x,f,h;if(e[4]!==a||e[5]!==n||e[6]!==d||e[7]!==o.id||e[8]!==r||e[9]!==m||e[10]!==p||e[11]!==t.agentIcon||e[12]!==t.agentName||e[13]!==t.maxHeight||e[14]!==t.minHeight||e[15]!==t.resourceUri||e[16]!==l){const v=r.filter(ki);f="flex h-full w-full flex-col gap-3 p-3";let j;e[22]!==m?(j=()=>{m()},e[22]=m,e[23]=j):j=e[23];const N=p||n,_=n&&"pl-10 pr-10";let T;e[24]!==_?(T=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",_),e[24]=_,e[25]=T):T=e[25];let S;e[26]!==t.agentIcon||e[27]!==t.agentName?(S=i.jsx(Y,{icon:t.agentIcon,name:t.agentName,size:"sm+"}),e[26]=t.agentIcon,e[27]=t.agentName,e[28]=S):S=e[28];let E;e[29]!==t.agentName?(E=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.agentName}),e[29]=t.agentName,e[30]=E):E=e[30];const k=n?"Drag to rearrange":"Open chat";let C;e[31]!==k?(C=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:k}),e[31]=k,e[32]=C):C=e[32];let I;e[33]!==E||e[34]!==C?(I=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[E,C]}),e[33]=E,e[34]=C,e[35]=I):I=e[35],e[36]!==p||e[37]!==T||e[38]!==S||e[39]!==I||e[40]!==j||e[41]!==N?(h=i.jsxs("button",{type:"button",onClick:j,disabled:N,"aria-busy":p,className:T,children:[S,I]}),e[36]=p,e[37]=T,e[38]=S,e[39]=I,e[40]=j,e[41]=N,e[42]=h):h=e[42],g="flex min-h-0 flex-1 gap-3 overflow-hidden";let A;e[43]===Symbol.for("react.memo_cache_sentinel")?(A=i.jsx(Ii,{}),e[43]=A):A=e[43];const D=t.minHeight??200,z=t.maxHeight??4e3;e[44]!==a||e[45]!==o.id||e[46]!==D||e[47]!==z||e[48]!==t.resourceUri?(b=i.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:i.jsx(L.Suspense,{fallback:A,children:i.jsx(ts,{resourceURI:t.resourceUri,orgId:o.id,client:a,displayMode:"fullscreen",minHeight:D,maxHeight:z,className:"h-full"})})}),e[44]=a,e[45]=o.id,e[46]=D,e[47]=z,e[48]=t.resourceUri,e[49]=b):b=e[49],x=v.length>0&&!n&&l>=2&&i.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:v.map(O=>i.jsx("button",{type:"button",onClick:()=>d(O),disabled:p,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:i.jsx("span",{className:"line-clamp-2",children:O.title})},O.promptName))}),e[4]=a,e[5]=n,e[6]=d,e[7]=o.id,e[8]=r,e[9]=m,e[10]=p,e[11]=t.agentIcon,e[12]=t.agentName,e[13]=t.maxHeight,e[14]=t.minHeight,e[15]=t.resourceUri,e[16]=l,e[17]=g,e[18]=b,e[19]=x,e[20]=f,e[21]=h}else g=e[17],b=e[18],x=e[19],f=e[20],h=e[21];let y;e[50]!==g||e[51]!==b||e[52]!==x?(y=i.jsxs("div",{className:g,children:[b,x]}),e[50]=g,e[51]=b,e[52]=x,e[53]=y):y=e[53];let w;return e[54]!==u||e[55]!==f||e[56]!==h||e[57]!==y?(w=i.jsxs("div",{className:f,children:[h,y,u]}),e[54]=u,e[55]=f,e[56]=h,e[57]=y,e[58]=w):w=e[58],w}function ki(s){return!!s.promptName}function Ii(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[i.jsx(H,{className:"h-3 w-2/3"}),i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"mt-1 h-full w-full rounded-md"})]}),s[0]=e):e=s[0],e}function $i(s){const e=$.c(14),{icon:t,name:r}=s;let n;e[0]!==t||e[1]!==r?(n=i.jsx(Y,{icon:t,name:r,size:"sm+"}),e[0]=t,e[1]=r,e[2]=n):n=e[2];let l;e[3]!==r?(l=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:r}),e[3]=r,e[4]=l):l=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=o):o=e[5];let c;e[6]!==l?(c=i.jsxs("div",{className:"min-w-0 flex-1",children:[l,o]}),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==n||e[9]!==c?(a=i.jsxs("div",{className:"flex items-center gap-2.5",children:[n,c]}),e[8]=n,e[9]=c,e[10]=a):a=e[10];let d;e[11]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[i.jsx(H,{className:"h-3 w-3/4"}),i.jsx(H,{className:"h-3 w-1/2"}),i.jsx(H,{className:"h-3 w-2/3"})]}),e[11]=d):d=e[11];let m;return e[12]!==a?(m=i.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[a,d]}),e[12]=a,e[13]=m):m=e[13],m}function Ai(s){const e=$.c(33),{tile:t,prompts:r,isEditMode:n}=s,{open:l,startBlank:o,dialog:c,starting:a}=ve(t.agentId);let d,m,u;if(e[0]!==n||e[1]!==l||e[2]!==r||e[3]!==o||e[4]!==a||e[5]!==t.agentIcon||e[6]!==t.agentName){const g=r.filter(Mi);d="flex h-full w-full flex-col gap-3 p-4";let b;e[10]!==o?(b=()=>{o()},e[10]=o,e[11]=b):b=e[11];const x=a||n,f=n&&"pl-10 pr-10";let h;e[12]!==f?(h=K("flex items-center gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",f),e[12]=f,e[13]=h):h=e[13];let y;e[14]!==t.agentIcon||e[15]!==t.agentName?(y=i.jsx(Y,{icon:t.agentIcon,name:t.agentName,size:"sm+"}),e[14]=t.agentIcon,e[15]=t.agentName,e[16]=y):y=e[16];let w;e[17]!==t.agentName?(w=i.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.agentName}),e[17]=t.agentName,e[18]=w):w=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"UI unavailable — open chat"}),e[19]=v):v=e[19];let j;e[20]!==w?(j=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[w,v]}),e[20]=w,e[21]=j):j=e[21],e[22]!==j||e[23]!==b||e[24]!==x||e[25]!==h||e[26]!==y?(m=i.jsxs("button",{type:"button",onClick:b,disabled:x,className:h,children:[y,j]}),e[22]=j,e[23]=b,e[24]=x,e[25]=h,e[26]=y,e[27]=m):m=e[27],u=g.length>0&&!n&&i.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:g.map(N=>i.jsx("button",{type:"button",onClick:()=>!n&&l(N),disabled:a,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:i.jsx("span",{className:"line-clamp-2",children:N.title})},N.promptName))}),e[0]=n,e[1]=l,e[2]=r,e[3]=o,e[4]=a,e[5]=t.agentIcon,e[6]=t.agentName,e[7]=d,e[8]=m,e[9]=u}else d=e[7],m=e[8],u=e[9];let p;return e[28]!==c||e[29]!==d||e[30]!==m||e[31]!==u?(p=i.jsxs("div",{className:d,children:[m,u,c]}),e[28]=c,e[29]=d,e[30]=m,e[31]=u,e[32]=p):p=e[32],p}function Mi(s){return!!s.promptName}function et(s){const e=$.c(36),{isEditMode:t}=s,{org:r}=V(),{isLoading:n,prompts:l,tiles:o}=ye(r.slug),c=Ue()?.ids??[];let a;e[0]!==c?(a=new Set(c),e[0]=c,e[1]=a):a=e[1];const d=a,m=Be();let u;e[2]!==o?(u=new Set(o.map(Di)),e[2]=o,e[3]=u):u=e[3];const p=u;let g;if(e[4]!==l){g=new Map;for(const C of l){const I=g.get(C.agentId);I?I.push(C):g.set(C.agentId,[C])}e[4]=l,e[5]=g}else g=e[5];let b;if(e[6]!==l||e[7]!==p||e[8]!==o){let C;e[10]!==p?(C=A=>!p.has(A.agentId),e[10]=p,e[11]=C):C=e[11];const I=l.filter(C);b=[...o.map(Ri),...I.map(Oi)],e[6]=l,e[7]=p,e[8]=o,e[9]=b}else b=e[9];const x=b;let f;e[12]!==x?(f=new Map(x.map(zi)),e[12]=x,e[13]=f):f=e[13];const h=f;let y;e[14]!==x||e[15]!==d?(y=x.map(C=>({id:C.id,defaultSize:C.kind==="tile"?bi:vi,minSize:C.kind==="tile"?yi:void 0,pinned:d.has(C.data.agentId)})),e[14]=x,e[15]=d,e[16]=y):y=e[16];const w=xi(y);let v;e[17]!==m?(v=C=>{m.apply(I=>I.filter(A=>A!==C)).catch(Li)},e[17]=m,e[18]=v):v=e[18];const j=v;let N;e[19]!==h||e[20]!==w||e[21]!==d||e[22]!==j?(N=C=>{const I=h.get(C);I&&d.has(I.data.agentId)?j(I.data.agentId):w.hideTile(C)},e[19]=h,e[20]=w,e[21]=d,e[22]=j,e[23]=N):N=e[23];const _=N;let T;e[24]!==h||e[25]!==t||e[26]!==g?(T=C=>{const I=h.get(C.id);if(!I)return null;if(I.kind==="tile"){const A=g.get(I.data.agentId)??[];return i.jsx(xt,{fallback:i.jsx(Ai,{tile:I.data,prompts:A,isEditMode:t}),children:i.jsx(L.Suspense,{fallback:i.jsx($i,{icon:I.data.agentIcon,name:I.data.agentName}),children:i.jsx(Ei,{tile:I.data,prompts:A,isEditMode:t,tileWidth:C.w})})})}return i.jsx(_i,{entry:I.data,isEditMode:t})},e[24]=h,e[25]=t,e[26]=g,e[27]=T):T=e[27];const S=T;if(n||w.isLoading){let C;return e[28]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ci,{}),e[28]=C):C=e[28],C}if(w.snapshot.visible.length===0&&!t)return null;let k;return e[29]!==t||e[30]!==w.moveTile||e[31]!==w.resizeTile||e[32]!==w.snapshot.visible||e[33]!==_||e[34]!==S?(k=i.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:i.jsx(ai,{tiles:w.snapshot.visible,isEditMode:t,renderTile:S,onMove:w.moveTile,onResize:w.resizeTile,onRemove:_})}),e[29]=t,e[30]=w.moveTile,e[31]=w.resizeTile,e[32]=w.snapshot.visible,e[33]=_,e[34]=S,e[35]=k):k=e[35],k}function Li(){return W.error("Couldn't remove from home — please try again.")}function zi(s){return[s.id,s]}function Oi(s){return{kind:"prompt",id:ji(s),data:s}}function Ri(s){return{kind:"tile",id:wi(s),data:s}}function Di(s){return s.agentId}function Pi(s){const e=$.c(2),{prompts:t,tiles:r}=ye(s),n=r.length>0||t.length>0;let l;return e[0]!==n?(l={hasVisibleTiles:n},e[0]=n,e[1]=l):l=e[1],l}const ke=420,Ie=305;function tt(){const s=$.c(4);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:ke}}),s[0]=e):e=s[0];let t;s[1]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:ke}}),s[1]=t):t=s[1];let r;s[2]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:Ie}}),s[2]=r):r=s[2];let n;return s[3]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,t,r,i.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:Ie}})]}),s[3]=n):n=s[3],n}function $e(){const s=$.c(33),{data:e}=gt.useSession(),{org:t}=V(),r=ge(),n=At(),{selectedVirtualMcp:l}=Mt();let o;s[0]!==t.id?(o=yt(t.id),s[0]=t.id,s[1]=o):o=s[1];const a=l??o;let d;s[2]!==t.slug?(d=qt(t.slug),s[2]=t.slug,s[3]=d):d=s[3],le(d);let m;s[4]!==t.id||s[5]!==t.slug?(m={connectionId:Le,orgId:t.id,orgSlug:t.slug},s[4]=t.id,s[5]=t.slug,s[6]=m):m=s[6];const u=ee(m);let p;s[7]!==t.id||s[8]!==u?(p=bs(u,t.id),s[7]=t.id,s[8]=u,s[9]=p):p=s[9];let g;s[10]!==t.id||s[11]!==u?(g=Qt(u,t.id),s[10]=t.id,s[11]=u,s[12]=g):g=s[12];let b;s[13]!==a.id||s[14]!==t.id||s[15]!==u?(b=wt(t.id,a.id,u),s[13]=a.id,s[14]=t.id,s[15]=u,s[16]=b):b=s[16];let x;s[17]!==p||s[18]!==g||s[19]!==b?(x={queries:[p,g,b]},s[17]=p,s[18]=g,s[19]=b,s[20]=x):x=s[20],Ss(x);const f=ys(),h=Nt(a.id),{hasDecoKey:y,isZeroBalance:w,isInitialFreeCredit:v,balanceDollars:j,hasOnlyDecoProvider:N}=kt(),{hasVisibleTiles:_}=Pi(t.slug),T=It(h?.metadata);if(f.length===0&&!(T&&$t(n))){let O;return s[21]===Symbol.for("react.memo_cache_sentinel")?(O=i.jsx("div",{className:"flex-1 overflow-y-auto",children:i.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:i.jsx(Lt,{})})}),s[21]=O):O=s[21],O}let E;s[22]!==e?.user?.name?(E=e?.user?.name?.split(" ")[0]||"there",s[22]=e?.user?.name,s[23]=E):E=s[23];const k=E,C=y&&v&&j!=null,I=y&&w&&N;let A;s[24]!==j||s[25]!==C||s[26]!==I?(A=C?i.jsx(ne.CreditsEyebrow,{balanceDollars:j}):I?i.jsx(ne.NoCreditsEyebrow,{}):null,s[24]=j,s[25]=C,s[26]=I,s[27]=A):A=s[27];const D=A;let z;return s[28]!==D||s[29]!==_||s[30]!==r||s[31]!==k?(z=i.jsx(ni,{children:r?i.jsx(Hi,{eyebrow:D,userName:k}):i.jsx(Ui,{eyebrow:D,userName:k,hasVisibleTiles:_})}),s[28]=D,s[29]=_,s[30]=r,s[31]=k,s[32]=z):z=s[32],z}function Hi(s){const e=$.c(12),{eyebrow:t,userName:r}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(tt,{}),e[0]=n):n=e[0];let l;e[1]!==t?(l=t&&i.jsx("div",{className:"mb-4",children:t}),e[1]=t,e[2]=l):l=e[2];let o;e[3]!==r?(o=i.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",r,"?"]}),e[3]=r,e[4]=o):o=e[4];let c;e[5]!==l||e[6]!==o?(c=i.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[l,o]}),e[5]=l,e[6]=o,e[7]=c):c=e[7];let a;e[8]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:i.jsx(ne.Input,{showConnectionsBanner:!0})}),e[8]=a):a=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx("div",{className:"relative w-full px-4 pb-8",children:i.jsx(et,{isEditMode:!1})}),e[9]=d):d=e[9];let m;return e[10]!==c?(m=i.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[n,c,a,d]}),e[10]=c,e[11]=m):m=e[11],m}function Ui(s){const e=$.c(32),{eyebrow:t,userName:r,hasVisibleTiles:n}=s,{isEditMode:l,enter:o,save:c,cancel:a,hasChanges:d}=Ye(),[m,u]=L.useState(!1);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>u(!0),e[0]=p):p=e[0];let g;e[1]!==a||e[2]!==o||e[3]!==d||e[4]!==l||e[5]!==c?(g=i.jsx(vs.Right,{children:i.jsx(Bi,{isEditMode:l,hasChanges:d,onEnter:o,onSave:c,onCancel:a,onAddTile:p})}),e[1]=a,e[2]=o,e[3]=d,e[4]=l,e[5]=c,e[6]=g):g=e[6];let b;e[7]!==m?(b=i.jsx(_s,{open:m,onOpenChange:u}),e[7]=m,e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(tt,{}),e[9]=x):x=e[9];const f=n||l?"pt-32":"flex-1 justify-center";let h;e[10]!==f?(h=K("relative flex flex-col items-center px-10 pb-4",f),e[10]=f,e[11]=h):h=e[11];let y;e[12]!==t?(y=t&&i.jsx("div",{className:"mb-4",children:t}),e[12]=t,e[13]=y):y=e[13];let w;e[14]!==r?(w=i.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",r,"?"]}),e[14]=r,e[15]=w):w=e[15];let v;e[16]!==y||e[17]!==w?(v=i.jsxs("div",{className:"text-center mb-10",children:[y,w]}),e[16]=y,e[17]=w,e[18]=v):v=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsxs("div",{className:"relative w-full",children:[i.jsx(Fi,{}),i.jsx(ne.Input,{showConnectionsBanner:!0})]}),e[19]=j):j=e[19];let N;e[20]!==v?(N=i.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[v,j]}),e[20]=v,e[21]=N):N=e[21];let _;e[22]!==l?(_=i.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:i.jsx(et,{isEditMode:l})}),e[22]=l,e[23]=_):_=e[23];let T;e[24]!==N||e[25]!==_||e[26]!==h?(T=i.jsxs("div",{className:"flex-1 relative flex flex-col min-h-0",children:[x,i.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:i.jsxs("div",{className:h,children:[N,_]})})]}),e[24]=N,e[25]=_,e[26]=h,e[27]=T):T=e[27];let S;return e[28]!==T||e[29]!==g||e[30]!==b?(S=i.jsxs(i.Fragment,{children:[g,b,T]}),e[28]=T,e[29]=g,e[30]=b,e[31]=S):S=e[31],S}function Bi(s){const e=$.c(17),{isEditMode:t,hasChanges:r,onEnter:n,onSave:l,onCancel:o,onAddTile:c}=s;if(t){let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(be,{size:14}),e[0]=m):m=e[0];let u;e[1]!==c?(u=i.jsxs("button",{type:"button",onClick:c,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[m,"Add tile"]}),e[1]=c,e[2]=u):u=e[2];let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsx(Oe,{size:14}),e[3]=p):p=e[3];let g;e[4]!==o?(g=i.jsxs(we,{size:"sm",variant:"ghost",onClick:o,className:"gap-1.5 h-7 text-xs",children:[p,"Cancel"]}),e[4]=o,e[5]=g):g=e[5];const b=!r;let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=i.jsx(St,{size:14}),e[6]=x):x=e[6];let f;e[7]!==l||e[8]!==b?(f=i.jsxs(we,{size:"sm",onClick:l,disabled:b,className:"gap-1.5 h-7 text-xs",children:[x,"Save"]}),e[7]=l,e[8]=b,e[9]=f):f=e[9];let h;return e[10]!==u||e[11]!==g||e[12]!==f?(h=i.jsxs(i.Fragment,{children:[u,g,f]}),e[10]=u,e[11]=g,e[12]=f,e[13]=h):h=e[13],h}let a;e[14]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(Et,{size:14}),e[14]=a):a=e[14];let d;return e[15]!==n?(d=i.jsxs("button",{type:"button",onClick:n,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[a,"Customize"]}),e[15]=n,e[16]=d):d=e[16],d}function Fi(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),s[0]=e):e=s[0],e}function Xr(){const s=$.c(2);if(ge()){let r;return s[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:i.jsx($e,{})}),s[0]=r):r=s[0],r}let t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:i.jsx("div",{className:"h-full p-0.5 pt-0.25",children:i.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:i.jsx($e,{})})})}),s[1]=t):t=s[1],t}export{Xr as default};
@@ -1,2 +1,2 @@
1
- import{e as N,q as E,F as Fe,a as ie,K as U,n as L,b2 as Me,r as X,j as s,B as P,c as Re,E as je,f as Be,d as Ke,z as Ie,o as Q}from"./index-CHwrxx2w.js";import{i as Ve}from"./ChevronRight-D5DpowYO.js";import{s as Ce}from"./Eye-MHwkC0Bm.js";import{n as Se,i as He}from"./Globe01-ZT5vmTMf.js";import{s as Qe}from"./Plus-CsnODh95.js";import{t as Ge}from"./Stars01-DxQPpWJA.js";import{i as De}from"./Upload01-Dh5J3z7m.js";import{b as ye,T as we,a as be,u as Xe}from"./tooltip-lUpcIPGH.js";import{A as We,a as Ye,b as Ze,c as Je,d as et,e as tt,f as st,g as lt}from"./alert-dialog-ocZJkxTi.js";import{D as re,a as oe,c as ae,b as nt,e as it,d as rt}from"./dialog-Cr0Lqq3q.js";import{I as ot}from"./input-BsiCsTx_.js";import{S as W}from"./skeleton-DIaIyZIy.js";import{i as ce}from"./DotsVertical-BGN9ibyU.js";import{i as Oe}from"./ZoomOut-DMIdbERz.js";import{s as de}from"./Trash01-BIBfIkQ_.js";import{i as ze}from"./Zap-DUKmeTe3.js";import{a as fe,c as Z,b as ue,D as me}from"./dropdown-menu-CvaGrQxV.js";import{F as G,d as Pe,M as at}from"./file-type-icon-BCikryQ0.js";import{n as ct}from"./LinkExternal01-DyZjuYqx.js";import{f as Ue,a as dt,F as ft}from"./file-preview-BJpkPGnT.js";import"./X-5JYlDYV-.js";import"./Check-xwts9G2J.js";function _(l,e,t,n){const i=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(l)}/fs/${encodeURIComponent(e)}/${t}${i?`?${i}`:""}`}async function R(l,e){const t=await fetch(l,e);if(!t.ok){let n="";try{n=(await t.json()).error??""}catch{}throw new Error(n||`HTTP ${t.status}`)}return t}function Te(l,e){const t=N.c(11),{org:n}=E();let i;t[0]!==n.id||t[1]!==e||t[2]!==l?(i=U.orgFsList(n.id,l,e),t[0]=n.id,t[1]=e,t[2]=l,t[3]=i):i=t[3];let r;t[4]!==n.slug||t[5]!==e||t[6]!==l?(r=async()=>(await(await R(_(n.slug,l,"list",{path:e}))).json()).entries.toSorted(ut),t[4]=n.slug,t[5]=e,t[6]=l,t[7]=r):r=t[7];let a;return t[8]!==i||t[9]!==r?(a={queryKey:i,placeholderData:Me,queryFn:r},t[8]=i,t[9]=r,t[10]=a):a=t[10],L(a)}function ut(l,e){return l.kind!==e.kind?l.kind==="dir"?-1:1:l.path.localeCompare(e.path)}function mt(l,e){const t=N.c(12),{org:n}=E();let i;t[0]!==n.id||t[1]!==e||t[2]!==l?(i=U.orgFsStat(n.id,l??"",e),t[0]=n.id,t[1]=e,t[2]=l,t[3]=i):i=t[3];const r=l!==null;let a;t[4]!==n.slug||t[5]!==e||t[6]!==l?(a=async()=>{const o=await fetch(_(n.slug,l??"","stat",{path:e}));if(o.status===404)return null;if(!o.ok)throw new Error(`HTTP ${o.status}`);return(await o.json()).entry},t[4]=n.slug,t[5]=e,t[6]=l,t[7]=a):a=t[7];let c;return t[8]!==i||t[9]!==r||t[10]!==a?(c={queryKey:i,enabled:r,queryFn:a},t[8]=i,t[9]=r,t[10]=a,t[11]=c):c=t[11],L(c)}function ht(l){const e=N.c(9),{org:t}=E();let n;e[0]!==t.id||e[1]!==l?(n=U.orgFsUsage(t.id,l),e[0]=t.id,e[1]=l,e[2]=n):n=e[2];let i;e[3]!==t.slug||e[4]!==l?(i=async()=>await(await R(_(t.slug,l,"usage"))).json(),e[3]=t.slug,e[4]=l,e[5]=i):i=e[5];let r;return e[6]!==n||e[7]!==i?(r={queryKey:n,queryFn:i},e[6]=n,e[7]=i,e[8]=r):r=e[8],L(r)}function xt(l){const e=N.c(8),t=60,{org:n}=E();let i;e[0]!==n.id?(i=U.orgFsRecent(n.id),e[0]=n.id,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==n.slug?(r=async()=>(await(await R(`/api/${encodeURIComponent(n.slug)}/fs/recent?limit=${t}`)).json()).entries,e[2]=t,e[3]=n.slug,e[4]=r):r=e[4];let a;return e[5]!==i||e[6]!==r?(a={queryKey:i,queryFn:r},e[5]=i,e[6]=r,e[7]=a):a=e[7],L(a)}function Ae(){const l=N.c(7),{org:e}=E();let t;l[0]!==e.id?(t=U.orgFsPublicSets(e.id),l[0]=e.id,l[1]=t):t=l[1];let n;l[2]!==e.slug?(n=async()=>(await(await R(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,l[2]=e.slug,l[3]=n):n=l[3];let i;return l[4]!==t||l[5]!==n?(i={queryKey:t,staleTime:3e5,queryFn:n},l[4]=t,l[5]=n,l[6]=i):i=l[6],L(i)}function pt(l){const e=N.c(3),{org:t}=E();let n;return e[0]!==t.slug||e[1]!==l?(n=i=>_(t.slug,l,"read",{path:i}),e[0]=t.slug,e[1]=l,e[2]=n):n=e[2],n}function he(){const l=N.c(2),{org:e}=E();let t;return l[0]!==e.slug?(t=(n,i)=>_(e.slug,n,"read",{path:i}),l[0]=e.slug,l[1]=t):t=l[1],t}function ve(l){const e=N.c(26),{org:t}=E(),n=Fe();let i;e[0]!==t||e[1]!==n||e[2]!==l?(i=()=>{n.invalidateQueries({queryKey:U.orgFsVolume(t.id,l)}),n.invalidateQueries({queryKey:U.orgFsRecent(t.id)})},e[0]=t,e[1]=n,e[2]=l,e[3]=i):i=e[3];const r=i;let a;e[4]!==t||e[5]!==l?(a=async g=>{for(const h of g.files){const $=g.dir?`${g.dir}/${h.name}`:h.name;await R(_(t.slug,l,"file",{path:$}),{method:"PUT",headers:{"content-type":h.type||"application/octet-stream"},body:h})}},e[4]=t,e[5]=l,e[6]=a):a=e[6];let c;e[7]!==r||e[8]!==a?(c={mutationFn:a,onSettled:r},e[7]=r,e[8]=a,e[9]=c):c=e[9];const o=ie(c);let d;e[10]!==t||e[11]!==l?(d=async g=>{await R(_(t.slug,l,"dir",{path:g}),{method:"POST"})},e[10]=t,e[11]=l,e[12]=d):d=e[12];let u;e[13]!==r||e[14]!==d?(u={mutationFn:d,onSuccess:r},e[13]=r,e[14]=d,e[15]=u):u=e[15];const f=ie(u);let m;e[16]!==t||e[17]!==l?(m=async g=>{await R(_(t.slug,l,"file",{path:g}),{method:"DELETE"})},e[16]=t,e[17]=l,e[18]=m):m=e[18];let y;e[19]!==r||e[20]!==m?(y={mutationFn:m,onSuccess:r},e[19]=r,e[20]=m,e[21]=y):y=e[21];const w=ie(y);let p;return e[22]!==f||e[23]!==w||e[24]!==o?(p={upload:o,mkdir:f,remove:w},e[22]=f,e[23]=w,e[24]=o,e[25]=p):p=e[25],p}function gt(l){const e=N.c(33);let t,n,i;e[0]!==l?({glyph:t,readOnly:i,...n}=l,e[0]=l,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);const r=X.useId(),a=`${r}-back`,c=`${r}-front`,o=`url(#${a})`;let d;e[4]!==o?(d=s.jsx("path",{d:"M2.53738 2.55C1.13602 2.55 0 3.68602 0 5.08738V11.535H31.931V7.65326C31.931 6.23616 30.7822 5.08738 29.3651 5.08738H14.7681L13.8775 5.02542C13.3886 4.99141 12.9197 4.81809 12.5261 4.52596L10.7726 3.22419C10.1828 2.78638 9.46784 2.55 8.73334 2.55H2.53738Z",fill:o}),e[4]=o,e[5]=d):d=e[5];const u=`url(#${c})`;let f;e[6]!==u?(f=s.jsx("rect",{y:"8.72",width:"32",height:"21",rx:"2.566",fill:u}),e[6]=u,e[7]=f):f=e[7];let m,y,w;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("rect",{x:"0.3",y:"8.86",width:"31.4",height:"0.55",rx:"0.275",fill:"#FFFFFF",opacity:"0.25"}),y=s.jsx("rect",{y:"25.81",width:"32",height:"0.552",fill:"#84CDFB"}),w=s.jsx("rect",{y:"27.05",width:"32",height:"0.552",fill:"#84CDFB"}),e[8]=m,e[9]=y,e[10]=w):(m=e[8],y=e[9],w=e[10]);let p;e[11]!==t?(p=t&&s.jsx(t,{x:10.5,y:13.2,width:11,height:11,strokeWidth:2.2,style:{color:"#014AC9",opacity:.55}}),e[11]=t,e[12]=p):p=e[12];let g;e[13]!==i?(g=i&&s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"25.5",cy:"25.5",r:"6.2",strokeWidth:"1",className:"fill-background stroke-border"}),s.jsx(Ce,{x:22.1,y:22.1,width:6.8,height:6.8,strokeWidth:2.2,className:"text-muted-foreground"})]}),e[13]=i,e[14]=g):g=e[14];let h,$;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx("stop",{offset:"0.3",stopColor:"#4D87DF"}),$=s.jsx("stop",{offset:"1",stopColor:"#296FE8"}),e[15]=h,e[16]=$):(h=e[15],$=e[16]);let b;e[17]!==a?(b=s.jsxs("linearGradient",{id:a,x1:"15.97",y1:"2.55",x2:"15.97",y2:"9.53",gradientUnits:"userSpaceOnUse",children:[h,$]}),e[17]=a,e[18]=b):b=e[18];let k,x;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("stop",{stopColor:"#72B6FA"}),x=s.jsx("stop",{offset:"1",stopColor:"#5BB1EF"}),e[19]=k,e[20]=x):(k=e[19],x=e[20]);let v;e[21]!==c?(v=s.jsxs("radialGradient",{id:c,cx:"0",cy:"0",r:"10",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(1.6 0 0 2.1538 16 19.22)",children:[k,x]}),e[21]=c,e[22]=v):v=e[22];let F;e[23]!==b||e[24]!==v?(F=s.jsxs("defs",{children:[b,v]}),e[23]=b,e[24]=v,e[25]=F):F=e[25];let S;return e[26]!==n||e[27]!==F||e[28]!==d||e[29]!==f||e[30]!==p||e[31]!==g?(S=s.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...n,children:[d,f,m,y,w,p,g,F]}),e[26]=n,e[27]=F,e[28]=d,e[29]=f,e[30]=p,e[31]=g,e[32]=S):S=e[32],S}function jt(l){const e={};for(const t of l.split(`
1
+ import{e as N,q as E,F as Fe,a as ie,K as U,n as L,b2 as Me,r as X,j as s,B as P,c as Re,E as je,f as Be,d as Ke,z as Ie,o as Q}from"./index-DiLEyBR7.js";import{i as Ve}from"./ChevronRight-9O5_X961.js";import{s as Ce}from"./Eye-ajWxW8TA.js";import{n as Se,i as He}from"./Globe01-BwNaijNv.js";import{s as Qe}from"./Plus-doXHkVHa.js";import{t as Ge}from"./Stars01-oDsL4ack.js";import{i as De}from"./Upload01-8N4jWZ6D.js";import{b as ye,T as we,a as be,u as Xe}from"./tooltip-B0tCRAZt.js";import{A as We,a as Ye,b as Ze,c as Je,d as et,e as tt,f as st,g as lt}from"./alert-dialog-C3vbBKla.js";import{D as re,a as oe,c as ae,b as nt,e as it,d as rt}from"./dialog-SqaK-j71.js";import{I as ot}from"./input-qiotzcFP.js";import{S as W}from"./skeleton-w9s8uxnB.js";import{i as ce}from"./DotsVertical-Dfjgq8zF.js";import{i as Oe}from"./ZoomOut-BCow3TNO.js";import{s as de}from"./Trash01-CNj6fyzQ.js";import{i as ze}from"./Zap-B3tBDVDH.js";import{a as fe,c as Z,b as ue,D as me}from"./dropdown-menu-Cjx6QPBx.js";import{F as G,d as Pe,M as at}from"./file-type-icon-BLDh61vl.js";import{n as ct}from"./LinkExternal01-BAdhV0q5.js";import{f as Ue,a as dt,F as ft}from"./file-preview-B6hUCqWd.js";import"./X-BkK5F0Sb.js";import"./Check-CsP_pvqo.js";function _(l,e,t,n){const i=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(l)}/fs/${encodeURIComponent(e)}/${t}${i?`?${i}`:""}`}async function R(l,e){const t=await fetch(l,e);if(!t.ok){let n="";try{n=(await t.json()).error??""}catch{}throw new Error(n||`HTTP ${t.status}`)}return t}function Te(l,e){const t=N.c(11),{org:n}=E();let i;t[0]!==n.id||t[1]!==e||t[2]!==l?(i=U.orgFsList(n.id,l,e),t[0]=n.id,t[1]=e,t[2]=l,t[3]=i):i=t[3];let r;t[4]!==n.slug||t[5]!==e||t[6]!==l?(r=async()=>(await(await R(_(n.slug,l,"list",{path:e}))).json()).entries.toSorted(ut),t[4]=n.slug,t[5]=e,t[6]=l,t[7]=r):r=t[7];let a;return t[8]!==i||t[9]!==r?(a={queryKey:i,placeholderData:Me,queryFn:r},t[8]=i,t[9]=r,t[10]=a):a=t[10],L(a)}function ut(l,e){return l.kind!==e.kind?l.kind==="dir"?-1:1:l.path.localeCompare(e.path)}function mt(l,e){const t=N.c(12),{org:n}=E();let i;t[0]!==n.id||t[1]!==e||t[2]!==l?(i=U.orgFsStat(n.id,l??"",e),t[0]=n.id,t[1]=e,t[2]=l,t[3]=i):i=t[3];const r=l!==null;let a;t[4]!==n.slug||t[5]!==e||t[6]!==l?(a=async()=>{const o=await fetch(_(n.slug,l??"","stat",{path:e}));if(o.status===404)return null;if(!o.ok)throw new Error(`HTTP ${o.status}`);return(await o.json()).entry},t[4]=n.slug,t[5]=e,t[6]=l,t[7]=a):a=t[7];let c;return t[8]!==i||t[9]!==r||t[10]!==a?(c={queryKey:i,enabled:r,queryFn:a},t[8]=i,t[9]=r,t[10]=a,t[11]=c):c=t[11],L(c)}function ht(l){const e=N.c(9),{org:t}=E();let n;e[0]!==t.id||e[1]!==l?(n=U.orgFsUsage(t.id,l),e[0]=t.id,e[1]=l,e[2]=n):n=e[2];let i;e[3]!==t.slug||e[4]!==l?(i=async()=>await(await R(_(t.slug,l,"usage"))).json(),e[3]=t.slug,e[4]=l,e[5]=i):i=e[5];let r;return e[6]!==n||e[7]!==i?(r={queryKey:n,queryFn:i},e[6]=n,e[7]=i,e[8]=r):r=e[8],L(r)}function xt(l){const e=N.c(8),t=60,{org:n}=E();let i;e[0]!==n.id?(i=U.orgFsRecent(n.id),e[0]=n.id,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==n.slug?(r=async()=>(await(await R(`/api/${encodeURIComponent(n.slug)}/fs/recent?limit=${t}`)).json()).entries,e[2]=t,e[3]=n.slug,e[4]=r):r=e[4];let a;return e[5]!==i||e[6]!==r?(a={queryKey:i,queryFn:r},e[5]=i,e[6]=r,e[7]=a):a=e[7],L(a)}function Ae(){const l=N.c(7),{org:e}=E();let t;l[0]!==e.id?(t=U.orgFsPublicSets(e.id),l[0]=e.id,l[1]=t):t=l[1];let n;l[2]!==e.slug?(n=async()=>(await(await R(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,l[2]=e.slug,l[3]=n):n=l[3];let i;return l[4]!==t||l[5]!==n?(i={queryKey:t,staleTime:3e5,queryFn:n},l[4]=t,l[5]=n,l[6]=i):i=l[6],L(i)}function pt(l){const e=N.c(3),{org:t}=E();let n;return e[0]!==t.slug||e[1]!==l?(n=i=>_(t.slug,l,"read",{path:i}),e[0]=t.slug,e[1]=l,e[2]=n):n=e[2],n}function he(){const l=N.c(2),{org:e}=E();let t;return l[0]!==e.slug?(t=(n,i)=>_(e.slug,n,"read",{path:i}),l[0]=e.slug,l[1]=t):t=l[1],t}function ve(l){const e=N.c(26),{org:t}=E(),n=Fe();let i;e[0]!==t||e[1]!==n||e[2]!==l?(i=()=>{n.invalidateQueries({queryKey:U.orgFsVolume(t.id,l)}),n.invalidateQueries({queryKey:U.orgFsRecent(t.id)})},e[0]=t,e[1]=n,e[2]=l,e[3]=i):i=e[3];const r=i;let a;e[4]!==t||e[5]!==l?(a=async g=>{for(const h of g.files){const $=g.dir?`${g.dir}/${h.name}`:h.name;await R(_(t.slug,l,"file",{path:$}),{method:"PUT",headers:{"content-type":h.type||"application/octet-stream"},body:h})}},e[4]=t,e[5]=l,e[6]=a):a=e[6];let c;e[7]!==r||e[8]!==a?(c={mutationFn:a,onSettled:r},e[7]=r,e[8]=a,e[9]=c):c=e[9];const o=ie(c);let d;e[10]!==t||e[11]!==l?(d=async g=>{await R(_(t.slug,l,"dir",{path:g}),{method:"POST"})},e[10]=t,e[11]=l,e[12]=d):d=e[12];let u;e[13]!==r||e[14]!==d?(u={mutationFn:d,onSuccess:r},e[13]=r,e[14]=d,e[15]=u):u=e[15];const f=ie(u);let m;e[16]!==t||e[17]!==l?(m=async g=>{await R(_(t.slug,l,"file",{path:g}),{method:"DELETE"})},e[16]=t,e[17]=l,e[18]=m):m=e[18];let y;e[19]!==r||e[20]!==m?(y={mutationFn:m,onSuccess:r},e[19]=r,e[20]=m,e[21]=y):y=e[21];const w=ie(y);let p;return e[22]!==f||e[23]!==w||e[24]!==o?(p={upload:o,mkdir:f,remove:w},e[22]=f,e[23]=w,e[24]=o,e[25]=p):p=e[25],p}function gt(l){const e=N.c(33);let t,n,i;e[0]!==l?({glyph:t,readOnly:i,...n}=l,e[0]=l,e[1]=t,e[2]=n,e[3]=i):(t=e[1],n=e[2],i=e[3]);const r=X.useId(),a=`${r}-back`,c=`${r}-front`,o=`url(#${a})`;let d;e[4]!==o?(d=s.jsx("path",{d:"M2.53738 2.55C1.13602 2.55 0 3.68602 0 5.08738V11.535H31.931V7.65326C31.931 6.23616 30.7822 5.08738 29.3651 5.08738H14.7681L13.8775 5.02542C13.3886 4.99141 12.9197 4.81809 12.5261 4.52596L10.7726 3.22419C10.1828 2.78638 9.46784 2.55 8.73334 2.55H2.53738Z",fill:o}),e[4]=o,e[5]=d):d=e[5];const u=`url(#${c})`;let f;e[6]!==u?(f=s.jsx("rect",{y:"8.72",width:"32",height:"21",rx:"2.566",fill:u}),e[6]=u,e[7]=f):f=e[7];let m,y,w;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("rect",{x:"0.3",y:"8.86",width:"31.4",height:"0.55",rx:"0.275",fill:"#FFFFFF",opacity:"0.25"}),y=s.jsx("rect",{y:"25.81",width:"32",height:"0.552",fill:"#84CDFB"}),w=s.jsx("rect",{y:"27.05",width:"32",height:"0.552",fill:"#84CDFB"}),e[8]=m,e[9]=y,e[10]=w):(m=e[8],y=e[9],w=e[10]);let p;e[11]!==t?(p=t&&s.jsx(t,{x:10.5,y:13.2,width:11,height:11,strokeWidth:2.2,style:{color:"#014AC9",opacity:.55}}),e[11]=t,e[12]=p):p=e[12];let g;e[13]!==i?(g=i&&s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"25.5",cy:"25.5",r:"6.2",strokeWidth:"1",className:"fill-background stroke-border"}),s.jsx(Ce,{x:22.1,y:22.1,width:6.8,height:6.8,strokeWidth:2.2,className:"text-muted-foreground"})]}),e[13]=i,e[14]=g):g=e[14];let h,$;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx("stop",{offset:"0.3",stopColor:"#4D87DF"}),$=s.jsx("stop",{offset:"1",stopColor:"#296FE8"}),e[15]=h,e[16]=$):(h=e[15],$=e[16]);let b;e[17]!==a?(b=s.jsxs("linearGradient",{id:a,x1:"15.97",y1:"2.55",x2:"15.97",y2:"9.53",gradientUnits:"userSpaceOnUse",children:[h,$]}),e[17]=a,e[18]=b):b=e[18];let k,x;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("stop",{stopColor:"#72B6FA"}),x=s.jsx("stop",{offset:"1",stopColor:"#5BB1EF"}),e[19]=k,e[20]=x):(k=e[19],x=e[20]);let v;e[21]!==c?(v=s.jsxs("radialGradient",{id:c,cx:"0",cy:"0",r:"10",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(1.6 0 0 2.1538 16 19.22)",children:[k,x]}),e[21]=c,e[22]=v):v=e[22];let F;e[23]!==b||e[24]!==v?(F=s.jsxs("defs",{children:[b,v]}),e[23]=b,e[24]=v,e[25]=F):F=e[25];let S;return e[26]!==n||e[27]!==F||e[28]!==d||e[29]!==f||e[30]!==p||e[31]!==g?(S=s.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...n,children:[d,f,m,y,w,p,g,F]}),e[26]=n,e[27]=F,e[28]=d,e[29]=f,e[30]=p,e[31]=g,e[32]=S):S=e[32],S}function jt(l){const e={};for(const t of l.split(`
2
2
  `)){const n=t.match(/^([A-Za-z][\w-]*):\s*(.*)$/);n?.[1]&&n[2]!==void 0&&(e[n[1].toLowerCase()]=n[2].trim())}return e}function ke(l){for(const e of l.split(/\n\s*\n/)){const t=e.trim();if(!(!t||t.startsWith("#")))return t.replace(/\n/g," ")}return null}function Ee(l){const e=l.match(/^---\n([\s\S]*?)\n---\n?/);if(!e||e[1]===void 0)return{name:null,description:ke(l),body:l};const t=jt(e[1]),n=l.slice(e[0].length);return{name:t.name||null,description:t.description||ke(n),body:n}}const yt=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),wt=new Set(["txt","md","markdown","json","csv","tsv","log","yaml","yml","xml","html","htm"]),bt=256*1024;function ee(l){const e=new Date(l);if(Number.isNaN(e.getTime()))return"";const t=Date.now()-e.getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const i=Math.floor(n/60);if(i<24)return`${i}h ago`;const r=Math.floor(i/24);return r<30?`${r}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function vt(l){return l.split(".").pop()?.toLowerCase()??""}function _e(l){const e=N.c(15),{downloadUrl:t,filename:n,onDelete:i}=l,r=`Actions for ${n}`;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(ce,{size:14}),e[0]=a):a=e[0];let c;e[1]!==r?(c=s.jsx(fe,{asChild:!0,children:s.jsx(P,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:Nt,"aria-label":r,children:a})}),e[1]=r,e[2]=c):c=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Se,{size:14}),e[3]=o):o=e[3];let d;e[4]!==t||e[5]!==n?(d=s.jsx(Z,{asChild:!0,children:s.jsxs("a",{href:t,download:n,children:[o,"Download"]})}),e[4]=t,e[5]=n,e[6]=d):d=e[6];let u;e[7]!==i?(u=i&&s.jsxs(Z,{variant:"destructive",onClick:i,children:[s.jsx(de,{size:14}),"Delete"]}),e[7]=i,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=s.jsxs(ue,{align:"end",onClick:kt,children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let m;return e[12]!==c||e[13]!==f?(m=s.jsxs(me,{children:[c,f]}),e[12]=c,e[13]=f,e[14]=m):m=e[14],m}function kt(l){return l.stopPropagation()}function Nt(l){return l.stopPropagation()}function te(l){const e=N.c(9),{onOpen:t,children:n,className:i}=l;let r;e[0]!==t?(r=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())},e[0]=t,e[1]=r):r=e[1];let a;e[2]!==i?(a=Re("group/card flex cursor-pointer flex-col gap-3 rounded-2xl border border-border bg-background p-4 text-left transition-colors hover:border-border hover:bg-muted/40",i),e[2]=i,e[3]=a):a=e[3];let c;return e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==a?(c=s.jsx("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:r,className:a,children:n}),e[4]=n,e[5]=t,e[6]=r,e[7]=a,e[8]=c):c=e[8],c}function se(l){const e=N.c(16),{icon:t,name:n,meta:i,subtitle:r,actions:a}=l;let c;e[0]!==n?(c=s.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",title:n,children:n}),e[0]=n,e[1]=c):c=e[1];let o;e[2]!==i?(o=i&&s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:i}),e[2]=i,e[3]=o):o=e[3];let d;e[4]!==c||e[5]!==o?(d=s.jsxs("div",{className:"flex items-start gap-3",children:[c,o]}),e[4]=c,e[5]=o,e[6]=d):d=e[6];let u;e[7]!==r?(u=r&&s.jsx("span",{className:"text-xs text-muted-foreground",children:r}),e[7]=r,e[8]=u):u=e[8];let f;e[9]!==d||e[10]!==u?(f=s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[d,u]}),e[9]=d,e[10]=u,e[11]=f):f=e[11];let m;return e[12]!==a||e[13]!==t||e[14]!==f?(m=s.jsxs("div",{className:"flex w-full items-center gap-2.5",children:[t,f,a]}),e[12]=a,e[13]=t,e[14]=f,e[15]=m):m=e[15],m}function le(l){const e=N.c(15),{name:t,meta:n,subtitle:i,glyph:r,readOnly:a,onOpen:c,onDelete:o}=l;let d;e[0]!==r||e[1]!==a?(d=s.jsx(gt,{glyph:r,readOnly:a,className:"size-8 shrink-0"}),e[0]=r,e[1]=a,e[2]=d):d=e[2];let u;e[3]!==t||e[4]!==o?(u=o?s.jsxs(me,{children:[s.jsx(fe,{asChild:!0,children:s.jsx(P,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:Ft,"aria-label":`Actions for ${t}`,children:s.jsx(ce,{size:14})})}),s.jsx(ue,{align:"end",onClick:$t,children:s.jsxs(Z,{variant:"destructive",onClick:o,children:[s.jsx(de,{size:14}),"Delete"]})})]}):void 0,e[3]=t,e[4]=o,e[5]=u):u=e[5];let f;e[6]!==n||e[7]!==t||e[8]!==i||e[9]!==d||e[10]!==u?(f=s.jsx(se,{icon:d,name:t,meta:n,subtitle:i,actions:u}),e[6]=n,e[7]=t,e[8]=i,e[9]=d,e[10]=u,e[11]=f):f=e[11];let m;return e[12]!==c||e[13]!==f?(m=s.jsx(te,{onOpen:c,children:f}),e[12]=c,e[13]=f,e[14]=m):m=e[14],m}function $t(l){return l.stopPropagation()}function Ft(l){return l.stopPropagation()}function qe(l){const e=N.c(19),{filename:t,updatedAt:n,downloadUrl:i,onOpen:r,onDelete:a}=l;let c;e[0]!==t?(c=s.jsx(G,{filename:t,className:"h-8 w-6.5 shrink-0"}),e[0]=t,e[1]=c):c=e[1];let o;e[2]!==n?(o=ee(n),e[2]=n,e[3]=o):o=e[3];let d;e[4]!==t?(d=Pe(t),e[4]=t,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==t||e[8]!==a?(u=s.jsx(_e,{downloadUrl:i,filename:t,onDelete:a}),e[6]=i,e[7]=t,e[8]=a,e[9]=u):u=e[9];let f;e[10]!==t||e[11]!==c||e[12]!==o||e[13]!==d||e[14]!==u?(f=s.jsx(se,{icon:c,name:t,meta:o,subtitle:d,actions:u}),e[10]=t,e[11]=c,e[12]=o,e[13]=d,e[14]=u,e[15]=f):f=e[15];let m;return e[16]!==r||e[17]!==f?(m=s.jsx(te,{onOpen:r,children:f}),e[16]=r,e[17]=f,e[18]=m):m=e[18],m}function Ct(l){const e=N.c(36),{dirName:t,updatedAt:n,skillMdUrl:i,onOpen:r,onBrowse:a,onDelete:c}=l;let o;e[0]!==i?(o=U.fileText(i),e[0]=i,e[1]=o):o=e[1];let d;e[2]!==i?(d=async()=>{const C=await fetch(i,{credentials:"include"});if(!C.ok)throw new Error(`fetch failed: ${C.status}`);return C.text()},e[2]=i,e[3]=d):d=e[3];let u;e[4]!==o||e[5]!==d?(u={queryKey:o,queryFn:d,staleTime:6e4,retry:!1},e[4]=o,e[5]=d,e[6]=u):u=e[6];const{data:f}=L(u);let m;e[7]!==f?(m=f?Ee(f):null,e[7]=f,e[8]=m):m=e[8];const y=m;let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s.jsx(ze,{size:16})}),e[9]=w):w=e[9];const p=y?.name??t;let g;e[10]!==n?(g=ee(n),e[10]=n,e[11]=g):g=e[11];const h=`Actions for ${t}`;let $;e[12]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(ce,{size:14}),e[12]=$):$=e[12];let b;e[13]!==h?(b=s.jsx(fe,{asChild:!0,children:s.jsx(P,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:Dt,"aria-label":h,children:$})}),e[13]=h,e[14]=b):b=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Oe,{size:14}),e[15]=k):k=e[15];let x;e[16]!==a?(x=s.jsxs(Z,{onClick:a,children:[k,"Browse files"]}),e[16]=a,e[17]=x):x=e[17];let v;e[18]!==c?(v=c&&s.jsxs(Z,{variant:"destructive",onClick:c,children:[s.jsx(de,{size:14}),"Delete"]}),e[18]=c,e[19]=v):v=e[19];let F;e[20]!==x||e[21]!==v?(F=s.jsxs(ue,{align:"end",onClick:St,children:[x,v]}),e[20]=x,e[21]=v,e[22]=F):F=e[22];let S;e[23]!==b||e[24]!==F?(S=s.jsxs(me,{children:[b,F]}),e[23]=b,e[24]=F,e[25]=S):S=e[25];let D;e[26]!==S||e[27]!==p||e[28]!==g?(D=s.jsx(se,{icon:w,name:p,meta:g,subtitle:"Skill",actions:S}),e[26]=S,e[27]=p,e[28]=g,e[29]=D):D=e[29];const z=y?.description??"";let O;e[30]!==z?(O=s.jsx("p",{className:"line-clamp-2 min-h-8 text-xs leading-4 text-muted-foreground",children:z}),e[30]=z,e[31]=O):O=e[31];let j;return e[32]!==r||e[33]!==D||e[34]!==O?(j=s.jsxs(te,{onOpen:r,children:[D,O]}),e[32]=r,e[33]=D,e[34]=O,e[35]=j):j=e[35],j}function St(l){return l.stopPropagation()}function Dt(l){return l.stopPropagation()}function Ot(l){const e=N.c(11),{url:t}=l;let n;e[0]!==t?(n=U.fileText(t),e[0]=t,e[1]=n):n=e[1];let i;e[2]!==t?(i=async()=>{const d=await fetch(t,{credentials:"include"});if(!d.ok)throw new Error(`fetch failed: ${d.status}`);return d.text()},e[2]=t,e[3]=i):i=e[3];let r;e[4]!==n||e[5]!==i?(r={queryKey:n,queryFn:i,staleTime:6e4,retry:!1},e[4]=n,e[5]=i,e[6]=r):r=e[6];const{data:a}=L(r);if(!a)return null;let c;e[7]!==a?(c=a.slice(0,2e3),e[7]=a,e[8]=c):c=e[8];let o;return e[9]!==c?(o=s.jsx("pre",{className:"pointer-events-none h-full w-full overflow-hidden bg-background p-3 font-mono text-[9px] leading-[1.5] text-muted-foreground select-none",children:c}),e[9]=c,e[10]=o):o=e[10],o}function zt(l){const e=N.c(4),{filename:t,size:n,downloadUrl:i}=l;let r;if(e[0]!==i||e[1]!==t||e[2]!==n){const a=vt(t),c=yt.has(a)?s.jsx("img",{src:i,alt:"",loading:"lazy",className:"h-full w-full object-cover"}):wt.has(a)&&n<=bt?s.jsx(Ot,{url:i}):s.jsx("div",{className:"flex h-full w-full items-center justify-center",children:s.jsx(G,{filename:t,className:"h-14 w-11 opacity-60"})});r=s.jsx("div",{className:"aspect-[400/265] w-full overflow-hidden rounded-lg border border-border/60 bg-muted/30",children:c}),e[0]=i,e[1]=t,e[2]=n,e[3]=r}else r=e[3];return r}function Pt(l){const e=N.c(24),t=l.onOpen;let n;e[0]!==l.filename?(n=s.jsx(G,{filename:l.filename,className:"h-8 w-6.5 shrink-0"}),e[0]=l.filename,e[1]=n):n=e[1];const i=l.filename;let r;e[2]!==l.updatedAt?(r=ee(l.updatedAt),e[2]=l.updatedAt,e[3]=r):r=e[3];let a;e[4]!==l.filename?(a=Pe(l.filename),e[4]=l.filename,e[5]=a):a=e[5];let c;e[6]!==l.downloadUrl||e[7]!==l.filename||e[8]!==l.onDelete?(c=s.jsx(_e,{downloadUrl:l.downloadUrl,filename:l.filename,onDelete:l.onDelete}),e[6]=l.downloadUrl,e[7]=l.filename,e[8]=l.onDelete,e[9]=c):c=e[9];let o;e[10]!==l.filename||e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==c?(o=s.jsx(se,{icon:n,name:i,meta:r,subtitle:a,actions:c}),e[10]=l.filename,e[11]=n,e[12]=r,e[13]=a,e[14]=c,e[15]=o):o=e[15];let d;e[16]!==l.downloadUrl||e[17]!==l.filename||e[18]!==l.size?(d=s.jsx(zt,{filename:l.filename,size:l.size,downloadUrl:l.downloadUrl}),e[16]=l.downloadUrl,e[17]=l.filename,e[18]=l.size,e[19]=d):d=e[19];let u;return e[20]!==l.onOpen||e[21]!==o||e[22]!==d?(u=s.jsxs(te,{onOpen:t,children:[o,d]}),e[20]=l.onOpen,e[21]=o,e[22]=d,e[23]=u):u=e[23],u}function xe(l){const e=l?l.split("/").filter(Boolean):[],t=e[0]==="public",n=t?e[1]??null:null,i=t?n?`public-${n}`:null:e[0]??null,r=(t?e.slice(2):e.slice(1)).join("/");return{segments:e,volume:i,dirPath:r,isPublic:t,publicSet:n,readOnly:t}}function Y(l,e){return l.isPublic&&l.publicSet?`public/${l.publicSet}/${e}`:l.volume?`${l.volume}/${e}`:e}function T(l){const e=l.lastIndexOf("/");return e===-1?l:l.slice(e+1)}function Ut(l){const e=N.c(48),{previewPath:t,onClose:n}=l;let i;e[0]!==t?(i=xe(t),e[0]=t,e[1]=i):i=e[1];const r=i,{volume:a,dirPath:c}=r,{data:o,isPending:d}=mt(a,c),u=pt(a??"");let f,m,y,w,p,g,h,$,b,k,x,v;e[2]!==u||e[3]!==o||e[4]!==c||e[5]!==n||e[6]!==t?(w=T(c),y=o&&o.kind==="file"?{key:t,filename:w,size:o.size,downloadUrl:u(o.path)}:null,m=re,x=!0,e[19]!==n?(v=C=>{C||n()},e[19]=n,e[20]=v):v=e[20],f=oe,k="flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",b="flex h-11 shrink-0 items-center gap-1 border-b border-border/60 py-1 pr-12 pl-2",p="flex min-w-0 flex-1 items-center gap-2 px-2",g=s.jsx(G,{filename:w,className:"h-4.5 w-3.5 shrink-0"}),e[21]!==w?(h=s.jsx(ae,{className:"truncate text-xs font-medium text-foreground",children:w}),e[21]=w,e[22]=h):h=e[22],$=y&&s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Ue(y.size)}),e[2]=u,e[3]=o,e[4]=c,e[5]=n,e[6]=t,e[7]=f,e[8]=m,e[9]=y,e[10]=w,e[11]=p,e[12]=g,e[13]=h,e[14]=$,e[15]=b,e[16]=k,e[17]=x,e[18]=v):(f=e[7],m=e[8],y=e[9],w=e[10],p=e[11],g=e[12],h=e[13],$=e[14],b=e[15],k=e[16],x=e[17],v=e[18]);let F;e[23]!==p||e[24]!==g||e[25]!==h||e[26]!==$?(F=s.jsxs("div",{className:p,children:[g,h,$]}),e[23]=p,e[24]=g,e[25]=h,e[26]=$,e[27]=F):F=e[27];let S;e[28]!==y?(S=y&&s.jsxs(s.Fragment,{children:[s.jsxs(ye,{children:[s.jsx(we,{asChild:!0,children:s.jsx(P,{variant:"ghost",size:"icon",asChild:!0,children:s.jsx("a",{href:y.downloadUrl,download:y.filename,children:s.jsx(Se,{size:14})})})}),s.jsx(be,{side:"bottom",children:"Download"})]}),s.jsxs(ye,{children:[s.jsx(we,{asChild:!0,children:s.jsx(P,{variant:"ghost",size:"icon",onClick:()=>window.open(y.downloadUrl,"_blank","noopener"),children:s.jsx(ct,{size:14})})}),s.jsx(be,{side:"bottom",children:"Open in new tab"})]})]}),e[28]=y,e[29]=S):S=e[29];let D;e[30]!==F||e[31]!==S||e[32]!==b?(D=s.jsxs("div",{className:b,children:[F,S]}),e[30]=F,e[31]=S,e[32]=b,e[33]=D):D=e[33];let z;e[34]!==y||e[35]!==w||e[36]!==d?(z=s.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:y?s.jsx(dt,{file:y}):d?s.jsx(ft,{}):s.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[s.jsx(G,{filename:w,className:"h-7.5 w-6"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."})]})}),e[34]=y,e[35]=w,e[36]=d,e[37]=z):z=e[37];let O;e[38]!==f||e[39]!==D||e[40]!==z||e[41]!==k?(O=s.jsxs(f,{className:k,children:[D,z]}),e[38]=f,e[39]=D,e[40]=z,e[41]=k,e[42]=O):O=e[42];let j;return e[43]!==m||e[44]!==O||e[45]!==x||e[46]!==v?(j=s.jsx(m,{open:x,onOpenChange:v,children:O}),e[43]=m,e[44]=O,e[45]=x,e[46]=v,e[47]=j):j=e[47],j}function Tt(l){const e=N.c(37),{skillPath:t,onClose:n,onOpenFile:i,onBrowse:r}=l,a=xe(t),{volume:c,dirPath:o}=a,u=he()(c??"",`${o}/SKILL.md`),f=L({queryKey:U.fileText(u),queryFn:async()=>{const A=await fetch(u,{credentials:"include"});if(!A.ok)throw new Error(`fetch failed: ${A.status}`);return A.text()},staleTime:6e4,retry:!1}),m=Te(c??"",o);let y;e[0]!==o?(y=T(o),e[0]=o,e[1]=y):y=e[1];const w=y;let p;e[2]!==f.data?(p=f.data?Ee(f.data):null,e[2]=f.data,e[3]=p):p=e[3];const g=p,h=(m.data??[]).filter(At),$=re,b=!0;let k;e[4]!==n?(k=A=>{A||n()},e[4]=n,e[5]=k):k=e[5];const x=oe,v="flex h-[85vh] w-[92vw] flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl!";let F;e[6]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:s.jsx(ze,{size:20})}),e[6]=F):F=e[6];const S=g?.name??w;let D;e[7]!==S?(D=s.jsx(ae,{className:"truncate text-sm font-medium text-foreground",children:S}),e[7]=S,e[8]=D):D=e[8];const z=g?.description??"Claude Code skill";let O;e[9]!==z?(O=s.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:z}),e[9]=z,e[10]=O):O=e[10];let j;e[11]!==O||e[12]!==D?(j=s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[D,O]}),e[11]=O,e[12]=D,e[13]=j):j=e[13];let C;e[14]!==r||e[15]!==t?(C=()=>r(t),e[14]=r,e[15]=t,e[16]=C):C=e[16];let B;e[17]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(Oe,{size:14}),e[17]=B):B=e[17];let K;e[18]!==C?(K=s.jsxs(P,{variant:"outline",size:"sm",className:"shrink-0",onClick:C,children:[B,"Browse files"]}),e[18]=C,e[19]=K):K=e[19];let I;e[20]!==j||e[21]!==K?(I=s.jsxs("div",{className:"flex shrink-0 items-start gap-3 border-b border-border/60 py-4 pr-12 pl-5",children:[F,j,K]}),e[20]=j,e[21]=K,e[22]=I):I=e[22];let V;e[23]!==f.isError||e[24]!==f.isPending||e[25]!==g||e[26]!==t?(V=s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:f.isPending?s.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[s.jsx(W,{className:"h-5 w-1/2"}),s.jsx(W,{className:"h-3 w-full"}),s.jsx(W,{className:"h-3 w-5/6"}),s.jsx(W,{className:"h-3 w-2/3"})]}):f.isError||!g?s.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):s.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-6 py-5",children:s.jsx(at,{id:`skill-preview-${t}`,text:g.body})})}),e[23]=f.isError,e[24]=f.isPending,e[25]=g,e[26]=t,e[27]=V):V=e[27];const ne=h.length>0&&s.jsxs("div",{className:"flex max-h-44 shrink-0 flex-col gap-1 overflow-y-auto border-t border-border/60 px-3 py-2.5",children:[s.jsx("p",{className:"px-2 text-xs text-muted-foreground",children:"Files in this skill"}),h.map(A=>s.jsxs("button",{type:"button",onClick:()=>i(Y(a,A.path)),className:"flex items-center gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-muted/60",children:[s.jsx(G,{filename:T(A.path),className:"h-5 w-4 shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",children:T(A.path)}),s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Ue(A.size)})]},A.path))]});let H;e[28]!==x||e[29]!==I||e[30]!==V||e[31]!==ne?(H=s.jsxs(x,{className:v,children:[I,V,ne]}),e[28]=x,e[29]=I,e[30]=V,e[31]=ne,e[32]=H):H=e[32];let J;return e[33]!==$||e[34]!==H||e[35]!==k?(J=s.jsx($,{open:b,onOpenChange:k,children:H}),e[33]=$,e[34]=H,e[35]=k,e[36]=J):J=e[36],J}function At(l){return l.kind==="file"&&T(l.path)!=="SKILL.md"}const Le=[{id:"uploads",description:"Files your team uploads",glyph:De},{id:"outputs",description:"Agent run outputs",glyph:Ge}],Ne=3;function M(l){const e=N.c(2),{children:t}=l;let n;return e[0]!==t?(n=s.jsx("p",{className:"text-[13px] text-foreground",children:t}),e[0]=t,e[1]=n):n=e[1],n}function q(l){const e=N.c(2),{children:t}=l;let n;return e[0]!==t?(n=s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t}),e[0]=t,e[1]=n):n=e[1],n}function pe(l){const e=N.c(2),{rows:t}=l,n=t===void 0?1:t;let i;return e[0]!==n?(i=s.jsx(q,{children:Array.from({length:n*3},Et)}),e[0]=n,e[1]=i):i=e[1],i}function Et(l,e){return s.jsx(W,{className:"h-16 rounded-2xl"},e)}function ge(l){const e=N.c(2),{children:t}=l;let n;return e[0]!==t?(n=s.jsx("p",{className:"text-sm text-muted-foreground",children:t}),e[0]=t,e[1]=n):n=e[1],n}function _t(){const l=N.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(P,{variant:"secondary",size:"sm",className:"h-7 px-2.5 text-xs",children:"All"}),s.jsx(P,{variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs",disabled:!0,title:"Coming soon",children:"Shared"}),s.jsx(P,{variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs",disabled:!0,title:"Coming soon",children:"Private"})]}),l[0]=e):e=l[0],e}function qt(l){const e=N.c(6),{volume:t,description:n,glyph:i,onOpen:r}=l,a=ht(t),c=a.data?`${a.data.files} files`:void 0;let o;return e[0]!==n||e[1]!==i||e[2]!==r||e[3]!==c||e[4]!==t?(o=s.jsx(le,{name:t,meta:c,subtitle:n,glyph:i,onOpen:r}),e[0]=n,e[1]=i,e[2]=r,e[3]=c,e[4]=t,e[5]=o):o=e[5],o}function Lt(l){const e=N.c(8),{segments:t,onNavigate:n}=l;let i;e[0]!==n?(i=s.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(""),children:"Library"}),e[0]=n,e[1]=i):i=e[1];let r;e[2]!==n||e[3]!==t?(r=t.map((c,o)=>{const d=t.slice(0,o+1).join("/"),u=o===t.length-1;return s.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[s.jsx(Ve,{size:12,className:"shrink-0 text-muted-foreground"}),u?s.jsx("span",{className:"truncate font-medium text-foreground",children:c}):s.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>n(d),children:c})]},d)}),e[2]=n,e[3]=t,e[4]=r):r=e[4];let a;return e[5]!==i||e[6]!==r?(a=s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[i,r]}),e[5]=i,e[6]=r,e[7]=a):a=e[7],a}function Mt(l){const e=N.c(18),{onOpenDir:t,onOpenFile:n,onDelete:i}=l,r=xt(),a=Ae(),c=he();let o;if(e[0]!==c||e[1]!==i||e[2]!==t||e[3]!==n||e[4]!==a.data?.length||e[5]!==r.data||e[6]!==r.isPending){const d=r.data??[],u=d.slice(0,Ne),f=d.slice(Ne);let m,y;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(M,{children:"Folders"}),y=s.jsx(_t,{}),e[8]=m,e[9]=y):(m=e[8],y=e[9]);let w;e[10]!==t?(w=Le.map(h=>s.jsx(qt,{volume:h.id,description:h.description,glyph:h.glyph,onOpen:()=>t(h.id)},h.id)),e[10]=t,e[11]=w):w=e[11];let p;e[12]!==t||e[13]!==a.data?.length?(p=(a.data?.length??0)>0&&s.jsx(le,{name:"public",meta:`${a.data?.length} sets`,subtitle:"Curated skill sets — read-only",glyph:He,readOnly:!0,onOpen:()=>t("public")}),e[12]=t,e[13]=a.data?.length,e[14]=p):p=e[14];let g;e[15]!==w||e[16]!==p?(g=s.jsxs("div",{className:"flex flex-col gap-3",children:[m,y,s.jsxs(q,{children:[w,p]})]}),e[15]=w,e[16]=p,e[17]=g):g=e[17],o=s.jsxs(s.Fragment,{children:[r.isPending?s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(M,{children:"Recently added"}),s.jsx(pe,{})]}):u.length>0?s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(M,{children:"Recently added"}),s.jsx(q,{children:u.map(h=>s.jsx(Pt,{filename:T(h.path),updatedAt:h.updatedAt,size:h.size,downloadUrl:c(h.volume,h.path),onOpen:()=>n(`${h.volume}/${h.path}`),onDelete:()=>i({volume:h.volume,path:h.path,kind:"file"})},`${h.volume}/${h.path}`))})]}):s.jsx(ge,{children:"No files yet — upload one, or ask an agent to produce something."}),g,f.length>0&&s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(M,{children:"All files"}),s.jsx(q,{children:f.map(h=>s.jsx(qe,{filename:T(h.path),updatedAt:h.updatedAt,downloadUrl:c(h.volume,h.path),onOpen:()=>n(`${h.volume}/${h.path}`),onDelete:()=>i({volume:h.volume,path:h.path,kind:"file"})},`${h.volume}/${h.path}`))})]})]}),e[0]=c,e[1]=i,e[2]=t,e[3]=n,e[4]=a.data?.length,e[5]=r.data,e[6]=r.isPending,e[7]=o}else o=e[7];return o}function Rt(l){const e=N.c(11),{onOpenDir:t}=l,n=Ae();if(n.isPending){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(pe,{}),e[0]=o):o=e[0],o}let i;e[1]!==n.data?(i=n.data??[],e[1]=n.data,e[2]=i):i=e[2];const r=i;if(r.length===0){let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ge,{children:"No public skill sets are configured."}),e[3]=o):o=e[3],o}let a;if(e[4]!==t||e[5]!==r){let o;e[7]!==t?(o=d=>s.jsx(le,{name:d,subtitle:"Read-only",readOnly:!0,onOpen:()=>t(`public/${d}`)},d),e[7]=t,e[8]=o):o=e[8],a=r.map(o),e[4]=t,e[5]=r,e[6]=a}else a=e[6];let c;return e[9]!==a?(c=s.jsx(q,{children:a}),e[9]=a,e[10]=c):c=e[10],c}function Bt(l){const e=N.c(25),{location:t,onOpenDir:n,onOpenFile:i,onOpenSkill:r,onDelete:a}=l,c=t.volume??"",o=Te(c,t.dirPath),d=he();if(o.isPending){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(pe,{rows:2}),e[0]=p):p=e[0],p}if(o.isError){const p=o.error instanceof Error?o.error.message:"Failed to load";let g;return e[1]!==p?(g=s.jsx("p",{className:"text-sm text-destructive",children:p}),e[1]=p,e[2]=g):g=e[2],g}let u,f,m,y;if(e[3]!==d||e[4]!==o.data||e[5]!==t||e[6]!==a||e[7]!==n||e[8]!==i||e[9]!==r||e[10]!==c){y=Symbol.for("react.early_return_sentinel");e:{const p=o.data??[],g=p.filter(Vt),h=p.filter(It),$=p.filter(Kt);if(p.length===0){const x=t.readOnly?"Empty — this read-only set syncs from its GitHub source.":"Empty folder — upload a file or create a folder to get started.";let v;e[15]!==x?(v=s.jsx(ge,{children:x}),e[15]=x,e[16]=v):v=e[16],y=v;break e}let b;e[17]!==t.readOnly||e[18]!==a||e[19]!==c?(b=x=>t.readOnly?void 0:()=>a({volume:c,path:x.path,kind:x.kind}),e[17]=t.readOnly,e[18]=a,e[19]=c,e[20]=b):b=e[20];const k=b;u=g.length>0&&s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(M,{children:"Skills"}),s.jsx(q,{children:g.map(x=>s.jsx(Ct,{dirName:T(x.path),updatedAt:x.updatedAt,skillMdUrl:d(c,`${x.path}/SKILL.md`),onOpen:()=>r(Y(t,x.path)),onBrowse:()=>n(Y(t,x.path)),onDelete:k(x)},x.path))})]}),f=h.length>0&&s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(M,{children:"Folders"}),s.jsx(q,{children:h.map(x=>s.jsx(le,{name:T(x.path),meta:ee(x.updatedAt),readOnly:t.readOnly,onOpen:()=>n(Y(t,x.path)),onDelete:k(x)},x.path))})]}),m=$.length>0&&s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(M,{children:"Files"}),s.jsx(q,{children:$.map(x=>s.jsx(qe,{filename:T(x.path),updatedAt:x.updatedAt,downloadUrl:d(c,x.path),onOpen:()=>i(Y(t,x.path)),onDelete:k(x)},x.path))})]})}e[3]=d,e[4]=o.data,e[5]=t,e[6]=a,e[7]=n,e[8]=i,e[9]=r,e[10]=c,e[11]=u,e[12]=f,e[13]=m,e[14]=y}else u=e[11],f=e[12],m=e[13],y=e[14];if(y!==Symbol.for("react.early_return_sentinel"))return y;let w;return e[21]!==u||e[22]!==f||e[23]!==m?(w=s.jsxs(s.Fragment,{children:[u,f,m]}),e[21]=u,e[22]=f,e[23]=m,e[24]=w):w=e[24],w}function Kt(l){return l.kind==="file"}function It(l){return l.kind==="dir"&&!l.hasSkill}function Vt(l){return l.kind==="dir"&&l.hasSkill}function $e(){const{org:l}=E(),e=Fe(),t=Be(),n=Ke({strict:!1}),i=n.path??"",r=xe(i),a=r.segments.length===0,c=(j,C)=>t({to:".",search:B=>({...B,[j]:C||void 0})}),o=j=>c("path",j),d=j=>c("preview",j),u=j=>c("skill",j),f=j=>t({to:".",search:C=>({...C,path:j,skill:void 0})}),[m,y]=X.useState(null),[w,p]=X.useState(!1),[g,h]=X.useState(""),$=X.useRef(null),b=r.readOnly?null:r.volume??"uploads",k=r.volume?r.dirPath:"",{upload:x,mkdir:v}=ve(b??"uploads"),{remove:F}=ve(m?.volume??"uploads");async function S(j){if(!(!b||!j||j.length===0))try{await x.mutateAsync({dir:k,files:[...j]}),Q.success(j.length===1?`Uploaded ${j[0]?.name}`:`Uploaded ${j.length} files`)}catch(C){Q.error(C instanceof Error?C.message:"Upload failed")}finally{$.current&&($.current.value="")}}async function D(){const j=g.trim();if(!(!b||!j))try{await v.mutateAsync(k?`${k}/${j}`:j),Q.success(`Folder "${j}" created`),p(!1),h("")}catch(C){Q.error(C instanceof Error?C.message:"Failed to create folder")}}async function z(){if(!m)return;const j=m;try{await F.mutateAsync(j.path),Q.success(`Deleted ${T(j.path)}`)}catch(C){Q.error(C instanceof Error?C.message:"Delete failed")}finally{y(null)}}function O(){for(const j of Le)e.invalidateQueries({queryKey:U.orgFsVolume(l.id,j.id)});r.volume&&e.invalidateQueries({queryKey:U.orgFsVolume(l.id,r.volume)}),e.invalidateQueries({queryKey:U.orgFsRecent(l.id)}),e.invalidateQueries({queryKey:U.orgFsPublicSets(l.id)})}return s.jsxs("div",{className:"h-full overflow-y-auto",children:[s.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[s.jsxs("div",{className:"flex flex-col gap-2",children:[!a&&s.jsx(Lt,{segments:r.segments,onNavigate:o}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h1",{className:"min-w-0 flex-1 truncate text-xl font-medium text-foreground",children:a?"Library":r.segments.at(-1)??"Library"}),s.jsx(P,{variant:"ghost",size:"icon",onClick:O,"aria-label":"Refresh",children:s.jsx(Ie,{size:14})}),!a&&b&&s.jsxs(P,{variant:"outline",size:"sm",onClick:()=>p(!0),children:[s.jsx(Qe,{size:14}),"New folder"]}),r.readOnly?s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(Ce,{size:12}),"Read-only"]}):s.jsxs(P,{size:"sm",disabled:x.isPending,onClick:()=>$.current?.click(),children:[s.jsx(De,{size:14}),x.isPending?"Uploading…":"Upload file"]}),s.jsx("input",{ref:$,type:"file",multiple:!0,className:"hidden",onChange:j=>{S(j.target.files)}})]})]}),a?s.jsx(Mt,{onOpenDir:o,onOpenFile:d,onDelete:y}):r.volume===null?s.jsx(Rt,{onOpenDir:o}):s.jsx(Bt,{location:r,onOpenDir:o,onOpenFile:d,onOpenSkill:u,onDelete:y},r.volume)]}),n.preview?s.jsx(Ut,{previewPath:n.preview,onClose:()=>c("preview",null)}):n.skill?s.jsx(Tt,{skillPath:n.skill,onClose:()=>c("skill",null),onOpenFile:d,onBrowse:f}):null,s.jsx(re,{open:w,onOpenChange:p,children:s.jsxs(oe,{children:[s.jsxs(nt,{children:[s.jsx(ae,{children:"New folder"}),s.jsxs(it,{children:["Create a folder in ",i||"the library","."]})]}),s.jsx(ot,{autoFocus:!0,placeholder:"folder-name",value:g,onChange:j=>h(j.target.value),onKeyDown:j=>{j.key==="Enter"&&D()}}),s.jsxs(rt,{children:[s.jsx(P,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),s.jsx(P,{disabled:!g.trim()||v.isPending,onClick:()=>{D()},children:"Create"})]})]})}),s.jsx(We,{open:m!==null,onOpenChange:j=>{j||y(null)},children:s.jsxs(Ye,{children:[s.jsxs(Ze,{children:[s.jsxs(Je,{children:["Delete ",m?T(m.path):"","?"]}),s.jsx(et,{children:m?.kind==="dir"?"The folder and everything inside it will be deleted for the whole organization. Sandboxes see this change within seconds.":"The file will be deleted for the whole organization. Sandboxes see this change within seconds."})]}),s.jsxs(tt,{children:[s.jsx(st,{children:"Cancel"}),s.jsx(lt,{onClick:()=>{z()},children:"Delete"})]})]})})]})}function hs(){const l=N.c(2);if(Xe()){let n;return l[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:s.jsx(je,{children:s.jsx($e,{})})}),l[0]=n):n=l[0],n}let t;return l[1]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("div",{className:"min-h-0 flex-1 pt-0 pr-1 pb-1 pl-0",children:s.jsx("div",{className:"h-full p-0.5 pt-0.25",children:s.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:s.jsx(je,{children:s.jsx($e,{})})})})}),l[1]=t):t=l[1],t}export{hs as default};
@@ -1 +1 @@
1
- import{bv as _}from"./index-CHwrxx2w.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
1
+ import{bv as _}from"./index-DiLEyBR7.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
@@ -1 +1 @@
1
- import{e as f,c as d,r as p,j as r}from"./index-CHwrxx2w.js";import{m as w}from"./sidebar-dkkCYhm2.js";const v=p.createContext(void 0),H=v.Provider;function N(c,e){const l=p.Children.toArray(c);for(const i of l)if(p.isValidElement(i)&&i.type===e)return i;return null}function P(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex flex-col h-full w-full bg-background overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function C(c){const e=f.c(17),{children:l,className:i,hideSidebarTrigger:s}=c;let t;e[0]!==l?(t=N(l,j),e[0]=l,e[1]=t):t=e[1];const n=t;let a;e[2]!==l?(a=N(l,b),e[2]=l,e[3]=a):a=e[3];const o=a;let m;e[4]!==i?(m=d("shrink-0 w-full border-b border-border/50 h-11","flex items-center justify-between gap-3 pr-2 pl-2 md:pl-4",i),e[4]=i,e[5]=m):m=e[5];let x;e[6]!==s?(x=!s&&r.jsx(w,{className:"md:hidden shrink-0"}),e[6]=s,e[7]=x):x=e[7];let u;e[8]!==n||e[9]!==x?(u=r.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[x,n]}),e[8]=n,e[9]=x,e[10]=u):u=e[10];let h;e[11]!==o?(h=r.jsx("div",{className:"flex items-center",children:o}),e[11]=o,e[12]=h):h=e[12];let g;return e[13]!==m||e[14]!==u||e[15]!==h?(g=r.jsxs("div",{className:m,children:[u,h]}),e[13]=m,e[14]=u,e[15]=h,e[16]=g):g=e[16],g}function j(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 min-w-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function b(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 shrink-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function $(c){const e=f.c(6),{children:l,className:i}=c,s=p.useContext(v);let t;e[0]!==i||e[1]!==s?(t=d("flex-1 overflow-auto",s,i),e[0]=i,e[1]=s,e[2]=t):t=e[2];let n;return e[3]!==l||e[4]!==t?(n=r.jsx("div",{className:t,children:l}),e[3]=l,e[4]=t,e[5]=n):n=e[5],n}function y(c){const e=f.c(10),{children:l,actions:i,className:s}=c;let t;e[0]!==s?(t=d("flex flex-wrap items-center justify-between gap-3",s),e[0]=s,e[1]=t):t=e[1];let n;e[2]!==l?(n=r.jsx("div",{className:"text-xl font-medium min-w-0",children:l}),e[2]=l,e[3]=n):n=e[3];let a;e[4]!==i?(a=i&&r.jsx("div",{className:"flex items-center gap-2",children:i}),e[4]=i,e[5]=a):a=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==a?(o=r.jsxs("div",{className:t,children:[n,a]}),e[6]=t,e[7]=n,e[8]=a,e[9]=o):o=e[9],o}function R(c){const e=f.c(6),{children:l,className:i,maxWidth:s}=c,t=s===void 0?"max-w-[1200px]":s;let n;e[0]!==i||e[1]!==t?(n=d("mx-auto w-full px-4 pt-8 pb-6 md:px-10 md:pt-12 md:pb-10",t,i),e[0]=i,e[1]=t,e[2]=n):n=e[2];let a;return e[3]!==l||e[4]!==n?(a=r.jsx("div",{className:n,children:l}),e[3]=l,e[4]=n,e[5]=a):a=e[5],a}const T=Object.assign(P,{Header:Object.assign(C,{Left:j,Right:b}),Content:$,Title:y,Body:R});export{T as P,H as a};
1
+ import{e as f,c as d,r as p,j as r}from"./index-DiLEyBR7.js";import{m as w}from"./sidebar-BIPju_nM.js";const v=p.createContext(void 0),H=v.Provider;function N(c,e){const l=p.Children.toArray(c);for(const i of l)if(p.isValidElement(i)&&i.type===e)return i;return null}function P(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex flex-col h-full w-full bg-background overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function C(c){const e=f.c(17),{children:l,className:i,hideSidebarTrigger:s}=c;let t;e[0]!==l?(t=N(l,j),e[0]=l,e[1]=t):t=e[1];const n=t;let a;e[2]!==l?(a=N(l,b),e[2]=l,e[3]=a):a=e[3];const o=a;let m;e[4]!==i?(m=d("shrink-0 w-full border-b border-border/50 h-11","flex items-center justify-between gap-3 pr-2 pl-2 md:pl-4",i),e[4]=i,e[5]=m):m=e[5];let x;e[6]!==s?(x=!s&&r.jsx(w,{className:"md:hidden shrink-0"}),e[6]=s,e[7]=x):x=e[7];let u;e[8]!==n||e[9]!==x?(u=r.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[x,n]}),e[8]=n,e[9]=x,e[10]=u):u=e[10];let h;e[11]!==o?(h=r.jsx("div",{className:"flex items-center",children:o}),e[11]=o,e[12]=h):h=e[12];let g;return e[13]!==m||e[14]!==u||e[15]!==h?(g=r.jsxs("div",{className:m,children:[u,h]}),e[13]=m,e[14]=u,e[15]=h,e[16]=g):g=e[16],g}function j(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 min-w-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function b(c){const e=f.c(5),{children:l,className:i}=c;let s;e[0]!==i?(s=d("flex items-center gap-2 shrink-0 overflow-hidden",i),e[0]=i,e[1]=s):s=e[1];let t;return e[2]!==l||e[3]!==s?(t=r.jsx("div",{className:s,children:l}),e[2]=l,e[3]=s,e[4]=t):t=e[4],t}function $(c){const e=f.c(6),{children:l,className:i}=c,s=p.useContext(v);let t;e[0]!==i||e[1]!==s?(t=d("flex-1 overflow-auto",s,i),e[0]=i,e[1]=s,e[2]=t):t=e[2];let n;return e[3]!==l||e[4]!==t?(n=r.jsx("div",{className:t,children:l}),e[3]=l,e[4]=t,e[5]=n):n=e[5],n}function y(c){const e=f.c(10),{children:l,actions:i,className:s}=c;let t;e[0]!==s?(t=d("flex flex-wrap items-center justify-between gap-3",s),e[0]=s,e[1]=t):t=e[1];let n;e[2]!==l?(n=r.jsx("div",{className:"text-xl font-medium min-w-0",children:l}),e[2]=l,e[3]=n):n=e[3];let a;e[4]!==i?(a=i&&r.jsx("div",{className:"flex items-center gap-2",children:i}),e[4]=i,e[5]=a):a=e[5];let o;return e[6]!==t||e[7]!==n||e[8]!==a?(o=r.jsxs("div",{className:t,children:[n,a]}),e[6]=t,e[7]=n,e[8]=a,e[9]=o):o=e[9],o}function R(c){const e=f.c(6),{children:l,className:i,maxWidth:s}=c,t=s===void 0?"max-w-[1200px]":s;let n;e[0]!==i||e[1]!==t?(n=d("mx-auto w-full px-4 pt-8 pb-6 md:px-10 md:pt-12 md:pb-10",t,i),e[0]=i,e[1]=t,e[2]=n):n=e[2];let a;return e[3]!==l||e[4]!==n?(a=r.jsx("div",{className:n,children:l}),e[3]=l,e[4]=n,e[5]=a):a=e[5],a}const T=Object.assign(P,{Header:Object.assign(C,{Left:j,Right:b}),Content:$,Title:y,Body:R});export{T as P,H as a};
@@ -1 +1 @@
1
- import{r as n,bd as q,cn as R,co as Ee,cp as ke,cq as Se,bx as xe,cr as j}from"./index-CHwrxx2w.js";var de=1,Ie=.9,Ce=.8,Re=.17,Q=.1,Z=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Z,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Z,I.length))):(h*=Re,u>0&&(h*=Math.pow(Z,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Q&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Q>h&&(h=x*Q)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:U=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")J(),W(),w(1,G);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{J(),W(),r.current.value||G(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{J(),s?.getAttribute("id")===e&&G(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function G(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function J(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function X(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function Y(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):Y(e)}let ie=()=>X(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):Y(1)},ce=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?ue(-1):Y(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),X(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Je},b),z(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;U(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function U(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:U,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),z(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},z(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),ze=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),Ue=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},z(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ye=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:ze,Empty:Ue,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function z({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ye as _};
1
+ import{r as n,bd as q,cn as R,co as Ee,cp as ke,cq as Se,bx as xe,cr as j}from"./index-DiLEyBR7.js";var de=1,Ie=.9,Ce=.8,Re=.17,Q=.1,Z=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Z,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Z,I.length))):(h*=Re,u>0&&(h*=Math.pow(Z,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Q&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Q>h&&(h=x*Q)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:U=!1,vimBindings:A=!0,...O}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")J(),W(),w(1,G);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{J(),W(),r.current.value||G(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{J(),s?.getAttribute("id")===e&&G(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),B=m.getAttribute("id");return((g=e.get(B))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function G(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function J(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],B=le(S,y);r.current.filtered.items.set(g,B),B>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function X(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function Y(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):Y(e)}let ie=()=>X(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):Y(1)},ce=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?ue(-1):Y(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var o;(o=O.onKeyDown)==null||o.call(O,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),X(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Je},b),z(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;U(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function U(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:O,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:U,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),z(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Oe=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Be=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},z(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),ze=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),Ue=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},z(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ye=Object.assign(be,{List:Be,Item:Ve,Input:Oe,Group:je,Separator:Le,Dialog:ze,Empty:Ue,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function z({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ye as _};