@xopcai/xopc 0.0.480 → 0.0.482
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/manifest.json +1 -1
- package/dist/extensions/dingtalk/src/index.js +8 -3
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/server/chunks.bin +1548 -1552
- package/dist/gateway/server/chunks.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-9wMoZ4Ok.js → activity-store-BCPCuT-6.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-TrALdAg_.js → agent-avatar-dicebear-Di9jxcH9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-BiHRFRo2.js → agent-avatar-display-KbzBlJ8W.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DLopBKfN.js → agent-defaults-settings-panel-CYZzdU6C.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-wisFd2cR.js → agent-plugin-dialog-Bhkawcil.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CzgZX_E9.js → agents-B2RXJeIo.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-Crvl6IB4.js → agents-admin-api-DpfkHNbc.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DQVcF1zq.js → api-BtngCZrB.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CJvZsRen.js → api-CnOSHyKU.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CYwY9a8P.js → app-management-settings-panel-Dyc3I-ng.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-8clf9SDY.js → appearance-settings-CmdhL-0n.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-B2qv9gWd.js → apps-page-BFqC9Knk.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Bu1nF6Lg.js → archive-plugin-DFP0MajV.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-HQmKv0Sm.js → automation-api-Cc5X3Q1t.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-CMjfyY6p.js → automation-result-state-B7fHzLLf.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-wlGMBYYv.js → automation-run-list-DPTby29p.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-2EsZ1jBs.js → automation-task-card-CjzArAJi.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BUtoiUiH.js → automations-page-BKbElVfF.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CW_8-0Cb.js → automations-workspace-_18qOoLm.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-Dz62GXI_.js → binary-plugins-DnE-iqaV.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CA66tdm3.js → block-editor-CYobheuw.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-settings-page-hAttQ9qS.js → browser-settings-page-BLniK98R.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-BfTF_flC.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-BNmDs-Ca.js → capabilities-oihQXc5J.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-B32XFJ59.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CWnHPY8j.js +8 -0
- package/dist/gateway/static/root/assets/capability-presentation-DlJQUUlM.js +1 -0
- package/dist/gateway/static/root/assets/{channels-CFmGXibE.js → channels-DEIqjf9M.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-LVSL686y.js → chat-agents-api-BzuJyysa.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-Drmp5p0m.js → chat-chart-block-DurSfGy2.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-CK4aWVbI.js +74 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-twWNRsuW.js → chat-terminal-dock-UBaRUsXJ.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-B27c_GTI.js → command-palette-api-3kNqE3U7.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-DdxZ-1U4.js → composer-model-config-control-CrI-u8F_.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-Dd64p5ZI.js → composer-notifications-L6u0F2_8.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-Cbkv-F26.js → composer-payload-handoff-DdHGkHOq.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-B8UkO-mU.js → computer-settings-page-BwvCOkbI.js} +1 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-B8eiZl6Z.js +1 -0
- package/dist/gateway/static/root/assets/{connection-usage-guide-CNB9P9jg.js → connection-usage-guide-CydSRk3h.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-DkifsBTl.js → connector-service-page-CLBi6R-Z.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DjIpuBCy.js → connectors-api-Bn2IbtcF.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-oGveGlkI.js → connectors-page-ywk7W0s6.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-_G6tIiGk.js → date-picker-DsD7NIm2.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-B3lS-ZGW.js → date-time-picker-BhnBpBpj.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BAKyq-sn.js → desktop-pet-eFR-zmP2.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DGpu4hH_.js → desktop-pet-settings-CfFTYstQ.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-DqYjZFu1.js → dev-view-store-D_uPX9_R.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CIvmpDvo.js → device-pairing-wizard-BeLkoDUp.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BAsEQvG4.js → directory-picker-path-field-5wZa0JF3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-BmlRcbhA.js → extension-authoritative-grants-DaA0KXyO.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page--EU_kb8E.js → extension-debug-page-CXe8jimk.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CcspWP4N.js → extension-iframe-host-BwMISzWU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-BQIfGFSy.js → extension-marketplace-api-DuWuae8G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-f7v82b69.js → extension-message-router-DzBfVl6h.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-page-CJxtbXQj.js → extension-page-DW18FOb8.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-htRLPCBf.js → extension-provider-CyYrgUw-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CKui11ZQ.js → extension-settings-page-ByGVQYDw.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-Cwy9Cgaq.js → file-preview-surface-Cw70pwph.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-abWJ0Q_y.js → gateway-config-swr-BYoBGl6i.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-PYDAppcy.js → gateway-realtime-Dzq6_piH.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-B9CDQ8NO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-BtAJNIO-.js → gateway-restart-CtqJpyNu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BvD8fcB2.js → gateway-settings-xzO7KDsu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Cza1BaL8.js → gateway-startup-retry-DCDOl6Oo.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BIa73mvy.js → global-defaults-api-DXFSI87T.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CztF0goW.js +8 -0
- package/dist/gateway/static/root/assets/home-task-actions-DTXb7Gc7.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BCU7Uxyy.js → image-generation-api-Ck0rMJy3.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Clh0polM.js → imports-page-egn9yYfF.js} +1 -1
- package/dist/gateway/static/root/assets/index-dqkMYWTd.js +11 -0
- package/dist/gateway/static/root/assets/index-q78xsKF3.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-DSkXYsng.js → install-connector-dialog-CMh8jhn1.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Crf76ecq.js → keyboard-shortcuts-settings-BOiKmOwN.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-WudNXl41.js → local-app-workbench-page-ev6VTDX2.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Br9ZO7Ad.js → local-apps-page-CQBSa3cR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-BHrHLZJJ.js → local-session-drafts-pAAFf-Ad.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-5DzxIIeq.js → locale-store-BYdvIuPj.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BqUeqzPB.js → logs-page-Z-4VNgnq.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-DHCpR1ma.js → management-api-D739TCBl.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-BccKy8tW.js → management-settings-CZDWUPmg.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-BOJVaGPC.js +261 -0
- package/dist/gateway/static/root/assets/markdown-view-Czi3_WHu.css +1 -0
- package/dist/gateway/static/root/assets/marked.esm-8VXEA2AD.js +64 -0
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DxZ-KH6B.js → mcp-conversation-setup-page-NcRvP7cK.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DissTT0S.js → media-plugins-B9bQ3e1j.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CGGOcV9B.js → messages-lc5BjBtX.js} +2 -2
- package/dist/gateway/static/root/assets/{model-selector-DsCLjn_X.js → model-selector-DugdMlvi.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-B0Y9Frop.js → models-hub-cache-DvDksW4g.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CEi6GNEA.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-DftbeSZR.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CdC4jVPP.js → notes-api-auhtw3zM.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CC5-BWmA.js → notes-page-DnI1iJ3g.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-CAPuqZdT.js → oauth-api-BXKG29Kg.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-7i3NoKo4.js → oauth-provider-connect-y6-vDWb-.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-BcSfcOme.js → page-context-capture-button-BBVJZgU0.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-BJ2cY1Us.js → page-context-draft-B30xEPDh.js} +1 -1
- package/dist/gateway/static/root/assets/{page-header-store-xgXJVGDC.js → page-header-store-BGCCXOOf.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-avatar-CidTaDAv.js → personal-avatar-w5Sekj02.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BlxApjBh.js → personal-page-BWzfp81f.js} +1 -1
- package/dist/gateway/static/root/assets/personal-profile-settings-BYmKk14v.js +1 -0
- package/dist/gateway/static/root/assets/{personal-settings-panel-BXKSkUoc.js → personal-settings-panel-DYnTT7aB.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-_7leySaj.js → phone-dependencies-card-DJciwZ-7.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-CVI6GGMF.js → phone-model-connection-C3jmc4ma.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-qP1Sh-eA.js → phone-model-picker-MWC_Zh2a.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-BAKOJllx.js → phone-settings-page-C1Yc6tP7.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-CDtfKAUX.js → phone-workspace-store-Cxk2PJZe.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-BpPMZLLz.js → plugin-details-dialog-CpKZE_nx.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-BS-XMhb4.js → preference-select-fields-ByihE_wl.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-runtime-D8kxmrLV.js → preview-runtime-iJuVSugF.js} +3 -3
- package/dist/gateway/static/root/assets/product-automation-feedback-ref9gqOW.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BUqA67HG.js → product-open-page-B7kAAD7Q.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-CowHxHNk.js → product-preview-content-CzNWh2h2.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-BJDwL7x3.js → product-preview-modal-B1RKw3Z-.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-CJQuslC9.js → project-detail-page-Zr1I56NG.js} +2 -2
- package/dist/gateway/static/root/assets/{project-understanding-eH4uN6k8.js → project-understanding-D0S9pFg7.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DFo_ESE9.js → projects-page-DlwRbxAj.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-Df4w723e.js → providers-api-D_v_CJ3l.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-DnRi2KQ5.js → recording-upload-BSyxK34y.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Dw8Ou9VV.js → registry-api-DGi-X6j7.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-B7jGK_WY.js → remote-access-hub-D3EYRXQC.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-CZV8cItD.js → resource-unavailable-52Jvhy-I.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-DOyKalyG.js → right-workspace-store-DsGslCi-.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-D00yB6hp.js +2 -0
- package/dist/gateway/static/root/assets/routine-panel-sCpXMbMl.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-2sksjMtE.js → runtime-tools-api-D8Xtty0g.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DPX5htrV.js → runtime-tools-settings-panel-r28zxrgP.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-BnJcjQuF.js → service-recommendation-list-Kw6pwI8U.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CUkWJyfm.js → session-api-eApyRHbI.js} +1 -1
- package/dist/gateway/static/root/assets/session-channel-icon-CJAPoVO-.js +1 -0
- package/dist/gateway/static/root/assets/session-identity-DRFdxntH.js +1 -0
- package/dist/gateway/static/root/assets/session-identity-label-CZf50vSj.js +1 -0
- package/dist/gateway/static/root/assets/session-manager-C-oe-9_N.js +28 -0
- package/dist/gateway/static/root/assets/sessions-page-BkNfjgXC.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B82UPSQS.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-Bponzv_k.js → settings-advanced-section-Dc9aztiW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-BtgmaA-P.js → settings-mode-store-DcE2iR7e.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C1USPFgf.js → settings-page-CXRPZxuB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-B8nLRdnY.js → settings-page-header-CQueaD1Z.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DhOLVJYv.js → settings-page-layout-BlwyxcEq.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-CyEO6jAM.js → setup-interaction-page-BvL6C5ja.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CNpRqxnq.js → setup-status-panel-Dp5cY2P9.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-kZSUpbBN.js → share-link-dialog-CB3LkWw8.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-9-aTa7_a.js → share-preview-page-IG0fTWJO.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-BxQqmxkq.js → shares-api-DgYOJV0T.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DoMMw8Ud.js → shares-settings-YeLkRDki.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-V3Y6pTog.js → skill-api-DRCHLW2T.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-BSHfM0qb.js → skill-list-api-CQUhEUOF.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Dq3F9pqP.js → skill-reload-api-BoEna1cx.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DGWy1Jns.js → skills-page-CBAL83FE.js} +1 -1
- package/dist/gateway/static/root/assets/{space-api-BkXqM2MT.js → space-api-d4Q4hkEY.js} +1 -1
- package/dist/gateway/static/root/assets/space-page-8BMb_g2p.js +2 -0
- package/dist/gateway/static/root/assets/{space-workbook-7S_FfalA.js → space-workbook-BDjeiRtr.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DSmwwU8o.js → system-settings-panel-dt8k0K4V.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DFeKIcxT.js +3 -0
- package/dist/gateway/static/root/assets/{task-header-title-DAwu5vni.js → task-header-title-ClyuCAFb.js} +1 -1
- package/dist/gateway/static/root/assets/task-run-issue-notice-XWlgvgEo.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-BIehlq7k.js → tasks-CwyNaa-j.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-IpKmyQVN.js → terminal-panel-store-CNkRP4kf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-B75oCec7.js → theme-store-nXIuAiQZ.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CVj7aLAl.js → tracing-settings-page-CoWcr2c0.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-TWW8dGwO.js → tunnel-api-DgsELO9g.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-NgjWPD55.js → understanding-activity-store-BI_PbKCi.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-CN-7T5G5.js → understanding-refresh-store-DPHzCi1Q.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-D6mzQviK.js → usage-page-BVNBJa59.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BYtW_pgF.js → use-autosave-BPDFVsgM.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Dn6X6xAP.js → use-composer-attachments-9nVD0sQ1.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-BT0pss9g.js → use-file-preview-expanded-BhmEiOkv.js} +1 -1
- package/dist/gateway/static/root/assets/{use-generated-media-CuhMqXFp.js → use-generated-media-CLEV4wYC.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-profile-DxE21oPS.js → use-personal-profile-CFaihmiJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-work-j8AH0g9w.js → use-personal-work-CIZMwOlm.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-CNG2yeaO.js → use-realtime-voice-CvtX2HcA.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-BohZkOOW.js → use-workspace-tree-BnvuxYD4.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Dlm-Mmo4.js → user-model-page-D4yNFvW1.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-D_o-xx9v.js → voice-api-key-field-NINoxB5r.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-BX2Q9Cgb.js → voice-config-api-7cvKLNoE.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-qbqLMfW_.js → voice-input-shortcut-events-DaCuiqoi.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-player-store-z-upb7lD.js → voice-player-store-DipmM7w1.js} +1 -1
- package/dist/gateway/static/root/assets/voice-settings-BTvMqF_9.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-ClPiLw1F.js → work-discovery-overlay-BKdumzyK.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BohjMx1A.js → work-discovery-page-uX1VIzJY.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-CcD0smT0.js → working-directory-picker-modal-C9hWAPvW.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-_mQWmOZm.js +2 -0
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-BzuNTkZu.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BjJEOajj.js → workspace-file-preview-dialog-D4Nc7XkR.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-Bc8qK8WA.js → workspace-open-location-menu-BZSS94es.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BWdmU4iy.js → xopc-cloud-account-card-xJr48TmR.js} +1 -1
- package/dist/gateway/static/root/index.html +125 -123
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tasks.js +38 -2
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +6 -5
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +8 -2
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/discovery.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/mcp/connection-drafts.d.ts +1 -1
- package/dist/src/agent/mcp/connection-drafts.js +15 -2
- package/dist/src/agent/mcp/managed-discovery.js +2 -2
- package/dist/src/agent/sandbox/exec-policy.js +1 -1
- package/dist/src/agent/service.js +5 -4
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +3 -2
- package/dist/src/agent/tools/personal-memory-tool.js +2 -2
- package/dist/src/agent/tools/personal-request-tool.d.ts +1 -0
- package/dist/src/agent/tools/personal-request-tool.js +2 -1
- package/dist/src/agent/tools/personal-task-tool.js +44 -13
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -0
- package/dist/src/agent/tools/xopc-use-tool.js +3 -3
- package/dist/src/agent-matching/delegation-service.js +1 -1
- package/dist/src/automations/capabilities/write.js +1 -1
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/delivery/delivery-router.js +1 -1
- package/dist/src/automations/service/automation-service.js +1 -1
- package/dist/src/capabilities/capability-catalog.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.js +1 -1
- package/dist/src/channels/enterprise/setup.d.ts +4 -0
- package/dist/src/channels/enterprise/setup.js +3 -2
- package/dist/src/channels/plugins/types.adapters.d.ts +4 -0
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +2 -1
- package/dist/src/connectors/connection-recovery-service.js +10 -7
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
- package/dist/src/gateway/hono/routes/mobile-capability-panels.d.ts +3 -1
- package/dist/src/gateway/hono/routes/mobile-capability-panels.js +144 -50
- package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
- package/dist/src/gateway/hono/routes/phone-dependencies.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +3 -3
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/task-retry.d.ts +3 -0
- package/dist/src/gateway/hono/routes/task-retry.js +20 -0
- package/dist/src/gateway/hono/routes/tui.js +2 -2
- package/dist/src/gateway/hono/routes/user-model.js +1 -1
- package/dist/src/gateway/media-access.js +2 -2
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service.d.ts +9 -0
- package/dist/src/gateway/service.js +21 -13
- package/dist/src/local-apps/automation-proposals.js +1 -1
- package/dist/src/local-apps/capabilities/projections.d.ts +1 -1
- package/dist/src/local-apps/execution-authority.js +1 -1
- package/dist/src/local-apps/p1-services.js +2 -2
- package/dist/src/local-apps/preview-worker.js +1 -1
- package/dist/src/local-apps/service.js +3 -3
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.js +3 -3
- package/dist/src/personal-agent/capability-service.js +2 -2
- package/dist/src/personal-agent/prompt-context.js +1 -1
- package/dist/src/personal-agent/prompts.js +2 -2
- package/dist/src/personal-agent/reply-composer.d.ts +2 -0
- package/dist/src/personal-agent/reply-composer.js +132 -82
- package/dist/src/personal-agent/reply-result.d.ts +11 -0
- package/dist/src/personal-agent/reply-result.js +60 -0
- package/dist/src/personal-agent/reply-style.d.ts +1 -1
- package/dist/src/personal-agent/reply-style.js +1 -1
- package/dist/src/personal-agent/request-access.js +1 -1
- package/dist/src/personal-agent/request-delivery.d.ts +1 -1
- package/dist/src/personal-agent/request-delivery.js +10 -9
- package/dist/src/personal-agent/request-service.d.ts +3 -1
- package/dist/src/personal-agent/request-service.js +75 -64
- package/dist/src/projects/capabilities/write.js +3 -3
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/runtime-tools/harmony-dependencies.js +5 -5
- package/dist/src/runtime-tools/hdc-files.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.js +2 -2
- package/dist/src/tasks/capabilities/read.js +1 -1
- package/dist/src/tasks/capabilities/relations.js +1 -1
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/index.js +1 -1
- package/dist/src/tasks/task-allocation-service.js +3 -3
- package/dist/src/tasks/task-application-service.d.ts +8 -0
- package/dist/src/tasks/task-application-service.js +18 -7
- package/dist/src/tasks/task-context-assembler.js +2 -2
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/tasks/task-execution-capabilities.js +2 -2
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-handoff.js +2 -2
- package/dist/src/tasks/task-origin-repository.d.ts +2 -0
- package/dist/src/tasks/task-origin-repository.js +3 -2
- package/dist/src/tasks/task-read-model-projector.js +22 -8
- package/dist/src/tasks/task-research-result.js +1 -1
- package/dist/src/tasks/task-result-delivery-service.js +1 -1
- package/dist/src/tasks/task-retry-policy.d.ts +5 -0
- package/dist/src/tasks/task-retry-policy.js +48 -0
- package/dist/src/tasks/task-retry-service.d.ts +18 -0
- package/dist/src/tasks/task-retry-service.js +186 -0
- package/dist/src/tasks/task-run-coordinator.js +3 -3
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tasks/task-run-repository.d.ts +1 -1
- package/dist/src/tui/backends/embedded-backend.js +3 -3
- package/dist/src/tui/tui-capabilities.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/user-context/changes.d.ts +1 -1
- package/dist/src/voice/realtime/memory-context.d.ts +1 -1
- package/dist/src/voice/realtime/memory-context.js +12 -10
- package/dist/src/voice/realtime/omniEngine.js +32 -12
- package/dist/src/voice/realtime/omniRoute.js +1 -1
- package/dist/src/voice/realtime/runtime.js +15 -11
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/capabilities-BcgSEYc5.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-CT6qMkqA.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-9lLzGQ-F.js +0 -8
- package/dist/gateway/static/root/assets/chat-page-qrdWReZ2.js +0 -72
- package/dist/gateway/static/root/assets/connected-providers-grid-ds0J-7Qc.js +0 -1
- package/dist/gateway/static/root/assets/diagnostics-Bo0Z42P_.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DTcS5Hqk.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CwUc6499.js +0 -8
- package/dist/gateway/static/root/assets/index-BWJ0tePz.js +0 -11
- package/dist/gateway/static/root/assets/index-C-4H3NhI.css +0 -1
- package/dist/gateway/static/root/assets/markdown-view-BwbjZnQ6.js +0 -324
- package/dist/gateway/static/root/assets/markdown-view-DG8DDkEA.css +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DEz8I-eN.js +0 -7
- package/dist/gateway/static/root/assets/note-image-lightbox-D-7a_BCN.js +0 -1
- package/dist/gateway/static/root/assets/personal-profile-settings-D1TpPIVg.js +0 -1
- package/dist/gateway/static/root/assets/product-automation-feedback-CDjJlwol.js +0 -7
- package/dist/gateway/static/root/assets/route-preload-N7Ieq1wB.js +0 -2
- package/dist/gateway/static/root/assets/routine-panel-BvBR3khG.js +0 -2
- package/dist/gateway/static/root/assets/session-channel-icon-COynhpeK.js +0 -1
- package/dist/gateway/static/root/assets/session-identity-label-DCIZvqbN.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-BRzFtnn4.js +0 -22
- package/dist/gateway/static/root/assets/sessions-page-PjTnKj7l.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-JrndQtAT.js +0 -1
- package/dist/gateway/static/root/assets/space-page-BAp28k1I.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-15Qm8kNq.js +0 -3
- package/dist/gateway/static/root/assets/task-result-evidence-BqAt23uk.js +0 -1
- package/dist/gateway/static/root/assets/voice-settings-BEhihzNq.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-Bpq_rBZM.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-BkCt8mdN.js +0 -1
- package/dist/gateway/static/root/assets/workspace-preview-store-QUX-jyAL.js +0 -1
|
@@ -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{_ as i,f as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as o}from"./locale-store-5DzxIIeq.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-DlirbHVs.js";import{t as m}from"./app-window-DXFNqt_0.js";import{t as h}from"./chevron-down-ccbiQQz_.js";import{n as g,r as _}from"./popover-select-hRG1EzAY.js";import{n as v,t as y}from"./beta-badge-BnzdzIEl.js";import{t as b}from"./play-kxZvpBg8.js";import{t as x}from"./plus-Q2yW6OE7.js";import{t as S}from"./refresh-cw-BRlGaq2w.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./shield-check-BU58siTV.js";import{t as T}from"./smartphone-DSSsQFqA.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./cn-0WouolD0.js";import{t as O}from"./skeleton-DzdOeGYz.js";import{i as k}from"./vendor-swr-CdRzEUwF.js";import{t as A}from"./button-C5tRaJxt.js";import{t as j}from"./phone-workspace-store-CDtfKAUX.js";import{l as ee,m as te,o as ne,r as M,t as re,u as ie}from"./dist-DaFr5KMw.js";import{n as ae,t as oe}from"./global-defaults-api-BIa73mvy.js";import{n as se,t as ce}from"./settings-page-header-B8nLRdnY.js";import{a as le,c as N,i as P,r as ue,s as de}from"./phone-model-picker-qP1Sh-eA.js";import{t as fe}from"./phone-dependencies-card-_7leySaj.js";import{n as pe,t as me}from"./phone-model-connection-CVI6GGMF.js";var F=e(t(),1),I=r();function he({device:e,zh:t,onClose:n,onConnected:r}){let[i,a]=(0,F.useState)(!1),[o,l]=(0,F.useState)(e.wireless?.host??``),[m,h]=(0,F.useState)(``),[g,_]=(0,F.useState)(!1),[v,y]=(0,F.useState)(``),b=async()=>{_(!0),y(``);try{await N(`/devices/${e.id}/reconnect`,i?{host:o,port:Number(m)}:{}),await r(),n()}catch(e){y(e instanceof Error?e.message:String(e)),a(!0)}finally{_(!1)}};return(0,I.jsx)(p,{open:!0,onOpenChange:e=>{!e&&!g&&n()},children:(0,I.jsxs)(u,{children:[(0,I.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,I.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(28rem,90dvh)] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5 text-fg`,children:[(0,I.jsxs)(f,{className:`text-base font-semibold`,children:[t?`重新连接手机`:`Reconnect phone`,` · `,e.name]}),(0,I.jsx)(c,{className:`mt-2 text-sm text-fg-muted`,children:t?`开启手机无线调试,并连接 Gateway 所在局域网。重连会保留设备权限,之前的任务需要重新打开。`:`Enable wireless debugging on the Gateway network. Device permissions are preserved; reopen the previous task.`}),(0,I.jsxs)(`form`,{className:`mt-4 flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto`,children:[(0,I.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:i,disabled:g,onChange:e=>a(e.target.checked)}),t?`手动填写当前连接地址`:`Enter current connection address`]}),i&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`label`,{className:`block text-sm`,children:[t?`手机 IP 地址`:`Phone IP address`,(0,I.jsx)(`input`,{className:`mt-1 w-full rounded-lg border border-edge bg-surface-base p-2`,required:!0,value:o,disabled:g,onChange:e=>l(e.target.value.trim())})]}),(0,I.jsxs)(`label`,{className:`block text-sm`,children:[t?`连接端口(无线调试首页)`:`Connection port (Wireless debugging screen)`,(0,I.jsx)(`input`,{className:`mt-1 w-full rounded-lg border border-edge bg-surface-base p-2`,type:`number`,min:1,max:65535,required:!0,value:m,disabled:g,onChange:e=>h(e.target.value)})]})]}),v&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:v})]}),(0,I.jsxs)(`footer`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge pt-4`,children:[(0,I.jsx)(A,{type:`button`,disabled:g,onClick:n,children:t?`取消`:`Cancel`}),(0,I.jsx)(A,{type:`submit`,variant:`primary`,disabled:g,children:g?t?`正在连接…`:`Connecting…`:t?`重新连接`:`Reconnect`})]})]})]})]})})}var L=n();function ge(e){let t=(0,L.c)(31),{deviceId:n,serial:r,platform:i,mode:a,selected:o,onModeChange:s,onSelectedChange:c,disabled:l,zh:u}=e,d=(0,F.useId)(),[f,p]=(0,F.useState)(``),h;t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r?(h=a===`selected`?[`phone-applications`,n??r,i??`android`]:null,t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=h):h=t[4];let g;t[5]!==n||t[6]!==i||t[7]!==r?(g=()=>P(n,r,i),t[5]=n,t[6]=i,t[7]=r,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={revalidateOnFocus:!1,shouldRetryOnError:!1},t[9]=_):_=t[9];let v=k(h,g,_),y;if(t[10]!==v||t[11]!==l||t[12]!==d||t[13]!==a||t[14]!==s||t[15]!==c||t[16]!==f||t[17]!==o||t[18]!==u){let e=f.trim().toLocaleLowerCase(),n=v.data?.filter(t=>`${t.label} ${t.packageName}`.toLocaleLowerCase().includes(e))??[],r=v.data,i=r?o.filter(e=>!r.some(t=>t.packageName===e)):[],h;t[20]!==c||t[21]!==o?(h=e=>c(o.includes(e)?o.filter(t=>t!==e):[...o,e]),t[20]=c,t[21]=o,t[22]=h):h=t[22];let g=h,_=u?`应用权限`:`Application access`,b;t[23]===_?b=t[24]:(b=(0,I.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:_}),t[23]=_,t[24]=b);let x;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`all`,`selected`],t[25]=x):x=t[25];let w;t[26]!==d||t[27]!==a||t[28]!==s||t[29]!==u?(w=(0,I.jsx)(`div`,{className:`grid gap-2`,children:x.map(e=>(0,I.jsxs)(`label`,{className:D(`flex min-h-14 cursor-pointer items-start gap-3 rounded-xl border p-3`,a===e?`border-accent/50 bg-accent-soft`:`border-edge bg-surface-base`),children:[(0,I.jsx)(`input`,{type:`radio`,name:d,value:e,checked:a===e,onChange:()=>s(e),className:`mt-1 size-4 shrink-0 accent-accent`}),(0,I.jsxs)(`span`,{className:`min-w-0`,children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium`,children:e===`all`?u?`允许所有应用`:`Allow all apps`:u?`仅允许所选应用`:`Only selected apps`}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-fg-muted`,children:e===`all`?u?`可在手机上的应用间切换,无需逐个配置。`:`Switch between apps on this phone without individual setup.`:u?`从手机上已安装的应用中选择。`:`Choose from applications installed on the phone.`})]})]},e))}),t[26]=d,t[27]=a,t[28]=s,t[29]=u,t[30]=w):w=t[30],y=(0,I.jsxs)(`fieldset`,{disabled:l,className:`space-y-3`,children:[b,w,a===`selected`?(0,I.jsxs)(`div`,{className:`space-y-2`,"aria-label":u?`选择手机应用`:`Choose phone applications`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:u?`已选择 ${o.length} 个应用`:`${o.length} apps selected`}),(0,I.jsxs)(A,{variant:`ghost`,className:`gap-1 px-2 py-1 text-xs`,"aria-label":u?`刷新应用列表`:`Refresh applications`,disabled:l||v.isValidating,onClick:()=>{v.mutate()},children:[(0,I.jsx)(S,{className:D(`size-3.5`,v.isValidating&&`animate-spin motion-reduce:animate-none`),"aria-hidden":!0}),u?`刷新`:`Refresh`]})]}),(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(C,{className:`pointer-events-none absolute left-3 top-3 size-4 text-fg-muted`,"aria-hidden":!0}),(0,I.jsx)(`input`,{type:`search`,"aria-label":u?`搜索手机应用`:`Search phone applications`,placeholder:u?`搜索应用`:`Search apps`,value:f,onChange:e=>p(e.target.value),className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm focus-visible:outline-2 focus-visible:outline-accent`})]}),v.error?(0,I.jsxs)(`div`,{role:`alert`,className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:[u?`暂时无法读取应用,请确认手机已连接后重试。之前的选择会保留。`:`Unable to read apps. Check the phone connection and retry. Previous selections are preserved.`,(0,I.jsx)(A,{variant:`ghost`,className:`ml-1 text-accent`,onClick:()=>{v.mutate()},children:u?`重试`:`Retry`})]}):null,!v.data&&!v.error?(0,I.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,I.jsx)(O,{className:`h-10 w-full`}),(0,I.jsx)(O,{className:`h-10 w-full`}),(0,I.jsx)(O,{className:`h-10 w-full`})]}):v.data?(0,I.jsxs)(`div`,{className:`max-h-56 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-base`,"aria-label":u?`可选应用`:`Available applications`,children:[n.map(e=>(0,I.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-3 px-3 py-2 hover:bg-surface-hover`,children:[(0,I.jsx)(m,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-sm`,title:e.label,children:e.label}),e.label!==e.packageName&&v.data.some(t=>t.packageName!==e.packageName&&t.label===e.label)?(0,I.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:e.packageName}):null]}),(0,I.jsx)(`input`,{type:`checkbox`,"aria-label":e.label,checked:o.includes(e.packageName),onChange:()=>g(e.packageName),className:`size-4 shrink-0 accent-accent`})]},e.packageName)),n.length?null:(0,I.jsx)(`p`,{className:`p-4 text-center text-sm text-fg-muted`,children:e?u?`没有找到匹配的应用`:`No matching applications`:u?`这台手机上没有可打开的应用`:`No launchable applications on this phone`})]}):null,i.length?(0,I.jsxs)(`div`,{className:`space-y-1 text-xs text-fg-muted`,children:[(0,I.jsx)(`p`,{children:u?`以下原有选择未在手机上找到,可取消选择。`:`These previous selections are no longer available. You may deselect them.`}),i.map(e=>(0,I.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:!0,onChange:()=>g(e),className:`accent-accent`}),(0,I.jsx)(`span`,{className:`break-all`,children:e})]},e))]}):null,o.length?null:(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:u?`至少选择一个应用后保存。`:`Choose at least one application before saving.`})]}):null]}),t[10]=v,t[11]=l,t[12]=d,t[13]=a,t[14]=s,t[15]=c,t[16]=f,t[17]=o,t[18]=u,t[19]=y}else y=t[19];return y}function R({deviceId:e,value:t,onChange:n,disabled:r,zh:i}){let[a,o]=(0,F.useState)(!1),[s,c]=(0,F.useState)(``);async function l(){o(!0),c(``);try{let t=await N(`/devices/${e}/input-status`);c(t.unicode===`available`?i?`中文输入通道已就绪,具体应用仍需允许粘贴。`:`Unicode input is ready. The app must allow pasting.`:t.unicode===`setup_required`?i?`请在手机依赖中安装或修复 scrcpy server,再重试检测。无需安装手机输入法。`:`Install or repair scrcpy server under phone dependencies, then retry. No phone keyboard installation is needed.`:i?`这台手机暂不支持自动中文输入,请接管后使用手机自带键盘。`:`Automatic Unicode input is unavailable. Take over and use the phone keyboard.`)}catch{c(i?`暂时无法检测,请确认手机连接后重试。`:`Unable to check. Reconnect the phone and retry.`)}finally{o(!1)}}return(0,I.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge bg-surface-base p-3`,children:[(0,I.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-3 text-sm font-medium`,children:[i?`允许自动输入文字`:`Allow automatic text input`,(0,I.jsx)(`input`,{type:`checkbox`,checked:t===`auto`,disabled:r,onChange:e=>n(e.target.checked?`auto`:`manual`),className:`size-4 accent-accent`})]}),(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:t===`auto`?i?`中文和 Emoji 通过手机剪贴板粘贴,不安装或切换输入法。输入内容可能留在手机剪贴板;不会读取或同步原有剪贴板。`:`Chinese and emoji use the phone clipboard without installing or switching keyboards. Supplied text may remain there; existing clipboard contents are never read or synced.`:i?`Agent 会在需要输入时暂停。请接管手机,使用手机自带键盘输入,完成后交还 Agent。`:`The Agent pauses when text is needed. Take over, type with the phone keyboard, then hand back to the Agent.`}),e?(0,I.jsx)(A,{variant:`ghost`,className:`min-h-9 px-2 text-xs text-accent`,disabled:r||a,onClick:()=>void l(),children:a?i?`正在检测…`:`Checking…`:i?`检测中文输入能力`:`Check Unicode input`}):null,s?(0,I.jsx)(`p`,{role:`status`,className:`text-xs leading-relaxed text-fg-muted`,children:s}):null]})}var z=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,B=`min-h-11 w-full cursor-default rounded-lg px-3 py-2 text-left text-sm outline-none data-[highlighted]:bg-surface-hover data-[highlighted]:ring-2 data-[highlighted]:ring-inset data-[highlighted]:ring-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,V=`space-y-4 rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`;function _e({device:e,serial:t,name:n,platform:r,onSave:i,onClose:a,zh:o}){let m=e?.platform??r,h=m===`harmonyos`,[g,_]=(0,F.useState)(e?.name??n),[v,y]=(0,F.useState)(e?.appAccess??(e?.allowedApps.length?`selected`:`all`)),[b,x]=(0,F.useState)(e?.allowedApps??[]),[S,C]=(0,F.useState)(e?.textInput??(h?`manual`:`auto`)),[w,T]=(0,F.useState)(e?.enabled??!0),[D,O]=(0,F.useState)(!1),[k,j]=(0,F.useState)(``),ee=async()=>{O(!0),j(``);try{let n={name:g,appAccess:v,allowedApps:v===`all`?[]:b,textInput:S,enabled:w};await N(e?`/devices/${e.id}`:`/devices`,e?n:{...n,serial:t,platform:m},e?`PATCH`:`POST`),await i(),a()}catch(e){j(e instanceof Error?e.message:String(e))}finally{O(!1)}};return(0,I.jsx)(p,{open:!0,onOpenChange:e=>{!e&&!D&&a()},children:(0,I.jsxs)(u,{children:[(0,I.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,I.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(44rem,90dvh)] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5 text-fg`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(f,{className:`text-base font-semibold`,children:e?o?`管理手机`:`Manage phone`:o?`添加手机`:`Add phone`}),(0,I.jsx)(c,{className:`mt-1 text-sm text-fg-muted`,children:o?`设备连接在 Gateway 所在电脑。修改权限会停止当前控制。`:`This phone connects to the Gateway host. Changing access stops active control.`})]}),(0,I.jsx)(l,{asChild:!0,children:(0,I.jsx)(A,{variant:`ghost`,disabled:D,"aria-label":o?`关闭`:`Close`,children:(0,I.jsx)(E,{className:`size-4`})})})]}),(0,I.jsxs)(`form`,{className:`mt-5 flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),ee()},children:[(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto pr-1`,children:[(0,I.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[o?`名称`:`Name`,(0,I.jsx)(`input`,{className:z,value:g,maxLength:100,required:!0,onChange:e=>_(e.target.value)})]}),(0,I.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[h?`HDC`:`ADB`,`: `,t]}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:o?`已启用 phone_use 工具的 Agent 可使用这台手机。`:`Agents with the phone_use tool can use this phone.`}),(0,I.jsx)(ge,{deviceId:e?.id,serial:t,platform:m,mode:v,selected:b,onModeChange:y,onSelectedChange:x,zh:o,disabled:D}),h?(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:o?`鸿蒙支持实时投屏和截图回退。手势释放后执行;文字请在手机上输入,完成后交还 Agent。应用列表暂以应用标识显示。`:`HarmonyOS supports live video with snapshot fallback. Gestures execute on release. Type on the phone, then hand back. Apps display bundle identifiers.`}):(0,I.jsx)(R,{deviceId:e?.id,value:S,onChange:C,disabled:D,zh:o}),(0,I.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-3 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked)}),o?`允许访问这台手机`:`Enable access to this phone`]}),k&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:k})]}),(0,I.jsxs)(`div`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge pt-4`,children:[(0,I.jsx)(A,{type:`button`,disabled:D,onClick:a,children:o?`取消`:`Cancel`}),(0,I.jsx)(A,{type:`submit`,variant:`primary`,disabled:D||!g.trim()||v===`selected`&&!b.length,children:D?o?`保存中…`:`Saving…`:o?`保存手机`:`Save phone`})]})]})]})]})})}function H(){let[e,t]=i(),n=(t,n=!1)=>e.has(t)?e.get(t)===`1`:n,r=(e,r,i=!1)=>{r!==n(e,i)&&t(t=>{let n=new URLSearchParams(t);return n.set(e,r?`1`:`0`),n})},s=o(e=>e.language)===`zh`,c=k(`phone-settings`,de),l=k(`phone-devices`,le,{refreshInterval:15e3}),u=k(`settings-agent-defaults`,oe),d=u.data?.defaults.models.phoneUse?.primary??``,[f,p]=(0,F.useState)(d);(0,F.useEffect)(()=>{p(d)},[d]);let[m,C]=(0,F.useState)(!1),[E,D]=(0,F.useState)(``),[P,L]=(0,F.useState)(``),[ge,R]=(0,F.useState)(!1),[H,ve]=(0,F.useState)(),[ye,U]=(0,F.useState)(),[be,xe]=(0,F.useState)(``),[W,Se]=(0,F.useState)(``),[G,Ce]=(0,F.useState)(``),[K,we]=(0,F.useState)(()=>sessionStorage.getItem(`phone-settings-session`)??``),q=k(K?[`phone-session`,K]:null,()=>N(`/sessions/${K}`),{refreshInterval:1500}),Te=a(),[J,Y]=(0,F.useState)({}),X=q.data,Z=X?.status===`running`,Ee=be||l.data?.defaultDeviceId||``,De=d===ue,Q=async(e,t)=>{C(!0),D(``),L(``);try{await e(),t&&L(t)}catch(e){D(e instanceof Error?e.message:String(e))}finally{C(!1)}},Oe=async e=>{let t=await oe(),n={...t.defaults.models};e?n.phoneUse={primary:e,fallbacks:[]}:delete n.phoneUse;let r=await ae({...t.defaults,models:n},{scope:`models`,expectedModels:t.defaults.models});await u.mutate(r,!1),p(e)},ke=()=>Q(async()=>{K&&X&&![`closed`,`cancelled`,`failed`,`outcome_unknown`].includes(X.status)&&await N(`/sessions/${K}/execute`,{op:`close`});let e=await N(`/sessions`,{deviceId:Ee,mode:`control`});we(e.id),sessionStorage.setItem(`phone-settings-session`,e.id),await N(`/sessions/${e.id}/execute`,{op:`run`,goal:W,...G?{expectText:G}:{},maxActions:6})}),$=e=>Q(async()=>{await N(`/sessions/${K}/execute`,{op:e}),await q.mutate()}),Ae=async e=>{Y(t=>({...t,[e.id]:{pending:!0,text:s?`正在诊断…`:`Checking…`}}));try{let t=await N(`/devices/${e.id}/diagnostics`,{}),n=s?{device:`已连接`,disconnected:`未连接`,unauthorized:`未授权调试`,offline:`离线`}:{device:`Connected`,disconnected:`Disconnected`,unauthorized:`Debugging not authorized`,offline:`Offline`};Y(r=>({...r,[e.id]:{pending:!1,text:`${s?`诊断结果`:`Diagnostics`}:${n[t.state]??t.state}`}}))}catch(t){Y(n=>({...n,[e.id]:{pending:!1,error:!0,text:t instanceof Error?t.message:String(t)}}))}},je=s?{ready:`就绪`,running:`执行中`,paused:`已暂停`,needs_user:`等待人工处理`,completed:`执行结束`,cancelled:`已停止`,closed:`已关闭`,failed:`执行失败`,outcome_unknown:`结果待核查`}:{},Me=!!(l.data?.devices.length&&l.data.devices.every(e=>e.connection));return(0,I.jsxs)(se,{gap:`gap-6`,className:`max-w-[48rem]`,children:[(0,I.jsx)(ce,{aiSetup:`phone`,title:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[s?`手机控制`:`Phone Use`,(0,I.jsx)(y,{})]}),subtitle:s?`让 AI 帮你操作 Android 和鸿蒙手机。`:`Let AI work with your Android or HarmonyOS phone.`}),E&&(0,I.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-3 text-sm text-danger`,children:E}),P&&(0,I.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:P}),c.error&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(c.error)}),(0,I.jsx)(`section`,{className:V,"aria-label":s?`手机控制设置`:`Phone control settings`,children:(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-surface-inset text-fg-muted`,children:(0,I.jsx)(T,{className:`size-6`,"aria-hidden":!0})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`启用手机控制`:`Enable Phone Use`}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s?`连接与操作在 Gateway 电脑上执行。`:`Connects and runs on your Gateway computer.`})]})]}),c.data?(0,I.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":c.data.config.enabled,"aria-label":s?`启用手机控制`:`Enable Phone Use`,disabled:m||Z,className:`touch-target flex shrink-0 items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,onClick:()=>{let e=!c.data.config.enabled;Q(async()=>{await N(`/settings`,{...c.data.config,enabled:e},`PATCH`),await c.mutate()})},children:(0,I.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors motion-reduce:transition-none ${c.data.config.enabled?`bg-accent`:`bg-fg-muted/30`}`,children:(0,I.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform motion-reduce:transition-none ${c.data.config.enabled?`translate-x-5`:`translate-x-0`}`})})}):(0,I.jsx)(O,{className:`h-8 w-12`})]})}),(0,I.jsx)(`section`,{className:V,children:(0,I.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,I.jsx)(`span`,{children:s?`默认执行方式`:`Default execution strategy`}),c.data?(0,I.jsxs)(g,{"aria-label":s?`默认执行方式`:`Default execution strategy`,value:c.data.config.executionMode??`collaborative`,disabled:m,onChange:e=>{let t=e.target.value;Q(async()=>{await N(`/settings`,{...c.data.config,executionMode:t},`PATCH`),await c.mutate()})},children:[(0,I.jsx)(_,{value:`collaborative`,children:s?`主 Agent 协作(默认)`:`Main Agent collaboration (default)`}),(0,I.jsx)(_,{value:`direct`,children:s?`直接执行`:`Direct execution`})]}):(0,I.jsx)(O,{className:`h-10 w-full`}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`协作:主 Agent 拆解目标并根据反馈继续。直接执行:手机模型自行规划完整手机任务。修改只影响新任务,聊天可覆盖。`:`Collaboration: the main Agent plans small goals using feedback. Direct: the phone model plans the full phone task. Changes affect new tasks; chats can override.`})]})}),(0,I.jsxs)(`section`,{"aria-label":s?`手机模型配置`:`Phone model configuration`,className:V,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`操作模型`:`Phone model`}),c.data&&(0,I.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,I.jsx)(`span`,{children:s?`连接保持时间`:`Connection lifetime`}),(0,I.jsxs)(g,{"aria-label":s?`连接保持时间`:`Connection lifetime`,value:String(c.data.config.idleDisconnectMs??0),disabled:m||Z,onChange:e=>{let t=Number(e.target.value);Q(async()=>{await N(`/settings`,{...c.data.config,idleDisconnectMs:t},`PATCH`),await c.mutate()})},children:[(0,I.jsx)(_,{value:`0`,children:s?`保持连接,直到手动断开`:`Keep connected until disconnected`}),[15,30,60].map(e=>(0,I.jsx)(_,{value:String(e*6e4),children:s?`闲置 ${e} 分钟后断开`:`Disconnect after ${e} idle minutes`},e))]}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`任务结束后保留连接;执行任务、人工操作和查看画面期间不计闲置。`:`Tasks finish without disconnecting. Running tasks, manual control and viewing the screen do not count as idle.`})]}),!u.data&&!u.error?(0,I.jsx)(O,{className:`h-20 w-full`}):(0,I.jsx)(me,{value:d,onSelect:p,onSave:Oe,zh:s,disabled:m||Z||!u.data}),u.error&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(u.error)}),(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:(0,I.jsx)(A,{variant:`ghost`,className:`px-0 text-accent-fg hover:bg-transparent hover:underline`,disabled:m||!f||f===`phone-mock/settings-about`,onClick:()=>{Q(async()=>{let e=await N(`/models/diagnostics`,{modelRef:f});L(e.mock?s?`模拟适配器可用;此测试不验证真实模型。`:`Mock adapter ready; this does not validate a real model.`:e.groundingVerified?s?`模型连接、动作协议和测试图定位通过;未操作真实手机。`:`Connection, protocol and test-image grounding passed. No phone was operated.`:s?`动作协议有效,但测试图定位未通过。`:`Protocol valid, but test-image grounding did not pass.`)})},children:s?`测试模型连接`:`Test model connection`})}),(0,I.jsxs)(`details`,{open:n(`privacy`),onToggle:e=>r(`privacy`,e.currentTarget.open),className:`group border-t border-edge-subtle pt-1 text-xs text-fg-muted`,children:[(0,I.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 [&::-webkit-details-marker]:hidden`,children:[(0,I.jsx)(w,{className:`size-4`,"aria-hidden":!0}),s?`隐私与执行限制`:`Privacy & execution limits`,(0,I.jsx)(h,{className:`ml-auto size-4 group-open:rotate-180`,"aria-hidden":!0})]}),(0,I.jsxs)(`div`,{className:`space-y-3 pb-2 leading-relaxed`,children:[(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:s?`手机截图会发送给所选模型;页面摘要可能进入聊天模型。`:`Phone screenshots go to the selected model; page summaries may reach the chat model.`}),` `,c.data&&(0,I.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[s?`每次小目标最多 12 步、${c.data.config.maxOperationDurationMs/1e3} 秒活跃执行时间;会话限制`:`Each goal: up to 12 actions / ${c.data.config.maxOperationDurationMs/1e3} active seconds. Session limits`,`: `,c.data.config.maxActionsPerSession,` `,s?`动作`:`actions`,` · `,c.data.config.maxModelRequests,` `,s?`模型请求`:`model requests`]}),(0,I.jsx)(`p`,{children:s?`远程浏览器无法访问你本机的 USB 设备。`:`A remote browser cannot access your local USB devices.`})]})]})]}),(0,I.jsxs)(`section`,{className:`space-y-3`,"aria-label":s?`手机管理`:`Phone management`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`手机管理`:`Phones`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(A,{variant:`ghost`,disabled:m,onClick:()=>R(!0),children:[(0,I.jsx)(x,{className:`size-4`,"aria-hidden":!0}),s?`添加手机`:`Add phone`]}),(0,I.jsxs)(A,{variant:`ghost`,disabled:m||l.isValidating,onClick:()=>{Q(()=>l.mutate())},children:[(0,I.jsx)(S,{className:`size-4`,"aria-hidden":!0}),s?`刷新`:`Refresh`]})]})]}),!l.data&&!l.error?(0,I.jsx)(O,{className:`h-32 w-full rounded-xl`}):(0,I.jsxs)(`div`,{className:V,children:[(l.error||!Me&&l.data?.diagnostic)&&(0,I.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[l.data?.diagnostic??String(l.error),` · `,s?`检查 Gateway 电脑的调试工具与 USB 连接。`:`Check debugging tools and USB on the Gateway host.`]}),l.data?.devices.map(e=>(0,I.jsxs)(`div`,{className:`border-b border-edge-subtle pb-4 last:border-b-0 last:pb-0`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-3 sm:flex-row sm:gap-4`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,I.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-fg-muted`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`p`,{className:`break-words text-sm font-medium`,children:[e.name,e.id===l.data?.defaultDeviceId&&(0,I.jsx)(`span`,{className:`ml-2 inline-block rounded-md bg-surface-inset px-2 py-0.5 text-xs font-normal text-fg-muted`,children:s?`默认`:`Default`})]}),(0,I.jsxs)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:[e.platform===`harmonyos`?`HarmonyOS · HDC · USB · `:e.connection?`${s?`阿里云`:`Alibaba Cloud`} · ADB · `:``,e.serial,` · `,e.enabled?e.connection?s?`已配置 · 按需连接`:`Configured · Connects on demand`:{device:s?`已连接`:`Connected`,offline:s?`离线`:`Offline`,unauthorized:s?`待授权`:`Unauthorized`}[l.data?.discovery.find(t=>t.serial===e.serial&&(t.platform??`android`)===(e.platform??`android`))?.state??``]??(s?`未连接`:`Disconnected`):s?`已禁用`:`Disabled`]})]})]}),(0,I.jsxs)(`div`,{className:`flex max-w-full shrink-0 flex-wrap items-center justify-end gap-1 self-end sm:self-start`,children:[(0,I.jsx)(A,{variant:`ghost`,disabled:m,onClick:()=>U({device:e,serial:e.serial,name:e.name}),children:s?`管理`:`Manage`}),(0,I.jsx)(A,{variant:`ghost`,disabled:m||!e.enabled,onClick:()=>{Q(async()=>{await N(`/devices/${e.id}/view`,{}),window.dispatchEvent(new Event(`phone-connections-changed`)),j.getState().show(e.id)})},children:s?`查看屏幕`:`View screen`}),(0,I.jsx)(A,{variant:`ghost`,disabled:m||!e.enabled,onClick:()=>{Q(async()=>{let t=await N(`/devices/${e.id}/conversations`,{});window.dispatchEvent(new Event(`session-created`)),j.getState().hide(),Te(`/chat/${t.conversationId}`)})},children:s?`对话控制手机`:`Control in chat`}),(0,I.jsxs)(ee,{modal:!1,children:[(0,I.jsx)(te,{asChild:!0,children:(0,I.jsxs)(A,{variant:`ghost`,disabled:m,"aria-label":s?`${e.name}的更多操作`:`More actions for ${e.name}`,children:[s?`更多`:`More`,(0,I.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,I.jsx)(ne,{children:(0,I.jsxs)(re,{align:`end`,sideOffset:6,collisionPadding:12,className:`z-[90] min-w-40 max-w-[calc(100vw-1.5rem)] rounded-xl border border-edge bg-surface-overlay p-1 text-fg shadow-popover`,children:[e.wireless&&(0,I.jsx)(M,{disabled:m||!e.enabled,className:B,onSelect:()=>ve(e),children:s?`重新连接`:`Reconnect`}),(0,I.jsx)(M,{disabled:m||J[e.id]?.pending,className:B,onSelect:()=>{Ae(e)},children:e.connection?s?`连接诊断`:`Connect & diagnose`:s?`诊断`:`Diagnose`}),e.id!==l.data?.defaultDeviceId&&(0,I.jsx)(M,{disabled:m,className:B,onSelect:()=>{Q(async()=>{await N(`/devices/${e.id}/default`,{}),await l.mutate()})},children:s?`设为默认`:`Set default`}),(0,I.jsx)(ie,{className:`my-1 border-t border-edge-subtle`}),(0,I.jsx)(M,{disabled:m,className:`${B} text-danger`,onSelect:()=>{Q(async()=>{await N(`/devices/${e.id}`,void 0,`DELETE`),await l.mutate()})},children:s?`移除连接`:`Remove connection`})]})})]})]})]}),(0,I.jsx)(`p`,{role:`status`,"aria-live":`polite`,title:J[e.id]?.text,className:`h-5 truncate text-xs leading-5 ${J[e.id]?.error?`text-danger`:`text-fg-muted`}`,children:J[e.id]?.text})]},e.id)),l.data?.discovery.filter(e=>!l.data?.devices.some(t=>t.serial===e.serial&&(t.platform??`android`)===(e.platform??`android`))).map(e=>(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`text-sm`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.platform===`harmonyos`?`HarmonyOS · USB`:e.emulator?s?`Android 模拟器`:`Android emulator`:`Android`,` · `,e.state]})]}),(0,I.jsx)(A,{disabled:m||e.state!==`device`,onClick:()=>U({serial:e.serial,name:e.name,platform:e.platform}),children:s?`添加手机`:`Add phone`})]},`${e.platform??`android`}:${e.serial}`)),!l.data?.devices.length&&!l.data?.discovery.length&&(0,I.jsx)(`p`,{className:`py-3 text-sm text-fg-muted`,children:s?`尚未发现设备。先启动 Android 模拟器,或通过 USB 连接手机并允许调试。`:`No devices found. Start an Android emulator, or connect a phone over USB and authorize debugging.`})]})]}),(0,I.jsx)(fe,{expanded:n(`components`),onExpandedChange:e=>r(`components`,e),cloudOnly:Me,onChanged:()=>{l.mutate(),c.mutate()}}),(0,I.jsxs)(`details`,{open:n(`test`,!!K),onToggle:e=>r(`test`,e.currentTarget.open,!!K),className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":s?`手机试运行`:`Phone test run`,children:[(0,I.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,I.jsx)(v,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`试运行`:`Test run`}),(0,I.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:s?`验证手机操作`:`Try a task`}),(0,I.jsx)(h,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,I.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-5`,children:[(0,I.jsxs)(g,{"aria-label":s?`测试手机`:`Test phone`,value:Ee,disabled:m||Z,onChange:e=>xe(e.target.value),children:[(0,I.jsx)(_,{value:``,children:s?`选择手机`:`Choose phone`}),l.data?.devices.filter(e=>e.enabled).map(e=>(0,I.jsx)(_,{value:e.id,children:e.name},e.id))]}),(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[s?`本次授权的小目标`:`Authorized goal`,(0,I.jsx)(`textarea`,{className:z,value:W,maxLength:2e3,onChange:e=>Se(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[s?`完成时应显示的文字(可选)`:`Expected completion text (optional)`,(0,I.jsx)(`input`,{className:z,value:G,maxLength:200,onChange:e=>Ce(e.target.value)})]}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`先手动打开允许的应用。模型说完成只表示执行结束,只有匹配界面证据才会显示验证通过。`:`First open an allowed app manually. A model completion claim remains unverified until native UI evidence matches.`})]}),(0,I.jsxs)(A,{variant:`primary`,disabled:m||Z||!c.data?.config.enabled||!d||De||f!==d||!Ee||!W.trim(),onClick:()=>{ke()},children:[(0,I.jsx)(b,{className:`size-4`}),s?`开始试运行`:`Start test run`]}),q.error&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(q.error)}),X&&(0,I.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4`,"aria-live":`polite`,children:[(0,I.jsxs)(`p`,{className:`text-sm font-medium`,children:[X.deviceName,` · `,je[X.status]??X.status]}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[X.actions,` `,s?`动作`:`actions`,` · `,X.modelRequests,` `,s?`模型请求`:`model requests`,` · `,X.verified?s?`界面条件已验证`:`UI condition verified`:s?`尚未验证完成`:`Completion unverified`]}),X.message&&(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:X.message}),(X.errorCode||X.stopReason)&&(0,I.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:X.errorCode??X.stopReason}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(A,{disabled:m||!Z,onClick:()=>{$(`pause`)},children:s?`暂停`:`Pause`}),(0,I.jsx)(A,{disabled:m||![`paused`,`needs_user`].includes(X.status),onClick:()=>{$(`resume`)},children:s?`恢复`:`Resume`}),(0,I.jsx)(A,{disabled:m||[`closed`,`cancelled`].includes(X.status),onClick:()=>{$(`cancel`)},children:s?`停止`:`Stop`}),(0,I.jsx)(A,{disabled:m,onClick:()=>{$(`close`)},children:s?`释放手机`:`Release phone`}),X.status===`ready`&&!X.mock&&(0,I.jsx)(A,{disabled:m,onClick:()=>{Q(async()=>{await N(`/sessions/${K}/execute`,{op:`run`,goal:W,...G?{expectText:G}:{}}),await q.mutate()})},children:s?`继续当前目标`:`Continue goal`})]}),X.facts?.length?(0,I.jsxs)(`details`,{children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:s?`本次观察到的界面文字`:`Observed UI text`}),(0,I.jsx)(`ul`,{className:`mt-2 max-h-52 space-y-1 overflow-auto text-xs text-fg-muted`,children:X.facts.map((e,t)=>(0,I.jsx)(`li`,{className:`break-words`,children:e},t))})]}):null]})]})]},K),ge&&(0,I.jsx)(pe,{onAdded:()=>{l.mutate()},zh:s,onClose:()=>R(!1),onSelect:e=>{R(!1),U({serial:e.serial,name:e.name,platform:e.platform})}}),H&&(0,I.jsx)(he,{device:H,zh:s,onClose:()=>ve(void 0),onConnected:async()=>{await l.mutate()}}),ye&&c.data&&(0,I.jsx)(_e,{...ye,zh:s,onSave:async()=>{await l.mutate()},onClose:()=>U(void 0)})]})}export{H as PhoneSettingsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,f as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as o}from"./locale-store-BYdvIuPj.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-DlirbHVs.js";import{t as m}from"./app-window-DXFNqt_0.js";import{t as h}from"./chevron-down-ccbiQQz_.js";import{n as g,r as _}from"./popover-select-hRG1EzAY.js";import{n as v,t as y}from"./beta-badge-BnzdzIEl.js";import{t as b}from"./play-kxZvpBg8.js";import{t as x}from"./plus-Q2yW6OE7.js";import{t as S}from"./refresh-cw-BRlGaq2w.js";import{t as C}from"./search-DA7gz22f.js";import{t as w}from"./shield-check-BU58siTV.js";import{t as T}from"./smartphone-DSSsQFqA.js";import{t as E}from"./x-B_N4OPjy.js";import{t as D}from"./cn-0WouolD0.js";import{t as O}from"./skeleton-DzdOeGYz.js";import{i as k}from"./vendor-swr-CdRzEUwF.js";import{t as A}from"./button-C5tRaJxt.js";import{t as j}from"./phone-workspace-store-Cxk2PJZe.js";import{l as ee,m as te,o as ne,r as M,t as re,u as ie}from"./dist-DaFr5KMw.js";import{n as ae,t as oe}from"./global-defaults-api-DXFSI87T.js";import{n as se,t as ce}from"./settings-page-header-CQueaD1Z.js";import{a as le,c as N,i as P,r as ue,s as de}from"./phone-model-picker-MWC_Zh2a.js";import{t as fe}from"./phone-dependencies-card-DJciwZ-7.js";import{n as pe,t as me}from"./phone-model-connection-C3jmc4ma.js";var F=e(t(),1),I=r();function he({device:e,zh:t,onClose:n,onConnected:r}){let[i,a]=(0,F.useState)(!1),[o,l]=(0,F.useState)(e.wireless?.host??``),[m,h]=(0,F.useState)(``),[g,_]=(0,F.useState)(!1),[v,y]=(0,F.useState)(``),b=async()=>{_(!0),y(``);try{await N(`/devices/${e.id}/reconnect`,i?{host:o,port:Number(m)}:{}),await r(),n()}catch(e){y(e instanceof Error?e.message:String(e)),a(!0)}finally{_(!1)}};return(0,I.jsx)(p,{open:!0,onOpenChange:e=>{!e&&!g&&n()},children:(0,I.jsxs)(u,{children:[(0,I.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,I.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(28rem,90dvh)] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5 text-fg`,children:[(0,I.jsxs)(f,{className:`text-base font-semibold`,children:[t?`重新连接手机`:`Reconnect phone`,` · `,e.name]}),(0,I.jsx)(c,{className:`mt-2 text-sm text-fg-muted`,children:t?`开启手机无线调试,并连接 Gateway 所在局域网。重连会保留设备权限,之前的任务需要重新打开。`:`Enable wireless debugging on the Gateway network. Device permissions are preserved; reopen the previous task.`}),(0,I.jsxs)(`form`,{className:`mt-4 flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto`,children:[(0,I.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:i,disabled:g,onChange:e=>a(e.target.checked)}),t?`手动填写当前连接地址`:`Enter current connection address`]}),i&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`label`,{className:`block text-sm`,children:[t?`手机 IP 地址`:`Phone IP address`,(0,I.jsx)(`input`,{className:`mt-1 w-full rounded-lg border border-edge bg-surface-base p-2`,required:!0,value:o,disabled:g,onChange:e=>l(e.target.value.trim())})]}),(0,I.jsxs)(`label`,{className:`block text-sm`,children:[t?`连接端口(无线调试首页)`:`Connection port (Wireless debugging screen)`,(0,I.jsx)(`input`,{className:`mt-1 w-full rounded-lg border border-edge bg-surface-base p-2`,type:`number`,min:1,max:65535,required:!0,value:m,disabled:g,onChange:e=>h(e.target.value)})]})]}),v&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:v})]}),(0,I.jsxs)(`footer`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge pt-4`,children:[(0,I.jsx)(A,{type:`button`,disabled:g,onClick:n,children:t?`取消`:`Cancel`}),(0,I.jsx)(A,{type:`submit`,variant:`primary`,disabled:g,children:g?t?`正在连接…`:`Connecting…`:t?`重新连接`:`Reconnect`})]})]})]})]})})}var L=n();function ge(e){let t=(0,L.c)(31),{deviceId:n,serial:r,platform:i,mode:a,selected:o,onModeChange:s,onSelectedChange:c,disabled:l,zh:u}=e,d=(0,F.useId)(),[f,p]=(0,F.useState)(``),h;t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r?(h=a===`selected`?[`phone-applications`,n??r,i??`android`]:null,t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=h):h=t[4];let g;t[5]!==n||t[6]!==i||t[7]!==r?(g=()=>P(n,r,i),t[5]=n,t[6]=i,t[7]=r,t[8]=g):g=t[8];let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_={revalidateOnFocus:!1,shouldRetryOnError:!1},t[9]=_):_=t[9];let v=k(h,g,_),y;if(t[10]!==v||t[11]!==l||t[12]!==d||t[13]!==a||t[14]!==s||t[15]!==c||t[16]!==f||t[17]!==o||t[18]!==u){let e=f.trim().toLocaleLowerCase(),n=v.data?.filter(t=>`${t.label} ${t.packageName}`.toLocaleLowerCase().includes(e))??[],r=v.data,i=r?o.filter(e=>!r.some(t=>t.packageName===e)):[],h;t[20]!==c||t[21]!==o?(h=e=>c(o.includes(e)?o.filter(t=>t!==e):[...o,e]),t[20]=c,t[21]=o,t[22]=h):h=t[22];let g=h,_=u?`应用权限`:`Application access`,b;t[23]===_?b=t[24]:(b=(0,I.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:_}),t[23]=_,t[24]=b);let x;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`all`,`selected`],t[25]=x):x=t[25];let w;t[26]!==d||t[27]!==a||t[28]!==s||t[29]!==u?(w=(0,I.jsx)(`div`,{className:`grid gap-2`,children:x.map(e=>(0,I.jsxs)(`label`,{className:D(`flex min-h-14 cursor-pointer items-start gap-3 rounded-xl border p-3`,a===e?`border-accent/50 bg-accent-soft`:`border-edge bg-surface-base`),children:[(0,I.jsx)(`input`,{type:`radio`,name:d,value:e,checked:a===e,onChange:()=>s(e),className:`mt-1 size-4 shrink-0 accent-accent`}),(0,I.jsxs)(`span`,{className:`min-w-0`,children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium`,children:e===`all`?u?`允许所有应用`:`Allow all apps`:u?`仅允许所选应用`:`Only selected apps`}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-fg-muted`,children:e===`all`?u?`可在手机上的应用间切换,无需逐个配置。`:`Switch between apps on this phone without individual setup.`:u?`从手机上已安装的应用中选择。`:`Choose from applications installed on the phone.`})]})]},e))}),t[26]=d,t[27]=a,t[28]=s,t[29]=u,t[30]=w):w=t[30],y=(0,I.jsxs)(`fieldset`,{disabled:l,className:`space-y-3`,children:[b,w,a===`selected`?(0,I.jsxs)(`div`,{className:`space-y-2`,"aria-label":u?`选择手机应用`:`Choose phone applications`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,I.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:u?`已选择 ${o.length} 个应用`:`${o.length} apps selected`}),(0,I.jsxs)(A,{variant:`ghost`,className:`gap-1 px-2 py-1 text-xs`,"aria-label":u?`刷新应用列表`:`Refresh applications`,disabled:l||v.isValidating,onClick:()=>{v.mutate()},children:[(0,I.jsx)(S,{className:D(`size-3.5`,v.isValidating&&`animate-spin motion-reduce:animate-none`),"aria-hidden":!0}),u?`刷新`:`Refresh`]})]}),(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(C,{className:`pointer-events-none absolute left-3 top-3 size-4 text-fg-muted`,"aria-hidden":!0}),(0,I.jsx)(`input`,{type:`search`,"aria-label":u?`搜索手机应用`:`Search phone applications`,placeholder:u?`搜索应用`:`Search apps`,value:f,onChange:e=>p(e.target.value),className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm focus-visible:outline-2 focus-visible:outline-accent`})]}),v.error?(0,I.jsxs)(`div`,{role:`alert`,className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:[u?`暂时无法读取应用,请确认手机已连接后重试。之前的选择会保留。`:`Unable to read apps. Check the phone connection and retry. Previous selections are preserved.`,(0,I.jsx)(A,{variant:`ghost`,className:`ml-1 text-accent`,onClick:()=>{v.mutate()},children:u?`重试`:`Retry`})]}):null,!v.data&&!v.error?(0,I.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,I.jsx)(O,{className:`h-10 w-full`}),(0,I.jsx)(O,{className:`h-10 w-full`}),(0,I.jsx)(O,{className:`h-10 w-full`})]}):v.data?(0,I.jsxs)(`div`,{className:`max-h-56 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-base`,"aria-label":u?`可选应用`:`Available applications`,children:[n.map(e=>(0,I.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-3 px-3 py-2 hover:bg-surface-hover`,children:[(0,I.jsx)(m,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-sm`,title:e.label,children:e.label}),e.label!==e.packageName&&v.data.some(t=>t.packageName!==e.packageName&&t.label===e.label)?(0,I.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:e.packageName}):null]}),(0,I.jsx)(`input`,{type:`checkbox`,"aria-label":e.label,checked:o.includes(e.packageName),onChange:()=>g(e.packageName),className:`size-4 shrink-0 accent-accent`})]},e.packageName)),n.length?null:(0,I.jsx)(`p`,{className:`p-4 text-center text-sm text-fg-muted`,children:e?u?`没有找到匹配的应用`:`No matching applications`:u?`这台手机上没有可打开的应用`:`No launchable applications on this phone`})]}):null,i.length?(0,I.jsxs)(`div`,{className:`space-y-1 text-xs text-fg-muted`,children:[(0,I.jsx)(`p`,{children:u?`以下原有选择未在手机上找到,可取消选择。`:`These previous selections are no longer available. You may deselect them.`}),i.map(e=>(0,I.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:!0,onChange:()=>g(e),className:`accent-accent`}),(0,I.jsx)(`span`,{className:`break-all`,children:e})]},e))]}):null,o.length?null:(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:u?`至少选择一个应用后保存。`:`Choose at least one application before saving.`})]}):null]}),t[10]=v,t[11]=l,t[12]=d,t[13]=a,t[14]=s,t[15]=c,t[16]=f,t[17]=o,t[18]=u,t[19]=y}else y=t[19];return y}function R({deviceId:e,value:t,onChange:n,disabled:r,zh:i}){let[a,o]=(0,F.useState)(!1),[s,c]=(0,F.useState)(``);async function l(){o(!0),c(``);try{let t=await N(`/devices/${e}/input-status`);c(t.unicode===`available`?i?`中文输入通道已就绪,具体应用仍需允许粘贴。`:`Unicode input is ready. The app must allow pasting.`:t.unicode===`setup_required`?i?`请在手机依赖中安装或修复 scrcpy server,再重试检测。无需安装手机输入法。`:`Install or repair scrcpy server under phone dependencies, then retry. No phone keyboard installation is needed.`:i?`这台手机暂不支持自动中文输入,请接管后使用手机自带键盘。`:`Automatic Unicode input is unavailable. Take over and use the phone keyboard.`)}catch{c(i?`暂时无法检测,请确认手机连接后重试。`:`Unable to check. Reconnect the phone and retry.`)}finally{o(!1)}}return(0,I.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge bg-surface-base p-3`,children:[(0,I.jsxs)(`label`,{className:`flex min-h-9 cursor-pointer items-center justify-between gap-3 text-sm font-medium`,children:[i?`允许自动输入文字`:`Allow automatic text input`,(0,I.jsx)(`input`,{type:`checkbox`,checked:t===`auto`,disabled:r,onChange:e=>n(e.target.checked?`auto`:`manual`),className:`size-4 accent-accent`})]}),(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:t===`auto`?i?`中文和 Emoji 通过手机剪贴板粘贴,不安装或切换输入法。输入内容可能留在手机剪贴板;不会读取或同步原有剪贴板。`:`Chinese and emoji use the phone clipboard without installing or switching keyboards. Supplied text may remain there; existing clipboard contents are never read or synced.`:i?`Agent 会在需要输入时暂停。请接管手机,使用手机自带键盘输入,完成后交还 Agent。`:`The Agent pauses when text is needed. Take over, type with the phone keyboard, then hand back to the Agent.`}),e?(0,I.jsx)(A,{variant:`ghost`,className:`min-h-9 px-2 text-xs text-accent`,disabled:r||a,onClick:()=>void l(),children:a?i?`正在检测…`:`Checking…`:i?`检测中文输入能力`:`Check Unicode input`}):null,s?(0,I.jsx)(`p`,{role:`status`,className:`text-xs leading-relaxed text-fg-muted`,children:s}):null]})}var z=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,B=`min-h-11 w-full cursor-default rounded-lg px-3 py-2 text-left text-sm outline-none data-[highlighted]:bg-surface-hover data-[highlighted]:ring-2 data-[highlighted]:ring-inset data-[highlighted]:ring-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,V=`space-y-4 rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`;function _e({device:e,serial:t,name:n,platform:r,onSave:i,onClose:a,zh:o}){let m=e?.platform??r,h=m===`harmonyos`,[g,_]=(0,F.useState)(e?.name??n),[v,y]=(0,F.useState)(e?.appAccess??(e?.allowedApps.length?`selected`:`all`)),[b,x]=(0,F.useState)(e?.allowedApps??[]),[S,C]=(0,F.useState)(e?.textInput??(h?`manual`:`auto`)),[w,T]=(0,F.useState)(e?.enabled??!0),[D,O]=(0,F.useState)(!1),[k,j]=(0,F.useState)(``),ee=async()=>{O(!0),j(``);try{let n={name:g,appAccess:v,allowedApps:v===`all`?[]:b,textInput:S,enabled:w};await N(e?`/devices/${e.id}`:`/devices`,e?n:{...n,serial:t,platform:m},e?`PATCH`:`POST`),await i(),a()}catch(e){j(e instanceof Error?e.message:String(e))}finally{O(!1)}};return(0,I.jsx)(p,{open:!0,onOpenChange:e=>{!e&&!D&&a()},children:(0,I.jsxs)(u,{children:[(0,I.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,I.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(44rem,90dvh)] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5 text-fg`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(f,{className:`text-base font-semibold`,children:e?o?`管理手机`:`Manage phone`:o?`添加手机`:`Add phone`}),(0,I.jsx)(c,{className:`mt-1 text-sm text-fg-muted`,children:o?`设备连接在 Gateway 所在电脑。修改权限会停止当前控制。`:`This phone connects to the Gateway host. Changing access stops active control.`})]}),(0,I.jsx)(l,{asChild:!0,children:(0,I.jsx)(A,{variant:`ghost`,disabled:D,"aria-label":o?`关闭`:`Close`,children:(0,I.jsx)(E,{className:`size-4`})})})]}),(0,I.jsxs)(`form`,{className:`mt-5 flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),ee()},children:[(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto pr-1`,children:[(0,I.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[o?`名称`:`Name`,(0,I.jsx)(`input`,{className:z,value:g,maxLength:100,required:!0,onChange:e=>_(e.target.value)})]}),(0,I.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[h?`HDC`:`ADB`,`: `,t]}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:o?`已启用 phone_use 工具的 Agent 可使用这台手机。`:`Agents with the phone_use tool can use this phone.`}),(0,I.jsx)(ge,{deviceId:e?.id,serial:t,platform:m,mode:v,selected:b,onModeChange:y,onSelectedChange:x,zh:o,disabled:D}),h?(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:o?`鸿蒙支持实时投屏和截图回退。手势释放后执行;文字请在手机上输入,完成后交还 Agent。应用列表暂以应用标识显示。`:`HarmonyOS supports live video with snapshot fallback. Gestures execute on release. Type on the phone, then hand back. Apps display bundle identifiers.`}):(0,I.jsx)(R,{deviceId:e?.id,value:S,onChange:C,disabled:D,zh:o}),(0,I.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-3 text-sm`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked)}),o?`允许访问这台手机`:`Enable access to this phone`]}),k&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:k})]}),(0,I.jsxs)(`div`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge pt-4`,children:[(0,I.jsx)(A,{type:`button`,disabled:D,onClick:a,children:o?`取消`:`Cancel`}),(0,I.jsx)(A,{type:`submit`,variant:`primary`,disabled:D||!g.trim()||v===`selected`&&!b.length,children:D?o?`保存中…`:`Saving…`:o?`保存手机`:`Save phone`})]})]})]})]})})}function H(){let[e,t]=i(),n=(t,n=!1)=>e.has(t)?e.get(t)===`1`:n,r=(e,r,i=!1)=>{r!==n(e,i)&&t(t=>{let n=new URLSearchParams(t);return n.set(e,r?`1`:`0`),n})},s=o(e=>e.language)===`zh`,c=k(`phone-settings`,de),l=k(`phone-devices`,le,{refreshInterval:15e3}),u=k(`settings-agent-defaults`,oe),d=u.data?.defaults.models.phoneUse?.primary??``,[f,p]=(0,F.useState)(d);(0,F.useEffect)(()=>{p(d)},[d]);let[m,C]=(0,F.useState)(!1),[E,D]=(0,F.useState)(``),[P,L]=(0,F.useState)(``),[ge,R]=(0,F.useState)(!1),[H,ve]=(0,F.useState)(),[ye,U]=(0,F.useState)(),[be,xe]=(0,F.useState)(``),[W,Se]=(0,F.useState)(``),[G,Ce]=(0,F.useState)(``),[K,we]=(0,F.useState)(()=>sessionStorage.getItem(`phone-settings-session`)??``),q=k(K?[`phone-session`,K]:null,()=>N(`/sessions/${K}`),{refreshInterval:1500}),Te=a(),[J,Y]=(0,F.useState)({}),X=q.data,Z=X?.status===`running`,Ee=be||l.data?.defaultDeviceId||``,De=d===ue,Q=async(e,t)=>{C(!0),D(``),L(``);try{await e(),t&&L(t)}catch(e){D(e instanceof Error?e.message:String(e))}finally{C(!1)}},Oe=async e=>{let t=await oe(),n={...t.defaults.models};e?n.phoneUse={primary:e,fallbacks:[]}:delete n.phoneUse;let r=await ae({...t.defaults,models:n},{scope:`models`,expectedModels:t.defaults.models});await u.mutate(r,!1),p(e)},ke=()=>Q(async()=>{K&&X&&![`closed`,`cancelled`,`failed`,`outcome_unknown`].includes(X.status)&&await N(`/sessions/${K}/execute`,{op:`close`});let e=await N(`/sessions`,{deviceId:Ee,mode:`control`});we(e.id),sessionStorage.setItem(`phone-settings-session`,e.id),await N(`/sessions/${e.id}/execute`,{op:`run`,goal:W,...G?{expectText:G}:{},maxActions:6})}),$=e=>Q(async()=>{await N(`/sessions/${K}/execute`,{op:e}),await q.mutate()}),Ae=async e=>{Y(t=>({...t,[e.id]:{pending:!0,text:s?`正在诊断…`:`Checking…`}}));try{let t=await N(`/devices/${e.id}/diagnostics`,{}),n=s?{device:`已连接`,disconnected:`未连接`,unauthorized:`未授权调试`,offline:`离线`}:{device:`Connected`,disconnected:`Disconnected`,unauthorized:`Debugging not authorized`,offline:`Offline`};Y(r=>({...r,[e.id]:{pending:!1,text:`${s?`诊断结果`:`Diagnostics`}:${n[t.state]??t.state}`}}))}catch(t){Y(n=>({...n,[e.id]:{pending:!1,error:!0,text:t instanceof Error?t.message:String(t)}}))}},je=s?{ready:`就绪`,running:`执行中`,paused:`已暂停`,needs_user:`等待人工处理`,completed:`执行结束`,cancelled:`已停止`,closed:`已关闭`,failed:`执行失败`,outcome_unknown:`结果待核查`}:{},Me=!!(l.data?.devices.length&&l.data.devices.every(e=>e.connection));return(0,I.jsxs)(se,{gap:`gap-6`,className:`max-w-[48rem]`,children:[(0,I.jsx)(ce,{aiSetup:`phone`,title:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[s?`手机控制`:`Phone Use`,(0,I.jsx)(y,{})]}),subtitle:s?`让 AI 帮你操作 Android 和鸿蒙手机。`:`Let AI work with your Android or HarmonyOS phone.`}),E&&(0,I.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-3 text-sm text-danger`,children:E}),P&&(0,I.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:P}),c.error&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(c.error)}),(0,I.jsx)(`section`,{className:V,"aria-label":s?`手机控制设置`:`Phone control settings`,children:(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-surface-inset text-fg-muted`,children:(0,I.jsx)(T,{className:`size-6`,"aria-hidden":!0})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`启用手机控制`:`Enable Phone Use`}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s?`连接与操作在 Gateway 电脑上执行。`:`Connects and runs on your Gateway computer.`})]})]}),c.data?(0,I.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":c.data.config.enabled,"aria-label":s?`启用手机控制`:`Enable Phone Use`,disabled:m||Z,className:`touch-target flex shrink-0 items-center rounded-lg px-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,onClick:()=>{let e=!c.data.config.enabled;Q(async()=>{await N(`/settings`,{...c.data.config,enabled:e},`PATCH`),await c.mutate()})},children:(0,I.jsx)(`span`,{className:`flex h-6 w-11 items-center rounded-full p-0.5 transition-colors motion-reduce:transition-none ${c.data.config.enabled?`bg-accent`:`bg-fg-muted/30`}`,children:(0,I.jsx)(`span`,{className:`size-5 rounded-full bg-white transition-transform motion-reduce:transition-none ${c.data.config.enabled?`translate-x-5`:`translate-x-0`}`})})}):(0,I.jsx)(O,{className:`h-8 w-12`})]})}),(0,I.jsx)(`section`,{className:V,children:(0,I.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,I.jsx)(`span`,{children:s?`默认执行方式`:`Default execution strategy`}),c.data?(0,I.jsxs)(g,{"aria-label":s?`默认执行方式`:`Default execution strategy`,value:c.data.config.executionMode??`collaborative`,disabled:m,onChange:e=>{let t=e.target.value;Q(async()=>{await N(`/settings`,{...c.data.config,executionMode:t},`PATCH`),await c.mutate()})},children:[(0,I.jsx)(_,{value:`collaborative`,children:s?`主 Agent 协作(默认)`:`Main Agent collaboration (default)`}),(0,I.jsx)(_,{value:`direct`,children:s?`直接执行`:`Direct execution`})]}):(0,I.jsx)(O,{className:`h-10 w-full`}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`协作:主 Agent 拆解目标并根据反馈继续。直接执行:手机模型自行规划完整手机任务。修改只影响新任务,聊天可覆盖。`:`Collaboration: the main Agent plans small goals using feedback. Direct: the phone model plans the full phone task. Changes affect new tasks; chats can override.`})]})}),(0,I.jsxs)(`section`,{"aria-label":s?`手机模型配置`:`Phone model configuration`,className:V,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`操作模型`:`Phone model`}),c.data&&(0,I.jsxs)(`label`,{className:`block space-y-2 text-sm`,children:[(0,I.jsx)(`span`,{children:s?`连接保持时间`:`Connection lifetime`}),(0,I.jsxs)(g,{"aria-label":s?`连接保持时间`:`Connection lifetime`,value:String(c.data.config.idleDisconnectMs??0),disabled:m||Z,onChange:e=>{let t=Number(e.target.value);Q(async()=>{await N(`/settings`,{...c.data.config,idleDisconnectMs:t},`PATCH`),await c.mutate()})},children:[(0,I.jsx)(_,{value:`0`,children:s?`保持连接,直到手动断开`:`Keep connected until disconnected`}),[15,30,60].map(e=>(0,I.jsx)(_,{value:String(e*6e4),children:s?`闲置 ${e} 分钟后断开`:`Disconnect after ${e} idle minutes`},e))]}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`任务结束后保留连接;执行任务、人工操作和查看画面期间不计闲置。`:`Tasks finish without disconnecting. Running tasks, manual control and viewing the screen do not count as idle.`})]}),!u.data&&!u.error?(0,I.jsx)(O,{className:`h-20 w-full`}):(0,I.jsx)(me,{value:d,onSelect:p,onSave:Oe,zh:s,disabled:m||Z||!u.data}),u.error&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(u.error)}),(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:(0,I.jsx)(A,{variant:`ghost`,className:`px-0 text-accent-fg hover:bg-transparent hover:underline`,disabled:m||!f||f===`phone-mock/settings-about`,onClick:()=>{Q(async()=>{let e=await N(`/models/diagnostics`,{modelRef:f});L(e.mock?s?`模拟适配器可用;此测试不验证真实模型。`:`Mock adapter ready; this does not validate a real model.`:e.groundingVerified?s?`模型连接、动作协议和测试图定位通过;未操作真实手机。`:`Connection, protocol and test-image grounding passed. No phone was operated.`:s?`动作协议有效,但测试图定位未通过。`:`Protocol valid, but test-image grounding did not pass.`)})},children:s?`测试模型连接`:`Test model connection`})}),(0,I.jsxs)(`details`,{open:n(`privacy`),onToggle:e=>r(`privacy`,e.currentTarget.open),className:`group border-t border-edge-subtle pt-1 text-xs text-fg-muted`,children:[(0,I.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 [&::-webkit-details-marker]:hidden`,children:[(0,I.jsx)(w,{className:`size-4`,"aria-hidden":!0}),s?`隐私与执行限制`:`Privacy & execution limits`,(0,I.jsx)(h,{className:`ml-auto size-4 group-open:rotate-180`,"aria-hidden":!0})]}),(0,I.jsxs)(`div`,{className:`space-y-3 pb-2 leading-relaxed`,children:[(0,I.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:s?`手机截图会发送给所选模型;页面摘要可能进入聊天模型。`:`Phone screenshots go to the selected model; page summaries may reach the chat model.`}),` `,c.data&&(0,I.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[s?`每次小目标最多 12 步、${c.data.config.maxOperationDurationMs/1e3} 秒活跃执行时间;会话限制`:`Each goal: up to 12 actions / ${c.data.config.maxOperationDurationMs/1e3} active seconds. Session limits`,`: `,c.data.config.maxActionsPerSession,` `,s?`动作`:`actions`,` · `,c.data.config.maxModelRequests,` `,s?`模型请求`:`model requests`]}),(0,I.jsx)(`p`,{children:s?`远程浏览器无法访问你本机的 USB 设备。`:`A remote browser cannot access your local USB devices.`})]})]})]}),(0,I.jsxs)(`section`,{className:`space-y-3`,"aria-label":s?`手机管理`:`Phone management`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`手机管理`:`Phones`}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(A,{variant:`ghost`,disabled:m,onClick:()=>R(!0),children:[(0,I.jsx)(x,{className:`size-4`,"aria-hidden":!0}),s?`添加手机`:`Add phone`]}),(0,I.jsxs)(A,{variant:`ghost`,disabled:m||l.isValidating,onClick:()=>{Q(()=>l.mutate())},children:[(0,I.jsx)(S,{className:`size-4`,"aria-hidden":!0}),s?`刷新`:`Refresh`]})]})]}),!l.data&&!l.error?(0,I.jsx)(O,{className:`h-32 w-full rounded-xl`}):(0,I.jsxs)(`div`,{className:V,children:[(l.error||!Me&&l.data?.diagnostic)&&(0,I.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[l.data?.diagnostic??String(l.error),` · `,s?`检查 Gateway 电脑的调试工具与 USB 连接。`:`Check debugging tools and USB on the Gateway host.`]}),l.data?.devices.map(e=>(0,I.jsxs)(`div`,{className:`border-b border-edge-subtle pb-4 last:border-b-0 last:pb-0`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col items-start justify-between gap-3 sm:flex-row sm:gap-4`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,I.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-fg-muted`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`p`,{className:`break-words text-sm font-medium`,children:[e.name,e.id===l.data?.defaultDeviceId&&(0,I.jsx)(`span`,{className:`ml-2 inline-block rounded-md bg-surface-inset px-2 py-0.5 text-xs font-normal text-fg-muted`,children:s?`默认`:`Default`})]}),(0,I.jsxs)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:[e.platform===`harmonyos`?`HarmonyOS · HDC · USB · `:e.connection?`${s?`阿里云`:`Alibaba Cloud`} · ADB · `:``,e.serial,` · `,e.enabled?e.connection?s?`已配置 · 按需连接`:`Configured · Connects on demand`:{device:s?`已连接`:`Connected`,offline:s?`离线`:`Offline`,unauthorized:s?`待授权`:`Unauthorized`}[l.data?.discovery.find(t=>t.serial===e.serial&&(t.platform??`android`)===(e.platform??`android`))?.state??``]??(s?`未连接`:`Disconnected`):s?`已禁用`:`Disabled`]})]})]}),(0,I.jsxs)(`div`,{className:`flex max-w-full shrink-0 flex-wrap items-center justify-end gap-1 self-end sm:self-start`,children:[(0,I.jsx)(A,{variant:`ghost`,disabled:m,onClick:()=>U({device:e,serial:e.serial,name:e.name}),children:s?`管理`:`Manage`}),(0,I.jsx)(A,{variant:`ghost`,disabled:m||!e.enabled,onClick:()=>{Q(async()=>{await N(`/devices/${e.id}/view`,{}),window.dispatchEvent(new Event(`phone-connections-changed`)),j.getState().show(e.id)})},children:s?`查看屏幕`:`View screen`}),(0,I.jsx)(A,{variant:`ghost`,disabled:m||!e.enabled,onClick:()=>{Q(async()=>{let t=await N(`/devices/${e.id}/conversations`,{});window.dispatchEvent(new Event(`session-created`)),j.getState().hide(),Te(`/chat/${t.conversationId}`)})},children:s?`对话控制手机`:`Control in chat`}),(0,I.jsxs)(ee,{modal:!1,children:[(0,I.jsx)(te,{asChild:!0,children:(0,I.jsxs)(A,{variant:`ghost`,disabled:m,"aria-label":s?`${e.name}的更多操作`:`More actions for ${e.name}`,children:[s?`更多`:`More`,(0,I.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,I.jsx)(ne,{children:(0,I.jsxs)(re,{align:`end`,sideOffset:6,collisionPadding:12,className:`z-[90] min-w-40 max-w-[calc(100vw-1.5rem)] rounded-xl border border-edge bg-surface-overlay p-1 text-fg shadow-popover`,children:[e.wireless&&(0,I.jsx)(M,{disabled:m||!e.enabled,className:B,onSelect:()=>ve(e),children:s?`重新连接`:`Reconnect`}),(0,I.jsx)(M,{disabled:m||J[e.id]?.pending,className:B,onSelect:()=>{Ae(e)},children:e.connection?s?`连接诊断`:`Connect & diagnose`:s?`诊断`:`Diagnose`}),e.id!==l.data?.defaultDeviceId&&(0,I.jsx)(M,{disabled:m,className:B,onSelect:()=>{Q(async()=>{await N(`/devices/${e.id}/default`,{}),await l.mutate()})},children:s?`设为默认`:`Set default`}),(0,I.jsx)(ie,{className:`my-1 border-t border-edge-subtle`}),(0,I.jsx)(M,{disabled:m,className:`${B} text-danger`,onSelect:()=>{Q(async()=>{await N(`/devices/${e.id}`,void 0,`DELETE`),await l.mutate()})},children:s?`移除连接`:`Remove connection`})]})})]})]})]}),(0,I.jsx)(`p`,{role:`status`,"aria-live":`polite`,title:J[e.id]?.text,className:`h-5 truncate text-xs leading-5 ${J[e.id]?.error?`text-danger`:`text-fg-muted`}`,children:J[e.id]?.text})]},e.id)),l.data?.discovery.filter(e=>!l.data?.devices.some(t=>t.serial===e.serial&&(t.platform??`android`)===(e.platform??`android`))).map(e=>(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`text-sm`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.platform===`harmonyos`?`HarmonyOS · USB`:e.emulator?s?`Android 模拟器`:`Android emulator`:`Android`,` · `,e.state]})]}),(0,I.jsx)(A,{disabled:m||e.state!==`device`,onClick:()=>U({serial:e.serial,name:e.name,platform:e.platform}),children:s?`添加手机`:`Add phone`})]},`${e.platform??`android`}:${e.serial}`)),!l.data?.devices.length&&!l.data?.discovery.length&&(0,I.jsx)(`p`,{className:`py-3 text-sm text-fg-muted`,children:s?`尚未发现设备。先启动 Android 模拟器,或通过 USB 连接手机并允许调试。`:`No devices found. Start an Android emulator, or connect a phone over USB and authorize debugging.`})]})]}),(0,I.jsx)(fe,{expanded:n(`components`),onExpandedChange:e=>r(`components`,e),cloudOnly:Me,onChanged:()=>{l.mutate(),c.mutate()}}),(0,I.jsxs)(`details`,{open:n(`test`,!!K),onToggle:e=>r(`test`,e.currentTarget.open,!!K),className:`group rounded-2xl border border-edge bg-surface-panel`,"aria-label":s?`手机试运行`:`Phone test run`,children:[(0,I.jsxs)(`summary`,{className:`flex min-h-16 cursor-pointer list-none items-center gap-3 p-5 [&::-webkit-details-marker]:hidden`,children:[(0,I.jsx)(v,{className:`size-5 text-fg-muted`,"aria-hidden":!0}),(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:s?`试运行`:`Test run`}),(0,I.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:s?`验证手机操作`:`Try a task`}),(0,I.jsx)(h,{className:`size-4 shrink-0 text-fg-muted group-open:rotate-180`,"aria-hidden":!0})]}),(0,I.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle p-5`,children:[(0,I.jsxs)(g,{"aria-label":s?`测试手机`:`Test phone`,value:Ee,disabled:m||Z,onChange:e=>xe(e.target.value),children:[(0,I.jsx)(_,{value:``,children:s?`选择手机`:`Choose phone`}),l.data?.devices.filter(e=>e.enabled).map(e=>(0,I.jsx)(_,{value:e.id,children:e.name},e.id))]}),(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[s?`本次授权的小目标`:`Authorized goal`,(0,I.jsx)(`textarea`,{className:z,value:W,maxLength:2e3,onChange:e=>Se(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[s?`完成时应显示的文字(可选)`:`Expected completion text (optional)`,(0,I.jsx)(`input`,{className:z,value:G,maxLength:200,onChange:e=>Ce(e.target.value)})]}),(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:s?`先手动打开允许的应用。模型说完成只表示执行结束,只有匹配界面证据才会显示验证通过。`:`First open an allowed app manually. A model completion claim remains unverified until native UI evidence matches.`})]}),(0,I.jsxs)(A,{variant:`primary`,disabled:m||Z||!c.data?.config.enabled||!d||De||f!==d||!Ee||!W.trim(),onClick:()=>{ke()},children:[(0,I.jsx)(b,{className:`size-4`}),s?`开始试运行`:`Start test run`]}),q.error&&(0,I.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(q.error)}),X&&(0,I.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4`,"aria-live":`polite`,children:[(0,I.jsxs)(`p`,{className:`text-sm font-medium`,children:[X.deviceName,` · `,je[X.status]??X.status]}),(0,I.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[X.actions,` `,s?`动作`:`actions`,` · `,X.modelRequests,` `,s?`模型请求`:`model requests`,` · `,X.verified?s?`界面条件已验证`:`UI condition verified`:s?`尚未验证完成`:`Completion unverified`]}),X.message&&(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:X.message}),(X.errorCode||X.stopReason)&&(0,I.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:X.errorCode??X.stopReason}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(A,{disabled:m||!Z,onClick:()=>{$(`pause`)},children:s?`暂停`:`Pause`}),(0,I.jsx)(A,{disabled:m||![`paused`,`needs_user`].includes(X.status),onClick:()=>{$(`resume`)},children:s?`恢复`:`Resume`}),(0,I.jsx)(A,{disabled:m||[`closed`,`cancelled`].includes(X.status),onClick:()=>{$(`cancel`)},children:s?`停止`:`Stop`}),(0,I.jsx)(A,{disabled:m,onClick:()=>{$(`close`)},children:s?`释放手机`:`Release phone`}),X.status===`ready`&&!X.mock&&(0,I.jsx)(A,{disabled:m,onClick:()=>{Q(async()=>{await N(`/sessions/${K}/execute`,{op:`run`,goal:W,...G?{expectText:G}:{}}),await q.mutate()})},children:s?`继续当前目标`:`Continue goal`})]}),X.facts?.length?(0,I.jsxs)(`details`,{children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:s?`本次观察到的界面文字`:`Observed UI text`}),(0,I.jsx)(`ul`,{className:`mt-2 max-h-52 space-y-1 overflow-auto text-xs text-fg-muted`,children:X.facts.map((e,t)=>(0,I.jsx)(`li`,{className:`break-words`,children:e},t))})]}):null]})]})]},K),ge&&(0,I.jsx)(pe,{onAdded:()=>{l.mutate()},zh:s,onClose:()=>R(!1),onSelect:e=>{R(!1),U({serial:e.serial,name:e.name,platform:e.platform})}}),H&&(0,I.jsx)(he,{device:H,zh:s,onClose:()=>ve(void 0),onConnected:async()=>{await l.mutate()}}),ye&&c.data&&(0,I.jsx)(_e,{...ye,zh:s,onSave:async()=>{await l.mutate()},onClose:()=>U(void 0)})]})}export{H as PhoneSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-BYdvIuPj.js";var t=e(e=>({activation:0,open:!1,selected:null,controlConversationId:null,displayMode:`docked`,position:null,floatingWidth:288,setFloatingWidth:t=>e({floatingWidth:t}),setDisplayMode:t=>e({displayMode:t}),setPosition:t=>e(e=>e.position?.x===t.x&&e.position?.y===t.y?e:{position:t}),show:(t,n=!0,r)=>e(e=>({activation:e.activation+ +!!n,selected:n||!e.selected?t??e.selected:e.selected,open:n||e.open,controlConversationId:n||!e.open?r??(t===void 0||t===e.selected?e.controlConversationId:null):e.controlConversationId})),hide:()=>e({open:!1})}));export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as a,n as o,o as ee}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as a,n as o,o as ee}from"./locale-store-BYdvIuPj.js";import{a as te,i as ne,n as s,o as re,r as ie,s as ae,t as c}from"./dist-DlirbHVs.js";import{t as l}from"./package-wATCyihJ.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./skeleton-DzdOeGYz.js";import{a as f,i as p}from"./vendor-swr-CdRzEUwF.js";import{t as m}from"./button-C5tRaJxt.js";import{t as h}from"./connection-usage-guide-CydSRk3h.js";import{r as g,t as _}from"./agent-plugin-dialog-Bhkawcil.js";import{n as oe}from"./capability-links-MZdYfPKx.js";import{t as se}from"./capability-icon-CmvCZOJX.js";import{n as ce,t as v}from"./plugin-presentation-CO5BFDGW.js";var le=n(),y=e(t(),1),b=r();function x(e){let t=(0,le.c)(63),{pluginId:n,initialConnect:r,onClose:x}=e,S=r!==void 0&&r,C=o(ue).startsWith(`zh`),{mutate:w}=f(),[de,T]=(0,y.useState)(!1),E=(0,y.useRef)(document.activeElement instanceof HTMLElement?document.activeElement:null),D;t[0]===n?D=t[1]:(D=async()=>{let e=await ee(a(`/api/extensions/agent-plugins/${encodeURIComponent(n)}`));if(!e.ok)throw Error(e.error??`Plugin not found`);return e.payload},t[0]=n,t[1]=D);let O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O={revalidateOnFocus:!0},t[2]=O):O=t[2];let{data:k,error:A,mutate:j}=p(`plugin-details:${n}`,D,O),M=k?ce(k,C):C?`插件详情`:`Plugin details`,N=k?.localizations?.[C?`zh-CN`:`en`]?.description??k?.description;if(de&&k){let e;t[3]!==j||t[4]!==T?(e=()=>{T(!1),j()},t[3]=j,t[4]=T,t[5]=e):e=t[5];let n;return t[6]!==k||t[7]!==x||t[8]!==e?(n=(0,b.jsx)(_,{extension:k,onUninstalled:x,onClose:e}),t[6]=k,t[7]=x,t[8]=e,t[9]=n):n=t[9],n}let P;t[10]===x?P=t[11]:(P=e=>{e||x()},t[10]=x,t[11]=P);let F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,b.jsx)(te,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[12]=F):F=t[12];let I;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{E.current?.isConnected&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},t[13]=I):I=t[13];let L=k?.branding?.iconUrl,R;t[14]===L?R=t[15]:(R=(0,b.jsx)(se,{iconUrl:L,fallback:l}),t[14]=L,t[15]=R);let z;t[16]===M?z=t[17]:(z=(0,b.jsx)(ae,{className:`truncate text-base font-semibold text-fg`,children:M}),t[16]=M,t[17]=z);let B;t[18]===k?B=t[19]:(B=k?(0,b.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[k.version,` · `,k.name]}):null,t[18]=k,t[19]=B);let V;t[20]!==B||t[21]!==z?(V=(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[z,B]}),t[20]=B,t[21]=z,t[22]=V):V=t[22];let H=C?`关闭插件详情`:`Close plugin details`,U;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,b.jsx)(u,{className:`size-5`,"aria-hidden":!0}),t[23]=U):U=t[23];let W;t[24]===H?W=t[25]:(W=(0,b.jsx)(s,{asChild:!0,children:(0,b.jsx)(m,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":H,children:U})}),t[24]=H,t[25]=W);let G;t[26]!==V||t[27]!==W||t[28]!==R?(G=(0,b.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-5 py-4`,children:[R,V,W]}),t[26]=V,t[27]=W,t[28]=R,t[29]=G):G=t[29];let K=C?`查看插件能力、管理账号连接与授权。关闭后返回原来的列表。`:`View plugin capabilities and manage account connections. Close to return to the list.`,q;t[30]===K?q=t[31]:(q=(0,b.jsx)(ne,{className:`sr-only`,children:K}),t[30]=K,t[31]=q);let J;t[32]!==k||t[33]!==N||t[34]!==A||t[35]!==S||t[36]!==w||t[37]!==M||t[38]!==x||t[39]!==n||t[40]!==j||t[41]!==C?(J=(0,b.jsx)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:A?(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:String(A)}):k?(0,b.jsxs)(b.Fragment,{children:[N?(0,b.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:N}):null,(0,b.jsx)(g,{initialConnect:S,extension:k,zh:C,onChanged:async()=>{await j(),await w(`gateway-extensions-list`)}},n),v(k)?(0,b.jsx)(h,{target:{kind:`plugin`,id:n,name:M},showAction:!1,onStart:x}):null,k.components?.skills.length?(0,b.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-medium`,children:C?`技能(${k.components.skills.length})`:`Skills (${k.components.skills.length})`}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.components.skills.map(e=>(0,b.jsx)(i,{onClick:x,to:`/capabilities/skills?${new URLSearchParams({tab:`installed`,source:`plugin`,q:k.dialect===`portable`?e.name:`${n}.${e.name}`})}`,className:`max-w-full break-words rounded-lg border border-edge px-3 py-2 text-sm text-accent hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.name},e.name))})]}):null]}):(0,b.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,b.jsx)(d,{className:`h-14 w-full`}),(0,b.jsx)(d,{className:`h-28 w-full`}),(0,b.jsx)(d,{className:`h-40 w-full`})]})}),t[32]=k,t[33]=N,t[34]=A,t[35]=S,t[36]=w,t[37]=M,t[38]=x,t[39]=n,t[40]=j,t[41]=C,t[42]=J):J=t[42];let Y;t[43]!==k||t[44]!==T||t[45]!==C?(Y=k?(0,b.jsx)(m,{variant:`ghost`,onClick:()=>T(!0),children:C?`管理插件`:`Manage plugin`}):(0,b.jsx)(`span`,{}),t[43]=k,t[44]=T,t[45]=C,t[46]=Y):Y=t[46];let X;t[47]!==k||t[48]!==M||t[49]!==n||t[50]!==C?(X=k&&v(k)?(0,b.jsx)(m,{asChild:!0,children:(0,b.jsx)(i,{to:oe(M,C,n),children:C?`开始使用`:`Start using`})}):(0,b.jsx)(s,{asChild:!0,children:(0,b.jsx)(m,{variant:`secondary`,children:C?`完成`:`Done`})}),t[47]=k,t[48]=M,t[49]=n,t[50]=C,t[51]=X):X=t[51];let Z;t[52]!==Y||t[53]!==X?(Z=(0,b.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[Y,X]}),t[52]=Y,t[53]=X,t[54]=Z):Z=t[54];let Q;t[55]!==G||t[56]!==q||t[57]!==J||t[58]!==Z?(Q=(0,b.jsxs)(re,{children:[F,(0,b.jsxs)(ie,{onCloseAutoFocus:I,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(42rem,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-popover`,children:[G,q,J,Z]})]}),t[55]=G,t[56]=q,t[57]=J,t[58]=Z,t[59]=Q):Q=t[59];let $;return t[60]!==Q||t[61]!==P?($=(0,b.jsx)(c,{open:!0,onOpenChange:P,children:Q}),t[60]=Q,t[61]=P,t[62]=$):$=t[62],$}function ue(e){return e.language}export{x as PluginDetailsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n,p as r}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n,p as r}from"./locale-store-BYdvIuPj.js";import{t as i}from"./messages-lc5BjBtX.js";import{n as a,r as o}from"./popover-select-hRG1EzAY.js";import{t as s}from"./cn-0WouolD0.js";import{t as c}from"./middleware-Pd0e8Igk.js";import{o as l}from"./form-field-width-DJw_jULe.js";import{i as u}from"./theme-store-nXIuAiQZ.js";var d=e(),f=[`compact`,`default`,`large`];function p(e){document.documentElement.dataset.fontScale=e}function m(){try{let e=localStorage.getItem(`xopc-web-font-scale`),t=`default`;if(e){let n=JSON.parse(e).state?.preference;n&&f.includes(n)&&(t=n)}p(t)}catch{p(`default`)}}var h=r(c(e=>({preference:`default`,setPreference:t=>{p(t),e({preference:t})}}),{name:`xopc-web-font-scale`}));function g(){p(h.getState().preference)}var _=t(),v=[`language`,`theme`,`font`];function y(e){let t=(0,d.c)(59),{variant:r,sections:c}=e,f=c===void 0?v:c,p=n(T),m=n(w),g=u(C),y=u(S),E=h(x),D=h(b),O;t[0]===p?O=t[1]:(O=i(p),t[0]=p,t[1]=O);let k=O.appearanceSettings,A=r===`page`?`w-full max-w-[min(100%,12rem)] shrink-0 sm:ml-auto sm:w-auto sm:max-w-[11rem]`:r===`toolbar`?`w-auto min-w-[6.5rem] max-w-[10rem] shrink-0 sm:min-w-[7.5rem]`:`w-full`,j;t[2]===A?j=t[3]:(j=s(l,A),t[2]=A,t[3]=j);let M=j,N=r===`page`?`flex flex-col gap-2 border-b border-edge-subtle px-4 py-3.5 last:border-b-0 sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:px-5 sm:py-4`:`flex flex-col gap-1.5`,P;t[4]===f?P=t[5]:(P=e=>f.includes(e),t[4]=f,t[5]=P);let F=P;if(r===`toolbar`){let e;t[6]!==k||t[7]!==p||t[8]!==M||t[9]!==m||t[10]!==F?(e=F(`language`)?(0,_.jsxs)(a,{className:M,value:p,"aria-label":k.languageTitle,onChange:e=>m(e.target.value),children:[(0,_.jsx)(o,{value:`en`,children:k.langOptionEn}),(0,_.jsx)(o,{value:`zh`,children:k.langOptionZh})]}):null,t[6]=k,t[7]=p,t[8]=M,t[9]=m,t[10]=F,t[11]=e):e=t[11];let n;t[12]!==k||t[13]!==M||t[14]!==y||t[15]!==F||t[16]!==g?(n=F(`theme`)?(0,_.jsxs)(a,{className:M,value:g,"aria-label":k.themeTitle,onChange:e=>y(e.target.value),children:[(0,_.jsx)(o,{value:`light`,children:k.themeOptionLight}),(0,_.jsx)(o,{value:`dark`,children:k.themeOptionDark}),(0,_.jsx)(o,{value:`system`,children:k.themeOptionSystem})]}):null,t[12]=k,t[13]=M,t[14]=y,t[15]=F,t[16]=g,t[17]=n):n=t[17];let r;t[18]!==k||t[19]!==E||t[20]!==M||t[21]!==D||t[22]!==F?(r=F(`font`)?(0,_.jsxs)(a,{className:M,value:E,"aria-label":k.fontScaleTitle,onChange:e=>D(e.target.value),children:[(0,_.jsx)(o,{value:`compact`,children:k.fontScaleCompact}),(0,_.jsx)(o,{value:`default`,children:k.fontScaleDefault}),(0,_.jsx)(o,{value:`large`,children:k.fontScaleLarge})]}):null,t[18]=k,t[19]=E,t[20]=M,t[21]=D,t[22]=F,t[23]=r):r=t[23];let i;return t[24]!==e||t[25]!==n||t[26]!==r?(i=(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e,n,r]}),t[24]=e,t[25]=n,t[26]=r,t[27]=i):i=t[27],i}let I=r===`sidebar`&&`flex flex-col gap-4`,L;t[28]===I?L=t[29]:(L=s(I),t[28]=I,t[29]=L);let R;t[30]!==k||t[31]!==p||t[32]!==N||t[33]!==M||t[34]!==m||t[35]!==F||t[36]!==r?(R=F(`language`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.languageTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.languageDescription})]}),(0,_.jsxs)(a,{className:M,value:p,"aria-label":k.languageTitle,onChange:e=>m(e.target.value),children:[(0,_.jsx)(o,{value:`en`,children:k.langOptionEn}),(0,_.jsx)(o,{value:`zh`,children:k.langOptionZh})]})]}):null,t[30]=k,t[31]=p,t[32]=N,t[33]=M,t[34]=m,t[35]=F,t[36]=r,t[37]=R):R=t[37];let z;t[38]!==k||t[39]!==N||t[40]!==M||t[41]!==y||t[42]!==F||t[43]!==g||t[44]!==r?(z=F(`theme`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.themeTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.themeDescription})]}),(0,_.jsxs)(a,{className:M,value:g,"aria-label":k.themeTitle,onChange:e=>y(e.target.value),children:[(0,_.jsx)(o,{value:`light`,children:k.themeOptionLight}),(0,_.jsx)(o,{value:`dark`,children:k.themeOptionDark}),(0,_.jsx)(o,{value:`system`,children:k.themeOptionSystem})]})]}):null,t[38]=k,t[39]=N,t[40]=M,t[41]=y,t[42]=F,t[43]=g,t[44]=r,t[45]=z):z=t[45];let B;t[46]!==k||t[47]!==E||t[48]!==N||t[49]!==M||t[50]!==D||t[51]!==F||t[52]!==r?(B=F(`font`)?(0,_.jsxs)(`div`,{className:N,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:k.fontScaleTitle}),r===`page`?null:(0,_.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:k.fontScaleDescription})]}),(0,_.jsxs)(a,{className:M,value:E,"aria-label":k.fontScaleTitle,onChange:e=>D(e.target.value),children:[(0,_.jsx)(o,{value:`compact`,children:k.fontScaleCompact}),(0,_.jsx)(o,{value:`default`,children:k.fontScaleDefault}),(0,_.jsx)(o,{value:`large`,children:k.fontScaleLarge})]})]}):null,t[46]=k,t[47]=E,t[48]=N,t[49]=M,t[50]=D,t[51]=F,t[52]=r,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==L||t[56]!==R||t[57]!==z?(V=(0,_.jsxs)(`div`,{className:L,children:[R,z,B]}),t[54]=B,t[55]=L,t[56]=R,t[57]=z,t[58]=V):V=t[58],V}function b(e){return e.setPreference}function x(e){return e.preference}function S(e){return e.setPreference}function C(e){return e.preference}function w(e){return e.setLanguage}function T(e){return e.language}export{h as i,m as n,g as r,y as t};
|
package/dist/gateway/static/root/assets/{preview-runtime-D8kxmrLV.js → preview-runtime-iJuVSugF.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/source-workspace-editor-BwYU5OEh.js","assets/vendor-react-BOUWij0V.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/languages-kF11aUYU.js","assets/binary-plugins-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{a,i as o,l as s}from"./locale-store-5DzxIIeq.js";import{t as c}from"./messages-CGGOcV9B.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{K as u,t as d}from"./markdown-view-BwbjZnQ6.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./rotate-cw-LIg3Am9S.js";import{t as m}from"./search-DA7gz22f.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-DzdOeGYz.js";import{r as _}from"./turn-outcome-BSbEJx8h.js";import{a as v,c as y,o as b,r as x,t as S}from"./attachment-utils-core-BPYdUI6y.js";import{n as C}from"./electron-env-DHOGevH3.js";import{t as w}from"./use-async-resource-BHFGZCY2.js";import{a as T,c as E,d as D,m as O,n as k,r as ee,u as A}from"./workspace-api-Bpq_rBZM.js";import{t as j}from"./index.module-Cd9ENXfk.js";var M=l(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]),N=l(`step-back`,[[`path`,{d:`M13.971 4.285A2 2 0 0 1 17 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`19qhus`}],[`path`,{d:`M21 20V4`,key:`cb8qj8`}]]),P=5*1024*1024,F=32*1024*1024,I=new Set(`.astro,.bat,.c,.cc,.clj,.cljs,.cljc,.cmd,.cpp,.cs,.cts,.cxx,.dart,.edn,.erl,.ex,.exs,.fish,.fs,.fsx,.go,.gql,.graphql,.groovy,.h,.hh,.hpp,.hrl,.hxx,.java,.ts,.tsx,.mts,.js,.jsx,.mjs,.cjs,.css,.scss,.sass,.less,.json,.jsonc,.json5,.yml,.yaml,.xml,.xsd,.xsl,.py,.pyw,.rb,.php,.rs,.kt,.kts,.scala,.swift,.m,.mm,.sh,.bash,.zsh,.ps1,.sql,.lua,.r,.pl,.pm,.sol,.tf,.tfvars,.nix,.proto,.vue,.svelte,.toml,.ini,.cfg,.conf,.properties`.split(`,`)),L=new Set([`.txt`,`.log`,`.lock`,`.csv`,`.tsv`,`.env`,`.gitignore`,`.gitattributes`,`.editorconfig`,`.npmrc`,`.dockerignore`,`.eslintignore`,`.prettierignore`,`.stylelintignore`]),R=new Set([`dockerfile`,`gemfile`,`jenkinsfile`,`makefile`,`procfile`,`rakefile`]),z=new Set([`brewfile`,`changelog`,`codeowners`,`license`,`readme`]),te=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.ico`,`.svg`,`.svgz`,`.tif`,`.tiff`,`.avif`,`.heic`,`.heif`,`.jxl`]),B=new Set([`.mp3`,`.wav`,`.ogg`,`.oga`,`.aac`,`.m4a`,`.flac`,`.opus`,`.weba`]),V=new Set([`.mp4`,`.webm`,`.mov`,`.m4v`,`.ogv`]),ne=new Set([`.zip`]),H=new Map([[`.pdf`,`application/pdf`],[`.docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`.pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`.xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`.xls`,`application/vnd.ms-excel`],[`.md`,`text/markdown`],[`.markdown`,`text/markdown`],[`.html`,`text/html`],[`.htm`,`text/html`],[`.json`,`application/json`],[`.txt`,`text/plain`],[`.csv`,`text/csv`],[`.tsv`,`text/tab-separated-values`],[`.png`,`image/png`],[`.jpg`,`image/jpeg`],[`.jpeg`,`image/jpeg`],[`.gif`,`image/gif`],[`.webp`,`image/webp`],[`.svg`,`image/svg+xml`],[`.svgz`,`image/svg+xml`],[`.mp3`,`audio/mpeg`],[`.wav`,`audio/wav`],[`.ogg`,`audio/ogg`],[`.mp4`,`video/mp4`],[`.webm`,`video/webm`],[`.mov`,`video/quicktime`],[`.zip`,`application/zip`]]);function U(e){let t=W(e),n=t.lastIndexOf(`.`);return n<0||n===t.length-1?``:t.slice(n).toLowerCase()}function W(e){let t=e.replace(/\\/g,`/`).split(`/`);return t[t.length-1]||e}function re(e,t){let n=t?.split(`;`)[0]?.trim().toLowerCase();return n&&n!==`application/octet-stream`?n:H.get(U(e))??n??`application/octet-stream`}function ie(e,t){let n=U(e),r=W(e).toLowerCase(),i=re(e,t);return i===`text/markdown`||n===`.md`||n===`.markdown`?`markdown`:i===`text/html`||n===`.html`||n===`.htm`?`html`:i===`application/pdf`||n===`.pdf`?`pdf`:i===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n===`.docx`?`docx`:i===`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`||i===`application/vnd.ms-excel`||n===`.xlsx`||n===`.xls`?`spreadsheet`:i===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n===`.pptx`?`pptx`:i.startsWith(`image/`)||te.has(n)?`image`:i.startsWith(`audio/`)||B.has(n)?`audio`:i.startsWith(`video/`)||V.has(n)?`video`:i===`application/zip`||ne.has(n)?`archive`:I.has(n)||R.has(r)||r.startsWith(`dockerfile.`)?`code`:i.startsWith(`text/`)||L.has(n)||z.has(r)||r.startsWith(`.env.`)||i===`application/json`?`text`:`unsupported`}function ae(e){switch(e){case`text`:case`markdown`:case`code`:case`html`:return`text`;case`unsupported`:return`metadata`;default:return`binary`}}async function G(e){let{uri:t,conversationId:n,taskId:r}=e;try{let e=_(t),i=await a(o(e?`/api/files/${encodeURIComponent(e)}/content`:y(t,n,r)));return i.ok?{ok:!0,blob:await i.blob()}:{ok:!1,reason:`http`,status:i.status}}catch(e){return{ok:!1,reason:`network`,message:e instanceof Error?e.message:String(e)}}}async function oe(e){let t=await G(e);return t.ok?{ok:!0,buffer:await t.blob.arrayBuffer()}:t}var K=n(),q=e(t(),1);function J(e){return e.id?String(e.id):`${e.name}:${e.uri??``}`}function se(){return{id:`__empty__`,context:`attachment`,fileName:``,mimeType:`application/octet-stream`,type:`unsupported`,source:{kind:`inline`}}}function Y(e){let t=(0,K.c)(65),{open:n,attachment:r,authToken:i,conversationId:a,language:o}=e,[s,l]=(0,q.useState)(n?r:null),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(!1),m;t[0]!==r||t[1]!==n?(m=n&&r?J(r):null,t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,g=(0,q.useRef)(h);h!==g.current&&(g.current=h,l(n&&r?r:null),d(!1),p(!1));let _=s,y;bb0:{if(!_){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=se(),t[3]=e):e=t[3],y=e;break bb0}let e=_.name??`attachment`,n,r;t[4]!==e||t[5]!==_.mimeType?(n=re(e,_.mimeType),r=ie(e,n),t[4]=e,t[5]=_.mimeType,t[6]=n,t[7]=r):(n=t[6],r=t[7]);let i=r,o=_.id?String(_.id):`${e}:${_.uri??``}`,s;t[8]!==a||t[9]!==_.uri?(s=_.uri?{kind:`media-uri`,uri:_.uri,conversationId:a}:{kind:`inline`},t[8]=a,t[9]=_.uri,t[10]=s):s=t[10];let c;t[11]!==e||t[12]!==n||t[13]!==_.size||t[14]!==o||t[15]!==s||t[16]!==i?(c={id:o,context:`attachment`,fileName:e,mimeType:n,size:_.size,type:i,source:s},t[11]=e,t[12]=n,t[13]=_.size,t[14]=o,t[15]=s,t[16]=i,t[17]=c):c=t[17],y=c}let b=y,S;t[18]===_?S=t[19]:(S=_?v(_):void 0,t[18]=_,t[19]=S);let C=S,T=_?.uri,E;t[20]===b.type?E=t[21]:(E=ae(b.type),t[20]=b.type,t[21]=E);let D=E,O=!!(n&&T&&!C&&i&&(D===`binary`||D===`text`)),k;t[22]!==a||t[23]!==o||t[24]!==T||t[25]!==_?.taskId?(k=async()=>{let e=c(o).chat,t=await oe({uri:T,conversationId:a,taskId:_?.taskId});if(!t.ok)throw t.reason===`http`?Error(`${e.attachmentPreviewLoadError} (HTTP ${t.status})`):Error(t.message);return t.buffer},t[22]=a,t[23]=o,t[24]=T,t[25]=_?.taskId,t[26]=k):k=t[26];let ee=_?.taskId,A;t[27]!==i||t[28]!==a||t[29]!==C||t[30]!==o||t[31]!==T||t[32]!==n||t[33]!==D||t[34]!==ee?(A=[n,T,i,o,C,ee,a,D],t[27]=i,t[28]=a,t[29]=C,t[30]=o,t[31]=T,t[32]=n,t[33]=D,t[34]=ee,t[35]=A):A=t[35];let j;t[36]===O?j=t[37]:(j={enabled:O,initial:null,errorData:null},t[36]=O,t[37]=j);let M=w(k,A,j),N;bb1:{if(C)try{let e;t[38]===C?e=t[39]:(e=x(C),t[38]=C,t[39]=e),N=e;break bb1}catch{N=null;break bb1}if(O&&M.loading){N=null;break bb1}N=M.data??null}let P=N,F=D===`binary`?P:null,I=_?.extractedText??``,L;t[40]!==P||t[41]!==I||t[42]!==o||t[43]!==D?(L=D===`text`?I||(P?new TextDecoder(`utf-8`,{fatal:!1}).decode(new Uint8Array(P)):c(o).chat.attachmentPreviewNoText):null,t[40]=P,t[41]=I,t[42]=o,t[43]=D,t[44]=L):L=t[44];let R=L,z=!!_?.extractedText,te=b.type===`pptx`&&I.length>3e5,B;t[45]!==i||t[46]!==C||t[47]!==o||t[48]!==T||t[49]!==n||t[50]!==D?(B=n&&T&&!C&&!i&&D===`binary`?c(o).chat.attachmentPreviewMissingAuth:null,t[45]=i,t[46]=C,t[47]=o,t[48]=T,t[49]=n,t[50]=D,t[51]=B):B=t[51];let V=B,ne=M.error?M.error instanceof Error?M.error.message:String(M.error):null,H=f?null:V??ne,U=O?M.loading:!1,W;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>p(!0),t[52]=W):W=t[52];let G=I||null,Y;return t[53]!==F||t[54]!==b||t[55]!==P||t[56]!==te||t[57]!==z||t[58]!==H||t[59]!==_||t[60]!==u||t[61]!==U||t[62]!==G||t[63]!==R?(Y={preview:_,descriptor:b,fileType:b.type,fileName:b.fileName,loading:U,loadError:H,clearLoadError:W,textContent:R,binaryBuffer:F,downloadBuffer:P,hasExtractedText:z,extractedText:G,extractedTextTruncated:te,showExtractedText:u,setShowExtractedText:d},t[53]=F,t[54]=b,t[55]=P,t[56]=te,t[57]=z,t[58]=H,t[59]=_,t[60]=u,t[61]=U,t[62]=G,t[63]=R,t[64]=Y):Y=t[64],Y}function ce(e){let t=(0,K.c)(12),{projectId:n,conversationId:r,agentId:i}=e,a;bb0:{let e;t[0]===n?e=t[1]:(e=n?.trim(),t[0]=n,t[1]=e);let o=e;if(o){let e;t[2]===o?e=t[3]:(e={projectId:o},t[2]=o,t[3]=e),a=e;break bb0}let s;t[4]===r?s=t[5]:(s=r?.trim(),t[4]=r,t[5]=s);let c=s;if(c){let e;t[6]===c?e=t[7]:(e={conversationId:c},t[6]=c,t[7]=e),a=e;break bb0}let l;t[8]===i?l=t[9]:(l=i?.trim(),t[8]=i,t[9]=l);let u=l,d;t[10]===u?d=t[11]:(d=u?{agentId:u}:void 0,t[10]=u,t[11]=d),a=d}return a}function le(e){return{descriptor:e,textContent:null,binaryBuffer:null,fileResourceId:null,mtimeMs:null,loadError:null,loading:!1,pptxText:null,pptxTruncated:!1,pptxError:null}}function ue(e,t){switch(t.type){case`clear`:return le(t.descriptor);case`loadStart`:return{...le(t.descriptor),loading:!0};case`loadSuccess`:return{...e,descriptor:t.payload.descriptor,textContent:t.payload.textContent??null,binaryBuffer:t.payload.binaryBuffer??null,fileResourceId:t.payload.fileResourceId??null,mtimeMs:t.payload.mtimeMs??null,loadError:null,loading:!1};case`loadError`:return{...le(t.descriptor),loadError:t.error};case`patchMtime`:return{...e,mtimeMs:t.mtimeMs};case`patchText`:return{...e,textContent:t.text};case`pptxClear`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:null};case`pptxSuccess`:return{...e,pptxText:t.text,pptxTruncated:t.truncated,pptxError:null};case`pptxError`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:t.error}}}function de(e,t){switch(t.type){case`reset`:return{sourceEditMode:!1,saveStatus:`idle`};case`source`:return{...e,sourceEditMode:typeof t.value==`function`?t.value(e.sourceEditMode):t.value};case`saveStatus`:return{...e,saveStatus:t.value}}}function fe({filePath:e,projectId:t,conversationId:n,agentId:r,resolvedFile:a,initialEditMode:o=!1}){let s=ce({projectId:t,conversationId:n,agentId:r}),c=(0,q.useMemo)(()=>{let t=e?W(e):``,i=re(t,b(t)),a=e?ie(t,i):`unsupported`;return{id:e||`__empty__`,context:`workspace`,fileName:t,mimeType:i,type:a,source:{kind:`workspace`,path:e||``,conversationId:n,agentId:r}}},[r,e,n]),[l,u]=(0,q.useReducer)(ue,c,le),[d,f]=(0,q.useReducer)(de,{sourceEditMode:o,saveStatus:`idle`}),[p,m]=(0,q.useState)([]),[h,g]=(0,q.useState)([]),_=(0,q.useRef)(e),v=(0,q.useRef)(void 0),y=(0,q.useRef)(null),x=(0,q.useRef)(null),w=(0,q.useRef)(null),[M,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(!1),[I,L]=(0,q.useState)(0);_.current!==e&&(_.current=e,f({type:`reset`})),(0,q.useEffect)(()=>{if(!e){u({type:`clear`,descriptor:c});return}let t=!1;u({type:`loadStart`,descriptor:c});let n=ae(c.type),r=e=>{t||u({type:`loadError`,descriptor:c,error:e instanceof Error?e.message:String(e)})};return n===`metadata`?(Promise.all([D(e,s).catch(()=>null),A(e,s).catch(()=>null)]).then(async([n,r])=>{if(!n){t||u({type:`loadSuccess`,payload:{descriptor:c,fileResourceId:r?.fileId??null,mtimeMs:typeof r?.mtimeMs==`number`?r.mtimeMs:null}});return}let i={...c,mimeType:n.mimeType,type:ie(n.name,n.mimeType)};if(ae(i.type)===`text`){let{content:r,mtimeMs:a,revision:o}=await E(e,s);t||(v.current=o,y.current=r,x.current=r,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:i,textContent:r,fileResourceId:n.id,mtimeMs:typeof a==`number`?a:n.modifiedAt}});return}t||u({type:`loadSuccess`,payload:{descriptor:i,fileResourceId:n.id,mtimeMs:n.modifiedAt}})}).catch(r),()=>{t=!0}):(n===`text`?E(e,s,I===0?a:void 0).then(({content:e,mtimeMs:n,revision:r,fileId:i})=>{t||(v.current=r,y.current=e,x.current=e,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:c,textContent:e,fileResourceId:i??null,mtimeMs:typeof n==`number`?n:null}})}).catch(r):Promise.all([T(e,s),A(e,s).catch(()=>null)]).then(async([e,n])=>{let r=await e.arrayBuffer();t||u({type:`loadSuccess`,payload:{descriptor:c,binaryBuffer:r,fileResourceId:n?.fileId??null,mtimeMs:typeof n?.mtimeMs==`number`?n.mtimeMs:null}})}).catch(r),()=>{t=!0})},[c,e,s,I,a]),(0,q.useEffect)(()=>{if(!l.binaryBuffer||l.descriptor.type!==`pptx`){u({type:`pptxClear`});return}let e=!1;return u({type:`pptxClear`}),i(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(l.binaryBuffer,l.descriptor.fileName)),__vite__mapDeps([0,1,2,3])).then(({extractedText:t})=>{if(e)return;let n=t.length>S;u({type:`pptxSuccess`,text:n?t.slice(0,S):t,truncated:n})}).catch(t=>{e||u({type:`pptxError`,error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type]);let R=(0,q.useCallback)(async()=>{if(w.current&&!await w.current)return!1;if(!e||y.current===null||y.current===x.current)return!0;let t=(async()=>{f({type:`saveStatus`,value:`saving`});try{for(;y.current!==x.current;){let t=y.current,n=await O(e,t,s,v.current);v.current=n.revision,x.current=t,typeof n.mtimeMs==`number`&&u({type:`patchMtime`,mtimeMs:n.mtimeMs})}return N(!1),f({type:`saveStatus`,value:`saved`}),!0}catch{return f({type:`saveStatus`,value:`error`}),!1}})();w.current=t;try{return await t}finally{w.current===t&&(w.current=null)}},[e,s]),z=j(()=>void R(),500),te=(0,q.useCallback)(e=>{y.current=e,N(e!==x.current),u({type:`patchText`,text:e}),z()},[z]);(0,q.useEffect)(()=>{let e=e=>{y.current!==x.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),z.cancel()}},[z]);let B=(0,q.useCallback)(()=>{!M&&!w.current&&L(e=>e+1)},[M]),V=(0,q.useRef)(!1),ne=(0,q.useCallback)(async()=>{if(!(!e||l.loading||w.current||V.current)){V.current=!0;try{let t=await D(e,s);if(!t||!(v.current?t.revision!==v.current:l.mtimeMs!=null&&t.modifiedAt!==l.mtimeMs))return;M||d.sourceEditMode?F(!0):B()}catch{F(!0)}finally{V.current=!1}}},[M,d.sourceEditMode,e,l.loading,l.mtimeMs,s,B]),H=(0,q.useCallback)(async()=>{if(!e)return;let t=W(e);if(l.binaryBuffer){k(t,l.binaryBuffer,l.descriptor.mimeType||`application/octet-stream`);return}if(l.textContent!=null){ee(t,l.textContent);return}let n=await T(e,s);k(t,await n.arrayBuffer(),l.descriptor.mimeType||n.type||`application/octet-stream`)},[e,l.binaryBuffer,l.descriptor.mimeType,l.textContent,s]),U=(0,q.useCallback)(async()=>{if(!e)throw Error(`No workspace file selected`);let t=W(e),n=l.descriptor.mimeType||`application/octet-stream`,r;return r=l.binaryBuffer?new Blob([l.binaryBuffer],{type:n}):l.textContent==null?await T(e,s):new Blob([l.textContent],{type:n}),new File([r],t,{type:l.descriptor.mimeType||r.type||`application/octet-stream`,lastModified:l.mtimeMs??Date.now()})},[e,l.binaryBuffer,l.descriptor.mimeType,l.mtimeMs,l.textContent,s]),G=!l.loading&&!!e,oe=C()&&(!!l.fileResourceId&&!!window.electronAPI?.shell?.openFileResource||l.descriptor.type===`spreadsheet`&&!!l.binaryBuffer&&!!window.electronAPI?.shell?.openTemporaryFile),K=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.chooseAppAndOpenFileResource,J=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!C()||!e||!window.electronAPI?.shell?.getOpenWithAppsForFileResource){g([]),m([]);return}try{let t=await window.electronAPI.shell.getOpenWithAppsForFileResource(e);g(t.recommended.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl}))),m(t.recent.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl,lastUsedAt:e.lastUsedAt})))}catch{g([]),m([])}},[l.fileResourceId]);(0,q.useEffect)(()=>{J()},[J]);let se=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.openFileResource)return window.electronAPI.shell.openFileResource(e);if(l.descriptor.type===`spreadsheet`&&l.binaryBuffer&&window.electronAPI?.shell?.openTemporaryFile)return window.electronAPI.shell.openTemporaryFile({fileName:l.descriptor.fileName,data:new Uint8Array(l.binaryBuffer)})},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type,l.fileResourceId]),Y=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!e||!window.electronAPI?.shell?.chooseAppAndOpenFileResource)return;let t=await window.electronAPI.shell.chooseAppAndOpenFileResource(e);return t.ok&&J(),t},[l.fileResourceId,J]),fe=(0,q.useCallback)(async e=>{let t=l.fileResourceId;if(!t||!e||!window.electronAPI?.shell?.openFileResourceWithApp)return;let n=await window.electronAPI.shell.openFileResourceWithApp(t,e);return n.ok&&J(),n},[l.fileResourceId,J]),X=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.showFileResourceInFolder,pe=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.showFileResourceInFolder)return window.electronAPI.shell.showFileResourceInFolder(e)},[l.fileResourceId]);return{...l,dirty:M,externalChange:P,flushSource:R,refresh:B,checkForUpdates:ne,extractedText:l.descriptor.type===`pptx`?l.pptxText:null,extractedTextTruncated:l.pptxTruncated,sourceEditMode:d.sourceEditMode,setSourceEditMode:e=>f({type:`source`,value:e}),saveStatus:d.saveStatus,onSourceChange:te,onDownload:H,createAttachmentFile:U,canDownload:G,canOpenWithSystemApp:oe,onOpenWithSystemApp:se,canChooseOpenWithApp:K,onChooseOpenWithApp:Y,recommendedOpenWithApps:h,recentOpenWithApps:p,onOpenWithRecentApp:fe,canRevealInFolder:X,onRevealInFolder:pe}}var X=new Map;function pe(e){return X.get(e)??{zoom:1,rotation:0,page:1,pageCount:null,searchQuery:``,scroll:[]}}function me(e,t){let n={...pe(e),...t};for(X.delete(e),X.set(e,n);X.size>100;)X.delete(X.keys().next().value)}s.subscribe((e,t)=>{(e.baseUrl!==t.baseUrl||e.conversationId!==t.conversationId)&&X.clear()});var he=120*1e3,Z=new Map;function ge(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function _e(e){for(let[t,n]of Z)n.expiresAt<=e&&Z.delete(t)}function ve(e,t=Date.now()){_e(t);let n=ge();return Z.set(n,{file:e,name:e.name,type:e.type,expiresAt:t+he}),n}function ye(e,t=Date.now()){let n=Z.get(e);return n?n.expiresAt<=t?(Z.delete(e),null):{name:n.name,type:n.type}:null}function be(e,t=Date.now()){let n=Z.get(e);if(!n)return null;if(n.expiresAt<=t)return Z.delete(e),null;if(!n.file)return null;let r=n.file;return n.file=null,r}var xe=`<script>
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/source-workspace-editor-BwYU5OEh.js","assets/vendor-react-BOUWij0V.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/languages-kF11aUYU.js","assets/binary-plugins-DnE-iqaV.js","assets/messages-lc5BjBtX.js","assets/attachment-utils-core-BPYdUI6y.js","assets/preview-open-alternatives-CY_hjK4b.js","assets/download-Dk-ZjtO6.js","assets/createLucideIcon-DPHK1VkS.js","assets/external-link-DjqjBmc3.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/interaction-BdhHBbYa.js","assets/electron-env-DHOGevH3.js","assets/use-blob-object-url-D4BFuzZB.js","assets/media-plugins-B9bQ3e1j.js","assets/archive-plugin-DFP0MajV.js","assets/jszip.min-Dj17eJqX.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{a,i as o,l as s}from"./locale-store-BYdvIuPj.js";import{t as c}from"./messages-lc5BjBtX.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{G as u,t as d}from"./markdown-view-BOJVaGPC.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./rotate-cw-LIg3Am9S.js";import{t as m}from"./search-DA7gz22f.js";import{t as h}from"./cn-0WouolD0.js";import{t as g}from"./skeleton-DzdOeGYz.js";import{r as _}from"./turn-outcome-BSbEJx8h.js";import{a as v,c as y,o as b,r as x,t as S}from"./attachment-utils-core-BPYdUI6y.js";import{n as C}from"./electron-env-DHOGevH3.js";import{t as w}from"./use-async-resource-BHFGZCY2.js";import{a as T,c as E,d as D,m as O,n as k,r as ee,u as A}from"./workspace-api-_mQWmOZm.js";import{t as j}from"./index.module-Cd9ENXfk.js";var M=l(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]),N=l(`step-back`,[[`path`,{d:`M13.971 4.285A2 2 0 0 1 17 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`19qhus`}],[`path`,{d:`M21 20V4`,key:`cb8qj8`}]]),P=5*1024*1024,F=32*1024*1024,I=new Set(`.astro,.bat,.c,.cc,.clj,.cljs,.cljc,.cmd,.cpp,.cs,.cts,.cxx,.dart,.edn,.erl,.ex,.exs,.fish,.fs,.fsx,.go,.gql,.graphql,.groovy,.h,.hh,.hpp,.hrl,.hxx,.java,.ts,.tsx,.mts,.js,.jsx,.mjs,.cjs,.css,.scss,.sass,.less,.json,.jsonc,.json5,.yml,.yaml,.xml,.xsd,.xsl,.py,.pyw,.rb,.php,.rs,.kt,.kts,.scala,.swift,.m,.mm,.sh,.bash,.zsh,.ps1,.sql,.lua,.r,.pl,.pm,.sol,.tf,.tfvars,.nix,.proto,.vue,.svelte,.toml,.ini,.cfg,.conf,.properties`.split(`,`)),L=new Set([`.txt`,`.log`,`.lock`,`.csv`,`.tsv`,`.env`,`.gitignore`,`.gitattributes`,`.editorconfig`,`.npmrc`,`.dockerignore`,`.eslintignore`,`.prettierignore`,`.stylelintignore`]),R=new Set([`dockerfile`,`gemfile`,`jenkinsfile`,`makefile`,`procfile`,`rakefile`]),z=new Set([`brewfile`,`changelog`,`codeowners`,`license`,`readme`]),te=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.ico`,`.svg`,`.svgz`,`.tif`,`.tiff`,`.avif`,`.heic`,`.heif`,`.jxl`]),B=new Set([`.mp3`,`.wav`,`.ogg`,`.oga`,`.aac`,`.m4a`,`.flac`,`.opus`,`.weba`]),V=new Set([`.mp4`,`.webm`,`.mov`,`.m4v`,`.ogv`]),ne=new Set([`.zip`]),H=new Map([[`.pdf`,`application/pdf`],[`.docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`.pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`.xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`.xls`,`application/vnd.ms-excel`],[`.md`,`text/markdown`],[`.markdown`,`text/markdown`],[`.html`,`text/html`],[`.htm`,`text/html`],[`.json`,`application/json`],[`.txt`,`text/plain`],[`.csv`,`text/csv`],[`.tsv`,`text/tab-separated-values`],[`.png`,`image/png`],[`.jpg`,`image/jpeg`],[`.jpeg`,`image/jpeg`],[`.gif`,`image/gif`],[`.webp`,`image/webp`],[`.svg`,`image/svg+xml`],[`.svgz`,`image/svg+xml`],[`.mp3`,`audio/mpeg`],[`.wav`,`audio/wav`],[`.ogg`,`audio/ogg`],[`.mp4`,`video/mp4`],[`.webm`,`video/webm`],[`.mov`,`video/quicktime`],[`.zip`,`application/zip`]]);function U(e){let t=W(e),n=t.lastIndexOf(`.`);return n<0||n===t.length-1?``:t.slice(n).toLowerCase()}function W(e){let t=e.replace(/\\/g,`/`).split(`/`);return t[t.length-1]||e}function re(e,t){let n=t?.split(`;`)[0]?.trim().toLowerCase();return n&&n!==`application/octet-stream`?n:H.get(U(e))??n??`application/octet-stream`}function ie(e,t){let n=U(e),r=W(e).toLowerCase(),i=re(e,t);return i===`text/markdown`||n===`.md`||n===`.markdown`?`markdown`:i===`text/html`||n===`.html`||n===`.htm`?`html`:i===`application/pdf`||n===`.pdf`?`pdf`:i===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n===`.docx`?`docx`:i===`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`||i===`application/vnd.ms-excel`||n===`.xlsx`||n===`.xls`?`spreadsheet`:i===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n===`.pptx`?`pptx`:i.startsWith(`image/`)||te.has(n)?`image`:i.startsWith(`audio/`)||B.has(n)?`audio`:i.startsWith(`video/`)||V.has(n)?`video`:i===`application/zip`||ne.has(n)?`archive`:I.has(n)||R.has(r)||r.startsWith(`dockerfile.`)?`code`:i.startsWith(`text/`)||L.has(n)||z.has(r)||r.startsWith(`.env.`)||i===`application/json`?`text`:`unsupported`}function ae(e){switch(e){case`text`:case`markdown`:case`code`:case`html`:return`text`;case`unsupported`:return`metadata`;default:return`binary`}}async function G(e){let{uri:t,conversationId:n,taskId:r}=e;try{let e=_(t),i=await a(o(e?`/api/files/${encodeURIComponent(e)}/content`:y(t,n,r)));return i.ok?{ok:!0,blob:await i.blob()}:{ok:!1,reason:`http`,status:i.status}}catch(e){return{ok:!1,reason:`network`,message:e instanceof Error?e.message:String(e)}}}async function oe(e){let t=await G(e);return t.ok?{ok:!0,buffer:await t.blob.arrayBuffer()}:t}var K=n(),q=e(t(),1);function J(e){return e.id?String(e.id):`${e.name}:${e.uri??``}`}function se(){return{id:`__empty__`,context:`attachment`,fileName:``,mimeType:`application/octet-stream`,type:`unsupported`,source:{kind:`inline`}}}function Y(e){let t=(0,K.c)(65),{open:n,attachment:r,authToken:i,conversationId:a,language:o}=e,[s,l]=(0,q.useState)(n?r:null),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(!1),m;t[0]!==r||t[1]!==n?(m=n&&r?J(r):null,t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,g=(0,q.useRef)(h);h!==g.current&&(g.current=h,l(n&&r?r:null),d(!1),p(!1));let _=s,y;bb0:{if(!_){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=se(),t[3]=e):e=t[3],y=e;break bb0}let e=_.name??`attachment`,n,r;t[4]!==e||t[5]!==_.mimeType?(n=re(e,_.mimeType),r=ie(e,n),t[4]=e,t[5]=_.mimeType,t[6]=n,t[7]=r):(n=t[6],r=t[7]);let i=r,o=_.id?String(_.id):`${e}:${_.uri??``}`,s;t[8]!==a||t[9]!==_.uri?(s=_.uri?{kind:`media-uri`,uri:_.uri,conversationId:a}:{kind:`inline`},t[8]=a,t[9]=_.uri,t[10]=s):s=t[10];let c;t[11]!==e||t[12]!==n||t[13]!==_.size||t[14]!==o||t[15]!==s||t[16]!==i?(c={id:o,context:`attachment`,fileName:e,mimeType:n,size:_.size,type:i,source:s},t[11]=e,t[12]=n,t[13]=_.size,t[14]=o,t[15]=s,t[16]=i,t[17]=c):c=t[17],y=c}let b=y,S;t[18]===_?S=t[19]:(S=_?v(_):void 0,t[18]=_,t[19]=S);let C=S,T=_?.uri,E;t[20]===b.type?E=t[21]:(E=ae(b.type),t[20]=b.type,t[21]=E);let D=E,O=!!(n&&T&&!C&&i&&(D===`binary`||D===`text`)),k;t[22]!==a||t[23]!==o||t[24]!==T||t[25]!==_?.taskId?(k=async()=>{let e=c(o).chat,t=await oe({uri:T,conversationId:a,taskId:_?.taskId});if(!t.ok)throw t.reason===`http`?Error(`${e.attachmentPreviewLoadError} (HTTP ${t.status})`):Error(t.message);return t.buffer},t[22]=a,t[23]=o,t[24]=T,t[25]=_?.taskId,t[26]=k):k=t[26];let ee=_?.taskId,A;t[27]!==i||t[28]!==a||t[29]!==C||t[30]!==o||t[31]!==T||t[32]!==n||t[33]!==D||t[34]!==ee?(A=[n,T,i,o,C,ee,a,D],t[27]=i,t[28]=a,t[29]=C,t[30]=o,t[31]=T,t[32]=n,t[33]=D,t[34]=ee,t[35]=A):A=t[35];let j;t[36]===O?j=t[37]:(j={enabled:O,initial:null,errorData:null},t[36]=O,t[37]=j);let M=w(k,A,j),N;bb1:{if(C)try{let e;t[38]===C?e=t[39]:(e=x(C),t[38]=C,t[39]=e),N=e;break bb1}catch{N=null;break bb1}if(O&&M.loading){N=null;break bb1}N=M.data??null}let P=N,F=D===`binary`?P:null,I=_?.extractedText??``,L;t[40]!==P||t[41]!==I||t[42]!==o||t[43]!==D?(L=D===`text`?I||(P?new TextDecoder(`utf-8`,{fatal:!1}).decode(new Uint8Array(P)):c(o).chat.attachmentPreviewNoText):null,t[40]=P,t[41]=I,t[42]=o,t[43]=D,t[44]=L):L=t[44];let R=L,z=!!_?.extractedText,te=b.type===`pptx`&&I.length>3e5,B;t[45]!==i||t[46]!==C||t[47]!==o||t[48]!==T||t[49]!==n||t[50]!==D?(B=n&&T&&!C&&!i&&D===`binary`?c(o).chat.attachmentPreviewMissingAuth:null,t[45]=i,t[46]=C,t[47]=o,t[48]=T,t[49]=n,t[50]=D,t[51]=B):B=t[51];let V=B,ne=M.error?M.error instanceof Error?M.error.message:String(M.error):null,H=f?null:V??ne,U=O?M.loading:!1,W;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>p(!0),t[52]=W):W=t[52];let G=I||null,Y;return t[53]!==F||t[54]!==b||t[55]!==P||t[56]!==te||t[57]!==z||t[58]!==H||t[59]!==_||t[60]!==u||t[61]!==U||t[62]!==G||t[63]!==R?(Y={preview:_,descriptor:b,fileType:b.type,fileName:b.fileName,loading:U,loadError:H,clearLoadError:W,textContent:R,binaryBuffer:F,downloadBuffer:P,hasExtractedText:z,extractedText:G,extractedTextTruncated:te,showExtractedText:u,setShowExtractedText:d},t[53]=F,t[54]=b,t[55]=P,t[56]=te,t[57]=z,t[58]=H,t[59]=_,t[60]=u,t[61]=U,t[62]=G,t[63]=R,t[64]=Y):Y=t[64],Y}function ce(e){let t=(0,K.c)(12),{projectId:n,conversationId:r,agentId:i}=e,a;bb0:{let e;t[0]===n?e=t[1]:(e=n?.trim(),t[0]=n,t[1]=e);let o=e;if(o){let e;t[2]===o?e=t[3]:(e={projectId:o},t[2]=o,t[3]=e),a=e;break bb0}let s;t[4]===r?s=t[5]:(s=r?.trim(),t[4]=r,t[5]=s);let c=s;if(c){let e;t[6]===c?e=t[7]:(e={conversationId:c},t[6]=c,t[7]=e),a=e;break bb0}let l;t[8]===i?l=t[9]:(l=i?.trim(),t[8]=i,t[9]=l);let u=l,d;t[10]===u?d=t[11]:(d=u?{agentId:u}:void 0,t[10]=u,t[11]=d),a=d}return a}function le(e){return{descriptor:e,textContent:null,binaryBuffer:null,fileResourceId:null,mtimeMs:null,loadError:null,loading:!1,pptxText:null,pptxTruncated:!1,pptxError:null}}function ue(e,t){switch(t.type){case`clear`:return le(t.descriptor);case`loadStart`:return{...le(t.descriptor),loading:!0};case`loadSuccess`:return{...e,descriptor:t.payload.descriptor,textContent:t.payload.textContent??null,binaryBuffer:t.payload.binaryBuffer??null,fileResourceId:t.payload.fileResourceId??null,mtimeMs:t.payload.mtimeMs??null,loadError:null,loading:!1};case`loadError`:return{...le(t.descriptor),loadError:t.error};case`patchMtime`:return{...e,mtimeMs:t.mtimeMs};case`patchText`:return{...e,textContent:t.text};case`pptxClear`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:null};case`pptxSuccess`:return{...e,pptxText:t.text,pptxTruncated:t.truncated,pptxError:null};case`pptxError`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:t.error}}}function de(e,t){switch(t.type){case`reset`:return{sourceEditMode:!1,saveStatus:`idle`};case`source`:return{...e,sourceEditMode:typeof t.value==`function`?t.value(e.sourceEditMode):t.value};case`saveStatus`:return{...e,saveStatus:t.value}}}function fe({filePath:e,projectId:t,conversationId:n,agentId:r,resolvedFile:a,initialEditMode:o=!1}){let s=ce({projectId:t,conversationId:n,agentId:r}),c=(0,q.useMemo)(()=>{let t=e?W(e):``,i=re(t,b(t)),a=e?ie(t,i):`unsupported`;return{id:e||`__empty__`,context:`workspace`,fileName:t,mimeType:i,type:a,source:{kind:`workspace`,path:e||``,conversationId:n,agentId:r}}},[r,e,n]),[l,u]=(0,q.useReducer)(ue,c,le),[d,f]=(0,q.useReducer)(de,{sourceEditMode:o,saveStatus:`idle`}),[p,m]=(0,q.useState)([]),[h,g]=(0,q.useState)([]),_=(0,q.useRef)(e),v=(0,q.useRef)(void 0),y=(0,q.useRef)(null),x=(0,q.useRef)(null),w=(0,q.useRef)(null),[M,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(!1),[I,L]=(0,q.useState)(0);_.current!==e&&(_.current=e,f({type:`reset`})),(0,q.useEffect)(()=>{if(!e){u({type:`clear`,descriptor:c});return}let t=!1;u({type:`loadStart`,descriptor:c});let n=ae(c.type),r=e=>{t||u({type:`loadError`,descriptor:c,error:e instanceof Error?e.message:String(e)})};return n===`metadata`?(Promise.all([D(e,s).catch(()=>null),A(e,s).catch(()=>null)]).then(async([n,r])=>{if(!n){t||u({type:`loadSuccess`,payload:{descriptor:c,fileResourceId:r?.fileId??null,mtimeMs:typeof r?.mtimeMs==`number`?r.mtimeMs:null}});return}let i={...c,mimeType:n.mimeType,type:ie(n.name,n.mimeType)};if(ae(i.type)===`text`){let{content:r,mtimeMs:a,revision:o}=await E(e,s);t||(v.current=o,y.current=r,x.current=r,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:i,textContent:r,fileResourceId:n.id,mtimeMs:typeof a==`number`?a:n.modifiedAt}});return}t||u({type:`loadSuccess`,payload:{descriptor:i,fileResourceId:n.id,mtimeMs:n.modifiedAt}})}).catch(r),()=>{t=!0}):(n===`text`?E(e,s,I===0?a:void 0).then(({content:e,mtimeMs:n,revision:r,fileId:i})=>{t||(v.current=r,y.current=e,x.current=e,N(!1),F(!1)),t||u({type:`loadSuccess`,payload:{descriptor:c,textContent:e,fileResourceId:i??null,mtimeMs:typeof n==`number`?n:null}})}).catch(r):Promise.all([T(e,s),A(e,s).catch(()=>null)]).then(async([e,n])=>{let r=await e.arrayBuffer();t||u({type:`loadSuccess`,payload:{descriptor:c,binaryBuffer:r,fileResourceId:n?.fileId??null,mtimeMs:typeof n?.mtimeMs==`number`?n.mtimeMs:null}})}).catch(r),()=>{t=!0})},[c,e,s,I,a]),(0,q.useEffect)(()=>{if(!l.binaryBuffer||l.descriptor.type!==`pptx`){u({type:`pptxClear`});return}let e=!1;return u({type:`pptxClear`}),i(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(l.binaryBuffer,l.descriptor.fileName)),__vite__mapDeps([0,1,2,3])).then(({extractedText:t})=>{if(e)return;let n=t.length>S;u({type:`pptxSuccess`,text:n?t.slice(0,S):t,truncated:n})}).catch(t=>{e||u({type:`pptxError`,error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type]);let R=(0,q.useCallback)(async()=>{if(w.current&&!await w.current)return!1;if(!e||y.current===null||y.current===x.current)return!0;let t=(async()=>{f({type:`saveStatus`,value:`saving`});try{for(;y.current!==x.current;){let t=y.current,n=await O(e,t,s,v.current);v.current=n.revision,x.current=t,typeof n.mtimeMs==`number`&&u({type:`patchMtime`,mtimeMs:n.mtimeMs})}return N(!1),f({type:`saveStatus`,value:`saved`}),!0}catch{return f({type:`saveStatus`,value:`error`}),!1}})();w.current=t;try{return await t}finally{w.current===t&&(w.current=null)}},[e,s]),z=j(()=>void R(),500),te=(0,q.useCallback)(e=>{y.current=e,N(e!==x.current),u({type:`patchText`,text:e}),z()},[z]);(0,q.useEffect)(()=>{let e=e=>{y.current!==x.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),z.cancel()}},[z]);let B=(0,q.useCallback)(()=>{!M&&!w.current&&L(e=>e+1)},[M]),V=(0,q.useRef)(!1),ne=(0,q.useCallback)(async()=>{if(!(!e||l.loading||w.current||V.current)){V.current=!0;try{let t=await D(e,s);if(!t||!(v.current?t.revision!==v.current:l.mtimeMs!=null&&t.modifiedAt!==l.mtimeMs))return;M||d.sourceEditMode?F(!0):B()}catch{F(!0)}finally{V.current=!1}}},[M,d.sourceEditMode,e,l.loading,l.mtimeMs,s,B]),H=(0,q.useCallback)(async()=>{if(!e)return;let t=W(e);if(l.binaryBuffer){k(t,l.binaryBuffer,l.descriptor.mimeType||`application/octet-stream`);return}if(l.textContent!=null){ee(t,l.textContent);return}let n=await T(e,s);k(t,await n.arrayBuffer(),l.descriptor.mimeType||n.type||`application/octet-stream`)},[e,l.binaryBuffer,l.descriptor.mimeType,l.textContent,s]),U=(0,q.useCallback)(async()=>{if(!e)throw Error(`No workspace file selected`);let t=W(e),n=l.descriptor.mimeType||`application/octet-stream`,r;return r=l.binaryBuffer?new Blob([l.binaryBuffer],{type:n}):l.textContent==null?await T(e,s):new Blob([l.textContent],{type:n}),new File([r],t,{type:l.descriptor.mimeType||r.type||`application/octet-stream`,lastModified:l.mtimeMs??Date.now()})},[e,l.binaryBuffer,l.descriptor.mimeType,l.mtimeMs,l.textContent,s]),G=!l.loading&&!!e,oe=C()&&(!!l.fileResourceId&&!!window.electronAPI?.shell?.openFileResource||l.descriptor.type===`spreadsheet`&&!!l.binaryBuffer&&!!window.electronAPI?.shell?.openTemporaryFile),K=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.chooseAppAndOpenFileResource,J=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!C()||!e||!window.electronAPI?.shell?.getOpenWithAppsForFileResource){g([]),m([]);return}try{let t=await window.electronAPI.shell.getOpenWithAppsForFileResource(e);g(t.recommended.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl}))),m(t.recent.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl,lastUsedAt:e.lastUsedAt})))}catch{g([]),m([])}},[l.fileResourceId]);(0,q.useEffect)(()=>{J()},[J]);let se=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.openFileResource)return window.electronAPI.shell.openFileResource(e);if(l.descriptor.type===`spreadsheet`&&l.binaryBuffer&&window.electronAPI?.shell?.openTemporaryFile)return window.electronAPI.shell.openTemporaryFile({fileName:l.descriptor.fileName,data:new Uint8Array(l.binaryBuffer)})},[l.binaryBuffer,l.descriptor.fileName,l.descriptor.type,l.fileResourceId]),Y=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(!e||!window.electronAPI?.shell?.chooseAppAndOpenFileResource)return;let t=await window.electronAPI.shell.chooseAppAndOpenFileResource(e);return t.ok&&J(),t},[l.fileResourceId,J]),fe=(0,q.useCallback)(async e=>{let t=l.fileResourceId;if(!t||!e||!window.electronAPI?.shell?.openFileResourceWithApp)return;let n=await window.electronAPI.shell.openFileResourceWithApp(t,e);return n.ok&&J(),n},[l.fileResourceId,J]),X=C()&&!!l.fileResourceId&&!!window.electronAPI?.shell?.showFileResourceInFolder,pe=(0,q.useCallback)(async()=>{let e=l.fileResourceId;if(e&&window.electronAPI?.shell?.showFileResourceInFolder)return window.electronAPI.shell.showFileResourceInFolder(e)},[l.fileResourceId]);return{...l,dirty:M,externalChange:P,flushSource:R,refresh:B,checkForUpdates:ne,extractedText:l.descriptor.type===`pptx`?l.pptxText:null,extractedTextTruncated:l.pptxTruncated,sourceEditMode:d.sourceEditMode,setSourceEditMode:e=>f({type:`source`,value:e}),saveStatus:d.saveStatus,onSourceChange:te,onDownload:H,createAttachmentFile:U,canDownload:G,canOpenWithSystemApp:oe,onOpenWithSystemApp:se,canChooseOpenWithApp:K,onChooseOpenWithApp:Y,recommendedOpenWithApps:h,recentOpenWithApps:p,onOpenWithRecentApp:fe,canRevealInFolder:X,onRevealInFolder:pe}}var X=new Map;function pe(e){return X.get(e)??{zoom:1,rotation:0,page:1,pageCount:null,searchQuery:``,scroll:[]}}function me(e,t){let n={...pe(e),...t};for(X.delete(e),X.set(e,n);X.size>100;)X.delete(X.keys().next().value)}s.subscribe((e,t)=>{(e.baseUrl!==t.baseUrl||e.conversationId!==t.conversationId)&&X.clear()});var he=120*1e3,Z=new Map;function ge(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function _e(e){for(let[t,n]of Z)n.expiresAt<=e&&Z.delete(t)}function ve(e,t=Date.now()){_e(t);let n=ge();return Z.set(n,{file:e,name:e.name,type:e.type,expiresAt:t+he}),n}function ye(e,t=Date.now()){let n=Z.get(e);return n?n.expiresAt<=t?(Z.delete(e),null):{name:n.name,type:n.type}:null}function be(e,t=Date.now()){let n=Z.get(e);if(!n)return null;if(n.expiresAt<=t)return Z.delete(e),null;if(!n.file)return null;let r=n.file;return n.file=null,r}var xe=`<script>
|
|
3
3
|
window.addEventListener('click', (event) => {
|
|
4
4
|
if (event.defaultPrevented || event.button !== 0 ||
|
|
5
5
|
event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
@@ -12,4 +12,4 @@ window.addEventListener('click', (event) => {
|
|
|
12
12
|
event.preventDefault();
|
|
13
13
|
window.location.assign('about:srcdoc' + href);
|
|
14
14
|
});
|
|
15
|
-
<\/script>`;function Se(e){let t=/<head(?:\s[^>]*)?>/i.exec(e);if(t?.index!==void 0){let n=t.index+t[0].length;return`${e.slice(0,n)}${xe}${e.slice(n)}`}let n=/<html(?:\s[^>]*)?>/i.exec(e);if(n?.index!==void 0){let t=n.index+n[0].length;return`${e.slice(0,t)}<head>${xe}</head>${e.slice(t)}`}let r=/^\s*<!doctype[^>]*>/i.exec(e);return r?`${r[0]}<head>${xe}</head>${e.slice(r[0].length)}`:`<head>${xe}</head>${e}`}var Q=r();function Ce(e){let t=(0,K.c)(22),{html:n,title:r}=e,i=(0,q.useRef)(null),[a,s]=(0,q.useState)(!1),c;t[0]===n?c=t[1]:(c=Se(n),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=()=>{i.current?.contentWindow?.postMessage({type:`xopc-html-preview`,html:l},`*`)},t[2]=l,t[3]=u);let d=u,f,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=e=>{e.source===i.current?.contentWindow&&e.data?.type===`xopc-html-preview-ready`&&s(!0)};window.addEventListener(`message`,e);let t=window.setTimeout(()=>s(!0),1800);return()=>{window.removeEventListener(`message`,e),window.clearTimeout(t)}},p=[],t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,q.useEffect)(f,p);let m;t[6]===d?m=t[7]:(m=[d],t[6]=d,t[7]=m),(0,q.useEffect)(d,m);let _=!a,v;t[8]===a?v=t[9]:(v=a?null:(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 space-y-4 rounded-lg bg-surface-panel p-4`,children:[(0,Q.jsx)(g,{className:`h-5 w-1/3`}),(0,Q.jsx)(g,{className:`h-32 w-full rounded-xl`}),(0,Q.jsx)(g,{className:`h-4 w-2/3`})]}),t[8]=a,t[9]=v);let y=a?`opacity-100`:`pointer-events-none opacity-0`,b;t[10]===y?b=t[11]:(b=h(`min-h-0 w-full flex-1 rounded-lg border border-edge-subtle bg-white motion-safe:transition-opacity motion-safe:duration-150 dark:border-edge dark:bg-[#1e1e1e]`,y),t[10]=y,t[11]=b);let x=a?void 0:-1,S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=o(`/api/preview/html`),t[12]=S):S=t[12];let C;t[13]!==d||t[14]!==x||t[15]!==b||t[16]!==r?(C=(0,Q.jsx)(`iframe`,{ref:i,title:r,className:b,tabIndex:x,src:S,sandbox:`allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals`,referrerPolicy:`no-referrer`,onLoad:d}),t[13]=d,t[14]=x,t[15]=b,t[16]=r,t[17]=C):C=t[17];let w;return t[18]!==C||t[19]!==_||t[20]!==v?(w=(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 w-full flex-1 flex-col`,"aria-busy":_,children:[v,C]}),t[18]=C,t[19]=_,t[20]=v,t[21]=w):w=t[21],w}var we=(0,q.lazy)(()=>i(()=>import(`./source-workspace-editor-BwYU5OEh.js`).then(e=>({default:e.SourceWorkspaceEditor})),__vite__mapDeps([4,1,5,6,7,2])));function Te(){let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-4 py-3`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Ee(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t).toLowerCase():``}function De(e){return{".ts":`typescript`,".tsx":`tsx`,".js":`javascript`,".jsx":`jsx`,".json":`json`,".css":`css`,".yml":`yaml`,".yaml":`yaml`,".py":`python`,".go":`go`,".rs":`rust`,".sh":`bash`}[Ee(e)]??`plaintext`}function Oe(e){let t=(0,K.c)(12),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a;if(t[0]!==n){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\r\n|\n|\r/,t[2]=e):e=t[2],a=n.split(e),t[0]=n,t[1]=a}else a=t[1];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i.current?.scrollIntoView({block:`center`})},t[3]=s):s=t[3];let c;t[4]!==r||t[5]!==n?(c=[r,n],t[4]=r,t[5]=n,t[6]=c):c=t[6],(0,q.useEffect)(s,c);let l;t[7]!==o||t[8]!==r?(l=o.map((e,t)=>{let n=t+1,a=n===r;return(0,Q.jsxs)(`div`,{ref:a?i:void 0,className:a?`flex bg-accent-soft/60 text-fg`:`flex`,"data-line":n,children:[(0,Q.jsx)(`span`,{className:`w-12 shrink-0 select-none pr-3 text-right text-fg-subtle`,children:n}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:e||` `})]},n)}),t[7]=o,t[8]=r,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:(0,Q.jsx)(`div`,{className:`min-w-max font-mono text-xs leading-relaxed text-fg`,children:l})}),t[10]=l,t[11]=u),u}function ke(e){let t=(0,K.c)(6),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a,o;t[0]!==r||t[1]!==n?(a=()=>{if(!r||!i.current)return;let e=n.split(/\r?\n/,r);if(!/^#{1,6}\s/.test(e.at(-1)??``))return;let t=e.filter(Ae).length-1;i.current.querySelectorAll(`h1,h2,h3,h4,h5,h6`)[t]?.scrollIntoView({block:`nearest`})},o=[r,n],t[0]=r,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,q.useEffect)(a,o);let s;return t[4]===n?s=t[5]:(s=(0,Q.jsx)(`div`,{ref:i,className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:n})}),t[4]=n,t[5]=s),s}function Ae(e){return/^#{1,6}\s/.test(e)}function je(e,t){let n=e.textContent??``,r=e.descriptor.context===`workspace`,i=e.workspaceEditing;return r&&i?.sourceEditMode?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Q.jsx)(q.Suspense,{fallback:(0,Q.jsx)(Te,{}),children:(0,Q.jsx)(we,{fileName:e.descriptor.fileName,initialContent:n,onChange:e=>i.onSourceChange?.(e),isDark:(i.isDark??e.resolvedTheme===`dark`)===!0,lineWrap:i.sourceWordWrap===!0},e.descriptor.id)})}):t===`markdown`?(0,Q.jsx)(ke,{text:n,targetLine:e.targetLine}):t===`html`?(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:(0,Q.jsx)(Ce,{html:n,title:e.descriptor.fileName})}):e.targetLine&&e.targetLine>0?(0,Q.jsx)(Oe,{text:n,targetLine:e.targetLine}):t===`code`?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:`\`\`\`${De(e.descriptor.fileName)}\n${n}\n\`\`\``})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-fg`,children:n})})}function Me(e){return je(e,`text`)}function Ne(e){return je(e,`markdown`)}function Pe(e){return je(e,`code`)}function Fe(e){return je(e,`html`)}function Ie(){return(0,q.createElement)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`},`Loading preview...`)}function $(e,t,n,r=`binary`){let i=(0,q.lazy)(n);return{id:e,readMode:r,capabilities:t,render:e=>(0,q.createElement)(q.Suspense,{fallback:Ie()},(0,q.createElement)(i,e))}}var Le={text:{id:`text`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Me,e)},markdown:{id:`markdown`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Ne,e)},code:{id:`code`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Pe,e)},html:{id:`html`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Fe,e)},image:$(`image`,[`download`,`zoom`,`rotate`],()=>i(()=>import(`./binary-plugins-Dz62GXI_.js`).then(e=>({default:e.InteractiveImagePreview})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pdf:$(`pdf`,[`download`,`zoom`,`rotate`,`pageNavigation`,`print`],()=>i(()=>import(`./binary-plugins-Dz62GXI_.js`).then(e=>({default:e.PdfPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),docx:$(`docx`,[`download`],()=>i(()=>import(`./binary-plugins-Dz62GXI_.js`).then(e=>({default:e.DocxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),spreadsheet:$(`spreadsheet`,[`download`],()=>i(()=>import(`./binary-plugins-Dz62GXI_.js`).then(e=>({default:e.SpreadsheetPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pptx:$(`pptx`,[`download`],()=>i(()=>import(`./binary-plugins-Dz62GXI_.js`).then(e=>({default:e.PptxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),audio:$(`audio`,[`download`],()=>i(()=>import(`./media-plugins-DissTT0S.js`).then(e=>({default:e.AudioPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),video:$(`video`,[`download`],()=>i(()=>import(`./media-plugins-DissTT0S.js`).then(e=>({default:e.VideoPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),archive:$(`archive`,[`download`],()=>i(()=>import(`./archive-plugin-Bu1nF6Lg.js`).then(e=>({default:e.ArchivePreviewPluginView})),__vite__mapDeps([21,1,5,9,22,11,12,13,14,15,16,17,18]))),unsupported:$(`unsupported`,[`download`],()=>i(()=>import(`./media-plugins-DissTT0S.js`).then(e=>({default:e.UnsupportedPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19])),`metadata`)};function Re(e){return Le[e]??Le.unsupported}function ze(e){let t=(0,K.c)(63),{plugin:n,controls:r,onZoomIn:i,onZoomOut:a,onZoomReset:o,onRotate:s,onSearchChange:c}=e,l;t[0]===n.capabilities?l=t[1]:(l=n.capabilities.includes(`zoom`),t[0]=n.capabilities,t[1]=l);let d=l,h;t[2]===n.capabilities?h=t[3]:(h=n.capabilities.includes(`search`),t[2]=n.capabilities,t[3]=h);let g=h,_;t[4]===n.capabilities?_=t[5]:(_=n.capabilities.includes(`rotate`),t[4]=n.capabilities,t[5]=_);let v=_,y;t[6]!==r||t[7]!==n.capabilities?(y=n.capabilities.includes(`pageNavigation`)&&r.pageCount!=null&&r.pageCount>1,t[6]=r,t[7]=n.capabilities,t[8]=y):y=t[8];let b=y;if(!(d||g||v||b))return null;let x;if(t[9]!==b||t[10]!==v||t[11]!==g||t[12]!==d||t[13]!==r||t[14]!==s||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==o){let e=[];if(b){let n=r.page<=1,i;t[20]===r?i=t[21]:(i=()=>r.setPage(Math.max(1,r.page-1)),t[20]=r,t[21]=i);let a;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(N,{className:`size-3.5`}),t[22]=a):a=t[22];let o;t[23]!==n||t[24]!==i?(o=(0,Q.jsx)(Be,{label:`Previous page`,disabled:n,onClick:i,children:a}),t[23]=n,t[24]=i,t[25]=o):o=t[25];let s;t[26]!==r.page||t[27]!==r.pageCount?(s=(0,Q.jsxs)(`span`,{className:`min-w-16 px-1 text-center text-xs text-fg-muted`,children:[r.page,` / `,r.pageCount]}),t[26]=r.page,t[27]=r.pageCount,t[28]=s):s=t[28];let c=r.page>=(r.pageCount??1),l;t[29]===r?l=t[30]:(l=()=>r.setPage(Math.min(r.pageCount??r.page,r.page+1)),t[29]=r,t[30]=l);let u;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(M,{className:`size-3.5`}),t[31]=u):u=t[31];let d;t[32]!==c||t[33]!==l?(d=(0,Q.jsx)(Be,{label:`Next page`,disabled:c,onClick:l,children:u}),t[32]=c,t[33]=l,t[34]=d):d=t[34];let f;t[35]!==s||t[36]!==d||t[37]!==o?(f=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[o,s,d]},`page`),t[35]=s,t[36]=d,t[37]=o,t[38]=f):f=t[38],e.push(f)}if(d){let n;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`size-3.5`}),t[39]=n):n=t[39];let s;t[40]===a?s=t[41]:(s=(0,Q.jsx)(Be,{label:`Zoom out`,onClick:a,children:n}),t[40]=a,t[41]=s);let c;t[42]===r.zoom?c=t[43]:(c=Math.round(r.zoom*100),t[42]=r.zoom,t[43]=c);let l;t[44]!==o||t[45]!==c?(l=(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-14 rounded px-1.5 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:o,title:`Reset zoom`,children:[c,`%`]}),t[44]=o,t[45]=c,t[46]=l):l=t[46];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(f,{className:`size-3.5`}),t[47]=d):d=t[47];let p;t[48]===i?p=t[49]:(p=(0,Q.jsx)(Be,{label:`Zoom in`,onClick:i,children:d}),t[48]=i,t[49]=p);let m;t[50]!==p||t[51]!==s||t[52]!==l?(m=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[s,l,p]},`zoom`),t[50]=p,t[51]=s,t[52]=l,t[53]=m):m=t[53],e.push(m)}if(v){let n;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(p,{className:`size-3.5`}),t[54]=n):n=t[54];let r;t[55]===s?r=t[56]:(r=(0,Q.jsx)(Be,{label:`Rotate`,onClick:s,children:n},`rotate`),t[55]=s,t[56]=r),e.push(r)}if(g){let n;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[57]=n):n=t[57];let i;t[58]===c?i=t[59]:(i=e=>c(e.target.value),t[58]=c,t[59]=i);let a;t[60]!==r.searchQuery||t[61]!==i?(a=(0,Q.jsxs)(`label`,{className:`flex min-w-40 items-center gap-1 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs text-fg-muted dark:border-edge`,children:[n,(0,Q.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:r.searchQuery,onChange:i,placeholder:`Search`})]},`search`),t[60]=r.searchQuery,t[61]=i,t[62]=a):a=t[62],e.push(a)}x=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:e}),t[9]=b,t[10]=v,t[11]=g,t[12]=d,t[13]=r,t[14]=s,t[15]=c,t[16]=i,t[17]=a,t[18]=o,t[19]=x}else x=t[19];return x}function Be(e){let t=(0,K.c)(6),{label:n,disabled:r,onClick:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=h(`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-40`),t[0]=o):o=t[0];let s;return t[1]!==a||t[2]!==r||t[3]!==n||t[4]!==i?(s=(0,Q.jsx)(`button`,{type:`button`,className:o,title:n,"aria-label":n,disabled:r,onClick:i,children:a}),t[1]=a,t[2]=r,t[3]=n,t[4]=i,t[5]=s):s=t[5],s}function Ve(e){let t=Re(e.type),n=pe(e.id),[r,i]=(0,q.useState)(n.zoom),[a,o]=(0,q.useState)(n.rotation),[s,c]=(0,q.useState)(n.page),[l,u]=(0,q.useState)(n.pageCount),[d,f]=(0,q.useState)(n.searchQuery),p=(0,q.useCallback)(e=>{c(Math.max(1,Math.min(l??e,Math.floor(e))))},[l]);(0,q.useEffect)(()=>{let t=pe(e.id);i(t.zoom),o(t.rotation),c(t.page),u(t.pageCount),f(t.searchQuery)},[e.id,e.type]);let m=(0,q.useRef)({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d});return m.current={zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d},(0,q.useEffect)(()=>()=>me(e.id,m.current),[e.id]),{plugin:t,controls:(0,q.useMemo)(()=>({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d,setPageCount:u,setPage:p}),[s,l,a,d,p,r]),onZoomIn:()=>i(e=>Math.min(4,Number((e+.15).toFixed(2)))),onZoomOut:()=>i(e=>Math.max(.25,Number((e-.15).toFixed(2)))),onZoomReset:()=>{i(1),o(0)},onRotate:()=>o(e=>(e+90)%360),onSearchChange:f}}function He(e){let t=(0,K.c)(8),{controller:n}=e,r;return t[0]!==n.controls||t[1]!==n.onRotate||t[2]!==n.onSearchChange||t[3]!==n.onZoomIn||t[4]!==n.onZoomOut||t[5]!==n.onZoomReset||t[6]!==n.plugin?(r=(0,Q.jsx)(ze,{plugin:n.plugin,controls:n.controls,onZoomIn:n.onZoomIn,onZoomOut:n.onZoomOut,onZoomReset:n.onZoomReset,onRotate:n.onRotate,onSearchChange:n.onSearchChange}),t[0]=n.controls,t[1]=n.onRotate,t[2]=n.onSearchChange,t[3]=n.onZoomIn,t[4]=n.onZoomOut,t[5]=n.onZoomReset,t[6]=n.plugin,t[7]=r):r=t[7],r}function Ue(e){let t=(0,K.c)(14),n;t[0]===e.language?n=t[1]:(n=c(e.language),t[0]=e.language,t[1]=n);let r=n,{controller:i}=e;if(e.loading){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-4 py-6`,"aria-busy":`true`,children:[(0,Q.jsx)(g,{className:`h-5 w-48 max-w-full`}),(0,Q.jsx)(g,{className:`h-4 w-full`}),(0,Q.jsx)(g,{className:`h-4 w-11/12`}),(0,Q.jsx)(g,{className:`h-4 w-3/4`}),(0,Q.jsx)(g,{className:`mt-3 min-h-48 flex-1 rounded-lg`})]}),t[2]=e):e=t[2],e}if(e.loadError){let n=(e.descriptor.context===`workspace`?r.workspace.loadError:r.chat.attachmentPreviewLoadError)+`: `+e.loadError,i;return t[3]===n?i=t[4]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n})}),t[3]=n,t[4]=i),i}if(e.descriptor.context===`attachment`&&e.showExtractedText&&e.descriptor.type!==`image`){let n=e.extractedText||r.chat.attachmentPreviewNoText,i;return t[5]===n?i=t[6]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-hover/40 p-4 dark:border-edge`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg-muted`,children:n})})}),t[5]=n,t[6]=i),i}let a=`${e.descriptor.id}:${i.plugin.id}`,o;t[7]!==i.controls||t[8]!==e?(o={...e,controls:i.controls},t[7]=i.controls,t[8]=e,t[9]=o):o=t[9];let s;return t[10]!==i.plugin.render||t[11]!==a||t[12]!==o?(s=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Q.jsx)(We,{pluginRender:i.plugin.render,props:o},a)}),t[10]=i.plugin.render,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function We(e){let t=(0,K.c)(5),{pluginRender:n,props:r}=e,i;t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:i}),t[3]=i,t[4]=a),a}export{ae as _,ye as a,me as c,G as d,F as f,re as g,W as h,ve as i,fe as l,ie as m,Ue as n,be as o,P as p,Ve as r,pe as s,He as t,Y as u,N as v,M as y};
|
|
15
|
+
<\/script>`;function Se(e){let t=/<head(?:\s[^>]*)?>/i.exec(e);if(t?.index!==void 0){let n=t.index+t[0].length;return`${e.slice(0,n)}${xe}${e.slice(n)}`}let n=/<html(?:\s[^>]*)?>/i.exec(e);if(n?.index!==void 0){let t=n.index+n[0].length;return`${e.slice(0,t)}<head>${xe}</head>${e.slice(t)}`}let r=/^\s*<!doctype[^>]*>/i.exec(e);return r?`${r[0]}<head>${xe}</head>${e.slice(r[0].length)}`:`<head>${xe}</head>${e}`}var Q=r();function Ce(e){let t=(0,K.c)(22),{html:n,title:r}=e,i=(0,q.useRef)(null),[a,s]=(0,q.useState)(!1),c;t[0]===n?c=t[1]:(c=Se(n),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=()=>{i.current?.contentWindow?.postMessage({type:`xopc-html-preview`,html:l},`*`)},t[2]=l,t[3]=u);let d=u,f,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=e=>{e.source===i.current?.contentWindow&&e.data?.type===`xopc-html-preview-ready`&&s(!0)};window.addEventListener(`message`,e);let t=window.setTimeout(()=>s(!0),1800);return()=>{window.removeEventListener(`message`,e),window.clearTimeout(t)}},p=[],t[4]=f,t[5]=p):(f=t[4],p=t[5]),(0,q.useEffect)(f,p);let m;t[6]===d?m=t[7]:(m=[d],t[6]=d,t[7]=m),(0,q.useEffect)(d,m);let _=!a,v;t[8]===a?v=t[9]:(v=a?null:(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 space-y-4 rounded-lg bg-surface-panel p-4`,children:[(0,Q.jsx)(g,{className:`h-5 w-1/3`}),(0,Q.jsx)(g,{className:`h-32 w-full rounded-xl`}),(0,Q.jsx)(g,{className:`h-4 w-2/3`})]}),t[8]=a,t[9]=v);let y=a?`opacity-100`:`pointer-events-none opacity-0`,b;t[10]===y?b=t[11]:(b=h(`min-h-0 w-full flex-1 rounded-lg border border-edge-subtle bg-white motion-safe:transition-opacity motion-safe:duration-150 dark:border-edge dark:bg-[#1e1e1e]`,y),t[10]=y,t[11]=b);let x=a?void 0:-1,S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=o(`/api/preview/html`),t[12]=S):S=t[12];let C;t[13]!==d||t[14]!==x||t[15]!==b||t[16]!==r?(C=(0,Q.jsx)(`iframe`,{ref:i,title:r,className:b,tabIndex:x,src:S,sandbox:`allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals`,referrerPolicy:`no-referrer`,onLoad:d}),t[13]=d,t[14]=x,t[15]=b,t[16]=r,t[17]=C):C=t[17];let w;return t[18]!==C||t[19]!==_||t[20]!==v?(w=(0,Q.jsxs)(`div`,{className:`relative flex min-h-0 w-full flex-1 flex-col`,"aria-busy":_,children:[v,C]}),t[18]=C,t[19]=_,t[20]=v,t[21]=w):w=t[21],w}var we=(0,q.lazy)(()=>i(()=>import(`./source-workspace-editor-BwYU5OEh.js`).then(e=>({default:e.SourceWorkspaceEditor})),__vite__mapDeps([4,1,5,6,7,2])));function Te(){let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-4 py-3`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function Ee(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t).toLowerCase():``}function De(e){return{".ts":`typescript`,".tsx":`tsx`,".js":`javascript`,".jsx":`jsx`,".json":`json`,".css":`css`,".yml":`yaml`,".yaml":`yaml`,".py":`python`,".go":`go`,".rs":`rust`,".sh":`bash`}[Ee(e)]??`plaintext`}function Oe(e){let t=(0,K.c)(12),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a;if(t[0]!==n){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\r\n|\n|\r/,t[2]=e):e=t[2],a=n.split(e),t[0]=n,t[1]=a}else a=t[1];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i.current?.scrollIntoView({block:`center`})},t[3]=s):s=t[3];let c;t[4]!==r||t[5]!==n?(c=[r,n],t[4]=r,t[5]=n,t[6]=c):c=t[6],(0,q.useEffect)(s,c);let l;t[7]!==o||t[8]!==r?(l=o.map((e,t)=>{let n=t+1,a=n===r;return(0,Q.jsxs)(`div`,{ref:a?i:void 0,className:a?`flex bg-accent-soft/60 text-fg`:`flex`,"data-line":n,children:[(0,Q.jsx)(`span`,{className:`w-12 shrink-0 select-none pr-3 text-right text-fg-subtle`,children:n}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:e||` `})]},n)}),t[7]=o,t[8]=r,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:(0,Q.jsx)(`div`,{className:`min-w-max font-mono text-xs leading-relaxed text-fg`,children:l})}),t[10]=l,t[11]=u),u}function ke(e){let t=(0,K.c)(6),{text:n,targetLine:r}=e,i=(0,q.useRef)(null),a,o;t[0]!==r||t[1]!==n?(a=()=>{if(!r||!i.current)return;let e=n.split(/\r?\n/,r);if(!/^#{1,6}\s/.test(e.at(-1)??``))return;let t=e.filter(Ae).length-1;i.current.querySelectorAll(`h1,h2,h3,h4,h5,h6`)[t]?.scrollIntoView({block:`nearest`})},o=[r,n],t[0]=r,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,q.useEffect)(a,o);let s;return t[4]===n?s=t[5]:(s=(0,Q.jsx)(`div`,{ref:i,className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:n})}),t[4]=n,t[5]=s),s}function Ae(e){return/^#{1,6}\s/.test(e)}function je(e,t){let n=e.textContent??``,r=e.descriptor.context===`workspace`,i=e.workspaceEditing;return r&&i?.sourceEditMode?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Q.jsx)(q.Suspense,{fallback:(0,Q.jsx)(Te,{}),children:(0,Q.jsx)(we,{fileName:e.descriptor.fileName,initialContent:n,onChange:e=>i.onSourceChange?.(e),isDark:(i.isDark??e.resolvedTheme===`dark`)===!0,lineWrap:i.sourceWordWrap===!0},e.descriptor.id)})}):t===`markdown`?(0,Q.jsx)(ke,{text:n,targetLine:e.targetLine}):t===`html`?(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:(0,Q.jsx)(Ce,{html:n,title:e.descriptor.fileName})}):e.targetLine&&e.targetLine>0?(0,Q.jsx)(Oe,{text:n,targetLine:e.targetLine}):t===`code`?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(d,{content:`\`\`\`${De(e.descriptor.fileName)}\n${n}\n\`\`\``})}):(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-fg`,children:n})})}function Me(e){return je(e,`text`)}function Ne(e){return je(e,`markdown`)}function Pe(e){return je(e,`code`)}function Fe(e){return je(e,`html`)}function Ie(){return(0,q.createElement)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`},`Loading preview...`)}function $(e,t,n,r=`binary`){let i=(0,q.lazy)(n);return{id:e,readMode:r,capabilities:t,render:e=>(0,q.createElement)(q.Suspense,{fallback:Ie()},(0,q.createElement)(i,e))}}var Le={text:{id:`text`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Me,e)},markdown:{id:`markdown`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Ne,e)},code:{id:`code`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Pe,e)},html:{id:`html`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,q.createElement)(Fe,e)},image:$(`image`,[`download`,`zoom`,`rotate`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.InteractiveImagePreview})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pdf:$(`pdf`,[`download`,`zoom`,`rotate`,`pageNavigation`,`print`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.PdfPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),docx:$(`docx`,[`download`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.DocxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),spreadsheet:$(`spreadsheet`,[`download`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.SpreadsheetPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pptx:$(`pptx`,[`download`],()=>i(()=>import(`./binary-plugins-DnE-iqaV.js`).then(e=>({default:e.PptxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),audio:$(`audio`,[`download`],()=>i(()=>import(`./media-plugins-B9bQ3e1j.js`).then(e=>({default:e.AudioPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),video:$(`video`,[`download`],()=>i(()=>import(`./media-plugins-B9bQ3e1j.js`).then(e=>({default:e.VideoPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),archive:$(`archive`,[`download`],()=>i(()=>import(`./archive-plugin-DFP0MajV.js`).then(e=>({default:e.ArchivePreviewPluginView})),__vite__mapDeps([21,1,5,9,22,11,12,13,14,15,16,17,18]))),unsupported:$(`unsupported`,[`download`],()=>i(()=>import(`./media-plugins-B9bQ3e1j.js`).then(e=>({default:e.UnsupportedPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19])),`metadata`)};function Re(e){return Le[e]??Le.unsupported}function ze(e){let t=(0,K.c)(63),{plugin:n,controls:r,onZoomIn:i,onZoomOut:a,onZoomReset:o,onRotate:s,onSearchChange:c}=e,l;t[0]===n.capabilities?l=t[1]:(l=n.capabilities.includes(`zoom`),t[0]=n.capabilities,t[1]=l);let d=l,h;t[2]===n.capabilities?h=t[3]:(h=n.capabilities.includes(`search`),t[2]=n.capabilities,t[3]=h);let g=h,_;t[4]===n.capabilities?_=t[5]:(_=n.capabilities.includes(`rotate`),t[4]=n.capabilities,t[5]=_);let v=_,y;t[6]!==r||t[7]!==n.capabilities?(y=n.capabilities.includes(`pageNavigation`)&&r.pageCount!=null&&r.pageCount>1,t[6]=r,t[7]=n.capabilities,t[8]=y):y=t[8];let b=y;if(!(d||g||v||b))return null;let x;if(t[9]!==b||t[10]!==v||t[11]!==g||t[12]!==d||t[13]!==r||t[14]!==s||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==o){let e=[];if(b){let n=r.page<=1,i;t[20]===r?i=t[21]:(i=()=>r.setPage(Math.max(1,r.page-1)),t[20]=r,t[21]=i);let a;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(N,{className:`size-3.5`}),t[22]=a):a=t[22];let o;t[23]!==n||t[24]!==i?(o=(0,Q.jsx)(Be,{label:`Previous page`,disabled:n,onClick:i,children:a}),t[23]=n,t[24]=i,t[25]=o):o=t[25];let s;t[26]!==r.page||t[27]!==r.pageCount?(s=(0,Q.jsxs)(`span`,{className:`min-w-16 px-1 text-center text-xs text-fg-muted`,children:[r.page,` / `,r.pageCount]}),t[26]=r.page,t[27]=r.pageCount,t[28]=s):s=t[28];let c=r.page>=(r.pageCount??1),l;t[29]===r?l=t[30]:(l=()=>r.setPage(Math.min(r.pageCount??r.page,r.page+1)),t[29]=r,t[30]=l);let u;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(M,{className:`size-3.5`}),t[31]=u):u=t[31];let d;t[32]!==c||t[33]!==l?(d=(0,Q.jsx)(Be,{label:`Next page`,disabled:c,onClick:l,children:u}),t[32]=c,t[33]=l,t[34]=d):d=t[34];let f;t[35]!==s||t[36]!==d||t[37]!==o?(f=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[o,s,d]},`page`),t[35]=s,t[36]=d,t[37]=o,t[38]=f):f=t[38],e.push(f)}if(d){let n;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`size-3.5`}),t[39]=n):n=t[39];let s;t[40]===a?s=t[41]:(s=(0,Q.jsx)(Be,{label:`Zoom out`,onClick:a,children:n}),t[40]=a,t[41]=s);let c;t[42]===r.zoom?c=t[43]:(c=Math.round(r.zoom*100),t[42]=r.zoom,t[43]=c);let l;t[44]!==o||t[45]!==c?(l=(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-14 rounded px-1.5 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:o,title:`Reset zoom`,children:[c,`%`]}),t[44]=o,t[45]=c,t[46]=l):l=t[46];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(f,{className:`size-3.5`}),t[47]=d):d=t[47];let p;t[48]===i?p=t[49]:(p=(0,Q.jsx)(Be,{label:`Zoom in`,onClick:i,children:d}),t[48]=i,t[49]=p);let m;t[50]!==p||t[51]!==s||t[52]!==l?(m=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[s,l,p]},`zoom`),t[50]=p,t[51]=s,t[52]=l,t[53]=m):m=t[53],e.push(m)}if(v){let n;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(p,{className:`size-3.5`}),t[54]=n):n=t[54];let r;t[55]===s?r=t[56]:(r=(0,Q.jsx)(Be,{label:`Rotate`,onClick:s,children:n},`rotate`),t[55]=s,t[56]=r),e.push(r)}if(g){let n;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[57]=n):n=t[57];let i;t[58]===c?i=t[59]:(i=e=>c(e.target.value),t[58]=c,t[59]=i);let a;t[60]!==r.searchQuery||t[61]!==i?(a=(0,Q.jsxs)(`label`,{className:`flex min-w-40 items-center gap-1 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs text-fg-muted dark:border-edge`,children:[n,(0,Q.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:r.searchQuery,onChange:i,placeholder:`Search`})]},`search`),t[60]=r.searchQuery,t[61]=i,t[62]=a):a=t[62],e.push(a)}x=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:e}),t[9]=b,t[10]=v,t[11]=g,t[12]=d,t[13]=r,t[14]=s,t[15]=c,t[16]=i,t[17]=a,t[18]=o,t[19]=x}else x=t[19];return x}function Be(e){let t=(0,K.c)(6),{label:n,disabled:r,onClick:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=h(`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-40`),t[0]=o):o=t[0];let s;return t[1]!==a||t[2]!==r||t[3]!==n||t[4]!==i?(s=(0,Q.jsx)(`button`,{type:`button`,className:o,title:n,"aria-label":n,disabled:r,onClick:i,children:a}),t[1]=a,t[2]=r,t[3]=n,t[4]=i,t[5]=s):s=t[5],s}function Ve(e){let t=Re(e.type),n=pe(e.id),[r,i]=(0,q.useState)(n.zoom),[a,o]=(0,q.useState)(n.rotation),[s,c]=(0,q.useState)(n.page),[l,u]=(0,q.useState)(n.pageCount),[d,f]=(0,q.useState)(n.searchQuery),p=(0,q.useCallback)(e=>{c(Math.max(1,Math.min(l??e,Math.floor(e))))},[l]);(0,q.useEffect)(()=>{let t=pe(e.id);i(t.zoom),o(t.rotation),c(t.page),u(t.pageCount),f(t.searchQuery)},[e.id,e.type]);let m=(0,q.useRef)({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d});return m.current={zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d},(0,q.useEffect)(()=>()=>me(e.id,m.current),[e.id]),{plugin:t,controls:(0,q.useMemo)(()=>({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d,setPageCount:u,setPage:p}),[s,l,a,d,p,r]),onZoomIn:()=>i(e=>Math.min(4,Number((e+.15).toFixed(2)))),onZoomOut:()=>i(e=>Math.max(.25,Number((e-.15).toFixed(2)))),onZoomReset:()=>{i(1),o(0)},onRotate:()=>o(e=>(e+90)%360),onSearchChange:f}}function He(e){let t=(0,K.c)(8),{controller:n}=e,r;return t[0]!==n.controls||t[1]!==n.onRotate||t[2]!==n.onSearchChange||t[3]!==n.onZoomIn||t[4]!==n.onZoomOut||t[5]!==n.onZoomReset||t[6]!==n.plugin?(r=(0,Q.jsx)(ze,{plugin:n.plugin,controls:n.controls,onZoomIn:n.onZoomIn,onZoomOut:n.onZoomOut,onZoomReset:n.onZoomReset,onRotate:n.onRotate,onSearchChange:n.onSearchChange}),t[0]=n.controls,t[1]=n.onRotate,t[2]=n.onSearchChange,t[3]=n.onZoomIn,t[4]=n.onZoomOut,t[5]=n.onZoomReset,t[6]=n.plugin,t[7]=r):r=t[7],r}function Ue(e){let t=(0,K.c)(14),n;t[0]===e.language?n=t[1]:(n=c(e.language),t[0]=e.language,t[1]=n);let r=n,{controller:i}=e;if(e.loading){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-4 py-6`,"aria-busy":`true`,children:[(0,Q.jsx)(g,{className:`h-5 w-48 max-w-full`}),(0,Q.jsx)(g,{className:`h-4 w-full`}),(0,Q.jsx)(g,{className:`h-4 w-11/12`}),(0,Q.jsx)(g,{className:`h-4 w-3/4`}),(0,Q.jsx)(g,{className:`mt-3 min-h-48 flex-1 rounded-lg`})]}),t[2]=e):e=t[2],e}if(e.loadError){let n=(e.descriptor.context===`workspace`?r.workspace.loadError:r.chat.attachmentPreviewLoadError)+`: `+e.loadError,i;return t[3]===n?i=t[4]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n})}),t[3]=n,t[4]=i),i}if(e.descriptor.context===`attachment`&&e.showExtractedText&&e.descriptor.type!==`image`){let n=e.extractedText||r.chat.attachmentPreviewNoText,i;return t[5]===n?i=t[6]:(i=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-hover/40 p-4 dark:border-edge`,children:(0,Q.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg-muted`,children:n})})}),t[5]=n,t[6]=i),i}let a=`${e.descriptor.id}:${i.plugin.id}`,o;t[7]!==i.controls||t[8]!==e?(o={...e,controls:i.controls},t[7]=i.controls,t[8]=e,t[9]=o):o=t[9];let s;return t[10]!==i.plugin.render||t[11]!==a||t[12]!==o?(s=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Q.jsx)(We,{pluginRender:i.plugin.render,props:o},a)}),t[10]=i.plugin.render,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function We(e){let t=(0,K.c)(5),{pluginRender:n,props:r}=e,i;t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:i}),t[3]=i,t[4]=a),a}export{ae as _,ye as a,me as c,G as d,F as f,re as g,W as h,ve as i,fe as l,ie as m,Ue as n,be as o,P as p,Ve as r,pe as s,He as t,Y as u,N as v,M as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-BYdvIuPj.js";import{t as o}from"./messages-lc5BjBtX.js";import{t as s}from"./createLucideIcon-DPHK1VkS.js";import{t as c}from"./activity-YogQEteU.js";import{t as l}from"./bot-DjLkhyZL.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./circle-pause-CN9jYH2s.js";import{t as f}from"./clock-3-DnrAnuyZ.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./message-square-fVE7Ghj1.js";import{t as g}from"./pause-DuPxgSxk.js";import{t as _}from"./play-kxZvpBg8.js";import{t as v}from"./rotate-ccw-JM1TBLpp.js";import{t as y}from"./rotate-cw-LIg3Am9S.js";import{t as b}from"./sparkles-DHlfQFAF.js";import{t as x}from"./triangle-alert-2JXFNNKU.js";import{t as S}from"./volume-2-BSJhAY97.js";import{t as C}from"./zap-dximCGjy.js";import{t as w}from"./cn-0WouolD0.js";import{a as T}from"./session-manager-C-oe-9_N.js";import{i as E}from"./vendor-swr-CdRzEUwF.js";import{t as D}from"./button-C5tRaJxt.js";import{t as O}from"./automation-api-Cc5X3Q1t.js";var k=s(`audio-lines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),A=s(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),j=s(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),M=s(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),N=n(),P=e(t(),1),F=r(),I=(0,P.forwardRef)(function(e,t){let n=(0,N.c)(36),r,i,a,o,s,c,l;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],l=n[7]):({input:a,labels:o,className:i,showLabel:s,disabled:c,hideNativeTitle:l,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,f=l!==void 0&&l,p;n[8]===a?p=n[9]:(p=typeof a==`function`?a():a,n[8]=a,n[9]=p);let h=p,y=T(L),b=T(R),x=T(z),C=y?.type===h.source.type&&y.id===h.source.id,E=C?b:`idle`,D=E===`preparing`?o.preparing:E===`playing`?o.pause:E===`paused`?o.resume:E===`error`?o.retry:o.read,O;n[10]!==a||n[11]!==x?(O=()=>x(typeof a==`function`?a():a),n[10]=a,n[11]=x,n[12]=O):O=n[12];let k;n[13]!==d||n[14]!==h.text?(k=d||!h.text.trim(),n[13]=d,n[14]=h.text,n[15]=k):k=n[15];let A=f?void 0:D,j=C&&(E===`playing`||E===`paused`),M=u?`min-h-11 gap-1.5 px-2.5 text-sm font-medium sm:min-h-8 sm:text-xs`:`size-11 sm:size-9`,P=C&&`bg-surface-active text-accent`,I;n[16]!==i||n[17]!==P||n[18]!==M?(I=w(`inline-flex shrink-0 items-center justify-center rounded-lg text-fg-muted transition-colors transition-transform duration-150 ease-out`,`hover:bg-surface-hover hover:text-fg active:scale-95 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,M,P,i),n[16]=i,n[17]=P,n[18]=M,n[19]=I):I=n[19];let B;n[20]===E?B=n[21]:(B=E===`preparing`?(0,F.jsx)(m,{className:`size-4 animate-spin`,"aria-hidden":!0}):E===`playing`?(0,F.jsx)(g,{className:`size-4`,"aria-hidden":!0}):E===`paused`?(0,F.jsx)(_,{className:`size-4`,"aria-hidden":!0}):E===`error`?(0,F.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,F.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n[20]=E,n[21]=B);let V;n[22]!==D||n[23]!==u?(V=u?(0,F.jsx)(`span`,{children:D}):null,n[22]=D,n[23]=u,n[24]=V):V=n[24];let H;return n[25]!==r||n[26]!==D||n[27]!==t||n[28]!==I||n[29]!==B||n[30]!==V||n[31]!==O||n[32]!==k||n[33]!==A||n[34]!==j?(H=(0,F.jsxs)(`button`,{...r,ref:t,type:`button`,onClick:O,disabled:k,title:A,"aria-label":D,"aria-pressed":j,className:I,children:[B,V]}),n[25]=r,n[26]=D,n[27]=t,n[28]=I,n[29]=B,n[30]=V,n[31]=O,n[32]=k,n[33]=A,n[34]=j,n[35]=H):H=n[35],H});function L(e){return e.source}function R(e){return e.status}function z(e){return e.requestStart}function B(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e)}function V(e,t){if(!e.enabled||e.trigger.kind!==`event`||e.trigger.eventType!==t.eventType||e.trigger.source&&e.trigger.source!==t.source)return!1;let n=e.trigger.payloadMatch;if(!n)return!0;let r=t.eventPayload??{};return Object.entries(n).every(([e,t])=>Object.is(r[e],t))}function H(e,t){let n=e.trigger,r=t.explain;return n.kind===`event`?[W(n.eventType,n.source,t),G(n.payloadMatch,t),q(e.safety,t),K(e.action,t)]:[r.triggerMatched,K(e.action,t)]}function U(e,t,n){let r=e.triggerSnapshot,i=Y(t),a=n.explain;return r.kind===`event`?[i?W(i.type,i.source,n):W(r.eventType,r.source,n),G(r.payloadMatch,n),q(J(t),n),K(e.actionSnapshot,n)]:r.kind===`manual`?[a.manual,K(e.actionSnapshot,n)]:r.kind===`webhook`?[a.webhook,K(e.actionSnapshot,n)]:[a.schedule,K(e.actionSnapshot,n)]}function W(e,t,n){let r=n.explain;return t?B(r.eventFrom,{eventType:e,source:t}):B(r.event,{eventType:e})}function G(e,t){if(!e||Object.keys(e).length===0)return t.explain.noPayloadFilter;let n=Object.entries(e).slice(0,3).map(([e,t])=>`${e}=${String(t)}`).join(`, `);return B(t.explain.payloadMatched,{pairs:n})}function K(e,t){return e.kind===`task_command`?`Starts task ${e.taskId}.`:e.kind===`system`?`Runs system capability ${e.capability}.`:t.explain.actionAgent}function q(e,t){let n=e?.mode??`auto_apply`;return B(t.explain.safetyMode,{mode:t.safety[n]})}function J(e){if(!e.data||typeof e.data!=`object`||Array.isArray(e.data))return;let t=e.data.safety;if(!t||typeof t!=`object`||Array.isArray(t))return;let n=t.mode;return n===`suggest_only`||n===`ask_before_apply`||n===`auto_apply`?{mode:n}:void 0}function Y(e){if(!e.data||typeof e.data!=`object`||Array.isArray(e.data))return null;let t=e.data.event;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;return typeof n.type!=`string`||!n.type.trim()?null:{type:n.type,source:typeof n.source==`string`?n.source:void 0}}function X(e){return e===`succeeded`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:e===`cancelled`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:`border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300`}function Z(e,t){return new Date(e).toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ee(e){return e.some(e=>[`queued`,`running`,`cancelling`].includes(e.run.status))}function Q(e){return e===`failed`||e===`timeout`||e===`cancelled`}function te(e){let t=new Map;for(let{run:n}of e){let e=t.get(n.automationId),r=!e||n.createdAtMs>e.latest.createdAtMs?n:e.latest;t.set(n.automationId,{latest:r,hadAttention:!!e?.hadAttention||Q(n.status)})}let n={total:t.size,succeeded:0,active:0,attention:0,recovered:0};for(let{latest:e,hadAttention:r}of t.values())e.status===`succeeded`&&(n.succeeded+=1),e.status===`succeeded`&&r&&(n.recovered+=1),(e.status===`queued`||e.status===`running`||e.status===`cancelling`)&&(n.active+=1),Q(e.status)&&(n.attention+=1,n.latestAttentionRun??=e);return n}function ne(e){let t=new Map;for(let{run:n}of e){let e=t.get(n.automationId);(!e||n.createdAtMs>e.createdAtMs)&&t.set(n.automationId,n)}return t}function $(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),e)}function re(e){let t=(0,N.c)(47),{health:n,labels:r,primaryRepairBusy:i,onPrimaryRepair:a}=e,o=n.attention>0,s=n.active>0,c=n.recovered>0,l;t[0]!==s||t[1]!==c||t[2]!==n.active||t[3]!==n.attention||t[4]!==n.latestAttentionRun?.automationName||t[5]!==n.recovered||t[6]!==n.succeeded||t[7]!==n.total||t[8]!==r.feedback.summaryHealthy||t[9]!==r.feedback.summaryNeedsAttention||t[10]!==r.feedback.summaryRecovered||t[11]!==r.feedback.summaryRunning||t[12]!==r.feedback.thisAutomation||t[13]!==o?(l=o?$(r.feedback.summaryNeedsAttention,{total:n.total,attention:n.attention,name:n.latestAttentionRun?.automationName??r.feedback.thisAutomation}):s?$(r.feedback.summaryRunning,{total:n.total,active:n.active}):c?$(r.feedback.summaryRecovered,{total:n.total,recovered:n.recovered,succeeded:n.succeeded}):$(r.feedback.summaryHealthy,{total:n.total,succeeded:n.succeeded}),t[0]=s,t[1]=c,t[2]=n.active,t[3]=n.attention,t[4]=n.latestAttentionRun?.automationName,t[5]=n.recovered,t[6]=n.succeeded,t[7]=n.total,t[8]=r.feedback.summaryHealthy,t[9]=r.feedback.summaryNeedsAttention,t[10]=r.feedback.summaryRecovered,t[11]=r.feedback.summaryRunning,t[12]=r.feedback.thisAutomation,t[13]=o,t[14]=l):l=t[14];let d=l,p=o?`text-amber-800 dark:text-amber-200`:`text-fg-muted`,m;t[15]===p?m=t[16]:(m=w(`break-words text-xs leading-5`,p),t[15]=p,t[16]=m);let h;t[17]!==d||t[18]!==m?(h=(0,F.jsx)(`p`,{className:m,children:d}),t[17]=d,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==n.succeeded||t[21]!==r.feedback.succeededCount?(g=n.succeeded?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.succeededCount,{count:n.succeeded})]}):null,t[20]=n.succeeded,t[21]=r.feedback.succeededCount,t[22]=g):g=t[22];let _;t[23]!==n.active||t[24]!==r.feedback.activeCount?(_=n.active?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-blue-500/25 bg-blue-500/10 px-2 py-0.5 text-xs text-blue-700 dark:text-blue-300`,children:[(0,F.jsx)(f,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.activeCount,{count:n.active})]}):null,t[23]=n.active,t[24]=r.feedback.activeCount,t[25]=_):_=t[25];let v;t[26]!==n.attention||t[27]!==r.feedback.attentionCount?(v=n.attention?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-amber-500/25 bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700 dark:text-amber-300`,children:[(0,F.jsx)(x,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.attentionCount,{count:n.attention})]}):null,t[26]=n.attention,t[27]=r.feedback.attentionCount,t[28]=v):v=t[28];let y;t[29]!==n.recovered||t[30]!==r.feedback.recoveredCount?(y=n.recovered?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3`,"aria-hidden":!0}),$(r.feedback.recoveredCount,{count:n.recovered})]}):null,t[29]=n.recovered,t[30]=r.feedback.recoveredCount,t[31]=y):y=t[31];let S;t[32]!==g||t[33]!==_||t[34]!==v||t[35]!==y?(S=(0,F.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:[g,_,v,y]}),t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=S):S=t[36];let C;t[37]!==r.feedback.primaryRepair||t[38]!==r.feedback.primaryRepairing||t[39]!==o||t[40]!==a||t[41]!==i?(C=o&&a?(0,F.jsx)(`div`,{className:`mt-2`,children:(0,F.jsxs)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:i,onClick:a,children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),i?r.feedback.primaryRepairing:r.feedback.primaryRepair]})}):null,t[37]=r.feedback.primaryRepair,t[38]=r.feedback.primaryRepairing,t[39]=o,t[40]=a,t[41]=i,t[42]=C):C=t[42];let T;return t[43]!==C||t[44]!==h||t[45]!==S?(T=(0,F.jsxs)(`div`,{className:`mb-3 border-l-2 border-accent/50 pl-3`,children:[h,S,C]}),t[43]=C,t[44]=h,t[45]=S,t[46]=T):T=t[46],T}function ie({eventType:e,source:t,payloadKey:n,payloadValue:r,limit:s=3,className:f,onSaveInsight:m,isInsightSaved:g}){let _=a(e=>e.language),v=o(_).automations,x=_===`zh`?`zh-CN`:`en-US`,S=[`product-automation-feedback`,e,t??``,n??``,r??``,s],[T,k]=(0,P.useState)(null),[A,j]=(0,P.useState)(null),{data:M,mutate:N}=E(e&&(!n||r!==void 0)?S:null,()=>O.productEventRuns({eventType:e,source:t,payloadKey:n,payloadValue:r,limit:s}),{revalidateOnFocus:!1,refreshInterval:e=>e?.items&&ee(e.items)?3e3:15e3}),[I,L]=(0,P.useState)({}),[R,z]=(0,P.useState)({}),B=M?.items??[],V=te(B),H=ne(B);if(!B.length)return null;let W=async(e,t)=>{k(e),j(null);try{await t(),await N()}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},G=async e=>{k(`${e.id}:repair`),j(null);try{let t=await O.repairDraft(e.id,{language:_});L(n=>({...n,[e.id]:t.repair})),z(t=>({...t,[e.id]:!1}))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},K=async(e,t,n=!1)=>{k(n?`${e.id}:applyAndRerun`:`${e.id}:applyRepair`),j(null);try{await O.update(e.automationId,t.patch),n&&await O.rerun(e.id),await N(),L(t=>{let n={...t};return delete n[e.id],n}),z(t=>{let n={...t};return delete n[e.id],n})}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(null)}},q=V.latestAttentionRun&&!I[V.latestAttentionRun.id]?V.latestAttentionRun:void 0,J=q?T===`${q.id}:repair`:!1;return(0,F.jsxs)(`section`,{className:w(`rounded-lg border border-edge bg-surface-panel p-3`,f),children:[(0,F.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`h3`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,F.jsx)(C,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate`,children:v.feedback.title})]}),(0,F.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:B.length})]}),(0,F.jsx)(re,{health:V,labels:v,primaryRepairBusy:J,onPrimaryRepair:q?()=>void G(q):void 0}),A?(0,F.jsxs)(`p`,{className:`mb-2 rounded-md border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`,role:`alert`,children:[v.feedback.actionFailed,`: `,A]}):null,(0,F.jsx)(`ul`,{className:`grid gap-2`,children:B.map(({run:e,triggerEvent:t})=>{let n=H.get(e.automationId),r=n?.id===e.id,a=Q(e.status)&&!r,o=a&&n?.status===`succeeded`,s=I[e.id],f=R[e.id]??!1,_=T===`${e.id}:repair`,S=T===`${e.id}:applyRepair`,C=T===`${e.id}:applyAndRerun`,E=U(e,t,v),k=g?.(e)??!1,A=e.status===`succeeded`&&!!e.summary&&!!m&&!k,j=T===`${e.id}:saveInsight`;return(0,F.jsxs)(`li`,{className:`rounded-md border border-edge/70 bg-surface-inset/35 px-2.5 py-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,F.jsx)(l,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.automationName})]}),(0,F.jsx)(`p`,{className:`mt-1 line-clamp-2 break-words text-xs text-fg-muted`,children:e.error||e.summary||t.message})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,F.jsx)(`span`,{className:w(`rounded-full border px-2 py-0.5 text-xs`,X(e.status)),children:v.status[e.status]}),a?(0,F.jsx)(`span`,{className:`rounded-full border border-emerald-500/25 bg-emerald-500/10 px-2 py-0.5 text-xs text-emerald-700 dark:text-emerald-300`,children:o?v.feedback.recovered:v.feedback.historical}):null]})]}),(0,F.jsx)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-xs text-fg-muted`,children:(0,F.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,F.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`truncate`,children:Z(t.createdAtMs,x)})]})}),(0,F.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/60 bg-surface-base/45 px-2.5 py-2`,children:[(0,F.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:v.explain.whyRan}),(0,F.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:E.map(e=>(0,F.jsx)(`span`,{className:`rounded-full border border-edge/70 bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e))})]}),s?(0,F.jsxs)(`div`,{className:`mt-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-amber-800 dark:text-amber-200`,children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),v.repair.title]}),(0,F.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg`,children:s.explanation}),s.expectedEffect?(0,F.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:s.expectedEffect}):null,s.risks.length?(0,F.jsx)(`ul`,{className:`mt-2 list-disc space-y-1 pl-4 text-xs text-fg-muted`,children:s.risks.slice(0,3).map(e=>(0,F.jsx)(`li`,{children:e},e))}):null,s.requiresApproval?(0,F.jsxs)(`label`,{className:`mt-2 flex items-start gap-2 text-xs text-fg`,children:[(0,F.jsx)(`input`,{className:`mt-0.5`,type:`checkbox`,checked:f,onChange:t=>{z(n=>({...n,[e.id]:t.target.checked}))}}),(0,F.jsx)(`span`,{children:v.repair.approval})]}):null,(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:[(0,F.jsx)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>{L(t=>{let n={...t};return delete n[e.id],n})},children:v.draft.discard}),(0,F.jsx)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:s.requiresApproval&&!f||T!==null,onClick:()=>void K(e,s),children:S?v.feedback.working:v.repair.apply}),(0,F.jsxs)(D,{variant:`primary`,className:`h-7 rounded-md px-2 text-xs`,disabled:s.requiresApproval&&!f||T!==null,onClick:()=>void K(e,s,!0),children:[(0,F.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),C?v.feedback.working:v.feedback.applyAndRerun]})]})]}):null,(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[k?(0,F.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1 rounded-md border border-emerald-500/25 bg-emerald-500/10 px-2 text-xs text-emerald-700 dark:text-emerald-300`,children:[(0,F.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.savedInsight]}):null,A?(0,F.jsxs)(D,{variant:`secondary`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:saveInsight`,()=>Promise.resolve(m(e))),children:[(0,F.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),j?v.feedback.savingInsight:v.feedback.saveInsight]}):null,e.conversationId?(0,F.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,children:(0,F.jsxs)(i,{to:`/chat/${encodeURIComponent(e.conversationId)}`,children:[(0,F.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.chat]})}):null,null,r&&Q(e.status)&&!s?(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void G(e),children:[(0,F.jsx)(b,{className:`size-3.5`,"aria-hidden":!0}),_?v.repair.generating:v.repair.suggest]}):null,(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:rerun`,()=>O.rerun(e.id)),children:[(0,F.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),T===`${e.id}:rerun`?v.feedback.working:v.feedback.rerun]}),(0,F.jsxs)(D,{variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,disabled:T!==null,onClick:()=>void W(`${e.id}:pause`,()=>O.pause(e.automationId)),children:[(0,F.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),T===`${e.id}:pause`?v.feedback.working:v.feedback.pause]}),(0,F.jsx)(D,{asChild:!0,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,children:(0,F.jsxs)(i,{to:`/automations?run=${encodeURIComponent(e.id)}`,children:[(0,F.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),v.feedback.open]})})]})]},e.id)})})]})}export{I as a,A as c,V as i,k as l,H as n,M as o,B as r,j as s,ie as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,r,t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{d as n,r,t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-BYdvIuPj.js";import{t as o}from"./skeleton-DzdOeGYz.js";import{i as s,o as c}from"./product-delivery-4gEqUIsK.js";import{i as l}from"./vendor-swr-CdRzEUwF.js";import{n as u}from"./api-BtngCZrB.js";import{t as d}from"./open-route-MyZ2sB9C.js";var f=e(),p=t();function m(){let e=(0,f.c)(14),t=n(),i=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=l(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=i?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=c({...m,title:m.id,capabilities:[`open`]}),n;return e[3]!==t||e[4]!==i?(n=t?(0,p.jsx)(r,{to:t,replace:!0}):(0,p.jsx)(g,{message:i?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:i}),e[3]=t,e[4]=i,e[5]=n):n=e[5],n}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?i?`找不到这个应用,它可能已被删除。`:`This app was not found and may have been deleted.`:y instanceof Error?y.message:i?`无法打开这个应用。`:`Unable to open this app.`,n;return e[6]!==t||e[7]!==i?(n=(0,p.jsx)(g,{message:t,zh:i}),e[6]=t,e[7]=i,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=d(v),e[9]=v,e[10]=t);let n;return e[11]===t?n=e[12]:(n=(0,p.jsx)(r,{to:t,replace:!0}),e[11]=t,e[12]=n),n}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(o,{className:`h-6 w-48`}),(0,p.jsx)(o,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,f.c)(7),{message:n,zh:r}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=r?`查看应用`:`View apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(i,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
|