@xopcai/xopc 0.0.463 → 0.0.465
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.
- package/dist/browser-ext/dist/sidepanel.js +5 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/adapters/cli-login.js +23 -49
- package/dist/extensions/feishu/src/adapters/gateway-setup.d.ts +3 -0
- package/dist/extensions/feishu/src/adapters/gateway-setup.js +180 -128
- package/dist/extensions/feishu/src/adapters/onboard-cli.d.ts +1 -1
- package/dist/extensions/feishu/src/adapters/onboard-cli.js +27 -15
- package/dist/extensions/feishu/src/auth/app-registration.d.ts +1 -0
- package/dist/extensions/feishu/src/auth/app-registration.js +12 -9
- package/dist/extensions/feishu/src/outbound/outbound-adapter.js +40 -16
- package/dist/extensions/feishu/src/plugin.d.ts +2 -0
- package/dist/extensions/feishu/src/plugin.js +37 -23
- package/dist/extensions/feishu/src/status/status-adapter.d.ts +1 -1
- package/dist/extensions/feishu/src/status/status-adapter.js +8 -5
- package/dist/extensions/feishu/src/streaming/streaming-adapter.js +97 -69
- package/dist/extensions/feishu/src/transport/client/bot-info.d.ts +10 -0
- package/dist/extensions/feishu/src/transport/client/bot-info.js +34 -0
- package/dist/extensions/feishu/src/transport/client/client.d.ts +7 -1
- package/dist/extensions/feishu/src/transport/client/client.js +6 -5
- package/dist/extensions/feishu/src/transport/client/install-sdk.d.ts +2 -0
- package/dist/extensions/feishu/src/transport/client/install-sdk.js +77 -0
- package/dist/extensions/feishu/src/transport/client/lark-sdk.d.ts +2 -0
- package/dist/extensions/feishu/src/transport/client/lark-sdk.js +27 -3
- package/dist/extensions/feishu/src/transport/client/sdk-catalog.d.ts +1 -0
- package/dist/extensions/feishu/src/transport/client/sdk-catalog.js +317 -0
- package/dist/extensions/feishu/src/transport/reliability/inbound-pipeline.d.ts +1 -1
- package/dist/extensions/feishu/src/transport/reliability/inbound-pipeline.js +13 -5
- package/dist/extensions/feishu/src/transport/reliability/message-ingress.d.ts +21 -0
- package/dist/extensions/feishu/src/transport/reliability/message-ingress.js +313 -0
- package/dist/extensions/feishu/src/transport/socket-mode/monitor.d.ts +1 -0
- package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +56 -171
- package/dist/extensions/feishu/src/transport/webhook/monitor.d.ts +1 -0
- package/dist/extensions/feishu/src/transport/webhook/monitor.js +10 -102
- package/dist/extensions/telegram/src/account-manager.d.ts +1 -0
- package/dist/extensions/telegram/src/account-manager.js +3 -0
- package/dist/extensions/telegram/src/adapters/debounce-keys.js +7 -2
- package/dist/extensions/telegram/src/adapters/gateway-setup.js +113 -63
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +8 -4
- package/dist/extensions/telegram/src/doctor.js +1 -1
- package/dist/extensions/telegram/src/inbound-coalescer.d.ts +8 -6
- package/dist/extensions/telegram/src/inbound-coalescer.js +47 -88
- package/dist/extensions/telegram/src/inbound-processor.js +5 -1
- package/dist/extensions/telegram/src/outbound-sender.js +16 -23
- package/dist/extensions/telegram/src/plugin.js +80 -57
- package/dist/extensions/telegram/src/polling-session.d.ts +3 -6
- package/dist/extensions/telegram/src/polling-session.js +107 -94
- package/dist/extensions/telegram/src/rich-message.d.ts +4 -0
- package/dist/extensions/telegram/src/rich-message.js +23 -0
- package/dist/extensions/telegram/src/timeout-abort.d.ts +1 -1
- package/dist/extensions/telegram/src/timeout-abort.js +9 -3
- package/dist/extensions/telegram/src/update-offset-store.d.ts +1 -0
- package/dist/extensions/telegram/src/update-offset-store.js +6 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.d.ts +1 -0
- package/dist/extensions/weixin/src/api/api.js +12 -6
- package/dist/extensions/weixin/src/api/types.d.ts +5 -2
- package/dist/extensions/weixin/src/auth/login-qr.d.ts +7 -1
- package/dist/extensions/weixin/src/auth/login-qr.js +48 -13
- package/dist/extensions/weixin/src/cdn/pic-decrypt.d.ts +2 -2
- package/dist/extensions/weixin/src/cdn/pic-decrypt.js +37 -25
- package/dist/extensions/weixin/src/cli/gateway-qr-login.d.ts +8 -0
- package/dist/extensions/weixin/src/cli/gateway-qr-login.js +45 -6
- package/dist/extensions/weixin/src/cli/qr-login.d.ts +1 -1
- package/dist/extensions/weixin/src/cli/qr-login.js +9 -3
- package/dist/extensions/weixin/src/media/media-download.d.ts +1 -0
- package/dist/extensions/weixin/src/media/media-download.js +4 -5
- package/dist/extensions/weixin/src/messaging/process-message.d.ts +2 -0
- package/dist/extensions/weixin/src/messaging/process-message.js +90 -65
- package/dist/extensions/weixin/src/messaging/quote-cache.d.ts +10 -0
- package/dist/extensions/weixin/src/messaging/quote-cache.js +46 -0
- package/dist/extensions/weixin/src/monitor/monitor.d.ts +3 -3
- package/dist/extensions/weixin/src/monitor/monitor.js +108 -104
- package/dist/extensions/weixin/src/plugin.d.ts +5 -1
- package/dist/extensions/weixin/src/plugin.js +138 -42
- package/dist/gateway/static/root/assets/{activity-store-CQHh48Zf.js → activity-store-B9heFbtJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAz-Ke6Q.js → agent-avatar-dicebear-nzhB7Xjk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-loBdGw_i.js → agent-avatar-display-DBzgoHMD.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-By2Q-6JS.js → agent-defaults-settings-panel-BJrNV93g.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-C_rlXuEe.js → agent-plugin-dialog-DLbTHALG.js} +1 -1
- package/dist/gateway/static/root/assets/agents-C2xG8f56.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-D0N09mqJ.js → agents-admin-api-CqQbYIiY.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B1J5ajiP.js → api-8tNOT72p.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B4FJ51EC.js → api-BGodd--L.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BHlUDZOG.js → app-management-settings-panel-Q7apF7KE.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Du5JLyV1.js → appearance-settings-ClVZeUmo.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-D1qzENN_.js → apps-page-BsJJwpKj.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BAvglLfu.js → archive-plugin-Bl_M0WJp.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-DxBmyzp0.js → automation-api-BOnIc_vw.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-CAsqgMNR.js → automation-result-state-BwDSJs05.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-BmYeWB_N.js → automation-run-list-CqlIq4BG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CJbIHRxN.js → automation-task-card-D3WXVKRs.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-HYFnPiNG.js → automations-page-Bimqx5Pc.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-2SOvmw-f.js +9 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D2bFqG6K.js → binary-plugins-DDNKe1Io.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DrZyRQQ0.js → block-editor-BQ3amsRP.js} +5 -5
- package/dist/gateway/static/root/assets/{browser-settings-page-CGcgZOWh.js → browser-settings-page-CHf1_RVl.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-hSb-qEgL.js → capabilities-C5oWMC-Z.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Dr-vvMez.js → capabilities-Cj8vl1ZY.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-U_hQx5ou.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-B08mjrGB.js → capabilities-settings-panel-k5CcwhXN.js} +1 -1
- package/dist/gateway/static/root/assets/channels-BUzno8Pi.js +1 -0
- package/dist/gateway/static/root/assets/chat-agents-api-C3JChTsh.js +1 -0
- package/dist/gateway/static/root/assets/{chat-chart-block-ClCZyIi0.js → chat-chart-block-DrtmYOIo.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page-CalELOKj.js → chat-page-qnsMsF_s.js} +29 -29
- package/dist/gateway/static/root/assets/{chat-terminal-dock-eneTvxV3.js → chat-terminal-dock-B0D220I-.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-CP0F6sIm.js → command-palette-api-CkJ6_Yf3.js} +1 -1
- package/dist/gateway/static/root/assets/composer-handoff-params-GKGdXjMZ.js +1 -0
- package/dist/gateway/static/root/assets/{composer-model-config-control-DAagrRx_.js → composer-model-config-control-DQCOWHzJ.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-CqV6Xj-H.js → composer-notifications-D__OU_xx.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-Dc43dgSg.js → composer-payload-handoff-BBTbJ1bO.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-f-vcEpeF.js → computer-settings-page-DGRUCkOt.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-CZ-FXxaW.js → connected-providers-grid-BoDipD2g.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-Cibh2lrV.js → connection-usage-guide-B1VUqibv.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Btz68iy8.js → connector-service-page-bwQ1PekA.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-CTuVWwBf.js → connectors-api-BvYGL65q.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-B9mpz_Rt.js → connectors-page-BX6Jt6w5.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-XnE3iFhG.js → date-picker-ClRDaNBJ.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-VGKm0HVn.js → date-time-picker-CA6H47M6.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CBm3DySQ.js → desktop-pet-Bi8Hgf-x.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-6O77QXGo.js → desktop-pet-settings-CQ6qE8lf.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-B8fGILny.js → dev-view-store-UCqQeWa2.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-qtUvtdDT.js → device-pairing-wizard-gC-XZxt2.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ByDqf5fE.js → directory-picker-path-field-Y8snl5Xl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-BfL8dMBf.js → extension-authoritative-grants-D2abOXTl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Bn_5xu_M.js → extension-debug-page-OOlRCInL.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-Vs6USa0c.js → extension-iframe-host-D_WXBf6a.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-BIzkukYp.js → extension-marketplace-api-Bmtm6-L1.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-GIekDj_w.js → extension-message-router-xqjjSxcp.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C_3bIjSB.js → extension-page-bpQnyNz-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-D-LolObs.js → extension-provider-l7SvHEK1.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BvUtZGLT.js +1 -0
- package/dist/gateway/static/root/assets/{file-preview-surface-i5UOFnQF.js → file-preview-surface-B-r2ZnCV.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-1Rk0LeEM.js → gateway-config-swr-DOwezeL2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DIs1pjkQ.js → gateway-realtime-Br7dErHY.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-OaEqjNTb.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-DTmlcJps.js → gateway-restart-B3Xro3qd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-ClcCloqQ.js → gateway-settings-DCnP-HPj.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D6WPS0RW.js → gateway-startup-retry-vteSIhYI.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BpDMnJe7.js → global-defaults-api-Bpje9rVk.js} +1 -1
- package/dist/gateway/static/root/assets/grip-horizontal-CqVA8V1e.js +1 -0
- package/dist/gateway/static/root/assets/home-page-CNEgNWEQ.js +8 -0
- package/dist/gateway/static/root/assets/{image-generation-api-sbtx4NiC.js → image-generation-api-BvpAa3Lj.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CBlaxUhl.js → imports-page-Dx5T5pqw.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cdo4_zon.js +11 -0
- package/dist/gateway/static/root/assets/index-DYTktubl.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-DxSv1wS2.js → install-connector-dialog-Cb4ufypG.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CnAV96nr.js → keyboard-shortcuts-settings-BEuXrnv0.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CfnixDO3.js → local-app-workbench-page-CPFIbEbv.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BI3Be5qo.js → local-apps-page-DxHcRSxc.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-Cmc-GCVa.js +4 -0
- package/dist/gateway/static/root/assets/{locale-store-Dy1EByeG.js → locale-store-tI9VX7dp.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CMW34T31.js → logs-page-BcibwftP.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-B5w5DdXH.js → management-api-C9tFjLcE.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DfcMIqbQ.js → management-settings-DbnAlXoB.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CNJaAdNN.js → markdown-view-CSpQhSka.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DCIEL5bA.js → mcp-conversation-setup-page-DedbjJbF.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DGhWjPIU.js → media-plugins-BYnP_orq.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-BAnhwALN.js → messages-e5MhDONm.js} +2 -2
- package/dist/gateway/static/root/assets/{model-selector-C-CqPBao.js → model-selector-B4oTiJI6.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-Bgh3Gfgl.js → models-hub-cache-DpEClnsE.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-DsXb1qjW.js → note-detail-panel-D8asMfBm.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DcDw5kp4.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BOIM9Q_D.js → notes-api-pVC1amyp.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BTpiOw67.js → notes-page-CG1_6PLz.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-B560CHeD.js → oauth-api-BsVPwufr.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-D63M8Iv7.js → oauth-provider-connect-Bu20kmPq.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-B_Vdo2Ai.js → page-context-capture-button-CDsnNXjS.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-Cr5GqS2D.js → page-context-draft-D6tu8c_9.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-DeaRqZgV.js +1 -0
- package/dist/gateway/static/root/assets/panels-top-left-BKvp2Dag.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-BMRVyTrE.js → personal-avatar-BboNc6e2.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-I3IGVSJh.js → personal-page-gMRmLCWG.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-C4CxmQLQ.js → personal-profile-settings-Cd4QyseL.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CnxI2TL0.js → personal-settings-panel-CtBY_Uk1.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-flTci8mm.js → phone-dependencies-card-BgH1LluB.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-Vi_Swyv6.js → phone-model-connection-DkdKU5Kv.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-BOv3mb_F.js → phone-model-picker-0g1z4RPL.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-vD0bTcHj.js → phone-settings-page-DlIUajBY.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-Ltrevdsx.js → phone-workspace-store-DW2sZtkh.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-F08k_k2u.js → plugin-details-dialog-9KUkZk_t.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-D1pZekPs.js → preference-select-fields-DH5QZhIc.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-CGso8wGv.js → product-automation-feedback-a1thJ0M9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BO8lUvw3.js → product-open-page-DCzQh7tr.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-Dgtb4LF7.js → product-preview-content-C5TLcagj.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-C35EWUps.js → product-preview-modal-D9f-7kcI.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-Dy46uSEt.js → project-detail-page-C4Z2HTRZ.js} +2 -2
- package/dist/gateway/static/root/assets/{project-understanding-Cg8WbBNB.js → project-understanding-CoPBvlqf.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-C6Pt6OdT.js → projects-page-k1v8Fry8.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-Nytkkop9.js → providers-api-BSJZyO8n.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-CFX7CANT.js → recording-upload-CExCePtr.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DuDIthjL.js → registry-api-CqcJj60w.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DePwafOK.js → remote-access-hub-BLFkNl1y.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-BRKhKJA0.js → resource-unavailable-B_BXTQa7.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-HPw7Gw0n.js → right-workspace-store-OceFhUjM.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-ClsAFFQc.js +2 -0
- package/dist/gateway/static/root/assets/{routine-panel-KH1VaEdC.js → routine-panel-BsE9o9uu.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-Dd8a07eo.js → runtime-tools-api-aAZChVm4.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CvHQoqHu.js → runtime-tools-settings-panel-Bn9HTrK5.js} +1 -1
- package/dist/gateway/static/root/assets/schema-form-BxBDgLrg.js +1 -0
- package/dist/gateway/static/root/assets/{service-recommendation-list-BmRtbJz2.js → service-recommendation-list-BNIVRGDf.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-BFiIYodK.js → session-api-DdW7Wix2.js} +1 -1
- package/dist/gateway/static/root/assets/session-channel-icon-DUJbB-Km.js +1 -0
- package/dist/gateway/static/root/assets/{session-identity-label-D5SAi0Uh.js → session-identity-label-DjhlQ6LU.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-XgtApqIh.js +25 -0
- package/dist/gateway/static/root/assets/sessions-page-CfhKeUkZ.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BBG8dTIY.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-B-H1gYOs.js → settings-advanced-section-BOoJfJuB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-YH60sibB.js → settings-mode-store-BMh_BQ9a.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C39lKVRv.js → settings-page-M6XwzIyu.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-DEZZ8D0S.js → settings-page-header-Bfu4cuQd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-De2j64Lo.js → settings-page-layout-BnZa1qHH.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-Dh6BPwv0.js → setup-interaction-page-CVlrVNrm.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DGAAczL-.js → setup-status-panel-FFyDODEx.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C1t_HB6f.js → share-link-dialog-Cv-eDEw_.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Cqy-7-rd.js → share-preview-page-BctH6eFs.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-Dm07CnXw.js → shares-api-cLTEcQLE.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DcetAN8K.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BV8oFqeE.js → skill-api-CgEZJoy9.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-1o_YRCu9.js → skill-list-api-BWVr2PL5.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-fGsO9Y86.js → skill-reload-api-BLhHNvaK.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DReUQ4Ug.js → skills-page-DIjcAvA0.js} +1 -1
- package/dist/gateway/static/root/assets/sliding-segmented-DagP0myu.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CUI6QHEP.js → system-settings-panel-C7LAPaN_.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-D1dNWTnP.js → task-detail-page-DmNEMg-l.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-CW_tN93T.js → task-result-evidence-BsBn3n_l.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-Du53Upr2.js → terminal-panel-store-DJbLuUku.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BaWep_o7.js → theme-store-QGcjV6pN.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CnciBMVH.js → tracing-settings-page-BKCiPwYL.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Iz7JCBt3.js → tunnel-api-S7J5Lpzt.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-BFc8PamJ.js → understanding-activity-store-BNVhtJkn.js} +1 -1
- package/dist/gateway/static/root/assets/understanding-refresh-store-CM6bUcaJ.js +1 -0
- package/dist/gateway/static/root/assets/undo-2-6IMTwK4M.js +1 -0
- package/dist/gateway/static/root/assets/{unlink-BEuthaaq.js → unlink-NsCMuCT1.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DL2fmeOh.js → usage-page-D-AqzjIx.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-N_SjHXTw.js → use-autosave-CqZbhhCc.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-BfLhIb2_.js +2 -0
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-D0IBFhM9.js → use-file-preview-expanded-DufxDues.js} +3 -3
- package/dist/gateway/static/root/assets/{use-personal-profile-C1vqD9yV.js → use-personal-profile-RnjxZnLa.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-B5IsKrRW.js → use-realtime-voice-w3aHR2dr.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-7X2ydgS8.js → use-workspace-tree-2Ck-ql5c.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CBcGMhrR.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-B_GApUQP.js → voice-api-key-field-C4rhpgco.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DhJ3l8fk.js → voice-config-api-7AHN-ns6.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CEeFBhp3.js → voice-input-shortcut-events-BbRrj833.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-57pwZeKD.js → voice-settings-wamtp0lg.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BJ15p4rH.js → work-discovery-overlay-fVofN7aP.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-8XciWNs5.js → work-discovery-page-DcQG5GWy.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-BGZduAXV.js → working-directory-picker-modal-D8Stwszr.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-Dd_UDfeo.js → workspace-api-D3iuTdNK.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-C-J7vr2o.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-Clj9hMj5.js → workspace-file-preview-dialog-BXbL5Y1h.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CvZxU9de.js → workspace-open-location-menu-1gFO_BdL.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-imhtuEIP.js → workspace-preview-store-adwmi4nx.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Q_jezTUy.js → xopc-cloud-account-card-DhGh4rm7.js} +1 -1
- package/dist/gateway/static/root/index.html +97 -93
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/session-input-command.js +5 -0
- package/dist/src/agent/inbound/inbound-loop.js +14 -0
- package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
- package/dist/src/agent/prompt/response-language.js +9 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -0
- package/dist/src/channels/connection-probe.d.ts +23 -0
- package/dist/src/channels/connection-probe.js +98 -0
- package/dist/src/channels/manager.d.ts +2 -0
- package/dist/src/channels/manager.js +5 -0
- package/dist/src/channels/message-journal.d.ts +25 -0
- package/dist/src/channels/message-journal.js +79 -0
- package/dist/src/channels/outbound-sender.d.ts +8 -0
- package/dist/src/channels/outbound-sender.js +60 -1
- package/dist/src/channels/plugins/types.adapters.d.ts +4 -0
- package/dist/src/channels/verified-inbound.js +20 -14
- package/dist/src/cli/commands/gateway/lifecycle.js +2 -2
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/schema.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/middleware/auth.js +1 -1
- package/dist/src/gateway/hono/routes/channels.js +23 -10
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/desktop-host.js +1 -1
- package/dist/src/gateway/hono/routes/imports.js +1 -1
- package/dist/src/gateway/hono/routes/personal-agent.js +3 -3
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/hono/routes/user-model.js +48 -20
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +2 -2
- package/dist/src/gateway/service/agent-runner.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.js +8 -8
- package/dist/src/i18n/response-language.d.ts +1 -1
- package/dist/src/infra/bus/index.d.ts +1 -1
- package/dist/src/infra/bus/queue.d.ts +16 -3
- package/dist/src/infra/bus/queue.js +74 -3
- package/dist/src/infra/debounce.d.ts +1 -0
- package/dist/src/infra/debounce.js +40 -35
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +2 -2
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +9 -0
- package/dist/src/knowledge-memory/repository.js +12 -2
- package/dist/src/notifications/service.js +2 -2
- package/dist/src/phone/stream-gateway.js +1 -1
- package/dist/src/runtime-tools/types.d.ts +1 -1
- package/dist/src/storage/sqlite/session-creation-repository.js +6 -1
- package/dist/src/user-context/config.d.ts +1 -1
- package/package.json +4 -5
- package/dist/extensions/demo-memory/src/index.d.ts +0 -6
- package/dist/extensions/demo-memory/src/index.js +0 -146
- package/dist/extensions/demo-memory/xopc.extension.json +0 -15
- package/dist/gateway/static/root/assets/agents-DC0lHtl5.js +0 -77
- package/dist/gateway/static/root/assets/automations-workspace-JCQ1IXFk.js +0 -9
- package/dist/gateway/static/root/assets/capabilities-page-kPv2dOzf.js +0 -2
- package/dist/gateway/static/root/assets/channels-B--IHNs4.js +0 -1
- package/dist/gateway/static/root/assets/chat-agents-api-CjlzCSmC.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BV51dk16.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-sx7B8kdC.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DefKShSW.js +0 -8
- package/dist/gateway/static/root/assets/index-CChzK_5b.css +0 -1
- package/dist/gateway/static/root/assets/index-DUo6H0PC.js +0 -11
- package/dist/gateway/static/root/assets/local-session-drafts-BIBHRkpM.js +0 -4
- package/dist/gateway/static/root/assets/note-image-lightbox-D6mvMSKr.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-Bm8oxpFR.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-ChTaYgpA.js +0 -2
- package/dist/gateway/static/root/assets/schema-form-C9TYGa0_.js +0 -1
- package/dist/gateway/static/root/assets/session-channel-icon-BzkFo-Ci.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-63NaXb1s.js +0 -25
- package/dist/gateway/static/root/assets/sessions-page-DQEq_VJS.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cvx7DnU8.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BDr50uTV.js +0 -1
- package/dist/gateway/static/root/assets/sliding-segmented-CgQ3BFdb.js +0 -1
- package/dist/gateway/static/root/assets/understanding-refresh-store-CdEfR40A.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-Xn6eUus2.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-D2FHjLi7.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-DVPJcbuE.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/workspace-file-preview-dialog-BXbL5Y1h.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-tI9VX7dp.js","assets/messages-e5MhDONm.js","assets/use-file-preview-expanded-DufxDues.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/createLucideIcon-DPHK1VkS.js","assets/app-window-DXFNqt_0.js","assets/check-DUBLcKHA.js","assets/chevron-down-ccbiQQz_.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/ellipsis-0k4rZLoy.js","assets/external-link-DjqjBmc3.js","assets/eye-CABVeTq0.js","assets/folder-open-CyzJ19I9.js","assets/link-2-D_ZKYUW7.js","assets/loader-circle-CifKLtgG.js","assets/markdown-view-CSpQhSka.js","assets/diagnostics-Bo0Z42P_.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.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-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/message-square-plus-XP0tGdlV.js","assets/minimize-2-DtOGrlpo.js","assets/paperclip-f1HujQY1.js","assets/pencil-DmIY3Oa-.js","assets/refresh-cw-BRlGaq2w.js","assets/rotate-cw-LIg3Am9S.js","assets/save-DRDABU--.js","assets/search-DA7gz22f.js","assets/skeleton-DzdOeGYz.js","assets/constants-Bg1wM2nv.js","assets/session-api-DdW7Wix2.js","assets/gateway-startup-retry-vteSIhYI.js","assets/attachment-utils-core-BIOUBrpT.js","assets/interaction-BdhHBbYa.js","assets/composer-notifications-D__OU_xx.js","assets/activity-store-B9heFbtJ.js","assets/app-chrome-BeB4KgOf.js","assets/electron-env-DHOGevH3.js","assets/use-async-resource-BHFGZCY2.js","assets/sliding-tab-list-CmcrqRzN.js","assets/sliding-indicator-hwz0sx3h.js","assets/workspace-api-D3iuTdNK.js","assets/files-BNL4kkSB.js","assets/index.module-Cd9ENXfk.js","assets/dist-ZrL34Ps4.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/share-link-dialog-Cv-eDEw_.js","assets/popover-select-CLsphyzA.js","assets/dist-GJ8-1PAx.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/globe-DSSGFWFn.js","assets/button-Cc4hUNTt.js","assets/copy-text-row-CpiRzq4G.js","assets/right-workspace-store-OceFhUjM.js","assets/phone-workspace-store-DW2sZtkh.js","assets/theme-store-QGcjV6pN.js","assets/middleware-Pd0e8Igk.js","assets/file-preview-surface-B-r2ZnCV.js","assets/shares-api-cLTEcQLE.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{l as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as l,n as u,o as d}from"./locale-store-tI9VX7dp.js";import{t as f}from"./messages-e5MhDONm.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-CY7CS_D3.js";import{t as b}from"./arrow-right-DSSvoX71.js";import{f as x}from"./automation-display-DaVDNZz8.js";import{t as S}from"./check-DUBLcKHA.js";import{t as C}from"./chevron-down-ccbiQQz_.js";import{t as w}from"./chevron-right-BweFrslA.js";import{t as T}from"./circle-alert-BEjgurr2.js";import{t as E}from"./circle-check-C23XjkUj.js";import{t as D}from"./circle-pause-CN9jYH2s.js";import{t as O}from"./clock-3-DnrAnuyZ.js";import{t as k}from"./external-link-DjqjBmc3.js";import{t as A}from"./file-text-D12HbeVy.js";import{t as j}from"./grip-horizontal-CqVA8V1e.js";import{t as M}from"./history-DXH_9jsE.js";import{t as N}from"./list-todo-CTVRto8O.js";import{t as P}from"./lock-keyhole-DEK5kH0u.js";import{N as F,t as I}from"./markdown-view-CSpQhSka.js";import{t as L}from"./message-circle-Badhj-4D.js";import{t as R}from"./message-square-fVE7Ghj1.js";import{t as z}from"./panels-top-left-BKvp2Dag.js";import{t as B}from"./paperclip-f1HujQY1.js";import{t as V}from"./plus-Q2yW6OE7.js";import{t as H}from"./refresh-cw-BRlGaq2w.js";import{t as U}from"./search-DA7gz22f.js";import{t as W}from"./settings-2-D-csvaET.js";import{t as G}from"./sparkles-DHlfQFAF.js";import{t as K}from"./undo-2-6IMTwK4M.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as q}from"./cn-0WouolD0.js";import{t as J}from"./skeleton-DzdOeGYz.js";import{o as te}from"./constants-Bg1wM2nv.js";import{i as Y,l as ne,s as re}from"./capabilities-C5oWMC-Z.js";import{i as ie}from"./vendor-swr-CdRzEUwF.js";import{S as ae,b as oe,c as se,g as ce,h as le,m as ue,n as de,s as fe,v as pe,w as me,y as he}from"./workspace-preview-store-adwmi4nx.js";import{t as X}from"./button-Cc4hUNTt.js";import{a as ge,i as _e,o as ve,r as ye,s as be}from"./dist-GJ8-1PAx.js";import{a as xe,c as Se,i as Ce,o as we,r as Te,s as Ee,t as De}from"./composer-payload-handoff-BBTbJ1bO.js";import{t as Oe}from"./use-realtime-voice-w3aHR2dr.js";import{t as ke}from"./page-header-store-DeaRqZgV.js";import{t as Ae}from"./automation-api-BOnIc_vw.js";import{r as je}from"./composer-handoff-params-GKGdXjMZ.js";import{t as Me}from"./sliding-tab-list-CmcrqRzN.js";import{n as Ne,t as Pe}from"./use-composer-attachments-BfLhIb2_.js";import{n as Fe,r as Ie}from"./voice-input-shortcut-events-BbRrj833.js";import{n as Le}from"./date-formatters-DukWSVwc.js";import{a as Re,i as ze,r as Be,t as Ve}from"./routine-panel-BsE9o9uu.js";import{r as He,t as Ue}from"./task-result-evidence-BsBn3n_l.js";import{n as We}from"./tab-completion-input-CxtEp0aP.js";var Ge=n(),Z=e(t(),1);function Ke(e,t,n=!1){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!0),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(0),u=(0,Z.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?ue(e,!0):ue(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Z.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Z.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var Q=r(),$=12e3;function qe(e){let t=(0,Ge.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:_,onDragOver:v,onDragLeave:y,onDrop:b,onSubmit:x}=e,S=n===`inline`,C;t[0]!==s||t[1]!==a?(C=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=C):C=t[2];let w=C,T=d.voiceActive&&d.phase!==`error`,E;t[3]!==x||t[4]!==d.voiceActive?(E=e=>{if(d.voiceActive){e.preventDefault();return}x(e)},t[3]=x,t[4]=d.voiceActive,t[5]=E):E=t[5];let D=S?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,O;t[6]===D?O=t[7]:(O=q(`relative`,D),t[6]=D,t[7]=O);let k;t[8]!==S||t[9]!==c||t[10]!==o.dropFiles?(k=c?(0,Q.jsx)(`div`,{className:q(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,S&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=S,t[9]=c,t[10]=o.dropFiles,t[11]=k):k=t[11];let A=!S&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,j;t[12]===A?j=t[13]:(j=q(A),t[12]=A,t[13]=j);let M=S?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,N;t[14]!==r||t[15]!==o.intentLabel||t[16]!==M?(N=(0,Q.jsx)(`label`,{htmlFor:r,className:M,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=M,t[17]=N):N=t[17];let P;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(P=d.voiceActive?(0,Q.jsx)(Te,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=P):P=t[32];let F=T&&`hidden`,I=S?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,L;t[33]!==F||t[34]!==I?(L=q(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,F,I),t[33]=F,t[34]=I,t[35]=L):L=t[35];let R;t[36]===m?R=t[37]:(R=e=>m(e.target.value),t[36]=m,t[37]=R);let z=!S,V;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==m||t[44]!==_||t[45]!==L||t[46]!==R||t[47]!==z?(V=(0,Q.jsx)(We,{ref:i,id:r,className:L,value:a,onChange:R,onPaste:_,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:Je,placeholder:o.intentPlaceholder,maxLength:$,autoFocus:z}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=m,t[44]=_,t[45]=L,t[46]=R,t[47]=z,t[48]=V):V=t[48];let H=S?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,U;t[49]!==s||t[50]!==g||t[51]!==H?(U=(0,Q.jsx)(Ne,{attachments:s,topPadded:!1,onRemove:g,className:H}),t[49]=s,t[50]=g,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==S||t[54]!==a.length||t[55]!==o.shortcut?(W=S?null:(0,Q.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{children:o.shortcut}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,$.toLocaleString()]})]}),t[53]=S,t[54]=a.length,t[55]=o.shortcut,t[56]=W):W=t[56];let K;t[57]!==P||t[58]!==V||t[59]!==U||t[60]!==W||t[61]!==j||t[62]!==N?(K=(0,Q.jsxs)(`div`,{className:j,children:[N,P,V,U,W]}),t[57]=P,t[58]=V,t[59]=U,t[60]=W,t[61]=j,t[62]=N,t[63]=K):K=t[63];let ee=S?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,J;t[64]===ee?J=t[65]:(J=q(`flex shrink-0 items-center gap-2 border-t`,ee),t[64]=ee,t[65]=J);let te=!S&&`mr-auto`,Y;t[66]===te?Y=t[67]:(Y=q(`flex items-center gap-1`,te),t[66]=te,t[67]=Y);let ne=l||u,re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(B,{className:`size-4`,"aria-hidden":!0}),t[68]=re):re=t[68];let ie;t[69]!==o.attachTitle||t[70]!==h||t[71]!==ne?(ie=(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ne,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:re}),t[69]=o.attachTitle,t[70]=h,t[71]=ne,t[72]=ie):ie=t[72];let ae;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(ae=d.voiceActive?null:(0,Q.jsx)(we,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=ae):ae=t[77];let oe;t[78]!==Y||t[79]!==ie||t[80]!==ae?(oe=(0,Q.jsxs)(`div`,{className:Y,children:[ie,ae]}),t[78]=Y,t[79]=ie,t[80]=ae,t[81]=oe):oe=t[81];let se;t[82]!==p||t[83]!==S||t[84]!==o.shortcut?(se=S?(0,Q.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[82]=p,t[83]=S,t[84]=o.shortcut,t[85]=se):se=t[85];let ce=S?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,le=!w||l||d.voiceActive,ue=S?`size-3.5`:`size-4`,de;t[86]===ue?de=t[87]:(de=(0,Q.jsx)(G,{className:ue,"aria-hidden":!0}),t[86]=ue,t[87]=de);let fe;t[88]!==o.submit||t[89]!==ce||t[90]!==le||t[91]!==de?(fe=(0,Q.jsxs)(X,{type:`submit`,variant:`primary`,className:ce,disabled:le,children:[de,o.submit]}),t[88]=o.submit,t[89]=ce,t[90]=le,t[91]=de,t[92]=fe):fe=t[92];let pe;t[93]!==J||t[94]!==oe||t[95]!==se||t[96]!==fe?(pe=(0,Q.jsxs)(`div`,{className:J,children:[oe,se,fe]}),t[93]=J,t[94]=oe,t[95]=se,t[96]=fe,t[97]=pe):pe=t[97];let me;return t[98]!==y||t[99]!==v||t[100]!==b||t[101]!==E||t[102]!==K||t[103]!==pe||t[104]!==O||t[105]!==k?(me=(0,Q.jsxs)(`form`,{onSubmit:E,onDragOver:v,onDragLeave:y,onDrop:b,className:O,children:[k,K,pe]}),t[98]=y,t[99]=v,t[100]=b,t[101]=E,t[102]=K,t[103]=pe,t[104]=O,t[105]=k,t[106]=me):me=t[106],me}function Je(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Ye(e){let t=(0,Ge.c)(12),{href:n,children:r,onOpen:i}=e,o=a();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,Q.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${o.pathname}${o.search}`,a;t[3]!==n||t[4]!==e?(a=F(e,n),t[3]=n,t[4]=e,t[5]=a):a=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==a?(c=(0,Q.jsx)(s,{to:a,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=a,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,Q.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function Xe(e){let t=(0,Ge.c)(6),{opportunity:n,onOpen:r}=e,i=u(Ze),a,o;if(t[0]!==i||t[1]!==r||t[2]!==n.evidence||t[3]!==n.evidencePresentation){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=f(i).projectsPage.home.advisorEvidenceCopy,t=n.evidencePresentation,s=t?.locale===i?t.groups:void 0,c=new Intl.DateTimeFormat(i===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),l=t=>(0,Q.jsx)(`ul`,{className:`mt-2 space-y-3 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:t.map(t=>{let n=!!(t.href&&(/^https?:\/\//i.test(t.href)||t.href.startsWith(`/`)&&!t.href.startsWith(`//`)));return(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsxs)(`p`,{className:`text-fg-subtle`,children:[e.sources[t.sourceType],` · `,(0,Q.jsx)(`time`,{dateTime:new Date(t.observedAt).toISOString(),children:c.format(t.observedAt)})]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:t.observation}),(0,Q.jsx)(`p`,{className:`mt-1`,children:n?(0,Q.jsx)(Ye,{href:t.href,onOpen:r,children:e.openSource}):e.noSource})]},t.id)})}),u=(t,r)=>(0,Q.jsxs)(`li`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`p`,{className:`text-fg-muted`,children:t.summary}),(0,Q.jsxs)(`details`,{className:`mt-1`,children:[(0,Q.jsxs)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.originals,` · `,e.sourceCount.replace(`{{count}}`,String(t.evidenceIds.length))]}),l(n.evidence.filter(e=>t.evidenceIds.includes(e.id)))]})]},r);if(!s){o=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:e.unavailable}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.originals}),l(n.evidence)]})]});break bb0}a=(0,Q.jsxs)(`div`,{className:`mt-2 text-xs leading-5`,children:[(0,Q.jsx)(`p`,{className:`mb-3 text-fg-subtle`,children:e.aiNote}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(0,3).map(u)}),s.length>3?(0,Q.jsxs)(`details`,{className:`mt-2`,children:[(0,Q.jsx)(`summary`,{className:`min-h-9 cursor-pointer rounded-sm py-2 text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.more.replace(`{{count}}`,String(s.length-3))}),(0,Q.jsx)(`ul`,{className:`space-y-3 border-l border-edge pl-3`,children:s.slice(3).map(u)})]}):null]})}t[0]=i,t[1]=r,t[2]=n.evidence,t[3]=n.evidencePresentation,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Ze(e){return e.language}function Qe(e){let t=(0,Ge.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Q.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function $e(e){let t=(0,Ge.c)(63),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(et),d;t[20]===r.aiLabel?d=t[21]:(d=(0,Q.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,Q.jsx)(Qe,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,Q.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,Q.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,Q.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(C,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,Q.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n?p=t[51]:(p=(0,Q.jsx)(Xe,{opportunity:n}),t[50]=n,t[51]=p);let m;t[52]!==f||t[53]!==p?(m=(0,Q.jsxs)(`details`,{className:`mt-4 group`,children:[f,p]}),t[52]=f,t[53]=p,t[54]=m):m=t[54];let h;return t[55]!==a||t[56]!==m||t[57]!==o||t[58]!==s||t[59]!==c||t[60]!==l||t[61]!==u?(h=(0,Q.jsxs)(Q.Fragment,{children:[a,o,s,c,l,u,m]}),t[55]=a,t[56]=m,t[57]=o,t[58]=s,t[59]=c,t[60]=l,t[61]=u,t[62]=h):h=t[62],h}function et(e){return e.readiness!==`ready`}function tt(e){let t=(0,Ge.c)(142),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:l,preflight:u,receipt:d}=e,[f,p]=(0,Z.useState)(),m;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(m=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=m):m=t[3];let h=m,g;t[4]!==h||t[5]!==f?(g=h.find(e=>e.id===f)??h[0],t[4]=h,t[5]=f,t[6]=g):g=t[6];let _=g,v;t[7]===h[0]?.id?v=t[8]:(v=()=>p(h[0]?.id),t[7]=h[0]?.id,t[8]=v);let y=h[0]?.id,b;if(t[9]!==n.state||t[10]!==y?(b=[n.state,y],t[9]=n.state,t[10]=y,t[11]=b):b=t[11],(0,Z.useEffect)(v,b),n.state===`disabled`)return null;if(d){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(E,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===d.title?n=t[14]:(n=(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:d.title}),t[13]=d.title,t[14]=n);let i;t[15]===d.detail?i=t[16]:(i=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:d.detail}),t[15]=d.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==l?(o=(0,Q.jsx)(Qe,{label:r.history,onClick:l}),t[20]=r.history,t[21]=l,t[22]=o):o=t[22];let s=`#${d.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,Q.jsx)(X,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Q.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let u;t[26]!==o||t[27]!==c?(u=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=u):u=t[28];let f;return t[29]!==u||t[30]!==a?(f=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,u]})}),t[29]=u,t[30]=a,t[31]=f):f=t[31],f}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==l?(o=(0,Q.jsx)(Qe,{label:r.history,onClick:l}),t[35]=r.history,t[36]=l,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let u;t[41]===n.question.question?u=t[42]:(u=(0,Q.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=u);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==u||t[55]!==f||t[56]!==s?(p=(0,Q.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,u,f]}),t[54]=u,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!_)return null;let x=u?.opportunityId===_.id?u.value:void 0,S;t[58]!==n.stale||t[59]!==r.refreshing?(S=n.stale?(0,Q.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Q.jsx)(H,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=S):S=t[60];let w;t[61]!==r||t[62]!==l||t[63]!==_?(w=(0,Q.jsx)($e,{opportunity:_,copy:r,onOpenHistory:l}),t[61]=r,t[62]=l,t[63]=_,t[64]=w):w=t[64];let T;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==_||t[72]!==x?(T=x?.state===`needs_setup`?(0,Q.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsx)(W,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:x.blockers.map(nt)}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[x.recoveryActions.map(e=>(0,Q.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),x.degradedAction?(0,Q.jsx)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=_,t[72]=x,t[73]=T):T=t[73];let D;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==_?(D=_.actions.canStart?(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`start`),children:[(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=_,t[78]=D):D=t[78];let O;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==_?(O=_.actions.canDiscuss?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(_,`discuss`),children:[(0,Q.jsx)(L,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=_,t[83]=O):O=t[83];let k;t[84]!==O||t[85]!==D?(k=(0,Q.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O]}),t[84]=O,t[85]=D,t[86]=k):k=t[86];let A;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t[87]=A):A=t[87];let j;t[88]===r.more?j=t[89]:(j=(0,Q.jsxs)(`summary`,{className:`inline-flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[r.more,A]}),t[88]=r.more,t[89]=j);let M;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(H,{className:`size-4`,"aria-hidden":!0}),t[90]=M):M=t[90];let N;t[91]!==i||t[92]!==r.refresh||t[93]!==a?(N=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[M,r.refresh]}),t[91]=i,t[92]=r.refresh,t[93]=a,t[94]=N):N=t[94];let P;t[95]===r.feedback?P=t[96]:(P=(0,Q.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[95]=r.feedback,t[96]=P);let F;t[97]===r.alreadyDone?F=t[98]:(F=[`already_done`,r.alreadyDone],t[97]=r.alreadyDone,t[98]=F);let I;t[99]===r.irrelevant?I=t[100]:(I=[`irrelevant`,r.irrelevant],t[99]=r.irrelevant,t[100]=I);let R;t[101]===r.later?R=t[102]:(R=[`too_early`,r.later],t[101]=r.later,t[102]=R);let z;t[103]===r.sourceIncorrect?z=t[104]:(z=[`source_incorrect`,r.sourceIncorrect],t[103]=r.sourceIncorrect,t[104]=z);let B;t[105]===r.lessLikeThis?B=t[106]:(B=[`less_like_this`,r.lessLikeThis],t[105]=r.lessLikeThis,t[106]=B);let V;t[107]!==F||t[108]!==I||t[109]!==R||t[110]!==z||t[111]!==B?(V=[F,I,R,z,B],t[107]=F,t[108]=I,t[109]=R,t[110]=z,t[111]=B,t[112]=V):V=t[112];let U=V,K;t[113]!==i||t[114]!==s||t[115]!==_||t[116]!==U?(K=(0,Q.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:U.map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(_,t),children:n},t)})}),t[113]=i,t[114]=s,t[115]=_,t[116]=U,t[117]=K):K=t[117];let ee;t[118]!==P||t[119]!==K?(ee=(0,Q.jsxs)(`details`,{className:`relative`,children:[P,K]}),t[118]=P,t[119]=K,t[120]=ee):ee=t[120];let q;t[121]!==N||t[122]!==ee?(q=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[N,ee]}),t[121]=N,t[122]=ee,t[123]=q):q=t[123];let J;t[124]!==i||t[125]!==r.alternatives||t[126]!==h||t[127]!==_.id?(J=h.length>1?(0,Q.jsxs)(`div`,{className:`border-t border-edge-subtle pt-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:h.filter(e=>e.id!==_.id).map(e=>(0,Q.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(e.id),children:e.title},e.id))})]}):null,t[124]=i,t[125]=r.alternatives,t[126]=h,t[127]=_.id,t[128]=J):J=t[128];let te;t[129]!==j||t[130]!==q||t[131]!==J?(te=(0,Q.jsxs)(`details`,{className:`mt-1`,children:[j,q,J]}),t[129]=j,t[130]=q,t[131]=J,t[132]=te):te=t[132];let Y;t[133]!==k||t[134]!==te||t[135]!==S||t[136]!==w||t[137]!==T?(Y=(0,Q.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[S,w,T,k,te]}),t[133]=k,t[134]=te,t[135]=S,t[136]=w,t[137]=T,t[138]=Y):Y=t[138];let ne;return t[139]!==r.aiLabel||t[140]!==Y?(ne=(0,Q.jsx)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:Y}),t[139]=r.aiLabel,t[140]=Y,t[141]=ne):ne=t[141],ne}function nt(e){return(0,Q.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}function rt(e){let t=(0,Ge.c)(11),{observation:n,language:r,onUpdated:i}=e,a=r===`zh`,o=n.followUps??[],[s,c]=(0,Z.useState)(!1),[u,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(``),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[0]=_):_=t[0];let[v,y]=(0,Z.useState)(_),[b,x]=(0,Z.useState)(!0),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(``),E;t[1]!==n.topics||t[2]!==a?(E=e=>{f(e?.goal??``),g(e?.firstStep??(a?`先整理已有线索、已知事实和资料缺口,再提出下一步建议。`:`Organize existing evidence, known facts and missing material, then propose the next step.`)),m(``),y(e?[e.topicId]:n.topics.slice(0,3).map(dt)),c(!0),T(``)},t[1]=n.topics,t[2]=a,t[3]=E):E=t[3];let D=E,O;t[4]!==r||t[5]!==i?(O=e=>(0,Q.jsx)(ft,{followUp:e,language:r,onUpdated:i},e.id),t[4]=r,t[5]=i,t[6]=O):O=t[6];let k=o.filter(ut).map(O),A=n.status===`active`?(0,Q.jsxs)(Q.Fragment,{children:[o.some(lt)?null:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:a?`把一件事推进到完成`:`Keep one goal moving until it is done`}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:a?`记住目标和进展,一步步整理证据、查清问题。有新资料继续推进,遇到阻塞会告诉你缺什么。`:`Keep the goal and its progress together. Work through the evidence, continue when input arrives, and make blockers clear.`})]}),s?null:(n.followUpCandidates??[]).map(e=>(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`这条请求可能需要继续跟进,请先确认目标`:`This request may need follow-through. Confirm the goal first.`}),(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm text-fg`,children:e.goal}),(0,Q.jsx)(X,{onClick:()=>D(e),children:a?`设为持续目标`:`Set up a continuing goal`})]},e.topicId)),s?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),!S&&(C(!0),T(``),d(l(`/api/home/follow-ups`),{method:`POST`,body:JSON.stringify({goal:u,criteria:p.split(`
|
|
3
|
+
`).map(ot).filter(Boolean),firstStep:h,topicIds:v,autoContinue:b,stepBudget:3,locale:r,expectedObservationRevision:n.revision,idempotencyKey:crypto.randomUUID()})}).then(e=>{te.parse(e),c(!1),i()}).catch(e=>{T(e instanceof Error?e.message:String(e)),i()}).finally(()=>C(!1)))},children:[(0,Q.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a?`希望最终达成什么?`:`What outcome should we reach?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:u,onChange:e=>f(e.target.value),placeholder:a?`例如:查清 connector 重复请求的原因,并整理可验证的解决方案。`:`For example: understand duplicate connector requests and prepare a verifiable resolution.`,className:`mt-1 min-h-20 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a?`达到什么标准才算完成?每行一条,最多 10 项`:`What counts as done? One criterion per line`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e4,value:p,onChange:e=>m(e.target.value),placeholder:a?`明确复现条件
|
|
4
|
+
原因有日志或代码证据支持
|
|
5
|
+
给出修复后需要通过的验证项`:`Reproduction conditions are clear
|
|
6
|
+
Evidence supports the cause
|
|
7
|
+
Verification checks are defined`,className:`mt-1 min-h-24 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a?`现在先推进哪一步?`:`What is the first step?`,(0,Q.jsx)(`input`,{required:!0,maxLength:1e3,value:h,onChange:e=>g(e.target.value),placeholder:a?`整理现有线索、已知事实和缺少的日志。`:`Organize existing reports, known facts and missing logs.`,className:`mt-1 w-full rounded-lg border border-edge bg-surface-panel p-2`})]}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:a?`参考资料范围:已选 ${v.length} 段对话`:`Source scope: ${v.length} selected conversations`}),(0,Q.jsx)(`div`,{className:`mt-2 max-h-40 space-y-2 overflow-y-auto`,children:n.topics.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:v.includes(e.id),disabled:!v.includes(e.id)&&v.length>=8,onChange:t=>y(t.target.checked?[...v,e.id]:v.filter(t=>t!==e.id))}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.title})]},e.id))})]}),n.topics.length?null:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`先在对话里提供这件事的背景资料,开启观察后再选为参考来源。`:`First provide the background in a chat, then select it as a source.`}),(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:b,onChange:e=>x(e.target.checked),className:`mt-1`}),a?`资料齐备时自动继续本轮分析,最多 3 步;缺资料或检查未通过就停下。只整理资料和分析,不修改外部服务。`:`Continue private analysis automatically, up to 3 steps this round. Stop for missing input or failed checks. No changes to external services.`]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`一份阶段结果不等于整个目标完成。最终由你对照完成标准验收,随时可以暂停或结束。`:`A step result does not complete the goal. You review the final criteria, and can pause or end at any time.`}),w?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:w}):null,(0,Q.jsx)(X,{variant:`primary`,type:`submit`,disabled:S||!v.length,children:a?`确认目标,开始第一步`:`Confirm goal and start`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:S,onClick:()=>c(!1),children:a?`取消`:`Cancel`})]}):(0,Q.jsx)(X,{variant:o.some(ct)?`ghost`:`primary`,onClick:()=>D(),children:o.some(st)?a?`再交给我一件事`:`Add another goal`:a?`交给我持续推进一件事`:`Keep a goal moving`})]}):null,j=o.some(at)?(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`text-xs text-fg-muted`,children:a?`已结束的目标`:`Past goals`}),o.filter(it).map(e=>(0,Q.jsx)(ft,{followUp:e,language:r,onUpdated:i},e.id))]}):null,M;return t[7]!==k||t[8]!==A||t[9]!==j?(M=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[k,A,j]}),t[7]=k,t[8]=A,t[9]=j,t[10]=M):M=t[10],M}function it(e){return[`done`,`ended`].includes(e.status)}function at(e){return[`done`,`ended`].includes(e.status)}function ot(e){return e.trim()}function st(e){return![`done`,`ended`].includes(e.status)}function ct(e){return![`done`,`ended`].includes(e.status)}function lt(e){return![`done`,`ended`].includes(e.status)}function ut(e){return![`done`,`ended`].includes(e.status)}function dt(e){return e.id}function ft(e){let t=(0,Ge.c)(100),{followUp:n,language:r,onUpdated:i}=e,a=r===`zh`,[o,s]=(0,Z.useState)(),[c,u]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[0]=E):E=t[0];let[D,O]=(0,Z.useState)(E),[k,A]=(0,Z.useState)(``),j=o&&o.revision>n.revision?o:n,M;t[1]===j.steps?M=t[2]:(M=j.steps.at(-1),t[1]=j.steps,t[2]=M);let N=M,P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=[`done`,`ended`],t[3]=P):P=t[3];let F=P.includes(j.status),I=N?.status===`queued`?a?`下一步已安排`:`Next step queued`:N&&[`succeeded`,`failed`,`cancelled`].includes(N.status)?a?`正在整理本步结果`:`Processing the step result`:a?`正在推进`:`In progress`,L=a?`等资料 / 待处理`:`Waiting for input`,R=a?`等你确认下一步`:`Review next step`,z=a?`已暂停`:`Paused`,B=a?`已由你验收完成`:`Accepted by you`,V=a?`已结束`:`Ended`,H;t[4]!==I||t[5]!==L||t[6]!==R||t[7]!==z||t[8]!==B||t[9]!==V?(H={working:I,waiting:L,review:R,paused:z,done:B,ended:V},t[4]=I,t[5]=L,t[6]=R,t[7]=z,t[8]=B,t[9]=V,t[10]=H):H=t[10];let U=H[j.status],W;t[11]!==c||t[12]!==j.id||t[13]!==j.revision||t[14]!==i||t[15]!==a?(W=e=>{c||(u(!0),p(``),d(l(`/api/home/follow-ups/${encodeURIComponent(j.id)}/command`),{method:`POST`,body:JSON.stringify({expectedRevision:j.revision,idempotencyKey:crypto.randomUUID(),command:e})}).then(t=>{s(te.parse(t)),e.kind===`add_input`&&h(``),y(!1),C(!1),T(!1),i()}).catch(e=>{let t=e instanceof Error?e.message:String(e);p(/changed/i.test(t)?a?`这条目标有新进展,已刷新。请确认后再操作。`:`Progress changed. Review the refreshed goal and try again.`:t),i()}).finally(()=>u(!1)))},t[11]=c,t[12]=j.id,t[13]=j.revision,t[14]=i,t[15]=a,t[16]=W):W=t[16];let G=W,K=a?`持续推进的目标`:`Continuing goal`,ee=a?`持续推进`:`Continuing goal`,q;t[17]===ee?q=t[18]:(q=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:ee}),t[17]=ee,t[18]=q);let J;t[19]===U?J=t[20]:(J=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,role:`status`,children:U}),t[19]=U,t[20]=J);let Y;t[21]!==q||t[22]!==J?(Y=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[q,J]}),t[21]=q,t[22]=J,t[23]=Y):Y=t[23];let ne;t[24]===j.goal?ne=t[25]:(ne=(0,Q.jsx)(`h4`,{className:`break-words text-base font-semibold text-fg`,children:j.goal}),t[24]=j.goal,t[25]=ne);let re;t[26]===f?re=t[27]:(re=f?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f}):null,t[26]=f,t[27]=re);let ie;t[28]!==j.stopPending||t[29]!==a?(ie=j.stopPending?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`已停止安排新步骤,正在确认上一步是否终止。`:`No new steps will start until the previous execution is confirmed stopped.`}):null,t[28]=j.stopPending,t[29]=a,t[30]=ie):ie=t[30];let ae;t[31]!==j.summary||t[32]!==a?(ae=j.summary?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`最近进展`:`Latest progress`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-sm text-fg`,children:j.summary})]}):null,t[31]=j.summary,t[32]=a,t[33]=ae):ae=t[33];let oe;t[34]!==j.waitingFor||t[35]!==a?(oe=j.waitingFor?(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-inset p-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`当前需要`:`What is needed`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:j.waitingFor===`Source scope or goal contract needs review`?a?`参考资料或目标要求已变更,请先检查。`:`Source scope or goal requirements need review.`:j.waitingFor===`Step history changed; review before resuming`?a?`一步历史结果已删除,目标已暂停。请确认下一步后再继续。`:`A step was deleted. Review the next action before resuming.`:j.waitingFor===`New material awaits review`?a?`有新增资料还没核对,请先推进下一步。`:`New material needs review before goal acceptance.`:j.waitingFor})]}):null,t[34]=j.waitingFor,t[35]=a,t[36]=oe):oe=t[36];let se;t[37]!==j.nextStep||t[38]!==j.status||t[39]!==a?(se=j.nextStep?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.status===`working`?a?`当前这一步`:`Current step`:a?`建议下一步`:`Proposed next step`}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:j.nextStep})]}):null,t[37]=j.nextStep,t[38]=j.status,t[39]=a,t[40]=se):se=t[40];let ce;t[41]!==N||t[42]!==b||t[43]!==a?(ce=N?(0,Q.jsx)(X,{variant:`secondary`,onClick:()=>x(b===N.taskId?void 0:N.taskId),children:a?`查看第 ${N.number} 步的进度与结果`:`Review step ${N.number}`}):null,t[41]=N,t[42]=b,t[43]=a,t[44]=ce):ce=t[44];let le;t[45]!==k||t[46]!==S||t[47]!==G||t[48]!==c||t[49]!==D||t[50]!==w||t[51]!==v||t[52]!==F||t[53]!==j.autoContinue||t[54]!==j.criteria||t[55]!==j.nextStep||t[56]!==j.remainingSteps||t[57]!==j.status||t[58]!==j.stopPending||t[59]!==N?.verified||t[60]!==g||t[61]!==m||t[62]!==a?(le=F?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.autoContinue?a?`本轮还可自动推进 ${j.remainingSteps} 步。每步结果都会保留,遇到资料缺口会停下。`:`Up to ${j.remainingSteps} more automatic steps this round. Missing input stops progress.`:a?`每个下一步都由你确认后再执行。`:`You confirm each next step before it runs.`}),j.status===`review`&&!j.stopPending?(0,Q.jsx)(X,{variant:`primary`,disabled:c,onClick:()=>{_(j.nextStep),y(!v)},children:j.nextStep?a?`确认或调整下一步`:`Confirm or adjust next step`:a?`安排下一步`:`Set the next step`}):null,v?(0,Q.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),G({kind:`continue`,nextStep:g,stepBudget:j.autoContinue?3:1})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`下一步要完成什么?`:`What should the next step deliver?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:g,onChange:e=>_(e.target.value),className:`mt-1 min-h-20 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:j.autoContinue?a?`确认后,本轮最多再推进 3 步。`:`Confirm up to 3 more private steps this round.`:a?`确认后仅执行这一步。`:`Confirm this step only.`}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:c,children:a?`确认继续推进`:`Continue with this step`})]}):null,(0,Q.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),G({kind:`add_input`,text:m})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`补充资料或最新情况`:`Add evidence or an update`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:8e3,value:m,onChange:e=>h(e.target.value),placeholder:a?`粘贴复现条件、日志片段,或说明有什么新进展。`:`Add reproduction steps, logs or new progress.`,className:`mt-1 min-h-16 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(X,{variant:j.status===`waiting`?`primary`:`secondary`,disabled:c||!m.trim(),type:`submit`,children:j.status===`waiting`&&j.autoContinue&&j.remainingSteps>0&&N?.verified?a?`补充资料,继续推进`:`Add evidence and continue`:a?`补充到这条目标`:`Add to this goal`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[j.status===`waiting`&&!j.stopPending?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>{_(j.nextStep),y(!v)},children:a?`调整下一步`:`Adjust next step`}):null,(0,Q.jsx)(X,{variant:`ghost`,disabled:c,onClick:()=>G({kind:j.status===`paused`?`resume`:`pause`}),children:j.status===`paused`?a?`恢复推进`:`Resume`:a?`暂停推进`:`Pause`}),N?.verified&&j.status!==`working`&&!j.stopPending?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>C(!S),children:a?`验收整个目标`:`Review goal completion`}):null,(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>T(!w),children:a?`结束跟进`:`End follow-up`})]}),w?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`停止后续推进并请求取消当前步骤,保留已有结果。`:`Stop further work and cancel the current step. Keep previous results.`}),(0,Q.jsx)(X,{disabled:c,onClick:()=>G({kind:`end`}),children:a?`确认结束跟进`:`Confirm end`})]}):null,S?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),G({kind:`complete`,confirmedCriteria:D,note:k})},children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a?`请对照结果逐项确认,阶段产出不代表目标已完成。`:`Confirm each criterion against the results. A completed step is not a completed goal.`}),j.criteria.map((e,t)=>(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:D.includes(t),onChange:e=>O(e.target.checked?[...D,t]:D.filter(e=>e!==t))}),e]},t)),(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`验收依据`:`Acceptance evidence`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:k,onChange:e=>A(e.target.value),className:`mt-1 w-full rounded-lg border border-edge bg-surface-panel p-2 text-sm`})]}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:c||D.length!==j.criteria.length||!k.trim(),children:a?`确认目标已完成`:`Accept completed goal`})]}):null]}),t[45]=k,t[46]=S,t[47]=G,t[48]=c,t[49]=D,t[50]=w,t[51]=v,t[52]=F,t[53]=j.autoContinue,t[54]=j.criteria,t[55]=j.nextStep,t[56]=j.remainingSteps,t[57]=j.status,t[58]=j.stopPending,t[59]=N?.verified,t[60]=g,t[61]=m,t[62]=a,t[63]=le):le=t[63];let ue=a?`完成标准与推进记录`:`Acceptance criteria and step history`,de;t[64]===ue?de=t[65]:(de=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:ue}),t[64]=ue,t[65]=de);let fe;t[66]===j.criteria?fe=t[67]:(fe=j.criteria.map(pt),t[66]=j.criteria,t[67]=fe);let pe;t[68]===fe?pe=t[69]:(pe=(0,Q.jsx)(`ul`,{className:`mt-2 list-disc pl-4 text-sm text-fg-muted`,children:fe}),t[68]=fe,t[69]=pe);let me;if(t[70]!==j.steps||t[71]!==a){let e;t[73]===a?e=t[74]:(e=e=>(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 border-l border-edge pl-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[e.number,`. `,e.action,` · `,e.verified?a?`本步检查通过`:`Step checked`:a?`结果待核查`:`Needs review`]}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>x(e.taskId),children:a?`查看`:`Review`})]},e.number),t[73]=a,t[74]=e),me=j.steps.map(e),t[70]=j.steps,t[71]=a,t[72]=me}else me=t[72];let he;t[75]!==de||t[76]!==pe||t[77]!==me?(he=(0,Q.jsxs)(`details`,{children:[de,pe,me]}),t[75]=de,t[76]=pe,t[77]=me,t[78]=he):he=t[78];let ge;t[79]!==r||t[80]!==i||t[81]!==b?(ge=b?(0,Q.jsx)(ze,{taskId:b,language:r,onComplete:i}):null,t[79]=r,t[80]=i,t[81]=b,t[82]=ge):ge=t[82];let _e=`#/tasks/${encodeURIComponent(j.rootTaskId)}`,ve=a?`查看完整目标与子任务`:`View the goal and its child tasks`,ye;t[83]!==_e||t[84]!==ve?(ye=(0,Q.jsx)(`a`,{className:`inline-block text-xs text-accent-fg`,href:_e,children:ve}),t[83]=_e,t[84]=ve,t[85]=ye):ye=t[85];let be;return t[86]!==K||t[87]!==Y||t[88]!==ne||t[89]!==re||t[90]!==ie||t[91]!==ae||t[92]!==oe||t[93]!==se||t[94]!==ce||t[95]!==le||t[96]!==he||t[97]!==ge||t[98]!==ye?(be=(0,Q.jsxs)(`section`,{className:`space-y-3 rounded-lg border border-edge p-3`,"aria-label":K,children:[Y,ne,re,ie,ae,oe,se,ce,le,he,ge,ye]}),t[86]=K,t[87]=Y,t[88]=ne,t[89]=re,t[90]=ie,t[91]=ae,t[92]=oe,t[93]=se,t[94]=ce,t[95]=le,t[96]=he,t[97]=ge,t[98]=ye,t[99]=be):be=t[99],be}function pt(e){return(0,Q.jsx)(`li`,{children:e},e)}function mt(e){let t=(0,Ge.c)(29),{starters:n,revision:r,language:i,onStarted:a,onUpdated:o}=e,s=i===`zh`,[c,u]=(0,Z.useState)(),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(``),g;if(t[0]!==f||t[1]!==m||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==r||t[6]!==c||t[7]!==n||t[8]!==s){let e;t[10]===c?e=t[11]:(e=e=>e.kind===c,t[10]=c,t[11]=e);let _=n.find(e),v=_&&ne[_.kind][i],y=s?`这些工作,可以先帮你整理一份`:`Here is work I can prepare for you`,b;t[12]===y?b=t[13]:(b=(0,Q.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:y}),t[12]=y,t[13]=b);let x=s?`从近期的相关请求中整理资料和待办,先给你看结果,再决定是否定期交给我。`:`Turn recent requests into useful drafts. Review the result before deciding whether to make it recurring.`,S;t[14]===x?S=t[15]:(S=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:x}),t[14]=x,t[15]=S);let C;if(t[16]!==f||t[17]!==i||t[18]!==c||t[19]!==n||t[20]!==s){let e;t[22]!==f||t[23]!==i||t[24]!==c||t[25]!==s?(e=e=>{let t=ne[e.kind][i];return(0,Q.jsxs)(`article`,{className:`flex min-w-0 flex-col items-start gap-2 rounded-lg border border-edge p-3`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.output}),(0,Q.jsx)(`p`,{className:`mt-auto text-xs text-fg-subtle`,children:s?`最近有 ${e.requestCount} 条相关请求`:`${e.requestCount} related recent requests`}),(0,Q.jsx)(X,{disabled:f,"aria-expanded":c===e.kind,onClick:()=>{u(e.kind),h(``)},children:s?`看看会做什么`:`See what I will prepare`})]},e.kind)},t[22]=f,t[23]=i,t[24]=c,t[25]=s,t[26]=e):e=t[26],C=n.map(e),t[16]=f,t[17]=i,t[18]=c,t[19]=n,t[20]=s,t[21]=C}else C=t[21];let w;t[27]===C?w=t[28]:(w=(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C}),t[27]=C,t[28]=w),g=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[b,S,w,_&&v?(0,Q.jsxs)(`form`,{className:`space-y-3 rounded-lg border border-edge bg-surface-inset p-3`,onSubmit:e=>{e.preventDefault(),!f&&(p(!0),h(``),d(l(`/api/home/observation/prepare`),{method:`POST`,body:JSON.stringify({kind:_.kind,topicIds:_.topicIds,expectedRevision:r,idempotencyKey:crypto.randomUUID(),locale:i})}).then(e=>{let t=Y.parse(e);if(t.outcome!==`task`)throw Error(s?`暂时无法开始,请稍后重试。`:`Could not start this draft.`);a(t.taskId),u(void 0),o()}).catch(e=>{let t=e instanceof Error?e.message:String(e);h(/revision|Refresh|available/i.test(t)?s?`工作记录有更新,已刷新可用任务,请重新确认。`:`Work has changed. Review the refreshed task and try again.`:t),o()}).finally(()=>p(!1)))},children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:s?`你会得到:${v.title}`:`You will get: ${v.title}`}),(0,Q.jsx)(`ul`,{className:`list-disc space-y-1 pl-4 text-sm text-fg-muted`,children:v.deliverables.map(gt)}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:s?`这次参考的请求`:`Requests used for this draft`}),_.previews.map(ht)]}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:s?`先准备私人草稿,资料不足会标出来。不发消息,也不自动设定时。`:`Prepare a private draft and flag missing material. No messages or recurring runs.`}),m?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m}):null,(0,Q.jsx)(X,{variant:`primary`,type:`submit`,disabled:f,children:f?s?`正在创建任务…`:`Starting…`:s?`先生成一份`:`Prepare this draft`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:f,onClick:()=>u(void 0),children:s?`取消`:`Cancel`})]}):null]}),t[0]=f,t[1]=m,t[2]=i,t[3]=a,t[4]=o,t[5]=r,t[6]=c,t[7]=n,t[8]=s,t[9]=g}else g=t[9];return g}function ht(e,t){return(0,Q.jsx)(`p`,{className:`mt-2 break-words`,children:e},t)}function gt(e){return(0,Q.jsx)(`li`,{children:e},e)}function _t({observation:e,advisor:t,language:n,emphasizeStart:r=!0,onUpdated:i}){let a=n===`zh`,[o,s]=(0,Z.useState)(!1),[c,u]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(`once`),[b,x]=(0,Z.useState)(),[S,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(),[N,F]=(0,Z.useState)(!1),I=t.state===`ready`?t.primary:void 0,L=I?.evidence.map(e=>/^observation:([^:]+):/.exec(e.id)?.[1]).find(Boolean),R=e.topics.filter(e=>e.feedback.some(e=>e.status===`active`)||e.trials.length||e.routine),z=R.find(e=>e.id===T),B=b?e.topics.find(e=>e.id===b):e.topics.find(e=>e.routine&&e.routine.status!==`ended`)??e.topics.find(e=>e.trials.length)??e.topics.find(e=>e.id===L)??e.topics[0],V=e.status===`active`&&B?.id===L?I:void 0,H=B?.trials[0],U=!!(B?.routine||H||V),W=t.state===`quiet`&&[`model_unavailable`,`generation_failed`,`budget_exhausted`].includes(t.reason),K=async e=>{if(!o){s(!0),u(``),p(``);try{await e(),i()}catch(e){u(e instanceof Error?e.message:String(e)),i()}finally{s(!1)}}},ee=async t=>re.parse(await d(l(`/api/home/observation/command`),{method:`POST`,body:JSON.stringify({expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),command:t})})),q=()=>{B&&(x(B.id),w(!S))},J=()=>B&&void K(async()=>{let t=await d(l(`/api/home/observation/discussion`),{method:`POST`,body:JSON.stringify({topicId:B.id,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID()})});window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:t}))});return(0,Q.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-panel p-4 shadow-surface`,"aria-labelledby":`home-observation-title`,"aria-busy":o,"data-workbench-panel":!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-accent-soft text-accent-fg`,children:(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`h2`,{id:`home-observation-title`,className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我`:`Let me handle it`})]}),(0,Q.jsxs)(X,{variant:`ghost`,className:`gap-1 rounded-lg px-2 text-xs`,"aria-expanded":D,onClick:()=>O(!D),children:[a?`记录与设置`:`History and settings`,(0,Q.jsx)(C,{className:D?`size-3.5 shrink-0 rotate-180`:`size-3.5 shrink-0`,"aria-hidden":!0})]})]}),c?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:c}):null,f?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-fg-muted`,children:f}):null,b&&!B&&g?(0,Q.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[a?`这件事已不在记录中。未保存的内容:`:`This item is no longer available. Your unsaved note: `,g]}):null,(0,Q.jsx)(rt,{observation:e,language:n,onUpdated:i}),e.status===`active`?(0,Q.jsx)(X,{className:`mt-3`,variant:`ghost`,"aria-expanded":m,onClick:()=>h(!m),children:a?`一次性整理与定期安排`:`One-off drafts and recurring work`}):null,e.status!==`active`||m?(0,Q.jsx)(Q.Fragment,{children:e.status===`disabled`?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`h3`,{className:`text-balance text-lg font-semibold leading-snug tracking-tight text-fg`,children:a?`把重复的事,慢慢交给我`:`Let me take recurring work off your hands`}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-prose text-sm leading-6 text-fg-muted`,children:a?`我会结合你在 xopc 中的工作记录,寻找可以代劳的事情。有合适的建议时,先做一次给你看。`:`I can look through your work in xopc for tasks I could take on, then offer a first draft for you to review.`}),(0,Q.jsx)(X,{className:`mt-3 rounded-lg text-xs sm:shadow-none`,variant:r?`primary`:`secondary`,disabled:o,onClick:()=>void K(async()=>{await ee({kind:`start`,backfillDays:30})}),children:a?`帮我发现重复工作`:`Find recurring work`}),(0,Q.jsxs)(`p`,{className:`mt-4 flex items-start gap-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:[(0,Q.jsx)(P,{className:`mt-1 size-3 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:a?`仅查看最近 30 天已授权的私人会话及后续工作记录。不扫描屏幕,定期执行前会请你确认。`:`Uses up to 30 days of authorized private chats and new work. No screen recording. Recurring runs need your confirmation.`})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[!U&&e.status===`active`&&e.starters?.length?(0,Q.jsx)(mt,{starters:e.starters,revision:e.revision,language:n,onStarted:M,onUpdated:i}):U?B?.routine?(0,Q.jsx)(Be,{routine:B.routine,language:n,onUpdated:i},B.routine.id):H?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:[`review`,`closed`].includes(H.phase)?a?`先看看这次做得怎么样`:`Review the first result`:a?`先做一次,再决定是否定期交给我`:`Try it once before making it recurring`}),(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:H.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`满意后再决定要不要定期交给我。`:`Review the result before deciding whether to make it recurring.`}),(0,Q.jsx)(X,{variant:`primary`,onClick:()=>M(j===H.taskId?void 0:H.taskId),children:a?`查看这次结果`:`Review this result`}),[`review`,`closed`].includes(H.phase)?(0,Q.jsx)(Ve,{topicId:B.id,trial:H,language:n,onUpdated:i},H.taskId):null]}):V&&B?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`这件事,可以先让我试试`:`Here is something I could try`}),(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:V.title}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:V.outcome}),V.risk===`analysis`?(0,Q.jsx)(X,{variant:`primary`,disabled:o,onClick:()=>void K(async()=>{let t=Y.parse(await d(l(`/api/home/observation/trial`),{method:`POST`,body:JSON.stringify({topicId:B.id,opportunityId:V.id,expectedRevision:e.revision,expectedOpportunityRevision:V.revision,idempotencyKey:crypto.randomUUID()})}));if(t.outcome===`task`)M(t.taskId);else throw Error(a?`请先完成相关能力配置。`:`Set up the required capabilities first.`)}),children:a?`先帮我做一次`:`Try it once`}):(0,Q.jsx)(X,{variant:`primary`,disabled:o,onClick:J,children:a?`先确认怎么做`:`Discuss the approach`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:V.risk===`analysis`?a?`先生成私人草稿,由你查看后决定下一步。`:`Start with a private draft for you to review.`:a?`这件事需要外部服务,先一起确认范围。`:`This needs an external service. Agree on the scope first.`}),(0,Q.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:a?`为什么推荐这件事`:`Why this suggestion`}),(0,Q.jsx)(`p`,{className:`mt-2 leading-5`,children:V.rationale}),V.evidence.map(e=>(0,Q.jsx)(`p`,{className:`mt-2 leading-5`,children:e.observation},e.id))]})]}):null:(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-base font-medium text-fg`,children:a?`先做一件具体的事`:`Start with a concrete task`}),(0,Q.jsx)(`p`,{className:`max-w-prose text-sm leading-6 text-fg-muted`,children:e.status===`paused`?a?`已暂停寻找新建议。你也可以直接告诉我,哪件事最想少做一点。`:`New suggestions are paused. You can still tell me what you would like to spend less time on.`:W?a?`暂时无法生成新建议,已有记录和反馈都已保留。你也可以直接说说想交给我的事。`:`New suggestions are temporarily unavailable. Your records and feedback are saved. You can still tell me what you would like help with.`:a?`例如整理 PR 审查清单、汇总问题线索,或写一份工作进展草稿。先准备一次,满意后再设为定期执行。`:`Prepare a PR review checklist, collect issue reports, or draft a work update. Try it once before making it recurring.`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`pr_review`,`issue_digest`,`work_summary`].map(e=>{let t=ne[e][n],r=a?`请帮我准备「${t.title}」。\n目标:${t.output}\n\n要参考的资料或链接:\n\n先生成私人草稿;缺少资料时明确告诉我,不要开启定时执行。`:`Prepare ${t.title}.\n${t.output}\n\nSource material or links:\n\nCreate a private draft and flag missing information. Do not create recurring runs.`;return(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(`a`,{href:`#/chat/new?${new URLSearchParams({draft:r})}`,children:t.title})},e)})}),e.status===`paused`?(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>F(!N),children:a?`恢复寻找建议`:`Resume suggestions`}):null]}),U&&B&&e.status===`active`?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1`,children:[(0,Q.jsx)(X,{variant:`ghost`,disabled:o,"aria-expanded":S,onClick:q,children:a?`调整做法`:`Refine the approach`}),(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:J,children:a?`聊聊这件事`:`Discuss this task`})]}):null,j?(0,Q.jsx)(ze,{taskId:j,language:n,onComplete:i}):null,N?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`恢复后,要补看暂停期间的工作吗?`:`Include work from while suggestions were paused?`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[[`catch_up`,`new_only`].map(e=>(0,Q.jsx)(X,{disabled:o,onClick:()=>void K(async()=>{await ee({kind:`resume`,mode:e}),F(!1)}),children:e===`catch_up`?a?`一起补看`:`Include earlier work`:a?`只看之后的工作`:`New work only`},e)),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>F(!1),children:a?`取消`:`Cancel`})]})]}):null]})}):null,S&&B?(0,Q.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),K(async()=>{await ee({kind:`feedback`,topicId:B.id,text:g,scope:v}),_(``),w(!1),p(a?`已记下。改变定期做法前,会先请你确认。`:`Preference saved. I will ask before changing the recurring approach.`)})},children:[(0,Q.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[a?`关于「${B.title}」,希望我怎么做?`:`How should I handle “${B.title}”?`,(0,Q.jsx)(`textarea`,{required:!0,maxLength:1e3,value:g,onChange:e=>_(e.target.value),placeholder:a?`例如:先列出未解决的阻塞,每项附上来源。`:`For example: list unresolved blockers first and include sources.`,className:`mt-1 min-h-24 w-full rounded-lg border border-edge bg-surface-inset p-2 text-sm text-fg`})]}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":a?`反馈范围`:`Feedback scope`,children:[`once`,`project`,`similar`].filter(e=>e!==`project`||B.projectId).map(e=>(0,Q.jsx)(X,{type:`button`,variant:e===v?`secondary`:`ghost`,"aria-pressed":e===v,onClick:()=>y(e),children:e===`once`?a?`仅这一次`:`Just this time`:e===`project`?a?`这个项目都适用`:`This project`:a?`以后这类事都适用`:`Similar future work`},e))}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`记下你的要求;改变定期安排前,仍会请你确认。`:`I will remember your preference and ask before changing a recurring arrangement.`}),(0,Q.jsx)(X,{type:`submit`,variant:`primary`,disabled:o||!g.trim(),children:a?`记住这个要求`:`Save preference`}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>{w(!1),_(``),y(`once`)},children:a?`取消`:`Cancel`})]}):null,D?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-3 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:e.status===`disabled`?a?`尚未开启`:`Not enabled`:e.status===`paused`?a?`已暂停寻找新建议`:`Suggestions paused`:e.analyzedRevision<e.revision?a?`正在整理最近的工作记录`:`Reviewing recent work`:a?`有新发现时会在这里告诉你`:`New suggestions will appear here`}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:a?`只查看已授权的 xopc 私人会话和相关任务结果。暂停寻找建议不会停止已经确认的定期安排。`:`Uses authorized private xopc chats and related task results. Pausing suggestions does not stop confirmed recurring tasks.`}),e.status===`disabled`?null:(0,Q.jsx)(X,{disabled:o,variant:`ghost`,onClick:()=>e.status===`active`?void K(async()=>{await ee({kind:`pause`})}):F(!N),children:e.status===`active`?a?`暂停寻找建议`:`Pause suggestions`:a?`恢复寻找建议`:`Resume suggestions`}),R.length?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:a?`已保存的要求与试做`:`Saved preferences and trials`}),(0,Q.jsx)(`div`,{className:`max-h-48 space-y-2 overflow-y-auto`,children:R.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg border border-edge p-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm text-fg`,children:e.routine?.title||e.trials[0]?.title||(a?`已保存的工作要求`:`Saved work preferences`)}),(0,Q.jsx)(X,{variant:`ghost`,disabled:!!g&&e.id!==B?.id,onClick:()=>{E(e.id),x(e.id),A(!1)},children:a?`管理`:`Manage`})]},e.id))}),z?(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg bg-surface-inset p-3`,children:[e.status===`active`?(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:q,children:a?`调整要求`:`Edit preferences`}):null,z.feedback.filter(e=>e.status===`active`).map(e=>(0,Q.jsxs)(`div`,{className:`text-xs text-fg`,children:[(0,Q.jsx)(`p`,{children:e.text}),(0,Q.jsx)(X,{disabled:o,variant:`ghost`,onClick:()=>void K(async()=>{await ee({kind:`retract`,topicId:z.id,feedbackId:e.id})}),children:a?`撤回要求`:`Retract preference`})]},e.id)),z.trials.map(e=>(0,Q.jsxs)(X,{variant:`ghost`,onClick:()=>M(e.taskId),children:[a?`查看结果:`:`Review result: `,e.title]},e.taskId)),(0,Q.jsx)(X,{variant:`ghost`,disabled:o,onClick:()=>A(!0),children:a?`不再参考这件事`:`Stop using this work history`}),k?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg`,children:a?`清除关于这件事的理解和要求。原始记录、已有任务和自动化保留。`:`Forget this understanding and saved preferences. Original records, tasks and automations remain.`}),(0,Q.jsx)(X,{disabled:o,onClick:()=>void K(async()=>{await ee({kind:`forget`,topicId:z.id}),x(void 0),E(void 0),A(!1),_(``),w(!1),M(void 0)}),children:a?`确认不再参考`:`Confirm exclusion`})]}):null]}):null]}):(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`你确认的要求与试做结果会保存在这里。普通聊天记录仍在原对话中查看。`:`Your saved preferences and trial results will appear here. View ordinary work history in its original chat.`})]}):null]})}var vt=new Set([`started`,`discussing`,`completed`]);function yt(){let e=(0,Ge.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(bt)}),e[0]=t):t=e[0],t}function bt(e){return(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Q.jsx)(J,{className:`h-4 w-24 rounded`}),(0,Q.jsx)(J,{className:`h-5 w-4/5 rounded`}),(0,Q.jsx)(J,{className:`h-4 w-3/5 rounded`})]},e)}function xt(e){let t=(0,Ge.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=u(St),s=f(o).projectsPage.home,l=c(),[d,b]=(0,Z.useState)(`all`),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[0]=x):x=t[0];let[S,w]=(0,Z.useState)(x),[T,E]=(0,Z.useState)(!1),[D,A]=(0,Z.useState)(),j;t[1]===n?j=t[2]:(j=()=>{if(!n)return;let e=!0;return E(!0),A(void 0),le().then(t=>{e&&w(t.items)}).catch(t=>{e&&A(t instanceof Error?t.message:String(t))}).finally(()=>{e&&E(!1)}),()=>{e=!1}},t[1]=n,t[2]=j);let N;t[3]!==n||t[4]!==r?(N=[n,r],t[3]=n,t[4]=r,t[5]=N):N=t[5],(0,Z.useEffect)(j,N);let P=S.filter(e=>d===`all`||(d===`adopted`?vt.has(e.status):!vt.has(e.status))),I=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),L=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of P){let t=I.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let z=[...R.entries()],B=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],V=e=>{if(e.href){i(!1),l(F(`/`,e.href));return}e.status===`discussing`&&(i(!1),l(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},U;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=U):U=t[6];let W;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(M,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=W):W=t[7];let G;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[8]=G):G=t[8];let K=T?(0,Q.jsx)(yt,{}):D?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):z.length===0?(0,Q.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Q.jsx)(M,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,Q.jsx)(`div`,{className:`space-y-6`,children:z.map(e=>{let[t,n]=e;return(0,Q.jsxs)(`section`,{"aria-label":t,children:[(0,Q.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Q.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:B(e)}),(0,Q.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Q.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:L.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Q.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Q.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,L.format(new Date(e.snoozedUntil))]}):null,(0,Q.jsxs)(`details`,{className:`group mt-3`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,Q.jsx)(C,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Q.jsx)(Xe,{opportunity:e.opportunity,onOpen:()=>i(!1)})]}),t||n?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>V(e),children:[(0,Q.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),q;return t[9]===K?q=t[10]:(q=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:K}),t[9]=K,t[10]=q),(0,Q.jsx)(y,{open:n,onOpenChange:i,children:(0,Q.jsxs)(g,{children:[U,(0,Q.jsxs)(_,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[W,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,Q.jsx)(m,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:G})})]}),(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Q.jsx)(Me,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Q.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${d===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":d===t,onClick:()=>b(t),children:n},t)})})}),q]})]})})}function St(e){return e.language}function Ct(e,t){return e.replace(`{{count}}`,String(t))}function wt(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ct(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Tt={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Et(e){let t=(0,Ge.c)(45),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]!==n||t[1]!==i?(l=wt(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h;t[5]!==u.refreshing||t[6]!==u.tone?(h=u.tone!==`neutral`&&!u.refreshing?(0,Q.jsx)(`span`,{className:q(`absolute right-1.5 top-1.5 size-1.5 rounded-full`,Tt[u.tone]),"aria-hidden":!0}):null,t[5]=u.refreshing,t[6]=u.tone,t[7]=h):h=t[7];let g;t[8]!==p||t[9]!==m||t[10]!==h?(g=(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`relative size-9 rounded-lg p-0 data-[state=open]:bg-surface-hover data-[state=open]:text-fg`,"aria-label":p,title:p,children:[m,h]})}),t[8]=p,t[9]=m,t[10]=h,t[11]=g):g=t[11];let _;t[12]===u.refreshing?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,Q.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Q.jsx)(G,{className:`size-4`,"aria-hidden":!0})}),t[12]=u.refreshing,t[13]=_);let v;t[14]===u.label?v=t[15]:(v=(0,Q.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[14]=u.label,t[15]=v);let y;t[16]===u.detail?y=t[17]:(y=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[16]=u.detail,t[17]=y);let b;t[18]!==v||t[19]!==y?(b=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,y]}),t[18]=v,t[19]=y,t[20]=b):b=t[20];let x;t[21]!==_||t[22]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[_,b]}),t[21]=_,t[22]=b,t[23]=x):x=t[23];let S;t[24]===a?S=t[25]:(S=()=>{c(!1),a()},t[24]=a,t[25]=S);let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(M,{className:`size-3.5`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]!==i.history||t[28]!==S?(w=(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[C,i.history]}),t[27]=i.history,t[28]=S,t[29]=w):w=t[29];let T;t[30]!==r||t[31]!==d||t[32]!==o||t[33]!==f?(T=d?(0,Q.jsxs)(X,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Q.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[30]=r,t[31]=d,t[32]=o,t[33]=f,t[34]=T):T=t[34];let E;t[35]!==w||t[36]!==T?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[w,T]}),t[35]=w,t[36]=T,t[37]=E):E=t[37];let D;t[38]!==E||t[39]!==x?(D=(0,Q.jsx)(ge,{children:(0,Q.jsxs)(_e,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:Dt,children:[x,E]})}),t[38]=E,t[39]=x,t[40]=D):D=t[40];let O;return t[41]!==s||t[42]!==D||t[43]!==g?(O=(0,Q.jsxs)(ve,{open:s,onOpenChange:c,children:[g,D]}),t[41]=s,t[42]=D,t[43]=g,t[44]=O):O=t[44],O}function Dt(e){return e.preventDefault()}var Ot=(0,Z.lazy)(()=>i(()=>import(`./workspace-file-preview-dialog-BXbL5Y1h.js`).then(e=>e.n).then(e=>({default:e.WorkspaceFilePreviewPanel})),__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,71,72,73,74,75,76,77])));function kt(e){let t=(0,Ge.c)(39),{item:n,language:r,primary:i,showNew:a,onOpen:o}=e,s=a!==void 0&&a,c;t[0]===r?c=t[1]:(c=f(r),t[0]=r,t[1]=c);let l=c.projectsPage.home.workbench,u;t[2]===s?u=t[3]:(u=s?(0,Q.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,Q.jsx)(A,{className:`size-4`,"aria-hidden":!0})}):null,t[2]=s,t[3]=u);let d;t[4]===n.title?d=t[5]:(d=(0,Q.jsx)(`p`,{className:`break-words text-sm font-semibold text-fg`,children:n.title}),t[4]=n.title,t[5]=d);let p;t[6]!==l.newDelivery||t[7]!==s?(p=s?(0,Q.jsx)(`span`,{className:`mr-2 font-medium text-accent-fg`,children:l.newDelivery}):null,t[6]=l.newDelivery,t[7]=s,t[8]=p):p=t[8];let m;t[9]===n.completedAt?m=t[10]:(m=new Date(n.completedAt).toISOString(),t[9]=n.completedAt,t[10]=m);let h;t[11]!==n.completedAt||t[12]!==r?(h=Le(new Date(n.completedAt),r),t[11]=n.completedAt,t[12]=r,t[13]=h):h=t[13];let g;t[14]!==m||t[15]!==h?(g=(0,Q.jsx)(`time`,{dateTime:m,children:h}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]!==p||t[18]!==g?(_=(0,Q.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[p,g]}),t[17]=p,t[18]=g,t[19]=_):_=t[19];let v;t[20]===n.summary?v=t[21]:(v=n.summary?(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs leading-5 text-fg-muted`,children:n.summary}):null,t[20]=n.summary,t[21]=v);let y;t[22]!==v||t[23]!==d||t[24]!==_?(y=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[d,_,v]}),t[22]=v,t[23]=d,t[24]=_,t[25]=y):y=t[25];let b;t[26]!==y||t[27]!==u?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-48 items-start gap-3`,children:[u,y]}),t[26]=y,t[27]=u,t[28]=b):b=t[28];let x=i?`primary`:s?`ghost`:`secondary`,S;t[29]===s?S=t[30]:(S=s?(0,Q.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}):null,t[29]=s,t[30]=S);let C;t[31]!==l.openDelivery||t[32]!==o||t[33]!==x||t[34]!==S?(C=(0,Q.jsxs)(X,{variant:x,className:`min-h-9 shrink-0 gap-1 rounded-lg px-2.5 text-xs sm:shadow-none`,onClick:o,children:[l.openDelivery,S]}),t[31]=l.openDelivery,t[32]=o,t[33]=x,t[34]=S,t[35]=C):C=t[35];let T;return t[36]!==b||t[37]!==C?(T=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3.5`,children:[b,C]}),t[36]=b,t[37]=C,t[38]=T):T=t[38],T}function At({view:e,items:t,language:n,onSelect:r,onClose:i,onRead:a,onOpenFull:o,onRestoreFocus:s}){let c=f(n).projectsPage.home,[l,u]=(0,Z.useState)(!1),[d,m]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),S=(0,Z.useRef)(!1),C=e&&e!==`history`?e:null,{data:w,error:T,mutate:E}=ie(C?[`home-delivery`,C.id]:null,async()=>{if(!C)return;if(C.kind===`automation`){let{run:e}=await Ae.getRun(C.subjectId);return{kind:`automation`,summary:e.summary}}let e=await ce(C.subjectId),t=e.receipts.find(e=>`task:${e.runId}`===C.id);if(!t)throw Error(c.workbench.deliveryFailed);return{kind:`task`,detail:e,receipt:t}},{shouldRetryOnError:!1}),D=w?.kind===`task`||!!w?.summary?.trim();async function O(e){if(!S.current){S.current=!0,u(!0),m(!1);try{e.kind===`automation`&&!e.read&&await Ae.markRunRead(e.subjectId),a(e)}catch{m(!0)}finally{S.current=!1,u(!1)}}}return(0,Q.jsx)(y,{open:e!==null,onOpenChange:e=>{!e&&!S.current&&(m(!1),i())},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),(0,Q.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(36rem,calc(100dvh-2rem))] w-[min(42rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay outline-none`,"aria-describedby":void 0,onCloseAutoFocus:e=>{e.preventDefault(),s()},children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:C?.title??c.workbench.deliveryHistory}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:`size-9 p-0`,disabled:l,"aria-label":n===`zh`?`关闭`:`Close`,children:(0,Q.jsx)(ee,{className:`size-4`})})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:e===`history`?t.length?(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:t.map(e=>(0,Q.jsx)(kt,{item:e,language:n,onOpen:()=>{m(!1),r(e)}},e.id))}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.deliveryEmpty}):T?(0,Q.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,Q.jsx)(`p`,{children:c.workbench.deliveryFailed}),(0,Q.jsx)(X,{variant:`secondary`,onClick:()=>void E(),children:c.retry})]}):w?w.kind===`task`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(He,{content:w.receipt.summary,contentKey:w.receipt.runId,language:n}),(0,Q.jsx)(Ue,{evidence:w.receipt.evidence,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId??void 0,language:n,onOpenFile:x}),(0,Q.jsx)(y,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`fixed inset-0 z-[90] bg-scrim`}),(0,Q.jsxs)(_,{className:`fixed left-1/2 top-1/2 z-[100] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,Q.jsx)(v,{className:`sr-only`,children:b}),(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(J,{className:`m-4 min-h-24`}),children:(0,Q.jsx)(Ot,{filePath:b,projectId:w.detail.task.projectId,conversationId:w.detail.conversation.activeConversationId,onClose:()=>x(null)})})]})]})})]}):w.kind===`automation`&&w.summary?(0,Q.jsx)(I,{content:w.summary}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.workbench.noSummary}):(0,Q.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Q.jsx)(J,{className:`h-5 w-2/3`}),(0,Q.jsx)(J,{className:`h-24`})]})}),C?(0,Q.jsxs)(`footer`,{className:`shrink-0 space-y-2 border-t border-edge px-4 py-3`,children:[d?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c.workbench.readFailed}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,Q.jsx)(X,{variant:`ghost`,disabled:l,onClick:()=>o(C),children:c.workbench.openFullResult}),(0,Q.jsx)(X,{variant:`primary`,disabled:!!T||!D||l,onClick:()=>void O(C),children:c.workbench.markRead})]})]}):null]})]})})}var jt=[`attention`,`delivery`,`resume`,`background`,`observation`],Mt=[`left`,`right`,`full`],Nt=`xopc.workbench.layout`,Pt=`application/x-xopc-workbench-card`,Ft=24,It=340,Lt=304,Rt=864,zt=1/1.57,Bt=260,Vt=72,Ht=1600,Ut={order:[...jt],lanes:{},sizes:{},ratio:zt};function Wt(){try{let e=JSON.parse(localStorage.getItem(Nt)??`{}`),t=Array.isArray(e?.order)?jt.filter(t=>e.order.includes(t)).sort((t,n)=>e.order.indexOf(t)-e.order.indexOf(n)):[],n={},r={};for(let t of jt){let i=e?.lanes?.[t];Mt.includes(i)&&(n[t]=i);let{width:a,height:o}=e?.sizes?.[t]??{},s=Number.isFinite(a)&&a>=Bt,c=Number.isFinite(o)&&o>=Vt&&o<=Ht;(s||c)&&(r[t]={width:s?a:void 0,height:c?o:void 0})}let i=typeof e?.ratio==`number`&&e.ratio>0&&e.ratio<1?e.ratio:zt;return{order:[...new Set([...t,...jt])],lanes:n,sizes:r,ratio:i}}catch{return Ut}}var Gt=`w-full justify-start rounded-md px-2.5 text-sm text-fg`;function Kt(e,t,n){return Math.round(Math.min(n,Math.max(t,e)))}function qt({cards:e,editing:t,language:n}){let r=n===`zh`,[i,a]=(0,Z.useState)(Wt),[o,s]=(0,Z.useState)({width:0,heights:{}}),[c,l]=(0,Z.useState)(),[u,d]=(0,Z.useState)(),[f,p]=(0,Z.useState)(),[m,h]=(0,Z.useState)(),[g,_]=(0,Z.useState)(``),v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),b=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!f)try{localStorage.setItem(Nt,JSON.stringify(i))}catch{}},[i,f]),(0,Z.useEffect)(()=>{let e=v.current,t=e?.closest(`[data-workbench-page-scroll]`);if(!e||!t)return;let n=e=>{let n=e.target instanceof Element?e.target.closest(`[data-workbench-card-scroll]`):null;n&&xe(e,n,t,{handoffOnly:!0})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>e.removeEventListener(`wheel`,n)},[]);let x=o.width-Ft,S=Math.max(It,x-Lt),C=Math.max(It,Math.min(S,Math.round(x*i.ratio))),w=new Map(e.map(e=>[e.id,e])),T=Mt.map(e=>i.order.flatMap(t=>{let n=w.get(t);return n&&(i.lanes[t]??n.lane)===e?[n]:[]})),E=e.some(({id:e})=>i.lanes[e]===`left`||i.lanes[e]===`right`),D=o.width>=Rt,O=D&&(t||E||T[0].length>0&&T[1].length>0);(0,Z.useLayoutEffect)(()=>{let e=v.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{let t=e.clientWidth,n={};for(let t of e.children)t instanceof HTMLElement&&t.dataset.workbenchItem&&(n[t.dataset.workbenchItem]=Math.ceil(t.getBoundingClientRect().height));s(e=>e.width===t&&Object.keys(e.heights).length===Object.keys(n).length&&Object.entries(n).every(([t,n])=>e.heights[t]===n)?e:{width:t,heights:n})},n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return t(),()=>n.disconnect()},[e,t,O,C]);function k(e,t){let{lane:n,anchor:o,after:s}=t;h(i),a(t=>{let r=t.order.filter(t=>t!==e);return r.splice(o?r.indexOf(o)+ +!!s:r.length,0,e),{...t,order:r,lanes:{...t.lanes,[e]:n}}}),_(r?`已移动「${w.get(e)?.label}」`:`Moved ${w.get(e)?.label}`)}function A(){l(void 0),d(void 0)}function M(e,t){!c||e.dataTransfer.getData(Pt)!==c||t.anchor===c||(e.preventDefault(),k(c,t),A())}function N(e,t){!c||t.anchor===c||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,d(e=>e?.lane===t.lane&&e.anchor===t.anchor&&e.after===t.after?e:t))}function P(e,t,n){let r=e.currentTarget.getBoundingClientRect();return{lane:t,anchor:n,after:e.clientY>=r.top+r.height/2}}function F(e){let t=Kt(e,It,S);t!==C&&a(e=>({...e,ratio:t/x}))}function I(e){let t=y.current;t&&(y.current=null,p(void 0),e?a(t.before):i.ratio!==t.before.ratio&&h(t.before))}function L(e,t){a(n=>{let r=n.sizes[e];if(r?.width===t.width&&r?.height===t.height)return n;let i={...n.sizes,[e]:t};return t.width===void 0&&t.height===void 0&&delete i[e],{...n,sizes:i}})}function R(e){i.sizes[e.id]&&(h(i),L(e.id,{}),_(r?`「${e.label}」已恢复自动尺寸`:`${e.label} restored to automatic size`))}function z(e,t){let n=b.current;if(n)if(b.current=null,p(void 0),t)a(n.before);else{let t=n.before.sizes[e.id],a=i.sizes[e.id];(a?.width!==t?.width||a?.height!==t?.height)&&(h(n.before),_(r?`已调整「${e.label}」大小`:`Resized ${e.label}`))}}let B=r?[`左栏`,`右栏`,`全宽`]:[`Left column`,`Right column`,`Full width`],V=[0,0,0],H=new Map,U=Mt.filter((e,n)=>t&&T[n].length===0);for(let[e,t]of Mt.entries()){let n=e===1?C+Ft:0,r=e===0?C:e===1?x-C:o.width;t===`full`&&(V[2]=Math.max(V[0],V[1]));let i=T[e].map(e=>e.id);U.includes(t)&&i.push(t);for(let t of i)H.set(t,{top:V[e],left:n,width:r}),V[e]+=(o.heights[t]??0)+Ft}return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,role:`status`,children:g}),t?(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-x-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`p`,{children:r?`拖动上方手柄移动卡片,拖动右下角调整大小。`:`Drag the top handle to move a card, or its bottom-right corner to resize.`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsxs)(X,{variant:`ghost`,className:`rounded-lg text-xs`,disabled:!m,onClick:()=>{m&&(a(m),h(void 0),_(r?`已撤销布局调整`:`Layout change undone`))},children:[(0,Q.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),r?`撤销`:`Undo`]}),(0,Q.jsx)(X,{variant:`ghost`,className:`rounded-lg text-xs`,onClick:()=>{h(i),a(Ut)},children:r?`恢复默认布局`:`Reset layout`})]})]}):null,(0,Q.jsxs)(`div`,{ref:v,className:q(`relative min-w-0`,!O&&`flex flex-col gap-6`,f&&`select-none`),style:O?{height:Math.max(0,V[2]-Ft)}:void 0,children:[O?(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":r?`调整左右栏宽度`:`Resize workbench columns`,"aria-valuemin":It,"aria-valuemax":S,"aria-valuenow":C,tabIndex:0,title:r?`左右拖动调整栏宽,双击恢复默认`:`Drag to resize columns, double-click to reset`,className:`group absolute top-0 z-10 flex w-6 touch-none cursor-col-resize items-start justify-center rounded-lg pt-3 focus-visible:outline-2 focus-visible:outline-accent`,style:{left:C,height:Math.max(0,Math.max(V[0],V[1])-Ft)},onPointerDown:e=>{e.button!==0||f||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),y.current={id:e.pointerId,x:e.clientX,width:C,before:i},p(`columns`))},onPointerMove:e=>{let t=y.current;t?.id===e.pointerId&&F(t.width+e.clientX-t.x)},onPointerUp:()=>I(!1),onPointerCancel:()=>I(!0),onLostPointerCapture:()=>I(!0),onDoubleClick:()=>{h(i),a(e=>({...e,ratio:zt}))},onKeyDown:e=>{let t={ArrowLeft:C-16,ArrowRight:C+16,Home:It,End:S};Object.hasOwn(t,e.key)&&(e.preventDefault(),h(i),F(t[e.key]))},children:(0,Q.jsx)(`span`,{"aria-hidden":!0,className:q(`h-8 w-px rounded-full bg-edge-strong motion-safe:transition-colors group-hover:bg-accent`,f===`columns`&&`bg-accent`)})}):null,T.flatMap((e,n)=>e.map((a,s)=>{let m=Mt[n],g=u?.anchor===a.id,v=r?`移动「${a.label}」`:`Move ${a.label}`,y=r?`调整「${a.label}」大小`:`Resize ${a.label}`,x=H.get(a.id),S=(O?x?.width:o.width)??o.width,C=i.sizes[a.id],w=D&&C?.width!==void 0?Math.min(S,C.width):void 0,T=C?.height,E=f===a.id,F=`home-workbench-content-${a.id}`;return(0,Q.jsxs)(`div`,{"data-workbench-item":a.id,"data-workbench-lane":m,className:q(`relative min-w-0`,O&&`absolute`,c===a.id&&`opacity-50`,t&&`rounded-xl bg-surface-panel pb-3 shadow-surface ring-1 ring-inset ring-edge pointer-coarse:pb-8`,t&&`[&_[data-workbench-panel]]:border-transparent [&_[data-workbench-panel]]:bg-transparent [&_[data-workbench-panel]]:shadow-none`,E&&`ring-2 ring-accent`),style:O?{...x,width:w??x?.width}:{width:w},onDragOver:c?e=>N(e,P(e,m,a.id)):void 0,onDrop:c?e=>M(e,P(e,m,a.id)):void 0,onDragLeave:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||d(e=>e?.anchor===a.id?void 0:e)},children:[g?(0,Q.jsx)(`span`,{"aria-hidden":!0,className:q(`pointer-events-none absolute inset-x-0 z-10 h-0.5 rounded-full bg-accent`,u.after?`-bottom-2`:`-top-2`)}):null,t?(0,Q.jsx)(`div`,{className:`flex justify-start px-2 pt-1`,children:(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:`h-7 cursor-grab rounded-lg px-3 py-0 active:cursor-grabbing`,"aria-label":v,title:v,draggable:!0,onDragStart:e=>{let t=e.currentTarget.closest(`[data-workbench-item]`);if(t){let n=t.getBoundingClientRect();e.dataTransfer.setDragImage(t,e.clientX-n.left,e.clientY-n.top)}e.dataTransfer.setData(Pt,a.id),e.dataTransfer.effectAllowed=`move`,l(a.id)},onDragEnd:A,children:(0,Q.jsx)(j,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(ge,{children:(0,Q.jsxs)(_e,{align:`start`,sideOffset:4,"aria-label":v,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:s===0,onClick:()=>k(a.id,{lane:m,anchor:e[s-1]?.id}),children:r?`上移`:`Move up`})}),(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:s===e.length-1,onClick:()=>k(a.id,{lane:m,anchor:e[s+1]?.id,after:!0}),children:r?`下移`:`Move down`})}),Mt.map((e,t)=>(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:e===m,onClick:()=>k(a.id,{lane:e}),children:r?`移到${B[t]}`:`Move to ${B[t].toLowerCase()}`})},e)),(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(X,{variant:`ghost`,className:Gt,disabled:!C,onClick:()=>R(a),children:r?`恢复自动尺寸`:`Restore automatic size`})})]})})]})}):null,(0,Q.jsx)(`div`,{id:F,"data-workbench-card-scroll":T===void 0?void 0:``,className:q(`min-w-0 rounded-xl`,t&&(a.id===`delivery`||a.id===`resume`)&&`px-3`,T!==void 0&&`overflow-auto overscroll-y-auto focus-visible:outline-2 focus-visible:outline-accent [&>section]:min-h-full [&>section:has(>[data-workbench-fill])]:flex [&>section:has(>[data-workbench-fill])]:flex-col [&>section>[data-workbench-fill]]:grow`),style:{height:T},role:T===void 0?void 0:`group`,"aria-label":T===void 0?void 0:a.label,tabIndex:T===void 0?void 0:0,children:a.content}),t?(0,Q.jsxs)(Q.Fragment,{children:[E?(0,Q.jsxs)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-2 right-9 z-10 rounded-md bg-accent-soft px-2 py-1 text-xs tabular-nums text-accent-fg`,children:[D?`${w??S} × `:``,T??b.current?.height,` px`]}):null,(0,Q.jsx)(X,{variant:`segmented`,className:q(`absolute bottom-0 right-0 z-10 size-8 touch-none rounded-none rounded-br-xl p-0 active:scale-100`,`pointer-fine:[clip-path:polygon(0_75%,75%_75%,75%_0,100%_0,100%_100%,0_100%)]`,`after:pointer-events-none after:absolute after:inset-0 after:rounded-br-xl after:border-b-2 after:border-r-2 after:border-accent after:opacity-0 motion-safe:after:transition-opacity hover:after:opacity-100 focus-visible:after:opacity-100`,D?`cursor-nwse-resize`:`cursor-ns-resize`,E&&`after:opacity-100`),"aria-label":y,"aria-controls":F,title:r?`拖动或使用方向键调整大小,双击恢复自动尺寸`:`Drag or use arrow keys to resize. Double-click to restore automatic size.`,onPointerDown:e=>{if(e.button!==0||f)return;let t=document.getElementById(F)?.getBoundingClientRect();t&&(e.currentTarget.focus({preventScroll:!0}),e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),b.current={pointer:e.pointerId,x:e.clientX,y:e.clientY,width:Math.round(t.width),height:Math.round(t.height),before:i},p(a.id))},onPointerMove:e=>{let t=b.current;if(t?.pointer!==e.pointerId)return;let n=t.before.sizes[a.id],r=e.clientX-t.x,i=e.clientY-t.y;L(a.id,{width:D&&r!==0?Kt(t.width+r,Bt,S):n?.width,height:i===0?n?.height:Kt(t.height+i,Vt,Ht)})},onPointerUp:()=>z(a,!1),onPointerCancel:()=>z(a,!0),onLostPointerCapture:()=>z(a,!0),onDoubleClick:()=>R(a),onKeyDown:e=>{if(e.key===`Escape`&&E){e.preventDefault();let t=b.current?.pointer;z(a,!0),t!==void 0&&e.currentTarget.hasPointerCapture(t)&&e.currentTarget.releasePointerCapture(t);return}if(e.key===`Home`||e.key===`Enter`||e.key===` `){e.preventDefault(),R(a);return}let t=e.key===`ArrowLeft`||e.key===`ArrowRight`,n=e.key===`ArrowUp`||e.key===`ArrowDown`;if((!t||!D)&&!n)return;let o=document.getElementById(F)?.getBoundingClientRect();if(!o)return;e.preventDefault();let s=e.key===`ArrowLeft`||e.key===`ArrowUp`?-16:16;h(i),L(a.id,{width:t?Kt((w??o.width)+s,Bt,S):C?.width,height:n?Kt((T??o.height)+s,Vt,Ht):C?.height}),_(r?`已调整「${a.label}」大小`:`Resized ${a.label}`)}})]}):null]},a.id)})),U.map(e=>(0,Q.jsx)(`div`,{"data-workbench-item":e,className:q(`grid min-h-16 place-items-center rounded-xl border border-dashed border-edge-strong text-xs text-fg-muted`,O&&`absolute`,u?.lane===e&&!u.anchor&&`border-accent bg-accent-soft text-accent-fg`),style:O?H.get(e):void 0,onDragOver:t=>N(t,{lane:e}),onDrop:t=>M(t,{lane:e}),onDragLeave:()=>d(t=>t?.lane===e&&!t.anchor?void 0:t),children:B[Mt.indexOf(e)]},e))]})]})}function Jt(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var Yt=`xopc-home-read-deliveries`,Xt=`min-w-0 rounded-xl border border-edge bg-surface-panel shadow-surface`,Zt=`text-base font-semibold tracking-tight text-fg`,Qt=`@min-[54rem]/workbench:grid-cols-[minmax(0,1fr)_minmax(19rem,0.57fr)]`;function $t(){try{let e=JSON.parse(localStorage.getItem(Yt)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`).slice(0,300):[]}catch{return[]}}function en(){let e=(0,Ge.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(J,{className:`h-56 rounded-xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`grid items-start gap-6 ${Qt}`,"aria-busy":!0,children:[(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[t,(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(J,{className:`h-5 w-28 rounded-md`}),(0,Q.jsx)(J,{className:`h-24 rounded-xl`})]})]}),(0,Q.jsx)(J,{className:`h-44 rounded-xl`})]}),e[1]=n):n=e[1],n}function tn(e){let t=(0,Ge.c)(91),{item:n,busy:r,primary:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[p,m]=o(),h;t[0]===n.openAction?h=t[1]:(h=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=h);let g=h,_=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:g?decodeURIComponent(g[1]):void 0,v;t[2]!==_||t[3]!==p?(v=_&&p.get(`reviewTask`)===_,t[2]=_,t[3]=p,t[4]=v):v=t[4];let y=!!v,b;t[5]!==_||t[6]!==p||t[7]!==m?(b=e=>{let t=new URLSearchParams(p);e&&_?t.set(`reviewTask`,_):t.delete(`reviewTask`),m(t)},t[5]=_,t[6]=p,t[7]=m,t[8]=b):b=t[8];let x=b,[S,C]=(0,Z.useState)(!1),w;t[9]===c?w=t[10]:(w=f(c),t[9]=c,t[10]=w);let T=w.projectsPage.home.workbench,E=n.primaryAction?.type===`connector_decision`,D;t[11]!==a||t[12]!==n.dueAt||t[13]!==c?(D=n.dueAt===void 0?null:`${a} ${Le(n.dueAt,c)}`,t[11]=a,t[12]=n.dueAt,t[13]=c,t[14]=D):D=t[14];let O=D,k;t[15]!==E||t[16]!==n.summary?(k=E?n.summary.split(`
|
|
8
|
+
`)[0]:n.summary,t[15]=E,t[16]=n.summary,t[17]=k):k=t[17];let A;t[18]!==n.projectName||t[19]!==k?(A=[n.projectName,k].filter(Boolean),t[18]=n.projectName,t[19]=k,t[20]=A):A=t[20];let j=A.join(` · `),M=!!(_&&(n.primaryAction?.type===`task_review`||n.primaryAction?.type===`open`)),N;t[21]!==n.id||t[22]!==n.openAction||t[23]!==n.title||t[24]!==l?(N=n.openAction?(0,Q.jsx)(`button`,{type:`button`,className:`touch-target min-w-0 break-words rounded-sm text-left text-sm font-semibold text-fg hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,onClick:()=>l(n.openAction,n.id),children:n.title}):(0,Q.jsx)(`span`,{className:`break-words text-sm font-semibold text-fg`,children:n.title}),t[21]=n.id,t[22]=n.openAction,t[23]=n.title,t[24]=l,t[25]=N):N=t[25];let P;t[26]!==O||t[27]!==s||t[28]!==n.kind?(P=O||n.kind===`failure`?(0,Q.jsx)(`span`,{className:`rounded-md bg-warning-soft px-1.5 py-0.5 text-xs text-fg-muted`,children:O??s}):null,t[26]=O,t[27]=s,t[28]=n.kind,t[29]=P):P=t[29];let F;t[30]!==N||t[31]!==P?(F=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1`,children:[N,P]}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]===j?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs leading-5 text-fg-muted`,children:j}),t[33]=j,t[34]=I);let L;t[35]!==F||t[36]!==I?(L=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 basis-52`,children:[F,I]}),t[35]=F,t[36]=I,t[37]=L):L=t[37];let R;t[38]!==n.primaryAction?.type||t[39]!==c||t[40]!==y||t[41]!==_||t[42]!==x?(R=_&&n.primaryAction?.type===`retry_task`?(0,Q.jsx)(X,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,"aria-expanded":y,onClick:()=>x(!y),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[38]=n.primaryAction?.type,t[39]=c,t[40]=y,t[41]=_,t[42]=x,t[43]=R):R=t[43];let z;t[44]!==E||t[45]!==r||t[46]!==M||t[47]!==n.id||t[48]!==n.primaryAction||t[49]!==l||t[50]!==i||t[51]!==y||t[52]!==S||t[53]!==x||t[54]!==T?(z=n.primaryAction?(0,Q.jsx)(X,{type:`button`,variant:i?`primary`:`secondary`,className:`min-h-9 shrink-0 rounded-lg px-3 text-xs sm:shadow-none`,disabled:r,"aria-expanded":E?S:M?y:void 0,onClick:()=>{E?C(rn):M?x(!y):l(n.primaryAction,n.id)},children:E?T.viewScope:n.primaryAction.label}):null,t[44]=E,t[45]=r,t[46]=M,t[47]=n.id,t[48]=n.primaryAction,t[49]=l,t[50]=i,t[51]=y,t[52]=S,t[53]=x,t[54]=T,t[55]=z):z=t[55];let B;t[56]!==R||t[57]!==z?(B=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[R,z]}),t[56]=R,t[57]=z,t[58]=B):B=t[58];let V;t[59]!==L||t[60]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[L,B]}),t[59]=L,t[60]=B,t[61]=V):V=t[61];let H;t[62]!==E||t[63]!==r||t[64]!==n.id||t[65]!==n.primaryAction||t[66]!==n.secondaryActions||t[67]!==n.summary||t[68]!==l||t[69]!==S?(H=E&&S?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-fg-muted`,children:n.summary}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(X,{variant:`primary`,disabled:r,onClick:()=>l(n.primaryAction,n.id),children:n.primaryAction?.label}),n.secondaryActions.map(e=>(0,Q.jsx)(X,{disabled:r,onClick:()=>l(e,n.id),children:e.label},e.label))]})]}):null,t[62]=E,t[63]=r,t[64]=n.id,t[65]=n.primaryAction,t[66]=n.secondaryActions,t[67]=n.summary,t[68]=l,t[69]=S,t[70]=H):H=t[70];let U;t[71]!==E||t[72]!==r||t[73]!==M||t[74]!==n.id||t[75]!==n.secondaryActions||t[76]!==l?(U=!E&&!M&&n.secondaryActions.length?(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:n.secondaryActions.filter(nn).map(e=>(0,Q.jsx)(X,{variant:`ghost`,disabled:r,onClick:()=>l(e,n.id),children:e.label},e.label))}):null,t[71]=E,t[72]=r,t[73]=M,t[74]=n.id,t[75]=n.secondaryActions,t[76]=l,t[77]=U):U=t[77];let W;t[78]!==c||t[79]!==u||t[80]!==d||t[81]!==y||t[82]!==_||t[83]!==x?(W=y&&_?(0,Q.jsx)(ze,{taskId:_,language:c,onUpdated:d,onComplete:()=>{x(!1),u()}},_):null,t[78]=c,t[79]=u,t[80]=d,t[81]=y,t[82]=_,t[83]=x,t[84]=W):W=t[84];let G;return t[85]!==r||t[86]!==V||t[87]!==H||t[88]!==U||t[89]!==W?(G=(0,Q.jsxs)(`article`,{className:`px-4 py-3.5 sm:px-5 sm:py-4`,"aria-busy":r,children:[V,H,U,W]}),t[85]=r,t[86]=V,t[87]=H,t[88]=U,t[89]=W,t[90]=G):G=t[90],G}function nn(e){return e.type!==`open`}function rn(e){return!e}function an(e){let t=(0,Ge.c)(40),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]!==n.backgroundState||t[3]!==n.kind?(d=n.kind===`scheduled`?(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0}):n.backgroundState===`paused`?(0,Q.jsx)(D,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.backgroundState,t[3]=n.kind,t[4]=d):d=t[4];let f=d,p=!n.openAction,m=u?o:void 0,h;t[5]!==n.id||t[6]!==n.openAction||t[7]!==r||t[8]!==u?(h=()=>u?s(on):n.openAction&&r(n.openAction,n.id),t[5]=n.id,t[6]=n.openAction,t[7]=r,t[8]=u,t[9]=h):h=t[9];let g;t[10]===f?g=t[11]:(g=(0,Q.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:f}),t[10]=f,t[11]=g);let _;t[12]===n.title?_=t[13]:(_=(0,Q.jsx)(`span`,{className:`block line-clamp-2 break-words text-sm font-medium text-fg`,children:n.title}),t[12]=n.title,t[13]=_);let v;t[14]!==n.kind||t[15]!==n.summary||t[16]!==n.updatedAt||t[17]!==i?(v=n.kind===`scheduled`?(0,Q.jsx)(`time`,{className:`block text-xs text-fg-muted`,dateTime:new Date(n.updatedAt).toISOString(),children:Le(n.updatedAt,i)}):(0,Q.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:n.summary}),t[14]=n.kind,t[15]=n.summary,t[16]=n.updatedAt,t[17]=i,t[18]=v):v=t[18];let y;t[19]!==_||t[20]!==v?(y=(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==o||t[23]!==n.openAction?(b=n.openAction?(0,Q.jsxs)(`span`,{className:`flex max-w-[35%] shrink-0 items-center gap-1 text-right text-xs leading-4 text-fg-muted group-hover:text-fg`,children:[(0,Q.jsx)(`span`,{children:n.openAction.label}),(0,Q.jsx)(w,{className:o?`size-3.5 shrink-0 rotate-90`:`size-3.5 shrink-0`,"aria-hidden":!0})]}):null,t[22]=o,t[23]=n.openAction,t[24]=b):b=t[24];let S;t[25]!==b||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==y?(S=(0,Q.jsxs)(`button`,{type:`button`,className:`group flex min-h-12 w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left motion-safe:transition-colors enabled:hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,y,b]}),t[25]=b,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=y,t[31]=S):S=t[31];let C;t[32]!==o||t[33]!==i||t[34]!==a||t[35]!==u?(C=u&&o?(0,Q.jsx)(ze,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[32]=o,t[33]=i,t[34]=a,t[35]=u,t[36]=C):C=t[36];let T;return t[37]!==S||t[38]!==C?(T=(0,Q.jsxs)(`div`,{children:[S,C]}),t[37]=S,t[38]=C,t[39]=T):T=t[39],T}function on(e){return!e}function sn(){let e=u(e=>e.language),t=f(e),n=t.projectsPage,r=Se(e),i=c(),o=a(),l=ke(e=>e.setPageHeader),d=ke(e=>e.clearPageHeader),[x,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!1),{home:k,loading:A,loadError:j,setLoadError:M,load:P}=Ke(e,o.key,!0),I=n.home.workbench,L=(0,Z.useRef)(null),[B,H]=(0,Z.useState)(null),[W,K]=(0,Z.useState)($t),q=(0,Z.useRef)(null),[J,te]=(0,Z.useState)(!1),[Y,ne]=(0,Z.useState)(!1),[re,ie]=(0,Z.useState)(``),ce=(0,Z.useRef)(!1),[le,ue]=(0,Z.useState)(),[ge,_e]=(0,Z.useState)(!1),[ve,ye]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(!1),[we,Te]=(0,Z.useState)(),[Ae,Me]=(0,Z.useState)(!1),[Ne,ze]=(0,Z.useState)(0),[Be,Ve]=(0,Z.useState)(),[He,Ue]=(0,Z.useState)(),[We,Ge]=(0,Z.useState)(!1),$=Pe({chat:t.chat}),Je=(0,Z.useRef)(null),Ye=Oe({disabled:We,chat:t.chat,onTranscript:e=>{ie(t=>Ce(t,e)),window.setTimeout(()=>Je.current?.focus(),0)}}),{phase:Xe,voiceActive:Ze,startVoiceInput:Qe,cancelVoiceInput:$e,confirmVoiceInput:et,retryVoiceInput:nt}=Ye;(0,Z.useEffect)(()=>{if(!Be)return;let e=window.setTimeout(()=>Ve(void 0),8e3);return()=>window.clearTimeout(e)},[Be]);let rt=(0,Z.useCallback)(async e=>{if(!(e.length===0||We)){Ge(!0);try{await $.processFiles(e)}finally{Ge(!1)}}},[We,$.processFiles]),it=(0,Z.useCallback)(async e=>{let t=Ee(e.clipboardData);t.length!==0&&(e.preventDefault(),await rt(t))},[rt]),at=(0,Z.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,$.setIsDragging(!0))},[$.setIsDragging]),ot=(0,Z.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&$.setIsDragging(!1)},[$.setIsDragging]),st=(0,Z.useCallback)(async e=>{e.preventDefault(),$.setIsDragging(!1),await rt(Array.from(e.dataTransfer.files))},[$.setIsDragging,rt]),ct=(0,Z.useCallback)(e=>{e.preventDefault();let t=$.wireAttachmentsPayload(),n=t.length>0?De(t):void 0,r=je(re,n,{projectScope:`none`});r&&(ne(!1),ie(``),$.clearAttachments(),i(r))},[$.clearAttachments,$.wireAttachmentsPayload,re,i]),lt=$.attachments.length>=10,ut={attachTitle:lt?Jt(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${$.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},dt=(0,Z.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),ft=(k?.recentDeliveries??[]).map(e=>W.includes(e.id)?{...e,read:!0}:e),pt=Date.now(),mt=ft.filter(e=>!e.read&&e.completedAt>=pt-10080*6e4),ht=k?.resumable??[],gt=(k?.needsUser.length??0)+(k?.attentionPolicy?.suppressedAttentionCount??0)+(k?.attentionPolicy?.suppressedDecisionCount??0),vt=new Date(pt);vt.setHours(24,0,0,0);let yt=k?.needsUser.filter(e=>e.dueAt!==void 0&&e.dueAt>=pt&&e.dueAt<vt.getTime()).length??0,bt=k?.background??[],St=bt.filter(e=>e.kind!==`scheduled`),Ct=bt.filter(e=>e.kind===`scheduled`),wt=k?.advisor.state===`ready`||k?.advisor.state===`clarification`||!!we;(0,Z.useEffect)(()=>{if(!we)return;let e=window.setTimeout(()=>Te(void 0),8e3);return()=>window.clearTimeout(e)},[we]);let Tt=k?gt>0?`attention`:mt.length>0?`delivery`:ht.length>0||St.length>0||k.runningConversations?.length||wt?`resume`:`idle`:void 0,Dt=Tt===`idle`,Ot=Dt&&!Y,jt=Ot||Y,Mt=(0,Z.useRef)(Tt),Nt=(0,Z.useRef)(!1);(0,Z.useLayoutEffect)(()=>{let e=Mt.current;if(Mt.current=Tt,!e||!Tt||Tt===e||(Nt.current&&(Nt.current=!1,document.activeElement===document.body&&L.current?.focus({preventScroll:!0})),window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches))return;let t=L.current?.animate?.([{opacity:.7,transform:`translateY(4px)`},{opacity:1,transform:`translateY(0)`}],{duration:180,easing:`ease-out`});return()=>t?.cancel()},[Tt]),(0,Z.useEffect)(()=>{let e=e=>{(e.key===Yt||e.key===null)&&K($t())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]);let Pt=(0,Z.useCallback)(e=>{K(t=>[...new Set([e,...t])].slice(0,300));try{localStorage.setItem(Yt,JSON.stringify([...new Set([e,...$t()])].slice(0,300)))}catch{}},[]);(0,Z.useEffect)(()=>{!jt&&Ze&&$e()},[$e,jt,Ze]),(0,Z.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!jt||We||(e.preventDefault(),Xe===`recording`?et():Xe===`idle`?(Je.current?.focus(),Qe()):Xe===`error`&&nt())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!jt||!Ze||(e.preventDefault(),$e(),Je.current?.focus())};return window.addEventListener(Ie,e),window.addEventListener(Fe,t),()=>{window.removeEventListener(Ie,e),window.removeEventListener(Fe,t)}},[We,$e,jt,et,nt,Qe,Ze,Xe]);let Ft=(0,Z.useCallback)(e=>{e||$e(),ne(e)},[$e]),It=(0,Z.useCallback)((t,n)=>{if(t.type===`open`){i(F(`/`,t.href));return}if(t.type===`task_review`||ce.current)return;ce.current=!0,ye(n);let r=k?.needsUser.findIndex(e=>e.id===n)??-1,a=r<0?void 0:{item:k?.needsUser[r],slot:r};ue(void 0),M(null),(async()=>{try{if(t.type===`retry_task`)await Re(t.taskId,e),ue({...a,message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:F(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await he({kind:`connector_approval`,approvalId:t.approvalId},t.decision),ue({...a,message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await oe({kind:t.subjectKind,runId:t.runId});ue({...a,message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await fe({kind:t.subjectKind,runId:t.runId}),ue({...a,message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));Nt.current=!0,await P()}catch(e){M(e instanceof Error?e.message:String(e))}finally{ce.current=!1,ye(null)}})()},[k,e,P,i]),Lt=(0,Z.useCallback)((t,n)=>{let r=t.task.phase===`closed`&&t.task.resolution===`done`?de(t):void 0;r&&Pt(`task:${r.runId}`),Nt.current=!0;let i=n?k?.needsUser.findIndex(e=>e.id===n.id):void 0;ue({item:n,slot:i,message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:F(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),P()},[k,e,P,Pt]),Rt=(0,Z.useCallback)(()=>{xe(!0),Te(void 0),Ue(void 0),M(null),pe(e).then(()=>P()).catch(e=>M(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[e,P]),zt=(0,Z.useCallback)((e,t)=>{xe(!0),M(null),se(e,t).then(async t=>{if(t.outcome===`needs_setup`){Ue({opportunityId:e.id,value:t.preflight});return}if(Ue(void 0),ze(e=>e+1),t.outcome===`task`){Te({title:n.home.advisorStartedTitle,detail:Jt(n.home.advisorStartedDetail,{title:e.title}),href:F(`/`,t.href)}),await P();return}i(t.href)}).catch(e=>M(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[P,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),Bt=(0,Z.useCallback)((e,t)=>{xe(!0),Te(void 0),Ue(void 0),M(null),ae(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(Ve({opportunityId:e.id,idempotencyKey:t}),ze(e=>e+1),P())).catch(e=>M(e instanceof Error?e.message:String(e))).finally(()=>xe(!1))},[P]),Vt=(0,Z.useCallback)(()=>{if(!Be)return;let e=Be;Ve(void 0),xe(!0),M(null),me(e.opportunityId,e.idempotencyKey).then(()=>(ze(e=>e+1),P())).catch(t=>{Ve(e),M(t instanceof Error?t.message:String(t))}).finally(()=>xe(!1))},[Be,P]),Ht=(0,Z.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),Ut=e=>{q.current=document.activeElement instanceof HTMLElement?document.activeElement:null,H(e)},Wt=e=>{Pt(e.id),H(null),ue({message:I.deliverySaved}),P()},Gt=x?k?.needsUser??[]:k?.needsUser.slice(0,2)??[],Kt=gt-Gt.length,Qt=le?.item&&!k?.needsUser.some(e=>e.id===le.item?.id)&&(le.slot??1/0)<2?le.item:void 0,nn=[...Gt];Qt&&nn.splice(le?.slot??0,0,Qt);let rn=(k?.runningConversations??[]).map(t=>({id:t.runId,kind:`running`,title:t.title??(e===`zh`?`对话正在执行`:`Conversation in progress`),summary:I.inProgress,updatedAt:t.updatedAt,secondaryActions:[],openAction:{type:`open`,label:I.inProgress,href:`/chat/${encodeURIComponent(t.conversationId)}`}})),on=[...St,...rn].sort((e,t)=>t.updatedAt-e.updatedAt),sn=Tt===`attention`&&!we&&!J,cn=k?.advisor.state===`ready`?k.advisor.primary.title:k?.advisor.state===`clarification`?k.advisor.question.question:void 0,ln=mt.length>0?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`home-delivery-title`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center justify-between gap-x-3 pl-1`,children:[(0,Q.jsx)(`h2`,{id:`home-delivery-title`,className:Zt,children:I.progress}),(0,Q.jsxs)(X,{variant:`ghost`,className:`rounded-lg px-2 text-xs`,onClick:()=>Ut(`history`),children:[I.deliveryHistory,(0,Q.jsx)(b,{className:`size-3.5`,"aria-hidden":!0})]})]}),(0,Q.jsx)(`div`,{className:`${Xt} divide-y divide-edge-subtle`,"data-workbench-fill":!0,"data-workbench-panel":!0,children:mt.slice(0,Tt===`attention`?1:3).map((t,n)=>(0,Q.jsx)(kt,{item:t,language:e,showNew:!0,primary:Tt===`delivery`&&n===0,onOpen:()=>Ut(t)},t.id))})]}):null,un=[{title:I.inProgress,items:on.filter(e=>!e.backgroundState&&!e.statusLabel)},{title:I.waiting,items:on.filter(e=>e.backgroundState===`waiting`||!e.backgroundState&&e.statusLabel)},{title:I.paused,items:on.filter(e=>e.backgroundState===`paused`)},{title:I.scheduled,items:Ct}].filter(e=>e.items.length>0),dn=Tt===`attention`?1:3,fn=un.length?(0,Q.jsxs)(`section`,{className:Xt,"aria-labelledby":`home-background-title`,"data-workbench-panel":!0,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 px-4 pb-1 pt-4`,children:[(0,Q.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(`h2`,{id:`home-background-title`,className:Zt,children:I.background})]}),(0,Q.jsxs)(`div`,{className:`px-3 pb-3`,children:[un.map(({title:t,items:n})=>(0,Q.jsxs)(`div`,{className:`pt-3`,children:[(0,Q.jsx)(`h3`,{className:`mb-1 px-2 text-xs font-medium text-fg-muted`,children:t}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:(ge?n:n.slice(0,dn)).map(t=>(0,Q.jsx)(an,{item:t,language:e,onAction:It,onUpdated:Lt},t.id))})]},t)),un.some(({items:e})=>e.length>dn)?(0,Q.jsxs)(X,{variant:`ghost`,className:`mt-2 w-full justify-start rounded-lg px-2 text-xs`,"aria-expanded":ge,onClick:()=>_e(e=>!e),children:[(0,Q.jsx)(C,{className:ge?`size-3.5 rotate-180`:`size-3.5`,"aria-hidden":!0}),e===`zh`?ge?`收起`:`查看全部 ${on.length+Ct.length} 项`:ge?`Show less`:`View all ${on.length+Ct.length} items`]}):null]})]}):null,pn=!k?.observation&&wt,mn=gt>0?(0,Q.jsxs)(`section`,{className:Xt,"aria-labelledby":`home-needs-user-title`,"data-workbench-panel":!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-2 border-b border-edge-subtle px-4 py-4 sm:px-5`,children:[(0,Q.jsx)(`span`,{className:`mr-0.5 grid size-9 shrink-0 place-items-center rounded-lg bg-warning-soft text-fg`,children:(0,Q.jsx)(T,{className:`size-[18px]`,"aria-hidden":!0})}),(0,Q.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-lg font-semibold tracking-tight text-fg sm:text-xl`,children:I.attention}),(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,"aria-live":`polite`,"aria-label":Jt(n.home.attentionTitle,{count:gt}),children:gt}),yt>0?(0,Q.jsx)(`span`,{className:`ml-auto rounded-md bg-warning-soft px-2 py-1 text-xs text-fg-muted`,children:Jt(I.dueToday,{count:yt})}):null]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge-subtle`,children:[nn.map((t,i)=>t===Qt?(0,Q.jsxs)(`div`,{className:`flex min-h-16 items-center justify-between gap-3 px-4 py-3 text-sm text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:t.title}),(0,Q.jsx)(S,{className:`size-4 shrink-0 text-success`,"aria-label":e===`zh`?`已处理`:`Handled`})]},t.id):(0,Q.jsx)(tn,{item:t,primary:i===0||i===1&&nn[0]===Qt,busy:ve!==null,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:It,onComplete:()=>void P(),onUpdated:e=>Lt(e,t)},t.id)),x||Kt>0?(0,Q.jsx)(`div`,{className:`px-2 py-1.5 sm:px-3`,children:(0,Q.jsxs)(X,{variant:`ghost`,className:`w-full justify-start rounded-lg px-2 text-xs`,"aria-expanded":x,onClick:()=>E(e=>!e),children:[(0,Q.jsx)(C,{className:x?`size-3.5 rotate-180`:`size-3.5`,"aria-hidden":!0}),x?I.collapse:Jt(I.remaining,{count:Kt})]})}):null]})]}):null,hn=k&&(ht.length>0||pn)?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`home-resume-title`,children:[(0,Q.jsx)(`h2`,{id:`home-resume-title`,className:`flex min-h-9 items-center pl-1 ${Zt}`,children:I.resume}),ht.length>0?(0,Q.jsx)(`div`,{className:`${Xt} divide-y divide-edge-subtle p-2`,"data-workbench-fill":!0,"data-workbench-panel":!0,children:ht.slice(0,Tt===`attention`?1:3).map(t=>(0,Q.jsxs)(s,{className:`group flex w-full flex-wrap items-center gap-x-3 gap-y-2 rounded-lg p-2 text-left motion-safe:transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent`,to:F(`/`,t.href),children:[(0,Q.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-inset text-fg-muted`,children:t.kind===`task`?(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(R,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block break-words text-sm font-semibold text-fg`,children:t.title}),(0,Q.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:[t.projectName,t.summary||Jt(I.lastActive,{time:Le(t.updatedAt,e)})].filter(Boolean).join(` · `)})]}),(0,Q.jsxs)(`span`,{className:`flex max-w-[35%] shrink-0 items-center gap-1 text-right text-xs leading-4 text-fg-muted group-hover:text-fg`,children:[t.kind===`task`?I.continueTask:I.continueChat,(0,Q.jsx)(w,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]})]},`${t.kind}:${t.id}`))}):null,!k.observation&&cn&&Tt===`attention`&&!we?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg bg-surface-inset px-3 py-1`,children:[(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(G,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[n.home.advisorStatusLabel,` · `,cn]})]}),(0,Q.jsx)(X,{variant:`ghost`,"aria-expanded":J,onClick:()=>te(e=>!e),children:J?I.hideSuggestion:I.viewSuggestion})]}):null,!k.observation&&wt&&!sn?(0,Q.jsx)(tt,{advisor:k.advisor,busy:be,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,more:I.moreSuggestionActions,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:Rt,onAction:zt,onFeedback:Bt,onClarification:Ht,onOpenHistory:()=>Me(!0),preflight:He,receipt:we}):null]}):null,gn=[{id:`attention`,label:I.attention,lane:`left`,content:mn},{id:`delivery`,label:I.progress,lane:`left`,content:ln},{id:`resume`,label:I.resume,lane:`left`,content:hn},{id:`background`,label:I.background,lane:`right`,content:fn},{id:`observation`,label:e===`zh`?`交给我`:`Let me handle it`,lane:`right`,content:k?.observation?(0,Q.jsx)(_t,{observation:k.observation,advisor:k.advisor,language:e,emphasizeStart:Tt!==`attention`&&Tt!==`delivery`,onUpdated:()=>void P()}):null}].filter(e=>e.content),_n=gn.length>0,vn=e===`zh`?`布局`:`Layout`,yn=e===`zh`?`完成布局`:`Done`,bn=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[k&&!Dt?(0,Q.jsx)(Et,{advisor:k.advisor,busy:be,copy:dt,onOpenHistory:()=>Me(!0),onRefresh:Rt}):null,_n?(0,Q.jsxs)(X,{type:`button`,variant:`ghost`,className:D?`h-9 w-9 gap-1.5 rounded-lg bg-accent-soft p-0 text-accent-fg sm:w-auto sm:px-2.5`:`size-9 rounded-lg p-0`,"aria-label":D?yn:vn,title:D?yn:vn,onClick:()=>O(e=>!e),children:[D?(0,Q.jsx)(S,{className:`size-4 shrink-0`,"aria-hidden":!0}):(0,Q.jsx)(z,{className:`size-4`,"aria-hidden":!0}),D?(0,Q.jsx)(`span`,{className:`hidden whitespace-nowrap sm:inline`,children:yn}):null]}):null,Dt?null:(0,Q.jsxs)(X,{type:`button`,variant:`primary`,className:`ml-1 h-9 gap-1.5 whitespace-nowrap rounded-lg px-2.5 sm:shadow-none`,onClick:()=>ne(!0),children:[(0,Q.jsx)(V,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.newWork]})]}),[be,dt,_n,r.newWork,yn,D,k,Dt,vn,Rt]);return(0,Z.useLayoutEffect)(()=>(l({startExtra:null,main:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:bn}),()=>d()),[d,bn,l,n.title]),(0,Q.jsxs)(`div`,{className:`@container/workbench mx-auto flex w-full min-w-0 max-w-7xl flex-1 flex-col px-4 pb-8 pt-5 sm:px-6 sm:pt-7 lg:px-8`,children:[(0,Q.jsx)(`input`,{ref:$.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&rt(Array.from(t)),e.target.value=``}}),(0,Q.jsx)(y,{open:Y,onOpenChange:Ft,children:(0,Q.jsxs)(g,{children:[(0,Q.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(v,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,Q.jsx)(m,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Q.jsx)(qe,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Je,intent:re,labels:{...ut,submit:r.submit},attachments:$.attachments,isDragging:$.isDragging,attachmentBusy:We,attachmentsFull:lt,voice:Ye,chat:t.chat,cancelAction:(0,Q.jsx)(h,{asChild:!0,children:(0,Q.jsx)(X,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:ie,onPickFiles:()=>$.fileInputRef.current?.click(),onRemoveAttachment:$.removeAttachment,onPaste:e=>void it(e),onDragOver:at,onDragLeave:ot,onDrop:e=>void st(e),onSubmit:ct})]})]})}),(0,Q.jsx)(xt,{open:Ae,refreshKey:Ne,onOpenChange:Me,onReevaluate:Rt}),j?(0,Q.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:j}),(0,Q.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void P(),children:n.home.retry})]}):null,(0,Q.jsx)(At,{view:B,items:ft,language:e,onSelect:H,onClose:()=>H(null),onRead:Wt,onOpenFull:e=>{H(null),i(F(`/`,e.href))},onRestoreFocus:()=>{(q.current?.isConnected?q.current:L.current)?.focus({preventScroll:!0})}}),(0,Q.jsx)(`div`,{role:`status`,children:le?(0,Q.jsxs)(`div`,{className:`mb-3 flex w-full flex-wrap items-center justify-between gap-2 rounded-lg bg-success-soft px-3 py-1.5 text-xs text-fg`,children:[(0,Q.jsx)(`span`,{children:le.message}),le.href?(0,Q.jsx)(X,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>i(le.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null}),A?(0,Q.jsx)(en,{}):k?(0,Q.jsxs)(`div`,{ref:L,tabIndex:-1,className:`flex min-h-0 w-full flex-1 flex-col gap-4 outline-none`,children:[gt===0?(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,"aria-live":`polite`,children:I.noAttention}):null,Ot?(0,Q.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[640px] flex-1 flex-col justify-center pb-12 pt-10 text-center sm:pb-20 sm:pt-16`,children:[(0,Q.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:I.startTitle}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:I.startHint}),(0,Q.jsx)(qe,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Je,intent:re,labels:{...ut,intentPlaceholder:I.startExample},attachments:$.attachments,isDragging:$.isDragging,attachmentBusy:We,attachmentsFull:lt,voice:Ye,chat:t.chat,onIntentChange:ie,onPickFiles:()=>$.fileInputRef.current?.click(),onRemoveAttachment:$.removeAttachment,onPaste:e=>void it(e),onDragOver:at,onDragLeave:ot,onDrop:e=>void st(e),onSubmit:ct}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:[(0,Q.jsxs)(X,{variant:`ghost`,onClick:()=>window.dispatchEvent(new Event(`open-command-palette`)),children:[(0,Q.jsx)(U,{className:`size-4`,"aria-hidden":!0}),I.findWork]}),(0,Q.jsx)(X,{variant:`ghost`,onClick:()=>Ut(`history`),children:I.deliveryHistory})]})]}):null,(0,Q.jsx)(qt,{cards:gn,editing:D,language:e}),!Dt&&!ln&&ft.length>0?(0,Q.jsx)(X,{variant:`ghost`,className:`self-start px-2 text-xs`,onClick:()=>Ut(`history`),children:I.deliveryHistory}):null]}):null,Be?(0,Q.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Q.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,Q.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Vt,children:n.home.advisorUndo})]}):null]})}export{sn as HomePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-tI9VX7dp.js";import{t as a}from"./x-B_N4OPjy.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{n as s}from"./model-selector-B4oTiJI6.js";var c=t();e();var l=n();function u(e){let t=(0,c.c)(30),{primary:n,value:r,models:i,loading:u,error:d,zh:f,onChange:p}=e,m;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],m=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=m}else m=t[3];let h=m,g=f?`回退顺序`:`Fallback order`,_;t[7]===g?_=t[8]:(_=(0,l.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:g}),t[7]=g,t[8]=_);let v=f?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,y;t[9]===v?y=t[10]:(y=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:v}),t[9]=v,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,l.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,l.jsxs)(`div`,{children:[_,y]})}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==i||t[15]!==p||t[16]!==r||t[17]!==f?(x=r.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,l.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,l.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,l.jsx)(`button`,{type:`button`,"aria-label":f?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(r.filter(t=>t!==e)),children:(0,l.jsx)(a,{className:`size-3`})})]},e))}):(0,l.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:f?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=p,t[16]=r,t[17]=f,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==d||t[21]!==u||t[22]!==p||t[23]!==r||t[24]!==f?(S=u?(0,l.jsx)(o,{className:`mt-3 h-11 w-full max-w-md rounded-lg`}):(0,l.jsx)(s,{value:``,models:h,modelsLoading:u,modelsError:d,placeholder:f?`添加回退模型`:`Add fallback model`,searchPlaceholder:f?`搜索模型或服务商`:`Search models or providers`,noMatches:f?`没有可添加的模型`:`No models available to add`,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:f?`添加回退模型`:`Add fallback model`,onChange:e=>{e&&p([...r,e])}}),t[19]=h,t[20]=d,t[21]=u,t[22]=p,t[23]=r,t[24]=f,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,l.jsxs)(`div`,{children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}async function d(){let e=await i(r(`/api/image-generation/catalog`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid image provider catalog`);return e.payload.providers}async function f(){let e=await i(r(`/api/image-generation/custom-providers`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid custom image provider list`);return e.payload.providers}async function p(e,t){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`PUT`,body:JSON.stringify(t)})}async function m(e){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`DELETE`})}async function h(e,t){await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:t})})}async function g(e,t){let n=await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/test`),{method:`POST`,body:JSON.stringify({modelId:t})});if(!Array.isArray(n.payload?.images))throw Error(`Invalid image generation test response`);return{images:n.payload.images}}export{h as a,p as i,f as n,g as o,d as r,u as s,m as t};
|
package/dist/gateway/static/root/assets/{imports-page-CBlaxUhl.js → imports-page-Dx5T5pqw.js}
RENAMED
|
@@ -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-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-Dy1EByeG.js";import{t as c}from"./messages-BAnhwALN.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./braces-Cfmtagno.js";import{t as _}from"./check-DUBLcKHA.js";import{t as v}from"./chevron-down-ccbiQQz_.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./folder-kanban-CpLlFI1o.js";import{t as x}from"./package-wATCyihJ.js";import{t as S}from"./plug-DKYPEgkR.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./settings-2-D-csvaET.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./cn-0WouolD0.js";import{t as D}from"./button-Cc4hUNTt.js";import{i as O,o as k}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as A}from"./settings-loading-skeleton-CAoOV17i.js";import{n as j,t as M}from"./settings-page-header-DEZZ8D0S.js";import"./settings-page-layout-De2j64Lo.js";var N=e(t(),1);async function P(e,t,n){return(await s(a(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:s,busy:_,locked:v,error:y,onClose:S,onRefresh:C,onSubmit:j}=e,M=c(o(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],K;t[3]===i?.candidates?K=t[4]:(K=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=K);let q=K,he;t[5]===i?.candidates?he=t[6]:(he=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=he);let ge=he,J;if(t[7]!==i?.candidates){J=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=J.get(e.parentId)??[];t.push(e),J.set(e.parentId,t)}t[7]=i?.candidates,t[8]=J}else J=t[8];let ve=J,ye=i?.candidates.filter(e=>a.has(e.id))??[],be=M.selected.replace(`{skills}`,String(ye.filter(oe).length)).replace(`{context}`,String(ye.filter(ae).length)).replace(`{projects}`,String(ye.filter(ie).length)),xe;t[9]!==i||t[10]!==s||t[11]!==a?(xe=(e,t)=>{i&&s(z(i,a,e,t))},t[9]=i,t[10]=s,t[11]=a,t[12]=xe):xe=t[12];let Se=xe,Ce;t[13]!==i||t[14]!==s||t[15]!==a?(Ce=(e,t)=>{i&&s(R(i,a,e,t))},t[13]=i,t[14]=s,t[15]=a,t[16]=Ce):Ce=t[16];let we=Ce,Y;t[17]===S?Y=t[18]:(Y=e=>{e||S()},t[17]=S,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${k}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=E(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,O),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(T,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=y&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:y}),(0,B.jsx)(D,{variant:`secondary`,disabled:v,onClick:C,children:M.refresh})]}),$;t[22]!==y||t[23]!==i?($=!i&&!y&&(0,B.jsx)(A,{sections:2}),t[22]=y,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:M.incomplete}),G.length>0&&(0,B.jsxs)(pe,{icon:w,title:M.personalSetup,description:M.personalSetupHint,items:G,selected:a,open:P,disabled:v,onOpenChange:I,onCheckedChange:e=>we(G,e),children:[(0,B.jsx)(me,{icon:x,title:M.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:v,onToggle:Se,onToggleAll:e=>we(G.filter(ne),e)}),(0,B.jsx)(me,{icon:g,title:M.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:v,onToggle:Se,onToggleAll:e=>we(G.filter(ee),e)})]}),q.length>0&&(0,B.jsx)(pe,{icon:b,title:M.kinds.project,description:M.projectsHint.replace(`{count}`,String(q.length)),items:q,selected:a,open:L,disabled:v,onOpenChange:V,children:(0,B.jsx)(_e,{inventoryId:i.id,projects:q,projectChildren:ve,selected:a,disabled:v,onToggle:Se})}),ge.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:ge}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:M.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[M.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=D,ke=!i||!a.size||_,Ae=_?M.importing:v?M.retry:M.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==j||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:j,children:Ae}),t[29]=Oe,t[30]=j,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(h,{open:n,onOpenChange:Y,children:(0,B.jsxs)(f,{children:[X,(0,B.jsxs)(p,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(m,{className:`text-xl font-semibold text-fg`,children:M.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M.chooseHint})]}),(0,B.jsx)(d,{asChild:!0,children:(0,B.jsx)(D,{variant:`ghost`,"aria-label":M.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:be}),_&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.runningHint}),v&&!_&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(D,{variant:`ghost`,onClick:S,children:_?M.close:M.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=c(o(fe)).imports,[s,l]=(0,N.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>l(U),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(S,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=d):d=t[1];let f=a.connectionsHint.replace(`{count}`,String(r.length)),p;t[2]===f?p=t[3]:(p=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:f}),t[2]=f,t[3]=p);let m=s&&`rotate-180`,h;t[4]===m?h=t[5]:(h=E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,m),t[4]=m,t[5]=h);let g;t[6]===h?g=t[7]:(g=(0,B.jsx)(v,{"aria-hidden":`true`,className:h}),t[6]=h,t[7]=g);let _;return t[8]!==n||t[9]!==r||t[10]!==s||t[11]!==a?(_=s&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(D,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=s,t[11]=a,t[12]=_):_=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:u,children:[d,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),p]}),g]})}),_]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=o(K),a;t[0]===i?a=t[1]:(a=c(i),t[0]=i,t[1]=a);let s=a.imports,[l,u]=(0,N.useState)(),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==l?(h=async function(){if(f(G),!l)try{u(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=l,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=s.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x;t[12]!==_||t[13]!==v||t[14]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=x):x=t[15];let S;t[16]===g?S=t[17]:(S=()=>void g(),t[16]=g,t[17]=S);let C;t[18]!==s.preview||t[19]!==S?(C=(0,B.jsx)(D,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:S,children:s.preview}),t[18]=s.preview,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==x?(w=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,C]}),t[21]=C,t[22]=x,t[23]=w):w=t[23];let T;t[24]===r.reason?T=t[25]:(T=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=T);let E;t[26]!==p||t[27]!==d||t[28]!==l?(E=d&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:p?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:p}):l?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:l.text}):(0,B.jsx)(A,{sections:1})}),t[26]=p,t[27]=d,t[28]=l,t[29]=E):E=t[29];let O;return t[30]!==w||t[31]!==T||t[32]!==E?(O=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[w,T,E]}),t[30]=w,t[31]=T,t[32]=E,t[33]=O):O=t[33],O}function G(e){return!e}function K(e){return e.language}function pe(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:l,onCheckedChange:u,children:d}=e,f;t[0]!==a||t[1]!==u||t[2]!==o?(f=u?L(a,o):void 0,t[0]=a,t[1]=u,t[2]=o,t[3]=f):f=t[3];let p=f,m;t[4]!==l||t[5]!==s?(m=()=>l(!s),t[4]=l,t[5]=s,t[6]=m):m=t[6];let h;t[7]===n?h=t[8]:(h=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[7]=n,t[8]=h);let g;t[9]===r?g=t[10]:(g=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[9]=r,t[10]=g);let _;t[11]===i?_=t[12]:(_=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[11]=i,t[12]=_);let y;t[13]!==g||t[14]!==_?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[g,_]}),t[13]=g,t[14]=_,t[15]=y):y=t[15];let b=s&&`rotate-180`,x;t[16]===b?x=t[17]:(x=E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[16]=b,t[17]=x);let S;t[18]===x?S=t[19]:(S=(0,B.jsx)(v,{"aria-hidden":`true`,className:x}),t[18]=x,t[19]=S);let C;t[20]!==s||t[21]!==m||t[22]!==h||t[23]!==y||t[24]!==S?(C=(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:m,children:[h,y,S]}),t[20]=s,t[21]=m,t[22]=h,t[23]=y,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==c||t[27]!==u||t[28]!==p||t[29]!==r?(w=p&&u&&(0,B.jsx)(X,{label:r,checked:p.checked,indeterminate:p.indeterminate,disabled:c||!p.availableCount,onChange:u}),t[26]=c,t[27]=u,t[28]=p,t[29]=r,t[30]=w):w=t[30];let T;t[31]!==C||t[32]!==w?(T=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[C,w]}),t[31]=C,t[32]=w,t[33]=T):T=t[33];let O;t[34]!==d||t[35]!==s?(O=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:d}),t[34]=d,t[35]=s,t[36]=O):O=t[36];let k;return t[37]!==T||t[38]!==O?(k=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[T,O]}),t[37]=T,t[38]=O,t[39]=k):k=t[39],k}function me(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:s,disabled:l,onToggle:u,onToggleAll:d}=e,f=c(o(ge)).imports,[p,m]=(0,N.useState)(!1),[h,g]=(0,N.useState)(``),[_,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==s?(b=L(i,s),t[0]=i,t[1]=s,t[2]=b):b=t[2];let x=b,S=Y(i,h),C=S.slice(0,_),w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>m(he),t[3]=w):w=t[3];let T;t[4]===n?T=t[5]:(T=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=T);let O;t[6]!==i.length||t[7]!==r?(O=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=O):O=t[8];let k;t[9]!==x.availableCount||t[10]!==x.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[x.selectedCount,`/`,x.availableCount]}),t[9]=x.availableCount,t[10]=x.selectedCount,t[11]=k):k=t[11];let A=p&&`rotate-180`,j;t[12]===A?j=t[13]:(j=E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(v,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==p||t[17]!==T||t[18]!==O||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":p,onClick:w,children:[T,O,k,M]}),t[16]=p,t[17]=T,t[18]=O,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=l||!x.availableCount,R;t[22]!==d||t[23]!==x.checked||t[24]!==x.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:x.checked,indeterminate:x.indeterminate,disabled:I,onChange:d}),t[22]=d,t[23]=x.checked,t[24]=x.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=p&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(we,{value:h,label:f.searchWithin.replace(`{group}`,r),onChange:e=>{g(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:C.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:s.has(e.id),disabled:l,onChange:t=>u(e,t)},e.id))}),!S.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:f.noMatches}),C.length<S.length&&(0,B.jsx)(D,{variant:`ghost`,className:`w-full`,onClick:()=>y(q),children:f.showMore.replace(`{count}`,String(S.length-C.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function q(e){return e+60}function he(e){return!e}function ge(e){return e.language}function _e(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:s,onToggle:l}=e,u=c(o(ve)).imports,[d,f]=(0,N.useState)(``),[p,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,d,h),_=g.slice(0,p),v=r.length>8&&(0,B.jsx)(we,{value:d,label:u.searchWithin.replace(`{group}`,u.kinds.project),onChange:e=>{f(e),m(60)}}),y;t[2]!==s||t[3]!==n||t[4]!==l||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(ye,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:s,onToggle:l},e.id),t[2]=s,t[3]=n,t[4]=l,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),x;t[8]===b?x=t[9]:(x=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=x);let S=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:u.noMatches}),C=_.length<g.length&&(0,B.jsx)(D,{variant:`ghost`,className:`w-full`,onClick:()=>m(J),children:u.showMore.replace(`{count}`,String(g.length-_.length))}),w;return t[10]!==v||t[11]!==x||t[12]!==S||t[13]!==C?(w=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,x,S,C]}),t[10]=v,t[11]=x,t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function J(e){return e+60}function ve(e){return e.language}function ye(e){let t=(0,F.c)(39),{inventoryId:n,project:r,children:i,selected:a,disabled:s,onToggle:l}=e,u=c(o(Ce)).imports,[d,f]=(0,N.useState)(!1),p;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),p=i.filter(e),t[0]=i,t[1]=a,t[2]=p}else p=t[2];let m=p.length,h;t[5]===r.name?h=t[6]:(h=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[5]=r.name,t[6]=h);let g;t[7]===r.displayPath?g=t[8]:(g=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[7]=r.displayPath,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let y=_,b=i.length>0?(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":d,onClick:()=>f(Se),children:[y,(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[u.projectContents.replace(`{skills}`,String(i.filter(xe).length)).replace(`{context}`,String(i.filter(be).length)),` · `,u.chosenCount.replace(`{count}`,String(m))]}),(0,B.jsx)(v,{"aria-hidden":`true`,className:E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,d&&`rotate-180`)})]}):(0,B.jsx)(`div`,{className:`min-w-0 flex-1 px-2`,children:y}),x=r.name,S;t[12]!==r.id||t[13]!==a?(S=a.has(r.id),t[12]=r.id,t[13]=a,t[14]=S):S=t[14];let C;t[15]!==s||t[16]!==r?(C=s||!I(r),t[15]=s,t[16]=r,t[17]=C):C=t[17];let w;t[18]!==l||t[19]!==r?(w=e=>l(r,e.target.checked),t[18]=l,t[19]=r,t[20]=w):w=t[20];let T;t[21]!==r.name||t[22]!==C||t[23]!==w||t[24]!==S?(T=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":x,checked:S,disabled:C,onChange:w}),t[21]=r.name,t[22]=C,t[23]=w,t[24]=S,t[25]=T):T=t[25];let O;t[26]!==T||t[27]!==b?(O=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[b,T]}),t[26]=T,t[27]=b,t[28]=O):O=t[28];let k;t[29]!==i||t[30]!==s||t[31]!==n||t[32]!==l||t[33]!==d||t[34]!==a?(k=d&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:s,onChange:t=>l(e,t)},e.id))})}),t[29]=i,t[30]=s,t[31]=n,t[32]=l,t[33]=d,t[34]=a,t[35]=k):k=t[35];let A;return t[36]!==O||t[37]!==k?(A=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38],A}function be(e){return e.kind===`context`}function xe(e){return e.kind===`skill`}function Se(e){return!e}function Ce(e){return e.language}function we(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(C,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let s=`${r}…`,c;t[3]===i?c=t[4]:(c=e=>i(e.target.value),t[3]=i,t[4]=c);let l;t[5]!==r||t[6]!==s||t[7]!==c||t[8]!==n?(l=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:s,"aria-label":r,onChange:c,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=s,t[7]=c,t[8]=n,t[9]=l):l=t[9];let u;return t[10]!==o||t[11]!==l?(u=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,l]}),t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:s}=e,l=o(Te),u;t[0]===l?u=t[1]:(u=c(l),t[0]=l,t[1]=u);let d=u.imports,[f,p]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==f?(v=async function(){if(_(Q),!f)try{p(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=f,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let x;t[9]===s?x=t[10]:(x=e=>s(e.target.checked),t[9]=s,t[10]=x);let S;t[11]!==i||t[12]!==b||t[13]!==x?(S=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:x}),t[11]=i,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]===r.name?C=t[16]:(C=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=C);let w;t[17]===r.displayPath?w=t[18]:(w=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=w);let T;t[19]!==C||t[20]!==w?(T=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[C,w]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==S||t[23]!==T?(E=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[S,T]}),t[22]=S,t[23]=T,t[24]=E):E=t[24];let O;t[25]!==r.name||t[26]!==r.status||t[27]!==d||t[28]!==y?(O=r.status!==`blocked`&&(0,B.jsx)(D,{variant:`ghost`,"aria-label":`${d.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:d.preview}),t[25]=r.name,t[26]=r.status,t[27]=d,t[28]=y,t[29]=O):O=t[29];let k;t[30]!==E||t[31]!==O?(k=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[E,O]}),t[30]=E,t[31]=O,t[32]=k):k=t[32];let j;t[33]===r.description?j=t[34]:(j=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=j);let M;t[35]!==r.status||t[36]!==r.targetName||t[37]!==d?(M=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[d.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=d,t[38]=M):M=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==f||t[42]!==m||t[43]!==g||t[44]!==d?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:f.text}),f.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:d.previewTruncated})]}):(0,B.jsx)(A,{sections:1})}),t[41]=f,t[42]=m,t[43]=g,t[44]=d,t[45]=R):R=t[45];let z;return t[46]!==k||t[47]!==j||t[48]!==M||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[k,j,M,L,R]}),t[46]=k,t[47]=j,t[48]=M,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=c(o(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,i]=(0,N.useState)(),[a,s]=(0,N.useState)(!1),[l,u]=(0,N.useState)(),[d,f]=(0,N.useState)(new Set),[p,m]=(0,N.useState)(!1),[h,g]=(0,N.useState)(),[v,b]=(0,N.useState)(),[x,S]=(0,N.useState)(``),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(0),O=(0,N.useRef)(null),k=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return S(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||S(t instanceof Error?t.message:String(t))}),()=>{e.abort(),O.current?.abort()}},[T]);let F=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!F)return;let e=new AbortController,t,n=async()=>{for(let t of F.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||I(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[F]);function I(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&g(t=>t?.requestId===e.id?void 0:t)}async function L(e){O.current?.abort();let t=new AbortController;O.current=t,i(e),s(!0),u(void 0),f(new Set),w(``),b(void 0),g(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(u(n),f(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||w(e instanceof Error?e.message:String(e))}}async function R(){if(!l||!d.size||k.current)return;k.current=!0,m(!0),w(``),S(``);let e=h??{inventoryId:l.id,candidateIds:[...d],requestId:crypto.randomUUID(),retryOf:v};g(e);try{I(await P(`/runs`,e)),s(!1)}catch(e){let t=e instanceof Error?e.message:String(e);w(t),S(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&g(void 0)}finally{k.current=!1,m(!1)}}async function z(e){i(e.source),s(!0),u(void 0),f(new Set),w(``),g(void 0),b(e.id),O.current?.abort();let t=new AbortController;O.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),u({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),f(r)}catch(e){t.signal.aborted||w(e instanceof Error?e.message:String(e))}}let H=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(j,{children:[(0,B.jsx)(M,{title:e.title,subtitle:e.subtitle}),x&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:x}),!t&&(0,B.jsx)(D,{variant:`ghost`,onClick:()=>E(e=>e+1),children:e.retry})]}),!t&&!x&&(0,B.jsx)(A,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),H?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:H.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(y,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(D,{variant:`secondary`,disabled:p||!t.detected||!!h&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{S(``),h&&r===t.id?s(!0):L(t.id)},children:p&&r===t.id?e.importing:h&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(_,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(D,{variant:`ghost`,disabled:p||!!h,onClick:()=>void z(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(D,{variant:`ghost`,className:`mt-3`,onClick:()=>E(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote})]}),(0,B.jsx)(V,{open:a,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:l,selected:d,onSelected:f,busy:p,locked:p||!!h,error:C,onClose:()=>{O.current?.abort(),s(!1)},onRefresh:()=>{r&&L(r)},onSubmit:()=>void R()})]})}export{$ as ImportsPage};
|
|
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-CiwuuyV8.js";import{i as a,n as o,o as s}from"./locale-store-tI9VX7dp.js";import{t as c}from"./messages-e5MhDONm.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./braces-Cfmtagno.js";import{t as _}from"./check-DUBLcKHA.js";import{t as v}from"./chevron-down-ccbiQQz_.js";import{t as y}from"./download-Dk-ZjtO6.js";import{t as b}from"./folder-kanban-CpLlFI1o.js";import{t as x}from"./package-wATCyihJ.js";import{t as S}from"./plug-DKYPEgkR.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./settings-2-D-csvaET.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./cn-0WouolD0.js";import{t as D}from"./button-Cc4hUNTt.js";import{i as O,o as k}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as A}from"./settings-loading-skeleton-CAoOV17i.js";import{n as j,t as M}from"./settings-page-header-Bfu4cuQd.js";import"./settings-page-layout-BnZa1qHH.js";var N=e(t(),1);async function P(e,t,n){return(await s(a(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:s,busy:_,locked:v,error:y,onClose:S,onRefresh:C,onSubmit:j}=e,M=c(o(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],K;t[3]===i?.candidates?K=t[4]:(K=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=K);let q=K,he;t[5]===i?.candidates?he=t[6]:(he=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=he);let ge=he,J;if(t[7]!==i?.candidates){J=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=J.get(e.parentId)??[];t.push(e),J.set(e.parentId,t)}t[7]=i?.candidates,t[8]=J}else J=t[8];let ve=J,ye=i?.candidates.filter(e=>a.has(e.id))??[],be=M.selected.replace(`{skills}`,String(ye.filter(oe).length)).replace(`{context}`,String(ye.filter(ae).length)).replace(`{projects}`,String(ye.filter(ie).length)),xe;t[9]!==i||t[10]!==s||t[11]!==a?(xe=(e,t)=>{i&&s(z(i,a,e,t))},t[9]=i,t[10]=s,t[11]=a,t[12]=xe):xe=t[12];let Se=xe,Ce;t[13]!==i||t[14]!==s||t[15]!==a?(Ce=(e,t)=>{i&&s(R(i,a,e,t))},t[13]=i,t[14]=s,t[15]=a,t[16]=Ce):Ce=t[16];let we=Ce,Y;t[17]===S?Y=t[18]:(Y=e=>{e||S()},t[17]=S,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(l,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${k}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=E(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,O),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(T,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=y&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:y}),(0,B.jsx)(D,{variant:`secondary`,disabled:v,onClick:C,children:M.refresh})]}),$;t[22]!==y||t[23]!==i?($=!i&&!y&&(0,B.jsx)(A,{sections:2}),t[22]=y,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:M.incomplete}),G.length>0&&(0,B.jsxs)(pe,{icon:w,title:M.personalSetup,description:M.personalSetupHint,items:G,selected:a,open:P,disabled:v,onOpenChange:I,onCheckedChange:e=>we(G,e),children:[(0,B.jsx)(me,{icon:x,title:M.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:v,onToggle:Se,onToggleAll:e=>we(G.filter(ne),e)}),(0,B.jsx)(me,{icon:g,title:M.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:v,onToggle:Se,onToggleAll:e=>we(G.filter(ee),e)})]}),q.length>0&&(0,B.jsx)(pe,{icon:b,title:M.kinds.project,description:M.projectsHint.replace(`{count}`,String(q.length)),items:q,selected:a,open:L,disabled:v,onOpenChange:V,children:(0,B.jsx)(_e,{inventoryId:i.id,projects:q,projectChildren:ve,selected:a,disabled:v,onToggle:Se})}),ge.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:ge}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:M.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[M.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=D,ke=!i||!a.size||_,Ae=_?M.importing:v?M.retry:M.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==j||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:j,children:Ae}),t[29]=Oe,t[30]=j,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(h,{open:n,onOpenChange:Y,children:(0,B.jsxs)(f,{children:[X,(0,B.jsxs)(p,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(m,{className:`text-xl font-semibold text-fg`,children:M.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M.chooseHint})]}),(0,B.jsx)(d,{asChild:!0,children:(0,B.jsx)(D,{variant:`ghost`,"aria-label":M.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:be}),_&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.runningHint}),v&&!_&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(D,{variant:`ghost`,onClick:S,children:_?M.close:M.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=c(o(fe)).imports,[s,l]=(0,N.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>l(U),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(S,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=d):d=t[1];let f=a.connectionsHint.replace(`{count}`,String(r.length)),p;t[2]===f?p=t[3]:(p=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:f}),t[2]=f,t[3]=p);let m=s&&`rotate-180`,h;t[4]===m?h=t[5]:(h=E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,m),t[4]=m,t[5]=h);let g;t[6]===h?g=t[7]:(g=(0,B.jsx)(v,{"aria-hidden":`true`,className:h}),t[6]=h,t[7]=g);let _;return t[8]!==n||t[9]!==r||t[10]!==s||t[11]!==a?(_=s&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(D,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=s,t[11]=a,t[12]=_):_=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:u,children:[d,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),p]}),g]})}),_]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=o(K),a;t[0]===i?a=t[1]:(a=c(i),t[0]=i,t[1]=a);let s=a.imports,[l,u]=(0,N.useState)(),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==l?(h=async function(){if(f(G),!l)try{u(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=l,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=s.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x;t[12]!==_||t[13]!==v||t[14]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=x):x=t[15];let S;t[16]===g?S=t[17]:(S=()=>void g(),t[16]=g,t[17]=S);let C;t[18]!==s.preview||t[19]!==S?(C=(0,B.jsx)(D,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:S,children:s.preview}),t[18]=s.preview,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==x?(w=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,C]}),t[21]=C,t[22]=x,t[23]=w):w=t[23];let T;t[24]===r.reason?T=t[25]:(T=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=T);let E;t[26]!==p||t[27]!==d||t[28]!==l?(E=d&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:p?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:p}):l?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:l.text}):(0,B.jsx)(A,{sections:1})}),t[26]=p,t[27]=d,t[28]=l,t[29]=E):E=t[29];let O;return t[30]!==w||t[31]!==T||t[32]!==E?(O=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[w,T,E]}),t[30]=w,t[31]=T,t[32]=E,t[33]=O):O=t[33],O}function G(e){return!e}function K(e){return e.language}function pe(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:l,onCheckedChange:u,children:d}=e,f;t[0]!==a||t[1]!==u||t[2]!==o?(f=u?L(a,o):void 0,t[0]=a,t[1]=u,t[2]=o,t[3]=f):f=t[3];let p=f,m;t[4]!==l||t[5]!==s?(m=()=>l(!s),t[4]=l,t[5]=s,t[6]=m):m=t[6];let h;t[7]===n?h=t[8]:(h=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[7]=n,t[8]=h);let g;t[9]===r?g=t[10]:(g=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[9]=r,t[10]=g);let _;t[11]===i?_=t[12]:(_=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[11]=i,t[12]=_);let y;t[13]!==g||t[14]!==_?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[g,_]}),t[13]=g,t[14]=_,t[15]=y):y=t[15];let b=s&&`rotate-180`,x;t[16]===b?x=t[17]:(x=E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[16]=b,t[17]=x);let S;t[18]===x?S=t[19]:(S=(0,B.jsx)(v,{"aria-hidden":`true`,className:x}),t[18]=x,t[19]=S);let C;t[20]!==s||t[21]!==m||t[22]!==h||t[23]!==y||t[24]!==S?(C=(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:m,children:[h,y,S]}),t[20]=s,t[21]=m,t[22]=h,t[23]=y,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==c||t[27]!==u||t[28]!==p||t[29]!==r?(w=p&&u&&(0,B.jsx)(X,{label:r,checked:p.checked,indeterminate:p.indeterminate,disabled:c||!p.availableCount,onChange:u}),t[26]=c,t[27]=u,t[28]=p,t[29]=r,t[30]=w):w=t[30];let T;t[31]!==C||t[32]!==w?(T=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[C,w]}),t[31]=C,t[32]=w,t[33]=T):T=t[33];let O;t[34]!==d||t[35]!==s?(O=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:d}),t[34]=d,t[35]=s,t[36]=O):O=t[36];let k;return t[37]!==T||t[38]!==O?(k=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[T,O]}),t[37]=T,t[38]=O,t[39]=k):k=t[39],k}function me(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:s,disabled:l,onToggle:u,onToggleAll:d}=e,f=c(o(ge)).imports,[p,m]=(0,N.useState)(!1),[h,g]=(0,N.useState)(``),[_,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==s?(b=L(i,s),t[0]=i,t[1]=s,t[2]=b):b=t[2];let x=b,S=Y(i,h),C=S.slice(0,_),w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>m(he),t[3]=w):w=t[3];let T;t[4]===n?T=t[5]:(T=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=T);let O;t[6]!==i.length||t[7]!==r?(O=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=O):O=t[8];let k;t[9]!==x.availableCount||t[10]!==x.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[x.selectedCount,`/`,x.availableCount]}),t[9]=x.availableCount,t[10]=x.selectedCount,t[11]=k):k=t[11];let A=p&&`rotate-180`,j;t[12]===A?j=t[13]:(j=E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(v,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==p||t[17]!==T||t[18]!==O||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":p,onClick:w,children:[T,O,k,M]}),t[16]=p,t[17]=T,t[18]=O,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=l||!x.availableCount,R;t[22]!==d||t[23]!==x.checked||t[24]!==x.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:x.checked,indeterminate:x.indeterminate,disabled:I,onChange:d}),t[22]=d,t[23]=x.checked,t[24]=x.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=p&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(we,{value:h,label:f.searchWithin.replace(`{group}`,r),onChange:e=>{g(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:C.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:s.has(e.id),disabled:l,onChange:t=>u(e,t)},e.id))}),!S.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:f.noMatches}),C.length<S.length&&(0,B.jsx)(D,{variant:`ghost`,className:`w-full`,onClick:()=>y(q),children:f.showMore.replace(`{count}`,String(S.length-C.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function q(e){return e+60}function he(e){return!e}function ge(e){return e.language}function _e(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:s,onToggle:l}=e,u=c(o(ve)).imports,[d,f]=(0,N.useState)(``),[p,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,d,h),_=g.slice(0,p),v=r.length>8&&(0,B.jsx)(we,{value:d,label:u.searchWithin.replace(`{group}`,u.kinds.project),onChange:e=>{f(e),m(60)}}),y;t[2]!==s||t[3]!==n||t[4]!==l||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(ye,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:s,onToggle:l},e.id),t[2]=s,t[3]=n,t[4]=l,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),x;t[8]===b?x=t[9]:(x=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=x);let S=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:u.noMatches}),C=_.length<g.length&&(0,B.jsx)(D,{variant:`ghost`,className:`w-full`,onClick:()=>m(J),children:u.showMore.replace(`{count}`,String(g.length-_.length))}),w;return t[10]!==v||t[11]!==x||t[12]!==S||t[13]!==C?(w=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,x,S,C]}),t[10]=v,t[11]=x,t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function J(e){return e+60}function ve(e){return e.language}function ye(e){let t=(0,F.c)(39),{inventoryId:n,project:r,children:i,selected:a,disabled:s,onToggle:l}=e,u=c(o(Ce)).imports,[d,f]=(0,N.useState)(!1),p;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),p=i.filter(e),t[0]=i,t[1]=a,t[2]=p}else p=t[2];let m=p.length,h;t[5]===r.name?h=t[6]:(h=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[5]=r.name,t[6]=h);let g;t[7]===r.displayPath?g=t[8]:(g=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[7]=r.displayPath,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let y=_,b=i.length>0?(0,B.jsxs)(D,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":d,onClick:()=>f(Se),children:[y,(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[u.projectContents.replace(`{skills}`,String(i.filter(xe).length)).replace(`{context}`,String(i.filter(be).length)),` · `,u.chosenCount.replace(`{count}`,String(m))]}),(0,B.jsx)(v,{"aria-hidden":`true`,className:E(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,d&&`rotate-180`)})]}):(0,B.jsx)(`div`,{className:`min-w-0 flex-1 px-2`,children:y}),x=r.name,S;t[12]!==r.id||t[13]!==a?(S=a.has(r.id),t[12]=r.id,t[13]=a,t[14]=S):S=t[14];let C;t[15]!==s||t[16]!==r?(C=s||!I(r),t[15]=s,t[16]=r,t[17]=C):C=t[17];let w;t[18]!==l||t[19]!==r?(w=e=>l(r,e.target.checked),t[18]=l,t[19]=r,t[20]=w):w=t[20];let T;t[21]!==r.name||t[22]!==C||t[23]!==w||t[24]!==S?(T=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":x,checked:S,disabled:C,onChange:w}),t[21]=r.name,t[22]=C,t[23]=w,t[24]=S,t[25]=T):T=t[25];let O;t[26]!==T||t[27]!==b?(O=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[b,T]}),t[26]=T,t[27]=b,t[28]=O):O=t[28];let k;t[29]!==i||t[30]!==s||t[31]!==n||t[32]!==l||t[33]!==d||t[34]!==a?(k=d&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:s,onChange:t=>l(e,t)},e.id))})}),t[29]=i,t[30]=s,t[31]=n,t[32]=l,t[33]=d,t[34]=a,t[35]=k):k=t[35];let A;return t[36]!==O||t[37]!==k?(A=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38],A}function be(e){return e.kind===`context`}function xe(e){return e.kind===`skill`}function Se(e){return!e}function Ce(e){return e.language}function we(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(C,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let s=`${r}…`,c;t[3]===i?c=t[4]:(c=e=>i(e.target.value),t[3]=i,t[4]=c);let l;t[5]!==r||t[6]!==s||t[7]!==c||t[8]!==n?(l=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:s,"aria-label":r,onChange:c,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=s,t[7]=c,t[8]=n,t[9]=l):l=t[9];let u;return t[10]!==o||t[11]!==l?(u=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,l]}),t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:s}=e,l=o(Te),u;t[0]===l?u=t[1]:(u=c(l),t[0]=l,t[1]=u);let d=u.imports,[f,p]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==f?(v=async function(){if(_(Q),!f)try{p(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=f,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let x;t[9]===s?x=t[10]:(x=e=>s(e.target.checked),t[9]=s,t[10]=x);let S;t[11]!==i||t[12]!==b||t[13]!==x?(S=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:x}),t[11]=i,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]===r.name?C=t[16]:(C=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=C);let w;t[17]===r.displayPath?w=t[18]:(w=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=w);let T;t[19]!==C||t[20]!==w?(T=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[C,w]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==S||t[23]!==T?(E=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[S,T]}),t[22]=S,t[23]=T,t[24]=E):E=t[24];let O;t[25]!==r.name||t[26]!==r.status||t[27]!==d||t[28]!==y?(O=r.status!==`blocked`&&(0,B.jsx)(D,{variant:`ghost`,"aria-label":`${d.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:d.preview}),t[25]=r.name,t[26]=r.status,t[27]=d,t[28]=y,t[29]=O):O=t[29];let k;t[30]!==E||t[31]!==O?(k=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[E,O]}),t[30]=E,t[31]=O,t[32]=k):k=t[32];let j;t[33]===r.description?j=t[34]:(j=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=j);let M;t[35]!==r.status||t[36]!==r.targetName||t[37]!==d?(M=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[d.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=d,t[38]=M):M=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==f||t[42]!==m||t[43]!==g||t[44]!==d?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:f.text}),f.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:d.previewTruncated})]}):(0,B.jsx)(A,{sections:1})}),t[41]=f,t[42]=m,t[43]=g,t[44]=d,t[45]=R):R=t[45];let z;return t[46]!==k||t[47]!==j||t[48]!==M||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[k,j,M,L,R]}),t[46]=k,t[47]=j,t[48]=M,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=c(o(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,i]=(0,N.useState)(),[a,s]=(0,N.useState)(!1),[l,u]=(0,N.useState)(),[d,f]=(0,N.useState)(new Set),[p,m]=(0,N.useState)(!1),[h,g]=(0,N.useState)(),[v,b]=(0,N.useState)(),[x,S]=(0,N.useState)(``),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(0),O=(0,N.useRef)(null),k=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return S(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||S(t instanceof Error?t.message:String(t))}),()=>{e.abort(),O.current?.abort()}},[T]);let F=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!F)return;let e=new AbortController,t,n=async()=>{for(let t of F.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||I(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[F]);function I(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&g(t=>t?.requestId===e.id?void 0:t)}async function L(e){O.current?.abort();let t=new AbortController;O.current=t,i(e),s(!0),u(void 0),f(new Set),w(``),b(void 0),g(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(u(n),f(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||w(e instanceof Error?e.message:String(e))}}async function R(){if(!l||!d.size||k.current)return;k.current=!0,m(!0),w(``),S(``);let e=h??{inventoryId:l.id,candidateIds:[...d],requestId:crypto.randomUUID(),retryOf:v};g(e);try{I(await P(`/runs`,e)),s(!1)}catch(e){let t=e instanceof Error?e.message:String(e);w(t),S(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&g(void 0)}finally{k.current=!1,m(!1)}}async function z(e){i(e.source),s(!0),u(void 0),f(new Set),w(``),g(void 0),b(e.id),O.current?.abort();let t=new AbortController;O.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),u({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),f(r)}catch(e){t.signal.aborted||w(e instanceof Error?e.message:String(e))}}let H=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(j,{children:[(0,B.jsx)(M,{title:e.title,subtitle:e.subtitle}),x&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:x}),!t&&(0,B.jsx)(D,{variant:`ghost`,onClick:()=>E(e=>e+1),children:e.retry})]}),!t&&!x&&(0,B.jsx)(A,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),H?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:H.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(y,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(D,{variant:`secondary`,disabled:p||!t.detected||!!h&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{S(``),h&&r===t.id?s(!0):L(t.id)},children:p&&r===t.id?e.importing:h&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(_,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(D,{variant:`ghost`,disabled:p||!!h,onClick:()=>void z(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(D,{variant:`ghost`,className:`mt-3`,onClick:()=>E(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote})]}),(0,B.jsx)(V,{open:a,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:l,selected:d,onSelected:f,busy:p,locked:p||!!h,error:C,onClose:()=>{O.current?.abort(),s(!1)},onRefresh:()=>{r&&L(r)},onSubmit:()=>void R()})]})}export{$ as ImportsPage};
|