decocms 3.11.0 → 3.12.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 (245) hide show
  1. package/dist/client/assets/{AlertCircle-Ctbek2zl.js → AlertCircle-l0Fpo8hU.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-CGlPrRsR.js → ArrowUpRight-nFWH1Ez9.js} +1 -1
  3. package/dist/client/assets/{Check-D-2DMeXR.js → Check-c_jJpxb1.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-CPLY3iX-.js → CheckCircle-38u06F5f.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-DUb-OAcF.js → ChevronDown-BD_mAbO2.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-IUSMXc7n.js → ChevronLeft-CpIXC6Gs.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-C6_Bb1P7.js → ChevronRight-DLrAfqVe.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-mT0kmu5O.js → ChevronUp-CSbcB5D_.js} +1 -1
  9. package/dist/client/assets/{Container-V3OuMECL.js → Container-DhunwrH9.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-CYMPhMIv.js → DotsVertical-Drb9z9hu.js} +1 -1
  11. package/dist/client/assets/{Eye-DLKlw-42.js → Eye-cKsI4OxT.js} +1 -1
  12. package/dist/client/assets/{FilterLines-B2lLGnWS.js → FilterLines-BiHh13xm.js} +1 -1
  13. package/dist/client/assets/{Globe01-BSqLqa8H.js → Globe01-BqxI6QZP.js} +1 -1
  14. package/dist/client/assets/{HardDrive-BFG0b6vP.js → HardDrive-BwbAMrUb.js} +1 -1
  15. package/dist/client/assets/{Key01-DeIJhm73.js → Key01-qQx1LV2o.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-CAachN7j.js → LayoutLeft-CpIWBcma.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-C7Ulot5I.js → LinkExternal01-CXoDDgz6.js} +1 -1
  18. package/dist/client/assets/{Monitor01-RdLthi4L.js → Monitor01-DdJ7wtCm.js} +1 -1
  19. package/dist/client/assets/{Palette-D1rjO3C7.js → Palette-B-k8xsYD.js} +1 -1
  20. package/dist/client/assets/{Play-CL1Mgiwf.js → Play-CjnZZCXU.js} +1 -1
  21. package/dist/client/assets/{Plus-DINfOuqC.js → Plus-DhX2w18y.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-DSZXx3HQ.js → RefreshCcw01-COCceFoS.js} +1 -1
  23. package/dist/client/assets/{SearchMd-Dt4Aj6N4.js → SearchMd-DrKxcX2-.js} +1 -1
  24. package/dist/client/assets/{Settings02-COHAF-aj.js → Settings02-YFMXLzh7.js} +1 -1
  25. package/dist/client/assets/{Shield01-Ef5O0H91.js → Shield01-C0lG89zR.js} +1 -1
  26. package/dist/client/assets/{Star01-DWr_psxV.js → Star01-DSZcWlXz.js} +1 -1
  27. package/dist/client/assets/{Stars01-CTAt_kJn.js → Stars01-CJvAL1Fd.js} +1 -1
  28. package/dist/client/assets/{Stars02-7S-x4jsE.js → Stars02-BZvUEwJW.js} +1 -1
  29. package/dist/client/assets/{Sun-C0yimusT.js → Sun-Bc4Ui5gi.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-CdSYnpvh.js → SwitchHorizontal01-Dh0Hb3Cs.js} +1 -1
  31. package/dist/client/assets/{Tool01-Co9IzxOX.js → Tool01-C6w2kT2d.js} +1 -1
  32. package/dist/client/assets/{Trash01-m4F91Gbm.js → Trash01-CicwXof9.js} +1 -1
  33. package/dist/client/assets/{Upload01-BWuva6Fs.js → Upload01-Cjsy_A0C.js} +1 -1
  34. package/dist/client/assets/{User01-BQ6QP8OL.js → User01-C-Fxjmsz.js} +1 -1
  35. package/dist/client/assets/{Users01-ByzlIQ3F.js → Users01-Bcdl2fo8.js} +1 -1
  36. package/dist/client/assets/{Users03-mgRYViRT.js → Users03-BQUStXwY.js} +1 -1
  37. package/dist/client/assets/{X-D5DAti-0.js → X-BZgcfyxc.js} +1 -1
  38. package/dist/client/assets/{XCircle-BjeFLJxj.js → XCircle-DZXIRf5B.js} +1 -1
  39. package/dist/client/assets/{XClose-s3WJPw3-.js → XClose-BJgeWVDy.js} +1 -1
  40. package/dist/client/assets/{Zap-Z3n8EP6c.js → Zap-DHRMF6hr.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-By7Cv3Wp.js → ZapSquare-DHYwZGs3.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-CIHaUyEl.js → ZoomOut-DUCp8Gob.js} +1 -1
  43. package/dist/client/assets/{access-gate-Duof6cnb.js → access-gate-D3K4mW0p.js} +1 -1
  44. package/dist/client/assets/accordion-Dczz3n4d.js +1 -0
  45. package/dist/client/assets/{add-section-modal-DkoTaNoJ.js → add-section-modal-UjRtSYXi.js} +1 -1
  46. package/dist/client/assets/{agent-capabilities-Ckkw1MUq.js → agent-capabilities-CTp309mj.js} +2 -2
  47. package/dist/client/assets/{agent-icon-VIqap9Jf.js → agent-icon-BGlV6q8v.js} +1 -1
  48. package/dist/client/assets/{agent-icons-D05ipmZ4.js → agent-icons-D51QBNe2.js} +1 -1
  49. package/dist/client/assets/{agents-list-CVx5qLnY.js → agents-list-BDjAtGII.js} +1 -1
  50. package/dist/client/assets/{ai-providers-BuKKX642.js → ai-providers-C5FRtqVa.js} +1 -1
  51. package/dist/client/assets/{alert-DlT05Ylq.js → alert-C2SAdiMn.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-Ci1rMRpl.js → alert-dialog-CfIqXXf0.js} +1 -1
  53. package/dist/client/assets/app-editor-BtCGiT5R.js +1 -0
  54. package/dist/client/assets/{auth-catchall-BUCBz8XY.js → auth-catchall-BNIV3K68.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-CY6KnHSz.js → auth-split-layout-Ur7ekzLQ.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-Dg6SIiTL.js → automation-list-row-BI945zvy.js} +1 -1
  57. package/dist/client/assets/{automation-runs-BmKdgkka.js → automation-runs-BYBNQ-JJ.js} +1 -1
  58. package/dist/client/assets/{automations-BcxEWxp4.js → automations-BS4h-ogy.js} +1 -1
  59. package/dist/client/assets/{avatar-B5XGLu28.js → avatar-CV-HskE0.js} +1 -1
  60. package/dist/client/assets/{badge-BiVWMQaC.js → badge-BIbhtFGp.js} +1 -1
  61. package/dist/client/assets/{brand-context-DSuk-fkh.js → brand-context-DoHj9jxR.js} +1 -1
  62. package/dist/client/assets/{buckets-DNim0Oxi.js → buckets-3KyheLMz.js} +1 -1
  63. package/dist/client/assets/{calendar-D3ybWgKx.js → calendar-anoyFX3_.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-BoG7ZxlR.js → capability-load-error-5fpCsl-E.js} +1 -1
  65. package/dist/client/assets/{card-Bs_ZETWd.js → card-clJ4_TXy.js} +1 -1
  66. package/dist/client/assets/{chat-context-DXMK9LpM.js → chat-context-CMCmhu0x.js} +7 -7
  67. package/dist/client/assets/{checkbox-CDeLVmoz.js → checkbox-D5ZsgUiL.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-DUzSXn1x.js → cli-auth-success-DUs_glfQ.js} +1 -1
  69. package/dist/client/assets/{collection-detail-B39xBZcf.js → collection-detail-DoORbeIU.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-LYjUKJyD.js → collection-display-button-BHU3gVjd.js} +1 -1
  71. package/dist/client/assets/{collection-search-CIGzMvXg.js → collection-search-XnV7IoL4.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-CRZ7umIR.js → collection-table-wrapper-Def6_fTh.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-Cl0Sce7d.js → collection-tabs-BL5EWXFo.js} +1 -1
  74. package/dist/client/assets/{collections-DsvWgjkq.js → collections-CjrPw-fH.js} +1 -1
  75. package/dist/client/assets/{command-nIpjgY_C.js → command-xElkUveT.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-D0cwbi62.js → connect-desktop-dialog-z9_d2OMY.js} +1 -1
  77. package/dist/client/assets/{connection-card-Js2GKnMD.js → connection-card-CdjjPmMy.js} +1 -1
  78. package/dist/client/assets/connection-detail-CLkds3z5.js +1 -0
  79. package/dist/client/assets/connection-form-helpers-x6Qv_JQD.js +1 -0
  80. package/dist/client/assets/{connections-BM65SkyA.js → connections-scTFfwYa.js} +1 -1
  81. package/dist/client/assets/constants-_NfKPeA7.js +10 -0
  82. package/dist/client/assets/{decopilot-sse-pool-xYuzxJCG.js → decopilot-sse-pool-uVjHemnd.js} +1 -1
  83. package/dist/client/assets/{dialog-BDoa-Aig.js → dialog-DAZt_PYz.js} +1 -1
  84. package/dist/client/assets/{domain-settings-BHKhY4wr.js → domain-settings-BeuJal2Z.js} +1 -1
  85. package/dist/client/assets/{drawer-DBoqm7Ga.js → drawer-DgVqJYUv.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-BuEg85yr.js → dropdown-menu-D8Jq0EXH.js} +1 -1
  87. package/dist/client/assets/{dynamic-plugin-layout-DROpH4YR.js → dynamic-plugin-layout-DfSmXQDS.js} +1 -1
  88. package/dist/client/assets/{empty-state-Ct_D2Lzo.js → empty-state-ClDtXUcE.js} +1 -1
  89. package/dist/client/assets/{empty-state-BzUpYoP8.js → empty-state-D2uf8sZL.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-C73XSXJg.js → extract-connection-data-CXd7xn8D.js} +1 -1
  91. package/dist/client/assets/features-D5HpJxEl.js +1 -0
  92. package/dist/client/assets/{file-explorer-DIE7TBnv.js → file-explorer-0O3gnUbG.js} +1 -1
  93. package/dist/client/assets/{file-type-icon-CXEAWEt3.js → file-type-icon-CM5FDHHb.js} +1 -1
  94. package/dist/client/assets/{files-Dk2BQIKH.js → files-CbWK6Oem.js} +1 -1
  95. package/dist/client/assets/{form-CEHwzUIx.js → form-Bom2oLZH.js} +1 -1
  96. package/dist/client/assets/{general-D0Ux1V9u.js → general-C1lfdTH5.js} +1 -1
  97. package/dist/client/assets/{generate-id-DwXNdT-H.js → generate-id-Bloedyht.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-CFHmzbdo.js → github-repo-picker-BLseIx3l.js} +2 -2
  99. package/dist/client/assets/{header-tab-button-Be5qNrZz.js → header-tab-button-HHwdKYUp.js} +3 -3
  100. package/dist/client/assets/{hover-card-CZKyvEKV.js → hover-card-BbAh8d7J.js} +1 -1
  101. package/dist/client/assets/{image-field-dhimK8za.js → image-field-A74OnXkk.js} +1 -1
  102. package/dist/client/assets/{index-CnvExC11.js → index-BztCosFc.js} +12 -12
  103. package/dist/client/assets/{index-OL8Ldzfm.js → index-CRqPsUNG.js} +12 -12
  104. package/dist/client/assets/{index-C1oz8tZO.js → index-Cwch4eob.js} +1 -1
  105. package/dist/client/assets/{index-3RJ1532Y.js → index-DFAITwpu.js} +1 -1
  106. package/dist/client/assets/{index-DJjaDA78.js → index-DKNjAJFI.js} +1 -1
  107. package/dist/client/assets/{index-BTP7FdvD.js → index-DNtm0JLi.js} +1 -1
  108. package/dist/client/assets/{index-fhh9LjnW.js → index-DRh6u24v.js} +1 -1
  109. package/dist/client/assets/{index-5FdhmN0u.js → index-DV3Yfg7N.js} +1 -1
  110. package/dist/client/assets/{index-D2E_r2Ga.js → index-DdDGbzVq.js} +1 -1
  111. package/dist/client/assets/{index-CX7SvFBB.js → index-DlenCt7g.js} +1 -1
  112. package/dist/client/assets/{index-DhlM3QdF.js → index-DoK0XiUD.js} +1 -1
  113. package/dist/client/assets/{index-qEEk-G84.js → index-DtS-92Oz.js} +1 -1
  114. package/dist/client/assets/{index-4cje1k2I.js → index-eZWazEyz.js} +4 -4
  115. package/dist/client/assets/{index-8Av7_XG5.js → index-kq5yUS_7.js} +30 -30
  116. package/dist/client/assets/{index-redirect-Cw9_x250.js → index-redirect-BE0FdN2x.js} +1 -1
  117. package/dist/client/assets/{index-B3HtVn_3.js → index-u752Wts1.js} +1 -1
  118. package/dist/client/assets/{infiniteQueryObserver-BPAoXqhZ.js → infiniteQueryObserver-BMRPwu0B.js} +1 -1
  119. package/dist/client/assets/{input-CFgdCIf-.js → input-CwrS-iub.js} +1 -1
  120. package/dist/client/assets/{integration-icon-ByZrCdpe.js → integration-icon-CpXFY6_W.js} +1 -1
  121. package/dist/client/assets/{label-D5ze4fbW.js → label-CLJ0AedA.js} +1 -1
  122. package/dist/client/assets/{layout-BuMBlDfo.js → layout-CRFmyheT.js} +1 -1
  123. package/dist/client/assets/{login-RbDPhsFB.js → login-ZDQxXAlc.js} +1 -1
  124. package/dist/client/assets/{members-k2G4ARa8.js → members-CETsRg6c.js} +2 -2
  125. package/dist/client/assets/{monaco-editor-BAqhsJzm.js → monaco-editor-DqjxL8qC.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-DSa7vGTC.js → monitoring-stats-row-BtrtxUC2.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-CbbBKuCW.js → oauth-callback-DKUIBnJx.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-BRZTOWnt.js → oauth-callback-ai-provider-CQsd2o0a.js} +1 -1
  129. package/dist/client/assets/{onboarding-C6E_j9z8.js → onboarding-Dp9u-AR8.js} +1 -1
  130. package/dist/client/assets/org-install-B0DdE2Cp.js +1 -0
  131. package/dist/client/assets/{org-layout-UJeeaSgp.js → org-layout-CbZhwhjC.js} +1 -1
  132. package/dist/client/assets/{org-plugin-layout-BKs5_fCy.js → org-plugin-layout-nvcLwDDm.js} +1 -1
  133. package/dist/client/assets/{page-seo-form-nusKb5Sb.js → page-seo-form-BfAIN8Sl.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-1M0ZQCXy.js +1 -0
  135. package/dist/client/assets/{pair-B10kI-gZ.js → pair-Ddwa7ge4.js} +5 -5
  136. package/dist/client/assets/{plugin-empty-state-j4CULS57.js → plugin-empty-state-DIWYp1SI.js} +1 -1
  137. package/dist/client/assets/{plugin-header-DULj-Y49.js → plugin-header-BK3X79ek.js} +1 -1
  138. package/dist/client/assets/{plugin-layout-BKWVYVIi.js → plugin-layout-G84GIXAW.js} +1 -1
  139. package/dist/client/assets/{popover-CusBDsw3.js → popover-DsfanlnP.js} +1 -1
  140. package/dist/client/assets/{post-editor-DEyWVqiE.js → post-editor-HYnj9aMU.js} +1 -1
  141. package/dist/client/assets/{primitives-K-Cou-34.js → primitives-h_5eGcD7.js} +1 -1
  142. package/dist/client/assets/{profile-Cbty-wCE.js → profile-C_EEhrOq.js} +1 -1
  143. package/dist/client/assets/project-app-view-ClBF_FE1.js +1 -0
  144. package/dist/client/assets/record-editor-D_XxtmM1.js +1 -0
  145. package/dist/client/assets/registry-DuikH1Le.js +2 -0
  146. package/dist/client/assets/registry-layout-ClLggzAs.js +27 -0
  147. package/dist/client/assets/{require-capability-B58b3LsO.js → require-capability-B9yp1djm.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-CLPqu2hV.js → required-auth-layout-BsLlfTDJ.js} +1 -1
  149. package/dist/client/assets/{reset-password-QvfJzQLt.js → reset-password-C2JTjbtA.js} +1 -1
  150. package/dist/client/assets/{resizable-DtVYiBv-.js → resizable-Bos_97Hr.js} +1 -1
  151. package/dist/client/assets/{roles-BJzMRSbv.js → roles-CBUmzMVz.js} +1 -1
  152. package/dist/client/assets/{save-status-CcrdCZvz.js → save-status-BbK1RQSX.js} +1 -1
  153. package/dist/client/assets/{schema-form-CLs9R9OM.js → schema-form-CUO9haBq.js} +1 -1
  154. package/dist/client/assets/{scroll-area-GY_MqX9m.js → scroll-area-Cq2TqSe0.js} +1 -1
  155. package/dist/client/assets/{search-input-CaIL3--R.js → search-input-W-g6XRjC.js} +1 -1
  156. package/dist/client/assets/{secrets-CEQKXAz2.js → secrets-BDICEFKM.js} +1 -1
  157. package/dist/client/assets/{sections-editor-3wx6-GfE.js → sections-editor-BaZsoyW0.js} +1 -1
  158. package/dist/client/assets/select-ci3BSqp5.js +1 -0
  159. package/dist/client/assets/{select-model-DV1-Oh57.js → select-model-DHOmXmSc.js} +1 -1
  160. package/dist/client/assets/{seo-editor-CwuvVAjS.js → seo-editor-BbPcLsSR.js} +1 -1
  161. package/dist/client/assets/{settings-layout-lPzeLZ6G.js → settings-layout-JiHWSow4.js} +1 -1
  162. package/dist/client/assets/{settings-section-rywQD1H8.js → settings-section-x9o4zXy4.js} +1 -1
  163. package/dist/client/assets/{sheet-HD1tdtUP.js → sheet-BwdJHIyp.js} +1 -1
  164. package/dist/client/assets/{shell-controls-CiR1mOgQ.js → shell-controls-Bk1-5JuX.js} +1 -1
  165. package/dist/client/assets/shell-layout-BSanGTZR.js +1 -0
  166. package/dist/client/assets/shell-route-loading-Oji4SthS.js +1 -0
  167. package/dist/client/assets/{sidebar-BTAYcbpn.js → sidebar-CZfP1p-N.js} +1 -1
  168. package/dist/client/assets/{skeleton-KPs8aExG.js → skeleton-C868IqtJ.js} +1 -1
  169. package/dist/client/assets/{sortable.esm-k9dnaUc0.js → sortable.esm-D3VtLwMe.js} +1 -1
  170. package/dist/client/assets/{spinner-CWHpDgnL.js → spinner-DFgihVtE.js} +1 -1
  171. package/dist/client/assets/{sso-DCJOVjP-.js → sso-Dd4ntKKA.js} +1 -1
  172. package/dist/client/assets/{store-QHf4NvZa.js → store-WLHJZJYL.js} +1 -1
  173. package/dist/client/assets/store-registry-Bipqg_S3.js +2 -0
  174. package/dist/client/assets/{switch-CCjru8jV.js → switch-dV1jxIo5.js} +1 -1
  175. package/dist/client/assets/{tab-id-Cj2zAp8p.js → tab-id-DQ11sDJ5.js} +1 -1
  176. package/dist/client/assets/{table-Dpu-CGxg.js → table-CHKmKoKb.js} +1 -1
  177. package/dist/client/assets/{tabs-Bsb3WneA.js → tabs-CSjv4io2.js} +1 -1
  178. package/dist/client/assets/{task-status-Bq8PHYFh.js → task-status-CAwvZzfY.js} +1 -1
  179. package/dist/client/assets/{textarea-Bw4v_xfm.js → textarea-CSfWC_ri.js} +1 -1
  180. package/dist/client/assets/{toggle-group-a9DpUbSj.js → toggle-group-D1uW02Dw.js} +1 -1
  181. package/dist/client/assets/{toolbar-BkMHRO8B.js → toolbar-C_QNuxJc.js} +1 -1
  182. package/dist/client/assets/{tools-list-CmaWZYdl.js → tools-list-DSls0TxE.js} +1 -1
  183. package/dist/client/assets/{tooltip-B9p8ywB_.js → tooltip-DjBYlSjK.js} +1 -1
  184. package/dist/client/assets/{types-5S14a687.js → types-I4bGGmPg.js} +19 -19
  185. package/dist/client/assets/{use-ai-providers-iJF3uFpo.js → use-ai-providers-BdU26Ah1.js} +1 -1
  186. package/dist/client/assets/{use-automations-BTipFIOi.js → use-automations-DOs6eBSZ.js} +1 -1
  187. package/dist/client/assets/{use-capability-CeWdChcL.js → use-capability-Dzq6Bisq.js} +1 -1
  188. package/dist/client/assets/use-collections-VJ2gqsdi.js +1 -0
  189. package/dist/client/assets/{use-connection-C2Ef-EqP.js → use-connection-CXK4eJ8D.js} +1 -1
  190. package/dist/client/assets/{use-copy-DPF-R5Zs.js → use-copy-DNF_xTyk.js} +1 -1
  191. package/dist/client/assets/{use-create-virtual-mcp-7QQxHiI4.js → use-create-virtual-mcp-YcZkU7UR.js} +1 -1
  192. package/dist/client/assets/{use-debounced-autosave-Da4caii8.js → use-debounced-autosave-B3zncsM_.js} +1 -1
  193. package/dist/client/assets/use-delete-connection-BwHdKngt.js +1 -0
  194. package/dist/client/assets/{use-file-configs-DWgNRokn.js → use-file-configs-DkyMSTLH.js} +1 -1
  195. package/dist/client/assets/{use-infinite-scroll-BaBllFvG.js → use-infinite-scroll-HH8GENKX.js} +1 -1
  196. package/dist/client/assets/{use-list-state-d80zzrG8.js → use-list-state-DTTdz8wm.js} +1 -1
  197. package/dist/client/assets/use-mcp-prompts-CVpfcaNj.js +1 -0
  198. package/dist/client/assets/use-mcp-tools-PoAtDkM2.js +1 -0
  199. package/dist/client/assets/{use-members-D2U599cF.js → use-members-BtoFg3-I.js} +1 -1
  200. package/dist/client/assets/{use-navigate-to-agent-C3AzTy7G.js → use-navigate-to-agent-C9nwjmya.js} +1 -1
  201. package/dist/client/assets/{use-org-auth-client-BQe59WMu.js → use-org-auth-client-q5-USMbu.js} +1 -1
  202. package/dist/client/assets/{use-org-sso-BB-vyF4c.js → use-org-sso-zB87Inuk.js} +1 -1
  203. package/dist/client/assets/{use-organization-roles-DItwUayG.js → use-organization-roles-Bye-MpK5.js} +1 -1
  204. package/dist/client/assets/{use-organization-settings-B6tWOwuA.js → use-organization-settings--vsQI-Ms.js} +1 -1
  205. package/dist/client/assets/{use-registry-connections-DIBKm4oO.js → use-registry-connections-BYv9Ob-m.js} +1 -1
  206. package/dist/client/assets/{use-secrets-BhZyR2Dx.js → use-secrets-uqIdLNLc.js} +1 -1
  207. package/dist/client/assets/{use-status-sounds-Wb6qMNbl.js → use-status-sounds-DrT-Tr09.js} +1 -1
  208. package/dist/client/assets/{use-view-mode-BwvjqQMY.js → use-view-mode-Cp1ETvgV.js} +1 -1
  209. package/dist/client/assets/use-virtual-mcp-z0hFit1f.js +1 -0
  210. package/dist/client/assets/useInfiniteQuery-JptJrV0H.js +1 -0
  211. package/dist/client/assets/{useRouterState-BLC1S9ll.js → useRouterState-fo-Z74Ek.js} +1 -1
  212. package/dist/client/assets/useSuspenseInfiniteQuery-Dg59byu5.js +1 -0
  213. package/dist/client/assets/{user-BHKPSALf.js → user-DIXNb7DL.js} +1 -1
  214. package/dist/client/assets/{view-mode-toggle-BabF7Sx4.js → view-mode-toggle-BaN0GlRl.js} +1 -1
  215. package/dist/client/assets/{workflow-BQFoQKwV.js → workflow-CE3SA7F3.js} +1 -1
  216. package/dist/client/assets/workflow-detail-CL1QoJdW.js +1 -0
  217. package/dist/client/index.html +1 -1
  218. package/dist/server/cli.js +425 -415
  219. package/dist/server/migrate.js +57 -57
  220. package/dist/server/server.js +288 -278
  221. package/package.json +1 -1
  222. package/dist/client/assets/accordion-B1qqQUiM.js +0 -1
  223. package/dist/client/assets/app-editor-DNNG7_rJ.js +0 -1
  224. package/dist/client/assets/connection-detail-Db8Rqnlx.js +0 -1
  225. package/dist/client/assets/connection-form-helpers-Dkeln3L-.js +0 -1
  226. package/dist/client/assets/constants-DeFtLUND.js +0 -10
  227. package/dist/client/assets/features-CG5whIKN.js +0 -1
  228. package/dist/client/assets/org-install-Dj9o_O_M.js +0 -1
  229. package/dist/client/assets/page-seo-sheet-BpOn67AY.js +0 -1
  230. package/dist/client/assets/project-app-view-gakpd8ie.js +0 -1
  231. package/dist/client/assets/record-editor-BJCIZK6H.js +0 -1
  232. package/dist/client/assets/registry-IJiacnxJ.js +0 -2
  233. package/dist/client/assets/registry-layout-1N9kmpom.js +0 -27
  234. package/dist/client/assets/select-Y4AHPww8.js +0 -1
  235. package/dist/client/assets/shell-layout-D1gXYOI4.js +0 -1
  236. package/dist/client/assets/shell-route-loading-BMvdQN97.js +0 -1
  237. package/dist/client/assets/store-registry-O5u8x-zS.js +0 -2
  238. package/dist/client/assets/use-collections-CMMaRmVG.js +0 -1
  239. package/dist/client/assets/use-delete-connection-DaFBaRNm.js +0 -1
  240. package/dist/client/assets/use-mcp-prompts-1dd1yGOH.js +0 -1
  241. package/dist/client/assets/use-mcp-tools-C8LW1vg1.js +0 -1
  242. package/dist/client/assets/use-virtual-mcp-C_vD2kKw.js +0 -1
  243. package/dist/client/assets/useInfiniteQuery-CQ_UxVw9.js +0 -1
  244. package/dist/client/assets/useSuspenseInfiniteQuery-XoWOrVYw.js +0 -1
  245. package/dist/client/assets/workflow-detail-CUEl0-_h.js +0 -1
@@ -1,5 +1,5 @@
1
- import{e as y,r as v,j as o,B as W,z as we,c as ee,q as C,F as ce,a as G,K as M,n as X,b2 as xe,o as re,a0 as ge,l as ye}from"./index-8Av7_XG5.js";import{D as je,a as ke,b as be,c as ie}from"./dropdown-menu-BuEg85yr.js";import{b as A,T as B,a as K}from"./tooltip-B9p8ywB_.js";import{i as ve}from"./Check-D-2DMeXR.js";import{a as Se}from"./Eye-DLKlw-42.js";import{n as Z}from"./Globe01-BSqLqa8H.js";import{e as $e,f as Te,i as Ee,b as Me}from"./ZoomOut-CIHaUyEl.js";import{i as Ce}from"./LayoutLeft-CAachN7j.js";import{n as Ne}from"./LinkExternal01-C7Ulot5I.js";import{S as Q}from"./skeleton-KPs8aExG.js";import{l as Fe,F as De}from"./index-CX7SvFBB.js";import{F as ze,M as Pe}from"./file-type-icon-CXEAWEt3.js";const wt=1e4,Ue=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 Oe(s){const e=Y(s);if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.pop(),t.length===0?"/":`/${t.join("/")}`}function xt(s,e){const t=e.replace(/^\/+|\/+$/g,"");return Y(t?`${s==="/"?"":s}/${t}`:s)}function gt(s,e){return e==="directory"?s:Oe(s)}function yt(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 _e(s){const e=te(s);return e?e.split("/").filter(Boolean).length:0}function jt(s,e,t,n=!1){return{files:[...new Set([...s,...t.files])],directories:[...new Set([...e,...t.directories??[]])],truncated:n||!!t.truncated}}function kt(s,e){return _e(s)>Ue&&!e.has(s)}function bt(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 vt(s){const e=te(s),t=".deco/blocks/";if(!e.startsWith(t)||!e.endsWith(".json"))return null;const n=e.slice(t.length,-5);try{return decodeURIComponent(n)}catch{return n}}function Re(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 St(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 $t(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 x=c.children.find(k=>k.name===f);x||(x={name:f,path:l,kind:m?"file":"directory",children:[]},c.children.push(x)),c=x})}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 We(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(...We(r.children,e,t+1)));return n}function Tt(s){return s.split(`
1
+ import{e as y,r as v,j as o,B as W,C as we,c as ee,q as C,G as ce,a as G,K as M,n as X,b6 as xe,o as re,a1 as ge,l as ye}from"./index-kq5yUS_7.js";import{D as je,a as ke,b as be,c as ie}from"./dropdown-menu-D8Jq0EXH.js";import{b as A,T as B,a as K}from"./tooltip-DjBYlSjK.js";import{i as ve}from"./Check-c_jJpxb1.js";import{a as Se}from"./Eye-cKsI4OxT.js";import{n as Z}from"./Globe01-BqxI6QZP.js";import{e as $e,f as Te,i as Ee,b as Me}from"./ZoomOut-DUCp8Gob.js";import{i as Ce}from"./LayoutLeft-CpIWBcma.js";import{n as Ne}from"./LinkExternal01-CXoDDgz6.js";import{S as Q}from"./skeleton-C868IqtJ.js";import{l as De,F as Fe}from"./index-DlenCt7g.js";import{F as Pe,M as Ue}from"./file-type-icon-CM5FDHHb.js";const wt=1e4,ze=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 Oe(s){const e=Y(s);if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.pop(),t.length===0?"/":`/${t.join("/")}`}function xt(s,e){const t=e.replace(/^\/+|\/+$/g,"");return Y(t?`${s==="/"?"":s}/${t}`:s)}function gt(s,e){return e==="directory"?s:Oe(s)}function yt(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 _e(s){const e=te(s);return e?e.split("/").filter(Boolean).length:0}function jt(s,e,t,n=!1){return{files:[...new Set([...s,...t.files])],directories:[...new Set([...e,...t.directories??[]])],truncated:n||!!t.truncated}}function kt(s,e){return _e(s)>ze&&!e.has(s)}function bt(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 vt(s){const e=te(s),t=".deco/blocks/";if(!e.startsWith(t)||!e.endsWith(".json"))return null;const n=e.slice(t.length,-5);try{return decodeURIComponent(n)}catch{return n}}function Re(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 St(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 $t(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 x=c.children.find(k=>k.name===f);x||(x={name:f,path:l,kind:m?"file":"directory",children:[]},c.children.push(x)),c=x})}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 We(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(...We(r.children,e,t+1)));return n}function Tt(s){return s.split(`
2
2
  `).map(e=>{const t=e.match(/^\d+\t(.*)/);return t?t[1]:e}).join(`
3
- `)}function Le(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(B,{asChild:!0,children:o.jsx(W,{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(Ce,{size:14})})}),o.jsx(K,{side:"bottom",children:n.railOpen?"Hide slide list":"Show slide list"})]}),e[4]=n,e[5]=m):m=e[5];let x;e[6]!==l?(x=()=>window.open(l,"_blank","noopener"),e[6]=l,e[7]=x):x=e[7];let k;e[8]!==l?(k=o.jsx("span",{className:"truncate",children:l}),e[8]=l,e[9]=k):k=e[9];let b;e[10]!==l||e[11]!==x||e[12]!==k?(b=o.jsx("button",{type:"button",onClick:x,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:k}),e[10]=l,e[11]=x,e[12]=k,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(B,{asChild:!0,children:o.jsxs(W,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(we,{size:12}),"Agent updated — reload"]})}),o.jsx(K,{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 j;e[17]!==n.saving?(j=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"Saving…"}),e[17]=n.saving,e[18]=j):j=e[18];let S;e[19]!==n?(S=n.deckDetected&&n.writable&&o.jsxs(A,{children:[o.jsx(B,{asChild:!0,children:o.jsx(W,{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($e,{size:14})})}),o.jsx(K,{side:"bottom",children:n.editMode?"Done editing":"Edit inline (text, reorder, delete)"})]}),e[19]=n,e[20]=S):S=e[20];let E;e[21]!==l||e[22]!==r||e[23]!==n.deckDetected?(E=n.deckDetected?o.jsxs(je,{children:[o.jsx(ke,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Download",children:o.jsx(Z,{size:14})})}),o.jsxs(be,{align:"end",children:[o.jsxs(ie,{onClick:()=>window.open(`${l}#print`,"_blank","noopener"),children:[o.jsx(Te,{size:14}),"Export as PDF"]}),o.jsx(ie,{asChild:!0,children:o.jsxs("a",{href:l,download:r,children:[o.jsx(Ee,{size:14}),"Download HTML"]})})]})]}):o.jsxs(A,{children:[o.jsx(B,{asChild:!0,children:o.jsx(W,{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(K,{side:"bottom",children:"Download"})]}),e[21]=l,e[22]=r,e[23]=n.deckDetected,e[24]=E):E=e[24];let D;e[25]!==a?(D=a?o.jsx(ve,{size:14}):o.jsx(Se,{size:14}),e[25]=a,e[26]=D):D=e[26];let z;e[27]!==u||e[28]!==D?(z=o.jsx(B,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Copy URL",onClick:u,children:D})}),e[27]=u,e[28]=D,e[29]=z):z=e[29];const V=a?"Copied":"Copy URL";let p;e[30]!==V?(p=o.jsx(K,{side:"bottom",children:V}),e[30]=V,e[31]=p):p=e[31];let P;e[32]!==z||e[33]!==p?(P=o.jsxs(A,{children:[z,p]}),e[32]=z,e[33]=p,e[34]=P):P=e[34];let N;e[35]!==l?(N=()=>window.open(l,"_blank","noopener"),e[35]=l,e[36]=N):N=e[36];let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Ne,{size:14}),e[37]=$):$=e[37];let T;e[38]!==N?(T=o.jsx(B,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Open in new tab",onClick:N,children:$})}),e[38]=N,e[39]=T):T=e[39];let I;e[40]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(K,{side:"bottom",children:"Open in new tab"}),e[40]=I):I=e[40];let U;e[41]!==T?(U=o.jsxs(A,{children:[T,I]}),e[41]=T,e[42]=U):U=e[42];let O;return e[43]!==E||e[44]!==P||e[45]!==U||e[46]!==m||e[47]!==b||e[48]!==g||e[49]!==j||e[50]!==S||e[51]!==i?(O=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[m,b,g,j,S,E,P,U,i]}),e[43]=E,e[44]=P,e[45]=U,e[46]=m,e[47]=b,e[48]=g,e[49]=j,e[50]=S,e[51]=i,e[52]=O):O=e[52],O}function qe(s){return s.contentHash??`${s.size}-${s.updatedAt}`}function F(s,e,t,n){const r=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(s)}/fs/${encodeURIComponent(e)}/${t}${r?`?${r}`:""}`}async function q(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 Et(s,e){const t=y.c(11),{org:n}=C();let r;t[0]!==n.id||t[1]!==e||t[2]!==s?(r=M.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 q(F(n.slug,s,"list",{path:e}))).json()).entries.toSorted(Ie),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:xe,queryFn:i},t[8]=r,t[9]=i,t[10]=a):a=t[10],X(a)}function Ie(s,e){return s.kind!==e.kind?s.kind==="dir"?-1:1:s.path.localeCompare(e.path)}function Mt(s,e,t){const n=y.c(15),{org:r}=C();let i;n[0]!==r.id||n[1]!==e||n[2]!==s?(i=M.orgFsStat(r.id,s??"",e),n[0]=r.id,n[1]=e,n[2]=s,n[3]=i):i=n[3];const a=s!==null;let d;n[4]!==t?(d=t?.refetchIntervalWhenAbsent?f=>f.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,n[4]=t,n[5]=d):d=n[5];let c;n[6]!==r.slug||n[7]!==e||n[8]!==s?(c=async()=>{const f=await fetch(F(r.slug,s??"","stat",{path:e}));if(f.status===404)return null;if(!f.ok)throw new Error(`HTTP ${f.status}`);return(await f.json()).entry},n[6]=r.slug,n[7]=e,n[8]=s,n[9]=c):c=n[9];let l;return n[10]!==i||n[11]!==a||n[12]!==d||n[13]!==c?(l={queryKey:i,enabled:a,refetchInterval:d,queryFn:c},n[10]=i,n[11]=a,n[12]=d,n[13]=c,n[14]=l):l=n[14],X(l)}function Ct(s){const e=y.c(9),{org:t}=C();let n;e[0]!==t.id||e[1]!==s?(n=M.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 q(F(t.slug,s,"usage"))).json(),e[3]=t.slug,e[4]=s,e[5]=r):r=e[5];let i;return e[6]!==n||e[7]!==r?(i={queryKey:n,queryFn:r},e[6]=n,e[7]=r,e[8]=i):i=e[8],X(i)}function Nt(s){const e=y.c(8),t=60,{org:n}=C();let r;e[0]!==n.id?(r=M.orgFsRecent(n.id),e[0]=n.id,e[1]=r):r=e[1];let i;e[2]!==t||e[3]!==n.slug?(i=async()=>(await(await q(`/api/${encodeURIComponent(n.slug)}/fs/recent?limit=${t}`)).json()).entries,e[2]=t,e[3]=n.slug,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a={queryKey:r,queryFn:i},e[5]=r,e[6]=i,e[7]=a):a=e[7],X(a)}function Ft(){const s=y.c(7),{org:e}=C();let t;s[0]!==e.id?(t=M.orgFsPublicSets(e.id),s[0]=e.id,s[1]=t):t=s[1];let n;s[2]!==e.slug?(n=async()=>(await(await q(`/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],X(r)}function Dt(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t.slug||e[1]!==s?(n=r=>F(t.slug,s,"read",{path:r}),e[0]=t.slug,e[1]=s,e[2]=n):n=e[2],n}function zt(){const s=y.c(2),{org:e}=C();let t;return s[0]!==e.slug?(t=(n,r)=>F(e.slug,n,"read",{path:r}),s[0]=e.slug,s[1]=t):t=s[1],t}function Ae(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t||e[1]!==s?(n={mutationFn:async r=>(await(await q(F(t.slug,s,"file",{path:r.path}),{method:"PUT",headers:{"content-type":r.contentType??"text/html; charset=utf-8"},body:r.body})).json()).entry},e[0]=t,e[1]=s,e[2]=n):n=e[2],G(n)}function Pt(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:M.orgFsVolume(t.id,s)}),n.invalidateQueries({queryKey:M.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 j of g.files){const S=g.dir?`${g.dir}/${j.name}`:j.name;await q(F(t.slug,s,"file",{path:S}),{method:"PUT",headers:{"content-type":j.type||"application/octet-stream"},body:j})}},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 q(F(t.slug,s,"dir",{path:g}),{method:"POST"})},e[10]=t,e[11]=s,e[12]=l):l=e[12];let f;e[13]!==i||e[14]!==l?(f={mutationFn:l,onSuccess:i},e[13]=i,e[14]=l,e[15]=f):f=e[15];const u=G(f);let m;e[16]!==t||e[17]!==s?(m=async g=>{await q(F(t.slug,s,"file",{path:g}),{method:"DELETE"})},e[16]=t,e[17]=s,e[18]=m):m=e[18];let x;e[19]!==i||e[20]!==m?(x={mutationFn:m,onSuccess:i},e[19]=i,e[20]=m,e[21]=x):x=e[21];const k=G(x);let b;return e[22]!==u||e[23]!==k||e[24]!==c?(b={upload:c,mkdir:u,remove:k},e[22]=u,e[23]=k,e[24]=c,e[25]=b):b=e[25],b}const H=1;function Be(s){if(typeof s!="object"||s===null||s.v!==H||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 de(s){return[...s.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Ke(s){const t=new DOMParser().parseFromString(s,"text/html").querySelector("deck-viewer");return t?de(t).length:null}function He(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=de(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>
3
+ `)}function Le(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(B,{asChild:!0,children:o.jsx(W,{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(Ce,{size:14})})}),o.jsx(K,{side:"bottom",children:n.railOpen?"Hide slide list":"Show slide list"})]}),e[4]=n,e[5]=m):m=e[5];let x;e[6]!==l?(x=()=>window.open(l,"_blank","noopener"),e[6]=l,e[7]=x):x=e[7];let k;e[8]!==l?(k=o.jsx("span",{className:"truncate",children:l}),e[8]=l,e[9]=k):k=e[9];let b;e[10]!==l||e[11]!==x||e[12]!==k?(b=o.jsx("button",{type:"button",onClick:x,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:k}),e[10]=l,e[11]=x,e[12]=k,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(B,{asChild:!0,children:o.jsxs(W,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:n.reload,children:[o.jsx(we,{size:12}),"Agent updated — reload"]})}),o.jsx(K,{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 j;e[17]!==n.saving?(j=n.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"Saving…"}),e[17]=n.saving,e[18]=j):j=e[18];let S;e[19]!==n?(S=n.deckDetected&&n.writable&&o.jsxs(A,{children:[o.jsx(B,{asChild:!0,children:o.jsx(W,{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($e,{size:14})})}),o.jsx(K,{side:"bottom",children:n.editMode?"Done editing":"Edit inline (text, reorder, delete)"})]}),e[19]=n,e[20]=S):S=e[20];let E;e[21]!==l||e[22]!==r||e[23]!==n.deckDetected?(E=n.deckDetected?o.jsxs(je,{children:[o.jsx(ke,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Download",children:o.jsx(Z,{size:14})})}),o.jsxs(be,{align:"end",children:[o.jsxs(ie,{onClick:()=>window.open(`${l}#print`,"_blank","noopener"),children:[o.jsx(Te,{size:14}),"Export as PDF"]}),o.jsx(ie,{asChild:!0,children:o.jsxs("a",{href:l,download:r,children:[o.jsx(Ee,{size:14}),"Download HTML"]})})]})]}):o.jsxs(A,{children:[o.jsx(B,{asChild:!0,children:o.jsx(W,{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(K,{side:"bottom",children:"Download"})]}),e[21]=l,e[22]=r,e[23]=n.deckDetected,e[24]=E):E=e[24];let F;e[25]!==a?(F=a?o.jsx(ve,{size:14}):o.jsx(Se,{size:14}),e[25]=a,e[26]=F):F=e[26];let P;e[27]!==u||e[28]!==F?(P=o.jsx(B,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Copy URL",onClick:u,children:F})}),e[27]=u,e[28]=F,e[29]=P):P=e[29];const V=a?"Copied":"Copy URL";let p;e[30]!==V?(p=o.jsx(K,{side:"bottom",children:V}),e[30]=V,e[31]=p):p=e[31];let U;e[32]!==P||e[33]!==p?(U=o.jsxs(A,{children:[P,p]}),e[32]=P,e[33]=p,e[34]=U):U=e[34];let N;e[35]!==l?(N=()=>window.open(l,"_blank","noopener"),e[35]=l,e[36]=N):N=e[36];let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Ne,{size:14}),e[37]=$):$=e[37];let T;e[38]!==N?(T=o.jsx(B,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Open in new tab",onClick:N,children:$})}),e[38]=N,e[39]=T):T=e[39];let I;e[40]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(K,{side:"bottom",children:"Open in new tab"}),e[40]=I):I=e[40];let z;e[41]!==T?(z=o.jsxs(A,{children:[T,I]}),e[41]=T,e[42]=z):z=e[42];let O;return e[43]!==E||e[44]!==U||e[45]!==z||e[46]!==m||e[47]!==b||e[48]!==g||e[49]!==j||e[50]!==S||e[51]!==i?(O=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[m,b,g,j,S,E,U,z,i]}),e[43]=E,e[44]=U,e[45]=z,e[46]=m,e[47]=b,e[48]=g,e[49]=j,e[50]=S,e[51]=i,e[52]=O):O=e[52],O}function qe(s){return s.contentHash??`${s.size}-${s.updatedAt}`}function D(s,e,t,n){const r=new URLSearchParams(n).toString();return`/api/${encodeURIComponent(s)}/fs/${encodeURIComponent(e)}/${t}${r?`?${r}`:""}`}async function q(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 Et(s,e){const t=y.c(11),{org:n}=C();let r;t[0]!==n.id||t[1]!==e||t[2]!==s?(r=M.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 q(D(n.slug,s,"list",{path:e}))).json()).entries.toSorted(Ie),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:xe,queryFn:i},t[8]=r,t[9]=i,t[10]=a):a=t[10],X(a)}function Ie(s,e){return s.kind!==e.kind?s.kind==="dir"?-1:1:s.path.localeCompare(e.path)}function Mt(s,e,t){const n=y.c(15),{org:r}=C();let i;n[0]!==r.id||n[1]!==e||n[2]!==s?(i=M.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(D(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],X(l)}function Ct(s){const e=y.c(9),{org:t}=C();let n;e[0]!==t.id||e[1]!==s?(n=M.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 q(D(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],X(i)}function Nt(s){const e=y.c(8),t=60,{org:n}=C();let r;e[0]!==n.id?(r=M.orgFsRecent(n.id),e[0]=n.id,e[1]=r):r=e[1];let i;e[2]!==t||e[3]!==n.slug?(i=async()=>(await(await q(`/api/${encodeURIComponent(n.slug)}/fs/recent?limit=${t}`)).json()).entries,e[2]=t,e[3]=n.slug,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a={queryKey:r,queryFn:i},e[5]=r,e[6]=i,e[7]=a):a=e[7],X(a)}function Dt(){const s=y.c(7),{org:e}=C();let t;s[0]!==e.id?(t=M.orgFsPublicSets(e.id),s[0]=e.id,s[1]=t):t=s[1];let n;s[2]!==e.slug?(n=async()=>(await(await q(`/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],X(r)}function Ft(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t.slug||e[1]!==s?(n=r=>D(t.slug,s,"read",{path:r}),e[0]=t.slug,e[1]=s,e[2]=n):n=e[2],n}function Pt(){const s=y.c(2),{org:e}=C();let t;return s[0]!==e.slug?(t=(n,r)=>D(e.slug,n,"read",{path:r}),s[0]=e.slug,s[1]=t):t=s[1],t}function Ae(s){const e=y.c(3),{org:t}=C();let n;return e[0]!==t||e[1]!==s?(n={mutationFn:async r=>(await(await q(D(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 Ut(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:M.orgFsVolume(t.id,s)}),n.invalidateQueries({queryKey:M.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 j of g.files){const S=g.dir?`${g.dir}/${j.name}`:j.name;await q(D(t.slug,s,"file",{path:S}),{method:"PUT",headers:{"content-type":j.type||"application/octet-stream"},body:j})}},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 q(D(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 q(D(t.slug,s,"file",{path:g}),{method:"DELETE"})},e[16]=t,e[17]=s,e[18]=m):m=e[18];let x;e[19]!==i||e[20]!==m?(x={mutationFn:m,onSuccess:i},e[19]=i,e[20]=m,e[21]=x):x=e[21];const k=G(x);let b;return e[22]!==u||e[23]!==k||e[24]!==c?(b={upload:c,mkdir:u,remove:k},e[22]=u,e[23]=k,e[24]=c,e[25]=b):b=e[25],b}const H=1;function Be(s){if(typeof s!="object"||s===null||s.v!==H||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 de(s){return[...s.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Ke(s){const t=new DOMParser().parseFromString(s,"text/html").querySelector("deck-viewer");return t?de(t).length:null}function He(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=de(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}
5
- `}const oe="home",Xe=400,Ve=800;function Qe(s){const e=s.savePath!==void 0,{org:t}=C(),n=ce(),r=Ae(oe),[i,a]=v.useState(!1),[d,c]=v.useState(!1),[l,f]=v.useState(!1),[u,m]=v.useState(!1),[x,k]=v.useState(!1),[b,g]=v.useState(!1),[j,S]=v.useState(null),[E,D]=v.useState(null),[z,V]=v.useState(0),[p]=v.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),P=i||b||x,N=()=>{s.savePath!==void 0&&(n.invalidateQueries({queryKey:M.orgFsStat(t.id,oe,s.savePath)}),n.invalidateQueries({queryKey:M.orgFsRecent(t.id)}))},$=h=>{p.iframe?.contentWindow?.postMessage(h,"*")},T=()=>{p.source=null,m(!1),E&&S(E),V(h=>h+1),N()};s.statMarker!==E&&(D(s.statMarker),s.statMarker!==null&&(j===null?S(s.statMarker):p.selfMarkers.has(s.statMarker)||s.statMarker!==j&&(P?m(!0):(p.source=null,S(s.statMarker)))));const I=async()=>{p.saveTimer=null;const h=p.source;if(h===null){g(!1);return}k(!0);try{const w=await r.mutateAsync({path:s.savePath,body:h});p.selfMarkers.add(qe(w)),N()}catch(w){console.error("[deck-editor] save failed",w),re.error("Couldn't save deck edits — reloading the preview."),_.current.reload()}finally{k(!1),g(!1)}},U=h=>{g(!0),p.saveTimer&&clearTimeout(p.saveTimer),p.saveTimer=setTimeout(()=>{_.current.flushSave()},h)},O=(h,w,R)=>{$({v:H,type:"ack",opId:h,ok:w,error:R})},se=async h=>{if(!e){O(h.opId,!1,"read-only preview");return}try{if(p.source===null){const R=await fetch(s.readUrl,{credentials:"include"});if(!R.ok)throw new Error(`HTTP ${R.status}`);p.source=await R.text()}const w=Ke(p.source);if(w===null||w!==h.witness.childCount)throw new L(`slide count drifted (source ${w}, iframe ${h.witness.childCount})`,"stale-index");p.source=He(p.source,h.op),O(h.opId,!0),U(h.op.kind==="replace"?Ve:Xe)}catch(w){console.error("[deck-editor] op failed",h.op,w),O(h.opId,!1,w instanceof Error?w.message:String(w)),re.error("That edit couldn't be saved — reloading the preview."),_.current.reload()}},ne=h=>{if(!p.iframe||h.source!==p.iframe.contentWindow)return;const w=Be(h.data);if(w){if(w.type==="ready"){c(!0),_.current.editMode?$({v:H,type:"set-edit-mode",enabled:!0}):_.current.railOpen&&$({v:H,type:"set-rail",open:!0});return}w.type==="op"&&(p.queue=p.queue.then(()=>_.current.handleOp(w)).catch(()=>{}))}},_=v.useRef({onMessage:ne,handleOp:se,flushSave:I,reload:T,editMode:i,railOpen:l});_.current={onMessage:ne,handleOp:se,flushSave:I,reload:T,editMode:i,railOpen:l};const[ue]=v.useState(()=>{let h=null;return w=>{if(w){p.iframe=w;const R=pe=>_.current.onMessage(pe);window.addEventListener("message",R),h=()=>window.removeEventListener("message",R)}else h?.(),h=null,p.iframe=null}}),me=h=>{f(h),$({v:H,type:"set-rail",open:h})},he=h=>{a(h),$({v:H,type:"set-edit-mode",enabled:h}),h&&f(!0),!h&&u&&!b&&!x&&T()};return{iframeRef:ue,deckDetected:d,writable:e,displayedMarker:j===null?null:`${j}.${z}`,editMode:i,setEditMode:he,railOpen:l,setRailOpen:me,saving:x,agentUpdated:u,reload:T,postToIframe:$}}const Ge=300;function Ut({readUrl:s,marker:e,title:t,savePath:n,trailing:r}){const i=Qe({readUrl:s,statMarker:e,savePath:n}),[a,d]=v.useState(null);if(i.displayedMarker===null)return null;const c=s.includes("?")?"&":"?",l=`${s}${c}v=${encodeURIComponent(i.displayedMarker)}`,f=a===l;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(Le,{readUrl:s,editor:i,downloadName:t.split("/").pop()??t,trailing:r}),o.jsx("div",{className:"relative flex-1",children:o.jsx("iframe",{ref:i.iframeRef,src:l,onLoad:()=>d(l),sandbox:"allow-scripts",className:ee("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",f?"opacity-100":"opacity-0"),style:{transitionDuration:`${Ge}ms`},title:t},l)})]})}Fe.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function Ye(s){const e=y.c(11),{value:t,filename:n}=s,[r]=ge(),i=r.theme==="dark"||r.theme==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;let a;e[0]!==n?(a=Re(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(ye,{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(De,{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 Ze(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}const Je=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),et=new Set(["txt","json","csv","tsv","log","yaml","yml","xml","toml","ts","tsx","js","jsx","py","rb","go","rs","java","sh","sql"]),le=2*1024*1024;function tt(s,e){const t=s.split(".").pop()?.toLowerCase()??"";return Je.has(t)?"image":t==="pdf"?"pdf":t==="html"||t==="htm"?"html":t==="md"||t==="markdown"?e<=le?"markdown":"download":et.has(t)&&e<=le?"text":"download"}function st(){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 fe(s){const e=y.c(20),{file:t,note:n}=s;let r;e[0]!==t.filename?(r=o.jsx(ze,{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=Ze(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(W,{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 ae(s){const e=y.c(16),{file:t,markdown:n}=s;let r;e[0]!==t.downloadUrl?(r=M.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}=X(a);if(c){let u;return e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(st,{}),e[7]=u):u=e[7],u}if(l||d===void 0){let u;return e[8]!==t?(u=o.jsx(fe,{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(Pe,{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(Ye,{value:d,filename:t.filename}),e[13]=d,e[14]=t.filename,e[15]=f):f=e[15],f}function Ot(s){const e=y.c(15),{file:t}=s;switch(tt(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(ae,{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(ae,{file:t,markdown:!1}),e[11]=t,e[12]=r):r=e[12],r}default:{let r;return e[13]!==t?(r=o.jsx(fe,{file:t}),e[13]=t,e[14]=r):r=e[14],r}}}function _t(s){const e=y.c(13),{title:t,icon:n,active:r,onClick:i}=s,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let d;e[0]!==a?(d=ee("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=d):d=e[1];let c;e[2]!==n?(c=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(nt,{icon:n})}),e[2]=n,e[3]=c):c=e[3];let l;e[4]!==t?(l=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:t}),e[4]=t,e[5]=l):l=e[5];let f;return e[6]!==r||e[7]!==i||e[8]!==d||e[9]!==c||e[10]!==l||e[11]!==t?(f=o.jsxs("button",{type:"button",onClick:i,"aria-pressed":r,"aria-label":t,className:d,children:[c,l]}),e[6]=r,e[7]=i,e[8]=d,e[9]=c,e[10]=l,e[11]=t,e[12]=f):f=e[12],f}function nt(s){const e=y.c(5),{icon:t}=s;if(t.kind==="component"){const{Component:r}=t;let i;return e[0]!==r?(i=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=i):i=e[1],i}if(t.kind==="url"){let r;return e[2]!==t.src?(r=o.jsx("img",{src:t.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=t.src,e[3]=r):r=e[3],r}let n;return e[4]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Me,{className:"size-4"}),e[4]=n):n=e[4],n}export{vt as A,jt as B,Ue as E,st as F,Ut as H,Ot as a,Dt as b,_t as c,zt as d,qe as e,Ze as f,Re as g,Et as h,Pt as i,Nt as j,Ft as k,Ct as l,wt as m,St as n,$t as o,We as p,gt as q,Y as r,kt as s,te as t,Mt as u,Tt as v,yt as w,Oe as x,xt as y,bt as z};
5
+ `}const oe="home",Xe=400,Ve=800;function Qe(s){const e=s.savePath!==void 0,{org:t}=C(),n=ce(),r=Ae(oe),[i,a]=v.useState(!1),[d,c]=v.useState(!1),[l,f]=v.useState(!1),[u,m]=v.useState(!1),[x,k]=v.useState(!1),[b,g]=v.useState(!1),[j,S]=v.useState(null),[E,F]=v.useState(null),[P,V]=v.useState(0),[p]=v.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),U=i||b||x,N=()=>{s.savePath!==void 0&&(n.invalidateQueries({queryKey:M.orgFsStat(t.id,oe,s.savePath)}),n.invalidateQueries({queryKey:M.orgFsRecent(t.id)}))},$=h=>{p.iframe?.contentWindow?.postMessage(h,"*")},T=()=>{p.source=null,m(!1),E&&S(E),V(h=>h+1),N()};s.statMarker!==E&&(F(s.statMarker),s.statMarker!==null&&(j===null?S(s.statMarker):p.selfMarkers.has(s.statMarker)||s.statMarker!==j&&(U?m(!0):(p.source=null,S(s.statMarker)))));const I=async()=>{p.saveTimer=null;const h=p.source;if(h===null){g(!1);return}k(!0);try{const w=await r.mutateAsync({path:s.savePath,body:h});p.selfMarkers.add(qe(w)),N()}catch(w){console.error("[deck-editor] save failed",w),re.error("Couldn't save deck edits — reloading the preview."),_.current.reload()}finally{k(!1),g(!1)}},z=h=>{g(!0),p.saveTimer&&clearTimeout(p.saveTimer),p.saveTimer=setTimeout(()=>{_.current.flushSave()},h)},O=(h,w,R)=>{$({v:H,type:"ack",opId:h,ok:w,error:R})},se=async h=>{if(!e){O(h.opId,!1,"read-only preview");return}try{if(p.source===null){const R=await fetch(s.readUrl,{credentials:"include"});if(!R.ok)throw new Error(`HTTP ${R.status}`);p.source=await R.text()}const w=Ke(p.source);if(w===null||w!==h.witness.childCount)throw new L(`slide count drifted (source ${w}, iframe ${h.witness.childCount})`,"stale-index");p.source=He(p.source,h.op),O(h.opId,!0),z(h.op.kind==="replace"?Ve:Xe)}catch(w){console.error("[deck-editor] op failed",h.op,w),O(h.opId,!1,w instanceof Error?w.message:String(w)),re.error("That edit couldn't be saved — reloading the preview."),_.current.reload()}},ne=h=>{if(!p.iframe||h.source!==p.iframe.contentWindow)return;const w=Be(h.data);if(w){if(w.type==="ready"){c(!0),_.current.editMode?$({v:H,type:"set-edit-mode",enabled:!0}):_.current.railOpen&&$({v:H,type:"set-rail",open:!0});return}w.type==="op"&&(p.queue=p.queue.then(()=>_.current.handleOp(w)).catch(()=>{}))}},_=v.useRef({onMessage:ne,handleOp:se,flushSave:I,reload:T,editMode:i,railOpen:l});_.current={onMessage:ne,handleOp:se,flushSave:I,reload:T,editMode:i,railOpen:l};const[ue]=v.useState(()=>{let h=null;return w=>{if(w){p.iframe=w;const R=pe=>_.current.onMessage(pe);window.addEventListener("message",R),h=()=>window.removeEventListener("message",R)}else h?.(),h=null,p.iframe=null}}),me=h=>{f(h),$({v:H,type:"set-rail",open:h})},he=h=>{a(h),$({v:H,type:"set-edit-mode",enabled:h}),h&&f(!0),!h&&u&&!b&&!x&&T()};return{iframeRef:ue,deckDetected:d,writable:e,displayedMarker:j===null?null:`${j}.${P}`,editMode:i,setEditMode:he,railOpen:l,setRailOpen:me,saving:x,agentUpdated:u,reload:T,postToIframe:$}}const Ge=300;function zt({readUrl:s,marker:e,title:t,savePath:n,trailing:r}){const i=Qe({readUrl:s,statMarker:e,savePath:n}),[a,d]=v.useState(null);if(i.displayedMarker===null)return null;const c=s.includes("?")?"&":"?",l=`${s}${c}v=${encodeURIComponent(i.displayedMarker)}`,f=a===l;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(Le,{readUrl:s,editor:i,downloadName:t.split("/").pop()??t,trailing:r}),o.jsx("div",{className:"relative flex-1",children:o.jsx("iframe",{ref:i.iframeRef,src:l,onLoad:()=>d(l),sandbox:"allow-scripts",className:ee("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",f?"opacity-100":"opacity-0"),style:{transitionDuration:`${Ge}ms`},title:t},l)})]})}De.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function Ye(s){const e=y.c(11),{value:t,filename:n}=s,[r]=ge(),i=r.theme==="dark"||r.theme==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;let a;e[0]!==n?(a=Re(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(ye,{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(Fe,{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 Ze(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}const Je=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),et=new Set(["txt","json","csv","tsv","log","yaml","yml","xml","toml","ts","tsx","js","jsx","py","rb","go","rs","java","sh","sql"]),le=2*1024*1024;function tt(s,e){const t=s.split(".").pop()?.toLowerCase()??"";return Je.has(t)?"image":t==="pdf"?"pdf":t==="html"||t==="htm"?"html":t==="md"||t==="markdown"?e<=le?"markdown":"download":et.has(t)&&e<=le?"text":"download"}function st(){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 fe(s){const e=y.c(20),{file:t,note:n}=s;let r;e[0]!==t.filename?(r=o.jsx(Pe,{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=Ze(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(W,{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 ae(s){const e=y.c(16),{file:t,markdown:n}=s;let r;e[0]!==t.downloadUrl?(r=M.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}=X(a);if(c){let u;return e[7]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(st,{}),e[7]=u):u=e[7],u}if(l||d===void 0){let u;return e[8]!==t?(u=o.jsx(fe,{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(Ue,{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(Ye,{value:d,filename:t.filename}),e[13]=d,e[14]=t.filename,e[15]=f):f=e[15],f}function Ot(s){const e=y.c(15),{file:t}=s;switch(tt(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(ae,{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(ae,{file:t,markdown:!1}),e[11]=t,e[12]=r):r=e[12],r}default:{let r;return e[13]!==t?(r=o.jsx(fe,{file:t}),e[13]=t,e[14]=r):r=e[14],r}}}function _t(s){const e=y.c(13),{title:t,icon:n,active:r,onClick:i}=s,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let d;e[0]!==a?(d=ee("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=d):d=e[1];let c;e[2]!==n?(c=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(nt,{icon:n})}),e[2]=n,e[3]=c):c=e[3];let l;e[4]!==t?(l=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:t}),e[4]=t,e[5]=l):l=e[5];let f;return e[6]!==r||e[7]!==i||e[8]!==d||e[9]!==c||e[10]!==l||e[11]!==t?(f=o.jsxs("button",{type:"button",onClick:i,"aria-pressed":r,"aria-label":t,className:d,children:[c,l]}),e[6]=r,e[7]=i,e[8]=d,e[9]=c,e[10]=l,e[11]=t,e[12]=f):f=e[12],f}function nt(s){const e=y.c(5),{icon:t}=s;if(t.kind==="component"){const{Component:r}=t;let i;return e[0]!==r?(i=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=i):i=e[1],i}if(t.kind==="url"){let r;return e[2]!==t.src?(r=o.jsx("img",{src:t.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=t.src,e[3]=r):r=e[3],r}let n;return e[4]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Me,{className:"size-4"}),e[4]=n):n=e[4],n}export{vt as A,jt as B,ze as E,st as F,zt as H,Ot as a,Ft as b,_t as c,Pt as d,qe as e,Ze as f,Re as g,Et as h,Ut as i,Nt as j,Dt as k,Ct as l,wt as m,St as n,$t as o,We as p,gt as q,Y as r,kt as s,te as t,Mt as u,Tt as v,yt as w,Oe as x,xt as y,bt as z};
@@ -1 +1 @@
1
- import{r as c,j as d,db as k,a6 as F,a7 as f,dd as T,af as $,bf as O,bq as I,de as U,df as W,dh as z,dc as B,bc as G,da as K,e as E,c as q}from"./index-8Av7_XG5.js";var w,b="HoverCard",[N]=$(b,[T]),R=T(),[V,S]=N(b),_=o=>{const{__scopeHoverCard:e,children:t,open:r,defaultOpen:a,onOpenChange:s,openDelay:l=700,closeDelay:u=300}=o,i=R(e),p=c.useRef(0),v=c.useRef(0),C=c.useRef(!1),h=c.useRef(!1),[m,n]=G({prop:r,defaultProp:a??!1,onChange:s,caller:b}),x=c.useCallback(()=>{clearTimeout(v.current),p.current=window.setTimeout(()=>n(!0),l)},[l,n]),L=c.useCallback(()=>{clearTimeout(p.current),!C.current&&!h.current&&(v.current=window.setTimeout(()=>n(!1),u))},[u,n]),M=c.useCallback(()=>n(!1),[n]);return c.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(v.current)},[]),d.jsx(V,{scope:e,open:m,onOpenChange:n,onOpen:x,onClose:L,onDismiss:M,hasSelectionRef:C,isPointerDownOnContentRef:h,children:d.jsx(K,{...i,children:t})})};_.displayName=b;var y="HoverCardTrigger",D=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=S(y,t),s=R(t);return d.jsx(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=y;var H="HoverCardPortal",[J,Q]=N(H,{forceMount:void 0}),j=o=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:a}=o,s=S(H,e);return d.jsx(J,{scope:e,forceMount:t,children:d.jsx(O,{present:t||s.open,children:d.jsx(B,{asChild:!0,container:a,children:r})})})};j.displayName=H;var g="HoverCardContent",A=c.forwardRef((o,e)=>{const t=Q(g,o.__scopeHoverCard),{forceMount:r=t.forceMount,...a}=o,s=S(g,o.__scopeHoverCard);return d.jsx(O,{present:r||s.open,children:d.jsx(X,{"data-state":s.open?"open":"closed",...a,onPointerEnter:f(o.onPointerEnter,P(s.onOpen)),onPointerLeave:f(o.onPointerLeave,P(s.onClose)),ref:e})})});A.displayName=g;var X=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,...u}=o,i=S(g,t),p=R(t),v=c.useRef(null),C=I(e,v),[h,m]=c.useState(!1);return c.useEffect(()=>{if(h){const n=document.body;return w=n.style.userSelect||n.style.webkitUserSelect,n.style.userSelect="none",n.style.webkitUserSelect="none",()=>{n.style.userSelect=w,n.style.webkitUserSelect=w}}},[h]),c.useEffect(()=>{if(v.current){const n=()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(i.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointerup",n),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),c.useEffect(()=>{v.current&&ee(v.current).forEach(x=>x.setAttribute("tabindex","-1"))}),d.jsx(U,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:f(s,n=>{n.preventDefault()}),onDismiss:i.onDismiss,children:d.jsx(W,{...p,...u,onPointerDown:f(u.onPointerDown,n=>{n.currentTarget.contains(n.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:C,style:{...u.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=R(t);return d.jsx(z,{...a,...r,ref:e})});Z.displayName=Y;function P(o){return e=>e.pointerType==="touch"?void 0:o()}function ee(o){const e=[],t=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();)e.push(t.currentNode);return e}var te=_,oe=D,re=j,ne=A;function se(o){const e=E.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=d.jsx(te,{"data-slot":"hover-card",...t}),e[2]=t,e[3]=r):r=e[3],r}function ie(o){const e=E.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=d.jsx(oe,{"data-slot":"hover-card-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function ce(o){const e=E.c(12);let t,r,a,s;e[0]!==o?({className:t,align:a,sideOffset:s,...r}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=a,e[4]=s):(t=e[1],r=e[2],a=e[3],s=e[4]);const l=a===void 0?"center":a,u=s===void 0?4:s;let i;e[5]!==t?(i=q("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),e[5]=t,e[6]=i):i=e[6];let p;return e[7]!==l||e[8]!==r||e[9]!==u||e[10]!==i?(p=d.jsx(re,{"data-slot":"hover-card-portal",children:d.jsx(ne,{"data-slot":"hover-card-content",align:l,sideOffset:u,className:i,...r})}),e[7]=l,e[8]=r,e[9]=u,e[10]=i,e[11]=p):p=e[11],p}export{ie as H,ce as a,se as b};
1
+ import{r as c,j as d,dk as M,a7 as F,a8 as f,dm as T,ag as $,bk as O,bx as I,dn as U,dp as W,dr as z,dl as B,bh as G,dj as K,e as E,c as V}from"./index-kq5yUS_7.js";var w,b="HoverCard",[N]=$(b,[T]),R=T(),[q,S]=N(b),_=o=>{const{__scopeHoverCard:e,children:t,open:r,defaultOpen:a,onOpenChange:s,openDelay:l=700,closeDelay:u=300}=o,i=R(e),p=c.useRef(0),v=c.useRef(0),C=c.useRef(!1),h=c.useRef(!1),[m,n]=G({prop:r,defaultProp:a??!1,onChange:s,caller:b}),x=c.useCallback(()=>{clearTimeout(v.current),p.current=window.setTimeout(()=>n(!0),l)},[l,n]),k=c.useCallback(()=>{clearTimeout(p.current),!C.current&&!h.current&&(v.current=window.setTimeout(()=>n(!1),u))},[u,n]),L=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:k,onDismiss:L,hasSelectionRef:C,isPointerDownOnContentRef:h,children:d.jsx(K,{...i,children:t})})};_.displayName=b;var y="HoverCardTrigger",j=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=S(y,t),s=R(t);return d.jsx(M,{asChild:!0,...s,children:d.jsx(F.a,{"data-state":a.open?"open":"closed",...r,ref:e,onPointerEnter:f(o.onPointerEnter,P(a.onOpen)),onPointerLeave:f(o.onPointerLeave,P(a.onClose)),onFocus:f(o.onFocus,a.onOpen),onBlur:f(o.onBlur,a.onClose),onTouchStart:f(o.onTouchStart,l=>l.preventDefault())})})});j.displayName=y;var H="HoverCardPortal",[J,Q]=N(H,{forceMount:void 0}),D=o=>{const{__scopeHoverCard:e,forceMount:t,children:r,container:a}=o,s=S(H,e);return d.jsx(J,{scope:e,forceMount:t,children:d.jsx(O,{present:t||s.open,children:d.jsx(B,{asChild:!0,container:a,children:r})})})};D.displayName=H;var g="HoverCardContent",A=c.forwardRef((o,e)=>{const t=Q(g,o.__scopeHoverCard),{forceMount:r=t.forceMount,...a}=o,s=S(g,o.__scopeHoverCard);return d.jsx(O,{present:r||s.open,children:d.jsx(X,{"data-state":s.open?"open":"closed",...a,onPointerEnter:f(o.onPointerEnter,P(s.onOpen)),onPointerLeave:f(o.onPointerLeave,P(s.onClose)),ref:e})})});A.displayName=g;var X=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,...u}=o,i=S(g,t),p=R(t),v=c.useRef(null),C=I(e,v),[h,m]=c.useState(!1);return c.useEffect(()=>{if(h){const n=document.body;return w=n.style.userSelect||n.style.webkitUserSelect,n.style.userSelect="none",n.style.webkitUserSelect="none",()=>{n.style.userSelect=w,n.style.webkitUserSelect=w}}},[h]),c.useEffect(()=>{if(v.current){const n=()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(i.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",n),()=>{document.removeEventListener("pointerup",n),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),c.useEffect(()=>{v.current&&ee(v.current).forEach(x=>x.setAttribute("tabindex","-1"))}),d.jsx(U,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:f(s,n=>{n.preventDefault()}),onDismiss:i.onDismiss,children:d.jsx(W,{...p,...u,onPointerDown:f(u.onPointerDown,n=>{n.currentTarget.contains(n.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:C,style:{...u.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=c.forwardRef((o,e)=>{const{__scopeHoverCard:t,...r}=o,a=R(t);return d.jsx(z,{...a,...r,ref:e})});Z.displayName=Y;function P(o){return e=>e.pointerType==="touch"?void 0:o()}function ee(o){const e=[],t=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;t.nextNode();)e.push(t.currentNode);return e}var te=_,oe=j,re=D,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,q as be,a as Ne,K as ke,j as t,E as we,r as $,c as de,B as Y,l as Ce,M as Ie,o as Q}from"./index-8Av7_XG5.js";import{a as W}from"./Tool01-Co9IzxOX.js";import{s as Se}from"./Trash01-m4F91Gbm.js";import{i as fe}from"./Upload01-BWuva6Fs.js";import{I as _e}from"./input-CFgdCIf-.js";import{L as Pe}from"./label-D5ze4fbW.js";import{i as Ue}from"./AlertCircle-Ctbek2zl.js";import{i as ge}from"./Check-D-2DMeXR.js";import{a as $e}from"./Eye-DLKlw-42.js";import{i as De}from"./DotsVertical-CYMPhMIv.js";import{G as ze}from"./agent-icon-VIqap9Jf.js";import{n as Fe}from"./LinkExternal01-C7Ulot5I.js";import{D as Te,c as Ee,e as Le,b as Oe,a as Ae}from"./dialog-BDoa-Aig.js";import{c as ce,a as Me,D as Re,b as Ge}from"./dropdown-menu-BuEg85yr.js";import{S as Be}from"./skeleton-KPs8aExG.js";import{T as Ve,a as Ke,b as qe,c as Je}from"./tabs-Bsb3WneA.js";import{u as Qe,c as Ye}from"./use-file-configs-DWgNRokn.js";import{u as We}from"./useInfiniteQuery-CQ_UxVw9.js";import{S as He,u as Xe}from"./constants-DeFtLUND.js";import{u as Ze}from"./unwrap-tool-result-BYXdCQMg.js";function et(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 tt(s){const e=w.c(13),{org:n}=be();let l;e[0]!==n.id||e[1]!==n.slug?(l={connectionId:He,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=l):l=e[2];const i=Xe(l);let o;e[3]!==n.id||e[4]!==s.configId?(o=ke.filePickerObjects(n.id,s.configId),e[3]=n.id,e[4]=s.configId,e[5]=o):o=e[5];const a=s.enabled!==!1&&!!s.configId;let r;e[6]!==i||e[7]!==s.configId?(r=async c=>{const{pageParam:g}=c,f=await i.callTool({name:"FILE_OBJECTS_LIST",arguments:{configId:s.configId,cursor:g??void 0}});return Ze(f)},e[6]=i,e[7]=s.configId,e[8]=r):r=e[8];let d;return e[9]!==o||e[10]!==a||e[11]!==r?(d={queryKey:o,enabled:a,staleTime:3e4,initialPageParam:null,queryFn:r,getNextPageParam:st},e[9]=o,e[10]=a,e[11]=r,e[12]=d):d=e[12],We(d)}function st(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(nt);let r=`${o.status} ${o.statusText}`;try{const d=JSON.parse(a);d.message&&(r=d.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 nt(){return""}const ue="file-picker:last-config-id";function it(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(Be,{className:"h-64 w-full"}),e[5]=a):a=e[5];let r;e[6]!==s?(r=f=>{s.onSelect(f),s.onOpenChange(!1)},e[6]=s,e[7]=r):r=e[7];let d;e[8]!==s.mode||e[9]!==r?(d=t.jsx(we,{fallback:lt,children:t.jsx($.Suspense,{fallback:a,children:t.jsx(ot,{mode:s.mode,onSelect:r})})}),e[8]=s.mode,e[9]=r,e[10]=d):d=e[10];let c;e[11]!==o||e[12]!==d?(c=t.jsxs(Ae,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[o,d]}),e[11]=o,e[12]=d,e[13]=c):c=e[13];let g;return e[14]!==s.onOpenChange||e[15]!==s.open||e[16]!==c?(g=t.jsx(Te,{open:s.open,onOpenChange:s.onOpenChange,children:c}),e[14]=s.onOpenChange,e[15]=s.open,e[16]=c,e[17]=g):g=e[17],g}function lt(s){const{error:e}=s;return t.jsx(rt,{error:e??new Error("Failed to load buckets")})}function rt(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 ot(s){const e=w.c(23),{mode:n,onSelect:l}=s,i=Qe();if(i.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(dt,{}),e[0]=u):u=e[0],u}if(i.length===1){const u=i[0];let p;return e[1]!==u||e[2]!==n||e[3]!==l?(p=t.jsx(pe,{config:u,mode:n,onSelect:l}),e[1]=u,e[2]=n,e[3]=l,e[4]=p):p=e[4],p}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(u=>u.id===a)?.id??i[0].id,e[6]=i,e[7]=r):r=e[7];const d=r;let c;e[8]!==i?(c=i.map(at),e[8]=i,e[9]=c):c=e[9];let g;e[10]!==c?(g=t.jsx(Ke,{className:"self-start",children:c}),e[10]=c,e[11]=g):g=e[11];let f;if(e[12]!==i||e[13]!==n||e[14]!==l){let u;e[16]!==n||e[17]!==l?(u=p=>t.jsx(qe,{value:p.id,className:"min-h-0 flex-1 overflow-hidden",children:t.jsx(pe,{config:p,mode:n,onSelect:l})},p.id),e[16]=n,e[17]=l,e[18]=u):u=e[18],f=i.map(u),e[12]=i,e[13]=n,e[14]=l,e[15]=f}else f=e[15];let x;return e[19]!==d||e[20]!==g||e[21]!==f?(x=t.jsxs(Je,{defaultValue:d,onValueChange:ct,className:"min-h-0 flex-1 flex flex-col",children:[g,f]}),e[19]=d,e[20]=g,e[21]=f,e[22]=x):x=e[22],x}function at(s){return t.jsx(Ve,{value:s.id,children:s.name},s.id)}function ct(s){typeof window<"u"&&window.localStorage.setItem(ue,s)}function dt(){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=tt({configId:s.id}),i=je(),[o,a]=$.useState(!1),r=$.useRef(null),d=e==="image"?"image/*":void 0;async function c(m){if(!m)return;const y=Array.from(m);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 g(m){m.preventDefault(),a(!0)}function f(){a(!1)}function x(m){m.preventDefault(),a(!1),c(m.dataTransfer.files)}const p=(l.data?.pages??[]).flatMap(m=>m.items),j=p.filter(m=>e==="image"?ye(m.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:g,onDragLeave:f,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:d,multiple:!0,className:"hidden",onChange:m=>{const y=m.target.files;m.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"&&p.length>0?t.jsx(ut,{}):t.jsx(ft,{}):e==="image"?t.jsx(gt,{items:j,onSelect:n}):t.jsx(pt,{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 ft(){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(W,{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 ut(){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(W,{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 mt(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"file":s.slice(e+1).toLowerCase()}function gt(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 pt(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=mt(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:xt}),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 d;e[29]!==n.key?(d=t.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:ye(n.key)?t.jsx(W,{size:16,className:"text-muted-foreground"}):t.jsx(ze,{size:16,className:"text-muted-foreground"})}),e[29]=n.key,e[30]=d):d=e[30];let c;e[31]!==n.key?(c=he(n.key),e[31]=n.key,e[32]=c):c=e[32];let g;e[33]!==c?(g=t.jsx("p",{className:"truncate text-sm font-medium",children:c}),e[33]=c,e[34]=g):g=e[34];let f;e[35]!==n.key?(f=t.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:n.key}),e[35]=n.key,e[36]=f):f=e[36];let x;e[37]!==g||e[38]!==f?(x=t.jsxs("div",{className:"min-w-0 flex-1",children:[g,f]}),e[37]=g,e[38]=f,e[39]=x):x=e[39];let u;e[40]!==a?(u=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]=u):u=e[41];let p;e[42]!==n.size?(p=yt(n.size),e[42]=n.size,e[43]=p):p=e[43];let j;e[44]!==p?(j=t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=j):j=e[45];let m;e[46]!==j||e[47]!==r||e[48]!==d||e[49]!==x||e[50]!==u?(m=t.jsxs("button",{type:"button",onClick:r,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[d,x,u,j]}),e[46]=j,e[47]=r,e[48]=d,e[49]=x,e[50]=u,e[51]=m):m=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]!==m||e[56]!==y?(k=t.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[m,y]}),e[55]=m,e[56]=y,e[57]=k):k=e[57],k}function xt(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 d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Me,{asChild:!0,children:t.jsx(Y,{type:"button",variant:"ghost",size:"icon",className:"size-7 rounded-md bg-background/80 backdrop-blur-sm",onClick:jt,"aria-label":"Asset actions",children:t.jsx(De,{size:14})})}),e[2]=d):d=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 g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(ge,{size:14}),e[6]=g):g=e[6];let f;e[7]!==c?(f=t.jsxs(ce,{onClick:c,children:[g,"Use this"]}),e[7]=c,e[8]=f):f=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 u=i?"Copied":"Copy URL";let p;e[11]!==r||e[12]!==x||e[13]!==u?(p=t.jsxs(ce,{onClick:r,children:[x,u]}),e[11]=r,e[12]=x,e[13]=u,e[14]=p):p=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 m;e[16]!==n.publicUrl?(m=t.jsx(ce,{asChild:!0,children:t.jsxs("a",{href:n.publicUrl,target:"_blank",rel:"noreferrer",onClick:ht,children:[j,"Open in new tab"]})}),e[16]=n.publicUrl,e[17]=m):m=e[17];let y;return e[18]!==m||e[19]!==f||e[20]!==p?(y=t.jsxs(Re,{children:[d,t.jsxs(Ge,{align:"end",onClick:bt,children:[f,p,m]})]}),e[18]=m,e[19]=f,e[20]=p,e[21]=y):y=e[21],y}function ht(s){return s.stopPropagation()}function bt(s){return s.stopPropagation()}function jt(s){return s.stopPropagation()}function he(s){const e=s.split("/");return e[e.length-1]??s}function yt(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function vt(s){try{const e=new URL(s).pathname;return decodeURIComponent(e.split("/").pop()??s)}catch{return s.split("/").pop()??s}}function Nt(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"":s.slice(e+1).toLowerCase()}const kt=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Kt(s){const e=w.c(79),{schema:n,value:l,onChange:i,path:o,label:a}=s,r=et(l),[d,c]=$.useState(!1),[g,f]=$.useState(!1),[x,u]=$.useState(!1),[p,j]=$.useState(!1),m=r?vt(r):"",y=m?Nt(m):"",k=Ye(),b=je();let N;e[0]!==i||e[1]!==j||e[2]!==u?(N=function(v){u(!1),j(!1),i(v)},e[0]=i,e[1]=j,e[2]=u,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(wt);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]!==f?(P=function(v){v.preventDefault(),v.dataTransfer.types.includes("Files")&&f(!0)},e[11]=f,e[12]=P):P=e[12];const se=P;let H;e[13]!==f?(H=function(v){v.currentTarget===v.target&&f(!1)},e[13]=f,e[14]=H):H=e[14];const ne=H;let X;e[15]!==_||e[16]!==f?(X=function(v){v.preventDefault(),f(!1),_(v.dataTransfer.files)},e[15]=_,e[16]=f,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=g&&"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]!==m||e[31]!==p||e[32]!==x||e[33]!==a||e[34]!==j||e[35]!==u||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:[!p&&t.jsx("img",{src:r,alt:a,className:de("h-full w-full object-contain transition-opacity",!x&&"opacity-0"),onLoad:()=>u(!0),onError:()=>j(!0)},r),p&&t.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[t.jsx(W,{size:20}),t.jsx("p",{className:"text-xs",children:"Preview unavailable"})]}),!x&&!p&&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:m}),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(W,{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]=m,e[31]=p,e[32]=x,e[33]=a,e[34]=j,e[35]=u,e[36]=c,e[37]=r,e[38]=b.isPending,e[39]=L):L=e[39];let O;e[40]!==g?(O=g&&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]=g,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 M;e[49]!==h?(M=U=>h(U.target.value),e[49]=h,e[50]=M):M=e[50];let R;e[51]!==o||e[52]!==r||e[53]!==M?(R=t.jsx(_e,{id:o,type:"url",value:r,onChange:M,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[51]=o,e[52]=r,e[53]=M,e[54]=R):R=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 B;e[58]!==G||e[59]!==oe?(B=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]=B):B=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]!==R||e[65]!==B||e[66]!==V?(K=t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[R,B,V]}),e[64]=R,e[65]=B,e[66]=V,e[67]=K):K=e[67];let q;e[68]!==h?(q=U=>h(U),e[68]=h,e[69]=q):q=e[69];let J;e[70]!==d||e[71]!==c||e[72]!==q?(J=t.jsx(it,{open:d,onOpenChange:c,mode:"image",onSelect:q}),e[70]=d,e[71]=c,e[72]=q,e[73]=J):J=e[73];let ee;return e[74]!==A||e[75]!==K||e[76]!==J||e[77]!==T?(ee=t.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[T,A,K,J]}),e[74]=A,e[75]=K,e[76]=J,e[77]=T,e[78]=ee):ee=e[78],ee}function wt(s){return kt.has(s.type||"")}export{it as F,Kt as I,ue as L,et as e,je as u};
1
+ import{e as w,q as be,a as Ne,K as ke,j as t,E as we,r as $,c as de,B as Y,l as Ce,P as Ie,o as Q}from"./index-kq5yUS_7.js";import{a as W}from"./Tool01-C6w2kT2d.js";import{s as Se}from"./Trash01-CicwXof9.js";import{i as fe}from"./Upload01-Cjsy_A0C.js";import{I as _e}from"./input-CwrS-iub.js";import{L as Pe}from"./label-CLJ0AedA.js";import{i as Ue}from"./AlertCircle-l0Fpo8hU.js";import{i as ge}from"./Check-c_jJpxb1.js";import{a as $e}from"./Eye-cKsI4OxT.js";import{i as De}from"./DotsVertical-Drb9z9hu.js";import{G as ze}from"./agent-icon-BGlV6q8v.js";import{n as Fe}from"./LinkExternal01-CXoDDgz6.js";import{D as Te,c as Ee,e as Le,b as Oe,a as Ae}from"./dialog-DAZt_PYz.js";import{c as ce,a as Re,D as Ge,b as Me}from"./dropdown-menu-D8Jq0EXH.js";import{S as Be}from"./skeleton-C868IqtJ.js";import{T as Ve,a as Ke,b as qe,c as Je}from"./tabs-CSjv4io2.js";import{u as Qe,c as Ye}from"./use-file-configs-DkyMSTLH.js";import{u as We}from"./useInfiniteQuery-JptJrV0H.js";import{S as He,u as Xe}from"./constants-_NfKPeA7.js";import{u as Ze}from"./unwrap-tool-result-BYXdCQMg.js";function et(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 tt(s){const e=w.c(13),{org:n}=be();let l;e[0]!==n.id||e[1]!==n.slug?(l={connectionId:He,orgId:n.id,orgSlug:n.slug},e[0]=n.id,e[1]=n.slug,e[2]=l):l=e[2];const i=Xe(l);let o;e[3]!==n.id||e[4]!==s.configId?(o=ke.filePickerObjects(n.id,s.configId),e[3]=n.id,e[4]=s.configId,e[5]=o):o=e[5];const a=s.enabled!==!1&&!!s.configId;let r;e[6]!==i||e[7]!==s.configId?(r=async c=>{const{pageParam:g}=c,f=await i.callTool({name:"FILE_OBJECTS_LIST",arguments:{configId:s.configId,cursor:g??void 0}});return Ze(f)},e[6]=i,e[7]=s.configId,e[8]=r):r=e[8];let d;return e[9]!==o||e[10]!==a||e[11]!==r?(d={queryKey:o,enabled:a,staleTime:3e4,initialPageParam:null,queryFn:r,getNextPageParam:st},e[9]=o,e[10]=a,e[11]=r,e[12]=d):d=e[12],We(d)}function st(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(nt);let r=`${o.status} ${o.statusText}`;try{const d=JSON.parse(a);d.message&&(r=d.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 nt(){return""}const ue="file-picker:last-config-id";function it(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(Be,{className:"h-64 w-full"}),e[5]=a):a=e[5];let r;e[6]!==s?(r=f=>{s.onSelect(f),s.onOpenChange(!1)},e[6]=s,e[7]=r):r=e[7];let d;e[8]!==s.mode||e[9]!==r?(d=t.jsx(we,{fallback:lt,children:t.jsx($.Suspense,{fallback:a,children:t.jsx(ot,{mode:s.mode,onSelect:r})})}),e[8]=s.mode,e[9]=r,e[10]=d):d=e[10];let c;e[11]!==o||e[12]!==d?(c=t.jsxs(Ae,{className:"sm:max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[o,d]}),e[11]=o,e[12]=d,e[13]=c):c=e[13];let g;return e[14]!==s.onOpenChange||e[15]!==s.open||e[16]!==c?(g=t.jsx(Te,{open:s.open,onOpenChange:s.onOpenChange,children:c}),e[14]=s.onOpenChange,e[15]=s.open,e[16]=c,e[17]=g):g=e[17],g}function lt(s){const{error:e}=s;return t.jsx(rt,{error:e??new Error("Failed to load buckets")})}function rt(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 ot(s){const e=w.c(23),{mode:n,onSelect:l}=s,i=Qe();if(i.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(dt,{}),e[0]=u):u=e[0],u}if(i.length===1){const u=i[0];let p;return e[1]!==u||e[2]!==n||e[3]!==l?(p=t.jsx(pe,{config:u,mode:n,onSelect:l}),e[1]=u,e[2]=n,e[3]=l,e[4]=p):p=e[4],p}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(u=>u.id===a)?.id??i[0].id,e[6]=i,e[7]=r):r=e[7];const d=r;let c;e[8]!==i?(c=i.map(at),e[8]=i,e[9]=c):c=e[9];let g;e[10]!==c?(g=t.jsx(Ke,{className:"self-start",children:c}),e[10]=c,e[11]=g):g=e[11];let f;if(e[12]!==i||e[13]!==n||e[14]!==l){let u;e[16]!==n||e[17]!==l?(u=p=>t.jsx(qe,{value:p.id,className:"min-h-0 flex-1 overflow-hidden",children:t.jsx(pe,{config:p,mode:n,onSelect:l})},p.id),e[16]=n,e[17]=l,e[18]=u):u=e[18],f=i.map(u),e[12]=i,e[13]=n,e[14]=l,e[15]=f}else f=e[15];let x;return e[19]!==d||e[20]!==g||e[21]!==f?(x=t.jsxs(Je,{defaultValue:d,onValueChange:ct,className:"min-h-0 flex-1 flex flex-col",children:[g,f]}),e[19]=d,e[20]=g,e[21]=f,e[22]=x):x=e[22],x}function at(s){return t.jsx(Ve,{value:s.id,children:s.name},s.id)}function ct(s){typeof window<"u"&&window.localStorage.setItem(ue,s)}function dt(){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=tt({configId:s.id}),i=je(),[o,a]=$.useState(!1),r=$.useRef(null),d=e==="image"?"image/*":void 0;async function c(m){if(!m)return;const y=Array.from(m);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 g(m){m.preventDefault(),a(!0)}function f(){a(!1)}function x(m){m.preventDefault(),a(!1),c(m.dataTransfer.files)}const p=(l.data?.pages??[]).flatMap(m=>m.items),j=p.filter(m=>e==="image"?ye(m.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:g,onDragLeave:f,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:d,multiple:!0,className:"hidden",onChange:m=>{const y=m.target.files;m.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"&&p.length>0?t.jsx(ut,{}):t.jsx(ft,{}):e==="image"?t.jsx(gt,{items:j,onSelect:n}):t.jsx(pt,{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 ft(){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(W,{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 ut(){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(W,{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 mt(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"file":s.slice(e+1).toLowerCase()}function gt(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 pt(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=mt(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:xt}),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 d;e[29]!==n.key?(d=t.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted",children:ye(n.key)?t.jsx(W,{size:16,className:"text-muted-foreground"}):t.jsx(ze,{size:16,className:"text-muted-foreground"})}),e[29]=n.key,e[30]=d):d=e[30];let c;e[31]!==n.key?(c=he(n.key),e[31]=n.key,e[32]=c):c=e[32];let g;e[33]!==c?(g=t.jsx("p",{className:"truncate text-sm font-medium",children:c}),e[33]=c,e[34]=g):g=e[34];let f;e[35]!==n.key?(f=t.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:n.key}),e[35]=n.key,e[36]=f):f=e[36];let x;e[37]!==g||e[38]!==f?(x=t.jsxs("div",{className:"min-w-0 flex-1",children:[g,f]}),e[37]=g,e[38]=f,e[39]=x):x=e[39];let u;e[40]!==a?(u=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]=u):u=e[41];let p;e[42]!==n.size?(p=yt(n.size),e[42]=n.size,e[43]=p):p=e[43];let j;e[44]!==p?(j=t.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:p}),e[44]=p,e[45]=j):j=e[45];let m;e[46]!==j||e[47]!==r||e[48]!==d||e[49]!==x||e[50]!==u?(m=t.jsxs("button",{type:"button",onClick:r,className:"flex min-w-0 flex-1 items-center gap-3 text-left",children:[d,x,u,j]}),e[46]=j,e[47]=r,e[48]=d,e[49]=x,e[50]=u,e[51]=m):m=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]!==m||e[56]!==y?(k=t.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2 transition hover:bg-muted/50",children:[m,y]}),e[55]=m,e[56]=y,e[57]=k):k=e[57],k}function xt(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 d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=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:jt,"aria-label":"Asset actions",children:t.jsx(De,{size:14})})}),e[2]=d):d=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 g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(ge,{size:14}),e[6]=g):g=e[6];let f;e[7]!==c?(f=t.jsxs(ce,{onClick:c,children:[g,"Use this"]}),e[7]=c,e[8]=f):f=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 u=i?"Copied":"Copy URL";let p;e[11]!==r||e[12]!==x||e[13]!==u?(p=t.jsxs(ce,{onClick:r,children:[x,u]}),e[11]=r,e[12]=x,e[13]=u,e[14]=p):p=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 m;e[16]!==n.publicUrl?(m=t.jsx(ce,{asChild:!0,children:t.jsxs("a",{href:n.publicUrl,target:"_blank",rel:"noreferrer",onClick:ht,children:[j,"Open in new tab"]})}),e[16]=n.publicUrl,e[17]=m):m=e[17];let y;return e[18]!==m||e[19]!==f||e[20]!==p?(y=t.jsxs(Ge,{children:[d,t.jsxs(Me,{align:"end",onClick:bt,children:[f,p,m]})]}),e[18]=m,e[19]=f,e[20]=p,e[21]=y):y=e[21],y}function ht(s){return s.stopPropagation()}function bt(s){return s.stopPropagation()}function jt(s){return s.stopPropagation()}function he(s){const e=s.split("/");return e[e.length-1]??s}function yt(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function vt(s){try{const e=new URL(s).pathname;return decodeURIComponent(e.split("/").pop()??s)}catch{return s.split("/").pop()??s}}function Nt(s){const e=s.lastIndexOf(".");return e<0||e===s.length-1?"":s.slice(e+1).toLowerCase()}const kt=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Kt(s){const e=w.c(79),{schema:n,value:l,onChange:i,path:o,label:a}=s,r=et(l),[d,c]=$.useState(!1),[g,f]=$.useState(!1),[x,u]=$.useState(!1),[p,j]=$.useState(!1),m=r?vt(r):"",y=m?Nt(m):"",k=Ye(),b=je();let N;e[0]!==i||e[1]!==j||e[2]!==u?(N=function(v){u(!1),j(!1),i(v)},e[0]=i,e[1]=j,e[2]=u,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(wt);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]!==f?(P=function(v){v.preventDefault(),v.dataTransfer.types.includes("Files")&&f(!0)},e[11]=f,e[12]=P):P=e[12];const se=P;let H;e[13]!==f?(H=function(v){v.currentTarget===v.target&&f(!1)},e[13]=f,e[14]=H):H=e[14];const ne=H;let X;e[15]!==_||e[16]!==f?(X=function(v){v.preventDefault(),f(!1),_(v.dataTransfer.files)},e[15]=_,e[16]=f,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=g&&"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]!==m||e[31]!==p||e[32]!==x||e[33]!==a||e[34]!==j||e[35]!==u||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:[!p&&t.jsx("img",{src:r,alt:a,className:de("h-full w-full object-contain transition-opacity",!x&&"opacity-0"),onLoad:()=>u(!0),onError:()=>j(!0)},r),p&&t.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[t.jsx(W,{size:20}),t.jsx("p",{className:"text-xs",children:"Preview unavailable"})]}),!x&&!p&&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:m}),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(W,{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]=m,e[31]=p,e[32]=x,e[33]=a,e[34]=j,e[35]=u,e[36]=c,e[37]=r,e[38]=b.isPending,e[39]=L):L=e[39];let O;e[40]!==g?(O=g&&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]=g,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 G;e[51]!==o||e[52]!==r||e[53]!==R?(G=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]=G):G=e[54];let M;e[55]!==c?(M=()=>c(!0),e[55]=c,e[56]=M):M=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 B;e[58]!==M||e[59]!==oe?(B=t.jsxs(Y,{type:"button",variant:"outline",size:"sm",onClick:M,className:"h-9 shrink-0",children:[Z,oe]}),e[58]=M,e[59]=oe,e[60]=B):B=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]!==G||e[65]!==B||e[66]!==V?(K=t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[G,B,V]}),e[64]=G,e[65]=B,e[66]=V,e[67]=K):K=e[67];let q;e[68]!==h?(q=U=>h(U),e[68]=h,e[69]=q):q=e[69];let J;e[70]!==d||e[71]!==c||e[72]!==q?(J=t.jsx(it,{open:d,onOpenChange:c,mode:"image",onSelect:q}),e[70]=d,e[71]=c,e[72]=q,e[73]=J):J=e[73];let ee;return e[74]!==A||e[75]!==K||e[76]!==J||e[77]!==T?(ee=t.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[T,A,K,J]}),e[74]=A,e[75]=K,e[76]=J,e[77]=T,e[78]=ee):ee=e[78],ee}function wt(s){return kt.has(s.type||"")}export{it as F,Kt as I,ue as L,et as e,je as u};