decocms 3.34.1 → 3.34.2

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 (234) hide show
  1. package/dist/client/assets/{AlertCircle-rpaL6q8T.js → AlertCircle-CQgcG-Ae.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-D7_4FAQ5.js → ArrowUpRight-D0znd3JO.js} +1 -1
  3. package/dist/client/assets/{Check-6LmIKXJj.js → Check-BUKt5vhH.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-D0kUlRsN.js → CheckCircle-x4whH3Qn.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-CaCYdoie.js → ChevronDown-C6ULHnU-.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-BuXkBFIm.js → ChevronLeft-Btt_21CS.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-kLRVkGUs.js → ChevronRight-glzdqN1s.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-DkGtzqyl.js → ChevronUp-C5QGzLz6.js} +1 -1
  9. package/dist/client/assets/{Container-Bl0qWNtu.js → Container-RGkdLpnR.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CvhOKI-w.js → DotsVertical-BrpflBsP.js} +1 -1
  11. package/dist/client/assets/{Eye-BNS1RmzG.js → Eye-Bk7j3Cz0.js} +1 -1
  12. package/dist/client/assets/{FilterLines-BSmtfAHG.js → FilterLines-xOxNVJBa.js} +1 -1
  13. package/dist/client/assets/{Globe01-DjWlKHom.js → Globe01-C8CeCAhz.js} +1 -1
  14. package/dist/client/assets/{HardDrive-Dx3Blqhn.js → HardDrive-Czbw3MRd.js} +1 -1
  15. package/dist/client/assets/{Key01-D6jyUgYu.js → Key01-ChQ6WmeN.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-C7Cmt2J8.js → LayoutLeft-D3sIkDa-.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-B6flmd1s.js → LinkExternal01-DNf7UuUK.js} +1 -1
  18. package/dist/client/assets/{Monitor01-DBfOkkx9.js → Monitor01-BzTgEIFJ.js} +1 -1
  19. package/dist/client/assets/{Palette-BX6fdd-v.js → Palette-DwfZnoA5.js} +1 -1
  20. package/dist/client/assets/{Play-DApzrsBx.js → Play-BXW8gJMz.js} +1 -1
  21. package/dist/client/assets/{Plus-Do6ZWheh.js → Plus-CugY_4xX.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-CW918RSV.js → RefreshCcw01-DiPX3Tzc.js} +1 -1
  23. package/dist/client/assets/{SearchMd-B4Lavo8e.js → SearchMd-DltTVRsJ.js} +1 -1
  24. package/dist/client/assets/{Settings02-B57k_aEv.js → Settings02-sAiuI7qb.js} +1 -1
  25. package/dist/client/assets/{Shield01-CFDfVqiL.js → Shield01-C-4y3Jk3.js} +1 -1
  26. package/dist/client/assets/{Star01-QoJ-qcfh.js → Star01-D8Xy046a.js} +1 -1
  27. package/dist/client/assets/{Stars01-ANwy09AP.js → Stars01-BPnYJgb7.js} +1 -1
  28. package/dist/client/assets/{Stars02-C17u9BVa.js → Stars02-CP1Go7Ud.js} +1 -1
  29. package/dist/client/assets/{Sun-D4yzlyEv.js → Sun-BsWLyXgw.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-CkwE98n9.js → SwitchHorizontal01-MAz-yRbe.js} +1 -1
  31. package/dist/client/assets/{Tool01-B0zT3ots.js → Tool01-Cjstio7H.js} +1 -1
  32. package/dist/client/assets/{Trash01-Bifm5Wb3.js → Trash01-BJ6_IzkG.js} +1 -1
  33. package/dist/client/assets/{Upload01-mjA8r4Fi.js → Upload01-C2pjhIpk.js} +1 -1
  34. package/dist/client/assets/{User01-BZL6tFVt.js → User01-D2zO49mC.js} +1 -1
  35. package/dist/client/assets/{Users01-CqVfleMx.js → Users01-ubeIr2qn.js} +1 -1
  36. package/dist/client/assets/{Users03-C5i2CKOP.js → Users03-BqYE15gt.js} +1 -1
  37. package/dist/client/assets/{X-BWR0-4rz.js → X-BQX3Zy-X.js} +1 -1
  38. package/dist/client/assets/{XCircle-CiiIVhRh.js → XCircle-D9dvtOsK.js} +1 -1
  39. package/dist/client/assets/{XClose-D0wmxYTF.js → XClose-DaB-YREn.js} +1 -1
  40. package/dist/client/assets/{Zap-BGp3QjmM.js → Zap-j4DAJVgz.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-CxE5iHdd.js → ZapSquare-cM9Cdjuc.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-B1VNHI1K.js → ZoomOut-DVfZ-43U.js} +1 -1
  43. package/dist/client/assets/{access-gate-BELP4oqa.js → access-gate-DZ_2pDdY.js} +1 -1
  44. package/dist/client/assets/{accordion-Dsx4jZXX.js → accordion-BISd33DR.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-BPiyATcO.js → add-section-modal-DIOLC-ZF.js} +1 -1
  46. package/dist/client/assets/{agent-capabilities-CmHO-Kgo.js → agent-capabilities-CVYxQ4uK.js} +1 -1
  47. package/dist/client/assets/{agent-icon-CpBAbwoh.js → agent-icon-BgD5mt7Y.js} +1 -1
  48. package/dist/client/assets/{agent-icons-C_pHQRgk.js → agent-icons-DmQcPkq-.js} +1 -1
  49. package/dist/client/assets/{agents-list-ud8B7XUs.js → agents-list-h30K61d9.js} +1 -1
  50. package/dist/client/assets/{ai-providers-DuT9vieJ.js → ai-providers-CEnY5BL7.js} +1 -1
  51. package/dist/client/assets/{alert-C_aVuLV8.js → alert-C7cWRVuG.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-Dsb6KPFM.js → alert-dialog-qtdXP2aD.js} +1 -1
  53. package/dist/client/assets/app-editor-B4mTx3Hz.js +1 -0
  54. package/dist/client/assets/{auth-catchall-DsJQjIZu.js → auth-catchall-CuT4FTL1.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-BBz1-8cc.js → auth-split-layout-BDEnOc9x.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-DTcrDIUh.js → automation-list-row-BW5rM44g.js} +1 -1
  57. package/dist/client/assets/{automation-runs-D8yf4pum.js → automation-runs-BUOdfMri.js} +1 -1
  58. package/dist/client/assets/{automations-BqoqwiaS.js → automations-ClItqGDn.js} +1 -1
  59. package/dist/client/assets/{avatar-nCSKoB6F.js → avatar-DYsooxxy.js} +1 -1
  60. package/dist/client/assets/{badge-CY1rqnYU.js → badge-CTK5gX_I.js} +1 -1
  61. package/dist/client/assets/{brand-context-DCIkJfS8.js → brand-context-CtcRGgwt.js} +1 -1
  62. package/dist/client/assets/{buckets-CvxCU-Mg.js → buckets-BPPYI6Ll.js} +1 -1
  63. package/dist/client/assets/{calendar-vde5tCHf.js → calendar-DMziTV2J.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-DYWpzVHl.js → capability-load-error-BTLQ23rW.js} +1 -1
  65. package/dist/client/assets/{card-CYGsSb57.js → card-DGQIgBVW.js} +1 -1
  66. package/dist/client/assets/{chat-context-CDygsN4Q.js → chat-context-BwBc2M6a.js} +1 -1
  67. package/dist/client/assets/{checkbox-vKl7eadT.js → checkbox-B-MHp2m4.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-BgBSOhsv.js → cli-auth-success-CPZJCSmX.js} +1 -1
  69. package/dist/client/assets/{collection-detail-Cl0_mdap.js → collection-detail-AQZQR51q.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-VpCmWGot.js → collection-display-button-Df3MeS7W.js} +1 -1
  71. package/dist/client/assets/{collection-search-CjkYy_AH.js → collection-search-BiQg9L4B.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-CuUrD2rg.js → collection-table-wrapper-DEwd3fgl.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-BGsvaOVA.js → collection-tabs-CcnS0Il2.js} +1 -1
  74. package/dist/client/assets/{collections-NCEoL2EX.js → collections-BnzTAqxJ.js} +1 -1
  75. package/dist/client/assets/{command-KCI9wvsu.js → command-DNZKPE8c.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-CgeQRUKM.js → connect-desktop-dialog-Cu6gQanY.js} +1 -1
  77. package/dist/client/assets/{connection-card-BioQsepZ.js → connection-card-CwL_Gtb4.js} +1 -1
  78. package/dist/client/assets/{connection-detail-szcerrZK.js → connection-detail-DTp8ff1l.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-DC_9yJsF.js → connection-form-helpers-Bm0LSgZq.js} +1 -1
  80. package/dist/client/assets/{connections-ZTcaOmQJ.js → connections-j-HJQpSe.js} +1 -1
  81. package/dist/client/assets/decopilot-sse-pool-COADWaXW.js +1 -0
  82. package/dist/client/assets/{dialog-CxpeEAA2.js → dialog-BVuxcsVk.js} +1 -1
  83. package/dist/client/assets/{domain-settings-FkOLC-vc.js → domain-settings-DKOBo5cc.js} +1 -1
  84. package/dist/client/assets/{drawer-R-Q-vfsa.js → drawer-DXb-AEyv.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-Xj0lVIXK.js → dropdown-menu-B8jiZxwT.js} +1 -1
  86. package/dist/client/assets/{dynamic-plugin-layout-ggJeSS9L.js → dynamic-plugin-layout-DYfQLQqA.js} +1 -1
  87. package/dist/client/assets/{empty-state-BhV-zl-f.js → empty-state-D5f29Xcz.js} +1 -1
  88. package/dist/client/assets/{empty-state-BEE0EBKQ.js → empty-state-DIMjTOGF.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-BJ4lD3eO.js → extract-connection-data-BJtaRoQB.js} +1 -1
  90. package/dist/client/assets/{features-2oa5PE-D.js → features-Baf8n_se.js} +1 -1
  91. package/dist/client/assets/{file-explorer-mkpu5feK.js → file-explorer-BB5qrAiH.js} +1 -1
  92. package/dist/client/assets/{file-type-icon-35VBMVCk.js → file-type-icon-9GbQJJla.js} +1 -1
  93. package/dist/client/assets/{files-C37GYe47.js → files-BDf63K2h.js} +1 -1
  94. package/dist/client/assets/{form-Ci8PGt-R.js → form-D5zHXlMU.js} +1 -1
  95. package/dist/client/assets/{general-NmglolSe.js → general-t5ylGzhM.js} +1 -1
  96. package/dist/client/assets/{generate-id-nWw_PZwJ.js → generate-id-16rt0unc.js} +1 -1
  97. package/dist/client/assets/{github-repo-picker-DY4w_1I0.js → github-repo-picker-D0jgVOhB.js} +1 -1
  98. package/dist/client/assets/{header-tab-button-C7XZ27Uv.js → header-tab-button-B7JCdtgi.js} +1 -1
  99. package/dist/client/assets/{hover-card-DY9PmUZF.js → hover-card-BAzXpmKd.js} +1 -1
  100. package/dist/client/assets/{image-field-DXfNSgLy.js → image-field-Ysc9gjw_.js} +1 -1
  101. package/dist/client/assets/{index-DO3UwA_I.js → index-BFPk_Xc8.js} +1 -1
  102. package/dist/client/assets/{index-BToBsTv0.js → index-BPCEqCH8.js} +1 -1
  103. package/dist/client/assets/{index-D9SSFpE5.js → index-BZGVDk3g.js} +1 -1
  104. package/dist/client/assets/{index-BvKb9qza.js → index-Bb8K2DUU.js} +1 -1
  105. package/dist/client/assets/{index-Czr8nkWj.js → index-C5DGaDTE.js} +1 -1
  106. package/dist/client/assets/{index-BEe1oLVg.js → index-C_RnYmCN.js} +1 -1
  107. package/dist/client/assets/{index-So-S11eP.js → index-CbN9kYHB.js} +1 -1
  108. package/dist/client/assets/{index-rZ1TPVyD.js → index-Cbngzld3.js} +3 -3
  109. package/dist/client/assets/{index-u2XUNnQk.js → index-DES0wLPI.js} +4 -4
  110. package/dist/client/assets/{index-DppjWA7O.js → index-DEkPGwPd.js} +1 -1
  111. package/dist/client/assets/{index-DUiGV32e.js → index-DdEtGRBb.js} +1 -1
  112. package/dist/client/assets/{index-61WbL3ye.js → index-Drq6TCfC.js} +1 -1
  113. package/dist/client/assets/{index-Dczuf3at.js → index-PadxIFkt.js} +1 -1
  114. package/dist/client/assets/{index-czuYZ_ID.js → index-kU5u3aEQ.js} +1 -1
  115. package/dist/client/assets/{index-redirect-Mq-_t69h.js → index-redirect-BVfzEM-2.js} +1 -1
  116. package/dist/client/assets/{index-Rf_PdJ5z.js → index-vM9scTJV.js} +1 -1
  117. package/dist/client/assets/{input-BPXWlz46.js → input-CxWmKS03.js} +1 -1
  118. package/dist/client/assets/{integration-icon-CWT0gSfx.js → integration-icon-C8l8gk56.js} +1 -1
  119. package/dist/client/assets/{label-CzVCjiiL.js → label-BUOqnJ7l.js} +1 -1
  120. package/dist/client/assets/{layout-DRDhyVmm.js → layout-BXEq9Lt0.js} +1 -1
  121. package/dist/client/assets/{login-BDymjDs5.js → login-79jBd8dT.js} +1 -1
  122. package/dist/client/assets/{members-CtJP3l4D.js → members-4ZcflmV4.js} +1 -1
  123. package/dist/client/assets/{monaco-editor-C-H4UmIT.js → monaco-editor-CwH2NVur.js} +1 -1
  124. package/dist/client/assets/{monitoring-stats-row-Bjwv0PCc.js → monitoring-stats-row-_N9Geab-.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-BS0_f_H5.js → oauth-callback-UYq6rKIp.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-ai-provider-Bp-Z15lU.js → oauth-callback-ai-provider-CcTTT6yu.js} +1 -1
  127. package/dist/client/assets/{onboarding-tR6ID9Ba.js → onboarding-DM9L8yF1.js} +1 -1
  128. package/dist/client/assets/{org-install-Dao8BW5b.js → org-install-BKkCtJoj.js} +1 -1
  129. package/dist/client/assets/{org-layout-3WhlK4a0.js → org-layout-CeAaKEeN.js} +1 -1
  130. package/dist/client/assets/{org-plugin-layout-C-NqJRXX.js → org-plugin-layout-B_8XF5xC.js} +1 -1
  131. package/dist/client/assets/{page-seo-form-Dk6e77BM.js → page-seo-form-c-iWMPRU.js} +1 -1
  132. package/dist/client/assets/page-seo-sheet-DEsc0wUy.js +1 -0
  133. package/dist/client/assets/{pair-DYb6YfcG.js → pair-DGfi0DYT.js} +1 -1
  134. package/dist/client/assets/{plugin-empty-state-YbbYO5hU.js → plugin-empty-state-DhzIqwYl.js} +1 -1
  135. package/dist/client/assets/{plugin-header-8P4QiIoH.js → plugin-header-Nu37D2e7.js} +1 -1
  136. package/dist/client/assets/{plugin-layout-CKmZivzq.js → plugin-layout-DS-45rI5.js} +1 -1
  137. package/dist/client/assets/{popover-Bk3EwUPD.js → popover-DIhiGQZO.js} +1 -1
  138. package/dist/client/assets/{post-editor-Bw21I9pc.js → post-editor-BhTIGX9u.js} +1 -1
  139. package/dist/client/assets/{primitives-Dql_hUCU.js → primitives-D3OiaA1o.js} +1 -1
  140. package/dist/client/assets/{profile-DVNKZaX-.js → profile-BOnhq-U1.js} +1 -1
  141. package/dist/client/assets/project-app-view-B6XESkOH.js +1 -0
  142. package/dist/client/assets/record-editor-DDxQqS5k.js +1 -0
  143. package/dist/client/assets/registry-AsFW8yYm.js +2 -0
  144. package/dist/client/assets/{registry-layout-DwX4dFWX.js → registry-layout-CkNttCUh.js} +1 -1
  145. package/dist/client/assets/{require-capability-6kSOKhdT.js → require-capability-Cm5KwYyo.js} +1 -1
  146. package/dist/client/assets/{required-auth-layout-YEZh9H2w.js → required-auth-layout-C2qJiXM7.js} +1 -1
  147. package/dist/client/assets/{reset-password-DaCJM4Eh.js → reset-password-iw6TtkA7.js} +1 -1
  148. package/dist/client/assets/{resizable-23UTrxEL.js → resizable-DOED-lqJ.js} +1 -1
  149. package/dist/client/assets/{roles-xmvI7O0C.js → roles-DpYb1zXX.js} +1 -1
  150. package/dist/client/assets/save-referenced-block-aVkQu985.js +1 -0
  151. package/dist/client/assets/{save-status-BkzFYIeb.js → save-status-NiMLdA_E.js} +1 -1
  152. package/dist/client/assets/{schema-form-DNaVud8y.js → schema-form-BMMNRxMa.js} +1 -1
  153. package/dist/client/assets/{scroll-area-QXSqgT3C.js → scroll-area-BCusTvyt.js} +1 -1
  154. package/dist/client/assets/{search-input-DbmU5zU8.js → search-input-BlmktcqH.js} +1 -1
  155. package/dist/client/assets/{secrets-CrK7EU6I.js → secrets-Kx-u37G9.js} +1 -1
  156. package/dist/client/assets/{sections-editor-DJ6-AL_q.js → sections-editor-Btt2eICm.js} +1 -1
  157. package/dist/client/assets/{select-DRqZIuLQ.js → select-DJ-jQ95-.js} +1 -1
  158. package/dist/client/assets/{select-model-CZe_eVYF.js → select-model-CuVna3TI.js} +1 -1
  159. package/dist/client/assets/{seo-editor-pRBB6PMK.js → seo-editor-CpGzaUnY.js} +1 -1
  160. package/dist/client/assets/{settings-layout-osjNi_Qw.js → settings-layout-CUxOF-JB.js} +1 -1
  161. package/dist/client/assets/{settings-section-5LNAbhU4.js → settings-section-Bs7s9mU1.js} +1 -1
  162. package/dist/client/assets/{sheet-Dsfk9URc.js → sheet-4VDYc-Lf.js} +1 -1
  163. package/dist/client/assets/{shell-controls-BvG0M9XK.js → shell-controls-D0MQ2JKg.js} +1 -1
  164. package/dist/client/assets/{shell-layout-DkW3B_MZ.js → shell-layout-BtNaHUcu.js} +1 -1
  165. package/dist/client/assets/{shell-route-loading-CKElD_Av.js → shell-route-loading-Dy64K_ax.js} +1 -1
  166. package/dist/client/assets/{sidebar-B3SsvTHC.js → sidebar-DeB8mcen.js} +1 -1
  167. package/dist/client/assets/{skeleton-DvVUqja_.js → skeleton-Cuoq2c8E.js} +1 -1
  168. package/dist/client/assets/{sortable.esm-CnPAeADV.js → sortable.esm-4pxxx_ZW.js} +1 -1
  169. package/dist/client/assets/{spinner-DZmgr2qu.js → spinner-Dar3jTAz.js} +1 -1
  170. package/dist/client/assets/{sso-Ce8-uwYP.js → sso-C0PJx8_v.js} +1 -1
  171. package/dist/client/assets/{store-Cy7UQOIx.js → store-XNFzt3Sr.js} +1 -1
  172. package/dist/client/assets/store-registry-D3KY8zoe.js +2 -0
  173. package/dist/client/assets/{studio-tools-jbRVdtpc.js → studio-tools-B99HmIGq.js} +1 -1
  174. package/dist/client/assets/{switch-rL3a0x4B.js → switch-jfclxkGe.js} +1 -1
  175. package/dist/client/assets/{tab-id-hZWLCmfc.js → tab-id-C7uvN0td.js} +1 -1
  176. package/dist/client/assets/{table-cHRXPecF.js → table-DEsh_yYm.js} +1 -1
  177. package/dist/client/assets/{tabs-B68TQ0Dt.js → tabs-tr2cYDEl.js} +1 -1
  178. package/dist/client/assets/{task-status-Cqn0_tco.js → task-status-Ds87FkqY.js} +1 -1
  179. package/dist/client/assets/{textarea-Bymi75yx.js → textarea-uwm8kgXD.js} +1 -1
  180. package/dist/client/assets/{toggle-group-DnRl91Ne.js → toggle-group-BDjNDkJX.js} +1 -1
  181. package/dist/client/assets/{toolbar-Cb06hfKk.js → toolbar-BIItBzPS.js} +1 -1
  182. package/dist/client/assets/{tools-list-D12nTCg-.js → tools-list-BQc1il3V.js} +1 -1
  183. package/dist/client/assets/{tooltip-ua4lJTzI.js → tooltip--aN5hOmO.js} +1 -1
  184. package/dist/client/assets/{types-DJl0mitR.js → types-BqoD-In5.js} +1 -1
  185. package/dist/client/assets/{use-ai-providers-P6PF7YRx.js → use-ai-providers-CdyP1ECQ.js} +1 -1
  186. package/dist/client/assets/{use-automations-DGe3A7k6.js → use-automations-CtzZDGfB.js} +1 -1
  187. package/dist/client/assets/{use-capability-B2IrzHkM.js → use-capability-KB17PgvY.js} +1 -1
  188. package/dist/client/assets/{use-clock-tick-x-ip1-Lp.js → use-clock-tick-CbDuKmI6.js} +1 -1
  189. package/dist/client/assets/{use-collections-Dvp_IbhN.js → use-collections-shQIB33q.js} +1 -1
  190. package/dist/client/assets/{use-connection-CyWLUiRu.js → use-connection-Zog2j0WA.js} +1 -1
  191. package/dist/client/assets/{use-copy-nAd5EMaO.js → use-copy-CZHdrpQ2.js} +1 -1
  192. package/dist/client/assets/{use-create-virtual-mcp-DmdlMapL.js → use-create-virtual-mcp-aKZM7QuJ.js} +1 -1
  193. package/dist/client/assets/{use-debounced-autosave-DSZqKaTf.js → use-debounced-autosave-CLmefNH1.js} +1 -1
  194. package/dist/client/assets/{use-delete-connection-VJfJqSrZ.js → use-delete-connection-DXPW2vzV.js} +1 -1
  195. package/dist/client/assets/{use-file-configs-DXD_Hwrv.js → use-file-configs-vUZ85Q5v.js} +1 -1
  196. package/dist/client/assets/{use-infinite-scroll-B2zyjKex.js → use-infinite-scroll-RcbuivWg.js} +1 -1
  197. package/dist/client/assets/{use-list-state-ByLS4CFA.js → use-list-state-D4jM3-Gj.js} +1 -1
  198. package/dist/client/assets/{use-mcp-client-CGBZ7ekq.js → use-mcp-client-BNpG-Sq-.js} +1 -1
  199. package/dist/client/assets/{use-mcp-prompts-BQNNtRte.js → use-mcp-prompts-DXY1goeC.js} +1 -1
  200. package/dist/client/assets/{use-mcp-tools-Dn2JgISP.js → use-mcp-tools-BIWz7WmP.js} +1 -1
  201. package/dist/client/assets/{use-members-BaX0tyb1.js → use-members--qC59KQg.js} +1 -1
  202. package/dist/client/assets/{use-navigate-to-agent-5w6ZqBss.js → use-navigate-to-agent-nRLYSeRD.js} +1 -1
  203. package/dist/client/assets/{use-org-auth-client-CLnnUl3h.js → use-org-auth-client-vlAtiOoY.js} +1 -1
  204. package/dist/client/assets/{use-org-sso-B8CLPiZl.js → use-org-sso-D9s0K3D9.js} +1 -1
  205. package/dist/client/assets/{use-organization-roles-UOgWPl1e.js → use-organization-roles-DfHQwz_9.js} +1 -1
  206. package/dist/client/assets/{use-organization-settings-D68AqLOQ.js → use-organization-settings-BYRiagaB.js} +1 -1
  207. package/dist/client/assets/{use-registry-connections-CRtbznIm.js → use-registry-connections-2J71KvqA.js} +1 -1
  208. package/dist/client/assets/{use-secrets--KIFsJ5I.js → use-secrets-CqzR66gk.js} +1 -1
  209. package/dist/client/assets/{use-status-sounds-B8VUkU2E.js → use-status-sounds-Ce0VEQki.js} +1 -1
  210. package/dist/client/assets/{use-view-mode-CvlKEBCR.js → use-view-mode-rJzWSnvR.js} +1 -1
  211. package/dist/client/assets/{use-virtual-mcp-mhycHzLS.js → use-virtual-mcp-CfnJ2csQ.js} +1 -1
  212. package/dist/client/assets/useInfiniteQuery-g2cikAaR.js +1 -0
  213. package/dist/client/assets/{useRouterState-qr3F3XJE.js → useRouterState-somQ9b5z.js} +1 -1
  214. package/dist/client/assets/useSuspenseInfiniteQuery-ZAutmGB6.js +1 -0
  215. package/dist/client/assets/{user-D73GXODW.js → user-Bku5ElcW.js} +1 -1
  216. package/dist/client/assets/{view-mode-toggle-3i0Tx7_t.js → view-mode-toggle-DV5nhx4X.js} +1 -1
  217. package/dist/client/assets/{watch-sse-pool-Bo209v56.js → watch-sse-pool-CzyBkAGb.js} +1 -1
  218. package/dist/client/assets/{workflow-DoAXdkx8.js → workflow-BPCoD875.js} +1 -1
  219. package/dist/client/assets/workflow-detail-DWZIWF6w.js +1 -0
  220. package/dist/client/index.html +1 -1
  221. package/dist/server/cli.js +2 -2
  222. package/dist/server/server.js +1 -1
  223. package/package.json +1 -1
  224. package/dist/client/assets/app-editor-CJE_W_Dn.js +0 -1
  225. package/dist/client/assets/decopilot-sse-pool-C2fCSDxg.js +0 -1
  226. package/dist/client/assets/page-seo-sheet-Ceb0gnAp.js +0 -1
  227. package/dist/client/assets/project-app-view-CMCeiidr.js +0 -1
  228. package/dist/client/assets/record-editor-803FPqaV.js +0 -1
  229. package/dist/client/assets/registry-BZxoTJql.js +0 -2
  230. package/dist/client/assets/save-referenced-block-CMYI5Fv0.js +0 -1
  231. package/dist/client/assets/store-registry-Cn522mzq.js +0 -2
  232. package/dist/client/assets/useInfiniteQuery-k6dph5MZ.js +0 -1
  233. package/dist/client/assets/useSuspenseInfiniteQuery-DGO3SU3a.js +0 -1
  234. package/dist/client/assets/workflow-detail-BVmen01p.js +0 -1
@@ -1,4 +1,4 @@
1
- import{e as $,j as t,q as J,b as he,G as ae,r as L,M as ke,J as Re,R as ie,n as xe,K as U,a as be,t as oe,o as D,B as se,c as V,l as Y,s as Ae,F as Oe}from"./index-rZ1TPVyD.js";import{b as Ge}from"./use-virtual-mcp-mhycHzLS.js";import{k as le}from"./use-navigate-to-agent-5w6ZqBss.js";import{b as Le,u as ye}from"./use-connection-CyWLUiRu.js";import{W as Pe,u as H,a as ce}from"./use-mcp-client-CGBZ7ekq.js";import{D as we,a as Ce,b as Ie,c as Ne,d as $e}from"./dialog-CxpeEAA2.js";import{i as ue}from"./RefreshCcw01-CW918RSV.js";import{C as je}from"./collection-search-CjkYy_AH.js";import{C as pe}from"./checkbox-vKl7eadT.js";import{n as He}from"./agent-icon-CpBAbwoh.js";import{u as Me}from"./use-mcp-tools-Dn2JgISP.js";import{e as De}from"./extract-connection-data-BJ4lD3eO.js";const Ue=`<svg width="74" height="84" viewBox="0 0 74 84" fill="none" xmlns="http://www.w3.org/2000/svg">
1
+ import{e as $,j as t,q as J,b as he,G as ae,r as L,M as ke,J as Re,R as ie,n as xe,K as U,a as be,t as oe,o as D,B as se,c as V,l as Y,s as Ae,F as Oe}from"./index-Cbngzld3.js";import{b as Ge}from"./use-virtual-mcp-CfnJ2csQ.js";import{k as le}from"./use-navigate-to-agent-nRLYSeRD.js";import{b as Le,u as ye}from"./use-connection-Zog2j0WA.js";import{W as Pe,u as H,a as ce}from"./use-mcp-client-BNpG-Sq-.js";import{D as we,a as Ce,b as Ie,c as Ne,d as $e}from"./dialog-BVuxcsVk.js";import{i as ue}from"./RefreshCcw01-DiPX3Tzc.js";import{C as je}from"./collection-search-BiQg9L4B.js";import{C as pe}from"./checkbox-B-MHp2m4.js";import{n as He}from"./agent-icon-BgD5mt7Y.js";import{u as Me}from"./use-mcp-tools-BIWz7WmP.js";import{e as De}from"./extract-connection-data-BJtaRoQB.js";const Ue=`<svg width="74" height="84" viewBox="0 0 74 84" fill="none" xmlns="http://www.w3.org/2000/svg">
2
2
  <path d="M63.4462 15.3005C63.1414 15.2764 57.2333 15.1845 57.2333 15.1845C57.2333 15.1845 52.2906 10.3849 51.8019 9.89426C51.6127 9.71981 51.3729 9.60981 51.1172 9.58008V83.0253L73.2664 77.5175C73.2664 77.5175 64.2277 16.3953 64.1696 15.9772C64.1417 15.7997 64.055 15.6366 63.9235 15.5139C63.7919 15.3913 63.6255 15.3162 63.4462 15.3005Z" fill="#171717"/>
