@xopcai/xopc 0.0.482 → 0.0.483

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 (470) hide show
  1. package/dist/browser-ext/dist/assets/{auth-B658Oa_i.js → auth-tm02ZZB8.js} +26 -17
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +1 -1
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  9. package/dist/gateway/server/chunks.bin +1001 -980
  10. package/dist/gateway/server/chunks.json +1 -1
  11. package/dist/gateway/static/root/assets/{activity-store-BCPCuT-6.js → activity-store-hSe5Nbgk.js} +1 -1
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Di9jxcH9.js → agent-avatar-dicebear-BY2wRiwY.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-avatar-display-KbzBlJ8W.js → agent-avatar-display-D_UDgOr9.js} +2 -2
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CYZzdU6C.js → agent-defaults-settings-panel-BrcyLG9M.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-Bhkawcil.js → agent-plugin-dialog-CSJC1yud.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-B2RXJeIo.js → agents-DX-t3X7K.js} +3 -3
  17. package/dist/gateway/static/root/assets/{agents-admin-api-DpfkHNbc.js → agents-admin-api-DSr-PWuW.js} +1 -1
  18. package/dist/gateway/static/root/assets/{api-BtngCZrB.js → api-B3T06TLl.js} +1 -1
  19. package/dist/gateway/static/root/assets/{api-CnOSHyKU.js → api-CGs641OT.js} +1 -1
  20. package/dist/gateway/static/root/assets/{app-management-settings-panel-Dyc3I-ng.js → app-management-settings-panel-D6ZoYKaA.js} +1 -1
  21. package/dist/gateway/static/root/assets/{appearance-settings-CmdhL-0n.js → appearance-settings-BRb6kZT8.js} +1 -1
  22. package/dist/gateway/static/root/assets/{apps-page-BFqC9Knk.js → apps-page-DO5uTFRI.js} +1 -1
  23. package/dist/gateway/static/root/assets/{archive-plugin-DFP0MajV.js → archive-plugin-CQ5UXgZk.js} +1 -1
  24. package/dist/gateway/static/root/assets/{automation-api-Cc5X3Q1t.js → automation-api-D-gn6x5E.js} +1 -1
  25. package/dist/gateway/static/root/assets/{automation-result-state-B7fHzLLf.js → automation-result-state-B7hq0XOL.js} +1 -1
  26. package/dist/gateway/static/root/assets/{automation-run-list-DPTby29p.js → automation-run-list-CM59-qm5.js} +1 -1
  27. package/dist/gateway/static/root/assets/{automation-task-card-CjzArAJi.js → automation-task-card-C453Q-Wa.js} +1 -1
  28. package/dist/gateway/static/root/assets/{automations-page-BKbElVfF.js → automations-page-C5rp_vOE.js} +1 -1
  29. package/dist/gateway/static/root/assets/{automations-workspace-_18qOoLm.js → automations-workspace-BxN47gkP.js} +2 -2
  30. package/dist/gateway/static/root/assets/{binary-plugins-DnE-iqaV.js → binary-plugins-D_zw0TgG.js} +1 -1
  31. package/dist/gateway/static/root/assets/{block-editor-CYobheuw.js → block-editor-Cesz2DqP.js} +1 -1
  32. package/dist/gateway/static/root/assets/{browser-settings-page-BLniK98R.js → browser-settings-page-BHElJSFt.js} +1 -1
  33. package/dist/gateway/static/root/assets/{capabilities-BfTF_flC.js → capabilities-BaKHutgZ.js} +1 -1
  34. package/dist/gateway/static/root/assets/{capabilities-oihQXc5J.js → capabilities-abgigXV1.js} +1 -1
  35. package/dist/gateway/static/root/assets/capabilities-page-BFYx0xu5.js +2 -0
  36. package/dist/gateway/static/root/assets/capabilities-settings-panel-B1o8BKxy.js +8 -0
  37. package/dist/gateway/static/root/assets/{channels-DEIqjf9M.js → channels-_m_FjvAY.js} +1 -1
  38. package/dist/gateway/static/root/assets/{chat-agents-api-BzuJyysa.js → chat-agents-api-CyvBfBbp.js} +1 -1
  39. package/dist/gateway/static/root/assets/{chat-chart-block-DurSfGy2.js → chat-chart-block-B83s8HE9.js} +1 -1
  40. package/dist/gateway/static/root/assets/{chat-page-CK4aWVbI.js → chat-page-D7l_0kTV.js} +4 -4
  41. package/dist/gateway/static/root/assets/{chat-terminal-dock-UBaRUsXJ.js → chat-terminal-dock-BKnlzlXT.js} +1 -1
  42. package/dist/gateway/static/root/assets/{command-palette-api-3kNqE3U7.js → command-palette-api-YP0zV_Ol.js} +1 -1
  43. package/dist/gateway/static/root/assets/{composer-model-config-control-CrI-u8F_.js → composer-model-config-control-C2Bku39S.js} +1 -1
  44. package/dist/gateway/static/root/assets/{composer-notifications-L6u0F2_8.js → composer-notifications-MGKffwC7.js} +1 -1
  45. package/dist/gateway/static/root/assets/{composer-payload-handoff-DdHGkHOq.js → composer-payload-handoff-ClWsunJ2.js} +1 -1
  46. package/dist/gateway/static/root/assets/{computer-settings-page-BwvCOkbI.js → computer-settings-page-DUzQe6Bz.js} +1 -1
  47. package/dist/gateway/static/root/assets/{connected-providers-grid-B8eiZl6Z.js → connected-providers-grid-BgW-ioIt.js} +1 -1
  48. package/dist/gateway/static/root/assets/{connection-usage-guide-CydSRk3h.js → connection-usage-guide-B9hoSOnN.js} +1 -1
  49. package/dist/gateway/static/root/assets/{connector-service-page-CLBi6R-Z.js → connector-service-page-e67KylnM.js} +1 -1
  50. package/dist/gateway/static/root/assets/{connectors-api-Bn2IbtcF.js → connectors-api-CRGq-TSw.js} +1 -1
  51. package/dist/gateway/static/root/assets/connectors-page-CXNy8Y5R.js +1 -0
  52. package/dist/gateway/static/root/assets/{date-picker-DsD7NIm2.js → date-picker-DwITf4I2.js} +1 -1
  53. package/dist/gateway/static/root/assets/{date-time-picker-BhnBpBpj.js → date-time-picker-ChG1CqR1.js} +1 -1
  54. package/dist/gateway/static/root/assets/{desktop-pet-eFR-zmP2.js → desktop-pet-BHoFymL4.js} +1 -1
  55. package/dist/gateway/static/root/assets/{desktop-pet-settings-CfFTYstQ.js → desktop-pet-settings-BYeBN4jj.js} +1 -1
  56. package/dist/gateway/static/root/assets/{dev-view-store-D_uPX9_R.js → dev-view-store-DsjH8x76.js} +1 -1
  57. package/dist/gateway/static/root/assets/device-connections-panel-XtEX1NcJ.js +1 -0
  58. package/dist/gateway/static/root/assets/device-pairing-action-w1enAo76.js +1 -0
  59. package/dist/gateway/static/root/assets/{device-pairing-wizard-BeLkoDUp.js → device-pairing-wizard-Dt737tSq.js} +1 -1
  60. package/dist/gateway/static/root/assets/{directory-picker-path-field-5wZa0JF3.js → directory-picker-path-field-B-eUnbng.js} +1 -1
  61. package/dist/gateway/static/root/assets/{extension-authoritative-grants-DaA0KXyO.js → extension-authoritative-grants-DYp2nNol.js} +1 -1
  62. package/dist/gateway/static/root/assets/{extension-debug-page-CXe8jimk.js → extension-debug-page-BcjkhaY9.js} +1 -1
  63. package/dist/gateway/static/root/assets/{extension-iframe-host-BwMISzWU.js → extension-iframe-host-RWjaucjJ.js} +1 -1
  64. package/dist/gateway/static/root/assets/{extension-marketplace-api-DuWuae8G.js → extension-marketplace-api-DGV5FC-v.js} +1 -1
  65. package/dist/gateway/static/root/assets/{extension-message-router-DzBfVl6h.js → extension-message-router-CzVgJn5c.js} +1 -1
  66. package/dist/gateway/static/root/assets/{extension-page-DW18FOb8.js → extension-page-DC58VBdj.js} +1 -1
  67. package/dist/gateway/static/root/assets/{extension-provider-CyYrgUw-.js → extension-provider-BGrqW0_n.js} +1 -1
  68. package/dist/gateway/static/root/assets/{extension-settings-page-ByGVQYDw.js → extension-settings-page-DYbal3Iq.js} +1 -1
  69. package/dist/gateway/static/root/assets/{file-preview-surface-Cw70pwph.js → file-preview-surface-BOfJPMux.js} +1 -1
  70. package/dist/gateway/static/root/assets/{gateway-config-swr-BYoBGl6i.js → gateway-config-swr-BD-ams0X.js} +1 -1
  71. package/dist/gateway/static/root/assets/gateway-realtime-jIH8iEGO.js +1 -0
  72. package/dist/gateway/static/root/assets/gateway-realtime-store-CTWm23Qi.js +1 -0
  73. package/dist/gateway/static/root/assets/{gateway-restart-CtqJpyNu.js → gateway-restart-Dos1Pp84.js} +1 -1
  74. package/dist/gateway/static/root/assets/{gateway-settings-xzO7KDsu.js → gateway-settings-DUC1iOVK.js} +1 -1
  75. package/dist/gateway/static/root/assets/{gateway-startup-retry-DCDOl6Oo.js → gateway-startup-retry-DgmvR-hb.js} +1 -1
  76. package/dist/gateway/static/root/assets/{global-defaults-api-DXFSI87T.js → global-defaults-api-B7suATYU.js} +1 -1
  77. package/dist/gateway/static/root/assets/{home-page-CztF0goW.js → home-page-DnjsusRG.js} +3 -3
  78. package/dist/gateway/static/root/assets/{home-task-actions-DTXb7Gc7.js → home-task-actions-C8Fi6GBq.js} +1 -1
  79. package/dist/gateway/static/root/assets/{image-generation-api-Ck0rMJy3.js → image-generation-api-Baz4xdZ4.js} +1 -1
  80. package/dist/gateway/static/root/assets/{imports-page-egn9yYfF.js → imports-page-DR0eLPgB.js} +1 -1
  81. package/dist/gateway/static/root/assets/index-Cl5ueYDl.css +1 -0
  82. package/dist/gateway/static/root/assets/index-DYRzuQl_.js +11 -0
  83. package/dist/gateway/static/root/assets/{install-connector-dialog-CMh8jhn1.js → install-connector-dialog-CntHi8Rh.js} +1 -1
  84. package/dist/gateway/static/root/assets/installed-connector-row-skeleton-BAe_utvG.js +1 -0
  85. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BOiKmOwN.js → keyboard-shortcuts-settings-DlGDLJI2.js} +1 -1
  86. package/dist/gateway/static/root/assets/{local-app-workbench-page-ev6VTDX2.js → local-app-workbench-page-DH5c5Zhv.js} +1 -1
  87. package/dist/gateway/static/root/assets/{local-apps-page-CQBSa3cR.js → local-apps-page-BoCtITdL.js} +1 -1
  88. package/dist/gateway/static/root/assets/{local-session-drafts-pAAFf-Ad.js → local-session-drafts-CGSV1RQg.js} +1 -1
  89. package/dist/gateway/static/root/assets/{locale-store-BYdvIuPj.js → locale-store-CHjsq5NR.js} +1 -1
  90. package/dist/gateway/static/root/assets/{logs-page-Z-4VNgnq.js → logs-page-D2olKpTB.js} +1 -1
  91. package/dist/gateway/static/root/assets/{management-api-D739TCBl.js → management-api-FVu7eYXD.js} +1 -1
  92. package/dist/gateway/static/root/assets/management-settings-QQB1r71U.js +1 -0
  93. package/dist/gateway/static/root/assets/map-pin-DNclV497.js +1 -0
  94. package/dist/gateway/static/root/assets/{markdown-view-BOJVaGPC.js → markdown-view-ihzUc4ud.js} +1 -1
  95. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-NcRvP7cK.js → mcp-conversation-setup-page-DffQKrjd.js} +1 -1
  96. package/dist/gateway/static/root/assets/{media-plugins-B9bQ3e1j.js → media-plugins-C78NkHfB.js} +1 -1
  97. package/dist/gateway/static/root/assets/{messages-lc5BjBtX.js → messages-C7QSnTdg.js} +2 -2
  98. package/dist/gateway/static/root/assets/{model-selector-DugdMlvi.js → model-selector-QFZY5XNN.js} +1 -1
  99. package/dist/gateway/static/root/assets/{models-hub-cache-DvDksW4g.js → models-hub-cache-BrD6r5Qs.js} +1 -1
  100. package/dist/gateway/static/root/assets/{note-detail-panel-CEi6GNEA.js → note-detail-panel-lU1-3mBw.js} +3 -3
  101. package/dist/gateway/static/root/assets/note-image-lightbox-Bvjumefe.js +1 -0
  102. package/dist/gateway/static/root/assets/{notes-api-auhtw3zM.js → notes-api-D5SvfybU.js} +1 -1
  103. package/dist/gateway/static/root/assets/{notes-page-DnI1iJ3g.js → notes-page-YQAAdasN.js} +1 -1
  104. package/dist/gateway/static/root/assets/{oauth-api-BXKG29Kg.js → oauth-api-DnMpUoyx.js} +1 -1
  105. package/dist/gateway/static/root/assets/{oauth-provider-connect-y6-vDWb-.js → oauth-provider-connect-DGYky6ut.js} +1 -1
  106. package/dist/gateway/static/root/assets/{page-context-capture-button-BBVJZgU0.js → page-context-capture-button-CDSH76wA.js} +1 -1
  107. package/dist/gateway/static/root/assets/{page-context-draft-B30xEPDh.js → page-context-draft-Bk7jVvAG.js} +1 -1
  108. package/dist/gateway/static/root/assets/{page-header-store-BGCCXOOf.js → page-header-store-NP7MCIaP.js} +1 -1
  109. package/dist/gateway/static/root/assets/{personal-avatar-w5Sekj02.js → personal-avatar-1TVnHakL.js} +1 -1
  110. package/dist/gateway/static/root/assets/{personal-page-BWzfp81f.js → personal-page-Bfgb5oQI.js} +1 -1
  111. package/dist/gateway/static/root/assets/{personal-profile-settings-BYmKk14v.js → personal-profile-settings-BvjLssF9.js} +1 -1
  112. package/dist/gateway/static/root/assets/{personal-settings-panel-DYnTT7aB.js → personal-settings-panel-Ffr7gcx4.js} +1 -1
  113. package/dist/gateway/static/root/assets/{phone-dependencies-card-DJciwZ-7.js → phone-dependencies-card-B4QsgIEF.js} +1 -1
  114. package/dist/gateway/static/root/assets/{phone-model-connection-C3jmc4ma.js → phone-model-connection-Dk5kE1Ll.js} +1 -1
  115. package/dist/gateway/static/root/assets/{phone-model-picker-MWC_Zh2a.js → phone-model-picker-CFoxQiws.js} +1 -1
  116. package/dist/gateway/static/root/assets/{phone-settings-page-C1Yc6tP7.js → phone-settings-page-Bv1xm8sh.js} +1 -1
  117. package/dist/gateway/static/root/assets/{phone-workspace-store-Cxk2PJZe.js → phone-workspace-store-DGaibcsi.js} +1 -1
  118. package/dist/gateway/static/root/assets/{plugin-details-dialog-CpKZE_nx.js → plugin-details-dialog-FcOJaeP0.js} +1 -1
  119. package/dist/gateway/static/root/assets/{preference-select-fields-ByihE_wl.js → preference-select-fields-B-yK91If.js} +1 -1
  120. package/dist/gateway/static/root/assets/{preview-runtime-iJuVSugF.js → preview-runtime-pNF_b2oD.js} +3 -3
  121. package/dist/gateway/static/root/assets/{product-automation-feedback-ref9gqOW.js → product-automation-feedback-BxA2Ype-.js} +1 -1
  122. package/dist/gateway/static/root/assets/product-navigation-wFfnI3uw.js +1 -0
  123. package/dist/gateway/static/root/assets/{product-open-page-B7kAAD7Q.js → product-open-page-C09VEZjY.js} +1 -1
  124. package/dist/gateway/static/root/assets/{product-preview-content-CzNWh2h2.js → product-preview-content-BOq3gtSJ.js} +1 -1
  125. package/dist/gateway/static/root/assets/{product-preview-modal-B1RKw3Z-.js → product-preview-modal-DIh_CsXp.js} +2 -2
  126. package/dist/gateway/static/root/assets/{project-detail-page-Zr1I56NG.js → project-detail-page-DDaG-n-H.js} +1 -1
  127. package/dist/gateway/static/root/assets/{project-understanding-D0S9pFg7.js → project-understanding-4IyHVmus.js} +1 -1
  128. package/dist/gateway/static/root/assets/{projects-page-DlwRbxAj.js → projects-page-BHQxQGTd.js} +1 -1
  129. package/dist/gateway/static/root/assets/{providers-api-D_v_CJ3l.js → providers-api-D9NuB7w3.js} +1 -1
  130. package/dist/gateway/static/root/assets/{recording-upload-BSyxK34y.js → recording-upload-plrQDkLa.js} +1 -1
  131. package/dist/gateway/static/root/assets/{registry-api-DGi-X6j7.js → registry-api-CDpUAb2R.js} +1 -1
  132. package/dist/gateway/static/root/assets/{remote-access-hub-D3EYRXQC.js → remote-access-hub-DVTs8pwO.js} +1 -1
  133. package/dist/gateway/static/root/assets/{resource-unavailable-52Jvhy-I.js → resource-unavailable-CZlqZYk-.js} +1 -1
  134. package/dist/gateway/static/root/assets/{right-workspace-store-DsGslCi-.js → right-workspace-store-Cehybf-G.js} +1 -1
  135. package/dist/gateway/static/root/assets/route-preload-B-OXsVjy.js +2 -0
  136. package/dist/gateway/static/root/assets/routine-panel-BWLC11Ou.js +2 -0
  137. package/dist/gateway/static/root/assets/{runtime-tools-api-D8Xtty0g.js → runtime-tools-api-BhS0RWf2.js} +1 -1
  138. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-r28zxrgP.js → runtime-tools-settings-panel-jTbGPGeA.js} +1 -1
  139. package/dist/gateway/static/root/assets/{service-recommendation-list-Kw6pwI8U.js → service-recommendation-list-wfd0Mjtu.js} +1 -1
  140. package/dist/gateway/static/root/assets/{session-api-eApyRHbI.js → session-api-CR3NLqvs.js} +1 -1
  141. package/dist/gateway/static/root/assets/{session-manager-C-oe-9_N.js → session-manager-CVNlrzFB.js} +1 -1
  142. package/dist/gateway/static/root/assets/{sessions-page-BkNfjgXC.js → sessions-page-9ibCNP9o.js} +1 -1
  143. package/dist/gateway/static/root/assets/settings-advanced-gate-Cq4HDQu2.js +1 -0
  144. package/dist/gateway/static/root/assets/{settings-advanced-section-Dc9aztiW.js → settings-advanced-section-CTLdGPvx.js} +1 -1
  145. package/dist/gateway/static/root/assets/{settings-mode-store-DcE2iR7e.js → settings-mode-store-CCQVvItG.js} +1 -1
  146. package/dist/gateway/static/root/assets/{settings-page-CXRPZxuB.js → settings-page-DzISa84O.js} +1 -1
  147. package/dist/gateway/static/root/assets/{settings-page-header-CQueaD1Z.js → settings-page-header-C21Iw2rD.js} +1 -1
  148. package/dist/gateway/static/root/assets/{settings-page-layout-BlwyxcEq.js → settings-page-layout-BXcLlp6p.js} +1 -1
  149. package/dist/gateway/static/root/assets/{setup-interaction-page-BvL6C5ja.js → setup-interaction-page-W2F5ZaR_.js} +1 -1
  150. package/dist/gateway/static/root/assets/{setup-status-panel-Dp5cY2P9.js → setup-status-panel-BFNwZuhp.js} +1 -1
  151. package/dist/gateway/static/root/assets/share-link-dialog-D31jDQN9.js +1 -0
  152. package/dist/gateway/static/root/assets/{share-preview-page-IG0fTWJO.js → share-preview-page-Co6GUYV5.js} +1 -1
  153. package/dist/gateway/static/root/assets/{shares-api-DgYOJV0T.js → shares-api-BhWvN3LS.js} +1 -1
  154. package/dist/gateway/static/root/assets/{shares-settings-YeLkRDki.js → shares-settings-C-czUl49.js} +1 -1
  155. package/dist/gateway/static/root/assets/{skill-api-DRCHLW2T.js → skill-api-BG9A1WF0.js} +1 -1
  156. package/dist/gateway/static/root/assets/{skill-list-api-CQUhEUOF.js → skill-list-api-B26hHnXq.js} +1 -1
  157. package/dist/gateway/static/root/assets/{skill-reload-api-BoEna1cx.js → skill-reload-api-B9Eu5Yk_.js} +1 -1
  158. package/dist/gateway/static/root/assets/{skills-page-CBAL83FE.js → skills-page-gGU0LZ5e.js} +1 -1
  159. package/dist/gateway/static/root/assets/{space-api-d4Q4hkEY.js → space-api-_uKFiASp.js} +1 -1
  160. package/dist/gateway/static/root/assets/space-page-DhhqkNGh.js +2 -0
  161. package/dist/gateway/static/root/assets/{space-workbook-BDjeiRtr.js → space-workbook-BAwHwK6O.js} +1 -1
  162. package/dist/gateway/static/root/assets/{system-settings-panel-dt8k0K4V.js → system-settings-panel-Gu0rWNOv.js} +1 -1
  163. package/dist/gateway/static/root/assets/{task-detail-page-DFeKIcxT.js → task-detail-page-DWoXIgp2.js} +1 -1
  164. package/dist/gateway/static/root/assets/{task-header-title-ClyuCAFb.js → task-header-title-DfyaQ58P.js} +1 -1
  165. package/dist/gateway/static/root/assets/{task-run-issue-notice-XWlgvgEo.js → task-run-issue-notice-CljFUd21.js} +1 -1
  166. package/dist/gateway/static/root/assets/{terminal-panel-store-CNkRP4kf.js → terminal-panel-store-Cy90Ix5U.js} +1 -1
  167. package/dist/gateway/static/root/assets/{theme-store-nXIuAiQZ.js → theme-store-CvG266p8.js} +1 -1
  168. package/dist/gateway/static/root/assets/{tracing-settings-page-CoWcr2c0.js → tracing-settings-page-Cx_fOH70.js} +1 -1
  169. package/dist/gateway/static/root/assets/{tunnel-api-DgsELO9g.js → tunnel-api-Cph-ZBBy.js} +1 -1
  170. package/dist/gateway/static/root/assets/{understanding-activity-store-BI_PbKCi.js → understanding-activity-store-CN4JzOIO.js} +1 -1
  171. package/dist/gateway/static/root/assets/{understanding-refresh-store-DPHzCi1Q.js → understanding-refresh-store-BuZZ1_VH.js} +1 -1
  172. package/dist/gateway/static/root/assets/{usage-page-BVNBJa59.js → usage-page-Du42x0ej.js} +1 -1
  173. package/dist/gateway/static/root/assets/{use-autosave-BPDFVsgM.js → use-autosave-B_WH_LBE.js} +1 -1
  174. package/dist/gateway/static/root/assets/{use-composer-attachments-9nVD0sQ1.js → use-composer-attachments-Dnrs5cP1.js} +1 -1
  175. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BhmEiOkv.js → use-file-preview-expanded-U5rH80Jf.js} +1 -1
  176. package/dist/gateway/static/root/assets/{use-generated-media-CLEV4wYC.js → use-generated-media-CzRbgtcv.js} +1 -1
  177. package/dist/gateway/static/root/assets/{use-personal-profile-CFaihmiJ.js → use-personal-profile-D4gLM6Wi.js} +1 -1
  178. package/dist/gateway/static/root/assets/{use-personal-work-CIZMwOlm.js → use-personal-work-FI9Cgyq5.js} +1 -1
  179. package/dist/gateway/static/root/assets/{use-realtime-voice-CvtX2HcA.js → use-realtime-voice-BARxeNLd.js} +1 -1
  180. package/dist/gateway/static/root/assets/use-section-navigation-yC9HkVpd.js +1 -0
  181. package/dist/gateway/static/root/assets/{use-workspace-tree-BnvuxYD4.js → use-workspace-tree-NEeru2fw.js} +1 -1
  182. package/dist/gateway/static/root/assets/{user-model-page-D4yNFvW1.js → user-model-page-AK2U8vGc.js} +1 -1
  183. package/dist/gateway/static/root/assets/{voice-api-key-field-NINoxB5r.js → voice-api-key-field-BqXQj51r.js} +1 -1
  184. package/dist/gateway/static/root/assets/{voice-config-api-7cvKLNoE.js → voice-config-api-sXEIG6lz.js} +1 -1
  185. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-DaCuiqoi.js → voice-input-shortcut-events-DN-_rY5a.js} +1 -1
  186. package/dist/gateway/static/root/assets/{voice-player-store-DipmM7w1.js → voice-player-store-CTbnOdeM.js} +1 -1
  187. package/dist/gateway/static/root/assets/{voice-settings-BTvMqF_9.js → voice-settings-bAmN4bUq.js} +1 -1
  188. package/dist/gateway/static/root/assets/wifi-off-C35sMFUl.js +1 -0
  189. package/dist/gateway/static/root/assets/{work-discovery-overlay-BKdumzyK.js → work-discovery-overlay-BjfTRFX8.js} +1 -1
  190. package/dist/gateway/static/root/assets/{work-discovery-page-uX1VIzJY.js → work-discovery-page-CSRkFiXc.js} +1 -1
  191. package/dist/gateway/static/root/assets/{working-directory-picker-modal-C9hWAPvW.js → working-directory-picker-modal-DgM21YVT.js} +1 -1
  192. package/dist/gateway/static/root/assets/{workspace-api-_mQWmOZm.js → workspace-api-C8-p66T-.js} +2 -2
  193. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CX8zX9eZ.js +1 -0
  194. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-D4Nc7XkR.js → workspace-file-preview-dialog-BlNfLhnV.js} +1 -1
  195. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BZSS94es.js → workspace-open-location-menu-BAbIGS01.js} +1 -1
  196. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-xJr48TmR.js → xopc-cloud-account-card-e8HJFnTs.js} +1 -1
  197. package/dist/gateway/static/root/index.html +96 -94
  198. package/dist/package.js +1 -1
  199. package/dist/packages/endpoint-tools-client/src/index.js +2 -1
  200. package/dist/packages/endpoint-tools-protocol/src/canonical-json.js +20 -0
  201. package/dist/packages/endpoint-tools-protocol/src/folders.js +175 -0
  202. package/dist/packages/endpoint-tools-protocol/src/index.js +14 -16
  203. package/dist/packages/endpoint-tools-protocol/src/location.js +22 -1
  204. package/dist/packages/endpoint-tools-protocol/src/personal.js +151 -8
  205. package/dist/src/agent/agent-manager.js +14 -14
  206. package/dist/src/agent/background-review/prompts.js +1 -1
  207. package/dist/src/agent/background-review/run-background-review.js +8 -8
  208. package/dist/src/agent/context/coordinator.js +1 -1
  209. package/dist/src/agent/context/deep-recall.js +4 -4
  210. package/dist/src/agent/context/execution-context.js +3 -3
  211. package/dist/src/agent/context/project-context.js +4 -4
  212. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  213. package/dist/src/agent/embedded/run-for-session.js +4 -4
  214. package/dist/src/agent/embedded/run-turn.js +1 -1
  215. package/dist/src/agent/embedded/session-runner.js +3 -3
  216. package/dist/src/agent/external-tools/cliProvider.js +4 -4
  217. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  218. package/dist/src/agent/external-tools/endpoint-provider.js +44 -10
  219. package/dist/src/agent/image/tool-model-config.js +1 -1
  220. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  221. package/dist/src/agent/mcp/connection-drafts.js +1 -1
  222. package/dist/src/agent/mcp/connection-setup.js +2 -2
  223. package/dist/src/agent/mcp/managed-discovery.js +1 -1
  224. package/dist/src/agent/mcp/tool-catalog.js +1 -1
  225. package/dist/src/agent/mcp/transport.js +1 -1
  226. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  227. package/dist/src/agent/orchestration/child-run-resume.js +1 -1
  228. package/dist/src/agent/prompt/response-language.js +1 -1
  229. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  230. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  231. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  232. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  233. package/dist/src/agent/service.js +10 -10
  234. package/dist/src/agent/session/session-config-service.js +1 -1
  235. package/dist/src/agent/session/session-inspector.js +1 -1
  236. package/dist/src/agent/skills/index.js +1 -1
  237. package/dist/src/agent/skills/managed-store.js +1 -1
  238. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  239. package/dist/src/agent/skills/skill-manager.js +1 -1
  240. package/dist/src/agent/skills/skill-sources.js +1 -1
  241. package/dist/src/agent/tasks/task-judge-service.js +6 -6
  242. package/dist/src/agent/tools/factory.js +10 -10
  243. package/dist/src/agent/tools/fetch-text.js +1 -1
  244. package/dist/src/agent/tools/index.js +3 -3
  245. package/dist/src/agent/tools/knowledge-memory-tool.js +1 -1
  246. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  247. package/dist/src/agent/tools/personal-memory-tool.js +5 -5
  248. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  249. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  250. package/dist/src/agent/tools/personal-request-tool.js +2 -2
  251. package/dist/src/agent/tools/personal-task-tool.js +4 -4
  252. package/dist/src/agent/tools/session-search-tool.js +2 -2
  253. package/dist/src/agent/tools/user-context-tool.js +2 -2
  254. package/dist/src/agent/tools/xopc-use-tool.js +5 -5
  255. package/dist/src/ai-assist/text-assist.js +1 -1
  256. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  257. package/dist/src/auth/sync-provider-auth.js +1 -1
  258. package/dist/src/automations/api/routes.js +2 -2
  259. package/dist/src/automations/capabilities/write.js +3 -3
  260. package/dist/src/automations/configuration-conversation.js +1 -1
  261. package/dist/src/automations/domain/index.js +1 -1
  262. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  263. package/dist/src/automations/index.js +2 -2
  264. package/dist/src/automations/service/action-executor.js +2 -2
  265. package/dist/src/automations/service/automation-service.js +2 -2
  266. package/dist/src/browser/native-messaging-host.js +1 -1
  267. package/dist/src/browser/remote/endpoint-transport.js +2 -1
  268. package/dist/src/capabilities/capability-catalog.js +3 -3
  269. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  270. package/dist/src/capabilities/runtime/product.js +2 -2
  271. package/dist/src/capabilities/store-connector.js +1 -1
  272. package/dist/src/chat-commands/agent-edit.js +1 -1
  273. package/dist/src/chat-commands/builtins/config.js +1 -1
  274. package/dist/src/cli/commands/agent.js +1 -1
  275. package/dist/src/cli/commands/agents.js +1 -1
  276. package/dist/src/cli/commands/connectors.js +1 -1
  277. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  278. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  279. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  280. package/dist/src/cli/commands/init.js +1 -1
  281. package/dist/src/cli/commands/models.js +2 -2
  282. package/dist/src/cli/commands/onboard/model.js +2 -2
  283. package/dist/src/cli/commands/onboard.js +1 -1
  284. package/dist/src/cli/commands/project.js +1 -1
  285. package/dist/src/cli/commands/tunnel.js +1 -1
  286. package/dist/src/cli/extension-cli-register.js +1 -1
  287. package/dist/src/cli/utils/gateway-client.js +1 -1
  288. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  289. package/dist/src/computer/endpoint-transport.js +3 -2
  290. package/dist/src/computer/runtime.js +1 -1
  291. package/dist/src/config/config-file.js +1 -1
  292. package/dist/src/config/index.js +4 -4
  293. package/dist/src/config/loader.js +1 -1
  294. package/dist/src/config/models-json.js +2 -2
  295. package/dist/src/connectors/connected-source-ingestion.js +2 -2
  296. package/dist/src/connectors/connected-source-understanding.js +2 -2
  297. package/dist/src/connectors/content-enrichment.js +1 -1
  298. package/dist/src/connectors/health.js +1 -1
  299. package/dist/src/endpoint-tools/context-store.js +2 -1
  300. package/dist/src/endpoint-tools/delegation.js +2 -1
  301. package/dist/src/endpoint-tools/desktop-authority-response.js +2 -1
  302. package/dist/src/endpoint-tools/folder-connections.d.ts +17 -0
  303. package/dist/src/endpoint-tools/folder-connections.js +44 -0
  304. package/dist/src/endpoint-tools/grant-service.js +2 -1
  305. package/dist/src/endpoint-tools/invocation-service.js +4 -3
  306. package/dist/src/endpoint-tools/policy.js +15 -4
  307. package/dist/src/endpoint-tools/provider-catalog.js +2 -1
  308. package/dist/src/endpoint-tools/provider-operation-journal.js +2 -1
  309. package/dist/src/endpoint-tools/registry.js +2 -1
  310. package/dist/src/endpoint-tools/target-resolver.d.ts +1 -1
  311. package/dist/src/endpoint-tools/target-resolver.js +17 -2
  312. package/dist/src/endpoint-tools/task-targets.d.ts +3 -1
  313. package/dist/src/endpoint-tools/task-targets.js +4 -3
  314. package/dist/src/endpoint-tools/terminal-broker.js +2 -1
  315. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  316. package/dist/src/extensions/agent-plugins/cli-authorization.js +1 -1
  317. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  318. package/dist/src/extensions/agent-plugins/setup.js +1 -1
  319. package/dist/src/extensions/agent-plugins/skill-catalog.js +3 -3
  320. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  321. package/dist/src/extensions/agent-plugins/user-config.js +1 -1
  322. package/dist/src/extensions/agent-plugins/validation.js +2 -2
  323. package/dist/src/extensions/install.js +1 -1
  324. package/dist/src/gateway/agent-reactions/reaction.js +3 -3
  325. package/dist/src/gateway/agents-admin.js +2 -2
  326. package/dist/src/gateway/file-path-classifier.js +1 -1
  327. package/dist/src/gateway/global-defaults-admin.js +1 -1
  328. package/dist/src/gateway/hono/app.js +1 -1
  329. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  330. package/dist/src/gateway/hono/oauth-async.js +1 -1
  331. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  332. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  333. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  334. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  335. package/dist/src/gateway/hono/routes/device-connections.d.ts +3 -0
  336. package/dist/src/gateway/hono/routes/device-connections.js +198 -0
  337. package/dist/src/gateway/hono/routes/device-targets.js +32 -5
  338. package/dist/src/gateway/hono/routes/endpoint-compatibility.js +2 -0
  339. package/dist/src/gateway/hono/routes/home.js +1 -1
  340. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  341. package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
  342. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  343. package/dist/src/gateway/hono/routes/memory-learning.js +2 -2
  344. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +4 -4
  345. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +9 -9
  346. package/dist/src/gateway/hono/routes/models.js +2 -2
  347. package/dist/src/gateway/hono/routes/notes.js +2 -2
  348. package/dist/src/gateway/hono/routes/phone-setup.js +3 -3
  349. package/dist/src/gateway/hono/routes/phone.js +2 -2
  350. package/dist/src/gateway/hono/routes/projects.js +5 -5
  351. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  352. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  353. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  354. package/dist/src/gateway/hono/routes/tui.js +1 -1
  355. package/dist/src/gateway/hono/routes/user-model.js +5 -5
  356. package/dist/src/gateway/image-generation-setup.js +1 -1
  357. package/dist/src/gateway/media-access.js +1 -1
  358. package/dist/src/gateway/service/agent-runner.js +2 -2
  359. package/dist/src/gateway/service/config-coordinator.js +1 -1
  360. package/dist/src/gateway/service/marketplace-service.js +2 -2
  361. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  362. package/dist/src/gateway/service/session-command-service.js +2 -2
  363. package/dist/src/gateway/service/session-input-coordinator.js +1 -1
  364. package/dist/src/gateway/service.js +29 -29
  365. package/dist/src/gateway/session-context-summary.js +1 -1
  366. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  367. package/dist/src/home-intelligence/follow-ups.js +1 -1
  368. package/dist/src/home-intelligence/generator.js +2 -2
  369. package/dist/src/home-intelligence/host.js +5 -5
  370. package/dist/src/home-intelligence/observation.js +1 -1
  371. package/dist/src/home-intelligence/routines.js +2 -2
  372. package/dist/src/imports/importService.js +1 -1
  373. package/dist/src/imports/inventory.js +2 -2
  374. package/dist/src/imports/productImport.js +1 -1
  375. package/dist/src/knowledge-memory/repository.js +1 -1
  376. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  377. package/dist/src/local-apps/automation-proposals.js +2 -2
  378. package/dist/src/local-apps/capabilities/automation-policy.js +1 -1
  379. package/dist/src/local-apps/capabilities/delegate.js +4 -4
  380. package/dist/src/local-apps/execution-authority.js +2 -2
  381. package/dist/src/local-apps/p1-services.js +3 -3
  382. package/dist/src/local-apps/preview-worker.js +1 -1
  383. package/dist/src/local-apps/service.js +2 -2
  384. package/dist/src/mcp/gateway-http-client.js +1 -1
  385. package/dist/src/memory-learning/choice-observations.js +6 -6
  386. package/dist/src/memory-learning/source-learning.js +4 -4
  387. package/dist/src/memory-learning/task-receipts.js +1 -1
  388. package/dist/src/memory-learning/work-capture.js +1 -1
  389. package/dist/src/memory-learning/work-review.js +2 -2
  390. package/dist/src/notes/service.js +1 -1
  391. package/dist/src/personal-agent/capability-service.js +1 -1
  392. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  393. package/dist/src/personal-agent/proactivity/service.js +4 -4
  394. package/dist/src/personal-agent/prompt-context.js +4 -4
  395. package/dist/src/personal-agent/reply-composer.js +4 -4
  396. package/dist/src/personal-agent/request-delivery.js +1 -1
  397. package/dist/src/personal-agent/request-service.js +4 -4
  398. package/dist/src/personal-agent/result-reader.js +1 -1
  399. package/dist/src/personal-agent/service.js +1 -1
  400. package/dist/src/personal-agent/task-cancel.js +1 -1
  401. package/dist/src/phone/cloud-adb-connection.js +1 -1
  402. package/dist/src/projects/capabilities/write.js +2 -2
  403. package/dist/src/projects/index.js +2 -2
  404. package/dist/src/projects/project-service.js +2 -2
  405. package/dist/src/projects/workspace.js +1 -1
  406. package/dist/src/providers/model-catalog-persistence.js +1 -1
  407. package/dist/src/providers/model-registry.js +1 -1
  408. package/dist/src/session/history-recall-policy.js +2 -2
  409. package/dist/src/session/index.js +1 -1
  410. package/dist/src/session/session-title.js +1 -1
  411. package/dist/src/session/store.js +1 -1
  412. package/dist/src/share/share-thumbnail.js +1 -1
  413. package/dist/src/share/site-proxy.js +1 -1
  414. package/dist/src/storage/sqlite/desktop-execution-repository.js +2 -1
  415. package/dist/src/storage/sqlite/desktop-execution-stop-repository.js +2 -1
  416. package/dist/src/storage/sqlite/desktop-operation-repository.js +2 -1
  417. package/dist/src/tasks/capabilities/read.js +4 -4
  418. package/dist/src/tasks/capabilities/relations.js +1 -1
  419. package/dist/src/tasks/capabilities/write.js +4 -4
  420. package/dist/src/tasks/home-query-service.js +1 -1
  421. package/dist/src/tasks/index.js +2 -2
  422. package/dist/src/tasks/task-allocation-service.js +4 -4
  423. package/dist/src/tasks/task-application-service.js +2 -2
  424. package/dist/src/tasks/task-contract-planner.js +1 -1
  425. package/dist/src/tasks/task-execution-capabilities.js +1 -1
  426. package/dist/src/tasks/task-handoff-service.js +1 -1
  427. package/dist/src/tasks/task-handoff.js +6 -6
  428. package/dist/src/tasks/task-json-acceptance.js +1 -1
  429. package/dist/src/tasks/task-main-update-decision-service.js +2 -2
  430. package/dist/src/tasks/task-main-update-delivery.js +1 -1
  431. package/dist/src/tasks/task-model-call.js +1 -1
  432. package/dist/src/tasks/task-research-result.js +2 -2
  433. package/dist/src/tasks/task-result-delivery-service.js +1 -1
  434. package/dist/src/tasks/task-retry-service.js +1 -1
  435. package/dist/src/tasks/task-run-coordinator.js +4 -4
  436. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  437. package/dist/src/tui/backends/embedded-backend.js +6 -6
  438. package/dist/src/tui/tui-capabilities.js +2 -2
  439. package/dist/src/tui/tui-commands.js +2 -2
  440. package/dist/src/tui/tui-management.js +6 -6
  441. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  442. package/dist/src/tui/tui-startup-resources.js +2 -2
  443. package/dist/src/tui/tui.js +4 -4
  444. package/dist/src/user-context/access-policy.js +2 -2
  445. package/dist/src/user-model/bootstrap.js +1 -1
  446. package/dist/src/user-model/capture/executor.js +2 -2
  447. package/dist/src/user-model/index.js +2 -2
  448. package/dist/src/user-model/usage-policy.js +1 -1
  449. package/dist/src/voice/realtime/conversation-context.js +1 -1
  450. package/dist/src/voice/realtime/memory-context.js +4 -4
  451. package/dist/src/voice/realtime/persona-context.js +1 -1
  452. package/dist/src/voice/realtime/user-context.js +1 -1
  453. package/dist/src/work-discovery/service.js +6 -6
  454. package/package.json +2 -2
  455. package/dist/gateway/static/root/assets/capabilities-page-B32XFJ59.js +0 -2
  456. package/dist/gateway/static/root/assets/capabilities-settings-panel-CWnHPY8j.js +0 -8
  457. package/dist/gateway/static/root/assets/connectors-page-ywk7W0s6.js +0 -1
  458. package/dist/gateway/static/root/assets/gateway-realtime-Dzq6_piH.js +0 -1
  459. package/dist/gateway/static/root/assets/gateway-realtime-store-B9CDQ8NO.js +0 -1
  460. package/dist/gateway/static/root/assets/index-dqkMYWTd.js +0 -11
  461. package/dist/gateway/static/root/assets/index-q78xsKF3.css +0 -1
  462. package/dist/gateway/static/root/assets/management-settings-CZDWUPmg.js +0 -1
  463. package/dist/gateway/static/root/assets/note-image-lightbox-DftbeSZR.js +0 -1
  464. package/dist/gateway/static/root/assets/product-navigation-Dp-adLY_.js +0 -1
  465. package/dist/gateway/static/root/assets/route-preload-D00yB6hp.js +0 -2
  466. package/dist/gateway/static/root/assets/routine-panel-sCpXMbMl.js +0 -2
  467. package/dist/gateway/static/root/assets/settings-advanced-gate-B82UPSQS.js +0 -1
  468. package/dist/gateway/static/root/assets/share-link-dialog-CB3LkWw8.js +0 -1
  469. package/dist/gateway/static/root/assets/space-page-8BMb_g2p.js +0 -2
  470. package/dist/gateway/static/root/assets/workspace-editor-agent-store-BzuNTkZu.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/source-workspace-editor-BwYU5OEh.js","assets/vendor-react-BOUWij0V.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/languages-kF11aUYU.js","assets/binary-plugins-DnE-iqaV.js","assets/messages-lc5BjBtX.js","assets/attachment-utils-core-BPYdUI6y.js","assets/preview-open-alternatives-CY_hjK4b.js","assets/download-Dk-ZjtO6.js","assets/createLucideIcon-DPHK1VkS.js","assets/external-link-DjqjBmc3.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/interaction-BdhHBbYa.js","assets/electron-env-DHOGevH3.js","assets/use-blob-object-url-D4BFuzZB.js","assets/media-plugins-B9bQ3e1j.js","assets/archive-plugin-DFP0MajV.js","assets/jszip.min-Dj17eJqX.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{a,i as o,l as s}from"./locale-store-BYdvIuPj.js";import{t as c}from"./messages-lc5BjBtX.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{G as u,t as d}from"./markdown-view-BOJVaGPC.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./rotate-cw-LIg3Am9S.js";import{t as m}from"./search-DA7gz22f.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-DzdOeGYz.js";import{r as _}from"./turn-outcome-BSbEJx8h.js";import{a as v,c as y,o as b,r as x,t as S}from"./attachment-utils-core-BPYdUI6y.js";import{n as C}from"./electron-env-DHOGevH3.js";import{t as w}from"./use-async-resource-BHFGZCY2.js";import{a as T,c as E,d as D,m as O,n as k,r as ee,u as A}from"./workspace-api-_mQWmOZm.js";import{t as j}from"./index.module-Cd9ENXfk.js";var M=l(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]),N=l(`step-back`,[[`path`,{d:`M13.971 4.285A2 2 0 0 1 17 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`19qhus`}],[`path`,{d:`M21 20V4`,key:`cb8qj8`}]]),P=5*1024*1024,F=32*1024*1024,I=new Set(`.astro,.bat,.c,.cc,.clj,.cljs,.cljc,.cmd,.cpp,.cs,.cts,.cxx,.dart,.edn,.erl,.ex,.exs,.fish,.fs,.fsx,.go,.gql,.graphql,.groovy,.h,.hh,.hpp,.hrl,.hxx,.java,.ts,.tsx,.mts,.js,.jsx,.mjs,.cjs,.css,.scss,.sass,.less,.json,.jsonc,.json5,.yml,.yaml,.xml,.xsd,.xsl,.py,.pyw,.rb,.php,.rs,.kt,.kts,.scala,.swift,.m,.mm,.sh,.bash,.zsh,.ps1,.sql,.lua,.r,.pl,.pm,.sol,.tf,.tfvars,.nix,.proto,.vue,.svelte,.toml,.ini,.cfg,.conf,.properties`.split(`,`)),L=new Set([`.txt`,`.log`,`.lock`,`.csv`,`.tsv`,`.env`,`.gitignore`,`.gitattributes`,`.editorconfig`,`.npmrc`,`.dockerignore`,`.eslintignore`,`.prettierignore`,`.stylelintignore`]),R=new Set([`dockerfile`,`gemfile`,`jenkinsfile`,`makefile`,`procfile`,`rakefile`]),z=new Set([`brewfile`,`changelog`,`codeowners`,`license`,`readme`]),te=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.ico`,`.svg`,`.svgz`,`.tif`,`.tiff`,`.avif`,`.heic`,`.heif`,`.jxl`]),B=new Set([`.mp3`,`.wav`,`.ogg`,`.oga`,`.aac`,`.m4a`,`.flac`,`.opus`,`.weba`]),V=new Set([`.mp4`,`.webm`,`.mov`,`.m4v`,`.ogv`]),ne=new Set([`.zip`]),H=new Map([[`.pdf`,`application/pdf`],[`.docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`.pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`.xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`.xls`,`application/vnd.ms-excel`],[`.md`,`text/markdown`],[`.markdown`,`text/markdown`],[`.html`,`text/html`],[`.htm`,`text/html`],[`.json`,`application/json`],[`.txt`,`text/plain`],[`.csv`,`text/csv`],[`.tsv`,`text/tab-separated-values`],[`.png`,`image/png`],[`.jpg`,`image/jpeg`],[`.jpeg`,`image/jpeg`],[`.gif`,`image/gif`],[`.webp`,`image/webp`],[`.svg`,`image/svg+xml`],[`.svgz`,`image/svg+xml`],[`.mp3`,`audio/mpeg`],[`.wav`,`audio/wav`],[`.ogg`,`audio/ogg`],[`.mp4`,`video/mp4`],[`.webm`,`video/webm`],[`.mov`,`video/quicktime`],[`.zip`,`application/zip`]]);function U(e){let t=W(e),n=t.lastIndexOf(`.`);return n<0||n===t.length-1?``:t.slice(n).toLowerCase()}function W(e){let t=e.replace(/\\/g,`/`).split(`/`);return t[t.length-1]||e}function re(e,t){let n=t?.split(`;`)[0]?.trim().toLowerCase();return n&&n!==`application/octet-stream`?n:H.get(U(e))??n??`application/octet-stream`}function ie(e,t){let n=U(e),r=W(e).toLowerCase(),i=re(e,t);return i===`text/markdown`||n===`.md`||n===`.markdown`?`markdown`:i===`text/html`||n===`.html`||n===`.htm`?`html`:i===`application/pdf`||n===`.pdf`?`pdf`:i===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n===`.docx`?`docx`:i===`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`||i===`application/vnd.ms-excel`||n===`.xlsx`||n===`.xls`?`spreadsheet`:i===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n===`.pptx`?`pptx`:i.startsWith(`image/`)||te.has(n)?`image`:i.startsWith(`audio/`)||B.has(n)?`audio`:i.startsWith(`video/`)||V.has(n)?`video`:i===`application/zip`||ne.has(n)?`archive`:I.has(n)||R.has(r)||r.startsWith(`dockerfile.`)?`code`:i.startsWith(`text/`)||L.has(n)||z.has(r)||r.startsWith(`.env.`)||i===`application/json`?`text`:`unsupported`}function ae(e){switch(e){case`text`:case`markdown`:case`code`:case`html`:return`text`;case`unsupported`:return`metadata`;default:return`binary`}}async function G(e){let{uri:t,conversationId:n,taskId:r}=e;try{let e=_(t),i=await a(o(e?`/api/files/${encodeURIComponent(e)}/content`:y(t,n,r)));return i.ok?{ok:!0,blob:await i.blob()}:{ok:!1,reason:`http`,status:i.status}}catch(e){return{ok:!1,reason:`network`,message:e instanceof Error?e.message:String(e)}}}async function oe(e){let t=await G(e);return t.ok?{ok:!0,buffer:await t.blob.arrayBuffer()}:t}var K=n(),q=e(t(),1);function J(e){return e.id?String(e.id):`${e.name}:${e.uri??``}`}function se(){return{id:`__empty__`,context:`attachment`,fileName:``,mimeType:`application/octet-stream`,type:`unsupported`,source:{kind:`inline`}}}function Y(e){let t=(0,K.c)(65),{open:n,attachment:r,authToken:i,conversationId:a,language:o}=e,[s,l]=(0,q.useState)(n?r:null),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(!1),m;t[0]!==r||t[1]!==n?(m=n&&r?J(r):null,t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,g=(0,q.useRef)(h);h!==g.current&&(g.current=h,l(n&&r?r:null),d(!1),p(!1));let _=s,y;bb0:{if(!_){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=se(),t[3]=e):e=t[3],y=e;break bb0}let e=_.name??`attachment`,n,r;t[4]!==e||t[5]!==_.mimeType?(n=re(e,_.mimeType),r=ie(e,n),t[4]=e,t[5]=_.mimeType,t[6]=n,t[7]=r):(n=t[6],r=t[7]);let i=r,o=_.id?String(_.id):`${e}:${_.uri??``}`,s;t[8]!==a||t[9]!==_.uri?(s=_.uri?{kind:`media-uri`,uri:_.uri,conversationId:a}:{kind:`inline`},t[8]=a,t[9]=_.uri,t[10]=s):s=t[10];let c;t[11]!==e||t[12]!==n||t[13]!==_.size||t[14]!==o||t[15]!==s||t[16]!==i?(c={id:o,context:`attachment`,fileName:e,mimeType:n,size:_.size,type:i,source:s},t[11]=e,t[12]=n,t[13]=_.size,t[14]=o,t[15]=s,t[16]=i,t[17]=c):c=t[17],y=c}let b=y,S;t[18]===_?S=t[19]:(S=_?v(_):void 0,t[18]=_,t[19]=S);let C=S,T=_?.uri,E;t[20]===b.type?E=t[21]:(E=ae(b.type),t[20]=b.type,t[21]=E);let D=E,O=!!(n&&T&&!C&&i&&(D===`binary`||D===`text`)),k;t[22]!==a||t[23]!==o||t[24]!==T||t[25]!==_?.taskId?(k=async()=>{let e=c(o).chat,t=await oe({uri:T,conversationId:a,taskId:_?.taskId});if(!t.ok)throw t.reason===`http`?Error(`${e.attachmentPreviewLoadError} (HTTP ${t.status})`):Error(t.message);return t.buffer},t[22]=a,t[23]=o,t[24]=T,t[25]=_?.taskId,t[26]=k):k=t[26];let ee=_?.taskId,A;t[27]!==i||t[28]!==a||t[29]!==C||t[30]!==o||t[31]!==T||t[32]!==n||t[33]!==D||t[34]!==ee?(A=[n,T,i,o,C,ee,a,D],t[27]=i,t[28]=a,t[29]=C,t[30]=o,t[31]=T,t[32]=n,t[33]=D,t[34]=ee,t[35]=A):A=t[35];let j;t[36]===O?j=t[37]:(j={enabled:O,initial:null,errorData:null},t[36]=O,t[37]=j);let M=w(k,A,j),N;bb1:{if(C)try{let e;t[38]===C?e=t[39]:(e=x(C),t[38]=C,t[39]=e),N=e;break bb1}catch{N=null;break bb1}if(O&&M.loading){N=null;break bb1}N=M.data??null}let P=N,F=D===`binary`?P:null,I=_?.extractedText??``,L;t[40]!==P||t[41]!==I||t[42]!==o||t[43]!==D?(L=D===`text`?I||(P?new TextDecoder(`utf-8`,{fatal:!1}).decode(new Uint8Array(P)):c(o).chat.attachmentPreviewNoText):null,t[40]=P,t[41]=I,t[42]=o,t[43]=D,t[44]=L):L=t[44];let R=L,z=!!_?.extractedText,te=b.type===`pptx`&&I.length>3e5,B;t[45]!==i||t[46]!==C||t[47]!==o||t[48]!==T||t[49]!==n||t[50]!==D?(B=n&&T&&!C&&!i&&D===`binary`?c(o).chat.attachmentPreviewMissingAuth:null,t[45]=i,t[46]=C,t[47]=o,t[48]=T,t[49]=n,t[50]=D,t[51]=B):B=t[51];let V=B,ne=M.error?M.error instanceof Error?M.error.message:String(M.error):null,H=f?null:V??ne,U=O?M.loading:!1,W;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>p(!0),t[52]=W):W=t[52];let G=I||null,Y;return t[53]!==F||t[54]!==b||t[55]!==P||t[56]!==te||t[57]!==z||t[58]!==H||t[59]!==_||t[60]!==u||t[61]!==U||t[62]!==G||t[63]!==R?(Y={preview:_,descriptor:b,fileType:b.type,fileName:b.fileName,loading:U,loadError:H,clearLoadError:W,textContent:R,binaryBuffer:F,downloadBuffer:P,hasExtractedText:z,extractedText:G,extractedTextTruncated:te,showExtractedText:u,setShowExtractedText:d},t[53]=F,t[54]=b,t[55]=P,t[56]=te,t[57]=z,t[58]=H,t[59]=_,t[60]=u,t[61]=U,t[62]=G,t[63]=R,t[64]=Y):Y=t[64],Y}function ce(e){let t=(0,K.c)(12),{projectId:n,conversationId:r,agentId:i}=e,a;bb0:{let e;t[0]===n?e=t[1]:(e=n?.trim(),t[0]=n,t[1]=e);let o=e;if(o){let e;t[2]===o?e=t[3]:(e={projectId:o},t[2]=o,t[3]=e),a=e;break bb0}let s;t[4]===r?s=t[5]:(s=r?.trim(),t[4]=r,t[5]=s);let c=s;if(c){let e;t[6]===c?e=t[7]:(e={conversationId:c},t[6]=c,t[7]=e),a=e;break bb0}let l;t[8]===i?l=t[9]:(l=i?.trim(),t[8]=i,t[9]=l);let u=l,d;t[10]===u?d=t[11]:(d=u?{agentId:u}:void 0,t[10]=u,t[11]=d),a=d}return a}function le(e){return{descriptor:e,textContent:null,binaryBuffer:null,fileResourceId:null,mtimeMs:null,loadError:null,loading:!1,pptxText:null,pptxTruncated:!1,pptxError:null}}function ue(e,t){switch(t.type){case`clear`:return le(t.descriptor);case`loadStart`:return{...le(t.descriptor),loading:!0};case`loadSuccess`:return{...e,descriptor:t.payload.descriptor,textContent:t.payload.textContent??null,binaryBuffer:t.payload.binaryBuffer??null,fileResourceId:t.payload.fileResourceId??null,mtimeMs:t.payload.mtimeMs??null,loadError:null,loading:!1};case`loadError`:return{...le(t.descriptor),loadError:t.error};case`patchMtime`:return{...e,mtimeMs:t.mtimeMs};case`patchText`:return{...e,textContent:t.text};case`pptxClear`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:null};case`pptxSuccess`:return{...e,pptxText:t.text,pptxTruncated:t.truncated,pptxError:null};case`pptxError`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:t.error}}}function de(e,t){switch(t.type){case`reset`:return{sourceEditMode:!1,saveStatus:`idle`};case`source`:return{...e,sourceEditMode:typeof t.value==`function`?t.value(e.sourceEditMode):t.value};case`saveStatus`:return{...e,saveStatus:t.value}}}function fe({filePath:e,projectId:t,conversationId:n,agentId:r,resolvedFile:a,initialEditMode:o=!1}){let s=ce({projectId:t,conversationId:n,agentId:r}),c=(0,q.useMemo)(()=>{let t=e?W(e):``,i=re(t,b(t)),a=e?ie(t,i):`unsupported`;return{id:e||`__empty__`,context:`workspace`,fileName:t,mimeType:i,type:a,source:{kind:`workspace`,path:e||``,conversationId:n,agentId:r}}},[r,e,n]),[l,u]=(0,q.useReducer)(ue,c,le),[d,f]=(0,q.useReducer)(de,{sourceEditMode:o,saveStatus:`idle`}),[p,m]=(0,q.useState)([]),[h,g]=(0,q.useState)([]),_=(0,q.useRef)(e),v=(0,q.useRef)(void 0),y=(0,q.useRef)(null),x=(0,q.useRef)(null),w=(0,q.useRef)(null),[M,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(!1),[I,L]=(0,q.useState)(0);_.current!==e&&(_.current=e,f({type:`reset`})),(0,q.useEffect)(()=>{if(!e){u({type:`clear`,descriptor:c});return}let t=!1;u({type:`loadStart`,descriptor:c});let n=ae(c.type),r=e=>{t||u({type:`loadError`,descriptor:c,error:e instanceof Error?e.message:String(e)})};return n===`metadata`?(Promise.all([D(e,s).catch(()=>null),A(e,s).catch(()=>null)]).then(async([n,r])=>{if(!n){t||u({type:`loadSuccess`,payload:{descriptor:c,fileResourceId:r?.fileId??null,mtimeMs:typeof r?.mtimeMs==`number`?r.mtimeMs:null}});return}let i={...c,mimeType:n.mimeType,type:ie(n.name,n.mimeType)};if(ae(i.type)===`text`){let{content:r,mtimeMs:a,revision:o}=await E(e,s);t||(v.current=o,y.current=r,x.current=r,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:i,textContent:r,fileResourceId:n.id,mtimeMs:typeof a==`number`?a:n.modifiedAt}});return}t||u({type:`loadSuccess`,payload:{descriptor:i,fileResourceId:n.id,mtimeMs:n.modifiedAt}})}).catch(r),()=>{t=!0}):(n===`text`?E(e,s,I===0?a:void 0).then(({content:e,mtimeMs:n,revision:r,fileId:i})=>{t||(v.current=r,y.current=e,x.current=e,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:c,textContent:e,fileResourceId:i??null,mtimeMs:typeof n==`number`?n:null}})}).catch(r):Promise.all([T(e,s),A(e,s).catch(()=>null)]).then(async([e,n])=>{let r=await e.arrayBuffer();t||u({type:`loadSuccess`,payload:{descriptor:c,binaryBuffer:r,fileResourceId:n?.fileId??null,mtimeMs:typeof n?.mtimeMs==`number`?n.mtimeMs:null}})}).catch(r),()=>{t=!0})},[c,e,s,I,a]),(0,q.useEffect)(()=>{if(!l.binaryBuffer||l.descriptor.type!==`pptx`){u({type:`pptxClear`});return}let e=!1;return u({type:`pptxClear`}),i(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(l.binaryBuffer,l.descriptor.fileName)),__vite__mapDeps([0,1,2,3])).then(({extractedText:t})=>{if(e)return;let n=t.length>S;u({type:`pptxSuccess`,text:n?t.slice(0,S):t,truncated:n})}).catch(t=>{e||u({type:`pptxError`,error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type]);let R=(0,q.useCallback)(async()=>{if(w.current&&!await w.current)return!1;if(!e||y.current===null||y.current===x.current)return!0;let t=(async()=>{f({type:`saveStatus`,value:`saving`});try{for(;y.current!==x.current;){let t=y.current,n=await O(e,t,s,v.current);v.current=n.revision,x.current=t,typeof n.mtimeMs==`number`&&u({type:`patchMtime`,mtimeMs:n.mtimeMs})}return N(!1),f({type:`saveStatus`,value:`saved`}),!0}catch{return f({type:`saveStatus`,value:`error`}),!1}})();w.current=t;try{return await t}finally{w.current===t&&(w.current=null)}},[e,s]),z=j(()=>void R(),500),te=(0,q.useCallback)(e=>{y.current=e,N(e!==x.current),u({type:`patchText`,text:e}),z()},[z]);(0,q.useEffect)(()=>{let e=e=>{y.current!==x.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),z.cancel()}},[z]);let B=(0,q.useCallback)(()=>{!M&&!w.current&&L(e=>e+1)},[M]),V=(0,q.useRef)(!1),ne=(0,q.useCallback)(async()=>{if(!(!e||l.loading||w.current||V.current)){V.current=!0;try{let t=await D(e,s);if(!t||!(v.current?t.revision!==v.current:l.mtimeMs!=null&&t.modifiedAt!==l.mtimeMs))return;M||d.sourceEditMode?F(!0):B()}catch{F(!0)}finally{V.current=!1}}},[M,d.sourceEditMode,e,l.loading,l.mtimeMs,s,B]),H=(0,q.useCallback)(async()=>{if(!e)return;let t=W(e);if(l.binaryBuffer){k(t,l.binaryBuffer,l.descriptor.mimeType||`application/octet-stream`);return}if(l.textContent!=null){ee(t,l.textContent);return}let n=await T(e,s);k(t,await n.arrayBuffer(),l.descriptor.mimeType||n.type||`application/octet-stream`)},[e,l.binaryBuffer,l.descriptor.mimeType,l.textContent,s]),U=(0,q.useCallback)(async()=>{if(!e)throw Error(`No workspace file selected`);let t=W(e),n=l.descriptor.mimeType||`application/octet-stream`,r;return r=l.binaryBuffer?new Blob([l.binaryBuffer],{type:n}):l.textContent==null?await T(e,s):new Blob([l.textContent],{type:n}),new File([r],t,{type:l.descriptor.mimeType||r.type||`application/octet-stream`,lastModified:l.mtimeMs??Date.now()})},[e,l.binaryBuffer,l.descriptor.mimeType,l.mtimeMs,l.textContent,s]),G=!l.loading&&!!e,oe=C()&&(!!l.fileResourceId&&!!window.electronAPI?.shell?.openFileResource||l.descriptor.type===`spreadsheet`&&!!l.binaryBuffer&&!!window.electronAPI?.shell?.openTemporaryFile),K=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.chooseAppAndOpenFileResource,J=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!C()||!e||!window.electronAPI?.shell?.getOpenWithAppsForFileResource){g([]),m([]);return}try{let t=await window.electronAPI.shell.getOpenWithAppsForFileResource(e);g(t.recommended.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl}))),m(t.recent.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl,lastUsedAt:e.lastUsedAt})))}catch{g([]),m([])}},[l.fileResourceId]);(0,q.useEffect)(()=>{J()},[J]);let se=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.openFileResource)return window.electronAPI.shell.openFileResource(e);if(l.descriptor.type===`spreadsheet`&&l.binaryBuffer&&window.electronAPI?.shell?.openTemporaryFile)return window.electronAPI.shell.openTemporaryFile({fileName:l.descriptor.fileName,data:new Uint8Array(l.binaryBuffer)})},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type,l.fileResourceId]),Y=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!e||!window.electronAPI?.shell?.chooseAppAndOpenFileResource)return;let t=await window.electronAPI.shell.chooseAppAndOpenFileResource(e);return t.ok&&J(),t},[l.fileResourceId,J]),fe=(0,q.useCallback)(async e=>{let t=l.fileResourceId;if(!t||!e||!window.electronAPI?.shell?.openFileResourceWithApp)return;let n=await window.electronAPI.shell.openFileResourceWithApp(t,e);return n.ok&&J(),n},[l.fileResourceId,J]),X=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.showFileResourceInFolder,pe=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.showFileResourceInFolder)return window.electronAPI.shell.showFileResourceInFolder(e)},[l.fileResourceId]);return{...l,dirty:M,externalChange:P,flushSource:R,refresh:B,checkForUpdates:ne,extractedText:l.descriptor.type===`pptx`?l.pptxText:null,extractedTextTruncated:l.pptxTruncated,sourceEditMode:d.sourceEditMode,setSourceEditMode:e=>f({type:`source`,value:e}),saveStatus:d.saveStatus,onSourceChange:te,onDownload:H,createAttachmentFile:U,canDownload:G,canOpenWithSystemApp:oe,onOpenWithSystemApp:se,canChooseOpenWithApp:K,onChooseOpenWithApp:Y,recommendedOpenWithApps:h,recentOpenWithApps:p,onOpenWithRecentApp:fe,canRevealInFolder:X,onRevealInFolder:pe}}var X=new Map;function pe(e){return X.get(e)??{zoom:1,rotation:0,page:1,pageCount:null,searchQuery:``,scroll:[]}}function me(e,t){let n={...pe(e),...t};for(X.delete(e),X.set(e,n);X.size>100;)X.delete(X.keys().next().value)}s.subscribe((e,t)=>{(e.baseUrl!==t.baseUrl||e.conversationId!==t.conversationId)&&X.clear()});var he=120*1e3,Z=new Map;function ge(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function _e(e){for(let[t,n]of Z)n.expiresAt<=e&&Z.delete(t)}function ve(e,t=Date.now()){_e(t);let n=ge();return Z.set(n,{file:e,name:e.name,type:e.type,expiresAt:t+he}),n}function ye(e,t=Date.now()){let n=Z.get(e);return n?n.expiresAt<=t?(Z.delete(e),null):{name:n.name,type:n.type}:null}function be(e,t=Date.now()){let n=Z.get(e);if(!n)return null;if(n.expiresAt<=t)return Z.delete(e),null;if(!n.file)return null;let r=n.file;return n.file=null,r}var xe=`<script>
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/source-workspace-editor-BwYU5OEh.js","assets/vendor-react-BOUWij0V.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/languages-kF11aUYU.js","assets/binary-plugins-D_zw0TgG.js","assets/messages-C7QSnTdg.js","assets/attachment-utils-core-BPYdUI6y.js","assets/preview-open-alternatives-CY_hjK4b.js","assets/download-Dk-ZjtO6.js","assets/createLucideIcon-DPHK1VkS.js","assets/external-link-DjqjBmc3.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/interaction-BdhHBbYa.js","assets/electron-env-DHOGevH3.js","assets/use-blob-object-url-D4BFuzZB.js","assets/media-plugins-C78NkHfB.js","assets/archive-plugin-CQ5UXgZk.js","assets/jszip.min-Dj17eJqX.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{a,i as o,l as s}from"./locale-store-CHjsq5NR.js";import{t as c}from"./messages-C7QSnTdg.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{G as u,t as d}from"./markdown-view-ihzUc4ud.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./rotate-cw-LIg3Am9S.js";import{t as m}from"./search-DA7gz22f.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-DzdOeGYz.js";import{r as _}from"./turn-outcome-BSbEJx8h.js";import{a as v,c as y,o as b,r as x,t as S}from"./attachment-utils-core-BPYdUI6y.js";import{n as C}from"./electron-env-DHOGevH3.js";import{t as w}from"./use-async-resource-BHFGZCY2.js";import{a as T,c as E,d as D,m as O,n as k,r as ee,u as A}from"./workspace-api-C8-p66T-.js";import{t as j}from"./index.module-Cd9ENXfk.js";var M=l(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]),N=l(`step-back`,[[`path`,{d:`M13.971 4.285A2 2 0 0 1 17 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`19qhus`}],[`path`,{d:`M21 20V4`,key:`cb8qj8`}]]),P=5*1024*1024,F=32*1024*1024,I=new Set(`.astro,.bat,.c,.cc,.clj,.cljs,.cljc,.cmd,.cpp,.cs,.cts,.cxx,.dart,.edn,.erl,.ex,.exs,.fish,.fs,.fsx,.go,.gql,.graphql,.groovy,.h,.hh,.hpp,.hrl,.hxx,.java,.ts,.tsx,.mts,.js,.jsx,.mjs,.cjs,.css,.scss,.sass,.less,.json,.jsonc,.json5,.yml,.yaml,.xml,.xsd,.xsl,.py,.pyw,.rb,.php,.rs,.kt,.kts,.scala,.swift,.m,.mm,.sh,.bash,.zsh,.ps1,.sql,.lua,.r,.pl,.pm,.sol,.tf,.tfvars,.nix,.proto,.vue,.svelte,.toml,.ini,.cfg,.conf,.properties`.split(`,`)),L=new Set([`.txt`,`.log`,`.lock`,`.csv`,`.tsv`,`.env`,`.gitignore`,`.gitattributes`,`.editorconfig`,`.npmrc`,`.dockerignore`,`.eslintignore`,`.prettierignore`,`.stylelintignore`]),R=new Set([`dockerfile`,`gemfile`,`jenkinsfile`,`makefile`,`procfile`,`rakefile`]),z=new Set([`brewfile`,`changelog`,`codeowners`,`license`,`readme`]),te=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.ico`,`.svg`,`.svgz`,`.tif`,`.tiff`,`.avif`,`.heic`,`.heif`,`.jxl`]),B=new Set([`.mp3`,`.wav`,`.ogg`,`.oga`,`.aac`,`.m4a`,`.flac`,`.opus`,`.weba`]),V=new Set([`.mp4`,`.webm`,`.mov`,`.m4v`,`.ogv`]),ne=new Set([`.zip`]),H=new Map([[`.pdf`,`application/pdf`],[`.docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`.pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`.xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`.xls`,`application/vnd.ms-excel`],[`.md`,`text/markdown`],[`.markdown`,`text/markdown`],[`.html`,`text/html`],[`.htm`,`text/html`],[`.json`,`application/json`],[`.txt`,`text/plain`],[`.csv`,`text/csv`],[`.tsv`,`text/tab-separated-values`],[`.png`,`image/png`],[`.jpg`,`image/jpeg`],[`.jpeg`,`image/jpeg`],[`.gif`,`image/gif`],[`.webp`,`image/webp`],[`.svg`,`image/svg+xml`],[`.svgz`,`image/svg+xml`],[`.mp3`,`audio/mpeg`],[`.wav`,`audio/wav`],[`.ogg`,`audio/ogg`],[`.mp4`,`video/mp4`],[`.webm`,`video/webm`],[`.mov`,`video/quicktime`],[`.zip`,`application/zip`]]);function U(e){let t=W(e),n=t.lastIndexOf(`.`);return n<0||n===t.length-1?``:t.slice(n).toLowerCase()}function W(e){let t=e.replace(/\\/g,`/`).split(`/`);return t[t.length-1]||e}function re(e,t){let n=t?.split(`;`)[0]?.trim().toLowerCase();return n&&n!==`application/octet-stream`?n:H.get(U(e))??n??`application/octet-stream`}function ie(e,t){let n=U(e),r=W(e).toLowerCase(),i=re(e,t);return i===`text/markdown`||n===`.md`||n===`.markdown`?`markdown`:i===`text/html`||n===`.html`||n===`.htm`?`html`:i===`application/pdf`||n===`.pdf`?`pdf`:i===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n===`.docx`?`docx`:i===`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`||i===`application/vnd.ms-excel`||n===`.xlsx`||n===`.xls`?`spreadsheet`:i===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n===`.pptx`?`pptx`:i.startsWith(`image/`)||te.has(n)?`image`:i.startsWith(`audio/`)||B.has(n)?`audio`:i.startsWith(`video/`)||V.has(n)?`video`:i===`application/zip`||ne.has(n)?`archive`:I.has(n)||R.has(r)||r.startsWith(`dockerfile.`)?`code`:i.startsWith(`text/`)||L.has(n)||z.has(r)||r.startsWith(`.env.`)||i===`application/json`?`text`:`unsupported`}function ae(e){switch(e){case`text`:case`markdown`:case`code`:case`html`:return`text`;case`unsupported`:return`metadata`;default:return`binary`}}async function G(e){let{uri:t,conversationId:n,taskId:r}=e;try{let e=_(t),i=await a(o(e?`/api/files/${encodeURIComponent(e)}/content`:y(t,n,r)));return i.ok?{ok:!0,blob:await i.blob()}:{ok:!1,reason:`http`,status:i.status}}catch(e){return{ok:!1,reason:`network`,message:e instanceof Error?e.message:String(e)}}}async function oe(e){let t=await G(e);return t.ok?{ok:!0,buffer:await t.blob.arrayBuffer()}:t}var K=n(),q=e(t(),1);function J(e){return e.id?String(e.id):`${e.name}:${e.uri??``}`}function se(){return{id:`__empty__`,context:`attachment`,fileName:``,mimeType:`application/octet-stream`,type:`unsupported`,source:{kind:`inline`}}}function Y(e){let t=(0,K.c)(65),{open:n,attachment:r,authToken:i,conversationId:a,language:o}=e,[s,l]=(0,q.useState)(n?r:null),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(!1),m;t[0]!==r||t[1]!==n?(m=n&&r?J(r):null,t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,g=(0,q.useRef)(h);h!==g.current&&(g.current=h,l(n&&r?r:null),d(!1),p(!1));let _=s,y;bb0:{if(!_){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=se(),t[3]=e):e=t[3],y=e;break bb0}let e=_.name??`attachment`,n,r;t[4]!==e||t[5]!==_.mimeType?(n=re(e,_.mimeType),r=ie(e,n),t[4]=e,t[5]=_.mimeType,t[6]=n,t[7]=r):(n=t[6],r=t[7]);let i=r,o=_.id?String(_.id):`${e}:${_.uri??``}`,s;t[8]!==a||t[9]!==_.uri?(s=_.uri?{kind:`media-uri`,uri:_.uri,conversationId:a}:{kind:`inline`},t[8]=a,t[9]=_.uri,t[10]=s):s=t[10];let c;t[11]!==e||t[12]!==n||t[13]!==_.size||t[14]!==o||t[15]!==s||t[16]!==i?(c={id:o,context:`attachment`,fileName:e,mimeType:n,size:_.size,type:i,source:s},t[11]=e,t[12]=n,t[13]=_.size,t[14]=o,t[15]=s,t[16]=i,t[17]=c):c=t[17],y=c}let b=y,S;t[18]===_?S=t[19]:(S=_?v(_):void 0,t[18]=_,t[19]=S);let C=S,T=_?.uri,E;t[20]===b.type?E=t[21]:(E=ae(b.type),t[20]=b.type,t[21]=E);let D=E,O=!!(n&&T&&!C&&i&&(D===`binary`||D===`text`)),k;t[22]!==a||t[23]!==o||t[24]!==T||t[25]!==_?.taskId?(k=async()=>{let e=c(o).chat,t=await oe({uri:T,conversationId:a,taskId:_?.taskId});if(!t.ok)throw t.reason===`http`?Error(`${e.attachmentPreviewLoadError} (HTTP ${t.status})`):Error(t.message);return t.buffer},t[22]=a,t[23]=o,t[24]=T,t[25]=_?.taskId,t[26]=k):k=t[26];let ee=_?.taskId,A;t[27]!==i||t[28]!==a||t[29]!==C||t[30]!==o||t[31]!==T||t[32]!==n||t[33]!==D||t[34]!==ee?(A=[n,T,i,o,C,ee,a,D],t[27]=i,t[28]=a,t[29]=C,t[30]=o,t[31]=T,t[32]=n,t[33]=D,t[34]=ee,t[35]=A):A=t[35];let j;t[36]===O?j=t[37]:(j={enabled:O,initial:null,errorData:null},t[36]=O,t[37]=j);let M=w(k,A,j),N;bb1:{if(C)try{let e;t[38]===C?e=t[39]:(e=x(C),t[38]=C,t[39]=e),N=e;break bb1}catch{N=null;break bb1}if(O&&M.loading){N=null;break bb1}N=M.data??null}let P=N,F=D===`binary`?P:null,I=_?.extractedText??``,L;t[40]!==P||t[41]!==I||t[42]!==o||t[43]!==D?(L=D===`text`?I||(P?new TextDecoder(`utf-8`,{fatal:!1}).decode(new Uint8Array(P)):c(o).chat.attachmentPreviewNoText):null,t[40]=P,t[41]=I,t[42]=o,t[43]=D,t[44]=L):L=t[44];let R=L,z=!!_?.extractedText,te=b.type===`pptx`&&I.length>3e5,B;t[45]!==i||t[46]!==C||t[47]!==o||t[48]!==T||t[49]!==n||t[50]!==D?(B=n&&T&&!C&&!i&&D===`binary`?c(o).chat.attachmentPreviewMissingAuth:null,t[45]=i,t[46]=C,t[47]=o,t[48]=T,t[49]=n,t[50]=D,t[51]=B):B=t[51];let V=B,ne=M.error?M.error instanceof Error?M.error.message:String(M.error):null,H=f?null:V??ne,U=O?M.loading:!1,W;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>p(!0),t[52]=W):W=t[52];let G=I||null,Y;return t[53]!==F||t[54]!==b||t[55]!==P||t[56]!==te||t[57]!==z||t[58]!==H||t[59]!==_||t[60]!==u||t[61]!==U||t[62]!==G||t[63]!==R?(Y={preview:_,descriptor:b,fileType:b.type,fileName:b.fileName,loading:U,loadError:H,clearLoadError:W,textContent:R,binaryBuffer:F,downloadBuffer:P,hasExtractedText:z,extractedText:G,extractedTextTruncated:te,showExtractedText:u,setShowExtractedText:d},t[53]=F,t[54]=b,t[55]=P,t[56]=te,t[57]=z,t[58]=H,t[59]=_,t[60]=u,t[61]=U,t[62]=G,t[63]=R,t[64]=Y):Y=t[64],Y}function ce(e){let t=(0,K.c)(12),{projectId:n,conversationId:r,agentId:i}=e,a;bb0:{let e;t[0]===n?e=t[1]:(e=n?.trim(),t[0]=n,t[1]=e);let o=e;if(o){let e;t[2]===o?e=t[3]:(e={projectId:o},t[2]=o,t[3]=e),a=e;break bb0}let s;t[4]===r?s=t[5]:(s=r?.trim(),t[4]=r,t[5]=s);let c=s;if(c){let e;t[6]===c?e=t[7]:(e={conversationId:c},t[6]=c,t[7]=e),a=e;break bb0}let l;t[8]===i?l=t[9]:(l=i?.trim(),t[8]=i,t[9]=l);let u=l,d;t[10]===u?d=t[11]:(d=u?{agentId:u}:void 0,t[10]=u,t[11]=d),a=d}return a}function le(e){return{descriptor:e,textContent:null,binaryBuffer:null,fileResourceId:null,mtimeMs:null,loadError:null,loading:!1,pptxText:null,pptxTruncated:!1,pptxError:null}}function ue(e,t){switch(t.type){case`clear`:return le(t.descriptor);case`loadStart`:return{...le(t.descriptor),loading:!0};case`loadSuccess`:return{...e,descriptor:t.payload.descriptor,textContent:t.payload.textContent??null,binaryBuffer:t.payload.binaryBuffer??null,fileResourceId:t.payload.fileResourceId??null,mtimeMs:t.payload.mtimeMs??null,loadError:null,loading:!1};case`loadError`:return{...le(t.descriptor),loadError:t.error};case`patchMtime`:return{...e,mtimeMs:t.mtimeMs};case`patchText`:return{...e,textContent:t.text};case`pptxClear`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:null};case`pptxSuccess`:return{...e,pptxText:t.text,pptxTruncated:t.truncated,pptxError:null};case`pptxError`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:t.error}}}function de(e,t){switch(t.type){case`reset`:return{sourceEditMode:!1,saveStatus:`idle`};case`source`:return{...e,sourceEditMode:typeof t.value==`function`?t.value(e.sourceEditMode):t.value};case`saveStatus`:return{...e,saveStatus:t.value}}}function fe({filePath:e,projectId:t,conversationId:n,agentId:r,resolvedFile:a,initialEditMode:o=!1}){let s=ce({projectId:t,conversationId:n,agentId:r}),c=(0,q.useMemo)(()=>{let t=e?W(e):``,i=re(t,b(t)),a=e?ie(t,i):`unsupported`;return{id:e||`__empty__`,context:`workspace`,fileName:t,mimeType:i,type:a,source:{kind:`workspace`,path:e||``,conversationId:n,agentId:r}}},[r,e,n]),[l,u]=(0,q.useReducer)(ue,c,le),[d,f]=(0,q.useReducer)(de,{sourceEditMode:o,saveStatus:`idle`}),[p,m]=(0,q.useState)([]),[h,g]=(0,q.useState)([]),_=(0,q.useRef)(e),v=(0,q.useRef)(void 0),y=(0,q.useRef)(null),x=(0,q.useRef)(null),w=(0,q.useRef)(null),[M,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(!1),[I,L]=(0,q.useState)(0);_.current!==e&&(_.current=e,f({type:`reset`})),(0,q.useEffect)(()=>{if(!e){u({type:`clear`,descriptor:c});return}let t=!1;u({type:`loadStart`,descriptor:c});let n=ae(c.type),r=e=>{t||u({type:`loadError`,descriptor:c,error:e instanceof Error?e.message:String(e)})};return n===`metadata`?(Promise.all([D(e,s).catch(()=>null),A(e,s).catch(()=>null)]).then(async([n,r])=>{if(!n){t||u({type:`loadSuccess`,payload:{descriptor:c,fileResourceId:r?.fileId??null,mtimeMs:typeof r?.mtimeMs==`number`?r.mtimeMs:null}});return}let i={...c,mimeType:n.mimeType,type:ie(n.name,n.mimeType)};if(ae(i.type)===`text`){let{content:r,mtimeMs:a,revision:o}=await E(e,s);t||(v.current=o,y.current=r,x.current=r,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:i,textContent:r,fileResourceId:n.id,mtimeMs:typeof a==`number`?a:n.modifiedAt}});return}t||u({type:`loadSuccess`,payload:{descriptor:i,fileResourceId:n.id,mtimeMs:n.modifiedAt}})}).catch(r),()=>{t=!0}):(n===`text`?E(e,s,I===0?a:void 0).then(({content:e,mtimeMs:n,revision:r,fileId:i})=>{t||(v.current=r,y.current=e,x.current=e,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:c,textContent:e,fileResourceId:i??null,mtimeMs:typeof n==`number`?n:null}})}).catch(r):Promise.all([T(e,s),A(e,s).catch(()=>null)]).then(async([e,n])=>{let r=await e.arrayBuffer();t||u({type:`loadSuccess`,payload:{descriptor:c,binaryBuffer:r,fileResourceId:n?.fileId??null,mtimeMs:typeof n?.mtimeMs==`number`?n.mtimeMs:null}})}).catch(r),()=>{t=!0})},[c,e,s,I,a]),(0,q.useEffect)(()=>{if(!l.binaryBuffer||l.descriptor.type!==`pptx`){u({type:`pptxClear`});return}let e=!1;return u({type:`pptxClear`}),i(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(l.binaryBuffer,l.descriptor.fileName)),__vite__mapDeps([0,1,2,3])).then(({extractedText:t})=>{if(e)return;let n=t.length>S;u({type:`pptxSuccess`,text:n?t.slice(0,S):t,truncated:n})}).catch(t=>{e||u({type:`pptxError`,error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type]);let R=(0,q.useCallback)(async()=>{if(w.current&&!await w.current)return!1;if(!e||y.current===null||y.current===x.current)return!0;let t=(async()=>{f({type:`saveStatus`,value:`saving`});try{for(;y.current!==x.current;){let t=y.current,n=await O(e,t,s,v.current);v.current=n.revision,x.current=t,typeof n.mtimeMs==`number`&&u({type:`patchMtime`,mtimeMs:n.mtimeMs})}return N(!1),f({type:`saveStatus`,value:`saved`}),!0}catch{return f({type:`saveStatus`,value:`error`}),!1}})();w.current=t;try{return await t}finally{w.current===t&&(w.current=null)}},[e,s]),z=j(()=>void R(),500),te=(0,q.useCallback)(e=>{y.current=e,N(e!==x.current),u({type:`patchText`,text:e}),z()},[z]);(0,q.useEffect)(()=>{let e=e=>{y.current!==x.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),z.cancel()}},[z]);let B=(0,q.useCallback)(()=>{!M&&!w.current&&L(e=>e+1)},[M]),V=(0,q.useRef)(!1),ne=(0,q.useCallback)(async()=>{if(!(!e||l.loading||w.current||V.current)){V.current=!0;try{let t=await D(e,s);if(!t||!(v.current?t.revision!==v.current:l.mtimeMs!=null&&t.modifiedAt!==l.mtimeMs))return;M||d.sourceEditMode?F(!0):B()}catch{F(!0)}finally{V.current=!1}}},[M,d.sourceEditMode,e,l.loading,l.mtimeMs,s,B]),H=(0,q.useCallback)(async()=>{if(!e)return;let t=W(e);if(l.binaryBuffer){k(t,l.binaryBuffer,l.descriptor.mimeType||`application/octet-stream`);return}if(l.textContent!=null){ee(t,l.textContent);return}let n=await T(e,s);k(t,await n.arrayBuffer(),l.descriptor.mimeType||n.type||`application/octet-stream`)},[e,l.binaryBuffer,l.descriptor.mimeType,l.textContent,s]),U=(0,q.useCallback)(async()=>{if(!e)throw Error(`No workspace file selected`);let t=W(e),n=l.descriptor.mimeType||`application/octet-stream`,r;return r=l.binaryBuffer?new Blob([l.binaryBuffer],{type:n}):l.textContent==null?await T(e,s):new Blob([l.textContent],{type:n}),new File([r],t,{type:l.descriptor.mimeType||r.type||`application/octet-stream`,lastModified:l.mtimeMs??Date.now()})},[e,l.binaryBuffer,l.descriptor.mimeType,l.mtimeMs,l.textContent,s]),G=!l.loading&&!!e,oe=C()&&(!!l.fileResourceId&&!!window.electronAPI?.shell?.openFileResource||l.descriptor.type===`spreadsheet`&&!!l.binaryBuffer&&!!window.electronAPI?.shell?.openTemporaryFile),K=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.chooseAppAndOpenFileResource,J=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!C()||!e||!window.electronAPI?.shell?.getOpenWithAppsForFileResource){g([]),m([]);return}try{let t=await window.electronAPI.shell.getOpenWithAppsForFileResource(e);g(t.recommended.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl}))),m(t.recent.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl,lastUsedAt:e.lastUsedAt})))}catch{g([]),m([])}},[l.fileResourceId]);(0,q.useEffect)(()=>{J()},[J]);let se=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.openFileResource)return window.electronAPI.shell.openFileResource(e);if(l.descriptor.type===`spreadsheet`&&l.binaryBuffer&&window.electronAPI?.shell?.openTemporaryFile)return window.electronAPI.shell.openTemporaryFile({fileName:l.descriptor.fileName,data:new Uint8Array(l.binaryBuffer)})},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type,l.fileResourceId]),Y=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!e||!window.electronAPI?.shell?.chooseAppAndOpenFileResource)return;let t=await window.electronAPI.shell.chooseAppAndOpenFileResource(e);return t.ok&&J(),t},[l.fileResourceId,J]),fe=(0,q.useCallback)(async e=>{let t=l.fileResourceId;if(!t||!e||!window.electronAPI?.shell?.openFileResourceWithApp)return;let n=await window.electronAPI.shell.openFileResourceWithApp(t,e);return n.ok&&J(),n},[l.fileResourceId,J]),X=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.showFileResourceInFolder,pe=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.showFileResourceInFolder)return window.electronAPI.shell.showFileResourceInFolder(e)},[l.fileResourceId]);return{...l,dirty:M,externalChange:P,flushSource:R,refresh:B,checkForUpdates:ne,extractedText:l.descriptor.type===`pptx`?l.pptxText:null,extractedTextTruncated:l.pptxTruncated,sourceEditMode:d.sourceEditMode,setSourceEditMode:e=>f({type:`source`,value:e}),saveStatus:d.saveStatus,onSourceChange:te,onDownload:H,createAttachmentFile:U,canDownload:G,canOpenWithSystemApp:oe,onOpenWithSystemApp:se,canChooseOpenWithApp:K,onChooseOpenWithApp:Y,recommendedOpenWithApps:h,recentOpenWithApps:p,onOpenWithRecentApp:fe,canRevealInFolder:X,onRevealInFolder:pe}}var X=new Map;function pe(e){return X.get(e)??{zoom:1,rotation:0,page:1,pageCount:null,searchQuery:``,scroll:[]}}function me(e,t){let n={...pe(e),...t};for(X.delete(e),X.set(e,n);X.size>100;)X.delete(X.keys().next().value)}s.subscribe((e,t)=>{(e.baseUrl!==t.baseUrl||e.conversationId!==t.conversationId)&&X.clear()});var he=120*1e3,Z=new Map;function ge(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function _e(e){for(let[t,n]of Z)n.expiresAt<=e&&Z.delete(t)}function ve(e,t=Date.now()){_e(t);let n=ge();return Z.set(n,{file:e,name:e.name,type:e.type,expiresAt:t+he}),n}function ye(e,t=Date.now()){let n=Z.get(e);return n?n.expiresAt<=t?(Z.delete(e),null):{name:n.name,type:n.type}:null}function be(e,t=Date.now()){let n=Z.get(e);if(!n)return null;if(n.expiresAt<=t)return Z.delete(e),null;if(!n.file)return null;let r=n.file;return n.file=null,r}var xe=`<script>
3
3
  window.addEventListener('click', (event) => {
4
4
  if (event.defaultPrevented || event.button !== 0 ||
5
5
  event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
@@ -12,4 +12,4 @@ window.addEventListener('click', (event) => {
12
12
  event.preventDefault();
13
13
  window.location.assign('about:srcdoc' + href);
14
14
  });
15
- <\/script>`;function Se(e){let t=/<head(?:\s[^>]*)?>/i.exec(e);if(t?.index!==void 0){let n=t.index+t[0].length;return`${e.slice(0,n)}${xe}${e.slice(n)}`}let n=/<html(?:\s[^>]*)?>/i.exec(e);if(n?.index!==void 0){let t=n.index+n[0].length;return`${e.slice(0,t)}<head>${xe}</head>${e.slice(t)}`}let r=/^\s*<!doctype[^>]*>/i.exec(e);return r?`${r[0]}<head>${xe}</head>${e.slice(r[0].length)}`:`<head>${xe}</head>${e}`}var Q=r();function Ce(e){let t=(0,K.c)(22),{html:n,title:r}=e,i=(0,q.useRef)(null),[a,s]=(0,q.useState)(!1),c;t[0]===n?c=t[1]:(c=Se(n),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=()=>{i.current?.contentWindow?.postMessage({type:`xopc-html-preview`,html:l},`*`)},t[2]=l,t[3]=u);let d=u,f,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=e=>{e.source===i.current?.contentWindow&&e.data?.type===`xopc-html-preview-ready`&&s(!0)};window.addEventListener(`message`,e);let t=window.setTimeout(()=>s(!0),1800);return()=>{window.removeEventListener(`message`,e),window.clearTimeout(t)}},p=[],t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,q.useEffect)(f,p);let m;t[6]===d?m=t[7]:(m=[d],t[6]=d,t[7]=m),(0,q.useEffect)(d,m);let _=!a,v;t[8]===a?v=t[9]:(v=a?null:(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 space-y-4 rounded-lg bg-surface-panel p-4`,children:[(0,Q.jsx)(g,{className:`h-5 w-1/3`}),(0,Q.jsx)(g,{className:`h-32 w-full rounded-xl`}),(0,Q.jsx)(g,{className:`h-4 w-2/3`})]}),t[8]=a,t[9]=v);let y=a?`opacity-100`:`pointer-events-none opacity-0`,b;t[10]===y?b=t[11]:(b=h(`min-h-0 w-full flex-1 rounded-lg border border-edge-subtle bg-white motion-safe:transition-opacity motion-safe:duration-150 dark:border-edge dark:bg-[#1e1e1e]`,y),t[10]=y,t[11]=b);let x=a?void 0:-1,S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=o(`/api/preview/html`),t[12]=S):S=t[12];let C;t[13]!==d||t[14]!==x||t[15]!==b||t[16]!==r?(C=(0,Q.jsx)(`iframe`,{ref:i,title:r,className:b,tabIndex:x,src:S,sandbox:`allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals`,referrerPolicy:`no-referrer`,onLoad:d}),t[13]=d,t[14]=x,t[15]=b,t[16]=r,t[17]=C):C=t[17];let w;return t[18]!==C||t[19]!==_||t[20]!==v?(w=(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 w-full flex-1 flex-col`,"aria-busy":_,children:[v,C]}),t[18]=C,t[19]=_,t[20]=v,t[21]=w):w=t[21],w}var we=(0,q.lazy)(()=>i(()=>import(`./source-workspace-editor-BwYU5OEh.js`).then(e=>({default:e.SourceWorkspaceEditor})),__vite__mapDeps([4,1,5,6,7,2])));function Te(){let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-4 py-3`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Ee(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t).toLowerCase():``}function De(e){return{".ts":`typescript`,".tsx":`tsx`,".js":`javascript`,".jsx":`jsx`,".json":`json`,".css":`css`,".yml":`yaml`,".yaml":`yaml`,".py":`python`,".go":`go`,".rs":`rust`,".sh":`bash`}[Ee(e)]??`plaintext`}function Oe(e){let t=(0,K.c)(12),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a;if(t[0]!==n){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\r\n|\n|\r/,t[2]=e):e=t[2],a=n.split(e),t[0]=n,t[1]=a}else a=t[1];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i.current?.scrollIntoView({block:`center`})},t[3]=s):s=t[3];let c;t[4]!==r||t[5]!==n?(c=[r,n],t[4]=r,t[5]=n,t[6]=c):c=t[6],(0,q.useEffect)(s,c);let l;t[7]!==o||t[8]!==r?(l=o.map((e,t)=>{let n=t+1,a=n===r;return(0,Q.jsxs)(`div`,{ref:a?i:void 0,className:a?`flex bg-accent-soft/60 text-fg`:`flex`,"data-line":n,children:[(0,Q.jsx)(`span`,{className:`w-12 shrink-0 select-none pr-3 text-right text-fg-subtle`,children:n}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:e||` `})]},n)}),t[7]=o,t[8]=r,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:(0,Q.jsx)(`div`,{className:`min-w-max font-mono text-xs leading-relaxed text-fg`,children:l})}),t[10]=l,t[11]=u),u}function ke(e){let t=(0,K.c)(6),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a,o;t[0]!==r||t[1]!==n?(a=()=>{if(!r||!i.current)return;let e=n.split(/\r?\n/,r);if(!/^#{1,6}\s/.test(e.at(-1)??``))return;let t=e.filter(Ae).length-1;i.current.querySelectorAll(`h1,h2,h3,h4,h5,h6`)[t]?.scrollIntoView({block:`nearest`})},o=[r,n],t[0]=r,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,q.useEffect)(a,o);let s;return t[4]===n?s=t[5]:(s=(0,Q.jsx)(`div`,{ref:i,className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:n})}),t[4]=n,t[5]=s),s}function Ae(e){return/^#{1,6}\s/.test(e)}function je(e,t){let n=e.textContent??``,r=e.descriptor.context===`workspace`,i=e.workspaceEditing;return r&&i?.sourceEditMode?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Q.jsx)(q.Suspense,{fallback:(0,Q.jsx)(Te,{}),children:(0,Q.jsx)(we,{fileName:e.descriptor.fileName,initialContent:n,onChange:e=>i.onSourceChange?.(e),isDark:(i.isDark??e.resolvedTheme===`dark`)===!0,lineWrap:i.sourceWordWrap===!0},e.descriptor.id)})}):t===`markdown`?(0,Q.jsx)(ke,{text:n,targetLine:e.targetLine}):t===`html`?(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:(0,Q.jsx)(Ce,{html:n,title:e.descriptor.fileName})}):e.targetLine&&e.targetLine>0?(0,Q.jsx)(Oe,{text:n,targetLine:e.targetLine}):t===`code`?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:`\`\`\`${De(e.descriptor.fileName)}\n${n}\n\`\`\``})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-fg`,children:n})})}function Me(e){return je(e,`text`)}function Ne(e){return je(e,`markdown`)}function Pe(e){return je(e,`code`)}function Fe(e){return je(e,`html`)}function Ie(){return(0,q.createElement)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`},`Loading preview...`)}function $(e,t,n,r=`binary`){let i=(0,q.lazy)(n);return{id:e,readMode:r,capabilities:t,render:e=>(0,q.createElement)(q.Suspense,{fallback:Ie()},(0,q.createElement)(i,e))}}var Le={text:{id:`text`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Me,e)},markdown:{id:`markdown`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Ne,e)},code:{id:`code`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Pe,e)},html:{id:`html`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Fe,e)},image:$(`image`,[`download`,`zoom`,`rotate`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.InteractiveImagePreview})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pdf:$(`pdf`,[`download`,`zoom`,`rotate`,`pageNavigation`,`print`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.PdfPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),docx:$(`docx`,[`download`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.DocxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),spreadsheet:$(`spreadsheet`,[`download`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.SpreadsheetPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pptx:$(`pptx`,[`download`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.PptxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),audio:$(`audio`,[`download`],()=>i(()=>import(`./media-plugins-B9bQ3e1j.js`).then(e=>({default:e.AudioPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),video:$(`video`,[`download`],()=>i(()=>import(`./media-plugins-B9bQ3e1j.js`).then(e=>({default:e.VideoPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),archive:$(`archive`,[`download`],()=>i(()=>import(`./archive-plugin-DFP0MajV.js`).then(e=>({default:e.ArchivePreviewPluginView})),__vite__mapDeps([21,1,5,9,22,11,12,13,14,15,16,17,18]))),unsupported:$(`unsupported`,[`download`],()=>i(()=>import(`./media-plugins-B9bQ3e1j.js`).then(e=>({default:e.UnsupportedPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19])),`metadata`)};function Re(e){return Le[e]??Le.unsupported}function ze(e){let t=(0,K.c)(63),{plugin:n,controls:r,onZoomIn:i,onZoomOut:a,onZoomReset:o,onRotate:s,onSearchChange:c}=e,l;t[0]===n.capabilities?l=t[1]:(l=n.capabilities.includes(`zoom`),t[0]=n.capabilities,t[1]=l);let d=l,h;t[2]===n.capabilities?h=t[3]:(h=n.capabilities.includes(`search`),t[2]=n.capabilities,t[3]=h);let g=h,_;t[4]===n.capabilities?_=t[5]:(_=n.capabilities.includes(`rotate`),t[4]=n.capabilities,t[5]=_);let v=_,y;t[6]!==r||t[7]!==n.capabilities?(y=n.capabilities.includes(`pageNavigation`)&&r.pageCount!=null&&r.pageCount>1,t[6]=r,t[7]=n.capabilities,t[8]=y):y=t[8];let b=y;if(!(d||g||v||b))return null;let x;if(t[9]!==b||t[10]!==v||t[11]!==g||t[12]!==d||t[13]!==r||t[14]!==s||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==o){let e=[];if(b){let n=r.page<=1,i;t[20]===r?i=t[21]:(i=()=>r.setPage(Math.max(1,r.page-1)),t[20]=r,t[21]=i);let a;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(N,{className:`size-3.5`}),t[22]=a):a=t[22];let o;t[23]!==n||t[24]!==i?(o=(0,Q.jsx)(Be,{label:`Previous page`,disabled:n,onClick:i,children:a}),t[23]=n,t[24]=i,t[25]=o):o=t[25];let s;t[26]!==r.page||t[27]!==r.pageCount?(s=(0,Q.jsxs)(`span`,{className:`min-w-16 px-1 text-center text-xs text-fg-muted`,children:[r.page,` / `,r.pageCount]}),t[26]=r.page,t[27]=r.pageCount,t[28]=s):s=t[28];let c=r.page>=(r.pageCount??1),l;t[29]===r?l=t[30]:(l=()=>r.setPage(Math.min(r.pageCount??r.page,r.page+1)),t[29]=r,t[30]=l);let u;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(M,{className:`size-3.5`}),t[31]=u):u=t[31];let d;t[32]!==c||t[33]!==l?(d=(0,Q.jsx)(Be,{label:`Next page`,disabled:c,onClick:l,children:u}),t[32]=c,t[33]=l,t[34]=d):d=t[34];let f;t[35]!==s||t[36]!==d||t[37]!==o?(f=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[o,s,d]},`page`),t[35]=s,t[36]=d,t[37]=o,t[38]=f):f=t[38],e.push(f)}if(d){let n;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`size-3.5`}),t[39]=n):n=t[39];let s;t[40]===a?s=t[41]:(s=(0,Q.jsx)(Be,{label:`Zoom out`,onClick:a,children:n}),t[40]=a,t[41]=s);let c;t[42]===r.zoom?c=t[43]:(c=Math.round(r.zoom*100),t[42]=r.zoom,t[43]=c);let l;t[44]!==o||t[45]!==c?(l=(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-14 rounded px-1.5 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:o,title:`Reset zoom`,children:[c,`%`]}),t[44]=o,t[45]=c,t[46]=l):l=t[46];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(f,{className:`size-3.5`}),t[47]=d):d=t[47];let p;t[48]===i?p=t[49]:(p=(0,Q.jsx)(Be,{label:`Zoom in`,onClick:i,children:d}),t[48]=i,t[49]=p);let m;t[50]!==p||t[51]!==s||t[52]!==l?(m=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[s,l,p]},`zoom`),t[50]=p,t[51]=s,t[52]=l,t[53]=m):m=t[53],e.push(m)}if(v){let n;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(p,{className:`size-3.5`}),t[54]=n):n=t[54];let r;t[55]===s?r=t[56]:(r=(0,Q.jsx)(Be,{label:`Rotate`,onClick:s,children:n},`rotate`),t[55]=s,t[56]=r),e.push(r)}if(g){let n;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[57]=n):n=t[57];let i;t[58]===c?i=t[59]:(i=e=>c(e.target.value),t[58]=c,t[59]=i);let a;t[60]!==r.searchQuery||t[61]!==i?(a=(0,Q.jsxs)(`label`,{className:`flex min-w-40 items-center gap-1 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs text-fg-muted dark:border-edge`,children:[n,(0,Q.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:r.searchQuery,onChange:i,placeholder:`Search`})]},`search`),t[60]=r.searchQuery,t[61]=i,t[62]=a):a=t[62],e.push(a)}x=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:e}),t[9]=b,t[10]=v,t[11]=g,t[12]=d,t[13]=r,t[14]=s,t[15]=c,t[16]=i,t[17]=a,t[18]=o,t[19]=x}else x=t[19];return x}function Be(e){let t=(0,K.c)(6),{label:n,disabled:r,onClick:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=h(`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-40`),t[0]=o):o=t[0];let s;return t[1]!==a||t[2]!==r||t[3]!==n||t[4]!==i?(s=(0,Q.jsx)(`button`,{type:`button`,className:o,title:n,"aria-label":n,disabled:r,onClick:i,children:a}),t[1]=a,t[2]=r,t[3]=n,t[4]=i,t[5]=s):s=t[5],s}function Ve(e){let t=Re(e.type),n=pe(e.id),[r,i]=(0,q.useState)(n.zoom),[a,o]=(0,q.useState)(n.rotation),[s,c]=(0,q.useState)(n.page),[l,u]=(0,q.useState)(n.pageCount),[d,f]=(0,q.useState)(n.searchQuery),p=(0,q.useCallback)(e=>{c(Math.max(1,Math.min(l??e,Math.floor(e))))},[l]);(0,q.useEffect)(()=>{let t=pe(e.id);i(t.zoom),o(t.rotation),c(t.page),u(t.pageCount),f(t.searchQuery)},[e.id,e.type]);let m=(0,q.useRef)({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d});return m.current={zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d},(0,q.useEffect)(()=>()=>me(e.id,m.current),[e.id]),{plugin:t,controls:(0,q.useMemo)(()=>({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d,setPageCount:u,setPage:p}),[s,l,a,d,p,r]),onZoomIn:()=>i(e=>Math.min(4,Number((e+.15).toFixed(2)))),onZoomOut:()=>i(e=>Math.max(.25,Number((e-.15).toFixed(2)))),onZoomReset:()=>{i(1),o(0)},onRotate:()=>o(e=>(e+90)%360),onSearchChange:f}}function He(e){let t=(0,K.c)(8),{controller:n}=e,r;return t[0]!==n.controls||t[1]!==n.onRotate||t[2]!==n.onSearchChange||t[3]!==n.onZoomIn||t[4]!==n.onZoomOut||t[5]!==n.onZoomReset||t[6]!==n.plugin?(r=(0,Q.jsx)(ze,{plugin:n.plugin,controls:n.controls,onZoomIn:n.onZoomIn,onZoomOut:n.onZoomOut,onZoomReset:n.onZoomReset,onRotate:n.onRotate,onSearchChange:n.onSearchChange}),t[0]=n.controls,t[1]=n.onRotate,t[2]=n.onSearchChange,t[3]=n.onZoomIn,t[4]=n.onZoomOut,t[5]=n.onZoomReset,t[6]=n.plugin,t[7]=r):r=t[7],r}function Ue(e){let t=(0,K.c)(14),n;t[0]===e.language?n=t[1]:(n=c(e.language),t[0]=e.language,t[1]=n);let r=n,{controller:i}=e;if(e.loading){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-4 py-6`,"aria-busy":`true`,children:[(0,Q.jsx)(g,{className:`h-5 w-48 max-w-full`}),(0,Q.jsx)(g,{className:`h-4 w-full`}),(0,Q.jsx)(g,{className:`h-4 w-11/12`}),(0,Q.jsx)(g,{className:`h-4 w-3/4`}),(0,Q.jsx)(g,{className:`mt-3 min-h-48 flex-1 rounded-lg`})]}),t[2]=e):e=t[2],e}if(e.loadError){let n=(e.descriptor.context===`workspace`?r.workspace.loadError:r.chat.attachmentPreviewLoadError)+`: `+e.loadError,i;return t[3]===n?i=t[4]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n})}),t[3]=n,t[4]=i),i}if(e.descriptor.context===`attachment`&&e.showExtractedText&&e.descriptor.type!==`image`){let n=e.extractedText||r.chat.attachmentPreviewNoText,i;return t[5]===n?i=t[6]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-hover/40 p-4 dark:border-edge`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg-muted`,children:n})})}),t[5]=n,t[6]=i),i}let a=`${e.descriptor.id}:${i.plugin.id}`,o;t[7]!==i.controls||t[8]!==e?(o={...e,controls:i.controls},t[7]=i.controls,t[8]=e,t[9]=o):o=t[9];let s;return t[10]!==i.plugin.render||t[11]!==a||t[12]!==o?(s=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Q.jsx)(We,{pluginRender:i.plugin.render,props:o},a)}),t[10]=i.plugin.render,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function We(e){let t=(0,K.c)(5),{pluginRender:n,props:r}=e,i;t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:i}),t[3]=i,t[4]=a),a}export{ae as _,ye as a,me as c,G as d,F as f,re as g,W as h,ve as i,fe as l,ie as m,Ue as n,be as o,P as p,Ve as r,pe as s,He as t,Y as u,N as v,M as y};
15
+ <\/script>`;function Se(e){let t=/<head(?:\s[^>]*)?>/i.exec(e);if(t?.index!==void 0){let n=t.index+t[0].length;return`${e.slice(0,n)}${xe}${e.slice(n)}`}let n=/<html(?:\s[^>]*)?>/i.exec(e);if(n?.index!==void 0){let t=n.index+n[0].length;return`${e.slice(0,t)}<head>${xe}</head>${e.slice(t)}`}let r=/^\s*<!doctype[^>]*>/i.exec(e);return r?`${r[0]}<head>${xe}</head>${e.slice(r[0].length)}`:`<head>${xe}</head>${e}`}var Q=r();function Ce(e){let t=(0,K.c)(22),{html:n,title:r}=e,i=(0,q.useRef)(null),[a,s]=(0,q.useState)(!1),c;t[0]===n?c=t[1]:(c=Se(n),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=()=>{i.current?.contentWindow?.postMessage({type:`xopc-html-preview`,html:l},`*`)},t[2]=l,t[3]=u);let d=u,f,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=e=>{e.source===i.current?.contentWindow&&e.data?.type===`xopc-html-preview-ready`&&s(!0)};window.addEventListener(`message`,e);let t=window.setTimeout(()=>s(!0),1800);return()=>{window.removeEventListener(`message`,e),window.clearTimeout(t)}},p=[],t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,q.useEffect)(f,p);let m;t[6]===d?m=t[7]:(m=[d],t[6]=d,t[7]=m),(0,q.useEffect)(d,m);let _=!a,v;t[8]===a?v=t[9]:(v=a?null:(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 space-y-4 rounded-lg bg-surface-panel p-4`,children:[(0,Q.jsx)(g,{className:`h-5 w-1/3`}),(0,Q.jsx)(g,{className:`h-32 w-full rounded-xl`}),(0,Q.jsx)(g,{className:`h-4 w-2/3`})]}),t[8]=a,t[9]=v);let y=a?`opacity-100`:`pointer-events-none opacity-0`,b;t[10]===y?b=t[11]:(b=h(`min-h-0 w-full flex-1 rounded-lg border border-edge-subtle bg-white motion-safe:transition-opacity motion-safe:duration-150 dark:border-edge dark:bg-[#1e1e1e]`,y),t[10]=y,t[11]=b);let x=a?void 0:-1,S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=o(`/api/preview/html`),t[12]=S):S=t[12];let C;t[13]!==d||t[14]!==x||t[15]!==b||t[16]!==r?(C=(0,Q.jsx)(`iframe`,{ref:i,title:r,className:b,tabIndex:x,src:S,sandbox:`allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals`,referrerPolicy:`no-referrer`,onLoad:d}),t[13]=d,t[14]=x,t[15]=b,t[16]=r,t[17]=C):C=t[17];let w;return t[18]!==C||t[19]!==_||t[20]!==v?(w=(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 w-full flex-1 flex-col`,"aria-busy":_,children:[v,C]}),t[18]=C,t[19]=_,t[20]=v,t[21]=w):w=t[21],w}var we=(0,q.lazy)(()=>i(()=>import(`./source-workspace-editor-BwYU5OEh.js`).then(e=>({default:e.SourceWorkspaceEditor})),__vite__mapDeps([4,1,5,6,7,2])));function Te(){let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-4 py-3`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Ee(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t).toLowerCase():``}function De(e){return{".ts":`typescript`,".tsx":`tsx`,".js":`javascript`,".jsx":`jsx`,".json":`json`,".css":`css`,".yml":`yaml`,".yaml":`yaml`,".py":`python`,".go":`go`,".rs":`rust`,".sh":`bash`}[Ee(e)]??`plaintext`}function Oe(e){let t=(0,K.c)(12),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a;if(t[0]!==n){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\r\n|\n|\r/,t[2]=e):e=t[2],a=n.split(e),t[0]=n,t[1]=a}else a=t[1];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i.current?.scrollIntoView({block:`center`})},t[3]=s):s=t[3];let c;t[4]!==r||t[5]!==n?(c=[r,n],t[4]=r,t[5]=n,t[6]=c):c=t[6],(0,q.useEffect)(s,c);let l;t[7]!==o||t[8]!==r?(l=o.map((e,t)=>{let n=t+1,a=n===r;return(0,Q.jsxs)(`div`,{ref:a?i:void 0,className:a?`flex bg-accent-soft/60 text-fg`:`flex`,"data-line":n,children:[(0,Q.jsx)(`span`,{className:`w-12 shrink-0 select-none pr-3 text-right text-fg-subtle`,children:n}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:e||` `})]},n)}),t[7]=o,t[8]=r,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:(0,Q.jsx)(`div`,{className:`min-w-max font-mono text-xs leading-relaxed text-fg`,children:l})}),t[10]=l,t[11]=u),u}function ke(e){let t=(0,K.c)(6),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a,o;t[0]!==r||t[1]!==n?(a=()=>{if(!r||!i.current)return;let e=n.split(/\r?\n/,r);if(!/^#{1,6}\s/.test(e.at(-1)??``))return;let t=e.filter(Ae).length-1;i.current.querySelectorAll(`h1,h2,h3,h4,h5,h6`)[t]?.scrollIntoView({block:`nearest`})},o=[r,n],t[0]=r,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,q.useEffect)(a,o);let s;return t[4]===n?s=t[5]:(s=(0,Q.jsx)(`div`,{ref:i,className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:n})}),t[4]=n,t[5]=s),s}function Ae(e){return/^#{1,6}\s/.test(e)}function je(e,t){let n=e.textContent??``,r=e.descriptor.context===`workspace`,i=e.workspaceEditing;return r&&i?.sourceEditMode?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Q.jsx)(q.Suspense,{fallback:(0,Q.jsx)(Te,{}),children:(0,Q.jsx)(we,{fileName:e.descriptor.fileName,initialContent:n,onChange:e=>i.onSourceChange?.(e),isDark:(i.isDark??e.resolvedTheme===`dark`)===!0,lineWrap:i.sourceWordWrap===!0},e.descriptor.id)})}):t===`markdown`?(0,Q.jsx)(ke,{text:n,targetLine:e.targetLine}):t===`html`?(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:(0,Q.jsx)(Ce,{html:n,title:e.descriptor.fileName})}):e.targetLine&&e.targetLine>0?(0,Q.jsx)(Oe,{text:n,targetLine:e.targetLine}):t===`code`?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:`\`\`\`${De(e.descriptor.fileName)}\n${n}\n\`\`\``})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-fg`,children:n})})}function Me(e){return je(e,`text`)}function Ne(e){return je(e,`markdown`)}function Pe(e){return je(e,`code`)}function Fe(e){return je(e,`html`)}function Ie(){return(0,q.createElement)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`},`Loading preview...`)}function $(e,t,n,r=`binary`){let i=(0,q.lazy)(n);return{id:e,readMode:r,capabilities:t,render:e=>(0,q.createElement)(q.Suspense,{fallback:Ie()},(0,q.createElement)(i,e))}}var Le={text:{id:`text`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Me,e)},markdown:{id:`markdown`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Ne,e)},code:{id:`code`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Pe,e)},html:{id:`html`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Fe,e)},image:$(`image`,[`download`,`zoom`,`rotate`],()=>i(()=>import(`./binary-plugins-D_zw0TgG.js`).then(e=>({default:e.InteractiveImagePreview})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pdf:$(`pdf`,[`download`,`zoom`,`rotate`,`pageNavigation`,`print`],()=>i(()=>import(`./binary-plugins-D_zw0TgG.js`).then(e=>({default:e.PdfPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),docx:$(`docx`,[`download`],()=>i(()=>import(`./binary-plugins-D_zw0TgG.js`).then(e=>({default:e.DocxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),spreadsheet:$(`spreadsheet`,[`download`],()=>i(()=>import(`./binary-plugins-D_zw0TgG.js`).then(e=>({default:e.SpreadsheetPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pptx:$(`pptx`,[`download`],()=>i(()=>import(`./binary-plugins-D_zw0TgG.js`).then(e=>({default:e.PptxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),audio:$(`audio`,[`download`],()=>i(()=>import(`./media-plugins-C78NkHfB.js`).then(e=>({default:e.AudioPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),video:$(`video`,[`download`],()=>i(()=>import(`./media-plugins-C78NkHfB.js`).then(e=>({default:e.VideoPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),archive:$(`archive`,[`download`],()=>i(()=>import(`./archive-plugin-CQ5UXgZk.js`).then(e=>({default:e.ArchivePreviewPluginView})),__vite__mapDeps([21,1,5,9,22,11,12,13,14,15,16,17,18]))),unsupported:$(`unsupported`,[`download`],()=>i(()=>import(`./media-plugins-C78NkHfB.js`).then(e=>({default:e.UnsupportedPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19])),`metadata`)};function Re(e){return Le[e]??Le.unsupported}function ze(e){let t=(0,K.c)(63),{plugin:n,controls:r,onZoomIn:i,onZoomOut:a,onZoomReset:o,onRotate:s,onSearchChange:c}=e,l;t[0]===n.capabilities?l=t[1]:(l=n.capabilities.includes(`zoom`),t[0]=n.capabilities,t[1]=l);let d=l,h;t[2]===n.capabilities?h=t[3]:(h=n.capabilities.includes(`search`),t[2]=n.capabilities,t[3]=h);let g=h,_;t[4]===n.capabilities?_=t[5]:(_=n.capabilities.includes(`rotate`),t[4]=n.capabilities,t[5]=_);let v=_,y;t[6]!==r||t[7]!==n.capabilities?(y=n.capabilities.includes(`pageNavigation`)&&r.pageCount!=null&&r.pageCount>1,t[6]=r,t[7]=n.capabilities,t[8]=y):y=t[8];let b=y;if(!(d||g||v||b))return null;let x;if(t[9]!==b||t[10]!==v||t[11]!==g||t[12]!==d||t[13]!==r||t[14]!==s||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==o){let e=[];if(b){let n=r.page<=1,i;t[20]===r?i=t[21]:(i=()=>r.setPage(Math.max(1,r.page-1)),t[20]=r,t[21]=i);let a;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(N,{className:`size-3.5`}),t[22]=a):a=t[22];let o;t[23]!==n||t[24]!==i?(o=(0,Q.jsx)(Be,{label:`Previous page`,disabled:n,onClick:i,children:a}),t[23]=n,t[24]=i,t[25]=o):o=t[25];let s;t[26]!==r.page||t[27]!==r.pageCount?(s=(0,Q.jsxs)(`span`,{className:`min-w-16 px-1 text-center text-xs text-fg-muted`,children:[r.page,` / `,r.pageCount]}),t[26]=r.page,t[27]=r.pageCount,t[28]=s):s=t[28];let c=r.page>=(r.pageCount??1),l;t[29]===r?l=t[30]:(l=()=>r.setPage(Math.min(r.pageCount??r.page,r.page+1)),t[29]=r,t[30]=l);let u;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(M,{className:`size-3.5`}),t[31]=u):u=t[31];let d;t[32]!==c||t[33]!==l?(d=(0,Q.jsx)(Be,{label:`Next page`,disabled:c,onClick:l,children:u}),t[32]=c,t[33]=l,t[34]=d):d=t[34];let f;t[35]!==s||t[36]!==d||t[37]!==o?(f=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[o,s,d]},`page`),t[35]=s,t[36]=d,t[37]=o,t[38]=f):f=t[38],e.push(f)}if(d){let n;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`size-3.5`}),t[39]=n):n=t[39];let s;t[40]===a?s=t[41]:(s=(0,Q.jsx)(Be,{label:`Zoom out`,onClick:a,children:n}),t[40]=a,t[41]=s);let c;t[42]===r.zoom?c=t[43]:(c=Math.round(r.zoom*100),t[42]=r.zoom,t[43]=c);let l;t[44]!==o||t[45]!==c?(l=(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-14 rounded px-1.5 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:o,title:`Reset zoom`,children:[c,`%`]}),t[44]=o,t[45]=c,t[46]=l):l=t[46];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(f,{className:`size-3.5`}),t[47]=d):d=t[47];let p;t[48]===i?p=t[49]:(p=(0,Q.jsx)(Be,{label:`Zoom in`,onClick:i,children:d}),t[48]=i,t[49]=p);let m;t[50]!==p||t[51]!==s||t[52]!==l?(m=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[s,l,p]},`zoom`),t[50]=p,t[51]=s,t[52]=l,t[53]=m):m=t[53],e.push(m)}if(v){let n;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(p,{className:`size-3.5`}),t[54]=n):n=t[54];let r;t[55]===s?r=t[56]:(r=(0,Q.jsx)(Be,{label:`Rotate`,onClick:s,children:n},`rotate`),t[55]=s,t[56]=r),e.push(r)}if(g){let n;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[57]=n):n=t[57];let i;t[58]===c?i=t[59]:(i=e=>c(e.target.value),t[58]=c,t[59]=i);let a;t[60]!==r.searchQuery||t[61]!==i?(a=(0,Q.jsxs)(`label`,{className:`flex min-w-40 items-center gap-1 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs text-fg-muted dark:border-edge`,children:[n,(0,Q.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:r.searchQuery,onChange:i,placeholder:`Search`})]},`search`),t[60]=r.searchQuery,t[61]=i,t[62]=a):a=t[62],e.push(a)}x=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:e}),t[9]=b,t[10]=v,t[11]=g,t[12]=d,t[13]=r,t[14]=s,t[15]=c,t[16]=i,t[17]=a,t[18]=o,t[19]=x}else x=t[19];return x}function Be(e){let t=(0,K.c)(6),{label:n,disabled:r,onClick:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=h(`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-40`),t[0]=o):o=t[0];let s;return t[1]!==a||t[2]!==r||t[3]!==n||t[4]!==i?(s=(0,Q.jsx)(`button`,{type:`button`,className:o,title:n,"aria-label":n,disabled:r,onClick:i,children:a}),t[1]=a,t[2]=r,t[3]=n,t[4]=i,t[5]=s):s=t[5],s}function Ve(e){let t=Re(e.type),n=pe(e.id),[r,i]=(0,q.useState)(n.zoom),[a,o]=(0,q.useState)(n.rotation),[s,c]=(0,q.useState)(n.page),[l,u]=(0,q.useState)(n.pageCount),[d,f]=(0,q.useState)(n.searchQuery),p=(0,q.useCallback)(e=>{c(Math.max(1,Math.min(l??e,Math.floor(e))))},[l]);(0,q.useEffect)(()=>{let t=pe(e.id);i(t.zoom),o(t.rotation),c(t.page),u(t.pageCount),f(t.searchQuery)},[e.id,e.type]);let m=(0,q.useRef)({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d});return m.current={zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d},(0,q.useEffect)(()=>()=>me(e.id,m.current),[e.id]),{plugin:t,controls:(0,q.useMemo)(()=>({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d,setPageCount:u,setPage:p}),[s,l,a,d,p,r]),onZoomIn:()=>i(e=>Math.min(4,Number((e+.15).toFixed(2)))),onZoomOut:()=>i(e=>Math.max(.25,Number((e-.15).toFixed(2)))),onZoomReset:()=>{i(1),o(0)},onRotate:()=>o(e=>(e+90)%360),onSearchChange:f}}function He(e){let t=(0,K.c)(8),{controller:n}=e,r;return t[0]!==n.controls||t[1]!==n.onRotate||t[2]!==n.onSearchChange||t[3]!==n.onZoomIn||t[4]!==n.onZoomOut||t[5]!==n.onZoomReset||t[6]!==n.plugin?(r=(0,Q.jsx)(ze,{plugin:n.plugin,controls:n.controls,onZoomIn:n.onZoomIn,onZoomOut:n.onZoomOut,onZoomReset:n.onZoomReset,onRotate:n.onRotate,onSearchChange:n.onSearchChange}),t[0]=n.controls,t[1]=n.onRotate,t[2]=n.onSearchChange,t[3]=n.onZoomIn,t[4]=n.onZoomOut,t[5]=n.onZoomReset,t[6]=n.plugin,t[7]=r):r=t[7],r}function Ue(e){let t=(0,K.c)(14),n;t[0]===e.language?n=t[1]:(n=c(e.language),t[0]=e.language,t[1]=n);let r=n,{controller:i}=e;if(e.loading){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-4 py-6`,"aria-busy":`true`,children:[(0,Q.jsx)(g,{className:`h-5 w-48 max-w-full`}),(0,Q.jsx)(g,{className:`h-4 w-full`}),(0,Q.jsx)(g,{className:`h-4 w-11/12`}),(0,Q.jsx)(g,{className:`h-4 w-3/4`}),(0,Q.jsx)(g,{className:`mt-3 min-h-48 flex-1 rounded-lg`})]}),t[2]=e):e=t[2],e}if(e.loadError){let n=(e.descriptor.context===`workspace`?r.workspace.loadError:r.chat.attachmentPreviewLoadError)+`: `+e.loadError,i;return t[3]===n?i=t[4]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n})}),t[3]=n,t[4]=i),i}if(e.descriptor.context===`attachment`&&e.showExtractedText&&e.descriptor.type!==`image`){let n=e.extractedText||r.chat.attachmentPreviewNoText,i;return t[5]===n?i=t[6]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-hover/40 p-4 dark:border-edge`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg-muted`,children:n})})}),t[5]=n,t[6]=i),i}let a=`${e.descriptor.id}:${i.plugin.id}`,o;t[7]!==i.controls||t[8]!==e?(o={...e,controls:i.controls},t[7]=i.controls,t[8]=e,t[9]=o):o=t[9];let s;return t[10]!==i.plugin.render||t[11]!==a||t[12]!==o?(s=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Q.jsx)(We,{pluginRender:i.plugin.render,props:o},a)}),t[10]=i.plugin.render,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function We(e){let t=(0,K.c)(5),{pluginRender:n,props:r}=e,i;t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:i}),t[3]=i,t[4]=a),a}export{ae as _,ye as a,me as c,G as d,F as f,re as g,W as h,ve as i,fe as l,ie as m,Ue as n,be as o,P as p,Ve as r,pe as s,He as t,Y as u,N as v,M as y};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-BYdvIuPj.js";import{t as o}from"./messages-lc5BjBtX.js";import{t as s}from"./createLucideIcon-DPHK1VkS.js";import{t as c}from"./activity-YogQEteU.js";import{t as l}from"./bot-DjLkhyZL.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./circle-pause-CN9jYH2s.js";import{t as f}from"./clock-3-DnrAnuyZ.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./message-square-fVE7Ghj1.js";import{t as g}from"./pause-DuPxgSxk.js";import{t as _}from"./play-kxZvpBg8.js";import{t as v}from"./rotate-ccw-JM1TBLpp.js";import{t as y}from"./rotate-cw-LIg3Am9S.js";import{t as b}from"./sparkles-DHlfQFAF.js";import{t as x}from"./triangle-alert-2JXFNNKU.js";import{t as S}from"./volume-2-BSJhAY97.js";import{t as C}from"./zap-dximCGjy.js";import{t as w}from"./cn-0WouolD0.js";import{a as T}from"./session-manager-C-oe-9_N.js";import{i as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-C5tRaJxt.js";import{t as O}from"./automation-api-Cc5X3Q1t.js";var k=s(`audio-lines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),A=s(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),j=s(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),M=s(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),N=n(),P=e(t(),1),F=r(),I=(0,P.forwardRef)(function(e,t){let n=(0,N.c)(36),r,i,a,o,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],l=n[7]):({input:a,labels:o,className:i,showLabel:s,disabled:c,hideNativeTitle:l,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,f=l!==void 0&&l,p;n[8]===a?p=n[9]:(p=typeof a==`function`?a():a,n[8]=a,n[9]=p);let h=p,y=T(L),b=T(R),x=T(z),C=y?.type===h.source.type&&y.id===h.source.id,E=C?b:`idle`,D=E===`preparing`?o.preparing:E===`playing`?o.pause:E===`paused`?o.resume:E===`error`?o.retry:o.read,O;n[10]!==a||n[11]!==x?(O=()=>x(typeof a==`function`?a():a),n[10]=a,n[11]=x,n[12]=O):O=n[12];let k;n[13]!==d||n[14]!==h.text?(k=d||!h.text.trim(),n[13]=d,n[14]=h.text,n[15]=k):k=n[15];let A=f?void 0:D,j=C&&(E===`playing`||E===`paused`),M=u?`min-h-11 gap-1.5 px-2.5 text-sm font-medium sm:min-h-8 sm:text-xs`:`size-11 sm:size-9`,P=C&&`bg-surface-active text-accent`,I;n[16]!==i||n[17]!==P||n[18]!==M?(I=w(`inline-flex shrink-0 items-center justify-center rounded-lg text-fg-muted transition-colors transition-transform duration-150 ease-out`,`hover:bg-surface-hover hover:text-fg active:scale-95 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,M,P,i),n[16]=i,n[17]=P,n[18]=M,n[19]=I):I=n[19];let B;n[20]===E?B=n[21]:(B=E===`preparing`?(0,F.jsx)(m,{className:`size-4 animate-spin`,"aria-hidden":!0}):E===`playing`?(0,F.jsx)(g,{className:`size-4`,"aria-hidden":!0}):E===`paused`?(0,F.jsx)(_,{className:`size-4`,"aria-hidden":!0}):E===`error`?(0,F.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,F.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n[20]=E,n[21]=B);let V;n[22]!==D||n[23]!==u?(V=u?(0,F.jsx)(`span`,{children:D}):null,n[22]=D,n[23]=u,n[24]=V):V=n[24];let H;return n[25]!==r||n[26]!==D||n[27]!==t||n[28]!==I||n[29]!==B||n[30]!==V||n[31]!==O||n[32]!==k||n[33]!==A||n[34]!==j?(H=(0,F.jsxs)(`button`,{...r,ref:t,type:`button`,onClick:O,disabled:k,title:A,"aria-label":D,"aria-pressed":j,className:I,children:[B,V]}),n[25]=r,n[26]=D,n[27]=t,n[28]=I,n[29]=B,n[30]=V,n[31]=O,n[32]=k,n[33]=A,n[34]=j,n[35]=H):H=n[35],H});function L(e){return e.source}function R(e){return e.status}function z(e){return e.requestStart}function B(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e)}function V(e,t){if(!e.enabled||e.trigger.kind!==`event`||e.trigger.eventType!==t.eventType||e.trigger.source&&e.trigger.source!==t.source)return!1;let n=e.trigger.payloadMatch;if(!n)return!0;let r=t.eventPayload??{};return Object.entries(n).every(([e,t])=>Object.is(r[e],t))}function H(e,t){let n=e.trigger,r=t.explain;return n.kind===`event`?[W(n.eventType,n.source,t),G(n.payloadMatch,t),q(e.safety,t),K(e.action,t)]:[r.triggerMatched,K(e.action,t)]}function U(e,t,n){let r=e.triggerSnapshot,i=Y(t),a=n.explain;return r.kind===`event`?[i?W(i.type,i.source,n):W(r.eventType,r.source,n),G(r.payloadMatch,n),q(J(t),n),K(e.actionSnapshot,n)]:r.kind===`manual`?[a.manual,K(e.actionSnapshot,n)]:r.kind===`webhook`?[a.webhook,K(e.actionSnapshot,n)]:[a.schedule,K(e.actionSnapshot,n)]}function W(e,t,n){let r=n.explain;return t?B(r.eventFrom,{eventType:e,source:t}):B(r.event,{eventType:e})}function G(e,t){if(!e||Object.keys(e).length===0)return t.explain.noPayloadFilter;let n=Object.entries(e).slice(0,3).map(([e,t])=>`${e}=${String(t)}`).join(`, `);return B(t.explain.payloadMatched,{pairs:n})}function K(e,t){return e.kind===`task_command`?`Starts task ${e.taskId}.`:e.kind===`system`?`Runs system capability ${e.capability}.`:t.explain.actionAgent}function q(e,t){let n=e?.mode??`auto_apply`;return B(t.explain.safetyMode,{mode:t.safety[n]})}function J(e){if(!e.data||typeof e.data!=`object`||Array.isArray(e.data))return;let t=e.data.safety;if(!t||typeof t!=`object`||Array.isArray(t))return;let n=t.mode;return n===`suggest_only`||n===`ask_before_apply`||n===`auto_apply`?{mode:n}:void 0}function Y(e){if(!e.data||typeof e.data!=`object`||Array.isArray(e.data))return null;let t=e.data.event;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.type!=`string`||!n.type.trim()?null:{type:n.type,source:typeof n.source==`string`?n.source:void 0}}function X(e){return e===`succeeded`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:e===`cancelled`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300`}function Z(e,t){return new Date(e).toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ee(e){return e.some(e=>[`queued`,`running`,`cancelling`].includes(e.run.status))}function Q(e){return e===`failed`||e===`timeout`||e===`cancelled`}function te(e){let t=new Map;for(let{run:n}of e){let e=t.get(n.automationId),r=!e||n.createdAtMs>e.latest.createdAtMs?n:e.latest;t.set(n.automationId,{latest:r,hadAttention:!!e?.hadAttention||Q(n.status)})}let n={total:t.size,succeeded:0,active:0,attention:0,recovered:0};for(let{latest:e,hadAttention:r}of t.values())e.status===`succeeded`&&(n.succeeded+=1),e.status===`succeeded`&&r&&(n.recovered+=1),(e.status===`queued`||e.status===`running`||e.status===`cancelling`)&&(n.active+=1),Q(e.status)&&(n.attention+=1,n.latestAttentionRun??=e);return n}function ne(e){let t=new Map;for(let{run:n}of e){let e=t.get(n.automationId);(!e||n.createdAtMs>e.createdAtMs)&&t.set(n.automationId,n)}return t}function $(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e)}function re(e){let t=(0,N.c)(47),{health:n,labels:r,primaryRepairBusy:i,onPrimaryRepair:a}=e,o=n.attention>0,s=n.active>0,c=n.recovered>0,l;t[0]!==s||t[1]!==c||t[2]!==n.active||t[3]!==n.attention||t[4]!==n.latestAttentionRun?.automationName||t[5]!==n.recovered||t[6]!==n.succeeded||t[7]!==n.total||t[8]!==r.feedback.summaryHealthy||t[9]!==r.feedback.summaryNeedsAttention||t[10]!==r.feedback.summaryRecovered||t[11]!==r.feedback.summaryRunning||t[12]!==r.feedback.thisAutomation||t[13]!==o?(l=o?$(r.feedback.summaryNeedsAttention,{total:n.total,attention:n.attention,name:n.latestAttentionRun?.automationName??r.feedback.thisAutomation}):s?$(r.feedback.summaryRunning,{total:n.total,active:n.active}):c?$(r.feedback.summaryRecovered,{total:n.total,recovered:n.recovered,succeeded:n.succeeded}):$(r.feedback.summaryHealthy,{total:n.total,succeeded:n.succeeded}),t[0]=s,t[1]=c,t[2]=n.active,t[3]=n.attention,t[4]=n.latestAttentionRun?.automationName,t[5]=n.recovered,t[6]=n.succeeded,t[7]=n.total,t[8]=r.feedback.summaryHealthy,t[9]=r.feedback.summaryNeedsAttention,t[10]=r.feedback.summaryRecovered,t[11]=r.feedback.summaryRunning,t[12]=r.feedback.thisAutomation,t[13]=o,t[14]=l):l=t[14];let d=l,p=o?`text-amber-800 dark:text-amber-200`:`text-fg-muted`,m;t[15]===p?m=t[16]:(m=w(`break-words text-xs leading-5`,p),t[15]=p,t[16]=m);let h;t[17]!==d||t[18]!==m?(h=(0,F.jsx)(`p`,{className:m,children:d}),t[17]=d,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==n.succeeded||t[21]!==r.feedback.succeededCount?(g=n.succeeded?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.succeededCount,{count:n.succeeded})]}):null,t[20]=n.succeeded,t[21]=r.feedback.succeededCount,t[22]=g):g=t[22];let _;t[23]!==n.active||t[24]!==r.feedback.activeCount?(_=n.active?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-blue-500/25 bg-blue-500/10 px-2 py-0.5 text-xs text-blue-700 dark:text-blue-300`,children:[(0,F.jsx)(f,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.activeCount,{count:n.active})]}):null,t[23]=n.active,t[24]=r.feedback.activeCount,t[25]=_):_=t[25];let v;t[26]!==n.attention||t[27]!==r.feedback.attentionCount?(v=n.attention?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-amber-500/25 bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700 dark:text-amber-300`,children:[(0,F.jsx)(x,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.attentionCount,{count:n.attention})]}):null,t[26]=n.attention,t[27]=r.feedback.attentionCount,t[28]=v):v=t[28];let y;t[29]!==n.recovered||t[30]!==r.feedback.recoveredCount?(y=n.recovered?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.recoveredCount,{count:n.recovered})]}):null,t[29]=n.recovered,t[30]=r.feedback.recoveredCount,t[31]=y):y=t[31];let S;t[32]!==g||t[33]!==_||t[34]!==v||t[35]!==y?(S=(0,F.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:[g,_,v,y]}),t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=S):S=t[36];let C;t[37]!==r.feedback.primaryRepair||t[38]!==r.feedback.primaryRepairing||t[39]!==o||t[40]!==a||t[41]!==i?(C=o&&a?(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsxs)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:i,onClick:a,children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),i?r.feedback.primaryRepairing:r.feedback.primaryRepair]})}):null,t[37]=r.feedback.primaryRepair,t[38]=r.feedback.primaryRepairing,t[39]=o,t[40]=a,t[41]=i,t[42]=C):C=t[42];let T;return t[43]!==C||t[44]!==h||t[45]!==S?(T=(0,F.jsxs)(`div`,{className:`mb-3 border-l-2 border-accent/50 pl-3`,children:[h,S,C]}),t[43]=C,t[44]=h,t[45]=S,t[46]=T):T=t[46],T}function ie({eventType:e,source:t,payloadKey:n,payloadValue:r,limit:s=3,className:f,onSaveInsight:m,isInsightSaved:g}){let _=a(e=>e.language),v=o(_).automations,x=_===`zh`?`zh-CN`:`en-US`,S=[`product-automation-feedback`,e,t??``,n??``,r??``,s],[T,k]=(0,P.useState)(null),[A,j]=(0,P.useState)(null),{data:M,mutate:N}=E(e&&(!n||r!==void 0)?S:null,()=>O.productEventRuns({eventType:e,source:t,payloadKey:n,payloadValue:r,limit:s}),{revalidateOnFocus:!1,refreshInterval:e=>e?.items&&ee(e.items)?3e3:15e3}),[I,L]=(0,P.useState)({}),[R,z]=(0,P.useState)({}),B=M?.items??[],V=te(B),H=ne(B);if(!B.length)return null;let W=async(e,t)=>{k(e),j(null);try{await t(),await N()}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},G=async e=>{k(`${e.id}:repair`),j(null);try{let t=await O.repairDraft(e.id,{language:_});L(n=>({...n,[e.id]:t.repair})),z(t=>({...t,[e.id]:!1}))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},K=async(e,t,n=!1)=>{k(n?`${e.id}:applyAndRerun`:`${e.id}:applyRepair`),j(null);try{await O.update(e.automationId,t.patch),n&&await O.rerun(e.id),await N(),L(t=>{let n={...t};return delete n[e.id],n}),z(t=>{let n={...t};return delete n[e.id],n})}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},q=V.latestAttentionRun&&!I[V.latestAttentionRun.id]?V.latestAttentionRun:void 0,J=q?T===`${q.id}:repair`:!1;return(0,F.jsxs)(`section`,{className:w(`rounded-lg border border-edge bg-surface-panel p-3`,f),children:[(0,F.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`h3`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,F.jsx)(C,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate`,children:v.feedback.title})]}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:B.length})]}),(0,F.jsx)(re,{health:V,labels:v,primaryRepairBusy:J,onPrimaryRepair:q?()=>void G(q):void 0}),A?(0,F.jsxs)(`p`,{className:`mb-2 rounded-md border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`,role:`alert`,children:[v.feedback.actionFailed,`: `,A]}):null,(0,F.jsx)(`ul`,{className:`grid gap-2`,children:B.map(({run:e,triggerEvent:t})=>{let n=H.get(e.automationId),r=n?.id===e.id,a=Q(e.status)&&!r,o=a&&n?.status===`succeeded`,s=I[e.id],f=R[e.id]??!1,_=T===`${e.id}:repair`,S=T===`${e.id}:applyRepair`,C=T===`${e.id}:applyAndRerun`,E=U(e,t,v),k=g?.(e)??!1,A=e.status===`succeeded`&&!!e.summary&&!!m&&!k,j=T===`${e.id}:saveInsight`;return(0,F.jsxs)(`li`,{className:`rounded-md border border-edge/70 bg-surface-inset/35 px-2.5 py-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,F.jsx)(l,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName})]}),(0,F.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs text-fg-muted`,children:e.error||e.summary||t.message})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,F.jsx)(`span`,{className:w(`rounded-full border px-2 py-0.5 text-xs`,X(e.status)),children:v.status[e.status]}),a?(0,F.jsx)(`span`,{className:`rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:o?v.feedback.recovered:v.feedback.historical}):null]})]}),(0,F.jsx)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-xs text-fg-muted`,children:(0,F.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,F.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate`,children:Z(t.createdAtMs,x)})]})}),(0,F.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/60 bg-surface-base/45 px-2.5 py-2`,children:[(0,F.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:v.explain.whyRan}),(0,F.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:E.map(e=>(0,F.jsx)(`span`,{className:`rounded-full border border-edge/70 bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e))})]}),s?(0,F.jsxs)(`div`,{className:`mt-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-amber-800 dark:text-amber-200`,children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),v.repair.title]}),(0,F.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg`,children:s.explanation}),s.expectedEffect?(0,F.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:s.expectedEffect}):null,s.risks.length?(0,F.jsx)(`ul`,{className:`mt-2 list-disc space-y-1 pl-4 text-xs text-fg-muted`,children:s.risks.slice(0,3).map(e=>(0,F.jsx)(`li`,{children:e},e))}):null,s.requiresApproval?(0,F.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-xs text-fg`,children:[(0,F.jsx)(`input`,{className:`mt-0.5`,type:`checkbox`,checked:f,onChange:t=>{z(n=>({...n,[e.id]:t.target.checked}))}}),(0,F.jsx)(`span`,{children:v.repair.approval})]}):null,(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:[(0,F.jsx)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>{L(t=>{let n={...t};return delete n[e.id],n})},children:v.draft.discard}),(0,F.jsx)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:s.requiresApproval&&!f||T!==null,onClick:()=>void K(e,s),children:S?v.feedback.working:v.repair.apply}),(0,F.jsxs)(D,{variant:`primary`,className:`h-7 rounded-md px-2 text-xs`,disabled:s.requiresApproval&&!f||T!==null,onClick:()=>void K(e,s,!0),children:[(0,F.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),C?v.feedback.working:v.feedback.applyAndRerun]})]})]}):null,(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[k?(0,F.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1 rounded-md border border-emerald-500/25 bg-emerald-500/10 px-2 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.savedInsight]}):null,A?(0,F.jsxs)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:saveInsight`,()=>Promise.resolve(m(e))),children:[(0,F.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),j?v.feedback.savingInsight:v.feedback.saveInsight]}):null,e.conversationId?(0,F.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,children:(0,F.jsxs)(i,{to:`/chat/${encodeURIComponent(e.conversationId)}`,children:[(0,F.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.chat]})}):null,null,r&&Q(e.status)&&!s?(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void G(e),children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),_?v.repair.generating:v.repair.suggest]}):null,(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:rerun`,()=>O.rerun(e.id)),children:[(0,F.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),T===`${e.id}:rerun`?v.feedback.working:v.feedback.rerun]}),(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:pause`,()=>O.pause(e.automationId)),children:[(0,F.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),T===`${e.id}:pause`?v.feedback.working:v.feedback.pause]}),(0,F.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,children:(0,F.jsxs)(i,{to:`/automations?run=${encodeURIComponent(e.id)}`,children:[(0,F.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.open]})})]})]},e.id)})})]})}export{I as a,A as c,V as i,k as l,H as n,M as o,B as r,j as s,ie as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./messages-C7QSnTdg.js";import{t as s}from"./createLucideIcon-DPHK1VkS.js";import{t as c}from"./activity-YogQEteU.js";import{t as l}from"./bot-DjLkhyZL.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./circle-pause-CN9jYH2s.js";import{t as f}from"./clock-3-DnrAnuyZ.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./message-square-fVE7Ghj1.js";import{t as g}from"./pause-DuPxgSxk.js";import{t as _}from"./play-kxZvpBg8.js";import{t as v}from"./rotate-ccw-JM1TBLpp.js";import{t as y}from"./rotate-cw-LIg3Am9S.js";import{t as b}from"./sparkles-DHlfQFAF.js";import{t as x}from"./triangle-alert-2JXFNNKU.js";import{t as S}from"./volume-2-BSJhAY97.js";import{t as C}from"./zap-dximCGjy.js";import{t as w}from"./cn-0WouolD0.js";import{a as T}from"./session-manager-CVNlrzFB.js";import{i as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-C5tRaJxt.js";import{t as O}from"./automation-api-D-gn6x5E.js";var k=s(`audio-lines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),A=s(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),j=s(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),M=s(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),N=n(),P=e(t(),1),F=r(),I=(0,P.forwardRef)(function(e,t){let n=(0,N.c)(36),r,i,a,o,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],l=n[7]):({input:a,labels:o,className:i,showLabel:s,disabled:c,hideNativeTitle:l,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,f=l!==void 0&&l,p;n[8]===a?p=n[9]:(p=typeof a==`function`?a():a,n[8]=a,n[9]=p);let h=p,y=T(L),b=T(R),x=T(z),C=y?.type===h.source.type&&y.id===h.source.id,E=C?b:`idle`,D=E===`preparing`?o.preparing:E===`playing`?o.pause:E===`paused`?o.resume:E===`error`?o.retry:o.read,O;n[10]!==a||n[11]!==x?(O=()=>x(typeof a==`function`?a():a),n[10]=a,n[11]=x,n[12]=O):O=n[12];let k;n[13]!==d||n[14]!==h.text?(k=d||!h.text.trim(),n[13]=d,n[14]=h.text,n[15]=k):k=n[15];let A=f?void 0:D,j=C&&(E===`playing`||E===`paused`),M=u?`min-h-11 gap-1.5 px-2.5 text-sm font-medium sm:min-h-8 sm:text-xs`:`size-11 sm:size-9`,P=C&&`bg-surface-active text-accent`,I;n[16]!==i||n[17]!==P||n[18]!==M?(I=w(`inline-flex shrink-0 items-center justify-center rounded-lg text-fg-muted transition-colors transition-transform duration-150 ease-out`,`hover:bg-surface-hover hover:text-fg active:scale-95 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,M,P,i),n[16]=i,n[17]=P,n[18]=M,n[19]=I):I=n[19];let B;n[20]===E?B=n[21]:(B=E===`preparing`?(0,F.jsx)(m,{className:`size-4 animate-spin`,"aria-hidden":!0}):E===`playing`?(0,F.jsx)(g,{className:`size-4`,"aria-hidden":!0}):E===`paused`?(0,F.jsx)(_,{className:`size-4`,"aria-hidden":!0}):E===`error`?(0,F.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,F.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n[20]=E,n[21]=B);let V;n[22]!==D||n[23]!==u?(V=u?(0,F.jsx)(`span`,{children:D}):null,n[22]=D,n[23]=u,n[24]=V):V=n[24];let H;return n[25]!==r||n[26]!==D||n[27]!==t||n[28]!==I||n[29]!==B||n[30]!==V||n[31]!==O||n[32]!==k||n[33]!==A||n[34]!==j?(H=(0,F.jsxs)(`button`,{...r,ref:t,type:`button`,onClick:O,disabled:k,title:A,"aria-label":D,"aria-pressed":j,className:I,children:[B,V]}),n[25]=r,n[26]=D,n[27]=t,n[28]=I,n[29]=B,n[30]=V,n[31]=O,n[32]=k,n[33]=A,n[34]=j,n[35]=H):H=n[35],H});function L(e){return e.source}function R(e){return e.status}function z(e){return e.requestStart}function B(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e)}function V(e,t){if(!e.enabled||e.trigger.kind!==`event`||e.trigger.eventType!==t.eventType||e.trigger.source&&e.trigger.source!==t.source)return!1;let n=e.trigger.payloadMatch;if(!n)return!0;let r=t.eventPayload??{};return Object.entries(n).every(([e,t])=>Object.is(r[e],t))}function H(e,t){let n=e.trigger,r=t.explain;return n.kind===`event`?[W(n.eventType,n.source,t),G(n.payloadMatch,t),q(e.safety,t),K(e.action,t)]:[r.triggerMatched,K(e.action,t)]}function U(e,t,n){let r=e.triggerSnapshot,i=Y(t),a=n.explain;return r.kind===`event`?[i?W(i.type,i.source,n):W(r.eventType,r.source,n),G(r.payloadMatch,n),q(J(t),n),K(e.actionSnapshot,n)]:r.kind===`manual`?[a.manual,K(e.actionSnapshot,n)]:r.kind===`webhook`?[a.webhook,K(e.actionSnapshot,n)]:[a.schedule,K(e.actionSnapshot,n)]}function W(e,t,n){let r=n.explain;return t?B(r.eventFrom,{eventType:e,source:t}):B(r.event,{eventType:e})}function G(e,t){if(!e||Object.keys(e).length===0)return t.explain.noPayloadFilter;let n=Object.entries(e).slice(0,3).map(([e,t])=>`${e}=${String(t)}`).join(`, `);return B(t.explain.payloadMatched,{pairs:n})}function K(e,t){return e.kind===`task_command`?`Starts task ${e.taskId}.`:e.kind===`system`?`Runs system capability ${e.capability}.`:t.explain.actionAgent}function q(e,t){let n=e?.mode??`auto_apply`;return B(t.explain.safetyMode,{mode:t.safety[n]})}function J(e){if(!e.data||typeof e.data!=`object`||Array.isArray(e.data))return;let t=e.data.safety;if(!t||typeof t!=`object`||Array.isArray(t))return;let n=t.mode;return n===`suggest_only`||n===`ask_before_apply`||n===`auto_apply`?{mode:n}:void 0}function Y(e){if(!e.data||typeof e.data!=`object`||Array.isArray(e.data))return null;let t=e.data.event;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.type!=`string`||!n.type.trim()?null:{type:n.type,source:typeof n.source==`string`?n.source:void 0}}function X(e){return e===`succeeded`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:e===`cancelled`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300`}function Z(e,t){return new Date(e).toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ee(e){return e.some(e=>[`queued`,`running`,`cancelling`].includes(e.run.status))}function Q(e){return e===`failed`||e===`timeout`||e===`cancelled`}function te(e){let t=new Map;for(let{run:n}of e){let e=t.get(n.automationId),r=!e||n.createdAtMs>e.latest.createdAtMs?n:e.latest;t.set(n.automationId,{latest:r,hadAttention:!!e?.hadAttention||Q(n.status)})}let n={total:t.size,succeeded:0,active:0,attention:0,recovered:0};for(let{latest:e,hadAttention:r}of t.values())e.status===`succeeded`&&(n.succeeded+=1),e.status===`succeeded`&&r&&(n.recovered+=1),(e.status===`queued`||e.status===`running`||e.status===`cancelling`)&&(n.active+=1),Q(e.status)&&(n.attention+=1,n.latestAttentionRun??=e);return n}function ne(e){let t=new Map;for(let{run:n}of e){let e=t.get(n.automationId);(!e||n.createdAtMs>e.createdAtMs)&&t.set(n.automationId,n)}return t}function $(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e)}function re(e){let t=(0,N.c)(47),{health:n,labels:r,primaryRepairBusy:i,onPrimaryRepair:a}=e,o=n.attention>0,s=n.active>0,c=n.recovered>0,l;t[0]!==s||t[1]!==c||t[2]!==n.active||t[3]!==n.attention||t[4]!==n.latestAttentionRun?.automationName||t[5]!==n.recovered||t[6]!==n.succeeded||t[7]!==n.total||t[8]!==r.feedback.summaryHealthy||t[9]!==r.feedback.summaryNeedsAttention||t[10]!==r.feedback.summaryRecovered||t[11]!==r.feedback.summaryRunning||t[12]!==r.feedback.thisAutomation||t[13]!==o?(l=o?$(r.feedback.summaryNeedsAttention,{total:n.total,attention:n.attention,name:n.latestAttentionRun?.automationName??r.feedback.thisAutomation}):s?$(r.feedback.summaryRunning,{total:n.total,active:n.active}):c?$(r.feedback.summaryRecovered,{total:n.total,recovered:n.recovered,succeeded:n.succeeded}):$(r.feedback.summaryHealthy,{total:n.total,succeeded:n.succeeded}),t[0]=s,t[1]=c,t[2]=n.active,t[3]=n.attention,t[4]=n.latestAttentionRun?.automationName,t[5]=n.recovered,t[6]=n.succeeded,t[7]=n.total,t[8]=r.feedback.summaryHealthy,t[9]=r.feedback.summaryNeedsAttention,t[10]=r.feedback.summaryRecovered,t[11]=r.feedback.summaryRunning,t[12]=r.feedback.thisAutomation,t[13]=o,t[14]=l):l=t[14];let d=l,p=o?`text-amber-800 dark:text-amber-200`:`text-fg-muted`,m;t[15]===p?m=t[16]:(m=w(`break-words text-xs leading-5`,p),t[15]=p,t[16]=m);let h;t[17]!==d||t[18]!==m?(h=(0,F.jsx)(`p`,{className:m,children:d}),t[17]=d,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==n.succeeded||t[21]!==r.feedback.succeededCount?(g=n.succeeded?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.succeededCount,{count:n.succeeded})]}):null,t[20]=n.succeeded,t[21]=r.feedback.succeededCount,t[22]=g):g=t[22];let _;t[23]!==n.active||t[24]!==r.feedback.activeCount?(_=n.active?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-blue-500/25 bg-blue-500/10 px-2 py-0.5 text-xs text-blue-700 dark:text-blue-300`,children:[(0,F.jsx)(f,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.activeCount,{count:n.active})]}):null,t[23]=n.active,t[24]=r.feedback.activeCount,t[25]=_):_=t[25];let v;t[26]!==n.attention||t[27]!==r.feedback.attentionCount?(v=n.attention?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-amber-500/25 bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700 dark:text-amber-300`,children:[(0,F.jsx)(x,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.attentionCount,{count:n.attention})]}):null,t[26]=n.attention,t[27]=r.feedback.attentionCount,t[28]=v):v=t[28];let y;t[29]!==n.recovered||t[30]!==r.feedback.recoveredCount?(y=n.recovered?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.recoveredCount,{count:n.recovered})]}):null,t[29]=n.recovered,t[30]=r.feedback.recoveredCount,t[31]=y):y=t[31];let S;t[32]!==g||t[33]!==_||t[34]!==v||t[35]!==y?(S=(0,F.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:[g,_,v,y]}),t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=S):S=t[36];let C;t[37]!==r.feedback.primaryRepair||t[38]!==r.feedback.primaryRepairing||t[39]!==o||t[40]!==a||t[41]!==i?(C=o&&a?(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsxs)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:i,onClick:a,children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),i?r.feedback.primaryRepairing:r.feedback.primaryRepair]})}):null,t[37]=r.feedback.primaryRepair,t[38]=r.feedback.primaryRepairing,t[39]=o,t[40]=a,t[41]=i,t[42]=C):C=t[42];let T;return t[43]!==C||t[44]!==h||t[45]!==S?(T=(0,F.jsxs)(`div`,{className:`mb-3 border-l-2 border-accent/50 pl-3`,children:[h,S,C]}),t[43]=C,t[44]=h,t[45]=S,t[46]=T):T=t[46],T}function ie({eventType:e,source:t,payloadKey:n,payloadValue:r,limit:s=3,className:f,onSaveInsight:m,isInsightSaved:g}){let _=a(e=>e.language),v=o(_).automations,x=_===`zh`?`zh-CN`:`en-US`,S=[`product-automation-feedback`,e,t??``,n??``,r??``,s],[T,k]=(0,P.useState)(null),[A,j]=(0,P.useState)(null),{data:M,mutate:N}=E(e&&(!n||r!==void 0)?S:null,()=>O.productEventRuns({eventType:e,source:t,payloadKey:n,payloadValue:r,limit:s}),{revalidateOnFocus:!1,refreshInterval:e=>e?.items&&ee(e.items)?3e3:15e3}),[I,L]=(0,P.useState)({}),[R,z]=(0,P.useState)({}),B=M?.items??[],V=te(B),H=ne(B);if(!B.length)return null;let W=async(e,t)=>{k(e),j(null);try{await t(),await N()}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},G=async e=>{k(`${e.id}:repair`),j(null);try{let t=await O.repairDraft(e.id,{language:_});L(n=>({...n,[e.id]:t.repair})),z(t=>({...t,[e.id]:!1}))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},K=async(e,t,n=!1)=>{k(n?`${e.id}:applyAndRerun`:`${e.id}:applyRepair`),j(null);try{await O.update(e.automationId,t.patch),n&&await O.rerun(e.id),await N(),L(t=>{let n={...t};return delete n[e.id],n}),z(t=>{let n={...t};return delete n[e.id],n})}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},q=V.latestAttentionRun&&!I[V.latestAttentionRun.id]?V.latestAttentionRun:void 0,J=q?T===`${q.id}:repair`:!1;return(0,F.jsxs)(`section`,{className:w(`rounded-lg border border-edge bg-surface-panel p-3`,f),children:[(0,F.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`h3`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,F.jsx)(C,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate`,children:v.feedback.title})]}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:B.length})]}),(0,F.jsx)(re,{health:V,labels:v,primaryRepairBusy:J,onPrimaryRepair:q?()=>void G(q):void 0}),A?(0,F.jsxs)(`p`,{className:`mb-2 rounded-md border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`,role:`alert`,children:[v.feedback.actionFailed,`: `,A]}):null,(0,F.jsx)(`ul`,{className:`grid gap-2`,children:B.map(({run:e,triggerEvent:t})=>{let n=H.get(e.automationId),r=n?.id===e.id,a=Q(e.status)&&!r,o=a&&n?.status===`succeeded`,s=I[e.id],f=R[e.id]??!1,_=T===`${e.id}:repair`,S=T===`${e.id}:applyRepair`,C=T===`${e.id}:applyAndRerun`,E=U(e,t,v),k=g?.(e)??!1,A=e.status===`succeeded`&&!!e.summary&&!!m&&!k,j=T===`${e.id}:saveInsight`;return(0,F.jsxs)(`li`,{className:`rounded-md border border-edge/70 bg-surface-inset/35 px-2.5 py-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,F.jsx)(l,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName})]}),(0,F.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs text-fg-muted`,children:e.error||e.summary||t.message})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,F.jsx)(`span`,{className:w(`rounded-full border px-2 py-0.5 text-xs`,X(e.status)),children:v.status[e.status]}),a?(0,F.jsx)(`span`,{className:`rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:o?v.feedback.recovered:v.feedback.historical}):null]})]}),(0,F.jsx)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-xs text-fg-muted`,children:(0,F.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,F.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate`,children:Z(t.createdAtMs,x)})]})}),(0,F.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/60 bg-surface-base/45 px-2.5 py-2`,children:[(0,F.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:v.explain.whyRan}),(0,F.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:E.map(e=>(0,F.jsx)(`span`,{className:`rounded-full border border-edge/70 bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e))})]}),s?(0,F.jsxs)(`div`,{className:`mt-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-amber-800 dark:text-amber-200`,children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),v.repair.title]}),(0,F.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg`,children:s.explanation}),s.expectedEffect?(0,F.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:s.expectedEffect}):null,s.risks.length?(0,F.jsx)(`ul`,{className:`mt-2 list-disc space-y-1 pl-4 text-xs text-fg-muted`,children:s.risks.slice(0,3).map(e=>(0,F.jsx)(`li`,{children:e},e))}):null,s.requiresApproval?(0,F.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-xs text-fg`,children:[(0,F.jsx)(`input`,{className:`mt-0.5`,type:`checkbox`,checked:f,onChange:t=>{z(n=>({...n,[e.id]:t.target.checked}))}}),(0,F.jsx)(`span`,{children:v.repair.approval})]}):null,(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:[(0,F.jsx)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>{L(t=>{let n={...t};return delete n[e.id],n})},children:v.draft.discard}),(0,F.jsx)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:s.requiresApproval&&!f||T!==null,onClick:()=>void K(e,s),children:S?v.feedback.working:v.repair.apply}),(0,F.jsxs)(D,{variant:`primary`,className:`h-7 rounded-md px-2 text-xs`,disabled:s.requiresApproval&&!f||T!==null,onClick:()=>void K(e,s,!0),children:[(0,F.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),C?v.feedback.working:v.feedback.applyAndRerun]})]})]}):null,(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[k?(0,F.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1 rounded-md border border-emerald-500/25 bg-emerald-500/10 px-2 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.savedInsight]}):null,A?(0,F.jsxs)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:saveInsight`,()=>Promise.resolve(m(e))),children:[(0,F.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),j?v.feedback.savingInsight:v.feedback.saveInsight]}):null,e.conversationId?(0,F.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,children:(0,F.jsxs)(i,{to:`/chat/${encodeURIComponent(e.conversationId)}`,children:[(0,F.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.chat]})}):null,null,r&&Q(e.status)&&!s?(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void G(e),children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),_?v.repair.generating:v.repair.suggest]}):null,(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:rerun`,()=>O.rerun(e.id)),children:[(0,F.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),T===`${e.id}:rerun`?v.feedback.working:v.feedback.rerun]}),(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:pause`,()=>O.pause(e.automationId)),children:[(0,F.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),T===`${e.id}:pause`?v.feedback.working:v.feedback.pause]}),(0,F.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,children:(0,F.jsxs)(i,{to:`/automations?run=${encodeURIComponent(e.id)}`,children:[(0,F.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.open]})})]})]},e.id)})})]})}export{I as a,A as c,V as i,k as l,H as n,M as o,B as r,j as s,ie as t};
@@ -0,0 +1 @@
1
+ var e=[{id:`work-overview`,domain:`work`,path:`/`},{id:`work-projects`,domain:`work`,path:`/projects`},{id:`work-notes`,domain:`work`,path:`/notes`}],t=[{id:`automation-triggers`,domain:`automation`,path:`/automations`}],n=[`extensions`,`skills`,`connectors`,`devices`,`agents`,`channels`],r=n.map(e=>({id:`capabilities-${e}`,domain:`capabilities`,path:`/capabilities/${e}`}));function i(e){return`/capabilities/${e}`}var a=[{id:`work`,path:`/`,sections:e},{id:`automation`,path:`/automations`,sections:t},{id:`capabilities`,path:i(n[0]),sections:r},{id:`apps`,path:`/local-apps`,sections:[{id:`apps-library`,domain:`apps`,path:`/local-apps`}]},{id:`me`,path:`/user-model`,sections:[{id:`me-overview`,domain:`me`,path:`/user-model`}]}];function o(e,t){return e===t||e.startsWith(`${t}/`)}function s(e){return e===`/`||o(e,`/chat`)||o(e,`/tasks`)||o(e,`/projects`)||o(e,`/notes`)?`work`:o(e,`/automations`)?`automation`:o(e,`/capabilities`)?`capabilities`:o(e,`/local-apps`)||o(e,`/open`)?`apps`:o(e,`/user-model`)?`me`:null}function c(e,t=``){if(e===`/`)return`work-overview`;if(o(e,`/projects`))return`work-projects`;if(o(e,`/notes`))return`work-notes`;if(o(e,`/automations`))return`automation-triggers`;if(o(e,`/local-apps`)||o(e,`/open`))return`apps-library`;if(o(e,`/user-model`))return`me-overview`;if(o(e,`/capabilities`)){let t=`capabilities-${e.split(`/`)[2]||n[0]}`;return r.some(e=>e.id===t)?t:r[0].id}return null}function l(e){return a.find(t=>t.id===e)}function u(e){if(o(e,`/chat`)||o(e,`/tasks`))return!1;let t=s(e);return t===`work`||t===`automation`||t===`capabilities`}export{l as a,s as i,a as n,c as o,i as r,u as s,n as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,r,t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-BYdvIuPj.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{i as s,o as c}from"./product-delivery-4gEqUIsK.js";import{i as l}from"./vendor-swr-CdRzEUwF.js";import{n as u}from"./api-BtngCZrB.js";import{t as d}from"./open-route-MyZ2sB9C.js";var f=e(),p=t();function m(){let e=(0,f.c)(14),t=n(),i=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=l(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=c({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=d(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(o,{className:`h-6 w-48`}),(0,p.jsx)(o,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,f.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,r,t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{i as s,o as c}from"./product-delivery-4gEqUIsK.js";import{i as l}from"./vendor-swr-CdRzEUwF.js";import{n as u}from"./api-B3T06TLl.js";import{t as d}from"./open-route-MyZ2sB9C.js";var f=e(),p=t();function m(){let e=(0,f.c)(14),t=n(),i=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=l(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=c({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=d(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(o,{className:`h-6 w-48`}),(0,p.jsx)(o,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,f.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,t as r}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i,l as a,n as o}from"./locale-store-BYdvIuPj.js";import{t as s}from"./messages-lc5BjBtX.js";import{i as c,u as l}from"./automation-display-DaVDNZz8.js";import{F as u,V as d,t as f}from"./markdown-view-BOJVaGPC.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{a as m,c as h}from"./api-CnOSHyKU.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-C5tRaJxt.js";import{t as v}from"./automation-api-Cc5X3Q1t.js";import{n as y}from"./automation-task-card-CjzArAJi.js";import{i as b,n as x}from"./api-BtngCZrB.js";import{n as S}from"./product-preview-modal-B1RKw3Z-.js";import{t as C}from"./open-route-MyZ2sB9C.js";import{i as w,r as T}from"./automation-result-state-B7fHzLLf.js";import{t as E}from"./project-overview-model-DrLXaO-t.js";var D=e(),O=t(),k=new Set([`queued`,`running`,`cancelling`]);function A(e){let t=(0,D.c)(60),{automationId:n,runId:r}=e,i=o(N),a=i===`zh`,c,l;t[0]!==n||t[1]!==r?(c=[`automation-run-preview`,n,r],l=async()=>{let[e,t]=await Promise.all([v.get(n),r?v.getRun(r).then(M):Promise.resolve(void 0)]);if(t&&t.automationId!==n)throw Error(`Run does not belong to this task`);return{task:e.automation,run:t}},t[0]=n,t[1]=r,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u={shouldRetryOnError:!1,refreshInterval:j},t[4]=u):u=t[4];let{data:d,error:m,mutate:h}=g(c,l,u);if(m){let e=a?`暂时无法读取这次运行,请重试。`:`Could not load this run. Try again.`,n;t[5]===e?n=t[6]:(n=(0,O.jsx)(`p`,{children:e}),t[5]=e,t[6]=n);let r;t[7]===h?r=t[8]:(r=()=>void h(),t[7]=h,t[8]=r);let i=a?`重试`:`Retry`,o;t[9]!==r||t[10]!==i?(o=(0,O.jsx)(_,{variant:`secondary`,onClick:r,children:i}),t[9]=r,t[10]=i,t[11]=o):o=t[11];let s;return t[12]!==n||t[13]!==o?(s=(0,O.jsxs)(`div`,{role:`alert`,className:`space-y-3 text-sm text-fg-muted`,children:[n,o]}),t[12]=n,t[13]=o,t[14]=s):s=t[14],s}if(!d){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,O.jsx)(p,{className:`h-6 w-2/3`}),(0,O.jsx)(p,{className:`h-4 w-1/3`}),(0,O.jsx)(p,{className:`h-32`})]}),t[15]=e):e=t[15],e}let b=d.run;if(!b){let e;t[16]===d.task.name?e=t[17]:(e=(0,O.jsx)(`h2`,{className:`text-lg font-medium text-fg`,children:d.task.name}),t[16]=d.task.name,t[17]=e);let n=a?`这条旧链接没有关联具体执行,请从任务的运行记录查看。`:`This older link does not identify an execution. Choose one from the task history.`,r;t[18]===n?r=t[19]:(r=(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n}),t[18]=n,t[19]=r);let i;return t[20]!==e||t[21]!==r?(i=(0,O.jsxs)(`div`,{className:`space-y-3`,children:[e,r]}),t[20]=e,t[21]=r,t[22]=i):i=t[22],i}let x;t[23]===d.task.name?x=t[24]:(x=(0,O.jsx)(`h2`,{className:`text-lg font-medium text-fg`,children:d.task.name}),t[23]=d.task.name,t[24]=x);let S;t[25]===i?S=t[26]:(S=s(i),t[25]=i,t[26]=S);let C=S.automations.status[b.status],E;t[27]!==b.createdAtMs||t[28]!==a?(E=new Date(b.createdAtMs).toLocaleString(a?`zh-CN`:`en-US`),t[27]=b.createdAtMs,t[28]=a,t[29]=E):E=t[29];let A;t[30]!==C||t[31]!==E?(A=(0,O.jsxs)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:[C,` · `,E]}),t[30]=C,t[31]=E,t[32]=A):A=t[32];let P;t[33]!==x||t[34]!==A?(P=(0,O.jsxs)(`div`,{className:`space-y-2`,children:[x,A]}),t[33]=x,t[34]=A,t[35]=P):P=t[35];let F;t[36]!==b.status||t[37]!==a?(F=b.status===`queued`?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`任务正在排队,开始后会自动更新。`:`Queued. This view updates when execution starts.`}):b.status===`running`?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`正在执行,结果会自动显示在这里。`:`Running. The result will appear here automatically.`}):null,t[36]=b.status,t[37]=a,t[38]=F):F=t[38];let I;t[39]===b.summary?I=t[40]:(I=b.summary?(0,O.jsx)(f,{content:b.summary}):null,t[39]=b.summary,t[40]=I);let L;t[41]!==i||t[42]!==b?(L=b.error?(0,O.jsx)(`p`,{className:`text-sm leading-6 text-danger`,children:T(b,i)}):null,t[41]=i,t[42]=b,t[43]=L):L=t[43];let R;t[44]!==n||t[45]!==i||t[46]!==b.id||t[47]!==b.status?(R=b.status===`failed`||b.status===`timeout`?(0,O.jsx)(y,{automationId:n,runId:b.id,language:i,variant:`secondary`}):null,t[44]=n,t[45]=i,t[46]=b.id,t[47]=b.status,t[48]=R):R=t[48];let z;t[49]!==i||t[50]!==b.id||t[51]!==b.status?(z=k.has(b.status)?null:(0,O.jsx)(w,{runId:b.id,language:i}),t[49]=i,t[50]=b.id,t[51]=b.status,t[52]=z):z=t[52];let ee;return t[53]!==F||t[54]!==I||t[55]!==L||t[56]!==R||t[57]!==z||t[58]!==P?(ee=(0,O.jsxs)(`div`,{className:`space-y-5`,children:[P,F,I,L,R,z]}),t[53]=F,t[54]=I,t[55]=L,t[56]=R,t[57]=z,t[58]=P,t[59]=ee):ee=t[59],ee}function j(e){return e&&(e.task.state.runningRunId||e.run&&k.has(e.run.status))?3e3:0}function M(e){return e.run}function N(e){return e.language}var P=`rounded text-sm text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent`,F=e=>e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`);function I(e){let t=(0,D.c)(83),{project:i,target:c}=e,l=o(re),m=a(B),_=n(),v=l===`zh`,y;t[0]===l?y=t[1]:(y=s(l),t[0]=l,t[1]=y);let b=y.projectDetailPage,x;t[2]!==c.id||t[3]!==m?(x=[`chat-project-operating-view`,c.id,m],t[2]=c.id,t[3]=m,t[4]=x):x=t[4];let S;t[5]===c.id?S=t[6]:(S=()=>h(c.id),t[5]=c.id,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C={shouldRetryOnError:!1},t[7]=C):C=t[7];let{data:w,error:T,isLoading:k,mutate:A}=g(x,S,C),j=`${_.pathname}${_.search}`,M=`/projects/${encodeURIComponent(c.id)}`,N;t[8]!==j||t[9]!==M||t[10]!==c.ownerAgentId?(N=e=>{let t=new URLSearchParams;return c.ownerAgentId&&t.set(`agentId`,c.ownerAgentId),d(`${M}/${e}${t.size?`?${t}`:``}`,j)},t[8]=j,t[9]=M,t[10]=c.ownerAgentId,t[11]=N):N=t[11];let I=N,V;t[12]===j?V=t[13]:(V=e=>u(j,e),t[12]=j,t[13]=V);let H=V,U,W,G,K,q,J,Y;if(t[14]!==T||t[15]!==k||t[16]!==A||t[17]!==b||t[18]!==i||t[19]!==I||t[20]!==H||t[21]!==w||t[22]!==v){let e=w?.tasks??[],n={moving:0,ready:0,waiting:0,needsUser:0,done:0};for(let t of e)t.phase===`closed`?t.resolution===`done`&&(n.done+=1):F(t)?n.needsUser+=1:[`queued`,`running`,`verifying`].includes(t.operationalState)?n.moving+=1:[`waiting`,`blocked`].includes(t.operationalState)?n.waiting+=1:n.ready+=1;let a={moving:v?`进行中`:`In progress`,ready:v?`待处理`:`To do`,waiting:v?`等待中`:`Waiting`,needsUser:v?`等你处理`:`Needs you`,done:v?`已完成`:`Completed`},o=new Set(e.filter(ne).map(te)),s=(w?.blockers??[]).filter(e=>o.has(e.taskId)).sort(ee),c=s.filter((e,t)=>s.findIndex(t=>t.taskId===e.taskId)===t).slice(0,2),l=E(e,e.length).sort(z).slice(0,3),u=[...(i.recentUpdates??[]).map((e,t)=>({id:`update:${e.id??t}`,source:`project`,summary:e.summary,at:e.createdAt,title:v?`项目进展`:`Project update`,href:I(`progress`)})),...(w?.recentResults??[]).map(e=>{let{taskId:t,taskTitle:n,receipt:r}=e;return{id:`receipt:${r.runId}`,source:`task:${t}`,summary:r.summary,at:r.finalizedAt,title:`${n} · ${v?{passed:`验证通过`,failed:`验证失败`,unverified:`未验证`}[r.verification.status]:r.verification.status}`,href:H(t)}})].filter(R).sort(L),d=u.filter((e,t)=>u.findIndex(t=>t.source===e.source&&t.summary.trim()===e.summary.trim())===t).slice(0,3),m;t[30]===v?m=t[31]:(m=e=>e===void 0||!Number.isFinite(new Date(e).getTime())?null:new Intl.DateTimeFormat(v?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)),t[30]=v,t[31]=m);let h=m,g=i.lastActiveAt||i.updatedAt,_;t[32]!==h||t[33]!==g?(_=h(g),t[32]=h,t[33]=g,t[34]=_):_=t[34];let y=_,x=i.outcome||i.description||i.brief,S=v?`项目健康度尚未评估`:`Project health not assessed`,C=v?`进展正常`:`On track`,D=v?`存在风险`:`At risk`,j=v?`偏离计划`:`Off track`,M;t[35]!==S||t[36]!==C||t[37]!==D||t[38]!==j?(M={unknown:S,on_track:C,at_risk:D,off_track:j},t[35]=S,t[36]=C,t[37]=D,t[38]=j,t[39]=M):M=t[39];let N=M;U=`space-y-5`;let B;t[40]===i.name?B=t[41]:(B=(0,O.jsx)(`h2`,{className:`min-w-0 break-words text-xl font-semibold text-fg`,children:i.name}),t[40]=i.name,t[41]=B);let re=b.statuses[i.status],V;t[42]===re?V=t[43]:(V=(0,O.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-inset px-2 py-1 text-xs text-fg-muted`,children:re}),t[42]=re,t[43]=V);let X;t[44]!==B||t[45]!==V?(X=(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[B,V]}),t[44]=B,t[45]=V,t[46]=X):X=t[46];let Z;t[47]!==x||t[48]!==v?(Z=x?(0,O.jsx)(`div`,{className:`line-clamp-3 text-sm text-fg-muted`,children:(0,O.jsx)(f,{content:x,mermaidActions:!1})}):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v?`尚未填写项目目标。`:`No project goal recorded yet.`}),t[47]=x,t[48]=v,t[49]=Z):Z=t[49];let ie=N[i.health],ae=y?` · ${v?`最近活动`:`Last activity`} ${y}`:``,Q;t[50]!==ie||t[51]!==ae?(Q=(0,O.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[ie,ae]}),t[50]=ie,t[51]=ae,t[52]=Q):Q=t[52],t[53]!==X||t[54]!==Z||t[55]!==Q?(W=(0,O.jsxs)(`div`,{className:`space-y-2`,children:[X,Z,Q]}),t[53]=X,t[54]=Z,t[55]=Q,t[56]=W):W=t[56];let oe=v?`当前概况`:`Overview`,se=v?`当前概况`:`Overview`,$;t[57]===se?$=t[58]:($=(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:se}),t[57]=se,t[58]=$);let ce=k?(0,O.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,O.jsx)(p,{className:`h-4 w-3/4`}),(0,O.jsx)(p,{className:`h-14 w-full`})]}):T||!w?(0,O.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,O.jsx)(`span`,{children:v?`任务概况暂时无法读取。`:`Task overview is temporarily unavailable.`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:P,children:v?`重试`:`Retry`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.length===0?v?`尚未关联任务,可在项目中添加下一步工作。`:`No tasks linked yet. Add the next piece of work in the project.`:v?`${n.moving} 项任务正在推进,${n.needsUser} 项等你处理,${n.waiting} 项等待中。`:`${n.moving} in progress, ${n.needsUser} need your input, ${n.waiting} waiting.`}),w.digest.recommendedAction&&(0,O.jsxs)(`p`,{className:`break-words text-sm leading-6 text-fg-muted`,children:[v?`建议下一步:`:`Suggested next step: `,w.digest.recommendedAction]}),(0,O.jsx)(`dl`,{className:`grid grid-cols-3 gap-3 border-t border-edge pt-3 sm:grid-cols-5`,children:Object.keys(a).map(e=>(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`dt`,{className:`text-xs text-fg-muted`,children:a[e]}),(0,O.jsx)(`dd`,{className:`mt-1 text-xl font-semibold tabular-nums text-fg`,children:n[e]})]},e))})]});t[59]!==oe||t[60]!==$||t[61]!==ce?(G=(0,O.jsxs)(`section`,{"aria-label":oe,className:`space-y-3 rounded-xl border border-edge bg-surface-inset/50 p-4`,children:[$,ce]}),t[59]=oe,t[60]=$,t[61]=ce,t[62]=G):G=t[62],K=w&&(0,O.jsxs)(`div`,{className:`grid gap-6 sm:grid-cols-2`,children:[(0,O.jsxs)(`section`,{className:`min-w-0 space-y-3`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v?`优先关注`:`Needs attention`}),c.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>(0,O.jsx)(`li`,{className:`py-3 first:pt-0`,children:(0,O.jsxs)(r,{to:H(e.taskId),className:`block rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`p`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),(0,O.jsx)(`p`,{className:`mt-1 line-clamp-3 break-words text-sm leading-6 text-fg-muted`,children:e.detail}),(0,O.jsx)(`span`,{className:`mt-2 inline-block ${P}`,children:v?`查看关联任务 →`:`View task →`})]})},e.taskId))}):(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:v?`暂无已记录的阻塞或待处理提醒。`:`No recorded blockers or attention items.`})]}),(0,O.jsxs)(`section`,{className:`min-w-0 space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v?`当前任务`:`Current tasks`}),(0,O.jsx)(r,{to:I(`tasks`),className:P,children:v?`查看全部`:`View all`})]}),l.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge`,children:l.map(e=>(0,O.jsx)(`li`,{children:(0,O.jsxs)(r,{to:H(e.id),className:`block rounded-lg py-3 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`p`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),(0,O.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[b.board.phases[e.phase],e.operationalState===`idle`?``:` · ${b.board.operationalStates[e.operationalState]}`]})]})},e.id))}):(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:v?`暂无可推进的任务,等待中的任务可在全部任务中查看。`:`No actionable tasks. View all tasks to see any waiting work.`})]})]}),q=`space-y-3 border-t border-edge pt-5`;let le=v?`最近进展`:`Recent progress`,ue;t[63]===le?ue=t[64]:(ue=(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:le}),t[63]=le,t[64]=ue);let de;t[65]===I?de=t[66]:(de=I(`progress`),t[65]=I,t[66]=de);let fe=v?`查看记录`:`View history`,pe;t[67]!==de||t[68]!==fe?(pe=(0,O.jsx)(r,{to:de,className:P,children:fe}),t[67]=de,t[68]=fe,t[69]=pe):pe=t[69],t[70]!==ue||t[71]!==pe?(J=(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[ue,pe]}),t[70]=ue,t[71]=pe,t[72]=J):J=t[72],Y=d.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:d.map(e=>(0,O.jsxs)(`li`,{className:`space-y-2 py-3 first:pt-0`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,O.jsxs)(`p`,{className:`min-w-0 break-words text-xs text-fg-muted`,children:[e.title,h(e.at)?` · ${h(e.at)}`:``]}),(0,O.jsx)(r,{to:e.href,className:P,children:v?`查看来源`:`View source`})]}),(0,O.jsx)(`div`,{className:`line-clamp-3 break-words text-sm text-fg`,children:(0,O.jsx)(f,{content:e.summary,mermaidActions:!1})})]},e.id))}):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v?`暂无项目进展或执行结果。`:`No project updates or execution results yet.`}),t[14]=T,t[15]=k,t[16]=A,t[17]=b,t[18]=i,t[19]=I,t[20]=H,t[21]=w,t[22]=v,t[23]=U,t[24]=W,t[25]=G,t[26]=K,t[27]=q,t[28]=J,t[29]=Y}else U=t[23],W=t[24],G=t[25],K=t[26],q=t[27],J=t[28],Y=t[29];let X;t[73]!==q||t[74]!==J||t[75]!==Y?(X=(0,O.jsxs)(`section`,{className:q,children:[J,Y]}),t[73]=q,t[74]=J,t[75]=Y,t[76]=X):X=t[76];let Z;return t[77]!==U||t[78]!==W||t[79]!==G||t[80]!==K||t[81]!==X?(Z=(0,O.jsxs)(`div`,{className:U,children:[W,G,K,X]}),t[77]=U,t[78]=W,t[79]=G,t[80]=K,t[81]=X,t[82]=Z):Z=t[82],Z}function L(e,t){return(t.at||0)-(e.at||0)}function R(e){return e.summary?.trim()}function z(e,t){return Number([`queued`,`running`,`verifying`].includes(t.operationalState))-Number([`queued`,`running`,`verifying`].includes(e.operationalState))}function ee(e,t){return Number([`input_required`,`approval_required`].includes(t.kind))-Number([`input_required`,`approval_required`].includes(e.kind))}function te(e){return e.id}function ne(e){return e.phase!==`closed`}function B(e){return e.conversationId}function re(e){return e.language}async function V(e){switch(e.kind){case`project`:return{kind:e.kind,value:await m(e.id)};case`automation`:{let[t,n]=await Promise.all([v.list(),v.runs(5,e.id)]);return{kind:e.kind,value:t.automations.find(t=>t.id===e.id),runs:n.runs}}case`local_app`:{let t=await x(e.id),n=e.sourceHash?await b(e.id,e.sourceHash):void 0;return{kind:e.kind,value:t,previewUrl:n?.previewUrl||t.draftPreviewUrl}}}}var H={pending:[`等待中`,`Pending`],planned:[`计划中`,`Planned`],active:[`进行中`,`Active`],paused:[`已暂停`,`Paused`],completed:[`已完成`,`Completed`],cancelled:[`已取消`,`Cancelled`],archived:[`已归档`,`Archived`],queued:[`排队中`,`Queued`],running:[`运行中`,`Running`],succeeded:[`成功`,`Succeeded`],failed:[`失败`,`Failed`],timeout:[`超时`,`Timed out`],cancelling:[`取消中`,`Cancelling`],unknown:[`尚未评估`,`Not assessed`],on_track:[`进展正常`,`On track`],at_risk:[`存在风险`,`At risk`],off_track:[`偏离计划`,`Off track`]};function U(e){let t=(0,D.c)(5),{target:n}=e;if(n.kind===`automation`&&n.view===`run`){let e;return t[0]!==n.id||t[1]!==n.runId?(e=(0,O.jsx)(A,{automationId:n.id,runId:n.runId}),t[0]=n.id,t[1]=n.runId,t[2]=e):e=t[2],e}let r;return t[3]===n?r=t[4]:(r=(0,O.jsx)(W,{target:n}),t[3]=n,t[4]=r),r}function W(e){let t=(0,D.c)(56),{target:n}=e,u=a(J),d=o(q),f=d===`zh`,p=s(d),m;t[0]===f?m=t[1]:(m=e=>H[e]?.[+!f]||e,t[0]=f,t[1]=m);let h=m,_;t[2]!==n.href||t[3]!==u?(_=[`chat-product-preview`,n.href,u],t[2]=n.href,t[3]=u,t[4]=_):_=t[4];let v;t[5]===n?v=t[6]:(v=()=>V(n),t[5]=n,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={shouldRetryOnError:!1,refreshInterval:K},t[7]=y):y=t[7];let{data:b,error:x,isLoading:w}=g(_,v,y);if(w){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsx)(S,{}),t[8]=e):e=t[8],e}if(x){let e=f?`无法加载内容,它可能已删除或暂时不可用。`:`Unable to load this content. It may have been deleted or be temporarily unavailable.`,n;return t[9]===e?n=t[10]:(n=(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:e}),t[9]=e,t[10]=n),n}if(!b?.value){let e=f?`内容不存在或已删除。`:`This content is unavailable or has been deleted.`,n;return t[11]===e?n=t[12]:(n=(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n),n}let T=G;if(b.kind===`project`){let e;return t[13]!==b.value||t[14]!==n?(e=(0,O.jsx)(I,{project:b.value,target:n}),t[13]=b.value,t[14]=n,t[15]=e):e=t[15],e}if(b.kind===`automation`){let e=b.value,n=e.action.kind===`agent`?e.action.instruction:void 0,r;t[16]===e.name?r=t[17]:(r=(0,O.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.name}),t[16]=e.name,t[17]=r);let i;t[18]!==e.description||t[19]!==T?(i=T(e.description),t[18]=e.description,t[19]=T,t[20]=i):i=t[20];let a;t[21]!==n||t[22]!==T?(a=T(n),t[21]=n,t[22]=T,t[23]=a):a=t[23];let o;t[24]!==e.state.nextRunAtMs||t[25]!==f?(o=e.state.nextRunAtMs&&(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[f?`下次运行`:`Next run`,` · `,new Date(e.state.nextRunAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),t[24]=e.state.nextRunAtMs,t[25]=f,t[26]=o):o=t[26];let s;t[27]===e.state.lastError?s=t[28]:(s=e.state.lastError&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.state.lastError}),t[27]=e.state.lastError,t[28]=s);let u=f?`最近运行`:`Recent runs`,m;t[29]===u?m=t[30]:(m=(0,O.jsx)(`h3`,{className:`font-medium text-fg`,children:u}),t[29]=u,t[30]=m);let g;t[31]!==b.runs||t[32]!==T||t[33]!==h||t[34]!==f?(g=b.runs.length?b.runs.map(e=>(0,O.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[h(e.status),` · `,new Date(e.createdAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),T(e.summary),e.error&&(0,O.jsx)(`p`,{className:`text-sm text-danger`,children:e.error})]},e.id)):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f?`暂无运行记录。`:`No runs yet.`}),t[31]=b.runs,t[32]=T,t[33]=h,t[34]=f,t[35]=g):g=t[35];let _;return t[36]!==m||t[37]!==g?(_=(0,O.jsxs)(`section`,{className:`space-y-3`,children:[m,g]}),t[36]=m,t[37]=g,t[38]=_):_=t[38],(0,O.jsxs)(`div`,{className:`space-y-6`,children:[(0,O.jsxs)(`div`,{className:`space-y-3`,children:[r,(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[l(e)?f?`已完成`:`Completed`:e.enabled?f?`已启用`:`Enabled`:f?`已暂停`:`Paused`,` · `,c(e.trigger,p.automations,p.cron,d)]}),i,a,o,s]}),_]})}let E=b.value,k;t[39]===E.name?k=t[40]:(k=(0,O.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:E.name}),t[39]=E.name,t[40]=k);let A=E.description||E.idea,j;t[41]!==T||t[42]!==A?(j=T(A),t[41]=T,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==E.name||t[45]!==b.previewUrl||t[46]!==f?(M=b.previewUrl&&(0,O.jsx)(`iframe`,{title:f?`${E.name} 交互预览`:`${E.name} interactive preview`,src:i(b.previewUrl),sandbox:`allow-scripts allow-forms`,className:`h-[min(30rem,55dvh)] w-full rounded-lg border border-edge bg-white`}),t[44]=E.name,t[45]=b.previewUrl,t[46]=f,t[47]=M):M=t[47];let N;t[48]!==E||t[49]!==f?(N=E.installationState===`installed`&&E.enabled&&E.status===`installed`&&(0,O.jsx)(r,{to:C(E),className:`inline-flex rounded-lg bg-accent px-3 py-2 text-sm text-white focus-visible:ring-2 focus-visible:ring-accent`,children:f?`使用应用`:`Use app`}),t[48]=E,t[49]=f,t[50]=N):N=t[50];let P;return t[51]!==k||t[52]!==j||t[53]!==M||t[54]!==N?(P=(0,O.jsxs)(`div`,{className:`space-y-5`,children:[k,j,M,N]}),t[51]=k,t[52]=j,t[53]=M,t[54]=N,t[55]=P):P=t[55],P}function G(e){return e?.trim()?(0,O.jsx)(f,{content:e,mermaidActions:!1}):null}function K(e){return e?.kind===`automation`&&e.value?.state.runningRunId?3e3:0}function q(e){return e.language}function J(e){return e.conversationId}export{U as default};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,t as r}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i,l as a,n as o}from"./locale-store-CHjsq5NR.js";import{t as s}from"./messages-C7QSnTdg.js";import{i as c,u as l}from"./automation-display-DaVDNZz8.js";import{F as u,V as d,t as f}from"./markdown-view-ihzUc4ud.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{a as m,c as h}from"./api-CGs641OT.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-C5tRaJxt.js";import{t as v}from"./automation-api-D-gn6x5E.js";import{n as y}from"./automation-task-card-C453Q-Wa.js";import{i as b,n as x}from"./api-B3T06TLl.js";import{n as S}from"./product-preview-modal-DIh_CsXp.js";import{t as C}from"./open-route-MyZ2sB9C.js";import{i as w,r as T}from"./automation-result-state-B7hq0XOL.js";import{t as E}from"./project-overview-model-DrLXaO-t.js";var D=e(),O=t(),k=new Set([`queued`,`running`,`cancelling`]);function A(e){let t=(0,D.c)(60),{automationId:n,runId:r}=e,i=o(N),a=i===`zh`,c,l;t[0]!==n||t[1]!==r?(c=[`automation-run-preview`,n,r],l=async()=>{let[e,t]=await Promise.all([v.get(n),r?v.getRun(r).then(M):Promise.resolve(void 0)]);if(t&&t.automationId!==n)throw Error(`Run does not belong to this task`);return{task:e.automation,run:t}},t[0]=n,t[1]=r,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u={shouldRetryOnError:!1,refreshInterval:j},t[4]=u):u=t[4];let{data:d,error:m,mutate:h}=g(c,l,u);if(m){let e=a?`暂时无法读取这次运行,请重试。`:`Could not load this run. Try again.`,n;t[5]===e?n=t[6]:(n=(0,O.jsx)(`p`,{children:e}),t[5]=e,t[6]=n);let r;t[7]===h?r=t[8]:(r=()=>void h(),t[7]=h,t[8]=r);let i=a?`重试`:`Retry`,o;t[9]!==r||t[10]!==i?(o=(0,O.jsx)(_,{variant:`secondary`,onClick:r,children:i}),t[9]=r,t[10]=i,t[11]=o):o=t[11];let s;return t[12]!==n||t[13]!==o?(s=(0,O.jsxs)(`div`,{role:`alert`,className:`space-y-3 text-sm text-fg-muted`,children:[n,o]}),t[12]=n,t[13]=o,t[14]=s):s=t[14],s}if(!d){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,O.jsx)(p,{className:`h-6 w-2/3`}),(0,O.jsx)(p,{className:`h-4 w-1/3`}),(0,O.jsx)(p,{className:`h-32`})]}),t[15]=e):e=t[15],e}let b=d.run;if(!b){let e;t[16]===d.task.name?e=t[17]:(e=(0,O.jsx)(`h2`,{className:`text-lg font-medium text-fg`,children:d.task.name}),t[16]=d.task.name,t[17]=e);let n=a?`这条旧链接没有关联具体执行,请从任务的运行记录查看。`:`This older link does not identify an execution. Choose one from the task history.`,r;t[18]===n?r=t[19]:(r=(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n}),t[18]=n,t[19]=r);let i;return t[20]!==e||t[21]!==r?(i=(0,O.jsxs)(`div`,{className:`space-y-3`,children:[e,r]}),t[20]=e,t[21]=r,t[22]=i):i=t[22],i}let x;t[23]===d.task.name?x=t[24]:(x=(0,O.jsx)(`h2`,{className:`text-lg font-medium text-fg`,children:d.task.name}),t[23]=d.task.name,t[24]=x);let S;t[25]===i?S=t[26]:(S=s(i),t[25]=i,t[26]=S);let C=S.automations.status[b.status],E;t[27]!==b.createdAtMs||t[28]!==a?(E=new Date(b.createdAtMs).toLocaleString(a?`zh-CN`:`en-US`),t[27]=b.createdAtMs,t[28]=a,t[29]=E):E=t[29];let A;t[30]!==C||t[31]!==E?(A=(0,O.jsxs)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:[C,` · `,E]}),t[30]=C,t[31]=E,t[32]=A):A=t[32];let P;t[33]!==x||t[34]!==A?(P=(0,O.jsxs)(`div`,{className:`space-y-2`,children:[x,A]}),t[33]=x,t[34]=A,t[35]=P):P=t[35];let F;t[36]!==b.status||t[37]!==a?(F=b.status===`queued`?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`任务正在排队,开始后会自动更新。`:`Queued. This view updates when execution starts.`}):b.status===`running`?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`正在执行,结果会自动显示在这里。`:`Running. The result will appear here automatically.`}):null,t[36]=b.status,t[37]=a,t[38]=F):F=t[38];let I;t[39]===b.summary?I=t[40]:(I=b.summary?(0,O.jsx)(f,{content:b.summary}):null,t[39]=b.summary,t[40]=I);let L;t[41]!==i||t[42]!==b?(L=b.error?(0,O.jsx)(`p`,{className:`text-sm leading-6 text-danger`,children:T(b,i)}):null,t[41]=i,t[42]=b,t[43]=L):L=t[43];let R;t[44]!==n||t[45]!==i||t[46]!==b.id||t[47]!==b.status?(R=b.status===`failed`||b.status===`timeout`?(0,O.jsx)(y,{automationId:n,runId:b.id,language:i,variant:`secondary`}):null,t[44]=n,t[45]=i,t[46]=b.id,t[47]=b.status,t[48]=R):R=t[48];let z;t[49]!==i||t[50]!==b.id||t[51]!==b.status?(z=k.has(b.status)?null:(0,O.jsx)(w,{runId:b.id,language:i}),t[49]=i,t[50]=b.id,t[51]=b.status,t[52]=z):z=t[52];let ee;return t[53]!==F||t[54]!==I||t[55]!==L||t[56]!==R||t[57]!==z||t[58]!==P?(ee=(0,O.jsxs)(`div`,{className:`space-y-5`,children:[P,F,I,L,R,z]}),t[53]=F,t[54]=I,t[55]=L,t[56]=R,t[57]=z,t[58]=P,t[59]=ee):ee=t[59],ee}function j(e){return e&&(e.task.state.runningRunId||e.run&&k.has(e.run.status))?3e3:0}function M(e){return e.run}function N(e){return e.language}var P=`rounded text-sm text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent`,F=e=>e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`);function I(e){let t=(0,D.c)(83),{project:i,target:c}=e,l=o(re),m=a(B),_=n(),v=l===`zh`,y;t[0]===l?y=t[1]:(y=s(l),t[0]=l,t[1]=y);let b=y.projectDetailPage,x;t[2]!==c.id||t[3]!==m?(x=[`chat-project-operating-view`,c.id,m],t[2]=c.id,t[3]=m,t[4]=x):x=t[4];let S;t[5]===c.id?S=t[6]:(S=()=>h(c.id),t[5]=c.id,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C={shouldRetryOnError:!1},t[7]=C):C=t[7];let{data:w,error:T,isLoading:k,mutate:A}=g(x,S,C),j=`${_.pathname}${_.search}`,M=`/projects/${encodeURIComponent(c.id)}`,N;t[8]!==j||t[9]!==M||t[10]!==c.ownerAgentId?(N=e=>{let t=new URLSearchParams;return c.ownerAgentId&&t.set(`agentId`,c.ownerAgentId),d(`${M}/${e}${t.size?`?${t}`:``}`,j)},t[8]=j,t[9]=M,t[10]=c.ownerAgentId,t[11]=N):N=t[11];let I=N,V;t[12]===j?V=t[13]:(V=e=>u(j,e),t[12]=j,t[13]=V);let H=V,U,W,G,K,q,J,Y;if(t[14]!==T||t[15]!==k||t[16]!==A||t[17]!==b||t[18]!==i||t[19]!==I||t[20]!==H||t[21]!==w||t[22]!==v){let e=w?.tasks??[],n={moving:0,ready:0,waiting:0,needsUser:0,done:0};for(let t of e)t.phase===`closed`?t.resolution===`done`&&(n.done+=1):F(t)?n.needsUser+=1:[`queued`,`running`,`verifying`].includes(t.operationalState)?n.moving+=1:[`waiting`,`blocked`].includes(t.operationalState)?n.waiting+=1:n.ready+=1;let a={moving:v?`进行中`:`In progress`,ready:v?`待处理`:`To do`,waiting:v?`等待中`:`Waiting`,needsUser:v?`等你处理`:`Needs you`,done:v?`已完成`:`Completed`},o=new Set(e.filter(ne).map(te)),s=(w?.blockers??[]).filter(e=>o.has(e.taskId)).sort(ee),c=s.filter((e,t)=>s.findIndex(t=>t.taskId===e.taskId)===t).slice(0,2),l=E(e,e.length).sort(z).slice(0,3),u=[...(i.recentUpdates??[]).map((e,t)=>({id:`update:${e.id??t}`,source:`project`,summary:e.summary,at:e.createdAt,title:v?`项目进展`:`Project update`,href:I(`progress`)})),...(w?.recentResults??[]).map(e=>{let{taskId:t,taskTitle:n,receipt:r}=e;return{id:`receipt:${r.runId}`,source:`task:${t}`,summary:r.summary,at:r.finalizedAt,title:`${n} · ${v?{passed:`验证通过`,failed:`验证失败`,unverified:`未验证`}[r.verification.status]:r.verification.status}`,href:H(t)}})].filter(R).sort(L),d=u.filter((e,t)=>u.findIndex(t=>t.source===e.source&&t.summary.trim()===e.summary.trim())===t).slice(0,3),m;t[30]===v?m=t[31]:(m=e=>e===void 0||!Number.isFinite(new Date(e).getTime())?null:new Intl.DateTimeFormat(v?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)),t[30]=v,t[31]=m);let h=m,g=i.lastActiveAt||i.updatedAt,_;t[32]!==h||t[33]!==g?(_=h(g),t[32]=h,t[33]=g,t[34]=_):_=t[34];let y=_,x=i.outcome||i.description||i.brief,S=v?`项目健康度尚未评估`:`Project health not assessed`,C=v?`进展正常`:`On track`,D=v?`存在风险`:`At risk`,j=v?`偏离计划`:`Off track`,M;t[35]!==S||t[36]!==C||t[37]!==D||t[38]!==j?(M={unknown:S,on_track:C,at_risk:D,off_track:j},t[35]=S,t[36]=C,t[37]=D,t[38]=j,t[39]=M):M=t[39];let N=M;U=`space-y-5`;let B;t[40]===i.name?B=t[41]:(B=(0,O.jsx)(`h2`,{className:`min-w-0 break-words text-xl font-semibold text-fg`,children:i.name}),t[40]=i.name,t[41]=B);let re=b.statuses[i.status],V;t[42]===re?V=t[43]:(V=(0,O.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-inset px-2 py-1 text-xs text-fg-muted`,children:re}),t[42]=re,t[43]=V);let X;t[44]!==B||t[45]!==V?(X=(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[B,V]}),t[44]=B,t[45]=V,t[46]=X):X=t[46];let Z;t[47]!==x||t[48]!==v?(Z=x?(0,O.jsx)(`div`,{className:`line-clamp-3 text-sm text-fg-muted`,children:(0,O.jsx)(f,{content:x,mermaidActions:!1})}):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v?`尚未填写项目目标。`:`No project goal recorded yet.`}),t[47]=x,t[48]=v,t[49]=Z):Z=t[49];let ie=N[i.health],ae=y?` · ${v?`最近活动`:`Last activity`} ${y}`:``,Q;t[50]!==ie||t[51]!==ae?(Q=(0,O.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[ie,ae]}),t[50]=ie,t[51]=ae,t[52]=Q):Q=t[52],t[53]!==X||t[54]!==Z||t[55]!==Q?(W=(0,O.jsxs)(`div`,{className:`space-y-2`,children:[X,Z,Q]}),t[53]=X,t[54]=Z,t[55]=Q,t[56]=W):W=t[56];let oe=v?`当前概况`:`Overview`,se=v?`当前概况`:`Overview`,$;t[57]===se?$=t[58]:($=(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:se}),t[57]=se,t[58]=$);let ce=k?(0,O.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,O.jsx)(p,{className:`h-4 w-3/4`}),(0,O.jsx)(p,{className:`h-14 w-full`})]}):T||!w?(0,O.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,O.jsx)(`span`,{children:v?`任务概况暂时无法读取。`:`Task overview is temporarily unavailable.`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:P,children:v?`重试`:`Retry`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.length===0?v?`尚未关联任务,可在项目中添加下一步工作。`:`No tasks linked yet. Add the next piece of work in the project.`:v?`${n.moving} 项任务正在推进,${n.needsUser} 项等你处理,${n.waiting} 项等待中。`:`${n.moving} in progress, ${n.needsUser} need your input, ${n.waiting} waiting.`}),w.digest.recommendedAction&&(0,O.jsxs)(`p`,{className:`break-words text-sm leading-6 text-fg-muted`,children:[v?`建议下一步:`:`Suggested next step: `,w.digest.recommendedAction]}),(0,O.jsx)(`dl`,{className:`grid grid-cols-3 gap-3 border-t border-edge pt-3 sm:grid-cols-5`,children:Object.keys(a).map(e=>(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`dt`,{className:`text-xs text-fg-muted`,children:a[e]}),(0,O.jsx)(`dd`,{className:`mt-1 text-xl font-semibold tabular-nums text-fg`,children:n[e]})]},e))})]});t[59]!==oe||t[60]!==$||t[61]!==ce?(G=(0,O.jsxs)(`section`,{"aria-label":oe,className:`space-y-3 rounded-xl border border-edge bg-surface-inset/50 p-4`,children:[$,ce]}),t[59]=oe,t[60]=$,t[61]=ce,t[62]=G):G=t[62],K=w&&(0,O.jsxs)(`div`,{className:`grid gap-6 sm:grid-cols-2`,children:[(0,O.jsxs)(`section`,{className:`min-w-0 space-y-3`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v?`优先关注`:`Needs attention`}),c.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>(0,O.jsx)(`li`,{className:`py-3 first:pt-0`,children:(0,O.jsxs)(r,{to:H(e.taskId),className:`block rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`p`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),(0,O.jsx)(`p`,{className:`mt-1 line-clamp-3 break-words text-sm leading-6 text-fg-muted`,children:e.detail}),(0,O.jsx)(`span`,{className:`mt-2 inline-block ${P}`,children:v?`查看关联任务 →`:`View task →`})]})},e.taskId))}):(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:v?`暂无已记录的阻塞或待处理提醒。`:`No recorded blockers or attention items.`})]}),(0,O.jsxs)(`section`,{className:`min-w-0 space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v?`当前任务`:`Current tasks`}),(0,O.jsx)(r,{to:I(`tasks`),className:P,children:v?`查看全部`:`View all`})]}),l.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge`,children:l.map(e=>(0,O.jsx)(`li`,{children:(0,O.jsxs)(r,{to:H(e.id),className:`block rounded-lg py-3 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`p`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),(0,O.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[b.board.phases[e.phase],e.operationalState===`idle`?``:` · ${b.board.operationalStates[e.operationalState]}`]})]})},e.id))}):(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:v?`暂无可推进的任务,等待中的任务可在全部任务中查看。`:`No actionable tasks. View all tasks to see any waiting work.`})]})]}),q=`space-y-3 border-t border-edge pt-5`;let le=v?`最近进展`:`Recent progress`,ue;t[63]===le?ue=t[64]:(ue=(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:le}),t[63]=le,t[64]=ue);let de;t[65]===I?de=t[66]:(de=I(`progress`),t[65]=I,t[66]=de);let fe=v?`查看记录`:`View history`,pe;t[67]!==de||t[68]!==fe?(pe=(0,O.jsx)(r,{to:de,className:P,children:fe}),t[67]=de,t[68]=fe,t[69]=pe):pe=t[69],t[70]!==ue||t[71]!==pe?(J=(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[ue,pe]}),t[70]=ue,t[71]=pe,t[72]=J):J=t[72],Y=d.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:d.map(e=>(0,O.jsxs)(`li`,{className:`space-y-2 py-3 first:pt-0`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,O.jsxs)(`p`,{className:`min-w-0 break-words text-xs text-fg-muted`,children:[e.title,h(e.at)?` · ${h(e.at)}`:``]}),(0,O.jsx)(r,{to:e.href,className:P,children:v?`查看来源`:`View source`})]}),(0,O.jsx)(`div`,{className:`line-clamp-3 break-words text-sm text-fg`,children:(0,O.jsx)(f,{content:e.summary,mermaidActions:!1})})]},e.id))}):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v?`暂无项目进展或执行结果。`:`No project updates or execution results yet.`}),t[14]=T,t[15]=k,t[16]=A,t[17]=b,t[18]=i,t[19]=I,t[20]=H,t[21]=w,t[22]=v,t[23]=U,t[24]=W,t[25]=G,t[26]=K,t[27]=q,t[28]=J,t[29]=Y}else U=t[23],W=t[24],G=t[25],K=t[26],q=t[27],J=t[28],Y=t[29];let X;t[73]!==q||t[74]!==J||t[75]!==Y?(X=(0,O.jsxs)(`section`,{className:q,children:[J,Y]}),t[73]=q,t[74]=J,t[75]=Y,t[76]=X):X=t[76];let Z;return t[77]!==U||t[78]!==W||t[79]!==G||t[80]!==K||t[81]!==X?(Z=(0,O.jsxs)(`div`,{className:U,children:[W,G,K,X]}),t[77]=U,t[78]=W,t[79]=G,t[80]=K,t[81]=X,t[82]=Z):Z=t[82],Z}function L(e,t){return(t.at||0)-(e.at||0)}function R(e){return e.summary?.trim()}function z(e,t){return Number([`queued`,`running`,`verifying`].includes(t.operationalState))-Number([`queued`,`running`,`verifying`].includes(e.operationalState))}function ee(e,t){return Number([`input_required`,`approval_required`].includes(t.kind))-Number([`input_required`,`approval_required`].includes(e.kind))}function te(e){return e.id}function ne(e){return e.phase!==`closed`}function B(e){return e.conversationId}function re(e){return e.language}async function V(e){switch(e.kind){case`project`:return{kind:e.kind,value:await m(e.id)};case`automation`:{let[t,n]=await Promise.all([v.list(),v.runs(5,e.id)]);return{kind:e.kind,value:t.automations.find(t=>t.id===e.id),runs:n.runs}}case`local_app`:{let t=await x(e.id),n=e.sourceHash?await b(e.id,e.sourceHash):void 0;return{kind:e.kind,value:t,previewUrl:n?.previewUrl||t.draftPreviewUrl}}}}var H={pending:[`等待中`,`Pending`],planned:[`计划中`,`Planned`],active:[`进行中`,`Active`],paused:[`已暂停`,`Paused`],completed:[`已完成`,`Completed`],cancelled:[`已取消`,`Cancelled`],archived:[`已归档`,`Archived`],queued:[`排队中`,`Queued`],running:[`运行中`,`Running`],succeeded:[`成功`,`Succeeded`],failed:[`失败`,`Failed`],timeout:[`超时`,`Timed out`],cancelling:[`取消中`,`Cancelling`],unknown:[`尚未评估`,`Not assessed`],on_track:[`进展正常`,`On track`],at_risk:[`存在风险`,`At risk`],off_track:[`偏离计划`,`Off track`]};function U(e){let t=(0,D.c)(5),{target:n}=e;if(n.kind===`automation`&&n.view===`run`){let e;return t[0]!==n.id||t[1]!==n.runId?(e=(0,O.jsx)(A,{automationId:n.id,runId:n.runId}),t[0]=n.id,t[1]=n.runId,t[2]=e):e=t[2],e}let r;return t[3]===n?r=t[4]:(r=(0,O.jsx)(W,{target:n}),t[3]=n,t[4]=r),r}function W(e){let t=(0,D.c)(56),{target:n}=e,u=a(J),d=o(q),f=d===`zh`,p=s(d),m;t[0]===f?m=t[1]:(m=e=>H[e]?.[+!f]||e,t[0]=f,t[1]=m);let h=m,_;t[2]!==n.href||t[3]!==u?(_=[`chat-product-preview`,n.href,u],t[2]=n.href,t[3]=u,t[4]=_):_=t[4];let v;t[5]===n?v=t[6]:(v=()=>V(n),t[5]=n,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={shouldRetryOnError:!1,refreshInterval:K},t[7]=y):y=t[7];let{data:b,error:x,isLoading:w}=g(_,v,y);if(w){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsx)(S,{}),t[8]=e):e=t[8],e}if(x){let e=f?`无法加载内容,它可能已删除或暂时不可用。`:`Unable to load this content. It may have been deleted or be temporarily unavailable.`,n;return t[9]===e?n=t[10]:(n=(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:e}),t[9]=e,t[10]=n),n}if(!b?.value){let e=f?`内容不存在或已删除。`:`This content is unavailable or has been deleted.`,n;return t[11]===e?n=t[12]:(n=(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n),n}let T=G;if(b.kind===`project`){let e;return t[13]!==b.value||t[14]!==n?(e=(0,O.jsx)(I,{project:b.value,target:n}),t[13]=b.value,t[14]=n,t[15]=e):e=t[15],e}if(b.kind===`automation`){let e=b.value,n=e.action.kind===`agent`?e.action.instruction:void 0,r;t[16]===e.name?r=t[17]:(r=(0,O.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.name}),t[16]=e.name,t[17]=r);let i;t[18]!==e.description||t[19]!==T?(i=T(e.description),t[18]=e.description,t[19]=T,t[20]=i):i=t[20];let a;t[21]!==n||t[22]!==T?(a=T(n),t[21]=n,t[22]=T,t[23]=a):a=t[23];let o;t[24]!==e.state.nextRunAtMs||t[25]!==f?(o=e.state.nextRunAtMs&&(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[f?`下次运行`:`Next run`,` · `,new Date(e.state.nextRunAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),t[24]=e.state.nextRunAtMs,t[25]=f,t[26]=o):o=t[26];let s;t[27]===e.state.lastError?s=t[28]:(s=e.state.lastError&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.state.lastError}),t[27]=e.state.lastError,t[28]=s);let u=f?`最近运行`:`Recent runs`,m;t[29]===u?m=t[30]:(m=(0,O.jsx)(`h3`,{className:`font-medium text-fg`,children:u}),t[29]=u,t[30]=m);let g;t[31]!==b.runs||t[32]!==T||t[33]!==h||t[34]!==f?(g=b.runs.length?b.runs.map(e=>(0,O.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[h(e.status),` · `,new Date(e.createdAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),T(e.summary),e.error&&(0,O.jsx)(`p`,{className:`text-sm text-danger`,children:e.error})]},e.id)):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f?`暂无运行记录。`:`No runs yet.`}),t[31]=b.runs,t[32]=T,t[33]=h,t[34]=f,t[35]=g):g=t[35];let _;return t[36]!==m||t[37]!==g?(_=(0,O.jsxs)(`section`,{className:`space-y-3`,children:[m,g]}),t[36]=m,t[37]=g,t[38]=_):_=t[38],(0,O.jsxs)(`div`,{className:`space-y-6`,children:[(0,O.jsxs)(`div`,{className:`space-y-3`,children:[r,(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[l(e)?f?`已完成`:`Completed`:e.enabled?f?`已启用`:`Enabled`:f?`已暂停`:`Paused`,` · `,c(e.trigger,p.automations,p.cron,d)]}),i,a,o,s]}),_]})}let E=b.value,k;t[39]===E.name?k=t[40]:(k=(0,O.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:E.name}),t[39]=E.name,t[40]=k);let A=E.description||E.idea,j;t[41]!==T||t[42]!==A?(j=T(A),t[41]=T,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==E.name||t[45]!==b.previewUrl||t[46]!==f?(M=b.previewUrl&&(0,O.jsx)(`iframe`,{title:f?`${E.name} 交互预览`:`${E.name} interactive preview`,src:i(b.previewUrl),sandbox:`allow-scripts allow-forms`,className:`h-[min(30rem,55dvh)] w-full rounded-lg border border-edge bg-white`}),t[44]=E.name,t[45]=b.previewUrl,t[46]=f,t[47]=M):M=t[47];let N;t[48]!==E||t[49]!==f?(N=E.installationState===`installed`&&E.enabled&&E.status===`installed`&&(0,O.jsx)(r,{to:C(E),className:`inline-flex rounded-lg bg-accent px-3 py-2 text-sm text-white focus-visible:ring-2 focus-visible:ring-accent`,children:f?`使用应用`:`Use app`}),t[48]=E,t[49]=f,t[50]=N):N=t[50];let P;return t[51]!==k||t[52]!==j||t[53]!==M||t[54]!==N?(P=(0,O.jsxs)(`div`,{className:`space-y-5`,children:[k,j,M,N]}),t[51]=k,t[52]=j,t[53]=M,t[54]=N,t[55]=P):P=t[55],P}function G(e){return e?.trim()?(0,O.jsx)(f,{content:e,mermaidActions:!1}):null}function K(e){return e?.kind===`automation`&&e.value?.state.runningRunId?3e3:0}function q(e){return e.language}function J(e){return e.conversationId}export{U as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/product-preview-content-CzNWh2h2.js","assets/vendor-react-BOUWij0V.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/preload-helper-Czpn1I53.js","assets/locale-store-BYdvIuPj.js","assets/messages-lc5BjBtX.js","assets/automation-display-DaVDNZz8.js","assets/createLucideIcon-DPHK1VkS.js","assets/markdown-view-BOJVaGPC.js","assets/marked.esm-8VXEA2AD.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-Ji4uewEG.js","assets/product-delivery-4gEqUIsK.js","assets/schemas-CCWMleym.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/skeleton-DzdOeGYz.js","assets/api-CnOSHyKU.js","assets/tasks-CwyNaa-j.js","assets/turn-outcome-BSbEJx8h.js","assets/specialists-xbB3xL9e.js","assets/files-GdwDamkp.js","assets/vendor-swr-CdRzEUwF.js","assets/button-C5tRaJxt.js","assets/automation-api-Cc5X3Q1t.js","assets/automation-task-card-CjzArAJi.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/popover-select-hRG1EzAY.js","assets/check-DUBLcKHA.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/message-circle-Badhj-4D.js","assets/pencil-DmIY3Oa-.js","assets/chat-agents-api-BzuJyysa.js","assets/gateway-config-swr-BYoBGl6i.js","assets/agent-avatar-display-KbzBlJ8W.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/agent-display-names-Bje7vfSn.js","assets/model-selector-DugdMlvi.js","assets/settings-2-D-csvaET.js","assets/registry-api-DGi-X6j7.js","assets/gateway-startup-retry-DCDOl6Oo.js","assets/open-capability-settings-DQsmJxI7.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/model-sort-_Tz8s_4N.js","assets/date-picker-DsD7NIm2.js","assets/calendar-days-hw_Y-g-s.js","assets/chevron-left-DqFhpbvK.js","assets/time-picker-otHjbob1.js","assets/clock-3-DnrAnuyZ.js","assets/api-BtngCZrB.js","assets/open-route-MyZ2sB9C.js","assets/automation-result-state-B7fHzLLf.js","assets/project-overview-model-DrLXaO-t.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as o}from"./locale-store-BYdvIuPj.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-DlirbHVs.js";import{t as m}from"./external-link-DjqjBmc3.js";import{V as h}from"./markdown-view-BOJVaGPC.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{i as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-C5tRaJxt.js";import{t as b}from"./automation-api-Cc5X3Q1t.js";import{r as x}from"./automation-task-card-CjzArAJi.js";var S=n(),C=e(t(),1),w=r(),T=(0,C.lazy)(()=>i(()=>import(`./product-preview-content-CzNWh2h2.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]))),E={project:[`项目预览`,`Project preview`],automation:[`自动化详情`,`Automation details`],local_app:[`应用预览`,`App preview`]};function D(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,w.jsx)(_,{className:`h-7 w-2/3`}),(0,w.jsx)(_,{className:`h-4 w-full`}),(0,w.jsx)(_,{className:`h-4 w-4/5`}),(0,w.jsx)(_,{className:`h-32 w-full`})]}),e[0]=t):t=e[0],t}function O(e){let t=(0,S.c)(8),{target:n,backgroundPath:r,onClose:i}=e;if(n.kind===`automation`&&n.view!==`run`){let e;return t[0]!==r||t[1]!==i||t[2]!==n?(e=(0,w.jsx)(k,{target:n,backgroundPath:r,onClose:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=e):e=t[3],e}let a;return t[4]!==r||t[5]!==i||t[6]!==n?(a=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=a):a=t[7],a}function k(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,a=o(A),l,m;t[0]===n.id?(l=t[1],m=t[2]):(l=[`automation-card`,n.id],m=()=>b.get(n.id),t[0]=n.id,t[1]=l,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,shouldRetryOnError:!1},t[3]=h):h=t[3];let{data:g,error:_,mutate:C}=v(l,m,h);if(g?.automation){if(g.automation.action.kind===`agent`&&!g.automation.management){let e;return t[4]!==g.automation||t[5]!==a||t[6]!==i?(e=(0,w.jsx)(x,{automation:g.automation,language:a,onClose:i}),t[4]=g.automation,t[5]=a,t[6]=i,t[7]=e):e=t[7],e}let e;return t[8]!==r||t[9]!==i||t[10]!==n?(e=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[8]=r,t[9]=i,t[10]=n,t[11]=e):e=t[11],e}let T=a===`zh`,E;t[12]===i?E=t[13]:(E=e=>{e||i()},t[12]=i,t[13]=E);let O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,w.jsx)(s,{className:`fixed inset-0 z-65 bg-scrim`}),t[14]=O):O=t[14];let k=T?`定时任务详情`:`Scheduled task details`,M;t[15]===k?M=t[16]:(M=(0,w.jsx)(f,{className:`mb-5 font-medium`,children:k}),t[15]=k,t[16]=M);let N=T?`查看和编辑定时任务。`:`View and edit the scheduled task.`,P;t[17]===N?P=t[18]:(P=(0,w.jsx)(c,{className:`sr-only`,children:N}),t[17]=N,t[18]=P);let F;t[19]!==_||t[20]!==C||t[21]!==T?(F=_?(0,w.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[(0,w.jsx)(`p`,{children:T?`任务已不存在或暂时无法读取。`:`This task is unavailable.`}),(0,w.jsx)(y,{variant:`secondary`,onClick:()=>void C(),children:T?`重试`:`Retry`})]}):(0,w.jsx)(D,{}),t[19]=_,t[20]=C,t[21]=T,t[22]=F):F=t[22];let I=T?`关闭`:`Close`,L;t[23]!==i||t[24]!==I?(L=(0,w.jsx)(y,{className:`mt-auto self-end`,variant:`ghost`,onClick:i,children:I}),t[23]=i,t[24]=I,t[25]=L):L=t[25];let R;t[26]!==F||t[27]!==L||t[28]!==M||t[29]!==P?(R=(0,w.jsxs)(u,{children:[O,(0,w.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-70 flex h-[min(600px,calc(100dvh-2rem))] w-[min(680px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5`,children:[M,P,F,L]})]}),t[26]=F,t[27]=L,t[28]=M,t[29]=P,t[30]=R):R=t[30];let z;return t[31]!==R||t[32]!==E?(z=(0,w.jsx)(p,{open:!0,onOpenChange:E,children:R}),t[31]=R,t[32]=E,t[33]=z):z=t[33],z}function A(e){return e.language}function j(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,_=o(M)===`zh`,v=n.kind===`project`?`w-[min(55rem,calc(100vw-2rem))]`:`w-[min(52rem,calc(100vw-2rem))]`,y=n.kind===`automation`&&n.view===`run`?_?`运行情况`:`Run progress`:E[n.kind][+!_],b;t[0]===i?b=t[1]:(b=e=>{e||i()},t[0]=i,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=x):x=t[2];let O=`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(48rem,calc(100dvh-2rem))] ${v} -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,k;t[3]===y?k=t[4]:(k=(0,w.jsx)(f,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:y}),t[3]=y,t[4]=k);let A=_?`查看关联内容,或打开独立页面。`:`Preview related content or open its full page.`,j;t[5]===A?j=t[6]:(j=(0,w.jsx)(c,{className:`sr-only`,children:A}),t[5]=A,t[6]=j);let N;t[7]!==r||t[8]!==n.href||t[9]!==n.view||t[10]!==_?(N=n.view!==`run`&&(0,w.jsxs)(a,{to:h(n.href,r),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm text-accent hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,w.jsx)(m,{className:`size-4`,"aria-hidden":!0}),_?`打开独立页面`:`Open full page`]}),t[7]=r,t[8]=n.href,t[9]=n.view,t[10]=_,t[11]=N):N=t[11];let P=_?`关闭预览`:`Close preview`,F=_?`关闭预览`:`Close preview`,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[12]=I):I=t[12];let L;t[13]!==P||t[14]!==F?(L=(0,w.jsx)(l,{title:P,"aria-label":F,className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:I}),t[13]=P,t[14]=F,t[15]=L):L=t[15];let R;t[16]!==L||t[17]!==k||t[18]!==j||t[19]!==N?(R=(0,w.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge bg-surface-panel px-5 py-3.5`,children:[k,j,N,L]}),t[16]=L,t[17]=k,t[18]=j,t[19]=N,t[20]=R):R=t[20];let z=`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5 ${n.kind===`project`?`sm:p-6`:`sm:p-8`}`,B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,w.jsx)(D,{}),t[21]=B):B=t[21];let V;t[22]===n?V=t[23]:(V=(0,w.jsx)(C.Suspense,{fallback:B,children:(0,w.jsx)(T,{target:n},n.href)}),t[22]=n,t[23]=V);let H;t[24]!==z||t[25]!==V?(H=(0,w.jsx)(`div`,{className:z,children:V}),t[24]=z,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==R||t[28]!==H||t[29]!==O?(U=(0,w.jsxs)(u,{children:[x,(0,w.jsxs)(d,{className:O,children:[R,H]})]}),t[27]=R,t[28]=H,t[29]=O,t[30]=U):U=t[30];let W;return t[31]!==b||t[32]!==U?(W=(0,w.jsx)(p,{open:!0,onOpenChange:b,children:U}),t[31]=b,t[32]=U,t[33]=W):W=t[33],W}function M(e){return e.language}export{D as n,O as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/product-preview-content-BOq3gtSJ.js","assets/vendor-react-BOUWij0V.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-KS7C4IRE-DIIvxCDx.js","assets/preload-helper-Czpn1I53.js","assets/locale-store-CHjsq5NR.js","assets/messages-C7QSnTdg.js","assets/automation-display-DaVDNZz8.js","assets/createLucideIcon-DPHK1VkS.js","assets/markdown-view-ihzUc4ud.js","assets/marked.esm-8VXEA2AD.js","assets/dist-DlirbHVs.js","assets/es2015-CFqg57eW.js","assets/dist-CDSvxjOh.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-Ji4uewEG.js","assets/product-delivery-4gEqUIsK.js","assets/schemas-CCWMleym.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-Czi3_WHu.css","assets/skeleton-DzdOeGYz.js","assets/api-CGs641OT.js","assets/tasks-CwyNaa-j.js","assets/turn-outcome-BSbEJx8h.js","assets/specialists-xbB3xL9e.js","assets/files-GdwDamkp.js","assets/vendor-swr-CdRzEUwF.js","assets/button-C5tRaJxt.js","assets/automation-api-D-gn6x5E.js","assets/automation-task-card-C453Q-Wa.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/popover-select-hRG1EzAY.js","assets/check-DUBLcKHA.js","assets/dist-BSVQC3i_.js","assets/dist-DSRLZhL9.js","assets/floating-ui.dom-CiMnRY5O.js","assets/floating-ui.react-dom-Gx6CM22l.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/message-circle-Badhj-4D.js","assets/pencil-DmIY3Oa-.js","assets/chat-agents-api-CyvBfBbp.js","assets/gateway-config-swr-BD-ams0X.js","assets/agent-avatar-display-D_UDgOr9.js","assets/loopi-CNtmi9FU.js","assets/loopi-C09I2mNj.css","assets/agent-display-names-Bje7vfSn.js","assets/model-selector-QFZY5XNN.js","assets/settings-2-D-csvaET.js","assets/registry-api-CDpUAb2R.js","assets/gateway-startup-retry-DgmvR-hb.js","assets/open-capability-settings-DQsmJxI7.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/model-sort-_Tz8s_4N.js","assets/date-picker-DwITf4I2.js","assets/calendar-days-hw_Y-g-s.js","assets/chevron-left-DqFhpbvK.js","assets/time-picker-otHjbob1.js","assets/clock-3-DnrAnuyZ.js","assets/api-B3T06TLl.js","assets/open-route-MyZ2sB9C.js","assets/automation-result-state-B7hq0XOL.js","assets/project-overview-model-DrLXaO-t.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as o}from"./locale-store-CHjsq5NR.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-DlirbHVs.js";import{t as m}from"./external-link-DjqjBmc3.js";import{V as h}from"./markdown-view-ihzUc4ud.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{i as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-C5tRaJxt.js";import{t as b}from"./automation-api-D-gn6x5E.js";import{r as x}from"./automation-task-card-C453Q-Wa.js";var S=n(),C=e(t(),1),w=r(),T=(0,C.lazy)(()=>i(()=>import(`./product-preview-content-BOq3gtSJ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]))),E={project:[`项目预览`,`Project preview`],automation:[`自动化详情`,`Automation details`],local_app:[`应用预览`,`App preview`]};function D(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,w.jsx)(_,{className:`h-7 w-2/3`}),(0,w.jsx)(_,{className:`h-4 w-full`}),(0,w.jsx)(_,{className:`h-4 w-4/5`}),(0,w.jsx)(_,{className:`h-32 w-full`})]}),e[0]=t):t=e[0],t}function O(e){let t=(0,S.c)(8),{target:n,backgroundPath:r,onClose:i}=e;if(n.kind===`automation`&&n.view!==`run`){let e;return t[0]!==r||t[1]!==i||t[2]!==n?(e=(0,w.jsx)(k,{target:n,backgroundPath:r,onClose:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=e):e=t[3],e}let a;return t[4]!==r||t[5]!==i||t[6]!==n?(a=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=a):a=t[7],a}function k(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,a=o(A),l,m;t[0]===n.id?(l=t[1],m=t[2]):(l=[`automation-card`,n.id],m=()=>b.get(n.id),t[0]=n.id,t[1]=l,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,shouldRetryOnError:!1},t[3]=h):h=t[3];let{data:g,error:_,mutate:C}=v(l,m,h);if(g?.automation){if(g.automation.action.kind===`agent`&&!g.automation.management){let e;return t[4]!==g.automation||t[5]!==a||t[6]!==i?(e=(0,w.jsx)(x,{automation:g.automation,language:a,onClose:i}),t[4]=g.automation,t[5]=a,t[6]=i,t[7]=e):e=t[7],e}let e;return t[8]!==r||t[9]!==i||t[10]!==n?(e=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[8]=r,t[9]=i,t[10]=n,t[11]=e):e=t[11],e}let T=a===`zh`,E;t[12]===i?E=t[13]:(E=e=>{e||i()},t[12]=i,t[13]=E);let O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,w.jsx)(s,{className:`fixed inset-0 z-65 bg-scrim`}),t[14]=O):O=t[14];let k=T?`定时任务详情`:`Scheduled task details`,M;t[15]===k?M=t[16]:(M=(0,w.jsx)(f,{className:`mb-5 font-medium`,children:k}),t[15]=k,t[16]=M);let N=T?`查看和编辑定时任务。`:`View and edit the scheduled task.`,P;t[17]===N?P=t[18]:(P=(0,w.jsx)(c,{className:`sr-only`,children:N}),t[17]=N,t[18]=P);let F;t[19]!==_||t[20]!==C||t[21]!==T?(F=_?(0,w.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[(0,w.jsx)(`p`,{children:T?`任务已不存在或暂时无法读取。`:`This task is unavailable.`}),(0,w.jsx)(y,{variant:`secondary`,onClick:()=>void C(),children:T?`重试`:`Retry`})]}):(0,w.jsx)(D,{}),t[19]=_,t[20]=C,t[21]=T,t[22]=F):F=t[22];let I=T?`关闭`:`Close`,L;t[23]!==i||t[24]!==I?(L=(0,w.jsx)(y,{className:`mt-auto self-end`,variant:`ghost`,onClick:i,children:I}),t[23]=i,t[24]=I,t[25]=L):L=t[25];let R;t[26]!==F||t[27]!==L||t[28]!==M||t[29]!==P?(R=(0,w.jsxs)(u,{children:[O,(0,w.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-70 flex h-[min(600px,calc(100dvh-2rem))] w-[min(680px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5`,children:[M,P,F,L]})]}),t[26]=F,t[27]=L,t[28]=M,t[29]=P,t[30]=R):R=t[30];let z;return t[31]!==R||t[32]!==E?(z=(0,w.jsx)(p,{open:!0,onOpenChange:E,children:R}),t[31]=R,t[32]=E,t[33]=z):z=t[33],z}function A(e){return e.language}function j(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,_=o(M)===`zh`,v=n.kind===`project`?`w-[min(55rem,calc(100vw-2rem))]`:`w-[min(52rem,calc(100vw-2rem))]`,y=n.kind===`automation`&&n.view===`run`?_?`运行情况`:`Run progress`:E[n.kind][+!_],b;t[0]===i?b=t[1]:(b=e=>{e||i()},t[0]=i,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=x):x=t[2];let O=`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(48rem,calc(100dvh-2rem))] ${v} -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,k;t[3]===y?k=t[4]:(k=(0,w.jsx)(f,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:y}),t[3]=y,t[4]=k);let A=_?`查看关联内容,或打开独立页面。`:`Preview related content or open its full page.`,j;t[5]===A?j=t[6]:(j=(0,w.jsx)(c,{className:`sr-only`,children:A}),t[5]=A,t[6]=j);let N;t[7]!==r||t[8]!==n.href||t[9]!==n.view||t[10]!==_?(N=n.view!==`run`&&(0,w.jsxs)(a,{to:h(n.href,r),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm text-accent hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,w.jsx)(m,{className:`size-4`,"aria-hidden":!0}),_?`打开独立页面`:`Open full page`]}),t[7]=r,t[8]=n.href,t[9]=n.view,t[10]=_,t[11]=N):N=t[11];let P=_?`关闭预览`:`Close preview`,F=_?`关闭预览`:`Close preview`,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[12]=I):I=t[12];let L;t[13]!==P||t[14]!==F?(L=(0,w.jsx)(l,{title:P,"aria-label":F,className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:I}),t[13]=P,t[14]=F,t[15]=L):L=t[15];let R;t[16]!==L||t[17]!==k||t[18]!==j||t[19]!==N?(R=(0,w.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge bg-surface-panel px-5 py-3.5`,children:[k,j,N,L]}),t[16]=L,t[17]=k,t[18]=j,t[19]=N,t[20]=R):R=t[20];let z=`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5 ${n.kind===`project`?`sm:p-6`:`sm:p-8`}`,B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,w.jsx)(D,{}),t[21]=B):B=t[21];let V;t[22]===n?V=t[23]:(V=(0,w.jsx)(C.Suspense,{fallback:B,children:(0,w.jsx)(T,{target:n},n.href)}),t[22]=n,t[23]=V);let H;t[24]!==z||t[25]!==V?(H=(0,w.jsx)(`div`,{className:z,children:V}),t[24]=z,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==R||t[28]!==H||t[29]!==O?(U=(0,w.jsxs)(u,{children:[x,(0,w.jsxs)(d,{className:O,children:[R,H]})]}),t[27]=R,t[28]=H,t[29]=O,t[30]=U):U=t[30];let W;return t[31]!==b||t[32]!==U?(W=(0,w.jsx)(p,{open:!0,onOpenChange:b,children:U}),t[31]=b,t[32]=U,t[33]=W):W=t[33],W}function M(e){return e.language}export{D as n,O as t};