decocms 3.36.8 → 3.37.0

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 (241) hide show
  1. package/dist/client/assets/{AlertCircle-diUVbO2-.js → AlertCircle-B8wgh1Ly.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DZao7AcN.js → ArrowUpRight-DFourmXp.js} +1 -1
  3. package/dist/client/assets/{Check-BKIJF1cF.js → Check-D0urCyzd.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-BEdczdw2.js → CheckCircle-Qyp95spV.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-CibD7WLD.js → ChevronDown-DwPK2mcP.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-DnwnYIMW.js → ChevronLeft-C357wJbK.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-BkNktb2f.js → ChevronRight-pxM9WiYB.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-DGD0GGvF.js → ChevronUp-DNp3BStr.js} +1 -1
  9. package/dist/client/assets/{Container-u2OVN7H1.js → Container-CwEfFXez.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CJXQkRAx.js → DotsVertical-DE_SmTP3.js} +1 -1
  11. package/dist/client/assets/{Eye-Dl4wUVA0.js → Eye-Cfv_RGHV.js} +1 -1
  12. package/dist/client/assets/{FilterLines-Ckb-C13v.js → FilterLines-91VA8muG.js} +1 -1
  13. package/dist/client/assets/{Globe01-DuXtiXmT.js → Globe01-ho0SCMcq.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DsvvHov8.js → HardDrive-B_FOclPu.js} +1 -1
  15. package/dist/client/assets/{Key01-CamRGqdp.js → Key01-iwxkuIvh.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-RNub1vlB.js → LayoutLeft-UZ6_8WBi.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-CkMjIxNM.js → LinkExternal01-Zwfdiaw5.js} +1 -1
  18. package/dist/client/assets/{Monitor01-CMEyE7XK.js → Monitor01-CwZrvxuC.js} +1 -1
  19. package/dist/client/assets/{Palette-3y8-lyYx.js → Palette-D6gsHlnc.js} +1 -1
  20. package/dist/client/assets/{Play-BWUsEKn-.js → Play-CvfmKRq2.js} +1 -1
  21. package/dist/client/assets/{Plus-CKCNLZUU.js → Plus-BCfK0mBl.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-Gjck8qdC.js → RefreshCcw01-k5H1KZCV.js} +1 -1
  23. package/dist/client/assets/{SearchMd-C9j-gudR.js → SearchMd-CPNqbMGc.js} +1 -1
  24. package/dist/client/assets/{Settings02-CYtGjYiT.js → Settings02-sp3cCEp1.js} +1 -1
  25. package/dist/client/assets/{Shield01-CnPBBwr9.js → Shield01-BnTZT70O.js} +1 -1
  26. package/dist/client/assets/{Star01-DkjN3wmL.js → Star01-C3iVmnF7.js} +1 -1
  27. package/dist/client/assets/{Stars01-CGinyuoF.js → Stars01-spNf2CVt.js} +1 -1
  28. package/dist/client/assets/{Stars02-8XRN5mVg.js → Stars02-DTJjqSl_.js} +1 -1
  29. package/dist/client/assets/{Sun-B5JsbdJQ.js → Sun-Bd_n5MS2.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-D_ioy5qF.js → SwitchHorizontal01--RQkLq3s.js} +1 -1
  31. package/dist/client/assets/{Tool01-WP19hvhy.js → Tool01-UC0L2ZqT.js} +1 -1
  32. package/dist/client/assets/{Trash01-ysxYI5Wr.js → Trash01-C89-wTac.js} +1 -1
  33. package/dist/client/assets/{Upload01-BEUiJeg2.js → Upload01-CvoLArfG.js} +1 -1
  34. package/dist/client/assets/{User01--nPpP5WD.js → User01-CHDBPbMe.js} +1 -1
  35. package/dist/client/assets/{Users01-CJfUt2eU.js → Users01-AMiQvbzx.js} +1 -1
  36. package/dist/client/assets/{Users03-C0zNVryE.js → Users03-z8pz4cwj.js} +1 -1
  37. package/dist/client/assets/{X-Dk_6ic2Z.js → X-ncGdMje6.js} +1 -1
  38. package/dist/client/assets/{XCircle-CbslYmbl.js → XCircle-BOJh16Ag.js} +1 -1
  39. package/dist/client/assets/{XClose-MySSOydc.js → XClose-xAOdH2ec.js} +1 -1
  40. package/dist/client/assets/{Zap-qtt4gXCs.js → Zap-DRqUuFzT.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-DiFDNaz3.js → ZapSquare-CgDDvUYJ.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-BEjoQvI4.js → ZoomOut-BX0KAK4E.js} +1 -1
  43. package/dist/client/assets/{access-gate-ngcc1WVS.js → access-gate--AqGaZB3.js} +1 -1
  44. package/dist/client/assets/{accordion-BOcO2Sna.js → accordion-BuZO_I6n.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-CJp9aW-b.js → add-section-modal-rYMlcfZK.js} +1 -1
  46. package/dist/client/assets/agent-capabilities-CqovZOHW.js +3 -0
  47. package/dist/client/assets/{agent-icon-DDCLA9rm.js → agent-icon-BSv2ZliY.js} +1 -1
  48. package/dist/client/assets/{agents-list-B0tfBLmN.js → agents-list-CmYCHfAQ.js} +1 -1
  49. package/dist/client/assets/{ai-providers-CFrOqxsn.js → ai-providers-6F9F9DIs.js} +1 -1
  50. package/dist/client/assets/{alert-BBvLAZ8F.js → alert-CcZNr6SG.js} +1 -1
  51. package/dist/client/assets/{alert-dialog-Czjj9xUL.js → alert-dialog-CAUF2lG9.js} +1 -1
  52. package/dist/client/assets/app-editor-B-eeqhg_.js +1 -0
  53. package/dist/client/assets/{auth-CiDtyFcv.js → auth-BL0nL9hg.js} +1 -1
  54. package/dist/client/assets/{auth-catchall-B0-jSWZU.js → auth-catchall-BOZa6JWc.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-BIBJaUjk.js → auth-split-layout-DPGpfEMf.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-ComFNSHa.js → automation-list-row-6ykDco-o.js} +1 -1
  57. package/dist/client/assets/{automation-runs-CwgZcPxU.js → automation-runs-DqEY9N3m.js} +1 -1
  58. package/dist/client/assets/{automations-CmFLKPOX.js → automations-DYa5K7uf.js} +1 -1
  59. package/dist/client/assets/{avatar-B0oOQW3w.js → avatar-CKQTxZ1l.js} +1 -1
  60. package/dist/client/assets/{badge-CPbLyufC.js → badge-8nbtF57a.js} +1 -1
  61. package/dist/client/assets/{brand-context-BNo29QkS.js → brand-context-Keh-FgCI.js} +1 -1
  62. package/dist/client/assets/{buckets-BTWRkLl1.js → buckets-v205fCPo.js} +1 -1
  63. package/dist/client/assets/{calendar-LmdrkG8B.js → calendar-BvmyrwZT.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-BU8SCPcT.js → capability-load-error-CgPvQ3DP.js} +1 -1
  65. package/dist/client/assets/{card-DdkEdLE9.js → card-CSrfjLPK.js} +1 -1
  66. package/dist/client/assets/chat-context-CX93kZ3t.js +21 -0
  67. package/dist/client/assets/{checkbox-BC4wIenO.js → checkbox-emZqfNka.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-DL51rx0C.js → cli-auth-success-TnF4DMg7.js} +1 -1
  69. package/dist/client/assets/{collection-detail-BiWubvHL.js → collection-detail-BT1eAXzt.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-tErBbn-6.js → collection-display-button-Cn53vdgk.js} +1 -1
  71. package/dist/client/assets/{collection-search-GY1bal72.js → collection-search-DtWJHNG9.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-BLpY2FjH.js → collection-table-wrapper-5l1s21E3.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-VcC-MXis.js → collection-tabs-BfVE1VBn.js} +1 -1
  74. package/dist/client/assets/{collections-DFUCvejZ.js → collections-CccDziah.js} +1 -1
  75. package/dist/client/assets/{command-DTlk4TO1.js → command-B9-QuD3I.js} +1 -1
  76. package/dist/client/assets/connect-desktop-dialog-Brphey_z.js +1 -0
  77. package/dist/client/assets/{connection-card-J_SBwL8x.js → connection-card-BT3OrnD0.js} +1 -1
  78. package/dist/client/assets/{connection-detail-BiRkgy_l.js → connection-detail-CbSv2HSL.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-BkqhduE1.js → connection-form-helpers-jwqRoSno.js} +1 -1
  80. package/dist/client/assets/{connections-BcU9kTAE.js → connections-Ye6Uy5rT.js} +1 -1
  81. package/dist/client/assets/{decopilot-BIeINY_s.js → decopilot-qvpc7Sek.js} +2 -2
  82. package/dist/client/assets/decopilot-sse-pool-C1TU9aOA.js +1 -0
  83. package/dist/client/assets/{dialog-BQ75yEwF.js → dialog-NPdsRr2K.js} +1 -1
  84. package/dist/client/assets/{domain-settings-e1Vus4xL.js → domain-settings-CkRknwBG.js} +1 -1
  85. package/dist/client/assets/{drawer-DHZ6TiZV.js → drawer-C8_o0ImI.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-C9Apf8St.js → dropdown-menu-B7tRotB5.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-uPTvMT1i.js → dynamic-plugin-layout-BOuZuhA_.js} +1 -1
  88. package/dist/client/assets/{empty-state-lFjdJT7F.js → empty-state-B5-XU_Qq.js} +1 -1
  89. package/dist/client/assets/{empty-state-DneBSEGo.js → empty-state-DAGj9d4y.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-DY_wdsqB.js → extract-connection-data-gSFD29EZ.js} +1 -1
  91. package/dist/client/assets/{features-9TbsLZr4.js → features-d8fgsMPi.js} +1 -1
  92. package/dist/client/assets/{file-explorer-9WRP-9UQ.js → file-explorer-DQz3ihEX.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-BMtzYhxY.js → file-type-icon-BQd_cgeD.js} +1 -1
  94. package/dist/client/assets/{files-Dhl8Q6Au.js → files-BbwS0mtG.js} +1 -1
  95. package/dist/client/assets/{form-CvLuR0Gb.js → form-Cj4RGsYg.js} +1 -1
  96. package/dist/client/assets/{general-2s032ZcY.js → general-BpEOoyW8.js} +1 -1
  97. package/dist/client/assets/{generate-id-Df1_2KNe.js → generate-id-ofakiB8n.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-DC8oHexa.js → github-repo-picker-mW07O8yJ.js} +1 -1
  99. package/dist/client/assets/{header-tab-button-BfAGzd8m.js → header-tab-button-D7VApmY0.js} +1 -1
  100. package/dist/client/assets/{hover-card-4KBIFi9j.js → hover-card-6VdpmsDU.js} +1 -1
  101. package/dist/client/assets/{image-field-KauoRkxt.js → image-field-Bcq-hVOg.js} +1 -1
  102. package/dist/client/assets/{index-6v8yQXXA.js → index-B9ecm8uM.js} +1 -1
  103. package/dist/client/assets/{index-D1RdoGnd.js → index-BtFMBt2v.js} +1 -1
  104. package/dist/client/assets/{index-CHcXeW8J.js → index-C81KKEdc.js} +1 -1
  105. package/dist/client/assets/{index-CZmaPtza.js → index-CH6rJ--L.js} +24 -24
  106. package/dist/client/assets/index-CTTuPnXB.js +1 -0
  107. package/dist/client/assets/{index-Bge_3NUT.js → index-CZc_n55l.js} +1 -1
  108. package/dist/client/assets/{index-BBsNs16v.js → index-Cl6oCTqk.js} +1 -1
  109. package/dist/client/assets/{index-CiA0zZvI.js → index-DF2vRBkT.js} +1 -1
  110. package/dist/client/assets/{index-D7zMM4W4.js → index-DGGjIheX.js} +3 -3
  111. package/dist/client/assets/{index-CfcqKeX1.js → index-DK5lK69Y.js} +1 -1
  112. package/dist/client/assets/{index-BkjOXm-U.js → index-DP7f4jv4.js} +1 -1
  113. package/dist/client/assets/{index-DAz0gT0O.js → index-Dx3qMd9z.js} +1 -1
  114. package/dist/client/assets/{index-DOOpysP1.js → index-b2M5sZOB.js} +1 -1
  115. package/dist/client/assets/{index-DY-zRdhZ.js → index-pTlAPI8b.js} +1 -1
  116. package/dist/client/assets/{index-redirect-DHEXmWaA.js → index-redirect-ByzWgrxP.js} +1 -1
  117. package/dist/client/assets/{index-DAqaT6Rd.js → index-u7WCkeqH.js} +1 -1
  118. package/dist/client/assets/{input-DlpqEr8E.js → input-DYsPOaw4.js} +1 -1
  119. package/dist/client/assets/{integration-icon-CBAKG0Pi.js → integration-icon-DPU9dY8x.js} +1 -1
  120. package/dist/client/assets/{label-BCg8KKvZ.js → label-Mdkg-a4K.js} +1 -1
  121. package/dist/client/assets/{layout-DXZ4W4co.js → layout-CU5iFDsE.js} +1 -1
  122. package/dist/client/assets/{login-CojfjNfQ.js → login-d0pplMa6.js} +1 -1
  123. package/dist/client/assets/{mcp-oauth-X7hs3Ag9.js → mcp-oauth-Volcctly.js} +1 -1
  124. package/dist/client/assets/{members-B8fViDTN.js → members-BK5L7JQD.js} +1 -1
  125. package/dist/client/assets/{monaco-editor-CIH-AKEP.js → monaco-editor-4CF0qu1C.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-CCcAAEao.js → monitoring-stats-row-CFGsDpK7.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-CZccUhJ6.js → oauth-callback-DhqXwpa8.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-CFS2UJsP.js → oauth-callback-ai-provider-BHSpzZke.js} +1 -1
  129. package/dist/client/assets/{onboarding-BRAoHg0Y.js → onboarding-DUe6TykK.js} +1 -1
  130. package/dist/client/assets/{org-install-DcjkeQWQ.js → org-install-DamvG0TG.js} +1 -1
  131. package/dist/client/assets/{org-layout-CoTqhSTr.js → org-layout-3uHDqMYh.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-OiLrrpvb.js → org-plugin-layout-CP8-PFlP.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-29P9gMgJ.js → page-seo-form-Co3gV6nS.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-DlQgt1ce.js +1 -0
  135. package/dist/client/assets/{pair-DbqLAr7H.js → pair-nJ1ZiPVr.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-clkVquTR.js → plugin-empty-state-B_fcTgAM.js} +1 -1
  137. package/dist/client/assets/{plugin-header-CvCFe8sm.js → plugin-header-zj7BhYV0.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-bpk5-ppI.js → plugin-layout-BXugA7sH.js} +1 -1
  139. package/dist/client/assets/{popover-CGxVd8dj.js → popover-CCUenseZ.js} +1 -1
  140. package/dist/client/assets/{post-editor-BRDFK_L9.js → post-editor-BmGcYIO1.js} +1 -1
  141. package/dist/client/assets/{primitives-BjOQ6kiW.js → primitives-DDWQanLc.js} +1 -1
  142. package/dist/client/assets/{profile-DXYWvJhr.js → profile-pOgFJgzN.js} +1 -1
  143. package/dist/client/assets/project-app-view-DADZJkAJ.js +1 -0
  144. package/dist/client/assets/record-editor-DwZPV8Tp.js +1 -0
  145. package/dist/client/assets/registry-DpZxa23w.js +2 -0
  146. package/dist/client/assets/{registry-layout-KpLfwb01.js → registry-layout-vrycAExD.js} +1 -1
  147. package/dist/client/assets/{require-capability-siE8o61Y.js → require-capability-DDdNdDdz.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-B6wlMeXp.js → required-auth-layout-Dvl8wW25.js} +1 -1
  149. package/dist/client/assets/{reset-password-DMGhuy3g.js → reset-password-BO9Tpk_q.js} +1 -1
  150. package/dist/client/assets/{resizable-DvU979g4.js → resizable-FPwEQu4J.js} +1 -1
  151. package/dist/client/assets/{roles-BbRFWJFf.js → roles-B5S-JsJi.js} +1 -1
  152. package/dist/client/assets/save-referenced-block-xyiiUgMo.js +1 -0
  153. package/dist/client/assets/{save-status-DMf7Ki8m.js → save-status-CDo7AlvY.js} +1 -1
  154. package/dist/client/assets/{schema-form-CmUF2bFS.js → schema-form-B5X_jnCS.js} +1 -1
  155. package/dist/client/assets/{scroll-area-DAQuWOFc.js → scroll-area-86Op8ApP.js} +1 -1
  156. package/dist/client/assets/{search-input-C0c6vwO5.js → search-input-DFrDstX6.js} +1 -1
  157. package/dist/client/assets/{secrets-D1HBT99G.js → secrets-C4XubnGB.js} +1 -1
  158. package/dist/client/assets/{sections-editor-Bcy_4zFJ.js → sections-editor-BGpn_Sa9.js} +1 -1
  159. package/dist/client/assets/{select-BTJH3S1Y.js → select-DIImlu5H.js} +1 -1
  160. package/dist/client/assets/{select-model-DPxYg0zJ.js → select-model-DMM38IJD.js} +1 -1
  161. package/dist/client/assets/{seo-editor-b_pr82NE.js → seo-editor-tNuhLm3d.js} +1 -1
  162. package/dist/client/assets/{settings-layout-Daps0DJ2.js → settings-layout-tNiJIWIn.js} +1 -1
  163. package/dist/client/assets/{settings-section-B5i82NgR.js → settings-section-8TfsFzZk.js} +1 -1
  164. package/dist/client/assets/{sheet-CCipW2FH.js → sheet-qXjZ6ijq.js} +1 -1
  165. package/dist/client/assets/{shell-controls-Ce5fzkhT.js → shell-controls-YPeEwMMG.js} +1 -1
  166. package/dist/client/assets/{shell-layout-CTQMbW4a.js → shell-layout-BZuowLaO.js} +1 -1
  167. package/dist/client/assets/{shell-route-loading-BwBOB-GI.js → shell-route-loading-DLvkliSc.js} +1 -1
  168. package/dist/client/assets/{sidebar-vUZgGPF7.js → sidebar-DV_8rP5O.js} +1 -1
  169. package/dist/client/assets/{skeleton-DWiCZKLu.js → skeleton-BAqUrlIk.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-B_SnIoCf.js → sortable.esm-CwxymQUp.js} +1 -1
  171. package/dist/client/assets/{spinner-Cf-IAzXM.js → spinner-BNJ1ntL6.js} +1 -1
  172. package/dist/client/assets/{sso-BVINRo2Z.js → sso-d2lJzN6l.js} +1 -1
  173. package/dist/client/assets/{store-BW1GY6_F.js → store-BnlTxhhC.js} +1 -1
  174. package/dist/client/assets/store-registry-BFDp8lS0.js +2 -0
  175. package/dist/client/assets/{studio-tools-LMNN2joX.js → studio-tools-VmDH_tkD.js} +1 -1
  176. package/dist/client/assets/{switch-DJP3r5vJ.js → switch-BLdRz6LH.js} +1 -1
  177. package/dist/client/assets/{tab-id-ByXHuOlI.js → tab-id-BuwvvoKA.js} +1 -1
  178. package/dist/client/assets/{table-B2KlLYRM.js → table-DLTcBxkL.js} +1 -1
  179. package/dist/client/assets/{tabs-V4XsHC7f.js → tabs-BfsyXeV7.js} +1 -1
  180. package/dist/client/assets/{task-status-CEXxjU1X.js → task-status-BebHkyud.js} +1 -1
  181. package/dist/client/assets/{textarea-Bc-j0SM5.js → textarea-DOxc062C.js} +1 -1
  182. package/dist/client/assets/{toggle-group-COWeQ2c6.js → toggle-group-CUnJVdhY.js} +1 -1
  183. package/dist/client/assets/{toolbar-PSYvcVzm.js → toolbar-C-goTyi1.js} +1 -1
  184. package/dist/client/assets/{tools-list-DTOKH1D-.js → tools-list-BMPh17xT.js} +1 -1
  185. package/dist/client/assets/{tooltip-B5iep7Ko.js → tooltip-AlbIxSnB.js} +1 -1
  186. package/dist/client/assets/{types-BAMtYEey.js → types-B6A14fRD.js} +1 -1
  187. package/dist/client/assets/{use-ai-providers-DzrkIvyk.js → use-ai-providers-Bm_rqURb.js} +1 -1
  188. package/dist/client/assets/{use-automations-tXwjiHAc.js → use-automations-BGZXYpIN.js} +1 -1
  189. package/dist/client/assets/{use-capability-DXVx5Xxx.js → use-capability-JDGz96yw.js} +1 -1
  190. package/dist/client/assets/{use-clock-tick-BDCCVICH.js → use-clock-tick-ApetjkK0.js} +1 -1
  191. package/dist/client/assets/{use-collections-DxiinEjJ.js → use-collections-X9suE0Rz.js} +1 -1
  192. package/dist/client/assets/{use-connection-7gOEmOWX.js → use-connection-H42b0qTa.js} +1 -1
  193. package/dist/client/assets/{use-copy-CRVb47fM.js → use-copy-Ch4eJC6W.js} +1 -1
  194. package/dist/client/assets/{use-create-virtual-mcp-CjtM4q6t.js → use-create-virtual-mcp-BiMPRmS0.js} +1 -1
  195. package/dist/client/assets/{use-debounced-autosave-DeRUhFjV.js → use-debounced-autosave-bupcMtLI.js} +1 -1
  196. package/dist/client/assets/{use-delete-connection-CKkxX1yi.js → use-delete-connection--wxVFqSC.js} +1 -1
  197. package/dist/client/assets/{use-file-configs-DihB1CSn.js → use-file-configs-B-TRPlGa.js} +1 -1
  198. package/dist/client/assets/{use-infinite-scroll-D1XgBgMg.js → use-infinite-scroll-CD71xyIK.js} +1 -1
  199. package/dist/client/assets/{use-list-state-CqG6kyCV.js → use-list-state-7-M0Oy-p.js} +1 -1
  200. package/dist/client/assets/{use-mcp-client-CrjmswbX.js → use-mcp-client-DVIPuDIp.js} +1 -1
  201. package/dist/client/assets/{use-mcp-prompts-CcgUU2va.js → use-mcp-prompts-Cc0asrBz.js} +1 -1
  202. package/dist/client/assets/{use-mcp-tools-SSgHcUph.js → use-mcp-tools-Ce2De-n9.js} +1 -1
  203. package/dist/client/assets/{use-members-7_urfNyQ.js → use-members-1AkYrlKa.js} +1 -1
  204. package/dist/client/assets/{use-navigate-to-agent-BkTVNUaN.js → use-navigate-to-agent-BIO7CjS7.js} +1 -1
  205. package/dist/client/assets/{use-org-auth-client-45Kq_uI1.js → use-org-auth-client-Dd-mOXzl.js} +1 -1
  206. package/dist/client/assets/{use-org-sso-gUWGH-aK.js → use-org-sso-DGDlZviB.js} +1 -1
  207. package/dist/client/assets/{use-organization-roles-lBuv_PBX.js → use-organization-roles-CjQiMsg2.js} +1 -1
  208. package/dist/client/assets/{use-organization-settings-CNaysSS7.js → use-organization-settings-DVnlfq4p.js} +1 -1
  209. package/dist/client/assets/use-registry-connections-DhiOfiCw.js +1 -0
  210. package/dist/client/assets/{use-secrets-CFUYkFk-.js → use-secrets-BiDXoWq-.js} +1 -1
  211. package/dist/client/assets/{use-status-sounds-B3I8SIeo.js → use-status-sounds--1cQ7Gwq.js} +1 -1
  212. package/dist/client/assets/{use-view-mode-Br-x5WnV.js → use-view-mode-Bc8_FKXN.js} +1 -1
  213. package/dist/client/assets/{use-virtual-mcp-YDOoOiIE.js → use-virtual-mcp-D9H9aNMJ.js} +1 -1
  214. package/dist/client/assets/useInfiniteQuery-DBPdoIhC.js +1 -0
  215. package/dist/client/assets/{useRouterState-B-4iWxA3.js → useRouterState-Ba9Tqr45.js} +1 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-BGLS34hq.js +1 -0
  217. package/dist/client/assets/{user-XzqpqM8M.js → user-CfS8x4lp.js} +1 -1
  218. package/dist/client/assets/{view-mode-toggle-EHbZdESt.js → view-mode-toggle-DaV2KCBn.js} +1 -1
  219. package/dist/client/assets/{watch-sse-pool-B2UHmnkn.js → watch-sse-pool-CbLJ0uWL.js} +1 -1
  220. package/dist/client/assets/{workflow-BvCi7RsT.js → workflow-BwGcPmPE.js} +1 -1
  221. package/dist/client/assets/workflow-detail-CYjYJeGk.js +1 -0
  222. package/dist/client/index.html +1 -1
  223. package/dist/server/cli.js +425 -425
  224. package/dist/server/server.js +256 -256
  225. package/package.json +1 -1
  226. package/dist/client/assets/agent-capabilities-DYA4_FQC.js +0 -3
  227. package/dist/client/assets/app-editor-BHLxWfgZ.js +0 -1
  228. package/dist/client/assets/chat-context-CD2JvZDF.js +0 -21
  229. package/dist/client/assets/connect-desktop-dialog-SmaY4SKp.js +0 -1
  230. package/dist/client/assets/decopilot-sse-pool-BXXKMHET.js +0 -1
  231. package/dist/client/assets/index-DRHoPy-V.js +0 -1
  232. package/dist/client/assets/page-seo-sheet-SyZrVZNj.js +0 -1
  233. package/dist/client/assets/project-app-view-BJauens7.js +0 -1
  234. package/dist/client/assets/record-editor-ZJ1XN9iZ.js +0 -1
  235. package/dist/client/assets/registry-BSzFy0xA.js +0 -2
  236. package/dist/client/assets/save-referenced-block-lBPwVOlw.js +0 -1
  237. package/dist/client/assets/store-registry-GHPfrbOP.js +0 -2
  238. package/dist/client/assets/use-registry-connections-CC5drynS.js +0 -1
  239. package/dist/client/assets/useInfiniteQuery-B4yLyRTD.js +0 -1
  240. package/dist/client/assets/useSuspenseInfiniteQuery-BfueowGJ.js +0 -1
  241. package/dist/client/assets/workflow-detail-BmwDA1AR.js +0 -1
@@ -1,4 +1,4 @@
1
- import{e as $,j as t,p as J,b as he,F as ae,r as G,M as ie,m as xe,K as U,a as be,t as oe,n as D,B as se,c as V,l as Y,q as ke,D as Re}from"./index-D7zMM4W4.js";import{b as Ae}from"./use-virtual-mcp-YDOoOiIE.js";import{l as le}from"./use-navigate-to-agent-BkTVNUaN.js";import{b as Oe,u as ye}from"./use-connection-7gOEmOWX.js";import{W as Le,u as H,a as ce}from"./use-mcp-client-CrjmswbX.js";import{D as we,a as Ce,b as Ie,c as Ne,d as Ge}from"./dialog-BQ75yEwF.js";import{i as ue}from"./RefreshCcw01-Gjck8qdC.js";import{C as je}from"./collection-search-GY1bal72.js";import{C as pe}from"./checkbox-BC4wIenO.js";import{n as Pe}from"./agent-icon-DDCLA9rm.js";import{i as $e,a as He}from"./mcp-oauth-X7hs3Ag9.js";import{u as Me}from"./use-mcp-tools-SSgHcUph.js";import{e as De}from"./extract-connection-data-DY_wdsqB.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,p as J,b as he,F as ae,r as G,M as ie,m as xe,K as U,a as be,t as oe,n as D,B as se,c as V,l as Y,q as ke,D as Re}from"./index-DGGjIheX.js";import{b as Ae}from"./use-virtual-mcp-D9H9aNMJ.js";import{l as le}from"./use-navigate-to-agent-BIO7CjS7.js";import{b as Oe,u as ye}from"./use-connection-H42b0qTa.js";import{W as Le,u as H,a as ce}from"./use-mcp-client-DVIPuDIp.js";import{D as we,a as Ce,b as Ie,c as Ne,d as Ge}from"./dialog-NPdsRr2K.js";import{i as ue}from"./RefreshCcw01-k5H1KZCV.js";import{C as je}from"./collection-search-DtWJHNG9.js";import{C as pe}from"./checkbox-emZqfNka.js";import{n as Pe}from"./agent-icon-BSv2ZliY.js";import{i as $e,a as He}from"./mcp-oauth-Volcctly.js";import{u as Me}from"./use-mcp-tools-Ce2De-n9.js";import{e as De}from"./extract-connection-data-gSFD29EZ.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)}`,jt={title:"New Website",description:"Website cloned from a public template",url:"https://github.com/decocms/webapp-template",owner:"decocms",name:"webapp-template"},St={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 vt(){const o=$.c(6),e=Ae(),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=Le.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=Oe(),l=ae(),[i,r]=G.useState("idle"),[f,b]=G.useState(null),[a,C]=G.useState(null),{data:h,isLoading:m}=ze(Be,{enabled:o.enabled}),x=G.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 $e({url:j.href,token:null,orgId:e.id});if(d.supportsOAuth&&!d.isAuthenticated){const{token:S,tokenInfo:c,error:v}=await He({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 Et({open:o,onOpenChange:e,onBack:n}){const{org:s}=J(),l=le(),i=ae(),{data:r}=he.useSession(),[f,b]=G.useState(null),[a,C]=G.useState(null),[h,m]=G.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),L=O.find(P=>P.name===u);if(!L)throw new Error("Selected site is no longer available");const E=Qe(u,L.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:L=>{const E=L.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(L=>L.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(Ge,{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]=G.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]),G.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 Tt(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]=G.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(G.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]=G.useState(null),[h,m]=G.useState(!0),[x,N]=G.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 L=R.content?.find(E=>E.type==="resource")?.resource?.text;if(!L)return null;try{const E=JSON.parse(L);return typeof E=="string"?E:JSON.stringify(E)}catch{return L}}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:L}=await rt({githubCallTool:E=>S.callTool(E),selfCallTool:E=>c.callTool(E),virtualMcpId:g,repo:k,connectionId:u,selectedKeys:R});L>0&&D.warning(`Set up ${_-L}/${_} 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}]}}}),L=_.structuredContent??_,E=L.item?.id;if(!L.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:L.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]=G.useState(""),y=ot(x,300),p=G.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(G.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}=ke(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(Re,{size:10}):t.jsx(Pe,{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,St as H,Et as I,Fe as S,jt as W,Tt as a,vt as u};
@@ -1,4 +1,4 @@
1
- import{e as y,p as C,F as ce,a as G,K as E,m as B,b3 as we,Y as xe,j as o,l as ge,B as q,r as v,z as ye,c as ee,n as re}from"./index-D7zMM4W4.js";import{S as Q}from"./skeleton-DWiCZKLu.js";import{n as Z}from"./Globe01-DuXtiXmT.js";import{l as je,F as ke}from"./index-DAz0gT0O.js";import{F as be,M as ve}from"./file-type-icon-BMtzYhxY.js";import{D as Se,a as $e,b as Te,c as ie}from"./dropdown-menu-C9Apf8St.js";import{b as A,T as K,a as H}from"./tooltip-B5iep7Ko.js";import{i as Ee}from"./Check-BKIJF1cF.js";import{a as Ce}from"./Eye-Dl4wUVA0.js";import{e as Fe,f as Me,a as Ne,b as De}from"./ZoomOut-BEjoQvI4.js";import{i as Pe}from"./LayoutLeft-RNub1vlB.js";import{n as Ue}from"./LinkExternal01-CkMjIxNM.js";function ze(s){return s.contentHash??`${s.size}-${s.updatedAt}`}function M(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(M(n.slug,s,"list",{path:e}))).json()).entries.toSorted(Oe),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 Oe(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(M(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(M(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(M(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 Ft(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t.slug||e[1]!==s?(n=r=>M(t.slug,s,"read",{path:r}),e[0]=t.slug,e[1]=s,e[2]=n):n=e[2],n}function Mt(){const s=y.c(2),{org:e}=C();let t;return s[0]!==e.slug?(t=(n,r)=>M(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(M(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],G(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(M(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=G(d);let l;e[10]!==t||e[11]!==s?(l=async g=>{await N(M(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=G(f);let m;e[16]!==t||e[17]!==s?(m=async g=>{await N(M(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=G(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 zt(s,e){return e==="directory"?s:He(s)}function Ot(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 Qe(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(...Qe(r.children,e,t+1)));return n}function Bt(s){return s.split(`
1
+ import{e as y,p as C,F as ce,a as G,K as E,m as B,b3 as we,Y as xe,j as o,l as ge,B as q,r as v,z as ye,c as ee,n as re}from"./index-DGGjIheX.js";import{S as Q}from"./skeleton-BAqUrlIk.js";import{n as Z}from"./Globe01-ho0SCMcq.js";import{l as je,F as ke}from"./index-Dx3qMd9z.js";import{F as be,M as ve}from"./file-type-icon-BQd_cgeD.js";import{D as Se,a as $e,b as Te,c as ie}from"./dropdown-menu-B7tRotB5.js";import{b as A,T as K,a as H}from"./tooltip-AlbIxSnB.js";import{i as Ee}from"./Check-D0urCyzd.js";import{a as Ce}from"./Eye-Cfv_RGHV.js";import{e as Fe,f as Me,a as Ne,b as De}from"./ZoomOut-BX0KAK4E.js";import{i as Pe}from"./LayoutLeft-UZ6_8WBi.js";import{n as Ue}from"./LinkExternal01-Zwfdiaw5.js";function ze(s){return s.contentHash??`${s.size}-${s.updatedAt}`}function M(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(M(n.slug,s,"list",{path:e}))).json()).entries.toSorted(Oe),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 Oe(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(M(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(M(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(M(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 Ft(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t.slug||e[1]!==s?(n=r=>M(t.slug,s,"read",{path:r}),e[0]=t.slug,e[1]=s,e[2]=n):n=e[2],n}function Mt(){const s=y.c(2),{org:e}=C();let t;return s[0]!==e.slug?(t=(n,r)=>M(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(M(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],G(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(M(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=G(d);let l;e[10]!==t||e[11]!==s?(l=async g=>{await N(M(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=G(f);let m;e[16]!==t||e[17]!==s?(m=async g=>{await N(M(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=G(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 zt(s,e){return e==="directory"?s:He(s)}function Ot(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 Qe(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(...Qe(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 Ge(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(Q,{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(Q,{className:"h-3 w-full"}),o.jsx(Q,{className:"h-3 w-5/6"}),o.jsx(Q,{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(Ge,{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(Fe,{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 F;e[21]!==l||e[22]!==r||e[23]!==n.deckDetected?(F=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(Me,{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]=F):F=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 z;e[32]!==U||e[33]!==p?(z=o.jsxs(A,{children:[U,p]}),e[32]=U,e[33]=p,e[34]=z):z=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 O;e[41]!==T?(O=o.jsxs(A,{children:[T,I]}),e[41]=T,e[42]=O):O=e[42];let R;return e[43]!==F||e[44]!==z||e[45]!==O||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,F,z,O,i]}),e[43]=F,e[44]=z,e[45]=O,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,dv as k,a4 as F,a5 as f,dx as T,ad as $,bh as O,bu as I,dy as U,dz as z,dB as B,dw as W,be as G,du as K,e as E,c as V}from"./index-D7zMM4W4.js";var S,b="HoverCard",[y]=$(b,[T]),R=T(),[q,w]=y(b),N=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]),M=c.useCallback(()=>n(!1),[n]);return c.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(v.current)},[]),d.jsx(q,{scope:e,open:m,onOpenChange:n,onOpen:x,onClose:L,onDismiss:M,hasSelectionRef:C,isPointerDownOnContentRef:h,children:d.jsx(K,{...i,children:t})})};N.displayName=b;var _="HoverCardTrigger",D=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=w(_,t),s=R(t);return d.jsx(k,{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=_;var H="HoverCardPortal",[J,Q]=y(H,{forceMount:void 0}),j=o=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:a}=o,s=w(H,e);return d.jsx(J,{scope:e,forceMount:t,children:d.jsx(O,{present:t||s.open,children:d.jsx(W,{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=w(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=w(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 S=n.style.userSelect||n.style.webkitUserSelect,n.style.userSelect="none",n.style.webkitUserSelect="none",()=>{n.style.userSelect=S,n.style.webkitUserSelect=S}}},[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(z,{...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(B,{...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=N,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=V("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,dv as k,a4 as F,a5 as f,dx as T,ad as $,bh as O,bu as I,dy as U,dz as z,dB as B,dw as W,be as G,du as K,e as E,c as V}from"./index-DGGjIheX.js";var S,b="HoverCard",[y]=$(b,[T]),R=T(),[q,w]=y(b),N=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]),M=c.useCallback(()=>n(!1),[n]);return c.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(v.current)},[]),d.jsx(q,{scope:e,open:m,onOpenChange:n,onOpen:x,onClose:L,onDismiss:M,hasSelectionRef:C,isPointerDownOnContentRef:h,children:d.jsx(K,{...i,children:t})})};N.displayName=b;var _="HoverCardTrigger",D=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=w(_,t),s=R(t);return d.jsx(k,{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=_;var H="HoverCardPortal",[J,Q]=y(H,{forceMount:void 0}),j=o=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:a}=o,s=w(H,e);return d.jsx(J,{scope:e,forceMount:t,children:d.jsx(O,{present:t||s.open,children:d.jsx(W,{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=w(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=w(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 S=n.style.userSelect||n.style.webkitUserSelect,n.style.userSelect="none",n.style.webkitUserSelect="none",()=>{n.style.userSelect=S,n.style.webkitUserSelect=S}}},[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(z,{...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(B,{...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=N,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=V("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,p 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,I as Ie,n as q}from"./index-D7zMM4W4.js";import{a as H}from"./Tool01-WP19hvhy.js";import{s as Se}from"./Trash01-ysxYI5Wr.js";import{i as fe}from"./Upload01-BEUiJeg2.js";import{I as _e}from"./input-DlpqEr8E.js";import{L as Pe}from"./label-BCg8KKvZ.js";import{i as Ue}from"./AlertCircle-diUVbO2-.js";import{i as ge}from"./Check-BKIJF1cF.js";import{a as $e}from"./Eye-Dl4wUVA0.js";import{i as De}from"./DotsVertical-CJXQkRAx.js";import{H as ze}from"./agent-icon-DDCLA9rm.js";import{n as Fe}from"./LinkExternal01-CkMjIxNM.js";import{D as Te,c as Ee,e as Le,b as Oe,a as Ae}from"./dialog-BQ75yEwF.js";import{c as ce,a as Re,D as Be,b as Ge}from"./dropdown-menu-C9Apf8St.js";import{S as Me}from"./skeleton-DWiCZKLu.js";import{T as Ve,a as Ke,b as Je,c as Qe}from"./tabs-V4XsHC7f.js";import{u as qe,c as Ye}from"./use-file-configs-DihB1CSn.js";import{u as He}from"./useInfiniteQuery-B4yLyRTD.js";import{u as We}from"./studio-tools-LMNN2joX.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(Je,{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(Qe,{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(Ie,{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 S;e[14]!==n||e[15]!==i?(S=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]=S):S=e[16];let I;e[17]!==n.key?(I=he(n.key),e[17]=n.key,e[18]=I):I=e[18];let _;e[19]!==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:I})}),e[19]=I,e[20]=_):_=e[20];let P;return e[21]!==h||e[22]!==C||e[23]!==S||e[24]!==_?(P=t.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[h,C,S,_]}),e[21]=h,e[22]=C,e[23]=S,e[24]=_,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 S=C;let I;e[6]!==S||e[7]!==c||e[8]!==h||e[9]!==b?(I=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=S();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]=S,e[7]=c,e[8]=h,e[9]=b,e[10]=I):I=e[10];const _=I;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]!==_||e[16]!==d?(X=function(v){v.preventDefault(),d(!1),_(v.dataTransfer.files)},e[15]=_,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(_e,{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(Se,{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 J;e[68]!==h?(J=U=>h(U),e[68]=h,e[69]=J):J=e[69];let Q;e[70]!==m||e[71]!==c||e[72]!==J?(Q=t.jsx(st,{open:m,onOpenChange:c,mode:"image",onSelect:J}),e[70]=m,e[71]=c,e[72]=J,e[73]=Q):Q=e[73];let ee;return e[74]!==A||e[75]!==K||e[76]!==Q||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,Q]}),e[74]=A,e[75]=K,e[76]=Q,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,p 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,I as Ie,n as q}from"./index-DGGjIheX.js";import{a as H}from"./Tool01-UC0L2ZqT.js";import{s as Se}from"./Trash01-C89-wTac.js";import{i as fe}from"./Upload01-CvoLArfG.js";import{I as _e}from"./input-DYsPOaw4.js";import{L as Pe}from"./label-Mdkg-a4K.js";import{i as Ue}from"./AlertCircle-B8wgh1Ly.js";import{i as ge}from"./Check-D0urCyzd.js";import{a as $e}from"./Eye-Cfv_RGHV.js";import{i as De}from"./DotsVertical-DE_SmTP3.js";import{H as ze}from"./agent-icon-BSv2ZliY.js";import{n as Fe}from"./LinkExternal01-Zwfdiaw5.js";import{D as Te,c as Ee,e as Le,b as Oe,a as Ae}from"./dialog-NPdsRr2K.js";import{c as ce,a as Re,D as Be,b as Ge}from"./dropdown-menu-B7tRotB5.js";import{S as Me}from"./skeleton-BAqUrlIk.js";import{T as Ve,a as Ke,b as Je,c as Qe}from"./tabs-BfsyXeV7.js";import{u as qe,c as Ye}from"./use-file-configs-B-TRPlGa.js";import{u as He}from"./useInfiniteQuery-DBPdoIhC.js";import{u as We}from"./studio-tools-VmDH_tkD.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(Je,{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(Qe,{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(Ie,{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 S;e[14]!==n||e[15]!==i?(S=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]=S):S=e[16];let I;e[17]!==n.key?(I=he(n.key),e[17]=n.key,e[18]=I):I=e[18];let _;e[19]!==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:I})}),e[19]=I,e[20]=_):_=e[20];let P;return e[21]!==h||e[22]!==C||e[23]!==S||e[24]!==_?(P=t.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-border/60 bg-muted",children:[h,C,S,_]}),e[21]=h,e[22]=C,e[23]=S,e[24]=_,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 S=C;let I;e[6]!==S||e[7]!==c||e[8]!==h||e[9]!==b?(I=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=S();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]=S,e[7]=c,e[8]=h,e[9]=b,e[10]=I):I=e[10];const _=I;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]!==_||e[16]!==d?(X=function(v){v.preventDefault(),d(!1),_(v.dataTransfer.files)},e[15]=_,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(_e,{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(Se,{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 J;e[68]!==h?(J=U=>h(U),e[68]=h,e[69]=J):J=e[69];let Q;e[70]!==m||e[71]!==c||e[72]!==J?(Q=t.jsx(st,{open:m,onOpenChange:c,mode:"image",onSelect:J}),e[70]=m,e[71]=c,e[72]=J,e[73]=Q):Q=e[73];let ee;return e[74]!==A||e[75]!==K||e[76]!==Q||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,Q]}),e[74]=A,e[75]=K,e[76]=Q,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,3 +1,3 @@
1
- import{e as S,r as E,j as t,m as J,B as T,K as M,c as Y,f as Ce,d as Se,E as re,p as $e,F as Ge,z as Xe,n as I}from"./index-D7zMM4W4.js";import{i as Qe}from"./ChevronRight-BkNktb2f.js";import{s as De}from"./Eye-Dl4wUVA0.js";import{n as ae,i as We}from"./Globe01-DuXtiXmT.js";import{i as Ye,c as Ze}from"./ZoomOut-BEjoQvI4.js";import{s as Je}from"./Plus-CKCNLZUU.js";import{t as et}from"./Stars01-CGinyuoF.js";import{i as ze}from"./Upload01-BEUiJeg2.js";import{b as K,T as V,a as q,u as Fe}from"./tooltip-B5iep7Ko.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-Czjj9xUL.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-BQ75yEwF.js";import{I as ut}from"./input-DlpqEr8E.js";import{S as H}from"./skeleton-DWiCZKLu.js";import{F as A,d as _e,M as ht}from"./file-type-icon-BMtzYhxY.js";import{a as xt}from"./toolbar-PSYvcVzm.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-BfAGzd8m.js";import{i as ue}from"./DotsVertical-CJXQkRAx.js";import{s as he}from"./Trash01-ysxYI5Wr.js";import{i as Re}from"./Zap-qtt4gXCs.js";import{a as xe,c as X,b as pe,D as je}from"./dropdown-menu-C9Apf8St.js";import{R as ve,a as bt,b as yt}from"./resizable-DvU979g4.js";import{n as Be}from"./LinkExternal01-CkMjIxNM.js";import{s as Ie}from"./XClose-MySSOydc.js";import{i as vt}from"./X-Dk_6ic2Z.js";import"./Check-BKIJF1cF.js";import"./ChevronLeft-DnwnYIMW.js";import"./index-DAz0gT0O.js";import"./LayoutLeft-RNub1vlB.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,m as J,B as T,K as M,c as Y,f as Ce,d as Se,E as re,p as $e,F as Ge,z as Xe,n as I}from"./index-DGGjIheX.js";import{i as Qe}from"./ChevronRight-pxM9WiYB.js";import{s as De}from"./Eye-Cfv_RGHV.js";import{n as ae,i as We}from"./Globe01-ho0SCMcq.js";import{i as Ye,c as Ze}from"./ZoomOut-BX0KAK4E.js";import{s as Je}from"./Plus-BCfK0mBl.js";import{t as et}from"./Stars01-spNf2CVt.js";import{i as ze}from"./Upload01-CvoLArfG.js";import{b as K,T as V,a as q,u as Fe}from"./tooltip-AlbIxSnB.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-CAUF2lG9.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-NPdsRr2K.js";import{I as ut}from"./input-DYsPOaw4.js";import{S as H}from"./skeleton-BAqUrlIk.js";import{F as A,d as _e,M as ht}from"./file-type-icon-BQd_cgeD.js";import{a as xt}from"./toolbar-C-goTyi1.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-D7VApmY0.js";import{i as ue}from"./DotsVertical-DE_SmTP3.js";import{s as he}from"./Trash01-C89-wTac.js";import{i as Re}from"./Zap-DRqUuFzT.js";import{a as xe,c as X,b as pe,D as je}from"./dropdown-menu-B7tRotB5.js";import{R as ve,a as bt,b as yt}from"./resizable-FPwEQu4J.js";import{n as Be}from"./LinkExternal01-Zwfdiaw5.js";import{s as Ie}from"./XClose-xAOdH2ec.js";import{i as vt}from"./X-ncGdMje6.js";import"./Check-D0urCyzd.js";import"./ChevronLeft-C357wJbK.js";import"./index-Dx3qMd9z.js";import"./LayoutLeft-UZ6_8WBi.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{P as z,a as G,D as H,h as J,j as Q}from"./scroll-area-DAQuWOFc.js";function V(x){var l;const{char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:E,startOfLine:j,$position:v}=x,B=b&&!P,y=Q(D),F=new RegExp(`\\s${y}$`),h=j?"^":"",M=P?"":y,N=B?new RegExp(`${h}${y}.*?(?=\\s${M}|$)`,"gm"):new RegExp(`${h}(?:^)?${y}[^\\s${M}]*`,"gm"),q=((l=v.nodeBefore)==null?void 0:l.isText)&&v.nodeBefore.text;if(!q)return null;const K=v.pos-q.length,u=Array.from(q.matchAll(N)).pop();if(!u||u.input===void 0||u.index===void 0)return null;const d=u.input.slice(Math.max(0,u.index-1),u.index),e=new RegExp(`^[${E?.join("")}\0]?$`).test(d);if(E!==null&&!e)return null;const I=K+u.index;let p=I+u[0].length;return B&&F.test(q.slice(p-1,p+1))&&(u[0]+=" ",p+=1),I<v.pos&&p>=v.pos?{range:{from:I,to:p},query:u[0].slice(D.length),text:u[0]}:null}var W=new z("suggestion");function Y({pluginKey:x=W,editor:l,char:D="@",allowSpaces:b=!1,allowToIncludeChar:P=!1,allowedPrefixes:E=[" "],startOfLine:j=!1,decorationTag:v="span",decorationClass:B="suggestion",decorationContent:y="",decorationEmptyClass:F="is-empty",command:h=()=>null,items:M=()=>[],render:N=()=>({}),allow:q=()=>!0,findSuggestionMatch:K=V,shouldShow:u}){let d;const e=N?.(),I=()=>{const n=l.state.selection.$anchor.pos,a=l.view.coordsAtPos(n),{top:r,right:s,bottom:o,left:c}=a;try{return new DOMRect(c,r,s-c,o-r)}catch{return null}},p=(n,a)=>a?()=>{const r=x.getState(l.state),s=r?.decorationId,o=n.dom.querySelector(`[data-decoration-id="${s}"]`);return o?.getBoundingClientRect()||null}:I;function U(n,a){var r;try{const o=x.getState(n.state),c=o?.decorationId?n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`):null,g={editor:l,range:o?.range||{from:0,to:0},query:o?.query||null,text:o?.text||null,items:[],command:m=>h({editor:l,range:o?.range||{from:0,to:0},props:m}),decorationNode:c,clientRect:p(n,c)};(r=e?.onExit)==null||r.call(e,g)}catch{}const s=n.state.tr.setMeta(a,{exit:!0});n.dispatch(s)}const C=new G({key:x,view(){return{update:async(n,a)=>{var r,s,o,c,g,m,S;const t=(r=this.key)==null?void 0:r.getState(a),f=(s=this.key)==null?void 0:s.getState(n.state),i=t.active&&f.active&&t.range.from!==f.range.from,_=!t.active&&f.active,A=t.active&&!f.active,R=!_&&!A&&t.query!==f.query,w=_||i&&R,k=R||i,O=A||i&&R;if(!w&&!k&&!O)return;const $=O&&!w?t:f,T=n.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`);d={editor:l,range:$.range,query:$.query,text:$.text,items:[],command:L=>h({editor:l,range:$.range,props:L}),decorationNode:T,clientRect:p(n,T)},w&&((o=e?.onBeforeStart)==null||o.call(e,d)),k&&((c=e?.onBeforeUpdate)==null||c.call(e,d)),(k||w)&&(d.items=await M({editor:l,query:$.query})),O&&((g=e?.onExit)==null||g.call(e,d)),k&&((m=e?.onUpdate)==null||m.call(e,d)),w&&((S=e?.onStart)==null||S.call(e,d))},destroy:()=>{var n;d&&((n=e?.onExit)==null||n.call(e,d))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(n,a,r,s){const{isEditable:o}=l,{composing:c}=l.view,{selection:g}=n,{empty:m,from:S}=g,t={...a},f=n.getMeta(x);if(f&&f.exit)return t.active=!1,t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null,t;if(t.composing=c,o&&(m||l.view.composing)){(S<a.range.from||S>a.range.to)&&!c&&!a.composing&&(t.active=!1);const i=K({char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:E,startOfLine:j,$position:g.$from}),_=`id_${Math.floor(Math.random()*4294967295)}`;i&&q({editor:l,state:s,range:i.range,isActive:a.active})&&(!u||u({editor:l,range:i.range,query:i.query,text:i.text,transaction:n}))?(t.active=!0,t.decorationId=a.decorationId?a.decorationId:_,t.range=i.range,t.query=i.query,t.text=i.text):t.active=!1}else t.active=!1;return t.active||(t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null),t}},props:{handleKeyDown(n,a){var r,s,o,c;const{active:g,range:m}=C.getState(n.state);if(!g)return!1;if(a.key==="Escape"||a.key==="Esc"){const t=C.getState(n.state),f=(r=d?.decorationNode)!=null?r:null,i=f??(t?.decorationId?n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`):null);if(((s=e?.onKeyDown)==null?void 0:s.call(e,{view:n,event:a,range:t.range}))||!1)return!0;const A={editor:l,range:t.range,query:t.query,text:t.text,items:[],command:R=>h({editor:l,range:t.range,props:R}),decorationNode:i,clientRect:i?()=>i.getBoundingClientRect()||null:null};return(o=e?.onExit)==null||o.call(e,A),U(n,x),!0}return((c=e?.onKeyDown)==null?void 0:c.call(e,{view:n,event:a,range:m}))||!1},decorations(n){const{active:a,range:r,decorationId:s,query:o}=C.getState(n);if(!a)return null;const c=!o?.length,g=[B];return c&&g.push(F),H.create(n.doc,[J.inline(r.from,r.to,{nodeName:v,class:g.join(" "),"data-decoration-id":s,"data-decoration-content":y})])}}});return C}export{Y as S};
1
+ import{P as z,a as G,D as H,h as J,j as Q}from"./scroll-area-86Op8ApP.js";function V(x){var l;const{char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:E,startOfLine:j,$position:v}=x,B=b&&!P,y=Q(D),F=new RegExp(`\\s${y}$`),h=j?"^":"",M=P?"":y,N=B?new RegExp(`${h}${y}.*?(?=\\s${M}|$)`,"gm"):new RegExp(`${h}(?:^)?${y}[^\\s${M}]*`,"gm"),q=((l=v.nodeBefore)==null?void 0:l.isText)&&v.nodeBefore.text;if(!q)return null;const K=v.pos-q.length,u=Array.from(q.matchAll(N)).pop();if(!u||u.input===void 0||u.index===void 0)return null;const d=u.input.slice(Math.max(0,u.index-1),u.index),e=new RegExp(`^[${E?.join("")}\0]?$`).test(d);if(E!==null&&!e)return null;const I=K+u.index;let p=I+u[0].length;return B&&F.test(q.slice(p-1,p+1))&&(u[0]+=" ",p+=1),I<v.pos&&p>=v.pos?{range:{from:I,to:p},query:u[0].slice(D.length),text:u[0]}:null}var W=new z("suggestion");function Y({pluginKey:x=W,editor:l,char:D="@",allowSpaces:b=!1,allowToIncludeChar:P=!1,allowedPrefixes:E=[" "],startOfLine:j=!1,decorationTag:v="span",decorationClass:B="suggestion",decorationContent:y="",decorationEmptyClass:F="is-empty",command:h=()=>null,items:M=()=>[],render:N=()=>({}),allow:q=()=>!0,findSuggestionMatch:K=V,shouldShow:u}){let d;const e=N?.(),I=()=>{const n=l.state.selection.$anchor.pos,a=l.view.coordsAtPos(n),{top:r,right:s,bottom:o,left:c}=a;try{return new DOMRect(c,r,s-c,o-r)}catch{return null}},p=(n,a)=>a?()=>{const r=x.getState(l.state),s=r?.decorationId,o=n.dom.querySelector(`[data-decoration-id="${s}"]`);return o?.getBoundingClientRect()||null}:I;function U(n,a){var r;try{const o=x.getState(n.state),c=o?.decorationId?n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`):null,g={editor:l,range:o?.range||{from:0,to:0},query:o?.query||null,text:o?.text||null,items:[],command:m=>h({editor:l,range:o?.range||{from:0,to:0},props:m}),decorationNode:c,clientRect:p(n,c)};(r=e?.onExit)==null||r.call(e,g)}catch{}const s=n.state.tr.setMeta(a,{exit:!0});n.dispatch(s)}const C=new G({key:x,view(){return{update:async(n,a)=>{var r,s,o,c,g,m,S;const t=(r=this.key)==null?void 0:r.getState(a),f=(s=this.key)==null?void 0:s.getState(n.state),i=t.active&&f.active&&t.range.from!==f.range.from,_=!t.active&&f.active,A=t.active&&!f.active,R=!_&&!A&&t.query!==f.query,w=_||i&&R,k=R||i,O=A||i&&R;if(!w&&!k&&!O)return;const $=O&&!w?t:f,T=n.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`);d={editor:l,range:$.range,query:$.query,text:$.text,items:[],command:L=>h({editor:l,range:$.range,props:L}),decorationNode:T,clientRect:p(n,T)},w&&((o=e?.onBeforeStart)==null||o.call(e,d)),k&&((c=e?.onBeforeUpdate)==null||c.call(e,d)),(k||w)&&(d.items=await M({editor:l,query:$.query})),O&&((g=e?.onExit)==null||g.call(e,d)),k&&((m=e?.onUpdate)==null||m.call(e,d)),w&&((S=e?.onStart)==null||S.call(e,d))},destroy:()=>{var n;d&&((n=e?.onExit)==null||n.call(e,d))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(n,a,r,s){const{isEditable:o}=l,{composing:c}=l.view,{selection:g}=n,{empty:m,from:S}=g,t={...a},f=n.getMeta(x);if(f&&f.exit)return t.active=!1,t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null,t;if(t.composing=c,o&&(m||l.view.composing)){(S<a.range.from||S>a.range.to)&&!c&&!a.composing&&(t.active=!1);const i=K({char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:E,startOfLine:j,$position:g.$from}),_=`id_${Math.floor(Math.random()*4294967295)}`;i&&q({editor:l,state:s,range:i.range,isActive:a.active})&&(!u||u({editor:l,range:i.range,query:i.query,text:i.text,transaction:n}))?(t.active=!0,t.decorationId=a.decorationId?a.decorationId:_,t.range=i.range,t.query=i.query,t.text=i.text):t.active=!1}else t.active=!1;return t.active||(t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null),t}},props:{handleKeyDown(n,a){var r,s,o,c;const{active:g,range:m}=C.getState(n.state);if(!g)return!1;if(a.key==="Escape"||a.key==="Esc"){const t=C.getState(n.state),f=(r=d?.decorationNode)!=null?r:null,i=f??(t?.decorationId?n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`):null);if(((s=e?.onKeyDown)==null?void 0:s.call(e,{view:n,event:a,range:t.range}))||!1)return!0;const A={editor:l,range:t.range,query:t.query,text:t.text,items:[],command:R=>h({editor:l,range:t.range,props:R}),decorationNode:i,clientRect:i?()=>i.getBoundingClientRect()||null:null};return(o=e?.onExit)==null||o.call(e,A),U(n,x),!0}return((c=e?.onKeyDown)==null?void 0:c.call(e,{view:n,event:a,range:m}))||!1},decorations(n){const{active:a,range:r,decorationId:s,query:o}=C.getState(n);if(!a)return null;const c=!o?.length,g=[B];return c&&g.push(F),H.create(n.doc,[J.inline(r.from,r.to,{nodeName:v,class:g.join(" "),"data-decoration-id":s,"data-decoration-content":y})])}}});return C}export{Y as S};
@@ -1 +1 @@
1
- import{r as n,bf as q,cv as R,cw as Ee,cx as ke,cy as Se,bB as xe,cz as j}from"./index-D7zMM4W4.js";var de=1,Ie=.9,Ce=.8,Re=.17,Q=.1,Z=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Z,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Z,I.length))):(h*=Re,u>0&&(h*=Math.pow(Z,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Q&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Q>h&&(h=x*Q)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:U=!1,vimBindings:A=!0,...B}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")J(),W(),w(1,G);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{J(),W(),r.current.value||G(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{J(),s?.getAttribute("id")===e&&G(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),O=m.getAttribute("id");return((g=e.get(O))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function G(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function J(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],O=le(S,y);r.current.filtered.items.set(g,O),O>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function X(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function Y(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):Y(e)}let ie=()=>X(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):Y(1)},ce=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?ue(-1):Y(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...B,"cmdk-root":"",onKeyDown:e=>{var o;(o=B.onKeyDown)==null||o.call(B,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),X(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Je},b),z(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;U(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function U(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:B,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:U,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),z(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Be=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Oe=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},z(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),ze=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),Ue=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},z(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ye=Object.assign(be,{List:Oe,Item:Ve,Input:Be,Group:je,Separator:Le,Dialog:ze,Empty:Ue,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function z({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ye as _};
1
+ import{r as n,bf as q,cv as R,cw as Ee,cx as ke,cy as Se,bB as xe,cz as j}from"./index-DGGjIheX.js";var de=1,Ie=.9,Ce=.8,Re=.17,Q=.1,Z=.999,Ae=.9999,Me=.99,$e=/[\\\/_+.#"@\[\(\{&]/,De=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ve=/[\s-]/g;function ee(t,l,r,f,u,c,d){if(c===l.length)return u===t.length?de:Me;var v=`${u},${c}`;if(d[v]!==void 0)return d[v];for(var b=f.charAt(c),i=r.indexOf(b,u),p=0,h,x,E,I;i>=0;)h=ee(t,l,r,f,i+1,c+1,d),h>p&&(i===u?h*=de:$e.test(t.charAt(i-1))?(h*=Ce,E=t.slice(u,i-1).match(De),E&&u>0&&(h*=Math.pow(Z,E.length))):Fe.test(t.charAt(i-1))?(h*=Ie,I=t.slice(u,i-1).match(ve),I&&u>0&&(h*=Math.pow(Z,I.length))):(h*=Re,u>0&&(h*=Math.pow(Z,i-u))),t.charAt(i)!==l.charAt(c)&&(h*=Ae)),(h<Q&&r.charAt(i-1)===f.charAt(c+1)||f.charAt(c+1)===f.charAt(c)&&r.charAt(i-1)!==f.charAt(c))&&(x=ee(t,l,r,f,i+1,c+2,d),x*Q>h&&(h=x*Q)),h>p&&(p=h),i=r.indexOf(b,i+1);return d[v]=p,p}function se(t){return t.toLowerCase().replace(ve," ")}function Ke(t,l,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ee(t,l,se(t),se(l),0,0,{})}var V='[cmdk-group=""]',_='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',me='[cmdk-item=""]',fe=`${me}:not([aria-disabled="true"])`,te="cmdk-item-select",F="data-value",Pe=(t,l,r)=>Ke(t,l,r),pe=n.createContext(void 0),L=()=>n.useContext(pe),he=n.createContext(void 0),re=()=>n.useContext(he),ge=n.createContext(void 0),be=n.forwardRef((t,l)=>{let r=K(()=>{var e,o;return{search:"",value:(o=(e=t.value)!=null?e:t.defaultValue)!=null?o:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),f=K(()=>new Set),u=K(()=>new Map),c=K(()=>new Map),d=K(()=>new Set),v=we(t),{label:b,children:i,value:p,onValueChange:h,filter:x,shouldFilter:E,loop:I,disablePointerSelection:U=!1,vimBindings:A=!0,...B}=t,H=q(),ne=q(),N=q(),M=n.useRef(null),w=We();$(()=>{if(p!==void 0){let e=p.trim();r.current.value=e,k.emit()}},[p]),$(()=>{w(6,ae)},[]);let k=n.useMemo(()=>({subscribe:e=>(d.current.add(e),()=>d.current.delete(e)),snapshot:()=>r.current,setState:(e,o,s)=>{var a,m,g,S;if(!Object.is(r.current[e],o)){if(r.current[e]=o,e==="search")J(),W(),w(1,G);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(N);y?y.focus():(a=document.getElementById(H))==null||a.focus()}if(w(7,()=>{var y;r.current.selectedItemId=(y=D())==null?void 0:y.id,k.emit()}),s||w(5,ae),((m=v.current)==null?void 0:m.value)!==void 0){let y=o??"";(S=(g=v.current).onValueChange)==null||S.call(g,y);return}}k.emit()}},emit:()=>{d.current.forEach(e=>e())}}),[]),T=n.useMemo(()=>({value:(e,o,s)=>{var a;o!==((a=c.current.get(e))==null?void 0:a.value)&&(c.current.set(e,{value:o,keywords:s}),r.current.filtered.items.set(e,le(o,s)),w(2,()=>{W(),k.emit()}))},item:(e,o)=>(f.current.add(e),o&&(u.current.has(o)?u.current.get(o).add(e):u.current.set(o,new Set([e]))),w(3,()=>{J(),W(),r.current.value||G(),k.emit()}),()=>{c.current.delete(e),f.current.delete(e),r.current.filtered.items.delete(e);let s=D();w(4,()=>{J(),s?.getAttribute("id")===e&&G(),k.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{c.current.delete(e),u.current.delete(e)}),filter:()=>v.current.shouldFilter,label:b||t["aria-label"],getDisablePointerSelection:()=>v.current.disablePointerSelection,listId:H,inputId:N,labelId:ne,listInnerRef:M}),[]);function le(e,o){var s,a;let m=(a=(s=v.current)==null?void 0:s.filter)!=null?a:Pe;return e?m(e,r.current.search,o):0}function W(){if(!r.current.search||v.current.shouldFilter===!1)return;let e=r.current.filtered.items,o=[];r.current.filtered.groups.forEach(a=>{let m=u.current.get(a),g=0;m.forEach(S=>{let y=e.get(S);g=Math.max(y,g)}),o.push([a,g])});let s=M.current;P().sort((a,m)=>{var g,S;let y=a.getAttribute("id"),O=m.getAttribute("id");return((g=e.get(O))!=null?g:0)-((S=e.get(y))!=null?S:0)}).forEach(a=>{let m=a.closest(_);m?m.appendChild(a.parentElement===m?a:a.closest(`${_} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${_} > *`))}),o.sort((a,m)=>m[1]-a[1]).forEach(a=>{var m;let g=(m=M.current)==null?void 0:m.querySelector(`${V}[${F}="${encodeURIComponent(a[0])}"]`);g?.parentElement.appendChild(g)})}function G(){let e=P().find(s=>s.getAttribute("aria-disabled")!=="true"),o=e?.getAttribute(F);k.setState("value",o||void 0)}function J(){var e,o,s,a;if(!r.current.search||v.current.shouldFilter===!1){r.current.filtered.count=f.current.size;return}r.current.filtered.groups=new Set;let m=0;for(let g of f.current){let S=(o=(e=c.current.get(g))==null?void 0:e.value)!=null?o:"",y=(a=(s=c.current.get(g))==null?void 0:s.keywords)!=null?a:[],O=le(S,y);r.current.filtered.items.set(g,O),O>0&&m++}for(let[g,S]of u.current)for(let y of S)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(g);break}r.current.filtered.count=m}function ae(){var e,o,s;let a=D();a&&(((e=a.parentElement)==null?void 0:e.firstChild)===a&&((s=(o=a.closest(V))==null?void 0:o.querySelector(qe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function D(){var e;return(e=M.current)==null?void 0:e.querySelector(`${me}[aria-selected="true"]`)}function P(){var e;return Array.from(((e=M.current)==null?void 0:e.querySelectorAll(fe))||[])}function X(e){let o=P()[e];o&&k.setState("value",o.getAttribute(F))}function Y(e){var o;let s=D(),a=P(),m=a.findIndex(S=>S===s),g=a[m+e];(o=v.current)!=null&&o.loop&&(g=m+e<0?a[a.length-1]:m+e===a.length?a[0]:a[m+e]),g&&k.setState("value",g.getAttribute(F))}function ue(e){let o=D(),s=o?.closest(V),a;for(;s&&!a;)s=e>0?Ne(s,V):Te(s,V),a=s?.querySelector(fe);a?k.setState("value",a.getAttribute(F)):Y(e)}let ie=()=>X(P().length-1),oe=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?ue(1):Y(1)},ce=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?ue(-1):Y(-1)};return n.createElement(R.div,{ref:l,tabIndex:-1,...B,"cmdk-root":"",onKeyDown:e=>{var o;(o=B.onKeyDown)==null||o.call(B,e);let s=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||s))switch(e.key){case"n":case"j":{A&&e.ctrlKey&&oe(e);break}case"ArrowDown":{oe(e);break}case"p":case"k":{A&&e.ctrlKey&&ce(e);break}case"ArrowUp":{ce(e);break}case"Home":{e.preventDefault(),X(0);break}case"End":{e.preventDefault(),ie();break}case"Enter":{e.preventDefault();let a=D();if(a){let m=new Event(te);a.dispatchEvent(m)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Je},b),z(t,e=>n.createElement(he.Provider,{value:k},n.createElement(pe.Provider,{value:T},e))))}),Ve=n.forwardRef((t,l)=>{var r,f;let u=q(),c=n.useRef(null),d=n.useContext(ge),v=L(),b=we(t),i=(f=(r=b.current)==null?void 0:r.forceMount)!=null?f:d?.forceMount;$(()=>{if(!i)return v.item(u,d?.id)},[i]);let p=ye(u,c,[t.value,t.children,c],t.keywords),h=re(),x=C(w=>w.value&&w.value===p.current),E=C(w=>i||v.filter()===!1?!0:w.search?w.filtered.items.get(u)>0:!0);n.useEffect(()=>{let w=c.current;if(!(!w||t.disabled))return w.addEventListener(te,I),()=>w.removeEventListener(te,I)},[E,t.onSelect,t.disabled]);function I(){var w,k;U(),(k=(w=b.current).onSelect)==null||k.call(w,p.current)}function U(){h.setState("value",p.current,!0)}if(!E)return null;let{disabled:A,value:B,onSelect:H,forceMount:ne,keywords:N,...M}=t;return n.createElement(R.div,{ref:j(c,l),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||v.getDisablePointerSelection()?void 0:U,onClick:A?void 0:I},t.children)}),je=n.forwardRef((t,l)=>{let{heading:r,children:f,forceMount:u,...c}=t,d=q(),v=n.useRef(null),b=n.useRef(null),i=q(),p=L(),h=C(E=>u||p.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);$(()=>p.group(d),[]),ye(d,v,[t.value,t.heading,b]);let x=n.useMemo(()=>({id:d,forceMount:u}),[u]);return n.createElement(R.div,{ref:j(v,l),...c,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},r&&n.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:i},r),z(t,E=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?i:void 0},n.createElement(ge.Provider,{value:x},E))))}),Le=n.forwardRef((t,l)=>{let{alwaysRender:r,...f}=t,u=n.useRef(null),c=C(d=>!d.search);return!r&&!c?null:n.createElement(R.div,{ref:j(u,l),...f,"cmdk-separator":"",role:"separator"})}),Be=n.forwardRef((t,l)=>{let{onValueChange:r,...f}=t,u=t.value!=null,c=re(),d=C(i=>i.search),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{t.value!=null&&c.setState("search",t.value)},[t.value]),n.createElement(R.input,{ref:l,...f,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":v,id:b.inputId,type:"text",value:u?t.value:d,onChange:i=>{u||c.setState("search",i.target.value),r?.(i.target.value)}})}),Oe=n.forwardRef((t,l)=>{let{children:r,label:f="Suggestions",...u}=t,c=n.useRef(null),d=n.useRef(null),v=C(i=>i.selectedItemId),b=L();return n.useEffect(()=>{if(d.current&&c.current){let i=d.current,p=c.current,h,x=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let E=i.offsetHeight;p.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return x.observe(i),()=>{cancelAnimationFrame(h),x.unobserve(i)}}},[]),n.createElement(R.div,{ref:j(c,l),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":v,"aria-label":f,id:b.listId},z(t,i=>n.createElement("div",{ref:j(d,b.listInnerRef),"cmdk-list-sizer":""},i)))}),ze=n.forwardRef((t,l)=>{let{open:r,onOpenChange:f,overlayClassName:u,contentClassName:c,container:d,...v}=t;return n.createElement(Ee,{open:r,onOpenChange:f},n.createElement(ke,{container:d},n.createElement(Se,{"cmdk-overlay":"",className:u}),n.createElement(xe,{"aria-label":t.label,"cmdk-dialog":"",className:c},n.createElement(be,{ref:l,...v}))))}),Ue=n.forwardRef((t,l)=>C(r=>r.filtered.count===0)?n.createElement(R.div,{ref:l,...t,"cmdk-empty":"",role:"presentation"}):null),He=n.forwardRef((t,l)=>{let{progress:r,children:f,label:u="Loading...",...c}=t;return n.createElement(R.div,{ref:l,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},z(t,d=>n.createElement("div",{"aria-hidden":!0},d)))}),Ye=Object.assign(be,{List:Oe,Item:Ve,Input:Be,Group:je,Separator:Le,Dialog:ze,Empty:Ue,Loading:He});function Ne(t,l){let r=t.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function Te(t,l){let r=t.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function we(t){let l=n.useRef(t);return $(()=>{l.current=t}),l}var $=typeof window>"u"?n.useEffect:n.useLayoutEffect;function K(t){let l=n.useRef();return l.current===void 0&&(l.current=t()),l}function C(t){let l=re(),r=()=>t(l.snapshot());return n.useSyncExternalStore(l.subscribe,r,r)}function ye(t,l,r,f=[]){let u=n.useRef(),c=L();return $(()=>{var d;let v=(()=>{var i;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(i=p.current.textContent)==null?void 0:i.trim():u.current}})(),b=f.map(i=>i.trim());c.value(t,v,b),(d=l.current)==null||d.setAttribute(F,v),u.current=v}),u}var We=()=>{let[t,l]=n.useState(),r=K(()=>new Map);return $(()=>{r.current.forEach(f=>f()),r.current=new Map},[t]),(f,u)=>{r.current.set(f,u),l({})}};function Ge(t){let l=t.type;return typeof l=="function"?l(t.props):"render"in l?l.render(t.props):t}function z({asChild:t,children:l},r){return t&&n.isValidElement(l)?n.cloneElement(Ge(l),{ref:l.ref},r(l.props.children)):r(l)}var Je={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};export{Ye as _};