3
3
  <path fill-rule="evenodd" clip-rule="evenodd" d="M32.748 0.00356357C34.8334 -0.0568526 36.5759 0.651298 37.9307 2.10122C38.0276 2.20613 38.1209 2.31463 38.2109 2.42544L38.2354 2.42349C38.4434 2.40657 38.6494 2.38638 38.8574 2.38638H38.8672C41.9831 2.3913 44.5571 4.16796 46.3184 7.527C46.8023 8.4621 47.2004 9.43976 47.5068 10.4469L49.9883 9.67837C50.3609 9.56961 51.315 9.42163 51.8037 9.90981L51.9922 82.3883L51.1162 83.0387L0 74.1979C0.0195597 74.0466 6.09952 27.0238 6.3291 25.3629C6.63636 23.1661 6.70922 23.0933 9.03906 22.361L16.957 19.9079C17.4531 16.377 19.1884 11.8165 21.4746 8.18423C24.7237 3.02487 28.7273 0.119714 32.748 0.00356357ZM38.8408 26.7077C38.8133 26.694 36.5926 25.6009 32.2842 25.8747C21.032 26.5853 15.9341 34.4515 16.4229 42.2213C17.0059 51.4485 26.2283 51.1199 26.584 56.734C26.6686 58.0922 25.8271 60.0114 23.4658 60.1588C19.8562 60.3883 15.3438 56.9831 15.3438 56.9831L13.6191 64.3249C13.6191 64.3249 18.1021 69.1296 26.2432 68.6149C33.027 68.1895 37.7351 62.759 37.2344 54.8249C36.5981 44.7397 25.2729 43.7966 25.002 39.4948C24.9512 38.7038 25.0055 35.556 29.9932 35.2418C33.3786 35.0279 36.2354 36.3195 36.2666 36.3336L38.8408 26.7077ZM32.8262 2.6813C26.6181 2.86014 21.2028 12.5587 19.8213 19.0211L26.8311 16.8512C27.6101 12.7476 29.5648 8.48928 32.1221 5.74868C33.0162 4.76667 34.0719 3.94401 35.2432 3.31704H35.2451C34.5654 2.87005 33.7695 2.66203 32.8262 2.6813ZM36.9775 5.46548C35.7921 5.95366 34.7952 6.80972 34.0791 7.57583C32.1608 9.63716 30.5951 12.7807 29.7725 15.9391L38.3057 13.2956C38.3322 11.0721 38.0904 7.7854 36.9775 5.46548ZM39.7568 5.14907C40.7052 7.59721 40.9505 10.4321 40.9795 12.4694L44.9473 11.2389C44.3133 9.17981 42.8075 5.72907 39.7568 5.14907Z" fill="#393939"/>
4
4
  </svg>`,Fe=`data:image/svg+xml,${encodeURIComponent(Ue)}`,Nt={title:"New Website",description:"Website cloned from a public template",url:"https://github.com/decocms/webapp-template",owner:"decocms",name:"webapp-template"},jt={title:"Shopify Headless Store",description:"Shopify Headless Store cloned from a public template",url:"https://github.com/Shopify/hydrogen-demo-store",owner:"Shopify",name:"hydrogen-demo-store",icon:Fe};function St(){const o=$.c(6),e=Ge(),n=le();let s;o[0]!==e.create||o[1]!==n?(s=async r=>{const f=await e.create.mutateAsync({title:r.title,description:r.description,icon:r.icon??null,status:"active",pinned:!1,connections:[],metadata:{githubRepo:{url:r.url,owner:r.owner,name:r.name},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}}});return f.id&&n(f.id),f},o[0]=e.create,o[1]=n,o[2]=s):s=o[2];const l=s;let i;return o[3]!==e.create.isPending||o[4]!==l?(i={createFromTemplate:l,isCreating:e.create.isPending},o[3]=e.create.isPending,o[4]=l,o[5]=i):i=o[5],i}function F(o){const e=$.c(4),{size:n,className:s}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=l):l=e[0];let i;return e[1]!==s||e[2]!==n?(i=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:s,children:l}),e[1]=s,e[2]=n,e[3]=i):i=e[3],i}function ze(o,e){const n=$.c(12),{org:s}=J();let l;n[0]!==s.id?(l=Pe.REGISTRY(s.id),n[0]=s.id,n[1]=l):l=n[1];const i=l;let r;n[2]!==s.id||n[3]!==s.slug||n[4]!==i?(r={connectionId:i,orgId:s.id,orgSlug:s.slug},n[2]=s.id,n[3]=s.slug,n[4]=i,n[5]=r):r=n[5];const f=H(r);let b;n[6]!==o?(b={name:o},n[6]=o,n[7]=b):b=n[7];const a=e?.enabled??!0;let C;return n[8]!==f||n[9]!==b||n[10]!==a?(C={client:f,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:b,enabled:a,staleTime:3e5,select:qe},n[8]=f,n[9]=b,n[10]=a,n[11]=C):C=n[11],Me(C)}function qe(o){return o.structuredContent?.item??null}const Be="deco/mcp-github";function Se(o){const{org:e}=J(),{data:n}=he.useSession(),s=Le(),l=ae(),[i,r]=L.useState("idle"),[f,b]=L.useState(null),[a,C]=L.useState(null),{data:h,isLoading:m}=ze(Be,{enabled:o.enabled}),x=L.useRef(!1);o.enabled&&h&&!m&&!x.current&&n?.user?.id&&i==="idle"&&(x.current=!0,N());async function N(){if(!(!h||!n?.user?.id||!e))try{r("installing"),b(null);const p=De(h,e.id,n.user.id,{remoteIndex:0});if(!p.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:w}=await s.create.mutateAsync(p);r("authenticating");const j=new URL(`/api/${e.slug}/mcp/${w}`,window.location.origin),d=await ke({url:j.href,token:null,orgId:e.id});if(d.supportsOAuth&&!d.isAuthenticated){const{token:S,tokenInfo:c,error:v}=await Re({connectionId:w,orgSlug:e.slug,scope:"offline_access"});if(v||!S){try{await s.delete.mutateAsync(w)}catch{}throw new Error(v??"No token received from GitHub")}if(c)try{(await fetch(`/api/${e.slug}/connections/${w}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:c.accessToken,refreshToken:c.refreshToken,expiresIn:c.expiresIn,scope:c.scope,clientId:c.clientId,clientSecret:c.clientSecret,tokenEndpoint:c.tokenEndpoint})})).ok||await s.update.mutateAsync({id:w,data:{connection_token:S}})}catch{await s.update.mutateAsync({id:w,data:{connection_token:S}})}}ie(l,e.id),C(p),r("ready")}catch(p){b(p instanceof Error?p.message:String(p)),r("error")}}function y(){r("idle"),b(null),C(null),x.current=!1}return o.enabled&&m&&i==="idle"?{status:"installing",error:null,connection:null,retry:y}:{status:i,error:f,connection:a,retry:y}}const Ve="deco-sites";function Ke(o){if(!o||typeof o!="object")return null;const e=o.github;if(!e||typeof e!="object")return null;const n=e.owner,s=e.repo;return typeof n!="string"||typeof s!="string"||n.length===0||s.length===0?null:{owner:n,repo:s}}function Qe(o,e){const n=e?Ke(e):null,s=n?.owner??Ve,l=n?.repo??o;return{owner:s,name:l,url:`https://github.com/${s}/${l}`}}const K={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function Je(o){if(!o||typeof o!="object"||Array.isArray(o))return K;const e=o;return Object.values(e).some(n=>typeof n!="string")?K:e}function Ye(o){if(!(typeof o!="number"||!Number.isFinite(o)||!Number.isInteger(o)||o<=0))return o}function We(o){const e=o.metadata?.repoScope;if(!e||typeof e.installationId!="number"||!Number.isFinite(e.installationId)||!Number.isInteger(e.installationId)||e.installationId<=0||typeof e.owner!="string"||typeof e.repo!="string"||e.owner.length===0||e.repo.length===0)return null;const n=Ye(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:Je(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function ve(o){return(o??[]).filter(e=>We(e)===null)}async function Ee(o,e){const s=(await o({name:"GITHUB_LIST_USER_ORGS",arguments:{connectionId:e}})).content?.[0]?.text;if(!s)throw new Error("No response from GITHUB_LIST_USER_ORGS");try{return JSON.parse(s)}catch{throw new Error("Invalid response from GITHUB_LIST_USER_ORGS")}}function Ze(o,e){const n=e.toLowerCase();return o.find(s=>s.login.toLowerCase()===n)}const ge="GitHub MCP did not return refreshable repo grant metadata";function q(o){if(typeof o!="string")return null;const e=o.trim();return e.length>0?e:null}function Xe(o){try{const e=new URL(o);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function et(o){return typeof o=="number"&&Number.isFinite(o)&&Number.isInteger(o)&&o>0?o:void 0}async function Te(o){const{orgSlug:e,sourceConnection:n,installationId:s,owner:l,repo:i,githubCallTool:r,selfCallTool:f}=o,b=await r({name:"MINT_REPO_TOKEN",arguments:{installationId:s,owner:l,repo:i,permissions:K}}),a=b.structuredContent;if(b.isError||!a?.token){const A=b.content?.find(T=>T.type==="text")?.text;throw new Error(A?`Failed to mint a repo-scoped GitHub token: ${A}`:"Failed to mint a repo-scoped GitHub token")}const C=q(a.refreshToken),h=q(a.tokenEndpoint),m=q(a.clientId);if(!C||!h||!m)throw new Error(ge);if(!Xe(h))throw new Error(ge);const x=q(a.repository?.owner),N=q(a.repository?.name),y="GitHub MCP returned refresh metadata for a different repository";if(a.repository?.owner!==void 0&&(!x||x.toLowerCase()!==l.toLowerCase()))throw new Error(y);if(a.repository?.name!==void 0&&(!N||N.toLowerCase()!==i.toLowerCase()))throw new Error(y);const p=et(a.repository?.id),I=a.expiresAt?Date.parse(a.expiresAt):NaN,w=Number.isFinite(I)?Math.max(0,Math.floor((I-Date.now())/1e3)):null,d=(typeof a.expiresIn=="number"&&Number.isFinite(a.expiresIn)&&Number.isInteger(a.expiresIn)&&a.expiresIn>0?a.expiresIn:null)??w,S=await f({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${l}/${i}`,description:`Repo-scoped GitHub access for ${l}/${i}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{repoScope:{installationId:s,repositoryId:p,owner:l,repo:i,permissions:K,grantProvider:"github-mcp"}}}}}),c=S.structuredContent??S,v=c.item?.id??c.id;if(!v)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${v}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:a.token,refreshToken:C,expiresIn:d,scope:a.scope??null,clientId:m,tokenEndpoint:h})})).ok)throw await f({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:v,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:v}}function tt(o){return o.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function nt(o){const e=await fetch(`/api/${o}/deco-sites`);if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.error??`Failed to load sites (${e.status})`)}return e.json()}function vt({open:o,onOpenChange:e,onBack:n}){const{org:s}=J(),l=le(),i=ae(),{data:r}=he.useSession(),[f,b]=L.useState(null),[a,C]=L.useState(null),[h,m]=L.useState(""),x=H({connectionId:ce,orgId:s.id,orgSlug:s.slug}),N=ye({slug:"mcp-github"}),y=ve(N),p=Se({enabled:o&&y.length===0}),I=y.length===1?y[0]??null:a,w=y.length>1&&!I,j=H({connectionId:I?.id??"",orgId:s.id,orgSlug:s.slug}),d=o&&y.length===0&&(p.status==="installing"||p.status==="authenticating"||p.status==="idle"),{data:S,isLoading:c,error:v}=xe({queryKey:U.decoSites(r?.user?.email),queryFn:()=>nt(s.slug),enabled:o&&!!r?.user?.email,staleTime:6e4,retry:!1}),O=S?.sites??[],A=u=>{u||(b(null),C(null),m("")),e(u)},T=O.filter(u=>u.name.toLowerCase().includes(h.toLowerCase())||(u.domains?.[0]?.domain?.toLowerCase().includes(h.toLowerCase())??!1)),g=!f||T.some(u=>u.name===f),k=be({mutationFn:async u=>{if(!I)throw new Error("GitHub is not connected. Complete GitHub setup and try again.");oe("deco_site_import_started",{site_name:u});const{installations:R,appSlug:_}=await Ee(P=>x.callTool(P),I.id),G=O.find(P=>P.name===u);if(!G)throw new Error("Selected site is no longer available");const E=Qe(u,G.metadata),z=Ze(R,E.owner);if(!z){const P=_?`https://github.com/apps/${_}/installations/new`:"https://github.com/settings/installations";throw new Error(`Install the GitHub App on the "${E.owner}" organization to import this site. ${P}`)}let W=null,Z=null,X=null;const _e=async()=>{X&&await x.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:X}}).catch(()=>{}),Z&&await x.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:Z,force:!0}}).catch(()=>{}),W&&await x.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:W,force:!0}}).catch(()=>{})};try{const P=await fetch(`/api/${s.slug}/deco-sites/connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:u})}),ee=await P.json().catch(()=>({}));if(!P.ok)throw new Error(ee.error??`Failed to create connection (${P.status})`);const M=ee.connId;if(!M)throw new Error("Server did not return a connection ID");W=M;const{childConnectionId:te}=await Te({orgSlug:s.slug,sourceConnection:I,installationId:z.installationId,owner:E.owner,repo:E.name,githubCallTool:ne=>j.callTool(ne),selfCallTool:ne=>x.callTool(ne)});Z=te;const de=ee.icon??null,me=tt(u),fe=await x.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:u,description:"Imported from deco.cx",pinned:!1,icon:de??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],githubRepo:{owner:E.owner,name:E.name,url:E.url,installationId:z.installationId,connectionId:te},ui:{banner:null,bannerColor:"#22C55E",icon:de,themeColor:"#22C55E",slug:me,pinnedViews:[{connectionId:M,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:M,toolName:"get_monitor_data",label:"Monitor",icon:null}],layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:M},{connection_id:te}]}}}),B=fe.structuredContent??fe;if(!B.item?.id)throw new Error("Failed to create the imported agent");return X=B.item.id,{slug:me,virtualMcpId:B.item.id,connId:M,item:B.item}}catch(P){throw await _e(),P}},onSuccess:({slug:u,virtualMcpId:R,item:_})=>{oe("deco_site_import_succeeded",{site_name:_.title,virtual_mcp_id:R,slug:u}),i.setQueryData(U.collectionItem(x,s.id,"","VIRTUAL_MCP",R),{item:_}),i.invalidateQueries({predicate:G=>{const E=G.queryKey;return E[1]===s.id&&E[3]==="collection"&&E[4]==="VIRTUAL_MCP"}}),i.invalidateQueries({queryKey:U.projects(s.id)}),D.success(`Imported ${u} from deco.cx`),A(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(R)},onError:u=>{oe("deco_site_import_failed",{error:u instanceof Error?u.message:"Unknown error"}),D.error("Import failed: "+(u instanceof Error?u.message:"Unknown error"))}});return t.jsx(we,{open:o,onOpenChange:A,children:t.jsxs(Ce,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[t.jsx(Ie,{className:"sr-only",children:t.jsx(Ne,{children:"Import from deco.cx"})}),t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[n&&t.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(ue,{size:18})}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"})]}),t.jsx("div",{children:t.jsx(je,{value:h,onChange:m,placeholder:"Search sites...",onKeyDown:u=>{u.key==="Escape"&&m("")}})}),t.jsxs("div",{className:"pb-0 min-h-[300px]",children:[p.status==="error"&&t.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[t.jsx("p",{className:"text-sm text-destructive",children:p.error??"Failed to connect GitHub"}),t.jsx(se,{variant:"outline",size:"sm",onClick:p.retry,children:"Retry GitHub setup"})]}),d&&p.status!=="error"&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Setting up GitHub connection..."}),w&&!d&&p.status!=="error"&&t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-8 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a GitHub connection"})}),y.map(u=>t.jsxs("button",{type:"button",onClick:()=>C(u),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[u.icon?t.jsx("img",{src:u.icon,alt:u.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(F,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:u.title})]},u.id))]}),c&&!d&&p.status!=="error"&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),!c&&!d&&!w&&p.status!=="error"&&!v&&O.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),!c&&!d&&!w&&p.status!=="error"&&O.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[T.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",h,"”"]}),T.map(u=>{const R=u.domains?.find(G=>G.production)?.domain??u.domains?.[0]?.domain,_=f===u.name;return t.jsxs("button",{type:"button",onClick:()=>b(u.name),className:V("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",_?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:u.thumb_url?t.jsx("img",{src:u.thumb_url,alt:u.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:u.name}),R&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:R})]})]},u.name)})]})]}),t.jsxs($e,{className:"px-8 py-5 border-t border-border",children:[t.jsx(se,{variant:"outline",onClick:()=>A(!1),disabled:k.isPending,children:"Cancel"}),t.jsx(se,{disabled:!f||!g||k.isPending||c||d||w||!I||p.status==="error",onClick:()=>f&&k.mutate(f),children:k.isPending?"Importing...":"Import"})]})]})})}function ot(o,e){const n=$.c(4),[s,l]=L.useState(o);let i,r;return n[0]!==e||n[1]!==o?(i=()=>{const f=setTimeout(()=>l(o),e);return()=>clearTimeout(f)},r=[o,e],n[0]=e,n[1]=o,n[2]=i,n[3]=r):(i=n[2],r=n[3]),L.useEffect(i,r),s}const Q=[{key:"auto-respond-to-issues",triggerType:"github.issues.opened",nameSuffix:"auto-respond to issues",label:"Auto-respond to new issues",defaultEnabled:!0,instructions:({owner:o,name:e})=>`A new GitHub issue has been opened in ${o}/${e}. Read the issue, explore relevant code, create a branch, implement the fix, and open a PR referencing the issue number.`},{key:"review-incoming-prs",triggerType:"github.pull_request.opened",nameSuffix:"review incoming PRs",label:"Review incoming pull requests",defaultEnabled:!0,instructions:({owner:o,name:e})=>`A pull request was opened in ${o}/${e}. Read the diff, summarize what changed, flag risks (security, perf, breaking changes), and leave a review comment.`},{key:"note-merged-prs",triggerType:"github.pull_request.closed",nameSuffix:"note merged/closed PRs",label:"Note merged or closed PRs",defaultEnabled:!1,instructions:({owner:o,name:e})=>`A pull request was closed in ${o}/${e}. If it was merged, update changelog/release notes as appropriate.`}];function st(o,e){const n=new Set;if(o.paramsSchema)for(const l of Object.keys(o.paramsSchema))n.add(l);if(Array.isArray(o.params))for(const l of o.params)n.add(l.name);else if(o.params&&typeof o.params=="object")for(const l of Object.keys(o.params))n.add(l);if(n.has("repo"))return{repo:`${e.owner}/${e.name}`};const s={};return n.has("owner")&&(s.owner=e.owner),n.has("name")&&(s.name=e.name),n.has("repository")&&(s.repository=`${e.owner}/${e.name}`),s}async function rt({githubCallTool:o,selfCallTool:e,virtualMcpId:n,repo:s,connectionId:l,selectedKeys:i}){const r=await o({name:"TRIGGER_LIST",arguments:{}}),f=r.structuredContent??r,b=new Map((f.triggers??[]).map(m=>[m.type,m])),a=Q.filter(m=>i.has(m.key)),C=await Promise.allSettled(a.map(async m=>{const x=b.get(m.triggerType);if(!x)throw new Error(`Trigger ${m.triggerType} not exposed`);const N=await e({name:"AUTOMATION_CREATE",arguments:{name:`${s.name}: ${m.nameSuffix}`,virtual_mcp_id:n,messages:m.instructions(s),active:!0}}),y=(N.structuredContent??N).id;if(!y)throw new Error(`AUTOMATION_CREATE returned no id for ${m.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:y,type:"event",connection_id:l,event_type:m.triggerType,params:st(x,s)}})})),h=C.filter(m=>m.status==="rejected").length;return h>0&&console.error("Some GitHub automations failed to set up:",C.filter(m=>m.status==="rejected")),{total:C.length,failed:h}}function Et(o){const e=$.c(22),{open:n,onOpenChange:s,title:l,hideAutoRespondCheckbox:i,onImportComplete:r}=o,f=l===void 0?"Import from GitHub":l,b=i===void 0?!1:i,[a,C]=L.useState(null);let h;e[0]!==f?(h=t.jsx(Ie,{className:"sr-only",children:t.jsx(Ne,{children:f})}),e[0]=f,e[1]=h):h=e[1];let m;e[2]!==a||e[3]!==f?(m=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:a?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>C(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(ue,{size:16})}),t.jsx("img",{src:a.avatarUrl,alt:a.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:a.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(F,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:f})]})}),e[2]=a,e[3]=f,e[4]=m):m=e[4];let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Y,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=x):x=e[5];let N;e[6]!==s?(N=()=>s(!1),e[6]=s,e[7]=N):N=e[7];let y;e[8]!==b||e[9]!==r||e[10]!==n||e[11]!==a||e[12]!==N?(y=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(L.Suspense,{fallback:x,children:t.jsx(it,{open:n,onComplete:N,selectedInstallation:a,onSelectInstallation:C,hideAutoRespondCheckbox:b,onImportComplete:r})})}),e[8]=b,e[9]=r,e[10]=n,e[11]=a,e[12]=N,e[13]=y):y=e[13];let p;e[14]!==h||e[15]!==m||e[16]!==y?(p=t.jsxs(Ce,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[h,m,y]}),e[14]=h,e[15]=m,e[16]=y,e[17]=p):p=e[17];let I;return e[18]!==s||e[19]!==n||e[20]!==p?(I=t.jsx(we,{open:n,onOpenChange:s,children:p}),e[18]=s,e[19]=n,e[20]=p,e[21]=I):I=e[21],I}function it({open:o,onComplete:e,selectedInstallation:n,onSelectInstallation:s,hideAutoRespondCheckbox:l,onImportComplete:i}){const{org:r}=J(),f=ae(),b=le(),[a,C]=L.useState(null),[h,m]=L.useState(!0),[x,N]=L.useState(()=>new Set(Q.filter(g=>g.defaultEnabled).map(g=>g.key))),y=Q.filter(g=>g.defaultEnabled).map(g=>g.key),p=l?new Set(y):h?x:new Set,I=ye({slug:"mcp-github"}),w=ve(I),j=Se({enabled:o&&w.length===0}),d=w.length===1?w[0]??null:a,S=H({connectionId:d?.id??"",orgId:r.id,orgSlug:r.slug}),c=H({connectionId:ce,orgId:r.id,orgSlug:r.slug}),v=async(g,k)=>{try{const R=await S.callTool({name:"get_file_contents",arguments:{owner:g.owner,repo:g.name,path:k}});if(R.isError)return null;const G=R.content?.find(E=>E.type==="resource")?.resource?.text;if(!G)return null;try{const E=JSON.parse(G);return typeof E=="string"?E:JSON.stringify(E)}catch{return G}}catch{return null}},O=(g,k)=>{Promise.all([v(k,"AGENTS.md"),v(k,"CLAUDE.md")]).then(async([u,R])=>{const _=u??R??null;_&&(await c.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:g,data:{metadata:{instructions:_}}}}),ie(f,r.id))}).catch(u=>{console.error("GitHub instructions fetch failed:",u)})},A=async({virtualMcpId:g,repo:k,connectionId:u,selectedKeys:R})=>{const{total:_,failed:G}=await rt({githubCallTool:E=>S.callTool(E),selfCallTool:E=>c.callTool(E),virtualMcpId:g,repo:k,connectionId:u,selectedKeys:R});G>0&&D.warning(`Set up ${_-G}/${_} GitHub automations. Add the rest from the automations view.`)},T=be({mutationFn:async g=>{if(!d||!n)throw new Error("No GitHub connection or installation");const k=n.installationId,{childConnectionId:u}=await Te({orgSlug:r.slug,sourceConnection:d,installationId:k,owner:g.owner,repo:g.name,githubCallTool:_=>S.callTool(_),selfCallTool:_=>c.callTool(_)});let R=null;try{const _=await c.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:g.name,description:g.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:g.owner,name:g.name,url:g.url,installationId:k,connectionId:u},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:u}]}}}),G=_.structuredContent??_,E=G.item?.id;if(!G.item||!E)throw new Error("Failed to create the imported agent");return R=E,p.size>0&&await A({virtualMcpId:E,repo:g,connectionId:u,selectedKeys:p}).catch(z=>{console.error("Failed to set up GitHub automations:",z),D.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:E,repo:g,connectionId:u,item:G.item}}catch(_){throw R&&await c.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:R}}).catch(()=>{}),await c.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:u,force:!0}}).catch(()=>{}),_}},onSuccess:({virtualMcpId:g,repo:k,connectionId:u,item:R})=>{if(f.setQueryData(U.collectionItem(c,r.id,"","VIRTUAL_MCP",g),{item:R}),ie(f,r.id),O(g,k),i){i({virtualMcpId:g,repo:k,connectionId:u});return}D.success(`Imported ${k.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),b(g)},onError:g=>{D.error("Failed to import repo: "+(g instanceof Error?g.message:"Unknown error"))}});return j.status==="installing"||j.status==="authenticating"?t.jsx(re,{status:j.status,error:null,retry:j.retry}):j.status==="error"?t.jsx(re,{status:"error",error:j.error,retry:j.retry}):w.length===0&&j.status==="idle"?t.jsx(re,{status:"installing",error:null,retry:j.retry}):w.length>1&&!d?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),w.map(g=>t.jsxs("button",{type:"button",onClick:()=>C(g),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[g.icon?t.jsx("img",{src:g.icon,alt:g.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(F,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:g.title})]},g.id))]}):d?n?t.jsx(lt,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,installation:n,onSelectRepo:g=>T.mutate(g),isSaving:T.isPending,autoRespondEnabled:h,onAutoRespondChange:m,selectedAutomationKeys:x,onAutomationKeysChange:N,hideAutoRespondCheckbox:l}):t.jsx(at,{connectionId:d.id,orgId:r.id,orgSlug:r.slug,onSelect:s,showBackButton:w.length>1,onBack:()=>C(null)}):null}function at(o){const e=$.c(31),{connectionId:n,orgId:s,orgSlug:l,onSelect:i,showBackButton:r,onBack:f}=o;let b;e[0]!==s||e[1]!==l?(b={connectionId:ce,orgId:s,orgSlug:l},e[0]=s,e[1]=l,e[2]=b):b=e[2];const a=H(b);let C;e[3]!==n||e[4]!==s?(C=U.githubUserOrgs(s,n),e[3]=n,e[4]=s,e[5]=C):C=e[5];let h;e[6]!==n||e[7]!==a?(h=()=>Ee(c=>a.callTool(c),n),e[6]=n,e[7]=a,e[8]=h):h=e[8];let m;e[9]!==C||e[10]!==h?(m={queryKey:C,queryFn:h},e[9]=C,e[10]=h,e[11]=m):m=e[11];const x=xe(m);if(x.isLoading){let c;return e[12]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Y,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=c):c=e[12],c}if(x.isError){let c;return e[13]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=c):c=e[13],c}const N=x.data;if(!N)return null;let y;e[14]!==f||e[15]!==r?(y=r&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:f,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(ue,{size:12}),"Change connection"]})}),e[14]=f,e[15]=r,e[16]=y):y=e[16];let p;if(e[17]!==N.installations||e[18]!==i){let c;e[20]!==i?(c=v=>t.jsxs("button",{type:"button",onClick:()=>i(v),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:v.avatarUrl,alt:v.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:v.login}),v.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},v.installationId),e[20]=i,e[21]=c):c=e[21],p=N.installations.map(c),e[17]=N.installations,e[18]=i,e[19]=p}else p=e[19];let I;e[22]!==p?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:p}),e[22]=p,e[23]=I):I=e[23];const w=N.appSlug?`https://github.com/apps/${N.appSlug}/installations/new`:"https://github.com/settings/installations";let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=j):j=e[24];let d;e[25]!==w?(d=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",j]})}),e[25]=w,e[26]=d):d=e[26];let S;return e[27]!==d||e[28]!==y||e[29]!==I?(S=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[y,I,d]}),e[27]=d,e[28]=y,e[29]=I,e[30]=S):S=e[30],S}function lt(o){const e=$.c(27),{connectionId:n,orgId:s,orgSlug:l,installation:i,onSelectRepo:r,isSaving:f,autoRespondEnabled:b,onAutoRespondChange:a,selectedAutomationKeys:C,onAutomationKeysChange:h,hideAutoRespondCheckbox:m}=o,[x,N]=L.useState(""),y=ot(x,300),p=L.useDeferredValue(y),I=x!==p;let w;e[0]!==I||e[1]!==x?(w=t.jsx(je,{placeholder:"Search repositories...",value:x,onChange:N,isSearching:I}),e[0]=I,e[1]=x,e[2]=w):w=e[2];const j=I?"opacity-40":"opacity-100";let d;e[3]!==j?(d=V("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",j),e[3]=j,e[4]=d):d=e[4];let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(Y,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=S):S=e[5];let c;e[6]!==n||e[7]!==p||e[8]!==i||e[9]!==f||e[10]!==r||e[11]!==s||e[12]!==l?(c=t.jsx(L.Suspense,{fallback:S,children:t.jsx(ct,{connectionId:n,orgId:s,orgSlug:l,installation:i,query:p,onSelectRepo:r,isSaving:f})}),e[6]=n,e[7]=p,e[8]=i,e[9]=f,e[10]=r,e[11]=s,e[12]=l,e[13]=c):c=e[13];let v;e[14]!==d||e[15]!==c?(v=t.jsx("div",{className:d,children:c}),e[14]=d,e[15]=c,e[16]=v):v=e[16];let O;e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==h||e[21]!==C?(O=!m&&t.jsxs("div",{className:"border-t border-border shrink-0",children:[t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",children:[t.jsx(pe,{checked:b,onCheckedChange:T=>a(T===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Set up GitHub automations for this repo"})]}),b&&t.jsx("div",{className:"px-4 pb-3 pl-9 flex flex-col gap-1.5",children:Q.map(T=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(pe,{checked:C.has(T.key),onCheckedChange:g=>{const k=new Set(C);g===!0?k.add(T.key):k.delete(T.key),h(k)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:T.label})]},T.key))})]}),e[17]=b,e[18]=m,e[19]=a,e[20]=h,e[21]=C,e[22]=O):O=e[22];let A;return e[23]!==w||e[24]!==v||e[25]!==O?(A=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[w,v,O]}),e[23]=w,e[24]=v,e[25]=O,e[26]=A):A=e[26],A}function ct(o){const e=$.c(29),{connectionId:n,orgId:s,orgSlug:l,installation:i,query:r,onSelectRepo:f,isSaving:b}=o;let a;e[0]!==n||e[1]!==s||e[2]!==l?(a={connectionId:n,orgId:s,orgSlug:l},e[0]=n,e[1]=s,e[2]=l,e[3]=a):a=e[3];const C=H(a),h=i.type==="User"?"user":"org",m=r?`${h}:${i.login} ${r} in:name`:`${h}:${i.login}`;let x;e[4]!==n||e[5]!==i.login||e[6]!==s||e[7]!==r?(x=U.githubOrgRepos(s,n,i.login,r),e[4]=n,e[5]=i.login,e[6]=s,e[7]=r,e[8]=x):x=e[8];let N;e[9]!==C||e[10]!==m?(N=async j=>{const{signal:d}=j,c=(await C.callTool({name:"search_repositories",arguments:{query:m,page:1,perPage:30}},void 0,{signal:d})).content?.[0]?.text;if(!c)throw new Error("No response from search_repositories");return(JSON.parse(c).items??[]).map(ut)},e[9]=C,e[10]=m,e[11]=N):N=e[11];let y;e[12]!==x||e[13]!==N?(y={queryKey:x,queryFn:N},e[12]=x,e[13]=N,e[14]=y):y=e[14];const{data:p}=Ae(y);if(p.length===0){let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=j):j=e[15];let d;e[16]!==r?(d=r&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=r,e[17]=d):d=e[17];let S;return e[18]!==d?(S=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[j,d]}),e[18]=d,e[19]=S):S=e[19],S}let I;if(e[20]!==b||e[21]!==f||e[22]!==p){let j;e[24]!==b||e[25]!==f?(j=d=>t.jsxs("button",{type:"button",onClick:()=>f(d),disabled:b,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(F,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:d.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[d.private?t.jsx(Oe,{size:10}):t.jsx(He,{size:10}),d.private?"Private":"Public"]})]},d.fullName),e[24]=b,e[25]=f,e[26]=j):j=e[26],I=p.map(j),e[20]=b,e[21]=f,e[22]=p,e[23]=I}else I=e[23];let w;return e[27]!==I?(w=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:I}),e[27]=I,e[28]=w):w=e[28],w}function ut(o){return{name:o.name,fullName:o.full_name,owner:o.full_name.split("/")[0]??"",url:o.html_url,private:o.private,description:o.description,updatedAt:o.updated_at}}function re(o){const e=$.c(33),{status:n,error:s,retry:l}=o;if(n==="error"){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(F,{className:"size-5 text-destructive"})}),e[0]=c):c=e[0];let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=v):v=e[1];const O=s??"Something went wrong while connecting to GitHub.";let A;e[2]!==O?(A=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[v,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:O})]}),e[2]=O,e[3]=A):A=e[3];let T;e[4]!==l?(T=t.jsx("button",{type:"button",onClick:l,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=l,e[5]=T):T=e[5];let g;return e[6]!==A||e[7]!==T?(g=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[c,A,T]}),e[6]=A,e[7]=T,e[8]=g):g=e[8],g}const i=n==="authenticating";let r;e[9]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(F,{className:"size-5 text-foreground"})}),e[9]=r):r=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsxs("div",{className:"relative size-10",children:[r,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(Y,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=f):f=e[10];const b=i?"Authenticating with GitHub":"Setting up GitHub";let a;e[11]!==b?(a=t.jsx("p",{className:"text-sm font-medium",children:b}),e[11]=b,e[12]=a):a=e[12];const C=i?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let h;e[13]!==C?(h=t.jsx("p",{className:"text-xs text-muted-foreground",children:C}),e[13]=C,e[14]=h):h=e[14];let m;e[15]!==a||e[16]!==h?(m=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[a,h]}),e[15]=a,e[16]=h,e[17]=m):m=e[17];const x=i?"bg-muted-foreground/30":"bg-foreground animate-pulse";let N;e[18]!==x?(N=V("size-1.5 rounded-full",x),e[18]=x,e[19]=N):N=e[19];let y;e[20]!==N?(y=t.jsx("span",{className:N}),e[20]=N,e[21]=y):y=e[21];const p=i?"bg-foreground animate-pulse":"bg-muted-foreground/30";let I;e[22]!==p?(I=V("size-1.5 rounded-full",p),e[22]=p,e[23]=I):I=e[23];let w;e[24]!==I?(w=t.jsx("span",{className:I}),e[24]=I,e[25]=w):w=e[25];let j;e[26]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=j):j=e[26];let d;e[27]!==y||e[28]!==w?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[y,w,j]}),e[27]=y,e[28]=w,e[29]=d):d=e[29];let S;return e[30]!==d||e[31]!==m?(S=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[f,m,d]}),e[30]=d,e[31]=m,e[32]=S):S=e[32],S}export{F as G,jt as H,vt as I,Fe as S,Nt as W,Et as a,St as u};
@@ -1,4 +1,4 @@
1
- import{e as y,q as C,G as ce,a as Q,K as E,n as B,b6 as we,a0 as xe,j as o,l as ge,B as q,r as v,C as ye,c as ee,o as re}from"./index-rZ1TPVyD.js";import{S as G}from"./skeleton-DvVUqja_.js";import{n as Z}from"./Globe01-DjWlKHom.js";import{l as je,F as ke}from"./index-DppjWA7O.js";import{F as be,M as ve}from"./file-type-icon-35VBMVCk.js";import{D as Se,a as $e,b as Te,c as ie}from"./dropdown-menu-Xj0lVIXK.js";import{b as A,T as K,a as H}from"./tooltip-ua4lJTzI.js";import{i as Ee}from"./Check-6LmIKXJj.js";import{a as Ce}from"./Eye-BNS1RmzG.js";import{e as Me,f as Fe,a as Ne,b as De}from"./ZoomOut-B1VNHI1K.js";import{i as Pe}from"./LayoutLeft-C7Cmt2J8.js";import{n as Ue}from"./LinkExternal01-B6flmd1s.js";function Oe(s){return s.contentHash??`${s.size}-${s.updatedAt}`}function F(s,e,t,n){const r=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(s)}/fs/${encodeURIComponent(e)}/${t}${r?`?${r}`:""}`}async function N(s,e){const t=await fetch(s,e);if(!t.ok){let n="";try{n=(await t.json()).error??""}catch{}throw new Error(n||`HTTP ${t.status}`)}return t}function vt(s,e){const t=y.c(11),{org:n}=C();let r;t[0]!==n.id||t[1]!==e||t[2]!==s?(r=E.orgFsList(n.id,s,e),t[0]=n.id,t[1]=e,t[2]=s,t[3]=r):r=t[3];let i;t[4]!==n.slug||t[5]!==e||t[6]!==s?(i=async()=>(await(await N(F(n.slug,s,"list",{path:e}))).json()).entries.toSorted(ze),t[4]=n.slug,t[5]=e,t[6]=s,t[7]=i):i=t[7];let a;return t[8]!==r||t[9]!==i?(a={queryKey:r,placeholderData:we,queryFn:i},t[8]=r,t[9]=i,t[10]=a):a=t[10],B(a)}function ze(s,e){return s.kind!==e.kind?s.kind==="dir"?-1:1:s.path.localeCompare(e.path)}function St(s,e,t){const n=y.c(15),{org:r}=C();let i;n[0]!==r.id||n[1]!==e||n[2]!==s?(i=E.orgFsStat(r.id,s??"",e),n[0]=r.id,n[1]=e,n[2]=s,n[3]=i):i=n[3];const a=s!==null;let d;n[4]!==t?(d=t?.refetchIntervalWhenAbsent?f=>f.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,n[4]=t,n[5]=d):d=n[5];let c;n[6]!==r.slug||n[7]!==e||n[8]!==s?(c=async()=>{const f=await fetch(F(r.slug,s??"","stat",{path:e}));if(f.status===404)return null;if(!f.ok)throw new Error(`HTTP ${f.status}`);return(await f.json()).entry},n[6]=r.slug,n[7]=e,n[8]=s,n[9]=c):c=n[9];let l;return n[10]!==i||n[11]!==a||n[12]!==d||n[13]!==c?(l={queryKey:i,enabled:a,refetchInterval:d,queryFn:c},n[10]=i,n[11]=a,n[12]=d,n[13]=c,n[14]=l):l=n[14],B(l)}function $t(s){const e=y.c(9),{org:t}=C();let n;e[0]!==t.id||e[1]!==s?(n=E.orgFsUsage(t.id,s),e[0]=t.id,e[1]=s,e[2]=n):n=e[2];let r;e[3]!==t.slug||e[4]!==s?(r=async()=>await(await N(F(t.slug,s,"usage"))).json(),e[3]=t.slug,e[4]=s,e[5]=r):r=e[5];let i;return e[6]!==n||e[7]!==r?(i={queryKey:n,queryFn:r},e[6]=n,e[7]=r,e[8]=i):i=e[8],B(i)}function Tt(s,e){const t=y.c(9),n=s===void 0?60:s,{org:r}=C();let i;t[0]!==r.id?(i=E.orgFsRecent(r.id),t[0]=r.id,t[1]=i):i=t[1];const a=e?.enabled;let d;t[2]!==n||t[3]!==r.slug?(d=async()=>(await(await N(`/api/${encodeURIComponent(r.slug)}/fs/recent?limit=${n}`)).json()).entries,t[2]=n,t[3]=r.slug,t[4]=d):d=t[4];let c;return t[5]!==i||t[6]!==a||t[7]!==d?(c={queryKey:i,enabled:a,queryFn:d},t[5]=i,t[6]=a,t[7]=d,t[8]=c):c=t[8],B(c)}function Et(s){const e=y.c(8),{org:t}=C();let n;e[0]!==t.id?(n=E.orgFsSkills(t.id),e[0]=t.id,e[1]=n):n=e[1];const r=s?.enabled;let i;e[2]!==t.slug?(i=async()=>{const d=await N(`/api/${encodeURIComponent(t.slug)}/fs/public-sets`),{sets:c}=await d.json(),l=["home",...c.map(_e)];return(await Promise.all(l.map(async u=>{const m=await N(F(t.slug,u,"list",{path:""})),{entries:w}=await m.json();return w.filter(Re).map(j=>({volume:u,path:j.path}))}))).flat()},e[2]=t.slug,e[3]=i):i=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==i?(a={queryKey:n,enabled:r,queryFn:i},e[4]=n,e[5]=r,e[6]=i,e[7]=a):a=e[7],B(a)}function Re(s){return s.kind==="dir"&&s.hasSkill}function _e(s){return`public-${s}`}function Ct(){const s=y.c(7),{org:e}=C();let t;s[0]!==e.id?(t=E.orgFsPublicSets(e.id),s[0]=e.id,s[1]=t):t=s[1];let n;s[2]!==e.slug?(n=async()=>(await(await N(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,s[2]=e.slug,s[3]=n):n=s[3];let r;return s[4]!==t||s[5]!==n?(r={queryKey:t,staleTime:3e5,queryFn:n},s[4]=t,s[5]=n,s[6]=r):r=s[6],B(r)}function Mt(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t.slug||e[1]!==s?(n=r=>F(t.slug,s,"read",{path:r}),e[0]=t.slug,e[1]=s,e[2]=n):n=e[2],n}function Ft(){const s=y.c(2),{org:e}=C();let t;return s[0]!==e.slug?(t=(n,r)=>F(e.slug,n,"read",{path:r}),s[0]=e.slug,s[1]=t):t=s[1],t}function We(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t||e[1]!==s?(n={mutationFn:async r=>(await(await N(F(t.slug,s,"file",{path:r.path}),{method:"PUT",headers:{"content-type":r.contentType??"text/html; charset=utf-8"},body:r.body})).json()).entry},e[0]=t,e[1]=s,e[2]=n):n=e[2],Q(n)}function Nt(s){const e=y.c(26),{org:t}=C(),n=ce();let r;e[0]!==t||e[1]!==n||e[2]!==s?(r=()=>{n.invalidateQueries({queryKey:E.orgFsVolume(t.id,s)}),n.invalidateQueries({queryKey:E.orgFsRecent(t.id)})},e[0]=t,e[1]=n,e[2]=s,e[3]=r):r=e[3];const i=r;let a;e[4]!==t||e[5]!==s?(a=async g=>{for(const k of g.files){const S=g.dir?`${g.dir}/${k.name}`:k.name;await N(F(t.slug,s,"file",{path:S}),{method:"PUT",headers:{"content-type":k.type||"application/octet-stream"},body:k})}},e[4]=t,e[5]=s,e[6]=a):a=e[6];let d;e[7]!==i||e[8]!==a?(d={mutationFn:a,onSettled:i},e[7]=i,e[8]=a,e[9]=d):d=e[9];const c=Q(d);let l;e[10]!==t||e[11]!==s?(l=async g=>{await N(F(t.slug,s,"dir",{path:g}),{method:"POST"})},e[10]=t,e[11]=s,e[12]=l):l=e[12];let f;e[13]!==i||e[14]!==l?(f={mutationFn:l,onSuccess:i},e[13]=i,e[14]=l,e[15]=f):f=e[15];const u=Q(f);let m;e[16]!==t||e[17]!==s?(m=async g=>{await N(F(t.slug,s,"file",{path:g}),{method:"DELETE"})},e[16]=t,e[17]=s,e[18]=m):m=e[18];let w;e[19]!==i||e[20]!==m?(w={mutationFn:m,onSuccess:i},e[19]=i,e[20]=m,e[21]=w):w=e[21];const j=Q(w);let b;return e[22]!==u||e[23]!==j||e[24]!==c?(b={upload:c,mkdir:u,remove:j},e[22]=u,e[23]=j,e[24]=c,e[25]=b):b=e[25],b}function qe(s){if(!s||s.includes("\\")||s.includes("..")||s.includes("\0"))return!0;try{const e=decodeURIComponent(s);if(e.includes("\\")||e.includes("..")||e.includes("\0"))return!0;if(e!==s&&e.includes("/")){const t=(s.match(/\//g)??[]).length;if((e.match(/\//g)??[]).length>t)return!0}return!1}catch{return!0}}function Le(s){if(qe(s))throw new Error(`Invalid block key: ${s||"(empty)"}`)}function Ie(s){try{return decodeURIComponent(s)}catch{return s}}function Be(s){return Le(s),encodeURIComponent(s)}function Ae(s){return`.deco/blocks/${Be(s)}.json`}function Dt(s){return`/${Ae(s)}`}const Pt=1e4,Ke=3;function J(s){return s.trim()?(s.startsWith("/")?s:`/${s}`).replace(/\/+/g,"/"):"/"}function te(s){return s.startsWith("/")?s.slice(1):s}function Y(s){return s.trim()?s.startsWith("/")?s:`/${s}`:"/"}function He(s){const e=Y(s);if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.pop(),t.length===0?"/":`/${t.join("/")}`}function Ut(s,e){const t=e.replace(/^\/+|\/+$/g,"");return Y(t?`${s==="/"?"":s}/${t}`:s)}function Ot(s,e){return e==="directory"?s:He(s)}function zt(s){const e=s.trim();return e?e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0")?"Name cannot contain /, \\, or ..":e.startsWith(".")?"Name cannot start with a dot":null:"Name is required"}function Ve(s){const e=te(s);return e?e.split("/").filter(Boolean).length:0}function Rt(s,e,t,n=!1){return{files:[...new Set([...s,...t.files])],directories:[...new Set([...e,...t.directories??[]])],truncated:n||!!t.truncated}}function _t(s,e){return Ve(s)>Ke&&!e.has(s)}function Wt(s,e,t=[]){const n=te(s);if(e.includes(n)||t.includes(n))return!0;if(!n)return!1;const r=`${n}/`;return e.some(i=>i.startsWith(r))||t.some(i=>i.startsWith(r))}function qt(s){const e=te(s),t=".deco/blocks/";if(!e.startsWith(t)||!e.endsWith(".json"))return null;const n=e.slice(t.length,-5);return Ie(n)}function Xe(s){if(!s)return"plaintext";const e=s.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?"typescript":e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?"javascript":e.endsWith(".json")?"json":e.endsWith(".md")||e.endsWith(".mdx")?"markdown":e.endsWith(".css")?"css":e.endsWith(".scss")?"scss":e.endsWith(".html")?"html":e.endsWith(".yaml")||e.endsWith(".yml")?"yaml":e.endsWith(".xml")||e.endsWith(".svg")?"xml":e.endsWith(".py")?"python":e.endsWith(".sql")?"sql":e.endsWith(".sh")?"shell":"plaintext"}function Lt(s){const e=J(s).split("/").filter(Boolean),t=["/"];let n="";for(const r of e.slice(0,-1))n+=`/${r}`,t.push(n);return t}function It(s,e=[]){const t={children:[]},n=i=>{const d=J(i).split("/").filter(Boolean);let c=t,l="";for(const f of d){l+=`/${f}`;let u=c.children.find(m=>m.name===f);u?u.kind==="file"&&(u.kind="directory"):(u={name:f,path:l,kind:"directory",children:[]},c.children.push(u)),c=u}};for(const i of s){const d=J(i).split("/").filter(Boolean);let c=t,l="";d.forEach((f,u)=>{l+=`/${f}`;const m=u===d.length-1;let w=c.children.find(j=>j.name===f);w||(w={name:f,path:l,kind:m?"file":"directory",children:[]},c.children.push(w)),c=w})}for(const i of e)n(Y(i));const r=i=>{i.sort((a,d)=>a.kind!==d.kind?a.kind==="directory"?-1:1:a.name.localeCompare(d.name));for(const a of i)a.children.length>0&&r(a.children)};return r(t.children),t.children}function Ge(s,e,t=0){const n=[];for(const r of s)r.name!==".gitkeep"&&(n.push({node:r,depth:t}),r.kind==="directory"&&r.children.length>0&&e.has(r.path)&&n.push(...Ge(r.children,e,t+1)));return n}function Bt(s){return s.split(`
1
+ import{e as y,q as C,G as ce,a as Q,K as E,n as B,b6 as we,a0 as xe,j as o,l as ge,B as q,r as v,C as ye,c as ee,o as re}from"./index-Cbngzld3.js";import{S as G}from"./skeleton-Cuoq2c8E.js";import{n as Z}from"./Globe01-C8CeCAhz.js";import{l as je,F as ke}from"./index-DEkPGwPd.js";import{F as be,M as ve}from"./file-type-icon-9GbQJJla.js";import{D as Se,a as $e,b as Te,c as ie}from"./dropdown-menu-B8jiZxwT.js";import{b as A,T as K,a as H}from"./tooltip--aN5hOmO.js";import{i as Ee}from"./Check-BUKt5vhH.js";import{a as Ce}from"./Eye-Bk7j3Cz0.js";import{e as Me,f as Fe,a as Ne,b as De}from"./ZoomOut-DVfZ-43U.js";import{i as Pe}from"./LayoutLeft-D3sIkDa-.js";import{n as Ue}from"./LinkExternal01-DNf7UuUK.js";function Oe(s){return s.contentHash??`${s.size}-${s.updatedAt}`}function F(s,e,t,n){const r=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(s)}/fs/${encodeURIComponent(e)}/${t}${r?`?${r}`:""}`}async function N(s,e){const t=await fetch(s,e);if(!t.ok){let n="";try{n=(await t.json()).error??""}catch{}throw new Error(n||`HTTP ${t.status}`)}return t}function vt(s,e){const t=y.c(11),{org:n}=C();let r;t[0]!==n.id||t[1]!==e||t[2]!==s?(r=E.orgFsList(n.id,s,e),t[0]=n.id,t[1]=e,t[2]=s,t[3]=r):r=t[3];let i;t[4]!==n.slug||t[5]!==e||t[6]!==s?(i=async()=>(await(await N(F(n.slug,s,"list",{path:e}))).json()).entries.toSorted(ze),t[4]=n.slug,t[5]=e,t[6]=s,t[7]=i):i=t[7];let a;return t[8]!==r||t[9]!==i?(a={queryKey:r,placeholderData:we,queryFn:i},t[8]=r,t[9]=i,t[10]=a):a=t[10],B(a)}function ze(s,e){return s.kind!==e.kind?s.kind==="dir"?-1:1:s.path.localeCompare(e.path)}function St(s,e,t){const n=y.c(15),{org:r}=C();let i;n[0]!==r.id||n[1]!==e||n[2]!==s?(i=E.orgFsStat(r.id,s??"",e),n[0]=r.id,n[1]=e,n[2]=s,n[3]=i):i=n[3];const a=s!==null;let d;n[4]!==t?(d=t?.refetchIntervalWhenAbsent?f=>f.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,n[4]=t,n[5]=d):d=n[5];let c;n[6]!==r.slug||n[7]!==e||n[8]!==s?(c=async()=>{const f=await fetch(F(r.slug,s??"","stat",{path:e}));if(f.status===404)return null;if(!f.ok)throw new Error(`HTTP ${f.status}`);return(await f.json()).entry},n[6]=r.slug,n[7]=e,n[8]=s,n[9]=c):c=n[9];let l;return n[10]!==i||n[11]!==a||n[12]!==d||n[13]!==c?(l={queryKey:i,enabled:a,refetchInterval:d,queryFn:c},n[10]=i,n[11]=a,n[12]=d,n[13]=c,n[14]=l):l=n[14],B(l)}function $t(s){const e=y.c(9),{org:t}=C();let n;e[0]!==t.id||e[1]!==s?(n=E.orgFsUsage(t.id,s),e[0]=t.id,e[1]=s,e[2]=n):n=e[2];let r;e[3]!==t.slug||e[4]!==s?(r=async()=>await(await N(F(t.slug,s,"usage"))).json(),e[3]=t.slug,e[4]=s,e[5]=r):r=e[5];let i;return e[6]!==n||e[7]!==r?(i={queryKey:n,queryFn:r},e[6]=n,e[7]=r,e[8]=i):i=e[8],B(i)}function Tt(s,e){const t=y.c(9),n=s===void 0?60:s,{org:r}=C();let i;t[0]!==r.id?(i=E.orgFsRecent(r.id),t[0]=r.id,t[1]=i):i=t[1];const a=e?.enabled;let d;t[2]!==n||t[3]!==r.slug?(d=async()=>(await(await N(`/api/${encodeURIComponent(r.slug)}/fs/recent?limit=${n}`)).json()).entries,t[2]=n,t[3]=r.slug,t[4]=d):d=t[4];let c;return t[5]!==i||t[6]!==a||t[7]!==d?(c={queryKey:i,enabled:a,queryFn:d},t[5]=i,t[6]=a,t[7]=d,t[8]=c):c=t[8],B(c)}function Et(s){const e=y.c(8),{org:t}=C();let n;e[0]!==t.id?(n=E.orgFsSkills(t.id),e[0]=t.id,e[1]=n):n=e[1];const r=s?.enabled;let i;e[2]!==t.slug?(i=async()=>{const d=await N(`/api/${encodeURIComponent(t.slug)}/fs/public-sets`),{sets:c}=await d.json(),l=["home",...c.map(_e)];return(await Promise.all(l.map(async u=>{const m=await N(F(t.slug,u,"list",{path:""})),{entries:w}=await m.json();return w.filter(Re).map(j=>({volume:u,path:j.path}))}))).flat()},e[2]=t.slug,e[3]=i):i=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==i?(a={queryKey:n,enabled:r,queryFn:i},e[4]=n,e[5]=r,e[6]=i,e[7]=a):a=e[7],B(a)}function Re(s){return s.kind==="dir"&&s.hasSkill}function _e(s){return`public-${s}`}function Ct(){const s=y.c(7),{org:e}=C();let t;s[0]!==e.id?(t=E.orgFsPublicSets(e.id),s[0]=e.id,s[1]=t):t=s[1];let n;s[2]!==e.slug?(n=async()=>(await(await N(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,s[2]=e.slug,s[3]=n):n=s[3];let r;return s[4]!==t||s[5]!==n?(r={queryKey:t,staleTime:3e5,queryFn:n},s[4]=t,s[5]=n,s[6]=r):r=s[6],B(r)}function Mt(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t.slug||e[1]!==s?(n=r=>F(t.slug,s,"read",{path:r}),e[0]=t.slug,e[1]=s,e[2]=n):n=e[2],n}function Ft(){const s=y.c(2),{org:e}=C();let t;return s[0]!==e.slug?(t=(n,r)=>F(e.slug,n,"read",{path:r}),s[0]=e.slug,s[1]=t):t=s[1],t}function We(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t||e[1]!==s?(n={mutationFn:async r=>(await(await N(F(t.slug,s,"file",{path:r.path}),{method:"PUT",headers:{"content-type":r.contentType??"text/html; charset=utf-8"},body:r.body})).json()).entry},e[0]=t,e[1]=s,e[2]=n):n=e[2],Q(n)}function Nt(s){const e=y.c(26),{org:t}=C(),n=ce();let r;e[0]!==t||e[1]!==n||e[2]!==s?(r=()=>{n.invalidateQueries({queryKey:E.orgFsVolume(t.id,s)}),n.invalidateQueries({queryKey:E.orgFsRecent(t.id)})},e[0]=t,e[1]=n,e[2]=s,e[3]=r):r=e[3];const i=r;let a;e[4]!==t||e[5]!==s?(a=async g=>{for(const k of g.files){const S=g.dir?`${g.dir}/${k.name}`:k.name;await N(F(t.slug,s,"file",{path:S}),{method:"PUT",headers:{"content-type":k.type||"application/octet-stream"},body:k})}},e[4]=t,e[5]=s,e[6]=a):a=e[6];let d;e[7]!==i||e[8]!==a?(d={mutationFn:a,onSettled:i},e[7]=i,e[8]=a,e[9]=d):d=e[9];const c=Q(d);let l;e[10]!==t||e[11]!==s?(l=async g=>{await N(F(t.slug,s,"dir",{path:g}),{method:"POST"})},e[10]=t,e[11]=s,e[12]=l):l=e[12];let f;e[13]!==i||e[14]!==l?(f={mutationFn:l,onSuccess:i},e[13]=i,e[14]=l,e[15]=f):f=e[15];const u=Q(f);let m;e[16]!==t||e[17]!==s?(m=async g=>{await N(F(t.slug,s,"file",{path:g}),{method:"DELETE"})},e[16]=t,e[17]=s,e[18]=m):m=e[18];let w;e[19]!==i||e[20]!==m?(w={mutationFn:m,onSuccess:i},e[19]=i,e[20]=m,e[21]=w):w=e[21];const j=Q(w);let b;return e[22]!==u||e[23]!==j||e[24]!==c?(b={upload:c,mkdir:u,remove:j},e[22]=u,e[23]=j,e[24]=c,e[25]=b):b=e[25],b}function qe(s){if(!s||s.includes("\\")||s.includes("..")||s.includes("\0"))return!0;try{const e=decodeURIComponent(s);if(e.includes("\\")||e.includes("..")||e.includes("\0"))return!0;if(e!==s&&e.includes("/")){const t=(s.match(/\//g)??[]).length;if((e.match(/\//g)??[]).length>t)return!0}return!1}catch{return!0}}function Le(s){if(qe(s))throw new Error(`Invalid block key: ${s||"(empty)"}`)}function Ie(s){try{return decodeURIComponent(s)}catch{return s}}function Be(s){return Le(s),encodeURIComponent(s)}function Ae(s){return`.deco/blocks/${Be(s)}.json`}function Dt(s){return`/${Ae(s)}`}const Pt=1e4,Ke=3;function J(s){return s.trim()?(s.startsWith("/")?s:`/${s}`).replace(/\/+/g,"/"):"/"}function te(s){return s.startsWith("/")?s.slice(1):s}function Y(s){return s.trim()?s.startsWith("/")?s:`/${s}`:"/"}function He(s){const e=Y(s);if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.pop(),t.length===0?"/":`/${t.join("/")}`}function Ut(s,e){const t=e.replace(/^\/+|\/+$/g,"");return Y(t?`${s==="/"?"":s}/${t}`:s)}function Ot(s,e){return e==="directory"?s:He(s)}function zt(s){const e=s.trim();return e?e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0")?"Name cannot contain /, \\, or ..":e.startsWith(".")?"Name cannot start with a dot":null:"Name is required"}function Ve(s){const e=te(s);return e?e.split("/").filter(Boolean).length:0}function Rt(s,e,t,n=!1){return{files:[...new Set([...s,...t.files])],directories:[...new Set([...e,...t.directories??[]])],truncated:n||!!t.truncated}}function _t(s,e){return Ve(s)>Ke&&!e.has(s)}function Wt(s,e,t=[]){const n=te(s);if(e.includes(n)||t.includes(n))return!0;if(!n)return!1;const r=`${n}/`;return e.some(i=>i.startsWith(r))||t.some(i=>i.startsWith(r))}function qt(s){const e=te(s),t=".deco/blocks/";if(!e.startsWith(t)||!e.endsWith(".json"))return null;const n=e.slice(t.length,-5);return Ie(n)}function Xe(s){if(!s)return"plaintext";const e=s.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?"typescript":e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?"javascript":e.endsWith(".json")?"json":e.endsWith(".md")||e.endsWith(".mdx")?"markdown":e.endsWith(".css")?"css":e.endsWith(".scss")?"scss":e.endsWith(".html")?"html":e.endsWith(".yaml")||e.endsWith(".yml")?"yaml":e.endsWith(".xml")||e.endsWith(".svg")?"xml":e.endsWith(".py")?"python":e.endsWith(".sql")?"sql":e.endsWith(".sh")?"shell":"plaintext"}function Lt(s){const e=J(s).split("/").filter(Boolean),t=["/"];let n="";for(const r of e.slice(0,-1))n+=`/${r}`,t.push(n);return t}function It(s,e=[]){const t={children:[]},n=i=>{const d=J(i).split("/").filter(Boolean);let c=t,l="";for(const f of d){l+=`/${f}`;let u=c.children.find(m=>m.name===f);u?u.kind==="file"&&(u.kind="directory"):(u={name:f,path:l,kind:"directory",children:[]},c.children.push(u)),c=u}};for(const i of s){const d=J(i).split("/").filter(Boolean);let c=t,l="";d.forEach((f,u)=>{l+=`/${f}`;const m=u===d.length-1;let w=c.children.find(j=>j.name===f);w||(w={name:f,path:l,kind:m?"file":"directory",children:[]},c.children.push(w)),c=w})}for(const i of e)n(Y(i));const r=i=>{i.sort((a,d)=>a.kind!==d.kind?a.kind==="directory"?-1:1:a.name.localeCompare(d.name));for(const a of i)a.children.length>0&&r(a.children)};return r(t.children),t.children}function Ge(s,e,t=0){const n=[];for(const r of s)r.name!==".gitkeep"&&(n.push({node:r,depth:t}),r.kind==="directory"&&r.children.length>0&&e.has(r.path)&&n.push(...Ge(r.children,e,t+1)));return n}function Bt(s){return s.split(`
2
2
  `).map(e=>{const t=e.match(/^\d+\t(.*)/);return t?t[1]:e}).join(`
3
3
  `)}je.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function Qe(s){const e=y.c(11),{value:t,filename:n}=s,[r]=xe(),i=r.theme==="dark"||r.theme==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;let a;e[0]!==n?(a=Xe(n),e[0]=n,e[1]=a):a=e[1];const d=i?"vs-dark":"light";let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsx(ge,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2];let l,f;e[3]===Symbol.for("react.memo_cache_sentinel")?(l={enabled:!1},f={top:12,bottom:12},e[3]=l,e[4]=f):(l=e[3],f=e[4]);let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u={readOnly:!0,domReadOnly:!0,fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:3,wordWrap:"on",minimap:l,padding:f,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}},e[5]=u):u=e[5];let m;return e[6]!==n||e[7]!==a||e[8]!==d||e[9]!==t?(m=o.jsx(ke,{path:n,language:a,value:t,theme:d,loading:c,options:u},n),e[6]=n,e[7]=a,e[8]=d,e[9]=t,e[10]=m):m=e[10],m}function Ye(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}const Ze=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),Je=new Set(["txt","json","csv","tsv","log","yaml","yml","xml","toml","ts","tsx","js","jsx","py","rb","go","rs","java","sh","sql"]),oe=2*1024*1024;function et(s,e){const t=s.split(".").pop()?.toLowerCase()??"";return Ze.has(t)?"image":t==="pdf"?"pdf":t==="html"||t==="htm"?"html":t==="md"||t==="markdown"?e<=oe?"markdown":"download":Je.has(t)&&e<=oe?"text":"download"}function tt(){const s=y.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(G,{className:"h-6 w-2/3"}),s[0]=e):e=s[0];let t;return s[1]===Symbol.for("react.memo_cache_sentinel")?(t=o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsxs("div",{className:"flex w-3/4 max-w-md flex-col gap-3 p-6",children:[e,o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx(G,{className:"h-3 w-full"}),o.jsx(G,{className:"h-3 w-5/6"}),o.jsx(G,{className:"h-3 w-2/3"})]})]})}),s[1]=t):t=s[1],t}function de(s){const e=y.c(20),{file:t,note:n}=s;let r;e[0]!==t.filename?(r=o.jsx(be,{filename:t.filename,className:"h-12 w-10"}),e[0]=t.filename,e[1]=r):r=e[1];let i;e[2]!==t.filename?(i=o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.filename}),e[2]=t.filename,e[3]=i):i=e[3];let a;e[4]!==t.size?(a=Ye(t.size),e[4]=t.size,e[5]=a):a=e[5];const d=n?` · ${n}`:"";let c;e[6]!==a||e[7]!==d?(c=o.jsxs("span",{className:"text-xs text-muted-foreground",children:[a,d]}),e[6]=a,e[7]=d,e[8]=c):c=e[8];let l;e[9]!==i||e[10]!==c?(l=o.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[i,c]}),e[9]=i,e[10]=c,e[11]=l):l=e[11];let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Z,{size:14}),e[12]=f):f=e[12];let u;e[13]!==t.downloadUrl||e[14]!==t.filename?(u=o.jsx(q,{asChild:!0,variant:"outline",size:"sm",children:o.jsxs("a",{href:t.downloadUrl,download:t.filename,children:[f,"Download"]})}),e[13]=t.downloadUrl,e[14]=t.filename,e[15]=u):u=e[15];let m;return e[16]!==r||e[17]!==l||e[18]!==u?(m=o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-border bg-muted/30 px-10 py-8",children:[r,l,u]})}),e[16]=r,e[17]=l,e[18]=u,e[19]=m):m=e[19],m}function le(s){const e=y.c(16),{file:t,markdown:n}=s;let r;e[0]!==t.downloadUrl?(r=E.fileText(t.downloadUrl),e[0]=t.downloadUrl,e[1]=r):r=e[1];let i;e[2]!==t.downloadUrl?(i=async()=>{const u=await fetch(t.downloadUrl,{credentials:"include"});if(!u.ok)throw new Error(`fetch failed: ${u.status}`);return u.text()},e[2]=t.downloadUrl,e[3]=i):i=e[3];let a;e[4]!==r||e[5]!==i?(a={queryKey:r,queryFn:i,staleTime:6e4,retry:!1},e[4]=r,e[5]=i,e[6]=a):a=e[6];const{data:d,isPending:c,isError:l}=B(a);if(c){let u;return e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(tt,{}),e[7]=u):u=e[7],u}if(l||d===void 0){let u;return e[8]!==t?(u=o.jsx(de,{file:t,note:"preview unavailable"}),e[8]=t,e[9]=u):u=e[9],u}if(n){const u=`file-preview-${t.key}`;let m;return e[10]!==d||e[11]!==u?(m=o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm dark:prose-invert mx-auto max-w-3xl px-6 py-6",children:o.jsx(ve,{id:u,text:d})})}),e[10]=d,e[11]=u,e[12]=m):m=e[12],m}let f;return e[13]!==d||e[14]!==t.filename?(f=o.jsx(Qe,{value:d,filename:t.filename}),e[13]=d,e[14]=t.filename,e[15]=f):f=e[15],f}function At(s){const e=y.c(15),{file:t}=s;switch(et(t.filename,t.size)){case"image":{let r;return e[0]!==t.downloadUrl||e[1]!==t.filename?(r=o.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-auto bg-muted/30 p-4",children:o.jsx("img",{src:t.downloadUrl,alt:t.filename,className:"max-h-full max-w-full rounded-lg object-contain"})}),e[0]=t.downloadUrl,e[1]=t.filename,e[2]=r):r=e[2],r}case"pdf":{let r;return e[3]!==t.downloadUrl||e[4]!==t.filename?(r=o.jsx("iframe",{src:t.downloadUrl,title:t.filename,className:"block h-full w-full bg-white"}),e[3]=t.downloadUrl,e[4]=t.filename,e[5]=r):r=e[5],r}case"html":{let r;return e[6]!==t.downloadUrl||e[7]!==t.filename?(r=o.jsx("iframe",{src:t.downloadUrl,title:t.filename,sandbox:"allow-scripts",className:"block h-full w-full bg-white"}),e[6]=t.downloadUrl,e[7]=t.filename,e[8]=r):r=e[8],r}case"markdown":{let r;return e[9]!==t?(r=o.jsx(le,{file:t,markdown:!0}),e[9]=t,e[10]=r):r=e[10],r}case"text":{let r;return e[11]!==t?(r=o.jsx(le,{file:t,markdown:!1}),e[11]=t,e[12]=r):r=e[12],r}default:{let r;return e[13]!==t?(r=o.jsx(de,{file:t}),e[13]=t,e[14]=r):r=e[14],r}}}function st(s){const e=y.c(53),{readUrl:t,editor:n,downloadName:r,trailing:i}=s,[a,d]=v.useState(!1);let c;e[0]!==t?(c=new URL(t,window.location.origin).toString(),e[0]=t,e[1]=c):c=e[1];const l=c;let f;e[2]!==l?(f=()=>{navigator.clipboard.writeText(l),d(!0),window.setTimeout(()=>d(!1),1500)},e[2]=l,e[3]=f):f=e[3];const u=f;let m;e[4]!==n?(m=n.deckDetected&&o.jsxs(A,{children:[o.jsx(K,{asChild:!0,children:o.jsx(q,{variant:n.railOpen?"secondary":"ghost",size:"icon","aria-label":n.railOpen?"Hide slide list":"Show slide list",onClick:()=>n.setRailOpen(!n.railOpen),children:o.jsx(Pe,{size:14})})}),o.jsx(H,{side:"bottom",children:n.railOpen?"Hide slide list":"Show slide list"})]}),e[4]=n,e[5]=m):m=e[5];let w;e[6]!==l?(w=()=>window.open(l,"_blank","noopener"),e[6]=l,e[7]=w):w=e[7];let j;e[8]!==l?(j=o.jsx("span",{className:"truncate",children:l}),e[8]=l,e[9]=j):j=e[9];let b;e[10]!==l||e[11]!==w||e[12]!==j?(b=o.jsx("button",{type:"button",onClick:w,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:l,children:j}),e[10]=l,e[11]=w,e[12]=j,e[13]=b):b=e[13];let g;e[14]!==n.agentUpdated||e[15]!==n.reload?(g=n.agentUpdated&&o.jsxs(A,{children:[o.jsx(K,{asChild:!0,children:o.jsxs(q,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(ye,{size:12}),"Agent updated — reload"]})}),o.jsx(H,{side:"bottom",children:"The agent rewrote this deck while you were editing. Reloading discards unsaved differences."})]}),e[14]=n.agentUpdated,e[15]=n.reload,e[16]=g):g=e[16];let k;e[17]!==n.saving?(k=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"Saving…"}),e[17]=n.saving,e[18]=k):k=e[18];let S;e[19]!==n?(S=n.deckDetected&&n.writable&&o.jsxs(A,{children:[o.jsx(K,{asChild:!0,children:o.jsx(q,{variant:n.editMode?"secondary":"ghost",size:"icon","aria-label":n.editMode?"Done editing":"Edit inline",className:ee(n.editMode&&"text-primary"),onClick:()=>n.setEditMode(!n.editMode),children:o.jsx(Me,{size:14})})}),o.jsx(H,{side:"bottom",children:n.editMode?"Done editing":"Edit inline (text, reorder, delete)"})]}),e[19]=n,e[20]=S):S=e[20];let M;e[21]!==l||e[22]!==r||e[23]!==n.deckDetected?(M=n.deckDetected?o.jsxs(Se,{children:[o.jsx($e,{asChild:!0,children:o.jsx(q,{variant:"ghost",size:"icon","aria-label":"Download",children:o.jsx(Z,{size:14})})}),o.jsxs(Te,{align:"end",children:[o.jsxs(ie,{onClick:()=>window.open(`${l}#print`,"_blank","noopener"),children:[o.jsx(Fe,{size:14}),"Export as PDF"]}),o.jsx(ie,{asChild:!0,children:o.jsxs("a",{href:l,download:r,children:[o.jsx(Ne,{size:14}),"Download HTML"]})})]})]}):o.jsxs(A,{children:[o.jsx(K,{asChild:!0,children:o.jsx(q,{variant:"ghost",size:"icon","aria-label":"Download",asChild:!0,children:o.jsx("a",{href:l,download:r,children:o.jsx(Z,{size:14})})})}),o.jsx(H,{side:"bottom",children:"Download"})]}),e[21]=l,e[22]=r,e[23]=n.deckDetected,e[24]=M):M=e[24];let P;e[25]!==a?(P=a?o.jsx(Ee,{size:14}):o.jsx(Ce,{size:14}),e[25]=a,e[26]=P):P=e[26];let U;e[27]!==u||e[28]!==P?(U=o.jsx(K,{asChild:!0,children:o.jsx(q,{variant:"ghost",size:"icon","aria-label":"Copy URL",onClick:u,children:P})}),e[27]=u,e[28]=P,e[29]=U):U=e[29];const X=a?"Copied":"Copy URL";let p;e[30]!==X?(p=o.jsx(H,{side:"bottom",children:X}),e[30]=X,e[31]=p):p=e[31];let O;e[32]!==U||e[33]!==p?(O=o.jsxs(A,{children:[U,p]}),e[32]=U,e[33]=p,e[34]=O):O=e[34];let D;e[35]!==l?(D=()=>window.open(l,"_blank","noopener"),e[35]=l,e[36]=D):D=e[36];let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Ue,{size:14}),e[37]=$):$=e[37];let T;e[38]!==D?(T=o.jsx(K,{asChild:!0,children:o.jsx(q,{variant:"ghost",size:"icon","aria-label":"Open in new tab",onClick:D,children:$})}),e[38]=D,e[39]=T):T=e[39];let I;e[40]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(H,{side:"bottom",children:"Open in new tab"}),e[40]=I):I=e[40];let z;e[41]!==T?(z=o.jsxs(A,{children:[T,I]}),e[41]=T,e[42]=z):z=e[42];let R;return e[43]!==M||e[44]!==O||e[45]!==z||e[46]!==m||e[47]!==b||e[48]!==g||e[49]!==k||e[50]!==S||e[51]!==i?(R=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[m,b,g,k,S,M,O,z,i]}),e[43]=M,e[44]=O,e[45]=z,e[46]=m,e[47]=b,e[48]=g,e[49]=k,e[50]=S,e[51]=i,e[52]=R):R=e[52],R}const V=1;function nt(s){if(typeof s!="object"||s===null||s.v!==V||s.source!=="deck-viewer")return null;const e=s;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class L extends Error{constructor(e,t){super(e),this.code=t,this.name="DeckOpError"}code}function ue(s){return[...s.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function rt(s){const t=new DOMParser().parseFromString(s,"text/html").querySelector("deck-viewer");return t?ue(t).length:null}function it(s,e){const t=new DOMParser().parseFromString(s,"text/html"),n=t.querySelector("deck-viewer");if(!n)throw new L("no <deck-viewer> element in source","no-viewer");const r=ue(n),i=e.kind==="move"?e.from:e.at,a=r[i];if(!a)throw new L(`slide index ${i} out of range (${r.length})`,"stale-index");switch(e.kind){case"remove":{if(r.length<=1)throw new L("cannot remove the last slide","bad-op");a.remove();break}case"duplicate":{const c=a.cloneNode(!0);c.removeAttribute("id");for(const l of c.querySelectorAll("[id]"))l.removeAttribute("id");a.after(c);break}case"move":{if(e.to<0||e.to>=r.length)throw new L(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?r[e.to]:r[e.to].nextSibling;n.insertBefore(a,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new L(`invalid attribute name: ${e.name}`,"bad-op");a.setAttribute(e.name,e.value);break}case"remove-attr":{a.removeAttribute(e.name);break}case"replace":{const l=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!l)throw new L("replace html has no root element","bad-op");a.replaceWith(t.importNode(l,!0));break}default:throw new L(`unknown op kind: ${e.kind}`,"bad-op")}return`${s.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
4
4
  `:""}${t.documentElement.outerHTML}
@@ -1 +1 @@
1
- import{r as c,j as d,dm as M,a7 as F,a8 as f,dp as T,ag as $,bk as O,bx as I,dq as U,dr as W,dt as z,dn as B,bh as G,dl as K,e as E,c as q}from"./index-rZ1TPVyD.js";var w,b="HoverCard",[N]=$(b,[T]),R=T(),[V,S]=N(b),_=o=>{const{__scopeHoverCard:e,children:t,open:r,defaultOpen:a,onOpenChange:s,openDelay:l=700,closeDelay:u=300}=o,i=R(e),p=c.useRef(0),v=c.useRef(0),C=c.useRef(!1),h=c.useRef(!1),[m,n]=G({prop:r,defaultProp:a??!1,onChange:s,caller:b}),x=c.useCallback(()=>{clearTimeout(v.current),p.current=window.setTimeout(()=>n(!0),l)},[l,n]),L=c.useCallback(()=>{clearTimeout(p.current),!C.current&&!h.current&&(v.current=window.setTimeout(()=>n(!1),u))},[u,n]),k=c.useCallback(()=>n(!1),[n]);return c.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(v.current)},[]),d.jsx(V,{scope:e,open:m,onOpenChange:n,onOpen:x,onClose:L,onDismiss:k,hasSelectionRef:C,isPointerDownOnContentRef:h,children:d.jsx(K,{...i,children:t})})};_.displayName=b;var y="HoverCardTrigger",D=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=S(y,t),s=R(t);return d.jsx(M,{asChild:!0,...s,children:d.jsx(F.a,{"data-state":a.open?"open":"closed",...r,ref:e,onPointerEnter:f(o.onPointerEnter,P(a.onOpen)),onPointerLeave:f(o.onPointerLeave,P(a.onClose)),onFocus:f(o.onFocus,a.onOpen),onBlur:f(o.onBlur,a.onClose),onTouchStart:f(o.onTouchStart,l=>l.preventDefault())})})});D.displayName=y;var H="HoverCardPortal",[J,Q]=N(H,{forceMount:void 0}),j=o=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:a}=o,s=S(H,e);return d.jsx(J,{scope:e,forceMount:t,children:d.jsx(O,{present:t||s.open,children:d.jsx(B,{asChild:!0,container:a,children:r})})})};j.displayName=H;var g="HoverCardContent",A=c.forwardRef((o,e)=>{const t=Q(g,o.__scopeHoverCard),{forceMount:r=t.forceMount,...a}=o,s=S(g,o.__scopeHoverCard);return d.jsx(O,{present:r||s.open,children:d.jsx(X,{"data-state":s.open?"open":"closed",...a,onPointerEnter:f(o.onPointerEnter,P(s.onOpen)),onPointerLeave:f(o.onPointerLeave,P(s.onClose)),ref:e})})});A.displayName=g;var X=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,...u}=o,i=S(g,t),p=R(t),v=c.useRef(null),C=I(e,v),[h,m]=c.useState(!1);return c.useEffect(()=>{if(h){const n=document.body;return w=n.style.userSelect||n.style.webkitUserSelect,n.style.userSelect="none",n.style.webkitUserSelect="none",()=>{n.style.userSelect=w,n.style.webkitUserSelect=w}}},[h]),c.useEffect(()=>{if(v.current){const n=()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(i.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointerup",n),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),c.useEffect(()=>{v.current&&ee(v.current).forEach(x=>x.setAttribute("tabindex","-1"))}),d.jsx(U,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:f(s,n=>{n.preventDefault()}),onDismiss:i.onDismiss,children:d.jsx(W,{...p,...u,onPointerDown:f(u.onPointerDown,n=>{n.currentTarget.contains(n.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:C,style:{...u.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=R(t);return d.jsx(z,{...a,...r,ref:e})});Z.displayName=Y;function P(o){return e=>e.pointerType==="touch"?void 0:o()}function ee(o){const e=[],t=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();)e.push(t.currentNode);return e}var te=_,oe=D,re=j,ne=A;function se(o){const e=E.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=d.jsx(te,{"data-slot":"hover-card",...t}),e[2]=t,e[3]=r):r=e[3],r}function ie(o){const e=E.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=d.jsx(oe,{"data-slot":"hover-card-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function ce(o){const e=E.c(12);let t,r,a,s;e[0]!==o?({className:t,align:a,sideOffset:s,...r}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=a,e[4]=s):(t=e[1],r=e[2],a=e[3],s=e[4]);const l=a===void 0?"center":a,u=s===void 0?4:s;let i;e[5]!==t?(i=q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),e[5]=t,e[6]=i):i=e[6];let p;return e[7]!==l||e[8]!==r||e[9]!==u||e[10]!==i?(p=d.jsx(re,{"data-slot":"hover-card-portal",children:d.jsx(ne,{"data-slot":"hover-card-content",align:l,sideOffset:u,className:i,...r})}),e[7]=l,e[8]=r,e[9]=u,e[10]=i,e[11]=p):p=e[11],p}export{ie as H,ce as a,se as b};
1
+ import{r as c,j as d,dm as M,a7 as F,a8 as f,dp as T,ag as $,bk as O,bx as I,dq as U,dr as W,dt as z,dn as B,bh as G,dl as K,e as E,c as q}from"./index-Cbngzld3.js";var w,b="HoverCard",[N]=$(b,[T]),R=T(),[V,S]=N(b),_=o=>{const{__scopeHoverCard:e,children:t,open:r,defaultOpen:a,onOpenChange:s,openDelay:l=700,closeDelay:u=300}=o,i=R(e),p=c.useRef(0),v=c.useRef(0),C=c.useRef(!1),h=c.useRef(!1),[m,n]=G({prop:r,defaultProp:a??!1,onChange:s,caller:b}),x=c.useCallback(()=>{clearTimeout(v.current),p.current=window.setTimeout(()=>n(!0),l)},[l,n]),L=c.useCallback(()=>{clearTimeout(p.current),!C.current&&!h.current&&(v.current=window.setTimeout(()=>n(!1),u))},[u,n]),k=c.useCallback(()=>n(!1),[n]);return c.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(v.current)},[]),d.jsx(V,{scope:e,open:m,onOpenChange:n,onOpen:x,onClose:L,onDismiss:k,hasSelectionRef:C,isPointerDownOnContentRef:h,children:d.jsx(K,{...i,children:t})})};_.displayName=b;var y="HoverCardTrigger",D=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=S(y,t),s=R(t);return d.jsx(M,{asChild:!0,...s,children:d.jsx(F.a,{"data-state":a.open?"open":"closed",...r,ref:e,onPointerEnter:f(o.onPointerEnter,P(a.onOpen)),onPointerLeave:f(o.onPointerLeave,P(a.onClose)),onFocus:f(o.onFocus,a.onOpen),onBlur:f(o.onBlur,a.onClose),onTouchStart:f(o.onTouchStart,l=>l.preventDefault())})})});D.displayName=y;var H="HoverCardPortal",[J,Q]=N(H,{forceMount:void 0}),j=o=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:a}=o,s=S(H,e);return d.jsx(J,{scope:e,forceMount:t,children:d.jsx(O,{present:t||s.open,children:d.jsx(B,{asChild:!0,container:a,children:r})})})};j.displayName=H;var g="HoverCardContent",A=c.forwardRef((o,e)=>{const t=Q(g,o.__scopeHoverCard),{forceMount:r=t.forceMount,...a}=o,s=S(g,o.__scopeHoverCard);return d.jsx(O,{present:r||s.open,children:d.jsx(X,{"data-state":s.open?"open":"closed",...a,onPointerEnter:f(o.onPointerEnter,P(s.onOpen)),onPointerLeave:f(o.onPointerLeave,P(s.onClose)),ref:e})})});A.displayName=g;var X=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,...u}=o,i=S(g,t),p=R(t),v=c.useRef(null),C=I(e,v),[h,m]=c.useState(!1);return c.useEffect(()=>{if(h){const n=document.body;return w=n.style.userSelect||n.style.webkitUserSelect,n.style.userSelect="none",n.style.webkitUserSelect="none",()=>{n.style.userSelect=w,n.style.webkitUserSelect=w}}},[h]),c.useEffect(()=>{if(v.current){const n=()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(i.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointerup",n),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),c.useEffect(()=>{v.current&&ee(v.current).forEach(x=>x.setAttribute("tabindex","-1"))}),d.jsx(U,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:f(s,n=>{n.preventDefault()}),onDismiss:i.onDismiss,children:d.jsx(W,{...p,...u,onPointerDown:f(u.onPointerDown,n=>{n.currentTarget.contains(n.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:C,style:{...u.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=R(t);return d.jsx(z,{...a,...r,ref:e})});Z.displayName=Y;function P(o){return e=>e.pointerType==="touch"?void 0:o()}function ee(o){const e=[],t=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();)e.push(t.currentNode);return e}var te=_,oe=D,re=j,ne=A;function se(o){const e=E.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=d.jsx(te,{"data-slot":"hover-card",...t}),e[2]=t,e[3]=r):r=e[3],r}function ie(o){const e=E.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=d.jsx(oe,{"data-slot":"hover-card-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function ce(o){const e=E.c(12);let t,r,a,s;e[0]!==o?({className:t,align:a,sideOffset:s,...r}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=a,e[4]=s):(t=e[1],r=e[2],a=e[3],s=e[4]);const l=a===void 0?"center":a,u=s===void 0?4:s;let i;e[5]!==t?(i=q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),e[5]=t,e[6]=i):i=e[6];let p;return e[7]!==l||e[8]!==r||e[9]!==u||e[10]!==i?(p=d.jsx(re,{"data-slot":"hover-card-portal",children:d.jsx(ne,{"data-slot":"hover-card-content",align:l,sideOffset:u,className:i,...r})}),e[7]=l,e[8]=r,e[9]=u,e[10]=i,e[11]=p):p=e[11],p}export{ie as H,ce as a,se as b};
@@ -1 +1 @@
1
- import{e as w,q as be,a as Ne,K as ke,j as t,E as we,r as $,c as de,B as Y,l as Ce,P as Se,o as Q}from"./index-rZ1TPVyD.js";import{a as H}from"./Tool01-B0zT3ots.js";import{s as _e}from"./Trash01-Bifm5Wb3.js";import{i as fe}from"./Upload01-mjA8r4Fi.js";import{I as Ie}from"./input-BPXWlz46.js";import{L as Pe}from"./label-CzVCjiiL.js";import{i as Ue}from"./AlertCircle-rpaL6q8T.js";import{i as ge}from"./Check-6LmIKXJj.js";import{a as $e}from"./Eye-BNS1RmzG.js";import{i as De}from"./DotsVertical-CvhOKI-w.js";import{H as ze}from"./agent-icon-CpBAbwoh.js";import{n as Fe}from"./LinkExternal01-B6flmd1s.js";import{D as Te,c as Ee,e as Le,b as Oe,a as Ae}from"./dialog-CxpeEAA2.js";import{c as ce,a as Re,D as Be,b as Ge}from"./dropdown-menu-Xj0lVIXK.js";import{S as Me}from"./skeleton-DvVUqja_.js";import{T as Ve,a as Ke,b as qe,c as Je}from"./tabs-B68TQ0Dt.js";import{u as Qe,c as Ye}from"./use-file-configs-DXD_Hwrv.js";import{u as He}from"./useInfiniteQuery-k6dph5MZ.js";import{u as We}from"./studio-tools-jbRVdtpc.js";function Xe(s){if(typeof s=="string")return s;if(!s||typeof s!="object")return"";const e=s;if(Array.isArray(e.variants)){const n=e.variants,l=n.find(o=>o.rule?.__resolveType?.includes("always"));if(typeof l?.value=="string")return l.value;const i=n.find(o=>typeof o.value=="string");if(i)return i.value}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}function Ze(s){const e=w.c(10),{org:n}=be(),l=We();let i;e[0]!==n.id||e[1]!==s.configId?(i=ke.filePickerObjects(n.id,s.configId),e[0]=n.id,e[1]=s.configId,e[2]=i):i=e[2];const o=s.enabled!==!1&&!!s.configId;let a;e[3]!==s.configId||e[4]!==l?(a=async m=>{const{pageParam:c}=m;return await l.call("FILE_OBJECTS_LIST",{configId:s.configId,cursor:c??void 0})},e[3]=s.configId,e[4]=l,e[5]=a):a=e[5];let r;return e[6]!==i||e[7]!==o||e[8]!==a?(r={queryKey:i,enabled:o,staleTime:3e4,initialPageParam:null,queryFn:a,getNextPageParam:et},e[6]=i,e[7]=o,e[8]=a,e[9]=r):r=e[9],He(r)}function et(s){return s.nextCursor??void 0}function je(){const s=w.c(2),{org:e}=be();let n;return s[0]!==e?(n={mutationFn:async l=>{const i=l.file.type||"application/octet-stream",o=await fetch(`/api/${encodeURIComponent(e.slug)}/file-configs/${encodeURIComponent(l.configId)}/upload?filename=${encodeURIComponent(l.file.name)}`,{method:"POST",headers:{"Content-Type":i},body:l.file});if(!o.ok){const a=await o.text().catch(tt);let r=`${o.status} ${o.statusText}`;try{const m=JSON.parse(a);m.message&&(r=m.message)}catch{a&&(r=a.slice(0,200))}throw new Error(`Upload failed: ${r}`)}return await o.json()}},s[0]=e,s[1]=n):n=s[1],Ne(n)}function tt(){return""}const ue="file-picker:last-config-id";function st(s){const e=w.c(18),n=s.mode==="image"?"Pick an image":"Pick a file";let l;e[0]!==n?(l=t.jsx(Ee,{children:n}),e[0]=n,e[1]=l):l=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Le,{children:"Upload a new file or pick one previously uploaded to a configured bucket."}),e[2]=i):i=e[2];let o;e[3]!==l?(o=t.jsxs(Oe,{children:[l,i]}),e[3]=l,e[4]=o):o=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Me,{className:"h-64 w-full"}),e[5]=a):a=e[5];let r;e[6]!==s?(r=d=>{s.onSelect(d),s.onOpenChange(!1)},e[6]=s,e[7]=r):r=e[7];let m;e[8]!==s.mode||e[9]!==r?(m=t.jsx(we,{fallback:nt,children:t.jsx($.Suspense,{fallback:a,children:t.jsx(lt,{mode:s.mode,onSelect:r})})}),e[8]=s.mode,e[9]=r,e[10]=m):m=e[10];let c;e[11]!==o||e[12]!==m?(c=t.jsxs(Ae,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[o,m]}),e[11]=o,e[12]=m,e[13]=c):c=e[13];let p;return e[14]!==s.onOpenChange||e[15]!==s.open||e[16]!==c?(p=t.jsx(Te,{open:s.open,onOpenChange:s.onOpenChange,children:c}),e[14]=s.onOpenChange,e[15]=s.open,e[16]=c,e[17]=p):p=e[17],p}function nt(s){const{error:e}=s;return t.jsx(it,{error:e??new Error("Failed to load buckets")})}function it(s){const e=w.c(3),{error:n}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Ue,{size:16}),e[0]=l):l=e[0];let i;return e[1]!==n.message?(i=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[l,t.jsx("span",{className:"text-sm font-medium",children:n.message})]}),e[1]=n.message,e[2]=i):i=e[2],i}function lt(s){const e=w.c(23),{mode:n,onSelect:l}=s,i=Qe();if(i.length===0){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(at,{}),e[0]=f):f=e[0],f}if(i.length===1){const f=i[0];let g;return e[1]!==f||e[2]!==n||e[3]!==l?(g=t.jsx(pe,{config:f,mode:n,onSelect:l}),e[1]=f,e[2]=n,e[3]=l,e[4]=g):g=e[4],g}let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=typeof window<"u"?window.localStorage.getItem(ue):null,e[5]=o):o=e[5];const a=o;let r;e[6]!==i?(r=i.find(f=>f.id===a)?.id??i[0].id,e[6]=i,e[7]=r):r=e[7];const m=r;let c;e[8]!==i?(c=i.map(rt),e[8]=i,e[9]=c):c=e[9];let p;e[10]!==c?(p=t.jsx(Ke,{className:"self-start",children:c}),e[10]=c,e[11]=p):p=e[11];let d;if(e[12]!==i||e[13]!==n||e[14]!==l){let f;e[16]!==n||e[17]!==l?(f=g=>t.jsx(qe,{value:g.id,className:"min-h-0 flex-1 overflow-hidden",children:t.jsx(pe,{config:g,mode:n,onSelect:l})},g.id),e[16]=n,e[17]=l,e[18]=f):f=e[18],d=i.map(f),e[12]=i,e[13]=n,e[14]=l,e[15]=d}else d=e[15];let x;return e[19]!==m||e[20]!==p||e[21]!==d?(x=t.jsxs(Je,{defaultValue:m,onValueChange:ot,className:"min-h-0 flex-1 flex flex-col",children:[p,d]}),e[19]=m,e[20]=p,e[21]=d,e[22]=x):x=e[22],x}function rt(s){return t.jsx(Ve,{value:s.id,children:s.name},s.id)}function ot(s){typeof window<"u"&&window.localStorage.setItem(ue,s)}function at(){const s=w.c(3);let e,n;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(fe,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No bucket configured"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Add an S3-compatible bucket in Settings before you can upload files."})]}),s[0]=e,s[1]=n):(e=s[0],n=s[1]);let l;return s[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[e,n,t.jsx(Y,{asChild:!0,size:"sm",className:"mt-2",children:t.jsx(Se,{to:"/settings/files",children:"Configure a bucket"})})]}),s[2]=l):l=s[2],l}function pe({config:s,mode:e,onSelect:n}){const l=Ze({configId:s.id}),i=je(),[o,a]=$.useState(!1),r=$.useRef(null),m=e==="image"?"image/*":void 0;async function c(u){if(!u)return;const y=Array.from(u);if(y.length===0)return;let k=null;const b=[];for(const N of y)try{const h=await i.mutateAsync({configId:s.id,file:N});k??=h.publicUrl}catch(h){b.push(`${N.name} (${h instanceof Error?h.message:"upload failed"})`)}await l.refetch(),b.length>0&&Q.error(b.length===y.length?`Upload failed: ${b.join("; ")}`:`Some files failed: ${b.join("; ")}`),k&&n(k)}function p(u){u.preventDefault(),a(!0)}function d(){a(!1)}function x(u){u.preventDefault(),a(!1),c(u.dataTransfer.files)}const g=(l.data?.pages??[]).flatMap(u=>u.items),j=g.filter(u=>e==="image"?ye(u.key):!0);return t.jsxs("div",{className:"flex flex-col gap-3 min-h-0 h-full",children:[t.jsxs("button",{type:"button",onClick:()=>r.current?.click(),onDragOver:p,onDragLeave:d,onDrop:x,className:de("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",o&&"border-primary bg-primary/5",i.isPending&&"opacity-60 pointer-events-none"),children:[t.jsx(fe,{size:18,className:"text-muted-foreground"}),t.jsx("p",{className:"text-sm font-medium",children:i.isPending?"Uploading…":"Drop files here or click to upload"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Up to 100 MB."," ",e==="image"?"Images only (PNG, JPEG, WebP, GIF, SVG, AVIF).":"Common image, video, audio, and document types."]}),t.jsx("input",{ref:r,type:"file",accept:m,multiple:!0,className:"hidden",onChange:u=>{const y=u.target.files;u.target.value="",c(y)}})]}),l.isFetching&&!l.isFetchingNextPage?t.jsx("div",{className:"flex justify-end",children:t.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})}):null,t.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[j.length===0?e==="image"&&g.length>0?t.jsx(dt,{}):t.jsx(ct,{}):e==="image"?t.jsx(ut,{items:j,onSelect:n}):t.jsx(mt,{items:j,onSelect:n}),l.hasNextPage&&t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:l.isFetchingNextPage,onClick:()=>l.fetchNextPage(),children:l.isFetchingNextPage?t.jsxs(t.Fragment,{children:[t.jsx(Ce,{size:14,className:"animate-spin"}),"Loading…"]}):"Load more"})})]})]})}function ct(){const s=w.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[t.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:t.jsx(H,{size:18,className:"text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium",children:"No files in this bucket yet"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Drop a file above to get started."})]}),s[0]=e):e=s[0],e}function dt(){const s=w.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[t.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:t.jsx(H,{size:18,className:"text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium",children:"No images in this bucket yet"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"The bucket has other files, but none match common image formats."})]}),s[0]=e):e=s[0],e}function ye(s){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(s)}function ft(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"file":s.slice(e+1).toLowerCase()}function ut(s){const e=w.c(7),{items:n,onSelect:l}=s;let i;if(e[0]!==n||e[1]!==l){let a;e[3]!==l?(a=r=>t.jsx(ve,{item:r,variant:"image",onSelect:l},r.key),e[3]=l,e[4]=a):a=e[4],i=n.map(a),e[0]=n,e[1]=l,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=o):o=e[6],o}function mt(s){const e=w.c(7),{items:n,onSelect:l}=s;let i;if(e[0]!==n||e[1]!==l){let a;e[3]!==l?(a=r=>t.jsx("li",{children:t.jsx(ve,{item:r,variant:"row",onSelect:l})},r.key),e[3]=l,e[4]=a):a=e[4],i=n.map(a),e[0]=n,e[1]=l,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=o):o=e[6],o}function ve(s){const e=w.c(58),{item:n,variant:l,onSelect:i}=s;let o;e[0]!==n.key?(o=ft(n.key),e[0]=n.key,e[1]=o):o=e[1];const a=o;if(l==="image"){let b;e[2]!==n.publicUrl||e[3]!==i?(b=()=>i(n.publicUrl),e[2]=n.publicUrl,e[3]=i,e[4]=b):b=e[4];let N;e[5]!==n.key||e[6]!==n.publicUrl?(N=t.jsx("img",{src:n.publicUrl,alt:n.key,loading:"lazy",className:"h-full w-full object-cover",onError:gt}),e[5]=n.key,e[6]=n.publicUrl,e[7]=N):N=e[7];let h;e[8]!==n.key||e[9]!==b||e[10]!==N?(h=t.jsx("button",{type:"button",onClick:b,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:n.key,children:N}),e[8]=n.key,e[9]=b,e[10]=N,e[11]=h):h=e[11];let C;e[12]!==a?(C=t.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-[10px] font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:a}),e[12]=a,e[13]=C):C=e[13];let _;e[14]!==n||e[15]!==i?(_=t.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:t.jsx(xe,{item:n,onSelect:i})}),e[14]=n,e[15]=i,e[16]=_):_=e[16];let S;e[17]!==n.key?(S=he(n.key),e[17]=n.key,e[18]=S):S=e[18];let I;e[19]!==S?(I=t.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:t.jsx("p",{className:"truncate text-xs text-white",children:S})}),e[19]=S,e[20]=I):I=e[20];let P;return e[21]!==h||e[22]!==C||e[23]!==_||e[24]!==I?(P=t.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[h,C,_,I]}),e[21]=h,e[22]=C,e[23]=_,e[24]=I,e[25]=P):P=e[25],P}let r;e[26]!==n.publicUrl||e[27]!==i?(r=()=>i(n.publicUrl),e[26]=n.publicUrl,e[27]=i,e[28]=r):r=e[28];let m;e[29]!==n.key?(m=t.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:ye(n.key)?t.jsx(H,{size:16,className:"text-muted-foreground"}):t.jsx(ze,{size:16,className:"text-muted-foreground"})}),e[29]=n.key,e[30]=m):m=e[30];let c;e[31]!==n.key?(c=he(n.key),e[31]=n.key,e[32]=c):c=e[32];let p;e[33]!==c?(p=t.jsx("p",{className:"truncate text-sm font-medium",children:c}),e[33]=c,e[34]=p):p=e[34];let d;e[35]!==n.key?(d=t.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:n.key}),e[35]=n.key,e[36]=d):d=e[36];let x;e[37]!==p||e[38]!==d?(x=t.jsxs("div",{className:"min-w-0 flex-1",children:[p,d]}),e[37]=p,e[38]=d,e[39]=x):x=e[39];let f;e[40]!==a?(f=t.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:a}),e[40]=a,e[41]=f):f=e[41];let g;e[42]!==n.size?(g=bt(n.size),e[42]=n.size,e[43]=g):g=e[43];let j;e[44]!==g?(j=t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:g}),e[44]=g,e[45]=j):j=e[45];let u;e[46]!==j||e[47]!==r||e[48]!==m||e[49]!==x||e[50]!==f?(u=t.jsxs("button",{type:"button",onClick:r,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[m,x,f,j]}),e[46]=j,e[47]=r,e[48]=m,e[49]=x,e[50]=f,e[51]=u):u=e[51];let y;e[52]!==n||e[53]!==i?(y=t.jsx(xe,{item:n,onSelect:i}),e[52]=n,e[53]=i,e[54]=y):y=e[54];let k;return e[55]!==u||e[56]!==y?(k=t.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[u,y]}),e[55]=u,e[56]=y,e[57]=k):k=e[57],k}function gt(s){s.target.style.display="none"}function xe(s){const e=w.c(22),{item:n,onSelect:l}=s,[i,o]=$.useState(!1);let a;e[0]!==n.publicUrl?(a=async function(b){b.preventDefault(),b.stopPropagation();try{await navigator.clipboard.writeText(n.publicUrl),o(!0),window.setTimeout(()=>o(!1),1500)}catch{Q.error("Failed to copy URL")}},e[0]=n.publicUrl,e[1]=a):a=e[1];const r=a;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Re,{asChild:!0,children:t.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:ht,"aria-label":"Asset actions",children:t.jsx(De,{size:14})})}),e[2]=m):m=e[2];let c;e[3]!==n.publicUrl||e[4]!==l?(c=()=>l(n.publicUrl),e[3]=n.publicUrl,e[4]=l,e[5]=c):c=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ge,{size:14}),e[6]=p):p=e[6];let d;e[7]!==c?(d=t.jsxs(ce,{onClick:c,children:[p,"Use this"]}),e[7]=c,e[8]=d):d=e[8];let x;e[9]!==i?(x=i?t.jsx(ge,{size:14}):t.jsx($e,{size:14}),e[9]=i,e[10]=x):x=e[10];const f=i?"Copied":"Copy URL";let g;e[11]!==r||e[12]!==x||e[13]!==f?(g=t.jsxs(ce,{onClick:r,children:[x,f]}),e[11]=r,e[12]=x,e[13]=f,e[14]=g):g=e[14];let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(Fe,{size:14}),e[15]=j):j=e[15];let u;e[16]!==n.publicUrl?(u=t.jsx(ce,{asChild:!0,children:t.jsxs("a",{href:n.publicUrl,target:"_blank",rel:"noreferrer",onClick:pt,children:[j,"Open in new tab"]})}),e[16]=n.publicUrl,e[17]=u):u=e[17];let y;return e[18]!==u||e[19]!==d||e[20]!==g?(y=t.jsxs(Be,{children:[m,t.jsxs(Ge,{align:"end",onClick:xt,children:[d,g,u]})]}),e[18]=u,e[19]=d,e[20]=g,e[21]=y):y=e[21],y}function pt(s){return s.stopPropagation()}function xt(s){return s.stopPropagation()}function ht(s){return s.stopPropagation()}function he(s){const e=s.split("/");return e[e.length-1]??s}function bt(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function jt(s){try{const e=new URL(s).pathname;return decodeURIComponent(e.split("/").pop()??s)}catch{return s.split("/").pop()??s}}function yt(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"":s.slice(e+1).toLowerCase()}const vt=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Gt(s){const e=w.c(79),{schema:n,value:l,onChange:i,path:o,label:a}=s,r=Xe(l),[m,c]=$.useState(!1),[p,d]=$.useState(!1),[x,f]=$.useState(!1),[g,j]=$.useState(!1),u=r?jt(r):"",y=u?yt(u):"",k=Ye(),b=je();let N;e[0]!==i||e[1]!==j||e[2]!==f?(N=function(v){f(!1),j(!1),i(v)},e[0]=i,e[1]=j,e[2]=f,e[3]=N):N=e[3];const h=N;let C;e[4]!==k.data?.configs?(C=function(){const v=k.data?.configs??[];if(v.length===1)return v[0].id;if(v.length===0)return null;const D=typeof window<"u"?window.localStorage.getItem(ue):null;return v.some(te=>te.id===D)?D:null},e[4]=k.data?.configs,e[5]=C):C=e[5];const _=C;let S;e[6]!==_||e[7]!==c||e[8]!==h||e[9]!==b?(S=async function(v){if(!v)return;const D=Array.from(v).filter(Nt);if(D.length===0){Q.error("Only image files are accepted here.");return}const te=_();if(!te){c(!0);return}try{const ae=await b.mutateAsync({configId:te,file:D[0]});h(ae.publicUrl),D.length>1&&Q.info(`Uploaded ${D[0].name}; extra files were ignored (single-select field).`)}catch(ae){const me=ae;Q.error(me instanceof Error?me.message:"Upload failed")}},e[6]=_,e[7]=c,e[8]=h,e[9]=b,e[10]=S):S=e[10];const I=S;let P;e[11]!==d?(P=function(v){v.preventDefault(),v.dataTransfer.types.includes("Files")&&d(!0)},e[11]=d,e[12]=P):P=e[12];const se=P;let W;e[13]!==d?(W=function(v){v.currentTarget===v.target&&d(!1)},e[13]=d,e[14]=W):W=e[14];const ne=W;let X;e[15]!==I||e[16]!==d?(X=function(v){v.preventDefault(),d(!1),I(v.dataTransfer.files)},e[15]=I,e[16]=d,e[17]=X):X=e[17];const ie=X;let z;e[18]!==a||e[19]!==o?(z=t.jsx(Pe,{htmlFor:o,className:"text-muted-foreground",children:a}),e[18]=a,e[19]=o,e[20]=z):z=e[20];let F;e[21]!==n.description?(F=n.description&&t.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=F):F=e[22];let T;e[23]!==z||e[24]!==F?(T=t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[z,F]}),e[23]=z,e[24]=F,e[25]=T):T=e[25];const le=p&&"border-primary ring-2 ring-primary/30",re=b.isPending&&"pointer-events-none opacity-60";let E;e[26]!==le||e[27]!==re?(E=de("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",le,re),e[26]=le,e[27]=re,e[28]=E):E=e[28];let L;e[29]!==y||e[30]!==u||e[31]!==g||e[32]!==x||e[33]!==a||e[34]!==j||e[35]!==f||e[36]!==c||e[37]!==r||e[38]!==b.isPending?(L=r?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative h-40 w-full bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!g&&t.jsx("img",{src:r,alt:a,className:de("h-full w-full object-contain transition-opacity",!x&&"opacity-0"),onLoad:()=>f(!0),onError:()=>j(!0)},r),g&&t.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[t.jsx(H,{size:20}),t.jsx("p",{className:"text-xs",children:"Preview unavailable"})]}),!x&&!g&&t.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"})]}),t.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:u}),y&&t.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:y})]})]}):t.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[t.jsx(H,{size:20}),t.jsx("span",{className:"text-sm font-medium",children:b.isPending?"Uploading…":"Drop an image or click to browse"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"PNG, JPEG, WebP, GIF, SVG, AVIF — up to 100 MB"})]}),e[29]=y,e[30]=u,e[31]=g,e[32]=x,e[33]=a,e[34]=j,e[35]=f,e[36]=c,e[37]=r,e[38]=b.isPending,e[39]=L):L=e[39];let O;e[40]!==p?(O=p&&t.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:t.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[40]=p,e[41]=O):O=e[41];let A;e[42]!==ne||e[43]!==se||e[44]!==ie||e[45]!==E||e[46]!==L||e[47]!==O?(A=t.jsxs("div",{onDragOver:se,onDragLeave:ne,onDrop:ie,className:E,children:[L,O]}),e[42]=ne,e[43]=se,e[44]=ie,e[45]=E,e[46]=L,e[47]=O,e[48]=A):A=e[48];let R;e[49]!==h?(R=U=>h(U.target.value),e[49]=h,e[50]=R):R=e[50];let B;e[51]!==o||e[52]!==r||e[53]!==R?(B=t.jsx(Ie,{id:o,type:"url",value:r,onChange:R,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[51]=o,e[52]=r,e[53]=R,e[54]=B):B=e[54];let G;e[55]!==c?(G=()=>c(!0),e[55]=c,e[56]=G):G=e[56];let Z;e[57]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(fe,{size:14}),e[57]=Z):Z=e[57];const oe=r?"Replace":"Browse";let M;e[58]!==G||e[59]!==oe?(M=t.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:G,className:"h-9 shrink-0",children:[Z,oe]}),e[58]=G,e[59]=oe,e[60]=M):M=e[60];let V;e[61]!==h||e[62]!==r?(V=r&&t.jsx(Y,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(""),className:"h-9 shrink-0","aria-label":"Remove image",children:t.jsx(_e,{size:14})}),e[61]=h,e[62]=r,e[63]=V):V=e[63];let K;e[64]!==B||e[65]!==M||e[66]!==V?(K=t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[B,M,V]}),e[64]=B,e[65]=M,e[66]=V,e[67]=K):K=e[67];let q;e[68]!==h?(q=U=>h(U),e[68]=h,e[69]=q):q=e[69];let J;e[70]!==m||e[71]!==c||e[72]!==q?(J=t.jsx(st,{open:m,onOpenChange:c,mode:"image",onSelect:q}),e[70]=m,e[71]=c,e[72]=q,e[73]=J):J=e[73];let ee;return e[74]!==A||e[75]!==K||e[76]!==J||e[77]!==T?(ee=t.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[T,A,K,J]}),e[74]=A,e[75]=K,e[76]=J,e[77]=T,e[78]=ee):ee=e[78],ee}function Nt(s){return vt.has(s.type||"")}export{st as F,Gt as I,ue as L,Xe as e,je as u};
1
+ import{e as w,q as be,a as Ne,K as ke,j as t,E as we,r as $,c as de,B as Y,l as Ce,P as Se,o as Q}from"./index-Cbngzld3.js";import{a as H}from"./Tool01-Cjstio7H.js";import{s as _e}from"./Trash01-BJ6_IzkG.js";import{i as fe}from"./Upload01-C2pjhIpk.js";import{I as Ie}from"./input-CxWmKS03.js";import{L as Pe}from"./label-BUOqnJ7l.js";import{i as Ue}from"./AlertCircle-CQgcG-Ae.js";import{i as ge}from"./Check-BUKt5vhH.js";import{a as $e}from"./Eye-Bk7j3Cz0.js";import{i as De}from"./DotsVertical-BrpflBsP.js";import{H as ze}from"./agent-icon-BgD5mt7Y.js";import{n as Fe}from"./LinkExternal01-DNf7UuUK.js";import{D as Te,c as Ee,e as Le,b as Oe,a as Ae}from"./dialog-BVuxcsVk.js";import{c as ce,a as Re,D as Be,b as Ge}from"./dropdown-menu-B8jiZxwT.js";import{S as Me}from"./skeleton-Cuoq2c8E.js";import{T as Ve,a as Ke,b as qe,c as Je}from"./tabs-tr2cYDEl.js";import{u as Qe,c as Ye}from"./use-file-configs-vUZ85Q5v.js";import{u as He}from"./useInfiniteQuery-g2cikAaR.js";import{u as We}from"./studio-tools-B99HmIGq.js";function Xe(s){if(typeof s=="string")return s;if(!s||typeof s!="object")return"";const e=s;if(Array.isArray(e.variants)){const n=e.variants,l=n.find(o=>o.rule?.__resolveType?.includes("always"));if(typeof l?.value=="string")return l.value;const i=n.find(o=>typeof o.value=="string");if(i)return i.value}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}function Ze(s){const e=w.c(10),{org:n}=be(),l=We();let i;e[0]!==n.id||e[1]!==s.configId?(i=ke.filePickerObjects(n.id,s.configId),e[0]=n.id,e[1]=s.configId,e[2]=i):i=e[2];const o=s.enabled!==!1&&!!s.configId;let a;e[3]!==s.configId||e[4]!==l?(a=async m=>{const{pageParam:c}=m;return await l.call("FILE_OBJECTS_LIST",{configId:s.configId,cursor:c??void 0})},e[3]=s.configId,e[4]=l,e[5]=a):a=e[5];let r;return e[6]!==i||e[7]!==o||e[8]!==a?(r={queryKey:i,enabled:o,staleTime:3e4,initialPageParam:null,queryFn:a,getNextPageParam:et},e[6]=i,e[7]=o,e[8]=a,e[9]=r):r=e[9],He(r)}function et(s){return s.nextCursor??void 0}function je(){const s=w.c(2),{org:e}=be();let n;return s[0]!==e?(n={mutationFn:async l=>{const i=l.file.type||"application/octet-stream",o=await fetch(`/api/${encodeURIComponent(e.slug)}/file-configs/${encodeURIComponent(l.configId)}/upload?filename=${encodeURIComponent(l.file.name)}`,{method:"POST",headers:{"Content-Type":i},body:l.file});if(!o.ok){const a=await o.text().catch(tt);let r=`${o.status} ${o.statusText}`;try{const m=JSON.parse(a);m.message&&(r=m.message)}catch{a&&(r=a.slice(0,200))}throw new Error(`Upload failed: ${r}`)}return await o.json()}},s[0]=e,s[1]=n):n=s[1],Ne(n)}function tt(){return""}const ue="file-picker:last-config-id";function st(s){const e=w.c(18),n=s.mode==="image"?"Pick an image":"Pick a file";let l;e[0]!==n?(l=t.jsx(Ee,{children:n}),e[0]=n,e[1]=l):l=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Le,{children:"Upload a new file or pick one previously uploaded to a configured bucket."}),e[2]=i):i=e[2];let o;e[3]!==l?(o=t.jsxs(Oe,{children:[l,i]}),e[3]=l,e[4]=o):o=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Me,{className:"h-64 w-full"}),e[5]=a):a=e[5];let r;e[6]!==s?(r=d=>{s.onSelect(d),s.onOpenChange(!1)},e[6]=s,e[7]=r):r=e[7];let m;e[8]!==s.mode||e[9]!==r?(m=t.jsx(we,{fallback:nt,children:t.jsx($.Suspense,{fallback:a,children:t.jsx(lt,{mode:s.mode,onSelect:r})})}),e[8]=s.mode,e[9]=r,e[10]=m):m=e[10];let c;e[11]!==o||e[12]!==m?(c=t.jsxs(Ae,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[o,m]}),e[11]=o,e[12]=m,e[13]=c):c=e[13];let p;return e[14]!==s.onOpenChange||e[15]!==s.open||e[16]!==c?(p=t.jsx(Te,{open:s.open,onOpenChange:s.onOpenChange,children:c}),e[14]=s.onOpenChange,e[15]=s.open,e[16]=c,e[17]=p):p=e[17],p}function nt(s){const{error:e}=s;return t.jsx(it,{error:e??new Error("Failed to load buckets")})}function it(s){const e=w.c(3),{error:n}=s;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Ue,{size:16}),e[0]=l):l=e[0];let i;return e[1]!==n.message?(i=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[l,t.jsx("span",{className:"text-sm font-medium",children:n.message})]}),e[1]=n.message,e[2]=i):i=e[2],i}function lt(s){const e=w.c(23),{mode:n,onSelect:l}=s,i=Qe();if(i.length===0){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(at,{}),e[0]=f):f=e[0],f}if(i.length===1){const f=i[0];let g;return e[1]!==f||e[2]!==n||e[3]!==l?(g=t.jsx(pe,{config:f,mode:n,onSelect:l}),e[1]=f,e[2]=n,e[3]=l,e[4]=g):g=e[4],g}let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=typeof window<"u"?window.localStorage.getItem(ue):null,e[5]=o):o=e[5];const a=o;let r;e[6]!==i?(r=i.find(f=>f.id===a)?.id??i[0].id,e[6]=i,e[7]=r):r=e[7];const m=r;let c;e[8]!==i?(c=i.map(rt),e[8]=i,e[9]=c):c=e[9];let p;e[10]!==c?(p=t.jsx(Ke,{className:"self-start",children:c}),e[10]=c,e[11]=p):p=e[11];let d;if(e[12]!==i||e[13]!==n||e[14]!==l){let f;e[16]!==n||e[17]!==l?(f=g=>t.jsx(qe,{value:g.id,className:"min-h-0 flex-1 overflow-hidden",children:t.jsx(pe,{config:g,mode:n,onSelect:l})},g.id),e[16]=n,e[17]=l,e[18]=f):f=e[18],d=i.map(f),e[12]=i,e[13]=n,e[14]=l,e[15]=d}else d=e[15];let x;return e[19]!==m||e[20]!==p||e[21]!==d?(x=t.jsxs(Je,{defaultValue:m,onValueChange:ot,className:"min-h-0 flex-1 flex flex-col",children:[p,d]}),e[19]=m,e[20]=p,e[21]=d,e[22]=x):x=e[22],x}function rt(s){return t.jsx(Ve,{value:s.id,children:s.name},s.id)}function ot(s){typeof window<"u"&&window.localStorage.setItem(ue,s)}function at(){const s=w.c(3);let e,n;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(fe,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No bucket configured"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Add an S3-compatible bucket in Settings before you can upload files."})]}),s[0]=e,s[1]=n):(e=s[0],n=s[1]);let l;return s[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"rounded-xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[e,n,t.jsx(Y,{asChild:!0,size:"sm",className:"mt-2",children:t.jsx(Se,{to:"/settings/files",children:"Configure a bucket"})})]}),s[2]=l):l=s[2],l}function pe({config:s,mode:e,onSelect:n}){const l=Ze({configId:s.id}),i=je(),[o,a]=$.useState(!1),r=$.useRef(null),m=e==="image"?"image/*":void 0;async function c(u){if(!u)return;const y=Array.from(u);if(y.length===0)return;let k=null;const b=[];for(const N of y)try{const h=await i.mutateAsync({configId:s.id,file:N});k??=h.publicUrl}catch(h){b.push(`${N.name} (${h instanceof Error?h.message:"upload failed"})`)}await l.refetch(),b.length>0&&Q.error(b.length===y.length?`Upload failed: ${b.join("; ")}`:`Some files failed: ${b.join("; ")}`),k&&n(k)}function p(u){u.preventDefault(),a(!0)}function d(){a(!1)}function x(u){u.preventDefault(),a(!1),c(u.dataTransfer.files)}const g=(l.data?.pages??[]).flatMap(u=>u.items),j=g.filter(u=>e==="image"?ye(u.key):!0);return t.jsxs("div",{className:"flex flex-col gap-3 min-h-0 h-full",children:[t.jsxs("button",{type:"button",onClick:()=>r.current?.click(),onDragOver:p,onDragLeave:d,onDrop:x,className:de("rounded-xl border border-dashed border-border/60 p-6 flex flex-col items-center justify-center gap-2 text-center transition-colors",o&&"border-primary bg-primary/5",i.isPending&&"opacity-60 pointer-events-none"),children:[t.jsx(fe,{size:18,className:"text-muted-foreground"}),t.jsx("p",{className:"text-sm font-medium",children:i.isPending?"Uploading…":"Drop files here or click to upload"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Up to 100 MB."," ",e==="image"?"Images only (PNG, JPEG, WebP, GIF, SVG, AVIF).":"Common image, video, audio, and document types."]}),t.jsx("input",{ref:r,type:"file",accept:m,multiple:!0,className:"hidden",onChange:u=>{const y=u.target.files;u.target.value="",c(y)}})]}),l.isFetching&&!l.isFetchingNextPage?t.jsx("div",{className:"flex justify-end",children:t.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})}):null,t.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[j.length===0?e==="image"&&g.length>0?t.jsx(dt,{}):t.jsx(ct,{}):e==="image"?t.jsx(ut,{items:j,onSelect:n}):t.jsx(mt,{items:j,onSelect:n}),l.hasNextPage&&t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(Y,{type:"button",variant:"outline",size:"sm",disabled:l.isFetchingNextPage,onClick:()=>l.fetchNextPage(),children:l.isFetchingNextPage?t.jsxs(t.Fragment,{children:[t.jsx(Ce,{size:14,className:"animate-spin"}),"Loading…"]}):"Load more"})})]})]})}function ct(){const s=w.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[t.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:t.jsx(H,{size:18,className:"text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium",children:"No files in this bucket yet"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Drop a file above to get started."})]}),s[0]=e):e=s[0],e}function dt(){const s=w.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex h-full min-h-40 flex-col items-center justify-center gap-2 py-8 text-center",children:[t.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted",children:t.jsx(H,{size:18,className:"text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium",children:"No images in this bucket yet"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"The bucket has other files, but none match common image formats."})]}),s[0]=e):e=s[0],e}function ye(s){return/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/i.test(s)}function ft(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"file":s.slice(e+1).toLowerCase()}function ut(s){const e=w.c(7),{items:n,onSelect:l}=s;let i;if(e[0]!==n||e[1]!==l){let a;e[3]!==l?(a=r=>t.jsx(ve,{item:r,variant:"image",onSelect:l},r.key),e[3]=l,e[4]=a):a=e[4],i=n.map(a),e[0]=n,e[1]=l,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:i}),e[5]=i,e[6]=o):o=e[6],o}function mt(s){const e=w.c(7),{items:n,onSelect:l}=s;let i;if(e[0]!==n||e[1]!==l){let a;e[3]!==l?(a=r=>t.jsx("li",{children:t.jsx(ve,{item:r,variant:"row",onSelect:l})},r.key),e[3]=l,e[4]=a):a=e[4],i=n.map(a),e[0]=n,e[1]=l,e[2]=i}else i=e[2];let o;return e[5]!==i?(o=t.jsx("ul",{className:"divide-y divide-border/60 rounded-lg border border-border/60",children:i}),e[5]=i,e[6]=o):o=e[6],o}function ve(s){const e=w.c(58),{item:n,variant:l,onSelect:i}=s;let o;e[0]!==n.key?(o=ft(n.key),e[0]=n.key,e[1]=o):o=e[1];const a=o;if(l==="image"){let b;e[2]!==n.publicUrl||e[3]!==i?(b=()=>i(n.publicUrl),e[2]=n.publicUrl,e[3]=i,e[4]=b):b=e[4];let N;e[5]!==n.key||e[6]!==n.publicUrl?(N=t.jsx("img",{src:n.publicUrl,alt:n.key,loading:"lazy",className:"h-full w-full object-cover",onError:gt}),e[5]=n.key,e[6]=n.publicUrl,e[7]=N):N=e[7];let h;e[8]!==n.key||e[9]!==b||e[10]!==N?(h=t.jsx("button",{type:"button",onClick:b,className:"block h-full w-full transition hover:ring-2 hover:ring-primary",title:n.key,children:N}),e[8]=n.key,e[9]=b,e[10]=N,e[11]=h):h=e[11];let C;e[12]!==a?(C=t.jsx("span",{className:"pointer-events-none absolute left-1.5 top-1.5 rounded bg-background/80 px-1.5 py-0.5 text-[10px] font-medium uppercase text-foreground opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100",children:a}),e[12]=a,e[13]=C):C=e[13];let _;e[14]!==n||e[15]!==i?(_=t.jsx("div",{className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:t.jsx(xe,{item:n,onSelect:i})}),e[14]=n,e[15]=i,e[16]=_):_=e[16];let S;e[17]!==n.key?(S=he(n.key),e[17]=n.key,e[18]=S):S=e[18];let I;e[19]!==S?(I=t.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 transition-opacity group-hover:opacity-100",children:t.jsx("p",{className:"truncate text-xs text-white",children:S})}),e[19]=S,e[20]=I):I=e[20];let P;return e[21]!==h||e[22]!==C||e[23]!==_||e[24]!==I?(P=t.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[h,C,_,I]}),e[21]=h,e[22]=C,e[23]=_,e[24]=I,e[25]=P):P=e[25],P}let r;e[26]!==n.publicUrl||e[27]!==i?(r=()=>i(n.publicUrl),e[26]=n.publicUrl,e[27]=i,e[28]=r):r=e[28];let m;e[29]!==n.key?(m=t.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:ye(n.key)?t.jsx(H,{size:16,className:"text-muted-foreground"}):t.jsx(ze,{size:16,className:"text-muted-foreground"})}),e[29]=n.key,e[30]=m):m=e[30];let c;e[31]!==n.key?(c=he(n.key),e[31]=n.key,e[32]=c):c=e[32];let p;e[33]!==c?(p=t.jsx("p",{className:"truncate text-sm font-medium",children:c}),e[33]=c,e[34]=p):p=e[34];let d;e[35]!==n.key?(d=t.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:n.key}),e[35]=n.key,e[36]=d):d=e[36];let x;e[37]!==p||e[38]!==d?(x=t.jsxs("div",{className:"min-w-0 flex-1",children:[p,d]}),e[37]=p,e[38]=d,e[39]=x):x=e[39];let f;e[40]!==a?(f=t.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:a}),e[40]=a,e[41]=f):f=e[41];let g;e[42]!==n.size?(g=bt(n.size),e[42]=n.size,e[43]=g):g=e[43];let j;e[44]!==g?(j=t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:g}),e[44]=g,e[45]=j):j=e[45];let u;e[46]!==j||e[47]!==r||e[48]!==m||e[49]!==x||e[50]!==f?(u=t.jsxs("button",{type:"button",onClick:r,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[m,x,f,j]}),e[46]=j,e[47]=r,e[48]=m,e[49]=x,e[50]=f,e[51]=u):u=e[51];let y;e[52]!==n||e[53]!==i?(y=t.jsx(xe,{item:n,onSelect:i}),e[52]=n,e[53]=i,e[54]=y):y=e[54];let k;return e[55]!==u||e[56]!==y?(k=t.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[u,y]}),e[55]=u,e[56]=y,e[57]=k):k=e[57],k}function gt(s){s.target.style.display="none"}function xe(s){const e=w.c(22),{item:n,onSelect:l}=s,[i,o]=$.useState(!1);let a;e[0]!==n.publicUrl?(a=async function(b){b.preventDefault(),b.stopPropagation();try{await navigator.clipboard.writeText(n.publicUrl),o(!0),window.setTimeout(()=>o(!1),1500)}catch{Q.error("Failed to copy URL")}},e[0]=n.publicUrl,e[1]=a):a=e[1];const r=a;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Re,{asChild:!0,children:t.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:ht,"aria-label":"Asset actions",children:t.jsx(De,{size:14})})}),e[2]=m):m=e[2];let c;e[3]!==n.publicUrl||e[4]!==l?(c=()=>l(n.publicUrl),e[3]=n.publicUrl,e[4]=l,e[5]=c):c=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ge,{size:14}),e[6]=p):p=e[6];let d;e[7]!==c?(d=t.jsxs(ce,{onClick:c,children:[p,"Use this"]}),e[7]=c,e[8]=d):d=e[8];let x;e[9]!==i?(x=i?t.jsx(ge,{size:14}):t.jsx($e,{size:14}),e[9]=i,e[10]=x):x=e[10];const f=i?"Copied":"Copy URL";let g;e[11]!==r||e[12]!==x||e[13]!==f?(g=t.jsxs(ce,{onClick:r,children:[x,f]}),e[11]=r,e[12]=x,e[13]=f,e[14]=g):g=e[14];let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(Fe,{size:14}),e[15]=j):j=e[15];let u;e[16]!==n.publicUrl?(u=t.jsx(ce,{asChild:!0,children:t.jsxs("a",{href:n.publicUrl,target:"_blank",rel:"noreferrer",onClick:pt,children:[j,"Open in new tab"]})}),e[16]=n.publicUrl,e[17]=u):u=e[17];let y;return e[18]!==u||e[19]!==d||e[20]!==g?(y=t.jsxs(Be,{children:[m,t.jsxs(Ge,{align:"end",onClick:xt,children:[d,g,u]})]}),e[18]=u,e[19]=d,e[20]=g,e[21]=y):y=e[21],y}function pt(s){return s.stopPropagation()}function xt(s){return s.stopPropagation()}function ht(s){return s.stopPropagation()}function he(s){const e=s.split("/");return e[e.length-1]??s}function bt(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function jt(s){try{const e=new URL(s).pathname;return decodeURIComponent(e.split("/").pop()??s)}catch{return s.split("/").pop()??s}}function yt(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"":s.slice(e+1).toLowerCase()}const vt=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Gt(s){const e=w.c(79),{schema:n,value:l,onChange:i,path:o,label:a}=s,r=Xe(l),[m,c]=$.useState(!1),[p,d]=$.useState(!1),[x,f]=$.useState(!1),[g,j]=$.useState(!1),u=r?jt(r):"",y=u?yt(u):"",k=Ye(),b=je();let N;e[0]!==i||e[1]!==j||e[2]!==f?(N=function(v){f(!1),j(!1),i(v)},e[0]=i,e[1]=j,e[2]=f,e[3]=N):N=e[3];const h=N;let C;e[4]!==k.data?.configs?(C=function(){const v=k.data?.configs??[];if(v.length===1)return v[0].id;if(v.length===0)return null;const D=typeof window<"u"?window.localStorage.getItem(ue):null;return v.some(te=>te.id===D)?D:null},e[4]=k.data?.configs,e[5]=C):C=e[5];const _=C;let S;e[6]!==_||e[7]!==c||e[8]!==h||e[9]!==b?(S=async function(v){if(!v)return;const D=Array.from(v).filter(Nt);if(D.length===0){Q.error("Only image files are accepted here.");return}const te=_();if(!te){c(!0);return}try{const ae=await b.mutateAsync({configId:te,file:D[0]});h(ae.publicUrl),D.length>1&&Q.info(`Uploaded ${D[0].name}; extra files were ignored (single-select field).`)}catch(ae){const me=ae;Q.error(me instanceof Error?me.message:"Upload failed")}},e[6]=_,e[7]=c,e[8]=h,e[9]=b,e[10]=S):S=e[10];const I=S;let P;e[11]!==d?(P=function(v){v.preventDefault(),v.dataTransfer.types.includes("Files")&&d(!0)},e[11]=d,e[12]=P):P=e[12];const se=P;let W;e[13]!==d?(W=function(v){v.currentTarget===v.target&&d(!1)},e[13]=d,e[14]=W):W=e[14];const ne=W;let X;e[15]!==I||e[16]!==d?(X=function(v){v.preventDefault(),d(!1),I(v.dataTransfer.files)},e[15]=I,e[16]=d,e[17]=X):X=e[17];const ie=X;let z;e[18]!==a||e[19]!==o?(z=t.jsx(Pe,{htmlFor:o,className:"text-muted-foreground",children:a}),e[18]=a,e[19]=o,e[20]=z):z=e[20];let F;e[21]!==n.description?(F=n.description&&t.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[21]=n.description,e[22]=F):F=e[22];let T;e[23]!==z||e[24]!==F?(T=t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[z,F]}),e[23]=z,e[24]=F,e[25]=T):T=e[25];const le=p&&"border-primary ring-2 ring-primary/30",re=b.isPending&&"pointer-events-none opacity-60";let E;e[26]!==le||e[27]!==re?(E=de("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",le,re),e[26]=le,e[27]=re,e[28]=E):E=e[28];let L;e[29]!==y||e[30]!==u||e[31]!==g||e[32]!==x||e[33]!==a||e[34]!==j||e[35]!==f||e[36]!==c||e[37]!==r||e[38]!==b.isPending?(L=r?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative h-40 w-full bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",children:[!g&&t.jsx("img",{src:r,alt:a,className:de("h-full w-full object-contain transition-opacity",!x&&"opacity-0"),onLoad:()=>f(!0),onError:()=>j(!0)},r),g&&t.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[t.jsx(H,{size:20}),t.jsx("p",{className:"text-xs",children:"Preview unavailable"})]}),!x&&!g&&t.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"})]}),t.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:u}),y&&t.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:y})]})]}):t.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex h-40 w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[t.jsx(H,{size:20}),t.jsx("span",{className:"text-sm font-medium",children:b.isPending?"Uploading…":"Drop an image or click to browse"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"PNG, JPEG, WebP, GIF, SVG, AVIF — up to 100 MB"})]}),e[29]=y,e[30]=u,e[31]=g,e[32]=x,e[33]=a,e[34]=j,e[35]=f,e[36]=c,e[37]=r,e[38]=b.isPending,e[39]=L):L=e[39];let O;e[40]!==p?(O=p&&t.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:t.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[40]=p,e[41]=O):O=e[41];let A;e[42]!==ne||e[43]!==se||e[44]!==ie||e[45]!==E||e[46]!==L||e[47]!==O?(A=t.jsxs("div",{onDragOver:se,onDragLeave:ne,onDrop:ie,className:E,children:[L,O]}),e[42]=ne,e[43]=se,e[44]=ie,e[45]=E,e[46]=L,e[47]=O,e[48]=A):A=e[48];let R;e[49]!==h?(R=U=>h(U.target.value),e[49]=h,e[50]=R):R=e[50];let B;e[51]!==o||e[52]!==r||e[53]!==R?(B=t.jsx(Ie,{id:o,type:"url",value:r,onChange:R,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[51]=o,e[52]=r,e[53]=R,e[54]=B):B=e[54];let G;e[55]!==c?(G=()=>c(!0),e[55]=c,e[56]=G):G=e[56];let Z;e[57]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(fe,{size:14}),e[57]=Z):Z=e[57];const oe=r?"Replace":"Browse";let M;e[58]!==G||e[59]!==oe?(M=t.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:G,className:"h-9 shrink-0",children:[Z,oe]}),e[58]=G,e[59]=oe,e[60]=M):M=e[60];let V;e[61]!==h||e[62]!==r?(V=r&&t.jsx(Y,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(""),className:"h-9 shrink-0","aria-label":"Remove image",children:t.jsx(_e,{size:14})}),e[61]=h,e[62]=r,e[63]=V):V=e[63];let K;e[64]!==B||e[65]!==M||e[66]!==V?(K=t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[B,M,V]}),e[64]=B,e[65]=M,e[66]=V,e[67]=K):K=e[67];let q;e[68]!==h?(q=U=>h(U),e[68]=h,e[69]=q):q=e[69];let J;e[70]!==m||e[71]!==c||e[72]!==q?(J=t.jsx(st,{open:m,onOpenChange:c,mode:"image",onSelect:q}),e[70]=m,e[71]=c,e[72]=q,e[73]=J):J=e[73];let ee;return e[74]!==A||e[75]!==K||e[76]!==J||e[77]!==T?(ee=t.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[T,A,K,J]}),e[74]=A,e[75]=K,e[76]=J,e[77]=T,e[78]=ee):ee=e[78],ee}function Nt(s){return vt.has(s.type||"")}export{st as F,Gt as I,ue as L,Xe as e,je as u};
@@ -1 +1 @@
1
- import{e as f,c as d,r as p,j as r}from"./index-rZ1TPVyD.js";import{m as w}from"./sidebar-B3SsvTHC.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-Cbngzld3.js";import{m as w}from"./sidebar-DeB8mcen.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,3 +1,3 @@
1
- import{e as S,r as E,j as t,n as J,B as T,K as M,c as Y,f as Ce,d as Se,E as re,q as $e,G as Ge,C as Xe,o as I}from"./index-rZ1TPVyD.js";import{i as Qe}from"./ChevronRight-kLRVkGUs.js";import{s as De}from"./Eye-BNS1RmzG.js";import{n as ae,i as We}from"./Globe01-DjWlKHom.js";import{i as Ye,c as Ze}from"./ZoomOut-B1VNHI1K.js";import{s as Je}from"./Plus-Do6ZWheh.js";import{t as et}from"./Stars01-ANwy09AP.js";import{i as ze}from"./Upload01-mjA8r4Fi.js";import{b as K,T as V,a as q,u as Fe}from"./tooltip-ua4lJTzI.js";import{A as tt,a as lt,b as st,c as nt,d as it,e as rt,f as ot,g as at}from"./alert-dialog-Dsb6KPFM.js";import{c as Z,D as ce,a as de,f as ct,b as dt,e as ft,d as mt}from"./dialog-CxpeEAA2.js";import{I as ut}from"./input-BPXWlz46.js";import{S as H}from"./skeleton-DvVUqja_.js";import{F as A,d as _e,M as ht}from"./file-type-icon-35VBMVCk.js";import{a as xt}from"./toolbar-Cb06hfKk.js";import{i as Oe,j as Pe,H as Te,k as Ue,h as Ae,f as fe,F as Ee,a as me,m as Me,l as pt,u as ye,b as jt,n as Le,o as gt}from"./header-tab-button-C7XZ27Uv.js";import{i as ue}from"./DotsVertical-CvhOKI-w.js";import{s as he}from"./Trash01-Bifm5Wb3.js";import{i as Re}from"./Zap-BGp3QjmM.js";import{a as xe,c as X,b as pe,D as je}from"./dropdown-menu-Xj0lVIXK.js";import{R as ve,a as bt,b as yt}from"./resizable-23UTrxEL.js";import{n as Be}from"./LinkExternal01-B6flmd1s.js";import{s as Ie}from"./XClose-D0wmxYTF.js";import{i as vt}from"./X-BWR0-4rz.js";import"./Check-6LmIKXJj.js";import"./ChevronLeft-BuXkBFIm.js";import"./index-DppjWA7O.js";import"./LayoutLeft-C7Cmt2J8.js";const wt=new Set(["output","upload","public","home"]),Nt=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function kt(l){return wt.has(l)||!Nt.test(l)?"home":l}function Ct(l){const e=S.c(33);let s,i,o;e[0]!==l?({glyph:s,readOnly:o,...i}=l,e[0]=l,e[1]=s,e[2]=i,e[3]=o):(s=e[1],i=e[2],o=e[3]);const c=E.useId(),r=`${c}-back`,a=`${c}-front`,n=`url(#${r})`;let d;e[4]!==n?(d=t.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:n}),e[4]=n,e[5]=d):d=e[5];const m=`url(#${a})`;let f;e[6]!==m?(f=t.jsx("rect",{y:"8.72",width:"32",height:"21",rx:"2.566",fill:m}),e[6]=m,e[7]=f):f=e[7];let u,g,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("rect",{x:"0.3",y:"8.86",width:"31.4",height:"0.55",rx:"0.275",fill:"#FFFFFF",opacity:"0.25"}),g=t.jsx("rect",{y:"25.81",width:"32",height:"0.552",fill:"#84CDFB"}),b=t.jsx("rect",{y:"27.05",width:"32",height:"0.552",fill:"#84CDFB"}),e[8]=u,e[9]=g,e[10]=b):(u=e[8],g=e[9],b=e[10]);let p;e[11]!==s?(p=s&&t.jsx(s,{x:10.5,y:13.2,width:11,height:11,strokeWidth:2.2,style:{color:"#014AC9",opacity:.55}}),e[11]=s,e[12]=p):p=e[12];let x;e[13]!==o?(x=o&&t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"25.5",cy:"25.5",r:"6.2",strokeWidth:"1",className:"fill-background stroke-border"}),t.jsx(De,{x:22.1,y:22.1,width:6.8,height:6.8,strokeWidth:2.2,className:"text-muted-foreground"})]}),e[13]=o,e[14]=x):x=e[14];let h,N;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("stop",{offset:"0.3",stopColor:"#4D87DF"}),N=t.jsx("stop",{offset:"1",stopColor:"#296FE8"}),e[15]=h,e[16]=N):(h=e[15],N=e[16]);let v;e[17]!==r?(v=t.jsxs("linearGradient",{id:r,x1:"15.97",y1:"2.55",x2:"15.97",y2:"9.53",gradientUnits:"userSpaceOnUse",children:[h,N]}),e[17]=r,e[18]=v):v=e[18];let w,j;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("stop",{stopColor:"#72B6FA"}),j=t.jsx("stop",{offset:"1",stopColor:"#5BB1EF"}),e[19]=w,e[20]=j):(w=e[19],j=e[20]);let C;e[21]!==a?(C=t.jsxs("radialGradient",{id:a,cx:"0",cy:"0",r:"10",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(1.6 0 0 2.1538 16 19.22)",children:[w,j]}),e[21]=a,e[22]=C):C=e[22];let k;e[23]!==v||e[24]!==C?(k=t.jsxs("defs",{children:[v,C]}),e[23]=v,e[24]=C,e[25]=k):k=e[25];let $;return e[26]!==i||e[27]!==k||e[28]!==d||e[29]!==f||e[30]!==p||e[31]!==x?($=t.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...i,children:[d,f,u,g,b,p,x,k]}),e[26]=i,e[27]=k,e[28]=d,e[29]=f,e[30]=p,e[31]=x,e[32]=$):$=e[32],$}function St(l){const e={};for(const s of l.split(`
1
+ import{e as S,r as E,j as t,n as J,B as T,K as M,c as Y,f as Ce,d as Se,E as re,q as $e,G as Ge,C as Xe,o as I}from"./index-Cbngzld3.js";import{i as Qe}from"./ChevronRight-glzdqN1s.js";import{s as De}from"./Eye-Bk7j3Cz0.js";import{n as ae,i as We}from"./Globe01-C8CeCAhz.js";import{i as Ye,c as Ze}from"./ZoomOut-DVfZ-43U.js";import{s as Je}from"./Plus-CugY_4xX.js";import{t as et}from"./Stars01-BPnYJgb7.js";import{i as ze}from"./Upload01-C2pjhIpk.js";import{b as K,T as V,a as q,u as Fe}from"./tooltip--aN5hOmO.js";import{A as tt,a as lt,b as st,c as nt,d as it,e as rt,f as ot,g as at}from"./alert-dialog-qtdXP2aD.js";import{c as Z,D as ce,a as de,f as ct,b as dt,e as ft,d as mt}from"./dialog-BVuxcsVk.js";import{I as ut}from"./input-CxWmKS03.js";import{S as H}from"./skeleton-Cuoq2c8E.js";import{F as A,d as _e,M as ht}from"./file-type-icon-9GbQJJla.js";import{a as xt}from"./toolbar-BIItBzPS.js";import{i as Oe,j as Pe,H as Te,k as Ue,h as Ae,f as fe,F as Ee,a as me,m as Me,l as pt,u as ye,b as jt,n as Le,o as gt}from"./header-tab-button-B7JCdtgi.js";import{i as ue}from"./DotsVertical-BrpflBsP.js";import{s as he}from"./Trash01-BJ6_IzkG.js";import{i as Re}from"./Zap-j4DAJVgz.js";import{a as xe,c as X,b as pe,D as je}from"./dropdown-menu-B8jiZxwT.js";import{R as ve,a as bt,b as yt}from"./resizable-DOED-lqJ.js";import{n as Be}from"./LinkExternal01-DNf7UuUK.js";import{s as Ie}from"./XClose-DaB-YREn.js";import{i as vt}from"./X-BQX3Zy-X.js";import"./Check-BUKt5vhH.js";import"./ChevronLeft-Btt_21CS.js";import"./index-DEkPGwPd.js";import"./LayoutLeft-D3sIkDa-.js";const wt=new Set(["output","upload","public","home"]),Nt=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function kt(l){return wt.has(l)||!Nt.test(l)?"home":l}function Ct(l){const e=S.c(33);let s,i,o;e[0]!==l?({glyph:s,readOnly:o,...i}=l,e[0]=l,e[1]=s,e[2]=i,e[3]=o):(s=e[1],i=e[2],o=e[3]);const c=E.useId(),r=`${c}-back`,a=`${c}-front`,n=`url(#${r})`;let d;e[4]!==n?(d=t.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:n}),e[4]=n,e[5]=d):d=e[5];const m=`url(#${a})`;let f;e[6]!==m?(f=t.jsx("rect",{y:"8.72",width:"32",height:"21",rx:"2.566",fill:m}),e[6]=m,e[7]=f):f=e[7];let u,g,b;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("rect",{x:"0.3",y:"8.86",width:"31.4",height:"0.55",rx:"0.275",fill:"#FFFFFF",opacity:"0.25"}),g=t.jsx("rect",{y:"25.81",width:"32",height:"0.552",fill:"#84CDFB"}),b=t.jsx("rect",{y:"27.05",width:"32",height:"0.552",fill:"#84CDFB"}),e[8]=u,e[9]=g,e[10]=b):(u=e[8],g=e[9],b=e[10]);let p;e[11]!==s?(p=s&&t.jsx(s,{x:10.5,y:13.2,width:11,height:11,strokeWidth:2.2,style:{color:"#014AC9",opacity:.55}}),e[11]=s,e[12]=p):p=e[12];let x;e[13]!==o?(x=o&&t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"25.5",cy:"25.5",r:"6.2",strokeWidth:"1",className:"fill-background stroke-border"}),t.jsx(De,{x:22.1,y:22.1,width:6.8,height:6.8,strokeWidth:2.2,className:"text-muted-foreground"})]}),e[13]=o,e[14]=x):x=e[14];let h,N;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("stop",{offset:"0.3",stopColor:"#4D87DF"}),N=t.jsx("stop",{offset:"1",stopColor:"#296FE8"}),e[15]=h,e[16]=N):(h=e[15],N=e[16]);let v;e[17]!==r?(v=t.jsxs("linearGradient",{id:r,x1:"15.97",y1:"2.55",x2:"15.97",y2:"9.53",gradientUnits:"userSpaceOnUse",children:[h,N]}),e[17]=r,e[18]=v):v=e[18];let w,j;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("stop",{stopColor:"#72B6FA"}),j=t.jsx("stop",{offset:"1",stopColor:"#5BB1EF"}),e[19]=w,e[20]=j):(w=e[19],j=e[20]);let C;e[21]!==a?(C=t.jsxs("radialGradient",{id:a,cx:"0",cy:"0",r:"10",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(1.6 0 0 2.1538 16 19.22)",children:[w,j]}),e[21]=a,e[22]=C):C=e[22];let k;e[23]!==v||e[24]!==C?(k=t.jsxs("defs",{children:[v,C]}),e[23]=v,e[24]=C,e[25]=k):k=e[25];let $;return e[26]!==i||e[27]!==k||e[28]!==d||e[29]!==f||e[30]!==p||e[31]!==x?($=t.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",...i,children:[d,f,u,g,b,p,x,k]}),e[26]=i,e[27]=k,e[28]=d,e[29]=f,e[30]=p,e[31]=x,e[32]=$):$=e[32],$}function St(l){const e={};for(const s of l.split(`
2
2
  `)){const i=s.match(/^([A-Za-z][\w-]*):\s*(.*)$/);i?.[1]&&i[2]!==void 0&&(e[i[1].toLowerCase()]=i[2].trim())}return e}function we(l){for(const e of l.split(/\n\s*\n/)){const s=e.trim();if(!(!s||s.startsWith("#")))return s.replace(/\n/g," ")}return null}function He(l){const e=l.match(/^---\n([\s\S]*?)\n---\n?/);if(!e||e[1]===void 0)return{name:null,description:we(l),body:l};const s=St(e[1]),i=l.slice(e[0].length);return{name:s.name||null,description:s.description||we(i),body:i}}const $t=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),Dt=new Set(["csv","tsv"]),zt=new Set(["mp4","webm","mov","m4v"]),Ft=new Set(["txt","md","markdown","json","log","yaml","yml","xml","html","htm"]),_t=256*1024;function ee(l){const e=new Date(l);if(Number.isNaN(e.getTime()))return"";const s=Date.now()-e.getTime(),i=Math.floor(s/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const o=Math.floor(i/60);if(o<24)return`${o}h ago`;const c=Math.floor(o/24);return c<30?`${c}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ot(l){return l.split(".").pop()?.toLowerCase()??""}function Ke(l){const e=S.c(15),{downloadUrl:s,filename:i,onDelete:o}=l,c=`Actions for ${i}`;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(ue,{size:14}),e[0]=r):r=e[0];let a;e[1]!==c?(a=t.jsx(xe,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:Tt,"aria-label":c,children:r})}),e[1]=c,e[2]=a):a=e[2];let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(ae,{size:14}),e[3]=n):n=e[3];let d;e[4]!==s||e[5]!==i?(d=t.jsx(X,{asChild:!0,children:t.jsxs("a",{href:s,download:i,children:[n,"Download"]})}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;e[7]!==o?(m=o&&t.jsxs(X,{variant:"destructive",onClick:o,children:[t.jsx(he,{size:14}),"Delete"]}),e[7]=o,e[8]=m):m=e[8];let f;e[9]!==d||e[10]!==m?(f=t.jsxs(pe,{align:"end",onClick:Pt,children:[d,m]}),e[9]=d,e[10]=m,e[11]=f):f=e[11];let u;return e[12]!==a||e[13]!==f?(u=t.jsxs(je,{children:[a,f]}),e[12]=a,e[13]=f,e[14]=u):u=e[14],u}function Pt(l){return l.stopPropagation()}function Tt(l){return l.stopPropagation()}function te(l){const e=S.c(9),{onOpen:s,children:i,className:o}=l;let c;e[0]!==s?(c=n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),s())},e[0]=s,e[1]=c):c=e[1];let r;e[2]!==o?(r=Y("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",o),e[2]=o,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==s||e[6]!==c||e[7]!==r?(a=t.jsx("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:c,className:r,children:i}),e[4]=i,e[5]=s,e[6]=c,e[7]=r,e[8]=a):a=e[8],a}function le(l){const e=S.c(16),{icon:s,name:i,meta:o,subtitle:c,actions:r}=l;let a;e[0]!==i?(a=t.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",title:i,children:i}),e[0]=i,e[1]=a):a=e[1];let n;e[2]!==o?(n=o&&t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=n):n=e[3];let d;e[4]!==a||e[5]!==n?(d=t.jsxs("div",{className:"flex items-start gap-3",children:[a,n]}),e[4]=a,e[5]=n,e[6]=d):d=e[6];let m;e[7]!==c?(m=c&&t.jsx("span",{className:"text-xs text-muted-foreground",children:c}),e[7]=c,e[8]=m):m=e[8];let f;e[9]!==d||e[10]!==m?(f=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[d,m]}),e[9]=d,e[10]=m,e[11]=f):f=e[11];let u;return e[12]!==r||e[13]!==s||e[14]!==f?(u=t.jsxs("div",{className:"flex w-full items-center gap-2.5",children:[s,f,r]}),e[12]=r,e[13]=s,e[14]=f,e[15]=u):u=e[15],u}function se(l){const e=S.c(15),{name:s,meta:i,subtitle:o,glyph:c,readOnly:r,onOpen:a,onDelete:n}=l;let d;e[0]!==c||e[1]!==r?(d=t.jsx(Ct,{glyph:c,readOnly:r,className:"size-8 shrink-0"}),e[0]=c,e[1]=r,e[2]=d):d=e[2];let m;e[3]!==s||e[4]!==n?(m=n?t.jsxs(je,{children:[t.jsx(xe,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:At,"aria-label":`Actions for ${s}`,children:t.jsx(ue,{size:14})})}),t.jsx(pe,{align:"end",onClick:Ut,children:t.jsxs(X,{variant:"destructive",onClick:n,children:[t.jsx(he,{size:14}),"Delete"]})})]}):void 0,e[3]=s,e[4]=n,e[5]=m):m=e[5];let f;e[6]!==i||e[7]!==s||e[8]!==o||e[9]!==d||e[10]!==m?(f=t.jsx(le,{icon:d,name:s,meta:i,subtitle:o,actions:m}),e[6]=i,e[7]=s,e[8]=o,e[9]=d,e[10]=m,e[11]=f):f=e[11];let u;return e[12]!==a||e[13]!==f?(u=t.jsx(te,{onOpen:a,children:f}),e[12]=a,e[13]=f,e[14]=u):u=e[14],u}function Ut(l){return l.stopPropagation()}function At(l){return l.stopPropagation()}function Ve(l){const e=S.c(19),{filename:s,updatedAt:i,downloadUrl:o,onOpen:c,onDelete:r}=l;let a;e[0]!==s?(a=t.jsx(A,{filename:s,className:"h-8 w-6.5 shrink-0"}),e[0]=s,e[1]=a):a=e[1];let n;e[2]!==i?(n=ee(i),e[2]=i,e[3]=n):n=e[3];let d;e[4]!==s?(d=_e(s),e[4]=s,e[5]=d):d=e[5];let m;e[6]!==o||e[7]!==s||e[8]!==r?(m=t.jsx(Ke,{downloadUrl:o,filename:s,onDelete:r}),e[6]=o,e[7]=s,e[8]=r,e[9]=m):m=e[9];let f;e[10]!==s||e[11]!==a||e[12]!==n||e[13]!==d||e[14]!==m?(f=t.jsx(le,{icon:a,name:s,meta:n,subtitle:d,actions:m}),e[10]=s,e[11]=a,e[12]=n,e[13]=d,e[14]=m,e[15]=f):f=e[15];let u;return e[16]!==c||e[17]!==f?(u=t.jsx(te,{onOpen:c,children:f}),e[16]=c,e[17]=f,e[18]=u):u=e[18],u}function Et(l){const e=S.c(36),{dirName:s,updatedAt:i,skillMdUrl:o,onOpen:c,onBrowse:r,onDelete:a}=l;let n;e[0]!==o?(n=M.fileText(o),e[0]=o,e[1]=n):n=e[1];let d;e[2]!==o?(d=async()=>{const F=await fetch(o,{credentials:"include"});if(!F.ok)throw new Error(`fetch failed: ${F.status}`);return F.text()},e[2]=o,e[3]=d):d=e[3];let m;e[4]!==n||e[5]!==d?(m={queryKey:n,queryFn:d,staleTime:6e4,retry:!1},e[4]=n,e[5]=d,e[6]=m):m=e[6];const{data:f}=J(m);let u;e[7]!==f?(u=f?He(f):null,e[7]=f,e[8]=u):u=e[8];const g=u;let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:t.jsx(Re,{size:16})}),e[9]=b):b=e[9];const p=g?.name??s;let x;e[10]!==i?(x=ee(i),e[10]=i,e[11]=x):x=e[11];const h=`Actions for ${s}`;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(ue,{size:14}),e[12]=N):N=e[12];let v;e[13]!==h?(v=t.jsx(xe,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",className:"size-6 shrink-0 opacity-0 transition-opacity group-hover/card:opacity-100 data-[state=open]:opacity-100",onClick:Lt,"aria-label":h,children:N})}),e[13]=h,e[14]=v):v=e[14];let w;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Ye,{size:14}),e[15]=w):w=e[15];let j;e[16]!==r?(j=t.jsxs(X,{onClick:r,children:[w,"Browse files"]}),e[16]=r,e[17]=j):j=e[17];let C;e[18]!==a?(C=a&&t.jsxs(X,{variant:"destructive",onClick:a,children:[t.jsx(he,{size:14}),"Delete"]}),e[18]=a,e[19]=C):C=e[19];let k;e[20]!==j||e[21]!==C?(k=t.jsxs(pe,{align:"end",onClick:Mt,children:[j,C]}),e[20]=j,e[21]=C,e[22]=k):k=e[22];let $;e[23]!==v||e[24]!==k?($=t.jsxs(je,{children:[v,k]}),e[23]=v,e[24]=k,e[25]=$):$=e[25];let z;e[26]!==$||e[27]!==p||e[28]!==x?(z=t.jsx(le,{icon:b,name:p,meta:x,subtitle:"Skill",actions:$}),e[26]=$,e[27]=p,e[28]=x,e[29]=z):z=e[29];const P=g?.description??"";let D;e[30]!==P?(D=t.jsx("p",{className:"line-clamp-2 min-h-8 text-xs leading-4 text-muted-foreground",children:P}),e[30]=P,e[31]=D):D=e[31];let y;return e[32]!==c||e[33]!==z||e[34]!==D?(y=t.jsxs(te,{onOpen:c,children:[z,D]}),e[32]=c,e[33]=z,e[34]=D,e[35]=y):y=e[35],y}function Mt(l){return l.stopPropagation()}function Lt(l){return l.stopPropagation()}function oe(l){const e=S.c(4),{children:s}=l,[i,o]=E.useState(!1);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>n=>{if(!n)return;const d=new IntersectionObserver(m=>{const[f]=m;f?.isIntersecting&&(o(!0),d.disconnect())},{rootMargin:"200px"});d.observe(n)},e[0]=c):c=e[0];const[r]=E.useState(c);if(i){let n;return e[1]!==s?(n=t.jsx(t.Fragment,{children:s}),e[1]=s,e[2]=n):n=e[2],n}let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{ref:r,className:"h-full w-full"}),e[3]=a):a=e[3],a}function Rt(l){const e=S.c(11),{url:s}=l;let i;e[0]!==s?(i=M.fileText(s),e[0]=s,e[1]=i):i=e[1];let o;e[2]!==s?(o=async()=>{const d=await fetch(s,{credentials:"include"});if(!d.ok)throw new Error(`fetch failed: ${d.status}`);return d.text()},e[2]=s,e[3]=o):o=e[3];let c;e[4]!==i||e[5]!==o?(c={queryKey:i,queryFn:o,staleTime:6e4,retry:!1},e[4]=i,e[5]=o,e[6]=c):c=e[6];const{data:r}=J(c);if(!r)return null;let a;e[7]!==r?(a=r.slice(0,2e3),e[7]=r,e[8]=a):a=e[8];let n;return e[9]!==a?(n=t.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:a}),e[9]=a,e[10]=n):n=e[10],n}function Bt(l){const e=S.c(23),{url:s,ext:i}=l;let o;e[0]!==s?(o=M.csvThumb(s),e[0]=s,e[1]=o):o=e[1];let c;e[2]!==s?(c=async()=>{const x=await fetch(s,{credentials:"include",headers:{Range:"bytes=0-8191"}});if(!x.ok)throw new Error(`fetch failed: ${x.status}`);return x.text()},e[2]=s,e[3]=c):c=e[3];let r;e[4]!==o||e[5]!==c?(r={queryKey:o,queryFn:c,staleTime:6e4,retry:!1},e[4]=o,e[5]=c,e[6]=r):r=e[6];const{data:a}=J(r);if(!a)return null;const n=i==="tsv"?" ":",";let d,m,f,u;if(e[7]!==a||e[8]!==n){u=Symbol.for("react.early_return_sentinel");e:{let x;e[13]!==n?(x=N=>N.split(n).slice(0,6).map(Kt),e[13]=n,e[14]=x):x=e[14];const h=a.split(`
3
3
  `).filter(Boolean).slice(0,7).map(x);if(h.length===0){u=null;break e}f="pointer-events-none h-full w-full overflow-hidden bg-background p-2 select-none",m="w-full border-collapse",d=h.map(It)}e[7]=a,e[8]=n,e[9]=d,e[10]=m,e[11]=f,e[12]=u}else d=e[9],m=e[10],f=e[11],u=e[12];if(u!==Symbol.for("react.early_return_sentinel"))return u;let g;e[15]!==d?(g=t.jsx("tbody",{children:d}),e[15]=d,e[16]=g):g=e[16];let b;e[17]!==m||e[18]!==g?(b=t.jsx("table",{className:m,children:g}),e[17]=m,e[18]=g,e[19]=b):b=e[19];let p;return e[20]!==f||e[21]!==b?(p=t.jsx("div",{className:f,children:b}),e[20]=f,e[21]=b,e[22]=p):p=e[22],p}function It(l,e){return t.jsx("tr",{className:Y(e===0&&"bg-muted/50 font-medium"),children:l.map(Ht)},e)}function Ht(l,e){return t.jsx("td",{className:"max-w-[56px] overflow-hidden border border-border/30 px-1 py-px text-[7px] leading-[1.4] text-muted-foreground",style:{maxWidth:56},children:t.jsx("span",{className:"block truncate",children:l})},e)}function Kt(l){return l.trim().replace(/^"|"$/g,"")}function Vt(l){const e=S.c(14),{filename:s,size:i,downloadUrl:o}=l;let c;if(e[0]!==o||e[1]!==s||e[2]!==i){const r=Ot(s);let a;if($t.has(r)){let n;e[4]!==o?(n=t.jsx("img",{src:o,alt:"",loading:"lazy",className:"h-full w-full object-cover"}),e[4]=o,e[5]=n):n=e[5],a=n}else if(zt.has(r)){const n=`${o}#t=0.1`;let d;e[6]!==n?(d=t.jsx(oe,{children:t.jsx("video",{src:n,preload:"metadata",muted:!0,playsInline:!0,className:"pointer-events-none h-full w-full object-cover"})}),e[6]=n,e[7]=d):d=e[7],a=d}else if(r==="pdf"){let n;e[8]!==s?(n=t.jsx("div",{className:"flex h-full w-full items-center justify-center",children:t.jsx(A,{filename:s,className:"h-14 w-11 opacity-60"})}),e[8]=s,e[9]=n):n=e[9],a=n}else if(Dt.has(r))a=t.jsx(oe,{children:t.jsx(Bt,{url:o,ext:r})});else if(Ft.has(r)&&i<=_t){let n;e[10]!==o?(n=t.jsx(oe,{children:t.jsx(Rt,{url:o})}),e[10]=o,e[11]=n):n=e[11],a=n}else{let n;e[12]!==s?(n=t.jsx("div",{className:"flex h-full w-full items-center justify-center",children:t.jsx(A,{filename:s,className:"h-14 w-11 opacity-60"})}),e[12]=s,e[13]=n):n=e[13],a=n}c=t.jsx("div",{className:"aspect-[400/265] w-full overflow-hidden rounded-lg border border-border/60 bg-muted/30",children:a}),e[0]=o,e[1]=s,e[2]=i,e[3]=c}else c=e[3];return c}function qt(l){const e=S.c(24),s=l.onOpen;let i;e[0]!==l.filename?(i=t.jsx(A,{filename:l.filename,className:"h-8 w-6.5 shrink-0"}),e[0]=l.filename,e[1]=i):i=e[1];const o=l.filename;let c;e[2]!==l.updatedAt?(c=ee(l.updatedAt),e[2]=l.updatedAt,e[3]=c):c=e[3];let r;e[4]!==l.filename?(r=_e(l.filename),e[4]=l.filename,e[5]=r):r=e[5];let a;e[6]!==l.downloadUrl||e[7]!==l.filename||e[8]!==l.onDelete?(a=t.jsx(Ke,{downloadUrl:l.downloadUrl,filename:l.filename,onDelete:l.onDelete}),e[6]=l.downloadUrl,e[7]=l.filename,e[8]=l.onDelete,e[9]=a):a=e[9];let n;e[10]!==l.filename||e[11]!==i||e[12]!==c||e[13]!==r||e[14]!==a?(n=t.jsx(le,{icon:i,name:o,meta:c,subtitle:r,actions:a}),e[10]=l.filename,e[11]=i,e[12]=c,e[13]=r,e[14]=a,e[15]=n):n=e[15];let d;e[16]!==l.downloadUrl||e[17]!==l.filename||e[18]!==l.size?(d=t.jsx(Vt,{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 m;return e[20]!==l.onOpen||e[21]!==n||e[22]!==d?(m=t.jsxs(te,{onOpen:s,children:[n,d]}),e[20]=l.onOpen,e[21]=n,e[22]=d,e[23]=m):m=e[23],m}function ne(l){const e=l?l.split("/").filter(Boolean):[],s=e[0]==="public",i=s?e[1]??null:null,o=s?i?`public-${i}`:null:e[0]??null,c=(s?e.slice(2):e.slice(1)).join("/");return{segments:e,volume:o,dirPath:c,isPublic:s,publicSet:i,readOnly:s}}function W(l,e){return l.isPublic&&l.publicSet?`public/${l.publicSet}/${e}`:l.volume?`${l.volume}/${e}`:e}function O(l){const e=l.lastIndexOf("/");return e===-1?l:l.slice(e+1)}const Gt=l=>/\.html?$/i.test(l);function Xt(l){const e=S.c(26),{previewPath:s,onClose:i}=l;let o;e[0]!==s?(o=ne(s),e[0]=s,e[1]=o):o=e[1];const c=o,{volume:r,dirPath:a}=c,{data:n,isPending:d}=Oe(r,a),m=Pe(r??"");let f,u,g,b,p,x;if(e[2]!==m||e[3]!==n||e[4]!==a||e[5]!==d||e[6]!==i||e[7]!==s||e[8]!==r){const v=O(a),w=n&&n.kind==="file"?{key:s,filename:v,size:n.size,downloadUrl:m(n.path)}:null;u=ce,p=!0,e[15]!==i?(x=j=>{j||i()},e[15]=i,e[16]=x):x=e[16],f=de,g="flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",b=w&&n&&Gt(v)?t.jsxs(t.Fragment,{children:[t.jsx(Z,{className:"sr-only",children:v}),t.jsx(Te,{readUrl:w.downloadUrl,marker:Ue(n),title:v,savePath:r==="home"?a:void 0,trailing:t.jsx("div",{className:"w-8 shrink-0"})},s)]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-1 border-b border-border/60 py-1 pr-12 pl-2",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[t.jsx(A,{filename:v,className:"h-4.5 w-3.5 shrink-0"}),t.jsx(Z,{className:"truncate text-xs font-medium text-foreground",children:v}),w&&t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Ae(w.size)})]}),w&&t.jsxs(t.Fragment,{children:[t.jsxs(K,{children:[t.jsx(V,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",asChild:!0,children:t.jsx("a",{href:w.downloadUrl,download:w.filename,children:t.jsx(ae,{size:14})})})}),t.jsx(q,{side:"bottom",children:"Download"})]}),t.jsxs(K,{children:[t.jsx(V,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",onClick:()=>window.open(w.downloadUrl,"_blank","noopener"),children:t.jsx(Be,{size:14})})}),t.jsx(q,{side:"bottom",children:"Open in new tab"})]})]})]}),t.jsx("div",{className:"relative min-h-0 flex-1 bg-background",children:w?t.jsx(fe,{file:w}):d?t.jsx(Ee,{}):t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[t.jsx(A,{filename:v,className:"h-7.5 w-6"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."})]})})]}),e[2]=m,e[3]=n,e[4]=a,e[5]=d,e[6]=i,e[7]=s,e[8]=r,e[9]=f,e[10]=u,e[11]=g,e[12]=b,e[13]=p,e[14]=x}else f=e[9],u=e[10],g=e[11],b=e[12],p=e[13],x=e[14];let h;e[17]!==f||e[18]!==g||e[19]!==b?(h=t.jsx(f,{className:g,children:b}),e[17]=f,e[18]=g,e[19]=b,e[20]=h):h=e[20];let N;return e[21]!==u||e[22]!==p||e[23]!==x||e[24]!==h?(N=t.jsx(u,{open:p,onOpenChange:x,children:h}),e[21]=u,e[22]=p,e[23]=x,e[24]=h,e[25]=N):N=e[25],N}const Qt=l=>/\.html?$/i.test(l);function Wt(l){const e=S.c(6),{onClose:s}=l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ie,{size:14}),e[0]=i):i=e[0];let o;e[1]!==s?(o=t.jsx(V,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",onClick:s,children:i})}),e[1]=s,e[2]=o):o=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(q,{side:"bottom",children:"Close"}),e[3]=c):c=e[3];let r;return e[4]!==o?(r=t.jsxs(K,{children:[o,c]}),e[4]=o,e[5]=r):r=e[5],r}function Yt(l){const e=S.c(49),{previewPath:s,onClose:i}=l;let o;e[0]!==s?(o=ne(s),e[0]=s,e[1]=o):o=e[1];const c=o,{volume:r,dirPath:a}=c,{data:n,isPending:d}=Oe(r,a),m=Pe(r??"");let f,u,g,b,p,x,h,N,v;if(e[2]!==m||e[3]!==n||e[4]!==a||e[5]!==i||e[6]!==s||e[7]!==r){v=Symbol.for("react.early_return_sentinel");e:{if(u=O(a),f=n&&n.kind==="file"?{key:s,filename:u,size:n.size,downloadUrl:m(n.path)}:null,f&&n&&Qt(u)){const F=f.downloadUrl;let U;e[17]!==n?(U=Ue(n),e[17]=n,e[18]=U):U=e[18];let B;e[19]!==i?(B=t.jsx(Wt,{onClose:i}),e[19]=i,e[20]=B):B=e[20],v=t.jsx(Te,{readUrl:F,marker:U,title:u,savePath:r==="home"?a:void 0,trailing:B},s);break e}N="flex h-full w-full flex-col bg-background",h="flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",g="flex min-w-0 flex-1 items-center gap-2 px-2",b=t.jsx(A,{filename:u,className:"h-4.5 w-3.5 shrink-0"}),e[21]!==u?(p=t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:u}),e[21]=u,e[22]=p):p=e[22],x=f&&t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Ae(f.size)})}e[2]=m,e[3]=n,e[4]=a,e[5]=i,e[6]=s,e[7]=r,e[8]=f,e[9]=u,e[10]=g,e[11]=b,e[12]=p,e[13]=x,e[14]=h,e[15]=N,e[16]=v}else f=e[8],u=e[9],g=e[10],b=e[11],p=e[12],x=e[13],h=e[14],N=e[15],v=e[16];if(v!==Symbol.for("react.early_return_sentinel"))return v;let w;e[23]!==g||e[24]!==b||e[25]!==p||e[26]!==x?(w=t.jsxs("div",{className:g,children:[b,p,x]}),e[23]=g,e[24]=b,e[25]=p,e[26]=x,e[27]=w):w=e[27];let j;e[28]!==f?(j=f&&t.jsxs(t.Fragment,{children:[t.jsxs(K,{children:[t.jsx(V,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",asChild:!0,children:t.jsx("a",{href:f.downloadUrl,download:f.filename,children:t.jsx(ae,{size:14})})})}),t.jsx(q,{side:"bottom",children:"Download"})]}),t.jsxs(K,{children:[t.jsx(V,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",onClick:()=>window.open(f.downloadUrl,"_blank","noopener"),children:t.jsx(Be,{size:14})})}),t.jsx(q,{side:"bottom",children:"Open in new tab"})]})]}),e[28]=f,e[29]=j):j=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Ie,{size:14}),e[30]=C):C=e[30];let k;e[31]!==i?(k=t.jsx(V,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",onClick:i,children:C})}),e[31]=i,e[32]=k):k=e[32];let $;e[33]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(q,{side:"bottom",children:"Close"}),e[33]=$):$=e[33];let z;e[34]!==k?(z=t.jsxs(K,{children:[k,$]}),e[34]=k,e[35]=z):z=e[35];let P;e[36]!==j||e[37]!==z||e[38]!==h||e[39]!==w?(P=t.jsxs("div",{className:h,children:[w,j,z]}),e[36]=j,e[37]=z,e[38]=h,e[39]=w,e[40]=P):P=e[40];let D;e[41]!==f||e[42]!==u||e[43]!==d?(D=t.jsx("div",{className:"relative min-h-0 flex-1",children:f?t.jsx(fe,{file:f}):d?t.jsx(Ee,{}):t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[t.jsx(A,{filename:u,className:"h-7.5 w-6"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."})]})}),e[41]=f,e[42]=u,e[43]=d,e[44]=D):D=e[44];let y;return e[45]!==P||e[46]!==D||e[47]!==N?(y=t.jsxs("div",{className:N,children:[P,D]}),e[45]=P,e[46]=D,e[47]=N,e[48]=y):y=e[48],y}function Zt(l){const e=S.c(21),{skillPath:s,onClose:i}=l,o=ne(s),{volume:c,dirPath:r}=o,a=me(),n=a(c??"",`${r}/SKILL.md`),d=M.fileText(n);let m;e[0]!==n?(m=async()=>{const _=await fetch(n,{credentials:"include"});if(!_.ok)throw new Error(`fetch failed: ${_.status}`);return _.text()},e[0]=n,e[1]=m):m=e[1];let f;e[2]!==d||e[3]!==m?(f={queryKey:d,queryFn:m,staleTime:6e4,retry:!1},e[2]=d,e[3]=m,e[4]=f):f=e[4];const u=J(f),g=Me(c??"",r);let b;e[5]!==r?(b=O(r),e[5]=r,e[6]=b):b=e[6];const p=b;let x;e[7]!==u.data?(x=u.data?He(u.data):null,e[7]=u.data,e[8]=x):x=e[8];const h=x,N=el;let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(_,G)=>N(_.path)?-1:N(G.path)?1:O(_.path).localeCompare(O(G.path)),e[9]=v):v=e[9];const w=(g.data??[]).filter(Jt).sort(v),[j,C]=E.useState(null),k=j===null?null:w.find(_=>_.path===j)??null;let $;e[10]!==i?($=_=>{_||i()},e[10]=i,e[11]=$):$=e[11];let z;e[12]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:t.jsx(Re,{size:18})}),e[12]=z):z=e[12];const P=h?.name??p;let D;e[13]!==P?(D=t.jsx(Z,{className:"flex-1 truncate text-base font-medium text-foreground",children:P}),e[13]=P,e[14]=D):D=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(ct,{asChild:!0,children:t.jsx(T,{variant:"ghost",size:"icon",className:"size-8 shrink-0",children:t.jsx(vt,{size:16})})}),e[15]=y):y=e[15];let F;e[16]!==D?(F=t.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[z,D,y]}),e[16]=D,e[17]=F):F=e[17];let U;e[18]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx("p",{className:"px-2 py-1.5 text-sm font-medium text-foreground",children:"Files"}),e[18]=U):U=e[18];const B="relative flex min-w-0 flex-1 flex-col overflow-y-auto",ie=k?t.jsx(fe,{file:{key:k.path,filename:O(k.path),size:k.size,downloadUrl:a(c??"",k.path)}}):u.isPending?t.jsxs("div",{className:"flex flex-col gap-2 p-6",children:[t.jsx(H,{className:"h-4 w-1/3"}),t.jsx(H,{className:"h-3 w-full"}),t.jsx(H,{className:"h-3 w-5/6"}),t.jsx(H,{className:"h-3 w-2/3"})]}):u.isError||!h?t.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"This skill is no longer available."}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-4 border-b border-border p-6",children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Description"}),t.jsx("p",{className:"text-base text-muted-foreground",children:h.description??"Claude Code skill"})]}),t.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none p-6",children:t.jsx(ht,{id:`skill-preview-${s}`,text:h.body})})]});let Q;return e[19]!==ie?(Q=t.jsx("div",{className:B,children:ie}),e[19]=ie,e[20]=Q):Q=e[20],t.jsx(ce,{open:!0,onOpenChange:$,children:t.jsxs(de,{className:"flex h-[88vh] w-[94vw] max-w-none! flex-col gap-0 overflow-hidden p-0 sm:max-w-5xl!",closeButtonClassName:"hidden",children:[F,t.jsxs("div",{className:"flex min-h-0 flex-1",children:[t.jsxs("div",{className:"flex w-[220px] shrink-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted p-3",children:[U,g.isPending?t.jsx(H,{className:"mx-2 h-4 w-24"}):w.map(_=>{const G=N(_.path)?k===null:j===_.path;return t.jsxs("button",{type:"button",onClick:()=>C(N(_.path)?null:_.path),className:Y("flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left",G?"bg-background shadow-sm":"hover:bg-muted/60"),children:[t.jsx(A,{filename:O(_.path),className:"h-6 w-5 shrink-0"}),t.jsx("span",{className:Y("truncate text-sm",G?"text-foreground":"text-muted-foreground"),children:O(_.path)})]},_.path)})]}),Q]})]})})}function Jt(l){return l.kind==="file"}function el(l){return O(l)==="SKILL.md"}const qe=[{id:"home",description:"Your organization's home folder",glyph:Ze},{id:"uploads",description:"Files your team uploads",glyph:ze},{id:"outputs",description:"Agent run outputs",glyph:et}],Ne=3;function R(l){const e=S.c(2),{children:s}=l;let i;return e[0]!==s?(i=t.jsx("p",{className:"text-[13px] text-foreground",children:s}),e[0]=s,e[1]=i):i=e[1],i}function L(l){const e=S.c(2),{children:s}=l;let i;return e[0]!==s?(i=t.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:s}),e[0]=s,e[1]=i):i=e[1],i}function ge(l){const e=S.c(2),{rows:s}=l,i=s===void 0?1:s;let o;return e[0]!==i?(o=t.jsx(L,{children:Array.from({length:i*3},tl)}),e[0]=i,e[1]=o):o=e[1],o}function tl(l,e){return t.jsx(H,{className:"h-16 rounded-2xl"},e)}function be(l){const e=S.c(2),{children:s}=l;let i;return e[0]!==s?(i=t.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1],i}function ll(l){const e=S.c(6),{volume:s,displayName:i,description:o,glyph:c,onOpen:r}=l,a=gt(s),n=i??s,d=a.data?`${a.data.files} files`:void 0;let m;return e[0]!==o||e[1]!==c||e[2]!==r||e[3]!==n||e[4]!==d?(m=t.jsx(se,{name:n,meta:d,subtitle:o,glyph:c,onOpen:r}),e[0]=o,e[1]=c,e[2]=r,e[3]=n,e[4]=d,e[5]=m):m=e[5],m}function sl(l){const e=S.c(8),{segments:s,onNavigate:i}=l;let o;e[0]!==i?(o=t.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground hover:underline",onClick:()=>i(""),children:"Library"}),e[0]=i,e[1]=o):o=e[1];let c;e[2]!==i||e[3]!==s?(c=s.map((a,n)=>{const d=s.slice(0,n+1).join("/"),m=n===s.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[t.jsx(Qe,{size:12,className:"shrink-0 text-muted-foreground"}),m?t.jsx("span",{className:"truncate font-medium text-foreground",children:a}):t.jsx("button",{type:"button",className:"truncate text-muted-foreground hover:text-foreground hover:underline",onClick:()=>i(d),children:a})]},d)}),e[2]=i,e[3]=s,e[4]=c):c=e[4];let r;return e[5]!==o||e[6]!==c?(r=t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-sm",children:[o,c]}),e[5]=o,e[6]=c,e[7]=r):r=e[7],r}function nl(l){const e=S.c(19),{onOpenDir:s,onOpenFile:i,onDelete:o}=l,{org:c}=$e(),r=jt(),a=Le(),n=me();let d;if(e[0]!==n||e[1]!==o||e[2]!==s||e[3]!==i||e[4]!==c||e[5]!==a.data?.length||e[6]!==r.data||e[7]!==r.isPending){const m=r.data??[],f=m.slice(0,Ne),u=m.slice(Ne);let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(R,{children:"Folders"}),e[9]=g):g=e[9];let b;e[10]!==s||e[11]!==c?(b=qe.map(h=>t.jsx(ll,{volume:h.id,displayName:h.id==="home"?kt(c.slug):void 0,description:h.description,glyph:h.glyph,onOpen:()=>s(h.id)},h.id)),e[10]=s,e[11]=c,e[12]=b):b=e[12];let p;e[13]!==s||e[14]!==a.data?.length?(p=(a.data?.length??0)>0&&t.jsx(se,{name:"public",meta:`${a.data?.length} sets`,subtitle:"Curated skill sets — read-only",glyph:We,readOnly:!0,onOpen:()=>s("public")}),e[13]=s,e[14]=a.data?.length,e[15]=p):p=e[15];let x;e[16]!==b||e[17]!==p?(x=t.jsxs("div",{className:"flex flex-col gap-3",children:[g,t.jsxs(L,{children:[b,p]})]}),e[16]=b,e[17]=p,e[18]=x):x=e[18],d=t.jsxs(t.Fragment,{children:[r.isPending?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(R,{children:"Recently added"}),t.jsx(ge,{})]}):f.length>0?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(R,{children:"Recently added"}),t.jsx(L,{children:f.map(h=>t.jsx(qt,{filename:O(h.path),updatedAt:h.updatedAt,size:h.size,downloadUrl:n(h.volume,h.path),onOpen:()=>i(`${h.volume}/${h.path}`),onDelete:()=>o({volume:h.volume,path:h.path,kind:"file"})},`${h.volume}/${h.path}`))})]}):t.jsx(be,{children:"No files yet — upload one, or ask an agent to produce something."}),x,u.length>0&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(R,{children:"All files"}),t.jsx(L,{children:u.map(h=>t.jsx(Ve,{filename:O(h.path),updatedAt:h.updatedAt,downloadUrl:n(h.volume,h.path),onOpen:()=>i(`${h.volume}/${h.path}`),onDelete:()=>o({volume:h.volume,path:h.path,kind:"file"})},`${h.volume}/${h.path}`))})]})]}),e[0]=n,e[1]=o,e[2]=s,e[3]=i,e[4]=c,e[5]=a.data?.length,e[6]=r.data,e[7]=r.isPending,e[8]=d}else d=e[8];return d}function il(l){const e=S.c(11),{onOpenDir:s}=l,i=Le();if(i.isPending){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(ge,{}),e[0]=n):n=e[0],n}let o;e[1]!==i.data?(o=i.data??[],e[1]=i.data,e[2]=o):o=e[2];const c=o;if(c.length===0){let n;return e[3]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(be,{children:"No public skill sets are configured."}),e[3]=n):n=e[3],n}let r;if(e[4]!==s||e[5]!==c){let n;e[7]!==s?(n=d=>t.jsx(se,{name:d,subtitle:"Read-only",readOnly:!0,onOpen:()=>s(`public/${d}`)},d),e[7]=s,e[8]=n):n=e[8],r=c.map(n),e[4]=s,e[5]=c,e[6]=r}else r=e[6];let a;return e[9]!==r?(a=t.jsx(L,{children:r}),e[9]=r,e[10]=a):a=e[10],a}function rl(l){const e=S.c(25),{location:s,onOpenDir:i,onOpenFile:o,onOpenSkill:c,onDelete:r}=l,a=s.volume??"",n=Me(a,s.dirPath),d=me();if(n.isPending){let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ge,{rows:2}),e[0]=p):p=e[0],p}if(n.isError){const p=n.error instanceof Error?n.error.message:"Failed to load";let x;return e[1]!==p?(x=t.jsx("p",{className:"text-sm text-destructive",children:p}),e[1]=p,e[2]=x):x=e[2],x}let m,f,u,g;if(e[3]!==d||e[4]!==n.data||e[5]!==s||e[6]!==r||e[7]!==i||e[8]!==o||e[9]!==c||e[10]!==a){g=Symbol.for("react.early_return_sentinel");e:{const p=n.data??[],x=p.filter(cl),h=p.filter(al),N=p.filter(ol);if(p.length===0){const j=s.readOnly?"Empty — this read-only set syncs from its GitHub source.":"Empty folder — upload a file or create a folder to get started.";let C;e[15]!==j?(C=t.jsx(be,{children:j}),e[15]=j,e[16]=C):C=e[16],g=C;break e}let v;e[17]!==s.readOnly||e[18]!==r||e[19]!==a?(v=j=>s.readOnly?void 0:()=>r({volume:a,path:j.path,kind:j.kind}),e[17]=s.readOnly,e[18]=r,e[19]=a,e[20]=v):v=e[20];const w=v;m=x.length>0&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(R,{children:"Skills"}),t.jsx(L,{children:x.map(j=>t.jsx(Et,{dirName:O(j.path),updatedAt:j.updatedAt,skillMdUrl:d(a,`${j.path}/SKILL.md`),onOpen:()=>c(W(s,j.path)),onBrowse:()=>i(W(s,j.path)),onDelete:w(j)},j.path))})]}),f=h.length>0&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(R,{children:"Folders"}),t.jsx(L,{children:h.map(j=>t.jsx(se,{name:O(j.path),meta:ee(j.updatedAt),readOnly:s.readOnly,onOpen:()=>i(W(s,j.path)),onDelete:w(j)},j.path))})]}),u=N.length>0&&t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(R,{children:"Files"}),t.jsx(L,{children:N.map(j=>t.jsx(Ve,{filename:O(j.path),updatedAt:j.updatedAt,downloadUrl:d(a,j.path),onOpen:()=>o(W(s,j.path)),onDelete:w(j)},j.path))})]})}e[3]=d,e[4]=n.data,e[5]=s,e[6]=r,e[7]=i,e[8]=o,e[9]=c,e[10]=a,e[11]=m,e[12]=f,e[13]=u,e[14]=g}else m=e[11],f=e[12],u=e[13],g=e[14];if(g!==Symbol.for("react.early_return_sentinel"))return g;let b;return e[21]!==m||e[22]!==f||e[23]!==u?(b=t.jsxs(t.Fragment,{children:[m,f,u]}),e[21]=m,e[22]=f,e[23]=u,e[24]=b):b=e[24],b}function ol(l){return l.kind==="file"}function al(l){return l.kind==="dir"&&!l.hasSkill}function cl(l){return l.kind==="dir"&&l.hasSkill}function ke(){const{org:l}=$e(),e=Ge(),s=Ce(),i=Fe(),o=Se({strict:!1}),c=o.path??"",r=ne(c),a=r.segments.length===0,n=(y,F)=>s({to:".",search:U=>({...U,[y]:F||void 0})}),d=y=>n("path",y),m=y=>n("preview",y),f=y=>n("skill",y),[u,g]=E.useState(null),[b,p]=E.useState(!1),[x,h]=E.useState(""),N=E.useRef(null),v=r.readOnly?null:r.volume??"uploads",w=r.volume?r.dirPath:"",{upload:j,mkdir:C}=ye(v??"uploads"),{remove:k}=ye(u?.volume??"uploads");async function $(y){if(!(!v||!y||y.length===0))try{await j.mutateAsync({dir:w,files:[...y]}),I.success(y.length===1?`Uploaded ${y[0]?.name}`:`Uploaded ${y.length} files`)}catch(F){I.error(F instanceof Error?F.message:"Upload failed")}finally{N.current&&(N.current.value="")}}async function z(){const y=x.trim();if(!(!v||!y))try{await C.mutateAsync(w?`${w}/${y}`:y),I.success(`Folder "${y}" created`),p(!1),h("")}catch(F){I.error(F instanceof Error?F.message:"Failed to create folder")}}async function P(){if(!u)return;const y=u;try{await k.mutateAsync(y.path),I.success(`Deleted ${O(y.path)}`)}catch(F){I.error(F instanceof Error?F.message:"Delete failed")}finally{g(null)}}function D(){for(const y of qe)e.invalidateQueries({queryKey:M.orgFsVolume(l.id,y.id)});r.volume&&e.invalidateQueries({queryKey:M.orgFsVolume(l.id,r.volume)}),e.invalidateQueries({queryKey:M.orgFsRecent(l.id)}),e.invalidateQueries({queryKey:M.orgFsPublicSets(l.id)})}return t.jsxs("div",{className:"h-full overflow-y-auto",children:[t.jsxs("div",{className:"mx-auto flex w-full max-w-[900px] flex-col gap-10 px-6 py-10 lg:px-10",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[!a&&t.jsx(sl,{segments:r.segments,onNavigate:d}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h1",{className:"min-w-0 flex-1 truncate text-xl font-medium text-foreground",children:a?"Library":r.segments.at(-1)??"Library"}),t.jsx(T,{variant:"ghost",size:"icon",onClick:D,"aria-label":"Refresh",children:t.jsx(Xe,{size:14})}),!a&&v&&t.jsxs(T,{variant:"outline",size:"sm",onClick:()=>p(!0),children:[t.jsx(Je,{size:14}),"New folder"]}),r.readOnly?t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx(De,{size:12}),"Read-only"]}):t.jsxs(T,{size:"sm",disabled:j.isPending,onClick:()=>N.current?.click(),children:[t.jsx(ze,{size:14}),j.isPending?"Uploading…":"Upload file"]}),t.jsx("input",{ref:N,type:"file",multiple:!0,className:"hidden",onChange:y=>{$(y.target.files)}})]})]}),a?t.jsx(nl,{onOpenDir:d,onOpenFile:m,onDelete:g}):r.volume===null?t.jsx(il,{onOpenDir:d}):t.jsx(rl,{location:r,onOpenDir:d,onOpenFile:m,onOpenSkill:f,onDelete:g},r.volume)]}),o.preview?i&&t.jsx(Xt,{previewPath:o.preview,onClose:()=>n("preview",null)}):o.skill?t.jsx(Zt,{skillPath:o.skill,onClose:()=>n("skill",null)},o.skill):null,t.jsx(ce,{open:b,onOpenChange:p,children:t.jsxs(de,{children:[t.jsxs(dt,{children:[t.jsx(Z,{children:"New folder"}),t.jsxs(ft,{children:["Create a folder in ",c||"the library","."]})]}),t.jsx(ut,{autoFocus:!0,placeholder:"folder-name",value:x,onChange:y=>h(y.target.value),onKeyDown:y=>{y.key==="Enter"&&z()}}),t.jsxs(mt,{children:[t.jsx(T,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),t.jsx(T,{disabled:!x.trim()||C.isPending,onClick:()=>{z()},children:"Create"})]})]})}),t.jsx(tt,{open:u!==null,onOpenChange:y=>{y||g(null)},children:t.jsxs(lt,{children:[t.jsxs(st,{children:[t.jsxs(nt,{children:["Delete ",u?O(u.path):"","?"]}),t.jsx(it,{children:u?.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."})]}),t.jsxs(rt,{children:[t.jsx(ot,{children:"Cancel"}),t.jsx(at,{onClick:()=>{P()},children:"Delete"})]})]})})]})}function Ll(){const l=S.c(13),e=Fe(),s=Ce();let i;l[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},l[0]=i):i=l[0];const c=Se(i).preview;let r;l[1]!==c?(r=c?O(c):"",l[1]=c,l[2]=r):r=l[2];const a=r;let n;l[3]!==s?(n=()=>s({to:".",search:dl}),l[3]=s,l[4]=n):n=l[4];const d=n;if(e){let g;return l[5]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:t.jsx(re,{children:t.jsx(ke,{})})}),l[5]=g):g=l[5],g}let m;l[6]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(ve,{order:1,minSize:30,defaultSize:55,children:t.jsx("div",{className:"h-full p-0.5 pt-0.25",children:t.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:t.jsx(re,{children:t.jsx(ke,{})})})})}),l[6]=m):m=l[6];let f;l[7]!==d||l[8]!==a||l[9]!==c?(f=c&&t.jsxs(t.Fragment,{children:[t.jsx(xt.Tabs,{children:t.jsx(pt,{title:a,icon:{kind:"component",Component:g=>t.jsx(A,{filename:a,...g})},active:!0,onClick:d})}),t.jsx(bt,{className:"bg-sidebar"}),t.jsx(ve,{order:2,minSize:25,defaultSize:45,children:t.jsx("div",{className:"h-full p-0.5 pt-0.25",children:t.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:t.jsx(re,{children:t.jsx(Yt,{previewPath:c,onClose:d})})})})})]}),l[7]=d,l[8]=a,l[9]=c,l[10]=f):f=l[10];let u;return l[11]!==f?(u=t.jsxs(yt,{direction:"horizontal",className:"min-h-0 flex-1 pt-0 pr-1 pb-1 pl-0",children:[m,f]}),l[11]=f,l[12]=u):u=l[12],u}function dl(l){return{...l,preview:void 0}}export{Ll as default};
@@ -1 +1 @@
1
- import{bC as _}from"./index-rZ1TPVyD.js";var S={exports:{}},r={};var $;function C(){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 I(){return v||(v=1,S.exports=C()),S.exports}var g=I();const h=_(g);export{h as R,g as r};
1
+ import{bC as _}from"./index-Cbngzld3.js";var S={exports:{}},r={};var $;function C(){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 I(){return v||(v=1,S.exports=C()),S.exports}var g=I();const h=_(g);export{h as R,g as r};
@@ -1,4 +1,4 @@
1
- import{e as le,r as K,f as bt,q as Be,j as t,B as Z,o as Ce,c as ce,K as it,n as yt,v as ss,d as rs,t as xt,E as ls}from"./index-rZ1TPVyD.js";import{S as os}from"./search-input-DbmU5zU8.js";import{P as Me}from"./index-DO3UwA_I.js";import{E as wt}from"./empty-state-BhV-zl-f.js";import{R as as}from"./require-capability-6kSOKhdT.js";import{o as kt}from"./pair-DYb6YfcG.js";import{B as rt}from"./badge-CY1rqnYU.js";import{P as ct,a as dt,b as mt}from"./popover-Bk3EwUPD.js";import{b as Ze,T as et,a as tt}from"./tooltip-ua4lJTzI.js";import{i as ft}from"./Check-6LmIKXJj.js";import{a as Xe}from"./Eye-BNS1RmzG.js";import{n as Tt}from"./Globe01-DjWlKHom.js";import{i as Pt}from"./FilterLines-BSmtfAHG.js";import{i as ns}from"./Key01-D6jyUgYu.js";import{i as is}from"./Play-DApzrsBx.js";import{a9 as cs,aa as ds,R as ms,G as us}from"./agent-icon-CpBAbwoh.js";import{M as Mt}from"./monaco-editor-C-H4UmIT.js";import{u as xs}from"./use-members-BaX0tyb1.js";import{u as _t}from"./use-connection-CyWLUiRu.js";import{a as fs,u as ps,W as hs}from"./use-mcp-client-CGBZ7ekq.js";import{a as gs}from"./use-virtual-mcp-mhycHzLS.js";import{n as Qe}from"./Container-Bl0qWNtu.js";import{c as js}from"./SwitchHorizontal01-CkwE98n9.js";import{s as vs}from"./Plus-Do6ZWheh.js";import{s as Ns}from"./Trash01-Bifm5Wb3.js";import{I as Ge}from"./input-BPXWlz46.js";import{g as bs,b as Dt,f as st,a as At,c as pt,d as ys,e as Lt,h as Vt,A as ws,T as Ss,i as Is,M as ht}from"./automation-runs-D8yf4pum.js";import{S as lt,a as ot,b as at,c as Re,d as nt}from"./select-DRqZIuLQ.js";import{S as Cs}from"./scroll-area-QXSqgT3C.js";import{t as Ut}from"./ChevronDown-CaCYdoie.js";import{C as ks}from"./calendar-vde5tCHf.js";import{T as Ts}from"./textarea-Bymi75yx.js";import{C as Kt}from"./collection-tabs-BGsvaOVA.js";import{S as Ms}from"./switch-rL3a0x4B.js";import{L as _s}from"./label-CzVCjiiL.js";import{I as qe}from"./integration-icon-CWT0gSfx.js";import{A as qt}from"./avatar-nCSKoB6F.js";import{A as Ds,a as Ls,b as Rs}from"./alert-C_aVuLV8.js";import{C as Bt}from"./card-CYGsSb57.js";import{K as ke}from"./monitoring-stats-row-Bjwv0PCc.js";import{u as Ht}from"./studio-tools-jbRVdtpc.js";import{g as Fs}from"./connection-slug-eyAPH6o3.js";import{u as $s}from"./useSuspenseInfiniteQuery-DGO3SU3a.js";import{d as zs,S as Os,a as Es,b as Ps}from"./sheet-Dsfk9URc.js";import{T as De,a as ut,b as Jt,c as Gt,d as Qt,e as oe}from"./table-cHRXPecF.js";import{n as As}from"./ChevronUp-DkGtzqyl.js";import{u as Vs}from"./use-infinite-scroll-B2zyjKex.js";import{c as Us,b as Ks}from"./use-automations-DGe3A7k6.js";import"./SearchMd-B4Lavo8e.js";import"./sidebar-B3SsvTHC.js";import"./LayoutLeft-C7Cmt2J8.js";import"./use-capability-B2IrzHkM.js";import"./access-gate-BELP4oqa.js";import"./capability-load-error-DYWpzVHl.js";import"./Stars01-ANwy09AP.js";import"./XCircle-CiiIVhRh.js";import"./ChevronRight-kLRVkGUs.js";import"./use-clock-tick-x-ip1-Lp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-nAd5EMaO.js";import"./file-type-icon-35VBMVCk.js";import"./dialog-CxpeEAA2.js";import"./X-BWR0-4rz.js";import"./ZoomOut-B1VNHI1K.js";import"./content-blocks-o63cs2vh.js";import"./types-DJl0mitR.js";import"./chat-context-CDygsN4Q.js";import"./tab-id-hZWLCmfc.js";import"./watch-sse-pool-Bo209v56.js";import"./decopilot-sse-pool-C2fCSDxg.js";import"./use-ai-providers-P6PF7YRx.js";import"./use-organization-settings-D68AqLOQ.js";import"./AlertCircle-rpaL6q8T.js";import"./Star01-QoJ-qcfh.js";import"./XClose-D0wmxYTF.js";import"./ZapSquare-CxE5iHdd.js";import"./Tool01-B0zT3ots.js";import"./Monitor01-DBfOkkx9.js";import"./Upload01-mjA8r4Fi.js";import"./shell-layout-DkW3B_MZ.js";import"./Users03-C5i2CKOP.js";import"./Stars02-C17u9BVa.js";import"./CheckCircle-D0kUlRsN.js";import"./Zap-BGp3QjmM.js";import"./required-auth-layout-YEZh9H2w.js";import"./useRouterState-qr3F3XJE.js";import"./use-org-sso-B8CLPiZl.js";import"./LinkExternal01-B6flmd1s.js";import"./Palette-BX6fdd-v.js";import"./use-navigate-to-agent-5w6ZqBss.js";import"./use-mcp-prompts-BQNNtRte.js";import"./form-Ci8PGt-R.js";import"./spinner-DZmgr2qu.js";import"./RefreshCcw01-CW918RSV.js";import"./ArrowUpRight-D7_4FAQ5.js";import"./ChevronLeft-BuXkBFIm.js";import"./DotsVertical-CvhOKI-w.js";import"./HardDrive-Dx3Blqhn.js";import"./Sun-D4yzlyEv.js";import"./Settings02-B57k_aEv.js";import"./Shield01-CFDfVqiL.js";import"./User01-BZL6tFVt.js";import"./Users01-CqVfleMx.js";import"./index-DppjWA7O.js";import"./use-org-auth-client-CLnnUl3h.js";import"./use-collections-Dvp_IbhN.js";import"./useInfiniteQuery-k6dph5MZ.js";import"./task-status-Cqn0_tco.js";import"./checkbox-vKl7eadT.js";import"./command-KCI9wvsu.js";import"./index-BEe1oLVg.js";import"./index-D9SSFpE5.js";const vt={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function Le(s){return s.filter(e=>e.key.trim()).map(e=>{const r=encodeURIComponent(e.key.trim()),l=encodeURIComponent(e.value||"");return`${r}:${e.operator}:${l}`}).join(",")}function qs(s){return s?s.split(",").map(e=>{const[r,l,...a]=e.split(":");return{key:decodeURIComponent(r||""),operator:l||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function Ye(s){return s.filter(e=>e.key.trim()).map(e=>{switch(e.operator){case"eq":return`${e.key}=${e.value}`;case"contains":return`${e.key}~${e.value}`;case"exists":return`${e.key}?`;case"in":return`${e.key}@${e.value}`}}).join(`
1
+ import{e as le,r as K,f as bt,q as Be,j as t,B as Z,o as Ce,c as ce,K as it,n as yt,v as ss,d as rs,t as xt,E as ls}from"./index-Cbngzld3.js";import{S as os}from"./search-input-BlmktcqH.js";import{P as Me}from"./index-BFPk_Xc8.js";import{E as wt}from"./empty-state-D5f29Xcz.js";import{R as as}from"./require-capability-Cm5KwYyo.js";import{o as kt}from"./pair-DGfi0DYT.js";import{B as rt}from"./badge-CTK5gX_I.js";import{P as ct,a as dt,b as mt}from"./popover-DIhiGQZO.js";import{b as Ze,T as et,a as tt}from"./tooltip--aN5hOmO.js";import{i as ft}from"./Check-BUKt5vhH.js";import{a as Xe}from"./Eye-Bk7j3Cz0.js";import{n as Tt}from"./Globe01-C8CeCAhz.js";import{i as Pt}from"./FilterLines-xOxNVJBa.js";import{i as ns}from"./Key01-ChQ6WmeN.js";import{i as is}from"./Play-BXW8gJMz.js";import{a9 as cs,aa as ds,R as ms,G as us}from"./agent-icon-BgD5mt7Y.js";import{M as Mt}from"./monaco-editor-CwH2NVur.js";import{u as xs}from"./use-members--qC59KQg.js";import{u as _t}from"./use-connection-Zog2j0WA.js";import{a as fs,u as ps,W as hs}from"./use-mcp-client-BNpG-Sq-.js";import{a as gs}from"./use-virtual-mcp-CfnJ2csQ.js";import{n as Qe}from"./Container-RGkdLpnR.js";import{c as js}from"./SwitchHorizontal01-MAz-yRbe.js";import{s as vs}from"./Plus-CugY_4xX.js";import{s as Ns}from"./Trash01-BJ6_IzkG.js";import{I as Ge}from"./input-CxWmKS03.js";import{g as bs,b as Dt,f as st,a as At,c as pt,d as ys,e as Lt,h as Vt,A as ws,T as Ss,i as Is,M as ht}from"./automation-runs-BUOdfMri.js";import{S as lt,a as ot,b as at,c as Re,d as nt}from"./select-DJ-jQ95-.js";import{S as Cs}from"./scroll-area-BCusTvyt.js";import{t as Ut}from"./ChevronDown-C6ULHnU-.js";import{C as ks}from"./calendar-DMziTV2J.js";import{T as Ts}from"./textarea-uwm8kgXD.js";import{C as Kt}from"./collection-tabs-CcnS0Il2.js";import{S as Ms}from"./switch-jfclxkGe.js";import{L as _s}from"./label-BUOqnJ7l.js";import{I as qe}from"./integration-icon-C8l8gk56.js";import{A as qt}from"./avatar-DYsooxxy.js";import{A as Ds,a as Ls,b as Rs}from"./alert-C7cWRVuG.js";import{C as Bt}from"./card-DGQIgBVW.js";import{K as ke}from"./monitoring-stats-row-_N9Geab-.js";import{u as Ht}from"./studio-tools-B99HmIGq.js";import{g as Fs}from"./connection-slug-eyAPH6o3.js";import{u as $s}from"./useSuspenseInfiniteQuery-ZAutmGB6.js";import{d as zs,S as Os,a as Es,b as Ps}from"./sheet-4VDYc-Lf.js";import{T as De,a as ut,b as Jt,c as Gt,d as Qt,e as oe}from"./table-DEsh_yYm.js";import{n as As}from"./ChevronUp-C5QGzLz6.js";import{u as Vs}from"./use-infinite-scroll-RcbuivWg.js";import{c as Us,b as Ks}from"./use-automations-CtzZDGfB.js";import"./SearchMd-DltTVRsJ.js";import"./sidebar-DeB8mcen.js";import"./LayoutLeft-D3sIkDa-.js";import"./use-capability-KB17PgvY.js";import"./access-gate-DZ_2pDdY.js";import"./capability-load-error-BTLQ23rW.js";import"./Stars01-BPnYJgb7.js";import"./XCircle-D9dvtOsK.js";import"./ChevronRight-glzdqN1s.js";import"./use-clock-tick-CbDuKmI6.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-CZHdrpQ2.js";import"./file-type-icon-9GbQJJla.js";import"./dialog-BVuxcsVk.js";import"./X-BQX3Zy-X.js";import"./ZoomOut-DVfZ-43U.js";import"./content-blocks-o63cs2vh.js";import"./types-BqoD-In5.js";import"./chat-context-BwBc2M6a.js";import"./tab-id-C7uvN0td.js";import"./watch-sse-pool-CzyBkAGb.js";import"./decopilot-sse-pool-COADWaXW.js";import"./use-ai-providers-CdyP1ECQ.js";import"./use-organization-settings-BYRiagaB.js";import"./AlertCircle-CQgcG-Ae.js";import"./Star01-D8Xy046a.js";import"./XClose-DaB-YREn.js";import"./ZapSquare-cM9Cdjuc.js";import"./Tool01-Cjstio7H.js";import"./Monitor01-BzTgEIFJ.js";import"./Upload01-C2pjhIpk.js";import"./shell-layout-BtNaHUcu.js";import"./Users03-BqYE15gt.js";import"./Stars02-CP1Go7Ud.js";import"./CheckCircle-x4whH3Qn.js";import"./Zap-j4DAJVgz.js";import"./required-auth-layout-C2qJiXM7.js";import"./useRouterState-somQ9b5z.js";import"./use-org-sso-D9s0K3D9.js";import"./LinkExternal01-DNf7UuUK.js";import"./Palette-DwfZnoA5.js";import"./use-navigate-to-agent-nRLYSeRD.js";import"./use-mcp-prompts-DXY1goeC.js";import"./form-D5zHXlMU.js";import"./spinner-Dar3jTAz.js";import"./RefreshCcw01-DiPX3Tzc.js";import"./ArrowUpRight-D0znd3JO.js";import"./ChevronLeft-Btt_21CS.js";import"./DotsVertical-BrpflBsP.js";import"./HardDrive-Czbw3MRd.js";import"./Sun-BsWLyXgw.js";import"./Settings02-sAiuI7qb.js";import"./Shield01-C-4y3Jk3.js";import"./User01-D2zO49mC.js";import"./Users01-ubeIr2qn.js";import"./index-DEkPGwPd.js";import"./use-org-auth-client-vlAtiOoY.js";import"./use-collections-shQIB33q.js";import"./useInfiniteQuery-g2cikAaR.js";import"./task-status-Ds87FkqY.js";import"./checkbox-B-MHp2m4.js";import"./command-DNZKPE8c.js";import"./index-C_RnYmCN.js";import"./index-BZGVDk3g.js";const vt={maxJsonRenderSize:5e4,pageSize:50,streamingRefetchInterval:3e3};function Le(s){return s.filter(e=>e.key.trim()).map(e=>{const r=encodeURIComponent(e.key.trim()),l=encodeURIComponent(e.value||"");return`${r}:${e.operator}:${l}`}).join(",")}function qs(s){return s?s.split(",").map(e=>{const[r,l,...a]=e.split(":");return{key:decodeURIComponent(r||""),operator:l||"eq",value:decodeURIComponent(a.join(":")||"")}}):[]}function Ye(s){return s.filter(e=>e.key.trim()).map(e=>{switch(e.operator){case"eq":return`${e.key}=${e.value}`;case"contains":return`${e.key}~${e.value}`;case"exists":return`${e.key}?`;case"in":return`${e.key}@${e.value}`}}).join(`
2
2
  `)}function Rt(s){return s.trim()?s.split(`
3
3
  `).map(e=>e.trim()).filter(e=>e.length>0).map(e=>{if(e.endsWith("?"))return{key:e.slice(0,-1),operator:"exists",value:""};if(e.includes("=")){const[r,...l]=e.split("=");return{key:r||"",operator:"eq",value:l.join("=")}}if(e.includes("~")){const[r,...l]=e.split("~");return{key:r||"",operator:"contains",value:l.join("~")}}if(e.includes("@")){const[r,...l]=e.split("@");return{key:r||"",operator:"in",value:l.join("@")}}return{key:e,operator:"exists",value:""}}):[]}function Bs(s){const e={},r={},l=[],a={};for(const o of s)if(o.key.trim())switch(o.operator){case"eq":o.value&&(e[o.key]=o.value);break;case"contains":o.value&&(r[o.key]=`%${o.value}%`);break;case"exists":l.push(o.key);break;case"in":o.value&&(a[o.key]=o.value);break}return{properties:Object.keys(e).length>0?e:void 0,propertyPatterns:Object.keys(r).length>0?r:void 0,propertyKeys:l.length>0?l:void 0,propertyInValues:Object.keys(a).length>0?a:void 0}}function Ft(s){if(!s)return{content:"null",isTruncated:!1,originalSize:4};if(typeof s._decocms_truncated=="string")return{content:s._decocms_truncated,isTruncated:!0,originalSize:s._decocms_truncated.length};const e=JSON.stringify(s,null,2),r=e.length;return r<=vt.maxJsonRenderSize?{content:e,isTruncated:!1,originalSize:r}:{content:e.slice(0,vt.maxJsonRenderSize)+`
4
4