@hienlh/ppm 0.23.8 → 0.23.9
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/CHANGELOG.md +7 -0
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/cli-reference.md +4 -4
- package/assets/skills/ppm/references/http-api.md +1 -1
- package/dist/web/assets/{accounts-settings-section-BNcPvEq1.js → accounts-settings-section-hxemqOZw.js} +1 -1
- package/dist/web/assets/accounts-settings-section-hxemqOZw.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-hxemqOZw.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-DfVRMUHS.js → ai-resource-editor-uI76obDR.js} +1 -1
- package/dist/web/assets/ai-resource-editor-uI76obDR.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-uI76obDR.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-Ezhw4Fef.js → ai-settings-section-Bmy9p9l-.js} +1 -1
- package/dist/web/assets/ai-settings-section-Bmy9p9l-.js.br +0 -0
- package/dist/web/assets/ai-settings-section-Bmy9p9l-.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-B_0-P8jx.js → ai-settings-section-CF39jnOD.js} +1 -1
- package/dist/web/assets/{appearance-settings-section-CPOAp0fY.js → appearance-settings-section-BCJK8_N6.js} +1 -1
- package/dist/web/assets/appearance-settings-section-BCJK8_N6.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-BCJK8_N6.js.gz +0 -0
- package/dist/web/assets/{apps-panel-Cz7_o-M4.js → apps-panel-Dcu2wMIn.js} +1 -1
- package/dist/web/assets/apps-panel-Dcu2wMIn.js.br +0 -0
- package/dist/web/assets/apps-panel-Dcu2wMIn.js.gz +0 -0
- package/dist/web/assets/{branch-review-tab-BPx3kHrM.js → branch-review-tab-DEkdGqaE.js} +1 -1
- package/dist/web/assets/branch-review-tab-DEkdGqaE.js.br +0 -0
- package/dist/web/assets/branch-review-tab-DEkdGqaE.js.gz +0 -0
- package/dist/web/assets/{chat-tab-BadDM_j8.js → chat-tab-BVyBR3yR.js} +1 -1
- package/dist/web/assets/chat-tab-BVyBR3yR.js.br +5 -0
- package/dist/web/assets/chat-tab-BVyBR3yR.js.gz +0 -0
- package/dist/web/assets/{chat-tab-IqAY4c7p.js → chat-tab-Dj8kFoUi.js} +3 -3
- package/dist/web/assets/chat-tab-Dj8kFoUi.js.br +0 -0
- package/dist/web/assets/chat-tab-Dj8kFoUi.js.gz +0 -0
- package/dist/web/assets/{code-editor-Dmitw9QS.js → code-editor-BKpaBc8f.js} +3 -3
- package/dist/web/assets/code-editor-BKpaBc8f.js.br +0 -0
- package/dist/web/assets/code-editor-BKpaBc8f.js.gz +0 -0
- package/dist/web/assets/{codex-reset-credit-button-D2hal4bG.js → codex-reset-credit-button-Xt1ttURe.js} +1 -1
- package/dist/web/assets/codex-reset-credit-button-Xt1ttURe.js.br +0 -0
- package/dist/web/assets/codex-reset-credit-button-Xt1ttURe.js.gz +0 -0
- package/dist/web/assets/{conflict-editor-Cj_gUncw.js → conflict-editor-C9TZTGN2.js} +1 -1
- package/dist/web/assets/conflict-editor-C9TZTGN2.js.br +0 -0
- package/dist/web/assets/conflict-editor-C9TZTGN2.js.gz +0 -0
- package/dist/web/assets/{csv-preview-Be3ODNj0.js → csv-preview-BfX8PrGn.js} +1 -1
- package/dist/web/assets/csv-preview-BfX8PrGn.js.br +0 -0
- package/dist/web/assets/csv-preview-BfX8PrGn.js.gz +0 -0
- package/dist/web/assets/{database-viewer-B1b--4y8.js → database-viewer-DVHa4Mw7.js} +1 -1
- package/dist/web/assets/database-viewer-DVHa4Mw7.js.br +0 -0
- package/dist/web/assets/database-viewer-DVHa4Mw7.js.gz +0 -0
- package/dist/web/assets/{design-tab-8wi0IHss.js → design-tab-Dc8RIIMj.js} +1 -1
- package/dist/web/assets/design-tab-Dc8RIIMj.js.br +0 -0
- package/dist/web/assets/design-tab-Dc8RIIMj.js.gz +0 -0
- package/dist/web/assets/{designs-sidebar-panel-D5-1Q8zQ.js → designs-sidebar-panel-BDEgeNCO.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-BDEgeNCO.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-BDEgeNCO.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-Dcxk6UTG.js → diff-viewer-DYAwueSh.js} +1 -1
- package/dist/web/assets/diff-viewer-DYAwueSh.js.br +0 -0
- package/dist/web/assets/diff-viewer-DYAwueSh.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-BVJQnTSV.js → editor-language-service-DufWCv_b.js} +1 -1
- package/dist/web/assets/editor-language-service-DufWCv_b.js.br +0 -0
- package/dist/web/assets/editor-language-service-DufWCv_b.js.gz +0 -0
- package/dist/web/assets/{explorer-body-CTkrlrI3.js → explorer-body-DW838S7p.js} +1 -1
- package/dist/web/assets/explorer-body-DW838S7p.js.br +0 -0
- package/dist/web/assets/explorer-body-DW838S7p.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-DH5AD3Ng.js → explorer-window-content-Cw4njYF9.js} +1 -1
- package/dist/web/assets/explorer-window-content-Cw4njYF9.js.br +0 -0
- package/dist/web/assets/explorer-window-content-Cw4njYF9.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-BJr6ccWw.js → extension-manager-section-CsudP-cF.js} +1 -1
- package/dist/web/assets/extension-manager-section-CsudP-cF.js.br +0 -0
- package/dist/web/assets/extension-manager-section-CsudP-cF.js.gz +0 -0
- package/dist/web/assets/{extension-webview-CYNXHd8D.js → extension-webview-BoeNtrL9.js} +1 -1
- package/dist/web/assets/extension-webview-BoeNtrL9.js.br +0 -0
- package/dist/web/assets/extension-webview-BoeNtrL9.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-JX7o4lex.js → files-settings-section-C998uv6a.js} +1 -1
- package/dist/web/assets/files-settings-section-C998uv6a.js.br +0 -0
- package/dist/web/assets/files-settings-section-C998uv6a.js.gz +0 -0
- package/dist/web/assets/{general-settings-section-kF94Mz5q.js → general-settings-section-Dm0NPoo2.js} +1 -1
- package/dist/web/assets/general-settings-section-Dm0NPoo2.js.br +0 -0
- package/dist/web/assets/general-settings-section-Dm0NPoo2.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-Crlp9ofM.js → git-log-panel-ZMLU_QWd.js} +1 -1
- package/dist/web/assets/git-log-panel-ZMLU_QWd.js.br +0 -0
- package/dist/web/assets/git-log-panel-ZMLU_QWd.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-O6MO5dKU.js → glide-data-grid-BuVHCdOY.js} +1 -1
- package/dist/web/assets/glide-data-grid-BuVHCdOY.js.br +0 -0
- package/dist/web/assets/glide-data-grid-BuVHCdOY.js.gz +0 -0
- package/dist/web/assets/{group-chat-tab-DGLSGf37.js → group-chat-tab-B2wk54Kb.js} +1 -1
- package/dist/web/assets/group-chat-tab-B2wk54Kb.js.br +0 -0
- package/dist/web/assets/group-chat-tab-B2wk54Kb.js.gz +0 -0
- package/dist/web/assets/{index-DQCw6d-2.js → index-D41mthBS.js} +5 -5
- package/dist/web/assets/index-D41mthBS.js.br +0 -0
- package/dist/web/assets/index-D41mthBS.js.gz +0 -0
- package/dist/web/assets/{jira-watcher-section-DwM7gqHT.js → jira-watcher-section-C1vWzVZJ.js} +1 -1
- package/dist/web/assets/{keybindings-store-CJtEHFIQ.js → keybindings-store-XUcWE5_j.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-CewWGwiF.js → keyboard-shortcuts-section-CDYzFVbt.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-CDYzFVbt.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-CDYzFVbt.js.gz +0 -0
- package/dist/web/assets/{language-servers-section-nricdxke.js → language-servers-section-DQH0qqem.js} +2 -2
- package/dist/web/assets/language-servers-section-DQH0qqem.js.br +0 -0
- package/dist/web/assets/language-servers-section-DQH0qqem.js.gz +0 -0
- package/dist/web/assets/{lsp-client-DRMEWb-z.js → lsp-client-Ce_E8lQ7.js} +1 -1
- package/dist/web/assets/lsp-client-Ce_E8lQ7.js.br +0 -0
- package/dist/web/assets/lsp-client-Ce_E8lQ7.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-Dab9Us6u.js → markdown-renderer-C9inQ_Z3.js} +1 -1
- package/dist/web/assets/markdown-renderer-C9inQ_Z3.js.br +0 -0
- package/dist/web/assets/markdown-renderer-C9inQ_Z3.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-D5-xliE9.js → markdown-renderer-CS193h6D.js} +1 -1
- package/dist/web/assets/{mobile-explorer-sheet-DtgdpvJ9.js → mobile-explorer-sheet-Dp5-b059.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-Dp5-b059.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-Dp5-b059.js.gz +0 -0
- package/dist/web/assets/{new-design-dialog-Dd5KDB_p.js → new-design-dialog-Bw3xciYg.js} +1 -1
- package/dist/web/assets/new-design-dialog-Bw3xciYg.js.br +0 -0
- package/dist/web/assets/new-design-dialog-Bw3xciYg.js.gz +0 -0
- package/dist/web/assets/{notification-store-D2vTyp_Q.js → notification-store-3PN0fYtT.js} +1 -1
- package/dist/web/assets/{performance-panel-LMGefOQ2.js → performance-panel-Bl3RwJGZ.js} +1 -1
- package/dist/web/assets/performance-panel-Bl3RwJGZ.js.br +0 -0
- package/dist/web/assets/performance-panel-Bl3RwJGZ.js.gz +0 -0
- package/dist/web/assets/{ppmbot-settings-section-D67u6gPi.js → ppmbot-settings-section-BtKmsfqX.js} +1 -1
- package/dist/web/assets/ppmbot-settings-section-BtKmsfqX.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-BtKmsfqX.js.gz +0 -0
- package/dist/web/assets/{problems-panel-DKgIw4uZ.js → problems-panel-dzNhRTnM.js} +1 -1
- package/dist/web/assets/problems-panel-dzNhRTnM.js.br +0 -0
- package/dist/web/assets/problems-panel-dzNhRTnM.js.gz +0 -0
- package/dist/web/assets/{process-table-BIAgC_jG.js → process-table-B9rXN1NM.js} +1 -1
- package/dist/web/assets/process-table-B9rXN1NM.js.br +0 -0
- package/dist/web/assets/process-table-B9rXN1NM.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-CFiYcTBA.js → proxy-settings-section-BAFgwYyD.js} +1 -1
- package/dist/web/assets/proxy-settings-section-BAFgwYyD.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-BAFgwYyD.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-clipboard-notice-Bs3fZSRw.js → remote-desktop-clipboard-notice-C6tt5SDH.js} +1 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-C6tt5SDH.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-C6tt5SDH.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-sheet-DgxTdWMh.js → remote-desktop-mobile-sheet-C6gFMzXV.js} +2 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-C6gFMzXV.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-C6gFMzXV.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-DgGOfPVY.js → remote-desktop-mobile-view-kD5Q339l.js} +1 -1
- package/dist/web/assets/remote-desktop-mobile-view-kD5Q339l.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-kD5Q339l.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-readiness-gate-DOWryrQx.js → remote-desktop-readiness-gate-CqnG8BlK.js} +1 -1
- package/dist/web/assets/remote-desktop-readiness-gate-CqnG8BlK.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CqnG8BlK.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-window-content-7t0wQsHx.js → remote-desktop-window-content-BjZdvaQX.js} +1 -1
- package/dist/web/assets/remote-desktop-window-content-BjZdvaQX.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-BjZdvaQX.js.gz +0 -0
- package/dist/web/assets/{schedules-settings-section-DGhG-b5O.js → schedules-settings-section-BrsGPl6j.js} +1 -1
- package/dist/web/assets/schedules-settings-section-BrsGPl6j.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-BrsGPl6j.js.gz +0 -0
- package/dist/web/assets/{services-panel-0klE3O4g.js → services-panel-mDvWNRkg.js} +1 -1
- package/dist/web/assets/services-panel-mDvWNRkg.js.br +0 -0
- package/dist/web/assets/services-panel-mDvWNRkg.js.gz +0 -0
- package/dist/web/assets/{settings-body-CfqpqFfq.js → settings-body-DJKHimA7.js} +2 -2
- package/dist/web/assets/settings-body-DJKHimA7.js.br +0 -0
- package/dist/web/assets/settings-body-DJKHimA7.js.gz +0 -0
- package/dist/web/assets/{settings-tab-CHweH5Nh.js → settings-tab-DyLehsVr.js} +1 -1
- package/dist/web/assets/{settings-window-content-C6Od3qV7.js → settings-window-content-BMbDb3BQ.js} +1 -1
- package/dist/web/assets/{sql-query-editor-ALQ5_X0j.js → sql-query-editor-Ci0vTqmC.js} +1 -1
- package/dist/web/assets/sql-query-editor-Ci0vTqmC.js.br +0 -0
- package/dist/web/assets/sql-query-editor-Ci0vTqmC.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-DKTty_jR.js → sqlite-viewer-kOyrMUsW.js} +1 -1
- package/dist/web/assets/sqlite-viewer-kOyrMUsW.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-kOyrMUsW.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-D6J6lq7-.js → system-monitor-body-D1lzquYw.js} +2 -2
- package/dist/web/assets/system-monitor-body-D1lzquYw.js.br +0 -0
- package/dist/web/assets/system-monitor-body-D1lzquYw.js.gz +0 -0
- package/dist/web/assets/{system-monitor-tab-Di18zNNS.js → system-monitor-tab-anJ6hmrA.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-D1t30f32.js → system-monitor-window-content-BcV01XgX.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-DTcx2D0O.js → tab-host-window-content-4kbVMd0b.js} +1 -1
- package/dist/web/assets/tab-host-window-content-4kbVMd0b.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-4kbVMd0b.js.gz +0 -0
- package/dist/web/assets/{team-member-sheet-CFSbPG6n.js → team-member-sheet-K3MMar1L.js} +2 -2
- package/dist/web/assets/team-member-sheet-K3MMar1L.js.br +0 -0
- package/dist/web/assets/team-member-sheet-K3MMar1L.js.gz +0 -0
- package/dist/web/assets/{team-member-window-content-VeI6DGeM.js → team-member-window-content-DidC04eW.js} +1 -1
- package/dist/web/assets/team-member-window-content-DidC04eW.js.br +0 -0
- package/dist/web/assets/team-member-window-content-DidC04eW.js.gz +0 -0
- package/dist/web/assets/{terminal-tab-DgTfQKBI.js → terminal-tab-BlYiIu9A.js} +1 -1
- package/dist/web/assets/terminal-tab-BlYiIu9A.js.br +0 -0
- package/dist/web/assets/terminal-tab-BlYiIu9A.js.gz +0 -0
- package/dist/web/assets/{tool-cards-_fpYI1hB.js → tool-cards-BoW8_vQb.js} +2 -2
- package/dist/web/assets/tool-cards-BoW8_vQb.js.br +0 -0
- package/dist/web/assets/tool-cards-BoW8_vQb.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-Dv111BKY.js → use-inline-blame-I6_SHzP0.js} +1 -1
- package/dist/web/assets/use-inline-blame-I6_SHzP0.js.br +0 -0
- package/dist/web/assets/use-inline-blame-I6_SHzP0.js.gz +0 -0
- package/dist/web/assets/{use-lsp-CZTFJIXX.js → use-lsp-D6skvdIp.js} +1 -1
- package/dist/web/assets/use-lsp-D6skvdIp.js.br +0 -0
- package/dist/web/assets/use-lsp-D6skvdIp.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-DL2dIG5L.js → use-monaco-theme-08OELBic.js} +1 -1
- package/dist/web/assets/{use-process-kill-D7D9QvJG.js → use-process-kill-4gRMygIV.js} +1 -1
- package/dist/web/assets/use-process-kill-4gRMygIV.js.br +0 -0
- package/dist/web/assets/use-process-kill-4gRMygIV.js.gz +0 -0
- package/dist/web/assets/{use-websocket-ziY-Gz_B.js → use-websocket-C1dxvoVt.js} +1 -1
- package/dist/web/assets/{video-preview-DzwY3q9W.js → video-preview-08dogvSP.js} +1 -1
- package/dist/web/assets/video-preview-08dogvSP.js.br +0 -0
- package/dist/web/assets/video-preview-08dogvSP.js.gz +0 -0
- package/dist/web/index.html +1 -1
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/dist/web/sw.js +1 -1
- package/dist/web/sw.js.br +0 -0
- package/dist/web/sw.js.gz +0 -0
- package/package.json +1 -1
- package/src/server/routes/chat.ts +12 -4
- package/src/web/components/chat/codex-usage-panel.tsx +26 -8
- package/dist/web/assets/accounts-settings-section-BNcPvEq1.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-BNcPvEq1.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-DfVRMUHS.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-DfVRMUHS.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-Ezhw4Fef.js.br +0 -0
- package/dist/web/assets/ai-settings-section-Ezhw4Fef.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-CPOAp0fY.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-CPOAp0fY.js.gz +0 -0
- package/dist/web/assets/apps-panel-Cz7_o-M4.js.br +0 -0
- package/dist/web/assets/apps-panel-Cz7_o-M4.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-BPx3kHrM.js.br +0 -0
- package/dist/web/assets/branch-review-tab-BPx3kHrM.js.gz +0 -0
- package/dist/web/assets/chat-tab-BadDM_j8.js.br +0 -0
- package/dist/web/assets/chat-tab-BadDM_j8.js.gz +0 -0
- package/dist/web/assets/chat-tab-IqAY4c7p.js.br +0 -0
- package/dist/web/assets/chat-tab-IqAY4c7p.js.gz +0 -0
- package/dist/web/assets/code-editor-Dmitw9QS.js.br +0 -0
- package/dist/web/assets/code-editor-Dmitw9QS.js.gz +0 -0
- package/dist/web/assets/codex-reset-credit-button-D2hal4bG.js.br +0 -0
- package/dist/web/assets/codex-reset-credit-button-D2hal4bG.js.gz +0 -0
- package/dist/web/assets/conflict-editor-Cj_gUncw.js.br +0 -0
- package/dist/web/assets/conflict-editor-Cj_gUncw.js.gz +0 -0
- package/dist/web/assets/csv-preview-Be3ODNj0.js.br +0 -0
- package/dist/web/assets/csv-preview-Be3ODNj0.js.gz +0 -0
- package/dist/web/assets/database-viewer-B1b--4y8.js.br +0 -0
- package/dist/web/assets/database-viewer-B1b--4y8.js.gz +0 -0
- package/dist/web/assets/design-tab-8wi0IHss.js.br +0 -0
- package/dist/web/assets/design-tab-8wi0IHss.js.gz +0 -0
- package/dist/web/assets/designs-sidebar-panel-D5-1Q8zQ.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-D5-1Q8zQ.js.gz +0 -0
- package/dist/web/assets/diff-viewer-Dcxk6UTG.js.br +0 -0
- package/dist/web/assets/diff-viewer-Dcxk6UTG.js.gz +0 -0
- package/dist/web/assets/editor-language-service-BVJQnTSV.js.br +0 -0
- package/dist/web/assets/editor-language-service-BVJQnTSV.js.gz +0 -0
- package/dist/web/assets/explorer-body-CTkrlrI3.js.br +0 -0
- package/dist/web/assets/explorer-body-CTkrlrI3.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-DH5AD3Ng.js.br +0 -0
- package/dist/web/assets/explorer-window-content-DH5AD3Ng.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-BJr6ccWw.js.br +0 -0
- package/dist/web/assets/extension-manager-section-BJr6ccWw.js.gz +0 -0
- package/dist/web/assets/extension-webview-CYNXHd8D.js.br +0 -0
- package/dist/web/assets/extension-webview-CYNXHd8D.js.gz +0 -0
- package/dist/web/assets/files-settings-section-JX7o4lex.js.br +0 -0
- package/dist/web/assets/files-settings-section-JX7o4lex.js.gz +0 -0
- package/dist/web/assets/general-settings-section-kF94Mz5q.js.br +0 -0
- package/dist/web/assets/general-settings-section-kF94Mz5q.js.gz +0 -0
- package/dist/web/assets/git-log-panel-Crlp9ofM.js.br +0 -0
- package/dist/web/assets/git-log-panel-Crlp9ofM.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-O6MO5dKU.js.br +0 -0
- package/dist/web/assets/glide-data-grid-O6MO5dKU.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-DGLSGf37.js.br +0 -0
- package/dist/web/assets/group-chat-tab-DGLSGf37.js.gz +0 -0
- package/dist/web/assets/index-DQCw6d-2.js.br +0 -0
- package/dist/web/assets/index-DQCw6d-2.js.gz +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-CewWGwiF.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-CewWGwiF.js.gz +0 -0
- package/dist/web/assets/language-servers-section-nricdxke.js.br +0 -0
- package/dist/web/assets/language-servers-section-nricdxke.js.gz +0 -0
- package/dist/web/assets/lsp-client-DRMEWb-z.js.br +0 -0
- package/dist/web/assets/lsp-client-DRMEWb-z.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-Dab9Us6u.js.br +0 -0
- package/dist/web/assets/markdown-renderer-Dab9Us6u.js.gz +0 -0
- package/dist/web/assets/mobile-explorer-sheet-DtgdpvJ9.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-DtgdpvJ9.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-Dd5KDB_p.js.br +0 -0
- package/dist/web/assets/new-design-dialog-Dd5KDB_p.js.gz +0 -0
- package/dist/web/assets/performance-panel-LMGefOQ2.js.br +0 -0
- package/dist/web/assets/performance-panel-LMGefOQ2.js.gz +0 -0
- package/dist/web/assets/ppmbot-settings-section-D67u6gPi.js.br +0 -0
- package/dist/web/assets/ppmbot-settings-section-D67u6gPi.js.gz +0 -0
- package/dist/web/assets/problems-panel-DKgIw4uZ.js.br +0 -0
- package/dist/web/assets/problems-panel-DKgIw4uZ.js.gz +0 -0
- package/dist/web/assets/process-table-BIAgC_jG.js.br +0 -0
- package/dist/web/assets/process-table-BIAgC_jG.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-CFiYcTBA.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-CFiYcTBA.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-Bs3fZSRw.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-Bs3fZSRw.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-DgxTdWMh.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-DgxTdWMh.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DgGOfPVY.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DgGOfPVY.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-DOWryrQx.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-DOWryrQx.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-7t0wQsHx.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-7t0wQsHx.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-DGhG-b5O.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-DGhG-b5O.js.gz +0 -0
- package/dist/web/assets/services-panel-0klE3O4g.js.br +0 -0
- package/dist/web/assets/services-panel-0klE3O4g.js.gz +0 -0
- package/dist/web/assets/settings-body-CfqpqFfq.js.br +0 -0
- package/dist/web/assets/settings-body-CfqpqFfq.js.gz +0 -0
- package/dist/web/assets/sql-query-editor-ALQ5_X0j.js.br +0 -0
- package/dist/web/assets/sql-query-editor-ALQ5_X0j.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-DKTty_jR.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-DKTty_jR.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-D6J6lq7-.js.br +0 -0
- package/dist/web/assets/system-monitor-body-D6J6lq7-.js.gz +0 -0
- package/dist/web/assets/tab-host-window-content-DTcx2D0O.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-DTcx2D0O.js.gz +0 -0
- package/dist/web/assets/team-member-sheet-CFSbPG6n.js.br +0 -0
- package/dist/web/assets/team-member-sheet-CFSbPG6n.js.gz +0 -0
- package/dist/web/assets/team-member-window-content-VeI6DGeM.js.br +0 -0
- package/dist/web/assets/team-member-window-content-VeI6DGeM.js.gz +0 -0
- package/dist/web/assets/terminal-tab-DgTfQKBI.js.br +0 -0
- package/dist/web/assets/terminal-tab-DgTfQKBI.js.gz +0 -0
- package/dist/web/assets/tool-cards-_fpYI1hB.js.br +0 -0
- package/dist/web/assets/tool-cards-_fpYI1hB.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-Dv111BKY.js.br +0 -0
- package/dist/web/assets/use-inline-blame-Dv111BKY.js.gz +0 -0
- package/dist/web/assets/use-lsp-CZTFJIXX.js.br +0 -0
- package/dist/web/assets/use-lsp-CZTFJIXX.js.gz +0 -0
- package/dist/web/assets/use-process-kill-D7D9QvJG.js.br +0 -0
- package/dist/web/assets/use-process-kill-D7D9QvJG.js.gz +0 -0
- package/dist/web/assets/video-preview-DzwY3q9W.js.br +0 -0
- package/dist/web/assets/video-preview-DzwY3q9W.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{En as r,Gr as i,Gt as a,Jr as o,Mn as s,Nt as c,On as l,Qt as u,Ur as d,W as f,or as p,pr as m,ti as h,ut as g,xr as _,z as v,zt as y}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{D as b,T as x,t as S}from"./settings-store-3jIBB8gx.js";import{n as C}from"./utils-btZ8C8-R.js";import"./panel-store-DrSH3Nhp.js";import"./window-store-B4cbZ5rr.js";import"./project-store-CCimwgGF.js";import{t as w}from"./use-visual-viewport-C307OVeV.js";import"./ws-auth-J3hw0Mhc.js";import{Z as ee}from"./index-DQCw6d-2.js";import"./run-in-terminal-Cdn9PaAl.js";import{a as T,c as te,d as E,f as D,i as ne,n as re,o as O,p as k,r as A,s as ie,t as j}from"./remote-desktop-clipboard-notice-Bs3fZSRw.js";var M=e(t(),1);function ae(e,t,n=10,r=300){let i=Math.hypot(t.x-e.x,t.y-e.y),a=t.t-e.t;return i<=n&&a<=r}function oe(e,t,n=15){return Math.abs(t-e)>n?`pinch`:`scroll`}function N(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function P(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function F(e,t,n){return Math.min(Math.max(e,t),n)}function I(e,t,n){return[{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!0},{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!1}]}function se(e,t,n){return{start:{x:e,y:t,t:performance.now()},last:{x:e,y:t},moved:!1,rect:n}}function ce(e,t,n,r,i,a){let o=Math.hypot(t-e.start.x,n-e.start.y);if(r===`touch`){if(!e.moved&&o>10){e.moved=!0;let r=E(e.start.x,e.start.y,e.rect,i);return e.last={x:t,y:n},{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!0}}}if(e.last={x:t,y:n},!e.moved)return{};let r=E(t,n,e.rect,i);return{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:null,down:null}}}let s=(t-e.last.x)/i.scale,c=(n-e.last.y)/i.scale;return o>10&&(e.moved=!0),e.last={x:t,y:n},{cursor:{xFrac:F(a.xFrac+s/e.rect.width,0,1),yFrac:F(a.yFrac+c/e.rect.height,0,1)},sendCursorMove:!0}}function L(e,t,n,r,i,a){let o={x:t,y:n,t:performance.now()},s=ae(e.start,o,10,300);if(r===`touch`){let r=E(t,n,e.rect,i);return!e.moved&&s?I(r.xFrac,r.yFrac,`left`):e.moved?[{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!1}]:[]}return!e.moved&&s?I(a.xFrac,a.yFrac,`left`):[]}function R(e,t,n){let r=P(e,t);return{startDistance:N(e,t),startMid:r,lastMid:r,startScale:n,startTime:performance.now(),gesture:null}}function le(e,t,n,r){let i=N(t,n),a=P(t,n);if(e.gesture===null){let t=Math.abs(i-e.startDistance),n=N(e.startMid,a);if(t>15)e.gesture=oe(e.startDistance,i,15);else if(n>15)e.gesture=`scroll`;else return e.lastMid=a,{}}let o;if(e.gesture===`pinch`)o={transform:{scale:F(e.startScale*(i/e.startDistance),1,4),panX:r.panX,panY:r.panY}};else if(r.scale>1.01){let t=a.x-e.lastMid.x,n=a.y-e.lastMid.y;o={transform:{scale:r.scale,panX:r.panX+t,panY:r.panY+n}}}else o={wheelDeltaPx:a.y-e.lastMid.y};return e.lastMid=a,o}function z(e,t,n){if(e.gesture===null&&performance.now()-e.startTime<=300){let r=E(e.lastMid.x,e.lastMid.y,t,n);return I(r.xFrac,r.yFrac,`right`)}return[]}var B={scale:1,panX:0,panY:0},ue=40,de=120;function fe({containerRef:e,canvasRef:t,mode:n,sendMessage:r,enabled:i}){let[a,o]=(0,M.useState)(B),[s,c]=(0,M.useState)({xFrac:.5,yFrac:.5}),l=(0,M.useRef)(a),u=(0,M.useRef)(s),d=(0,M.useRef)(n);d.current=n;let f=(0,M.useRef)({transform:null,cursor:null,sendCursorMove:!1,wheelPx:0}),p=(0,M.useRef)(0),m=(0,M.useCallback)(()=>{p.current=0;let e=f.current;e.transform&&=(l.current=e.transform,o(e.transform),null),e.cursor&&(u.current=e.cursor,c(e.cursor),e.sendCursorMove&&r({type:`pointer`,xFrac:e.cursor.xFrac,yFrac:e.cursor.yFrac,button:null,down:null}),e.cursor=null,e.sendCursorMove=!1),e.wheelPx!==0&&(r({type:`wheel`,dy:-(e.wheelPx/ue)*de}),e.wheelPx=0)},[r]),h=(0,M.useCallback)(()=>{p.current||=requestAnimationFrame(m)},[m]),g=(0,M.useCallback)(()=>{l.current=B,o(B)},[]);return(0,M.useEffect)(()=>{let n=e.current;if(!n||!i)return;let a=null,o=null,s=e=>e.forEach(r),c=()=>{let e=n.getBoundingClientRect(),r=t.current;return!r||!r.width||!r.height?e:D(e,r.width,r.height)},m=e=>{e.preventDefault(),e.stopPropagation();let t=c();if(e.touches.length===1){o=null;let n=e.touches[0];a=se(n.clientX,n.clientY,t)}else if(e.touches.length===2){a=null;let[t,n]=[e.touches[0],e.touches[1]];o=R({x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current.scale)}else a=null,o=null},g=e=>{if(e.preventDefault(),e.stopPropagation(),a&&e.touches.length===1){let t=e.touches[0],n=ce(a,t.clientX,t.clientY,d.current,l.current,u.current);n.message&&r(n.message),n.cursor&&(u.current=n.cursor,f.current.cursor=n.cursor,f.current.sendCursorMove=!!n.sendCursorMove,h());return}if(o&&e.touches.length===2){let[t,n]=[e.touches[0],e.touches[1]],r=le(o,{x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current);r.transform&&(l.current=r.transform,f.current.transform=r.transform,h()),r.wheelDeltaPx&&(f.current.wheelPx+=r.wheelDeltaPx,h())}},_=e=>{e.preventDefault(),e.stopPropagation();let t=e.changedTouches[0];if(a){let e=t?t.clientX:a.last.x,n=t?t.clientY:a.last.y;s(L(a,e,n,d.current,l.current,u.current)),a=null}o&&=(s(z(o,c(),l.current)),null)},v=e=>{e.stopPropagation(),a?.moved&&d.current===`touch`&&s(L(a,a.last.x,a.last.y,`touch`,l.current,u.current)),a=null,o=null};return n.addEventListener(`touchstart`,m,{passive:!1}),n.addEventListener(`touchmove`,g,{passive:!1}),n.addEventListener(`touchend`,_,{passive:!1}),n.addEventListener(`touchcancel`,v,{passive:!1}),()=>{p.current&&cancelAnimationFrame(p.current),n.removeEventListener(`touchstart`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,_),n.removeEventListener(`touchcancel`,v)}},[e,t,i,r,h]),{transform:a,virtualCursor:n===`mouse`?s:null,resetZoom:g}}function V(e,t,n){let r=e=>{n({type:`key`,code:e,down:!0}),n({type:`key`,code:e,down:!1})};switch(e){case`insertText`:return t&&n({type:`text`,text:t}),!0;case`insertLineBreak`:case`insertParagraph`:return r(`Enter`),!0;case`deleteContentBackward`:return r(`Backspace`),!0;case`deleteContentForward`:return r(`Delete`),!0;default:return!1}}function pe(e,t,n){let r=(0,M.useRef)(null);return(0,M.useEffect)(()=>{let i=r.current;if(!i||!t)return;let a=()=>e({type:`releaseAll`}),o=e=>e.code!==``&&e.key!==`Unidentified`,s=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!0}))},c=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!1}))},l=t=>{V(t.inputType,t.data,e)&&t.preventDefault()},u=t=>{t.data&&e({type:`text`,text:t.data}),i.value=``},d=e=>{let t=e.clipboardData?.getData(`text/plain`);!t||!n||(e.preventDefault(),n(t))},f=()=>a(),p=()=>{document.hidden&&a()};return i.addEventListener(`keydown`,s),i.addEventListener(`keyup`,c),i.addEventListener(`beforeinput`,l),i.addEventListener(`compositionend`,u),i.addEventListener(`paste`,d),i.addEventListener(`blur`,f),document.addEventListener(`visibilitychange`,p),()=>{i.removeEventListener(`keydown`,s),i.removeEventListener(`keyup`,c),i.removeEventListener(`beforeinput`,l),i.removeEventListener(`compositionend`,u),i.removeEventListener(`paste`,d),i.removeEventListener(`blur`,f),document.removeEventListener(`visibilitychange`,p),a()}},[t,e,n]),{inputRef:r,show:(0,M.useCallback)(()=>r.current?.focus(),[])}}var H=n();function U({onClick:e,label:t,active:n,children:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":t,className:C(`flex min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg py-1.5 text-[10px]`,`text-white/80 active:bg-white/10 transition-colors`,n&&`bg-white/15 text-white`),children:[r,(0,H.jsx)(`span`,{children:t})]})}function me({displayLabel:e,onNextDisplay:t,qualityLabel:n,onNextQuality:a,mode:c,onToggleMode:l,onOpenKeyboard:d,onResetZoom:f,settingsOpen:p,onToggleSettings:g,onClose:_}){return(0,H.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 border-t border-white/10 bg-black/90 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5`,"data-testid":`remote-desktop-mobile-toolbar`,children:[(0,H.jsx)(U,{onClick:l,label:c===`mouse`?`Mouse`:`Touch`,active:!0,children:c===`mouse`?(0,H.jsx)(s,{className:`size-5`}):(0,H.jsx)(y,{className:`size-5`})}),(0,H.jsx)(U,{onClick:d,label:`Keyboard`,children:(0,H.jsx)(u,{className:`size-5`})}),(0,H.jsx)(U,{onClick:f,label:`Reset zoom`,children:(0,H.jsx)(h,{className:`size-5`})}),e!==null&&(0,H.jsx)(U,{onClick:t,label:e.length>10?`${e.slice(0,9)}…`:e,children:(0,H.jsx)(r,{className:`size-5`})}),(0,H.jsx)(U,{onClick:a,label:n,children:(0,H.jsx)(i,{className:`size-5`})}),(0,H.jsx)(U,{onClick:g,label:`More`,active:p,children:(0,H.jsx)(m,{className:`size-5`})}),(0,H.jsx)(U,{onClick:_,label:`Close`,children:(0,H.jsx)(o,{className:`size-5`})})]})}function W(e){return(e.includes(`ControlLeft`)||e.includes(`MetaLeft`))&&(e.includes(`KeyC`)||e.includes(`KeyX`))}var G=[{label:`Ctrl`,code:`ControlLeft`},{label:`Alt`,code:`AltLeft`},{label:`Shift`,code:`ShiftLeft`},{label:`Win`,code:`MetaLeft`}],K=[{label:`Esc`,code:`Escape`},{label:`Tab`,code:`Tab`},{label:`←`,code:`ArrowLeft`},{label:`↑`,code:`ArrowUp`},{label:`↓`,code:`ArrowDown`},{label:`→`,code:`ArrowRight`}],q=[{label:`Ctrl+C`,codes:[`ControlLeft`,`KeyC`]},{label:`Ctrl+V`,codes:[`ControlLeft`,`KeyV`]},{label:`Ctrl+Z`,codes:[`ControlLeft`,`KeyZ`]},{label:`Ctrl+A`,codes:[`ControlLeft`,`KeyA`]},{label:`Alt+Tab`,codes:[`AltLeft`,`Tab`]},{label:`Ctrl+Alt+Del`,codes:[`ControlLeft`,`AltLeft`,`Delete`]}];function J({onClick:e,active:t,className:n,children:r}){return(0,H.jsx)(`button`,{type:`button`,onClick:e,className:C(`min-h-11 min-w-11 shrink-0 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-white/80`,`active:bg-white/15 transition-colors`,t&&`bg-primary text-primary-foreground`,n),children:r})}function he({sendMessage:e,onCopyCombo:t}){let[n,r]=(0,M.useState)(new Set),i=(0,M.useRef)(n);i.current=n,(0,M.useEffect)(()=>()=>{i.current.forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);let a=(0,M.useCallback)(t=>{r(n=>{let r=n.has(t);e({type:`key`,code:t,down:!r});let i=new Set(n);return r?i.delete(t):i.add(t),i})},[e]),o=(0,M.useCallback)(t=>{e({type:`key`,code:t,down:!0}),e({type:`key`,code:t,down:!1})},[e]),s=(0,M.useCallback)(n=>{n.forEach(t=>e({type:`key`,code:t,down:!0})),[...n].reverse().forEach(t=>e({type:`key`,code:t,down:!1})),W(n)&&t?.()},[e,t]);return(0,H.jsxs)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-t border-white/10 bg-black/90 px-2 py-1.5`,"data-testid":`remote-desktop-mobile-key-bar`,children:[G.map(e=>(0,H.jsx)(J,{onClick:()=>a(e.code),active:n.has(e.code),children:e.label},e.code)),(0,H.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),K.map(e=>(0,H.jsx)(J,{onClick:()=>o(e.code),children:e.label},e.code)),(0,H.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),q.map(e=>(0,H.jsx)(J,{onClick:()=>s(e.codes),children:e.label},e.label))]})}function Y({icon:e,label:t,hint:n,checked:r,onToggle:i,testId:a,disabled:o}){return(0,H.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:o,onClick:i,"data-testid":a,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-white/80 active:bg-white/10 disabled:opacity-50`,children:[(0,H.jsx)(`span`,{className:`shrink-0 opacity-80`,children:e}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-xs`,children:t}),n&&(0,H.jsx)(`span`,{className:`block truncate text-[10px] text-white/45`,children:n})]}),(0,H.jsx)(`span`,{className:C(`relative h-5 w-9 shrink-0 rounded-full transition-colors`,r?`bg-primary`:`bg-white/20`),children:(0,H.jsx)(`span`,{className:C(`absolute top-0.5 size-4 rounded-full bg-white transition-all`,r?`left-[1.125rem]`:`left-0.5`)})})]})}function ge({statsVisible:e,onToggleStats:t,showCursor:n,onSetShowCursor:r,clipboardEnabled:i,onSetClipboardEnabled:o,audioOn:l,audioReason:u,onSetAudioOn:p,privacyOn:m,privacyReason:h,onSetPrivacyOn:y,hostModes:b,hostModeId:x,hostOriginalModeId:S,onSetHostMode:w,canResizeHost:ee,resolutionError:T,recording:E,recordingSupported:D,onToggleRecording:ne,onScreenshot:re}){let k=(0,M.useMemo)(()=>te(b),[b]),A=(0,M.useMemo)(()=>ie(),[]),j=(0,M.useMemo)(()=>O(b,A,x),[b,A,x]);return(0,H.jsxs)(`div`,{className:`mx-2 mb-1 space-y-0.5 rounded-xl border border-white/10 bg-black/90 p-1`,"data-testid":`remote-desktop-mobile-settings`,children:[(0,H.jsx)(Y,{icon:(0,H.jsx)(c,{className:`size-4`}),label:`Quality monitor`,checked:e,onToggle:t,testId:`remote-desktop-mobile-stats-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(s,{className:`size-4`}),label:`Show remote cursor`,hint:`Restarts the stream`,checked:n,onToggle:()=>r(!n),testId:`remote-desktop-mobile-cursor-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(f,{className:`size-4`}),label:`Sync clipboard`,hint:`Off: Ctrl+V pastes the host's own clipboard`,checked:i,onToggle:()=>o(!i),testId:`remote-desktop-mobile-clipboard-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(d,{className:`size-4`}),label:`Play host audio`,hint:u??void 0,checked:l,disabled:u!==null,onToggle:()=>p(!l),testId:`remote-desktop-mobile-audio-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(g,{className:`size-4`}),label:`Privacy mode`,hint:h??`Blocks the host's own keyboard and mouse`,checked:m,disabled:h!==null&&!m,onToggle:()=>y(!m),testId:`remote-desktop-mobile-privacy-toggle`}),ee&&k.length>1&&(0,H.jsxs)(`div`,{className:`px-3 pt-1`,children:[(0,H.jsx)(`div`,{className:`pb-1.5 text-[10px] uppercase tracking-wide text-white/40`,children:`Resolution`}),(0,H.jsxs)(`div`,{className:`flex max-h-28 flex-wrap gap-1.5 overflow-y-auto`,children:[S&&S!==x&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>w(S),"data-testid":`remote-desktop-mobile-resolution-original`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Original`}),j&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>w(j.id),"data-testid":`remote-desktop-mobile-resolution-fit-local`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Fit local`}),k.map(e=>{let t=(x??k.find(e=>e.current)?.id)===e.id;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>w(e.id),"data-testid":`remote-desktop-mobile-resolution-${e.width}x${e.height}`,className:C(`min-h-9 rounded-md px-2.5 py-1 text-[11px] tabular-nums`,t?`bg-white/25 text-white`:`bg-white/10 text-white/70 active:bg-white/20`),children:[e.width,`×`,e.height]},e.id)})]}),T&&(0,H.jsx)(`div`,{className:`pt-1.5 text-[10px] leading-tight text-red-400`,children:T})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:re,"data-testid":`remote-desktop-mobile-screenshot`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:[(0,H.jsx)(a,{className:`size-4 opacity-80`}),` Save screenshot`]}),D&&(0,H.jsx)(`button`,{type:`button`,onClick:ne,"data-testid":`remote-desktop-mobile-record`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:E?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{className:`size-4 text-red-500`}),` Stop recording`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(v,{className:`size-4 opacity-80`}),` Start recording`]})})]})}function X({onClose:e}){let t=(0,M.useRef)(null),n=(0,M.useRef)(null),[r,i]=(0,M.useState)(`mouse`),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(!1),u=re(),{connState:d,errorMessage:f,decoderStatus:m,decoderErrorMessage:h,sendMessage:g,reconnect:_,getTotalBytes:v,getFrameCount:y,quality:C,setQuality:te,showCursor:E,setShowCursor:O,audioOn:ie,setAudioOn:ae,getAudioTracks:oe,privacyOn:N,privacyError:P,setPrivacyOn:F,hostModeId:I,hostOriginalModeId:se,resolutionError:ce,setHostMode:L,pendingHostClipboard:R,clearHostClipboard:le,sendClipboard:z,requestHostClipboard:B}=k(n,{displayId:u.displayId}),ue=S(e=>e.remoteDesktopStatsVisible),de=S(e=>e.toggleRemoteDesktopStatsVisible),V=S(e=>e.remoteDesktopClipboardSync),U=S(e=>e.setRemoteDesktopClipboardSync),W=S(e=>e.remoteDesktopQuality),G=d===`streaming`,{transform:K,virtualCursor:q,resetZoom:J}=fe({containerRef:t,canvasRef:n,mode:r,sendMessage:g,enabled:G}),[Y,X]=(0,M.useState)(!1),_e=(0,M.useCallback)(e=>{X(!0),z(e,!0)},[z]),{caps:Z}=ee(!1),Q=ne(n,oe),{inputRef:ve,show:ye}=pe(g,G,V?_e:void 0),$=w(!0)?.keyboardInset??0,be=(0,M.useCallback)(()=>i(e=>e===`mouse`?`touch`:`mouse`),[]),xe=(0,M.useCallback)(()=>{ye(),o(!0)},[ye]),Se=m===`unsupported`?h:d===`error`?f:d===`closed`?`Disconnected`:d===`connecting`?`Connecting…`:null,Ce={transform:`translate(${K.panX}px, ${K.panY}px) scale(${K.scale})`},we=`${(q?.xFrac??.5)*100}%`,Te=`${(q?.yFrac??.5)*100}%`;if(q&&t.current&&n.current?.width&&n.current.height){let e=t.current.getBoundingClientRect(),r=D({left:0,top:0,width:e.width,height:e.height},n.current.width,n.current.height);we=`${r.left+q.xFrac*r.width}px`,Te=`${r.top+q.yFrac*r.height}px`}return(0,H.jsxs)(`div`,{className:`relative h-full w-full bg-black`,"data-testid":`remote-desktop-mobile-view`,"data-conn-state":d,children:[(0,H.jsxs)(`div`,{ref:t,className:`absolute inset-x-0 top-0 flex items-center justify-center overflow-hidden`,style:{touchAction:`none`,bottom:$},"data-testid":`remote-desktop-mobile-stage-container`,children:[(0,H.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center`,style:Ce,children:[(0,H.jsx)(`canvas`,{ref:n,"data-testid":`remote-desktop-canvas`,className:`block h-full w-full min-h-0 min-w-0 object-contain outline-none`}),r===`mouse`&&q&&G&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute rounded-full border-2 border-white bg-primary shadow-[0_0_0_1px_rgba(0,0,0,0.6)]`,style:{left:we,top:Te,width:14,height:14,transform:`translate(-50%, -50%) scale(${1/K.scale})`},"data-testid":`remote-desktop-virtual-cursor`})]}),Se&&(0,H.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,H.jsx)(l,{className:`size-6 opacity-70`}),(0,H.jsx)(`span`,{className:`max-w-sm px-4 text-center`,children:Se}),(d===`error`||d===`closed`)&&m!==`unsupported`&&(0,H.jsxs)(`button`,{onClick:_,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,H.jsx)(p,{className:`size-3.5`}),` Reconnect`]})]}),(0,H.jsx)(`input`,{ref:ve,type:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`absolute size-px opacity-0`,"aria-hidden":`true`,tabIndex:-1,onBlur:()=>o(!1),"data-testid":`remote-desktop-virtual-keyboard-input`})]}),(0,H.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0`,style:$>0?{transform:`translateY(-${$}px)`}:void 0,"data-testid":`remote-desktop-mobile-bottom-bar`,children:[(0,H.jsx)(j,{pendingText:R,onDismiss:le,missingToolAction:Y&&Z&&!Z.clipboard.available?Z.clipboard.action:null,onDismissMissingTool:()=>X(!1),positionClassName:`mx-2 mb-1 max-w-[calc(100%-1rem)]`}),s&&(0,H.jsx)(ge,{statsVisible:ue,onToggleStats:de,showCursor:E,onSetShowCursor:O,clipboardEnabled:V,onSetClipboardEnabled:U,audioOn:ie,audioReason:Z&&!Z.audio.available?Z.audio.reason:null,onSetAudioOn:ae,privacyOn:N,privacyReason:P??(Z&&!Z.privacy.available?Z.privacy.reason:null),hostModes:Z?.resolutions?.modes??[],hostModeId:I,hostOriginalModeId:se,onSetHostMode:L,canResizeHost:Z?.inputReady??!1,resolutionError:ce,onSetPrivacyOn:F,recording:Q.recording,recordingSupported:Q.supported,onToggleRecording:Q.toggle,onScreenshot:()=>void T(n.current)}),a&&(0,H.jsx)(he,{sendMessage:g,onCopyCombo:V?B:void 0}),(0,H.jsx)(me,{displayLabel:u.displays.length>1?u.current?.label??null:null,onNextDisplay:u.next,qualityLabel:b(W),onNextQuality:()=>te(x(W)),mode:r,onToggleMode:be,onOpenKeyboard:xe,onResetZoom:J,settingsOpen:s,onToggleSettings:()=>c(e=>!e),onClose:e})]}),(0,H.jsx)(A,{canvasRef:n,getFrameCount:y,getTotalBytes:v,positionClassName:`left-1 top-[calc(env(safe-area-inset-top,0px)+2.75rem)]`})]})}export{X as default};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{En as r,Gr as i,Gt as a,Jr as o,Mn as s,Nt as c,On as l,Qt as u,Ur as d,W as f,or as p,pr as m,ti as h,ut as g,xr as _,z as v,zt as y}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{D as b,T as x,t as S}from"./settings-store-3jIBB8gx.js";import{n as C}from"./utils-btZ8C8-R.js";import"./panel-store-DrSH3Nhp.js";import"./window-store-B4cbZ5rr.js";import"./project-store-CCimwgGF.js";import{t as w}from"./use-visual-viewport-C307OVeV.js";import"./ws-auth-J3hw0Mhc.js";import{Z as ee}from"./index-D41mthBS.js";import"./run-in-terminal-Cdn9PaAl.js";import{a as T,c as te,d as E,f as D,i as ne,n as re,o as O,p as k,r as A,s as ie,t as j}from"./remote-desktop-clipboard-notice-C6tt5SDH.js";var M=e(t(),1);function ae(e,t,n=10,r=300){let i=Math.hypot(t.x-e.x,t.y-e.y),a=t.t-e.t;return i<=n&&a<=r}function oe(e,t,n=15){return Math.abs(t-e)>n?`pinch`:`scroll`}function N(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function P(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function F(e,t,n){return Math.min(Math.max(e,t),n)}function I(e,t,n){return[{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!0},{type:`pointer`,xFrac:e,yFrac:t,button:n,down:!1}]}function se(e,t,n){return{start:{x:e,y:t,t:performance.now()},last:{x:e,y:t},moved:!1,rect:n}}function ce(e,t,n,r,i,a){let o=Math.hypot(t-e.start.x,n-e.start.y);if(r===`touch`){if(!e.moved&&o>10){e.moved=!0;let r=E(e.start.x,e.start.y,e.rect,i);return e.last={x:t,y:n},{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!0}}}if(e.last={x:t,y:n},!e.moved)return{};let r=E(t,n,e.rect,i);return{message:{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:null,down:null}}}let s=(t-e.last.x)/i.scale,c=(n-e.last.y)/i.scale;return o>10&&(e.moved=!0),e.last={x:t,y:n},{cursor:{xFrac:F(a.xFrac+s/e.rect.width,0,1),yFrac:F(a.yFrac+c/e.rect.height,0,1)},sendCursorMove:!0}}function L(e,t,n,r,i,a){let o={x:t,y:n,t:performance.now()},s=ae(e.start,o,10,300);if(r===`touch`){let r=E(t,n,e.rect,i);return!e.moved&&s?I(r.xFrac,r.yFrac,`left`):e.moved?[{type:`pointer`,xFrac:r.xFrac,yFrac:r.yFrac,button:`left`,down:!1}]:[]}return!e.moved&&s?I(a.xFrac,a.yFrac,`left`):[]}function R(e,t,n){let r=P(e,t);return{startDistance:N(e,t),startMid:r,lastMid:r,startScale:n,startTime:performance.now(),gesture:null}}function le(e,t,n,r){let i=N(t,n),a=P(t,n);if(e.gesture===null){let t=Math.abs(i-e.startDistance),n=N(e.startMid,a);if(t>15)e.gesture=oe(e.startDistance,i,15);else if(n>15)e.gesture=`scroll`;else return e.lastMid=a,{}}let o;if(e.gesture===`pinch`)o={transform:{scale:F(e.startScale*(i/e.startDistance),1,4),panX:r.panX,panY:r.panY}};else if(r.scale>1.01){let t=a.x-e.lastMid.x,n=a.y-e.lastMid.y;o={transform:{scale:r.scale,panX:r.panX+t,panY:r.panY+n}}}else o={wheelDeltaPx:a.y-e.lastMid.y};return e.lastMid=a,o}function z(e,t,n){if(e.gesture===null&&performance.now()-e.startTime<=300){let r=E(e.lastMid.x,e.lastMid.y,t,n);return I(r.xFrac,r.yFrac,`right`)}return[]}var B={scale:1,panX:0,panY:0},ue=40,de=120;function fe({containerRef:e,canvasRef:t,mode:n,sendMessage:r,enabled:i}){let[a,o]=(0,M.useState)(B),[s,c]=(0,M.useState)({xFrac:.5,yFrac:.5}),l=(0,M.useRef)(a),u=(0,M.useRef)(s),d=(0,M.useRef)(n);d.current=n;let f=(0,M.useRef)({transform:null,cursor:null,sendCursorMove:!1,wheelPx:0}),p=(0,M.useRef)(0),m=(0,M.useCallback)(()=>{p.current=0;let e=f.current;e.transform&&=(l.current=e.transform,o(e.transform),null),e.cursor&&(u.current=e.cursor,c(e.cursor),e.sendCursorMove&&r({type:`pointer`,xFrac:e.cursor.xFrac,yFrac:e.cursor.yFrac,button:null,down:null}),e.cursor=null,e.sendCursorMove=!1),e.wheelPx!==0&&(r({type:`wheel`,dy:-(e.wheelPx/ue)*de}),e.wheelPx=0)},[r]),h=(0,M.useCallback)(()=>{p.current||=requestAnimationFrame(m)},[m]),g=(0,M.useCallback)(()=>{l.current=B,o(B)},[]);return(0,M.useEffect)(()=>{let n=e.current;if(!n||!i)return;let a=null,o=null,s=e=>e.forEach(r),c=()=>{let e=n.getBoundingClientRect(),r=t.current;return!r||!r.width||!r.height?e:D(e,r.width,r.height)},m=e=>{e.preventDefault(),e.stopPropagation();let t=c();if(e.touches.length===1){o=null;let n=e.touches[0];a=se(n.clientX,n.clientY,t)}else if(e.touches.length===2){a=null;let[t,n]=[e.touches[0],e.touches[1]];o=R({x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current.scale)}else a=null,o=null},g=e=>{if(e.preventDefault(),e.stopPropagation(),a&&e.touches.length===1){let t=e.touches[0],n=ce(a,t.clientX,t.clientY,d.current,l.current,u.current);n.message&&r(n.message),n.cursor&&(u.current=n.cursor,f.current.cursor=n.cursor,f.current.sendCursorMove=!!n.sendCursorMove,h());return}if(o&&e.touches.length===2){let[t,n]=[e.touches[0],e.touches[1]],r=le(o,{x:t.clientX,y:t.clientY},{x:n.clientX,y:n.clientY},l.current);r.transform&&(l.current=r.transform,f.current.transform=r.transform,h()),r.wheelDeltaPx&&(f.current.wheelPx+=r.wheelDeltaPx,h())}},_=e=>{e.preventDefault(),e.stopPropagation();let t=e.changedTouches[0];if(a){let e=t?t.clientX:a.last.x,n=t?t.clientY:a.last.y;s(L(a,e,n,d.current,l.current,u.current)),a=null}o&&=(s(z(o,c(),l.current)),null)},v=e=>{e.stopPropagation(),a?.moved&&d.current===`touch`&&s(L(a,a.last.x,a.last.y,`touch`,l.current,u.current)),a=null,o=null};return n.addEventListener(`touchstart`,m,{passive:!1}),n.addEventListener(`touchmove`,g,{passive:!1}),n.addEventListener(`touchend`,_,{passive:!1}),n.addEventListener(`touchcancel`,v,{passive:!1}),()=>{p.current&&cancelAnimationFrame(p.current),n.removeEventListener(`touchstart`,m),n.removeEventListener(`touchmove`,g),n.removeEventListener(`touchend`,_),n.removeEventListener(`touchcancel`,v)}},[e,t,i,r,h]),{transform:a,virtualCursor:n===`mouse`?s:null,resetZoom:g}}function V(e,t,n){let r=e=>{n({type:`key`,code:e,down:!0}),n({type:`key`,code:e,down:!1})};switch(e){case`insertText`:return t&&n({type:`text`,text:t}),!0;case`insertLineBreak`:case`insertParagraph`:return r(`Enter`),!0;case`deleteContentBackward`:return r(`Backspace`),!0;case`deleteContentForward`:return r(`Delete`),!0;default:return!1}}function pe(e,t,n){let r=(0,M.useRef)(null);return(0,M.useEffect)(()=>{let i=r.current;if(!i||!t)return;let a=()=>e({type:`releaseAll`}),o=e=>e.code!==``&&e.key!==`Unidentified`,s=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!0}))},c=t=>{o(t)&&(t.preventDefault(),e({type:`key`,code:t.code,down:!1}))},l=t=>{V(t.inputType,t.data,e)&&t.preventDefault()},u=t=>{t.data&&e({type:`text`,text:t.data}),i.value=``},d=e=>{let t=e.clipboardData?.getData(`text/plain`);!t||!n||(e.preventDefault(),n(t))},f=()=>a(),p=()=>{document.hidden&&a()};return i.addEventListener(`keydown`,s),i.addEventListener(`keyup`,c),i.addEventListener(`beforeinput`,l),i.addEventListener(`compositionend`,u),i.addEventListener(`paste`,d),i.addEventListener(`blur`,f),document.addEventListener(`visibilitychange`,p),()=>{i.removeEventListener(`keydown`,s),i.removeEventListener(`keyup`,c),i.removeEventListener(`beforeinput`,l),i.removeEventListener(`compositionend`,u),i.removeEventListener(`paste`,d),i.removeEventListener(`blur`,f),document.removeEventListener(`visibilitychange`,p),a()}},[t,e,n]),{inputRef:r,show:(0,M.useCallback)(()=>r.current?.focus(),[])}}var H=n();function U({onClick:e,label:t,active:n,children:r}){return(0,H.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":t,className:C(`flex min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg py-1.5 text-[10px]`,`text-white/80 active:bg-white/10 transition-colors`,n&&`bg-white/15 text-white`),children:[r,(0,H.jsx)(`span`,{children:t})]})}function me({displayLabel:e,onNextDisplay:t,qualityLabel:n,onNextQuality:a,mode:c,onToggleMode:l,onOpenKeyboard:d,onResetZoom:f,settingsOpen:p,onToggleSettings:g,onClose:_}){return(0,H.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 border-t border-white/10 bg-black/90 px-2 pb-[max(0.375rem,env(safe-area-inset-bottom))] pt-1.5`,"data-testid":`remote-desktop-mobile-toolbar`,children:[(0,H.jsx)(U,{onClick:l,label:c===`mouse`?`Mouse`:`Touch`,active:!0,children:c===`mouse`?(0,H.jsx)(s,{className:`size-5`}):(0,H.jsx)(y,{className:`size-5`})}),(0,H.jsx)(U,{onClick:d,label:`Keyboard`,children:(0,H.jsx)(u,{className:`size-5`})}),(0,H.jsx)(U,{onClick:f,label:`Reset zoom`,children:(0,H.jsx)(h,{className:`size-5`})}),e!==null&&(0,H.jsx)(U,{onClick:t,label:e.length>10?`${e.slice(0,9)}…`:e,children:(0,H.jsx)(r,{className:`size-5`})}),(0,H.jsx)(U,{onClick:a,label:n,children:(0,H.jsx)(i,{className:`size-5`})}),(0,H.jsx)(U,{onClick:g,label:`More`,active:p,children:(0,H.jsx)(m,{className:`size-5`})}),(0,H.jsx)(U,{onClick:_,label:`Close`,children:(0,H.jsx)(o,{className:`size-5`})})]})}function W(e){return(e.includes(`ControlLeft`)||e.includes(`MetaLeft`))&&(e.includes(`KeyC`)||e.includes(`KeyX`))}var G=[{label:`Ctrl`,code:`ControlLeft`},{label:`Alt`,code:`AltLeft`},{label:`Shift`,code:`ShiftLeft`},{label:`Win`,code:`MetaLeft`}],K=[{label:`Esc`,code:`Escape`},{label:`Tab`,code:`Tab`},{label:`←`,code:`ArrowLeft`},{label:`↑`,code:`ArrowUp`},{label:`↓`,code:`ArrowDown`},{label:`→`,code:`ArrowRight`}],q=[{label:`Ctrl+C`,codes:[`ControlLeft`,`KeyC`]},{label:`Ctrl+V`,codes:[`ControlLeft`,`KeyV`]},{label:`Ctrl+Z`,codes:[`ControlLeft`,`KeyZ`]},{label:`Ctrl+A`,codes:[`ControlLeft`,`KeyA`]},{label:`Alt+Tab`,codes:[`AltLeft`,`Tab`]},{label:`Ctrl+Alt+Del`,codes:[`ControlLeft`,`AltLeft`,`Delete`]}];function J({onClick:e,active:t,className:n,children:r}){return(0,H.jsx)(`button`,{type:`button`,onClick:e,className:C(`min-h-11 min-w-11 shrink-0 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-white/80`,`active:bg-white/15 transition-colors`,t&&`bg-primary text-primary-foreground`,n),children:r})}function he({sendMessage:e,onCopyCombo:t}){let[n,r]=(0,M.useState)(new Set),i=(0,M.useRef)(n);i.current=n,(0,M.useEffect)(()=>()=>{i.current.forEach(t=>e({type:`key`,code:t,down:!1}))},[e]);let a=(0,M.useCallback)(t=>{r(n=>{let r=n.has(t);e({type:`key`,code:t,down:!r});let i=new Set(n);return r?i.delete(t):i.add(t),i})},[e]),o=(0,M.useCallback)(t=>{e({type:`key`,code:t,down:!0}),e({type:`key`,code:t,down:!1})},[e]),s=(0,M.useCallback)(n=>{n.forEach(t=>e({type:`key`,code:t,down:!0})),[...n].reverse().forEach(t=>e({type:`key`,code:t,down:!1})),W(n)&&t?.()},[e,t]);return(0,H.jsxs)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-t border-white/10 bg-black/90 px-2 py-1.5`,"data-testid":`remote-desktop-mobile-key-bar`,children:[G.map(e=>(0,H.jsx)(J,{onClick:()=>a(e.code),active:n.has(e.code),children:e.label},e.code)),(0,H.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),K.map(e=>(0,H.jsx)(J,{onClick:()=>o(e.code),children:e.label},e.code)),(0,H.jsx)(`div`,{className:`mx-0.5 w-px shrink-0 bg-white/10`}),q.map(e=>(0,H.jsx)(J,{onClick:()=>s(e.codes),children:e.label},e.label))]})}function Y({icon:e,label:t,hint:n,checked:r,onToggle:i,testId:a,disabled:o}){return(0,H.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":r,disabled:o,onClick:i,"data-testid":a,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-white/80 active:bg-white/10 disabled:opacity-50`,children:[(0,H.jsx)(`span`,{className:`shrink-0 opacity-80`,children:e}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-xs`,children:t}),n&&(0,H.jsx)(`span`,{className:`block truncate text-[10px] text-white/45`,children:n})]}),(0,H.jsx)(`span`,{className:C(`relative h-5 w-9 shrink-0 rounded-full transition-colors`,r?`bg-primary`:`bg-white/20`),children:(0,H.jsx)(`span`,{className:C(`absolute top-0.5 size-4 rounded-full bg-white transition-all`,r?`left-[1.125rem]`:`left-0.5`)})})]})}function ge({statsVisible:e,onToggleStats:t,showCursor:n,onSetShowCursor:r,clipboardEnabled:i,onSetClipboardEnabled:o,audioOn:l,audioReason:u,onSetAudioOn:p,privacyOn:m,privacyReason:h,onSetPrivacyOn:y,hostModes:b,hostModeId:x,hostOriginalModeId:S,onSetHostMode:w,canResizeHost:ee,resolutionError:T,recording:E,recordingSupported:D,onToggleRecording:ne,onScreenshot:re}){let k=(0,M.useMemo)(()=>te(b),[b]),A=(0,M.useMemo)(()=>ie(),[]),j=(0,M.useMemo)(()=>O(b,A,x),[b,A,x]);return(0,H.jsxs)(`div`,{className:`mx-2 mb-1 space-y-0.5 rounded-xl border border-white/10 bg-black/90 p-1`,"data-testid":`remote-desktop-mobile-settings`,children:[(0,H.jsx)(Y,{icon:(0,H.jsx)(c,{className:`size-4`}),label:`Quality monitor`,checked:e,onToggle:t,testId:`remote-desktop-mobile-stats-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(s,{className:`size-4`}),label:`Show remote cursor`,hint:`Restarts the stream`,checked:n,onToggle:()=>r(!n),testId:`remote-desktop-mobile-cursor-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(f,{className:`size-4`}),label:`Sync clipboard`,hint:`Off: Ctrl+V pastes the host's own clipboard`,checked:i,onToggle:()=>o(!i),testId:`remote-desktop-mobile-clipboard-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(d,{className:`size-4`}),label:`Play host audio`,hint:u??void 0,checked:l,disabled:u!==null,onToggle:()=>p(!l),testId:`remote-desktop-mobile-audio-toggle`}),(0,H.jsx)(Y,{icon:(0,H.jsx)(g,{className:`size-4`}),label:`Privacy mode`,hint:h??`Blocks the host's own keyboard and mouse`,checked:m,disabled:h!==null&&!m,onToggle:()=>y(!m),testId:`remote-desktop-mobile-privacy-toggle`}),ee&&k.length>1&&(0,H.jsxs)(`div`,{className:`px-3 pt-1`,children:[(0,H.jsx)(`div`,{className:`pb-1.5 text-[10px] uppercase tracking-wide text-white/40`,children:`Resolution`}),(0,H.jsxs)(`div`,{className:`flex max-h-28 flex-wrap gap-1.5 overflow-y-auto`,children:[S&&S!==x&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>w(S),"data-testid":`remote-desktop-mobile-resolution-original`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Original`}),j&&(0,H.jsx)(`button`,{type:`button`,onClick:()=>w(j.id),"data-testid":`remote-desktop-mobile-resolution-fit-local`,className:`min-h-9 rounded-md bg-white/10 px-2.5 py-1 text-[11px] text-white/70 active:bg-white/20`,children:`Fit local`}),k.map(e=>{let t=(x??k.find(e=>e.current)?.id)===e.id;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>w(e.id),"data-testid":`remote-desktop-mobile-resolution-${e.width}x${e.height}`,className:C(`min-h-9 rounded-md px-2.5 py-1 text-[11px] tabular-nums`,t?`bg-white/25 text-white`:`bg-white/10 text-white/70 active:bg-white/20`),children:[e.width,`×`,e.height]},e.id)})]}),T&&(0,H.jsx)(`div`,{className:`pt-1.5 text-[10px] leading-tight text-red-400`,children:T})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:re,"data-testid":`remote-desktop-mobile-screenshot`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:[(0,H.jsx)(a,{className:`size-4 opacity-80`}),` Save screenshot`]}),D&&(0,H.jsx)(`button`,{type:`button`,onClick:ne,"data-testid":`remote-desktop-mobile-record`,className:`flex min-h-11 w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-xs text-white/80 active:bg-white/10`,children:E?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{className:`size-4 text-red-500`}),` Stop recording`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(v,{className:`size-4 opacity-80`}),` Start recording`]})})]})}function X({onClose:e}){let t=(0,M.useRef)(null),n=(0,M.useRef)(null),[r,i]=(0,M.useState)(`mouse`),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(!1),u=re(),{connState:d,errorMessage:f,decoderStatus:m,decoderErrorMessage:h,sendMessage:g,reconnect:_,getTotalBytes:v,getFrameCount:y,quality:C,setQuality:te,showCursor:E,setShowCursor:O,audioOn:ie,setAudioOn:ae,getAudioTracks:oe,privacyOn:N,privacyError:P,setPrivacyOn:F,hostModeId:I,hostOriginalModeId:se,resolutionError:ce,setHostMode:L,pendingHostClipboard:R,clearHostClipboard:le,sendClipboard:z,requestHostClipboard:B}=k(n,{displayId:u.displayId}),ue=S(e=>e.remoteDesktopStatsVisible),de=S(e=>e.toggleRemoteDesktopStatsVisible),V=S(e=>e.remoteDesktopClipboardSync),U=S(e=>e.setRemoteDesktopClipboardSync),W=S(e=>e.remoteDesktopQuality),G=d===`streaming`,{transform:K,virtualCursor:q,resetZoom:J}=fe({containerRef:t,canvasRef:n,mode:r,sendMessage:g,enabled:G}),[Y,X]=(0,M.useState)(!1),_e=(0,M.useCallback)(e=>{X(!0),z(e,!0)},[z]),{caps:Z}=ee(!1),Q=ne(n,oe),{inputRef:ve,show:ye}=pe(g,G,V?_e:void 0),$=w(!0)?.keyboardInset??0,be=(0,M.useCallback)(()=>i(e=>e===`mouse`?`touch`:`mouse`),[]),xe=(0,M.useCallback)(()=>{ye(),o(!0)},[ye]),Se=m===`unsupported`?h:d===`error`?f:d===`closed`?`Disconnected`:d===`connecting`?`Connecting…`:null,Ce={transform:`translate(${K.panX}px, ${K.panY}px) scale(${K.scale})`},we=`${(q?.xFrac??.5)*100}%`,Te=`${(q?.yFrac??.5)*100}%`;if(q&&t.current&&n.current?.width&&n.current.height){let e=t.current.getBoundingClientRect(),r=D({left:0,top:0,width:e.width,height:e.height},n.current.width,n.current.height);we=`${r.left+q.xFrac*r.width}px`,Te=`${r.top+q.yFrac*r.height}px`}return(0,H.jsxs)(`div`,{className:`relative h-full w-full bg-black`,"data-testid":`remote-desktop-mobile-view`,"data-conn-state":d,children:[(0,H.jsxs)(`div`,{ref:t,className:`absolute inset-x-0 top-0 flex items-center justify-center overflow-hidden`,style:{touchAction:`none`,bottom:$},"data-testid":`remote-desktop-mobile-stage-container`,children:[(0,H.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center`,style:Ce,children:[(0,H.jsx)(`canvas`,{ref:n,"data-testid":`remote-desktop-canvas`,className:`block h-full w-full min-h-0 min-w-0 object-contain outline-none`}),r===`mouse`&&q&&G&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute rounded-full border-2 border-white bg-primary shadow-[0_0_0_1px_rgba(0,0,0,0.6)]`,style:{left:we,top:Te,width:14,height:14,transform:`translate(-50%, -50%) scale(${1/K.scale})`},"data-testid":`remote-desktop-virtual-cursor`})]}),Se&&(0,H.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,H.jsx)(l,{className:`size-6 opacity-70`}),(0,H.jsx)(`span`,{className:`max-w-sm px-4 text-center`,children:Se}),(d===`error`||d===`closed`)&&m!==`unsupported`&&(0,H.jsxs)(`button`,{onClick:_,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,H.jsx)(p,{className:`size-3.5`}),` Reconnect`]})]}),(0,H.jsx)(`input`,{ref:ve,type:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,className:`absolute size-px opacity-0`,"aria-hidden":`true`,tabIndex:-1,onBlur:()=>o(!1),"data-testid":`remote-desktop-virtual-keyboard-input`})]}),(0,H.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0`,style:$>0?{transform:`translateY(-${$}px)`}:void 0,"data-testid":`remote-desktop-mobile-bottom-bar`,children:[(0,H.jsx)(j,{pendingText:R,onDismiss:le,missingToolAction:Y&&Z&&!Z.clipboard.available?Z.clipboard.action:null,onDismissMissingTool:()=>X(!1),positionClassName:`mx-2 mb-1 max-w-[calc(100%-1rem)]`}),s&&(0,H.jsx)(ge,{statsVisible:ue,onToggleStats:de,showCursor:E,onSetShowCursor:O,clipboardEnabled:V,onSetClipboardEnabled:U,audioOn:ie,audioReason:Z&&!Z.audio.available?Z.audio.reason:null,onSetAudioOn:ae,privacyOn:N,privacyReason:P??(Z&&!Z.privacy.available?Z.privacy.reason:null),hostModes:Z?.resolutions?.modes??[],hostModeId:I,hostOriginalModeId:se,onSetHostMode:L,canResizeHost:Z?.inputReady??!1,resolutionError:ce,onSetPrivacyOn:F,recording:Q.recording,recordingSupported:Q.supported,onToggleRecording:Q.toggle,onScreenshot:()=>void T(n.current)}),a&&(0,H.jsx)(he,{sendMessage:g,onCopyCombo:V?B:void 0}),(0,H.jsx)(me,{displayLabel:u.displays.length>1?u.current?.label??null:null,onNextDisplay:u.next,qualityLabel:b(W),onNextQuality:()=>te(x(W)),mode:r,onToggleMode:be,onOpenKeyboard:xe,onResetZoom:J,settingsOpen:s,onToggleSettings:()=>c(e=>!e),onClose:e})]}),(0,H.jsx)(A,{canvasRef:n,getFrameCount:y,getTotalBytes:v,positionClassName:`left-1 top-[calc(env(safe-area-inset-top,0px)+2.75rem)]`})]})}export{X as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{Ar as r,Dn as i,E as a,ct as o,hr as s,un as c,z as l}from"./icons-CO_II6D-.js";import{t as u}from"./settings-store-3jIBB8gx.js";import{Z as d}from"./index-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{Ar as r,Dn as i,E as a,ct as o,hr as s,un as c,z as l}from"./icons-CO_II6D-.js";import{t as u}from"./settings-store-3jIBB8gx.js";import{Z as d}from"./index-D41mthBS.js";import{r as f}from"./run-in-terminal-Cdn9PaAl.js";var p=e(t(),1),m=n();function h({onCancel:e,children:t}){let n=u(e=>e.remoteDesktopWarningDismissed),r=u(e=>e.setRemoteDesktopWarningDismissed),[a,o]=(0,p.useState)(!1),[c,l]=(0,p.useState)(!1);if(n||a)return(0,m.jsx)(m.Fragment,{children:t});let d=()=>{c&&r(!0),o(!0)};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-warning-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(i,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`Remote Desktop`}),(0,m.jsx)(`span`,{className:`ml-auto rounded-full bg-amber-500/20 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-300`,children:`Beta`})]}),(0,m.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm text-white/80`,children:[(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`span`,{children:[`This streams the host's `,(0,m.jsx)(`strong`,{children:`whole screen`}),` and lets you `,(0,m.jsx)(`strong`,{children:`move its mouse and type`}),` as if you were sitting at it. Anything you do here happens on the real desktop.`]})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Anyone signed in to this PPM can do the same. Avoid opening it over a public share link you don't fully trust; a private network (Tailscale, LAN) is safer.`})]}),(0,m.jsxs)(`li`,{className:`flex gap-2`,children:[(0,m.jsx)(s,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsx)(`span`,{children:`Still beta: the host must be unlocked with an active session, UAC prompts stay hidden, and a person at the host will fight you for the cursor.`})]})]}),(0,m.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`size-4 accent-primary`,"data-testid":`remote-desktop-warning-dont-show`}),`Don't show this again`]}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,"data-testid":`remote-desktop-warning-cancel`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,onClick:d,className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`remote-desktop-warning-continue`,children:`Continue`})]})]})})}function g({onCancel:e,children:t}){let[n,r]=(0,p.useState)(!1),{caps:a,failed:o,runHostAction:s}=d(!n);if(n||a?.videoReady&&a.inputReady)return(0,m.jsx)(m.Fragment,{children:t});let l=a?.requirements.filter(e=>!e.ok)??[],u=!!a?.videoReady&&!a.inputReady,h=t=>{f(t),e()};return(0,m.jsx)(`div`,{className:`flex h-full w-full items-center justify-center overflow-y-auto bg-black p-4 text-white`,"data-testid":`remote-desktop-readiness-gate`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-xl border border-white/10 bg-white/5 p-5`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(i,{className:`size-5 shrink-0 text-primary`}),(0,m.jsx)(`h2`,{className:`text-base font-semibold`,children:`This host needs a few things`})]}),!a&&!o&&(0,m.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-white/70`,children:[(0,m.jsx)(c,{className:`size-4 animate-spin`}),` Checking the host…`]}),o&&(0,m.jsx)(`p`,{className:`text-sm text-red-300`,children:`Could not reach the host's remote-desktop service.`}),(0,m.jsx)(`ul`,{className:`flex flex-col gap-3`,children:a?.requirements.map(e=>(0,m.jsx)(_,{req:e,onHostAction:s,onTerminal:h},e.id))}),l.length>0&&(0,m.jsx)(`p`,{className:`text-xs text-white/50`,children:`Re-checking every few seconds — this updates by itself once fixed.`}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:e,className:`min-h-11 flex-1 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`,children:`Cancel`}),(0,m.jsx)(`button`,{type:`button`,disabled:!a?.videoReady,onClick:()=>r(!0),className:`min-h-11 flex-1 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40`,"data-testid":`remote-desktop-readiness-continue`,children:u?`Continue (view only)`:`Continue`})]})]})})}function _({req:e,...t}){return(0,m.jsxs)(`li`,{className:`flex gap-2`,"data-testid":`remote-desktop-requirement-${e.id}`,"data-ok":e.ok,children:[e.ok?(0,m.jsx)(a,{className:`mt-0.5 size-4 shrink-0 text-emerald-400`}):(0,m.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-amber-300`}),(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm font-medium`,children:[e.title,!e.ok&&(0,m.jsx)(`span`,{className:`ml-2 text-xs font-normal text-white/50`,children:e.gates===`video`?`required`:`for mouse & keyboard`})]}),!e.ok&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`p`,{className:`text-sm text-white/70`,children:e.detail}),(0,m.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.actions.map(n=>(0,m.jsx)(v,{action:n,reqId:e.id,...t},n.label))})]})]})]})}function v({action:e,reqId:t,onHostAction:n,onTerminal:i}){let a=`inline-flex min-h-11 items-center gap-1.5 rounded-md bg-white/10 px-3 text-sm hover:bg-white/20`;return e.kind===`terminal`?(0,m.jsxs)(`button`,{type:`button`,className:a,onClick:()=>i(e.command),title:e.command,children:[(0,m.jsx)(r,{className:`size-4`}),` `,e.label]}):e.kind===`link`?(0,m.jsxs)(`a`,{className:a,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,m.jsx)(o,{className:`size-4`}),` `,e.label]}):(0,m.jsx)(`button`,{type:`button`,className:a,onClick:()=>void n(t,e.action),children:e.label})}export{h as n,g as t};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{En as r,Gt as i,Nt as a,On as o,Tn as s,Zn as c,or as l,pr as u,ut as d,xr as f,z as p}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{C as m,a as h,c as g,d as _,f as v,i as y,l as b,m as x,n as S,o as ee,p as C,r as te,s as w,t as T,u as ne,w as re}from"./settings-store-3jIBB8gx.js";import{n as ie}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-DrSH3Nhp.js";import{t as ae}from"./window-store-B4cbZ5rr.js";import"./project-store-CCimwgGF.js";import{t as oe}from"./button-CsmGH5xa.js";import{a as se,i as E,n as D,o as O,r as k,t as A}from"./dialog-z8PLkL8n.js";import"./ws-auth-J3hw0Mhc.js";import{Cn as j,Dn as M,En as N,On as P,Sn as F,Tn as I,Z as ce,_n as L,bn as R,vn as z,wn as B,xn as V,yn as H}from"./index-DQCw6d-2.js";import"./run-in-terminal-Cdn9PaAl.js";import{n as U,t as W}from"./remote-desktop-readiness-gate-DOWryrQx.js";import{a as G,c as le,h as K,i as ue,l as de,m as q,n as fe,o as J,p as pe,r as me,s as he,t as ge,u as Y}from"./remote-desktop-clipboard-notice-Bs3fZSRw.js";var X=e(t(),1);function Z(e,t,n,r){let i=(0,X.useCallback)((n,r,i,a)=>{let o=e.current;if(!o)return;let{xFrac:s,yFrac:c}=Y(n,r,o.getBoundingClientRect());t({type:`pointer`,xFrac:s,yFrac:c,button:i,down:a})},[e,t]);(0,X.useEffect)(()=>{let a=e.current;if(!a||!n)return;let o=e=>e===0?`left`:e===2?`right`:null,s=()=>t({type:`releaseAll`}),c=null,l=0,u=()=>{l=0,c&&=(i(c.x,c.y,null,null),null)},d=()=>{l&&=(cancelAnimationFrame(l),0),c&&=(i(c.x,c.y,null,null),null)},f=e=>{e.preventDefault(),a.setPointerCapture(e.pointerId),a.focus(),d(),i(e.clientX,e.clientY,o(e.button),!0)},p=e=>{c={x:e.clientX,y:e.clientY},l||=requestAnimationFrame(u)},m=e=>{d(),i(e.clientX,e.clientY,o(e.button),!1)},h=e=>e.preventDefault(),g=!1,_=e=>{if(r&&K(e)){g=e.shiftKey;return}e.preventDefault(),t({type:`key`,code:e.code,down:!0}),r&&q(e)&&r.onCopyCombo()},v=e=>{r&&K(e)||(e.preventDefault(),t({type:`key`,code:e.code,down:!1}))},y=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`);t&&r?.onPasteText(t,g),g=!1},b=()=>{document.hidden&&s()};return a.tabIndex=0,a.addEventListener(`pointerdown`,f),a.addEventListener(`pointermove`,p),a.addEventListener(`pointerup`,m),a.addEventListener(`contextmenu`,h),a.addEventListener(`keydown`,_),a.addEventListener(`keyup`,v),a.addEventListener(`paste`,y),a.addEventListener(`blur`,s),document.addEventListener(`visibilitychange`,b),()=>{l&&cancelAnimationFrame(l),a.removeEventListener(`pointerdown`,f),a.removeEventListener(`pointermove`,p),a.removeEventListener(`pointerup`,m),a.removeEventListener(`contextmenu`,h),a.removeEventListener(`keydown`,_),a.removeEventListener(`keyup`,v),a.removeEventListener(`blur`,s),document.removeEventListener(`visibilitychange`,b)}},[e,n,i,t,r])}var Q={h264_nvenc:`NVIDIA NVENC`,h264_qsv:`Intel QuickSync`,h264_vaapi:`VAAPI (GPU)`,h264_amf:`AMD AMF`,h264_videotoolbox:`Apple VideoToolbox`,libx264:`Software (x264)`};function _e(e){return Object.hasOwn(Q,e)?Q[e]:e}var $=n(),ve=`flex size-7 shrink-0 items-center justify-center rounded bg-black/40 text-white/70 outline-none hover:bg-black/60 hover:text-white data-[state=open]:bg-black/70 data-[state=open]:text-white`;function ye({displays:e,currentDisplayId:t,onSelectDisplay:n,quality:o,qualityChoice:s,onSetQuality:c,onOpenCustomQuality:l,codecs:h,codec:g,onSetCodec:_,hostModes:v,hostModeId:b,hostOriginalModeId:x,onSetHostMode:S,canResizeHost:ee,resolutionError:C,viewStyle:w,customScale:T,onSetViewStyle:ne,onSetCustomScale:ae,showCursor:oe,onSetShowCursor:se,audioOn:E,audioReason:D,onSetAudioOn:O,privacyOn:k,privacyReason:A,privacyCanBlank:ce,onSetPrivacyOn:U,recording:W,recordingElapsedSec:G,recordingSupported:K,onToggleRecording:ue,onScreenshot:q,clipboardEnabled:fe,onSetClipboardEnabled:pe,statsVisible:me,onToggleStats:ge}){let Y=(0,X.useMemo)(()=>le(v),[v]),Z=(0,X.useMemo)(()=>he(),[]),Q=(0,X.useMemo)(()=>J(v,Z,b),[v,Z,b]),ye=!!(x&&x!==b),Se=t??e.find(e=>e.primary)?.id??e[0]?.id??``;return(0,$.jsxs)(`div`,{className:`absolute right-1 top-1 z-40 flex items-center gap-1`,"data-testid":`remote-desktop-toolbar`,children:[e.length>1&&(0,$.jsxs)(L,{children:[(0,$.jsx)(P,{className:ve,"aria-label":`Display`,title:`Display`,children:(0,$.jsx)(r,{className:`size-3.5`})}),(0,$.jsxs)(H,{align:`end`,className:`w-64`,children:[(0,$.jsx)(V,{children:`Display`}),(0,$.jsx)(F,{value:Se,onValueChange:n,children:e.map(e=>(0,$.jsxs)(j,{value:e.id,"data-testid":`remote-desktop-display-${e.id}`,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))})]})]}),(0,$.jsxs)(L,{children:[(0,$.jsx)(P,{className:ve,"aria-label":`Display settings`,title:`Display settings`,"data-testid":`remote-desktop-settings-trigger`,children:(0,$.jsx)(u,{className:`size-3.5`})}),(0,$.jsxs)(H,{align:`end`,className:`w-64`,children:[(0,$.jsx)(V,{children:`Scale`}),(0,$.jsx)(F,{value:w,onValueChange:e=>ne(e),children:y.map(e=>(0,$.jsx)(j,{value:e,"data-testid":`remote-desktop-view-style-${e}`,children:te[e]},e))}),w===`custom`&&(0,$.jsx)(xe,{scale:T,onSet:ae}),(0,$.jsx)(B,{}),(0,$.jsxs)(I,{children:[(0,$.jsxs)(M,{"data-testid":`remote-desktop-quality-submenu`,children:[`Image quality`,o.held<1&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,"data-testid":`remote-desktop-quality-held`,children:[Math.round(o.held*100),`% — link limited`]})]}),(0,$.jsx)(N,{className:`w-56`,children:(0,$.jsxs)(F,{value:s,onValueChange:e=>e===`custom`?l():c(e),children:[re.map(e=>(0,$.jsx)(j,{value:e,"data-testid":`remote-desktop-quality-${e}`,children:m[e].label},e)),(0,$.jsx)(j,{value:`custom`,"data-testid":`remote-desktop-quality-custom`,children:`Custom…`})]})})]}),h.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(M,{"data-testid":`remote-desktop-codec-submenu`,children:`Codec`}),(0,$.jsx)(N,{className:`w-56`,children:(0,$.jsxs)(F,{value:g??`auto`,onValueChange:e=>_(e===`auto`?null:e),children:[(0,$.jsxs)(j,{value:`auto`,children:[`Auto · `,_e(h[0])]}),h.map(e=>(0,$.jsx)(j,{value:e,"data-testid":`remote-desktop-codec-${e}`,children:_e(e)},e))]})})]}),ee&&Y.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(M,{"data-testid":`remote-desktop-resolution-submenu`,children:`Resolution`}),(0,$.jsxs)(N,{className:`max-h-80 w-56 overflow-y-auto`,children:[ye&&x&&(0,$.jsx)(R,{onSelect:()=>S(x),"data-testid":`remote-desktop-resolution-original`,children:`Original`}),Q&&(0,$.jsxs)(R,{onSelect:()=>S(Q.id),"data-testid":`remote-desktop-resolution-fit-local`,children:[`Fit local `,Q.width,`×`,Q.height]}),(ye||Q)&&(0,$.jsx)(B,{}),(0,$.jsx)(F,{value:b??Y.find(e=>e.current)?.id??``,onValueChange:S,children:Y.map(e=>(0,$.jsxs)(j,{value:e.id,"data-testid":`remote-desktop-resolution-${e.width}x${e.height}`,children:[de(e),e.preferred&&(0,$.jsx)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:`native`})]},e.id))}),C&&(0,$.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] leading-tight text-destructive`,children:C})]})]}),(0,$.jsx)(B,{}),(0,$.jsx)(z,{checked:oe,onCheckedChange:se,"data-testid":`remote-desktop-show-cursor`,children:`Show remote cursor`}),(0,$.jsx)(z,{checked:fe,onCheckedChange:pe,"data-testid":`remote-desktop-clipboard-toggle`,children:`Sync clipboard`}),(0,$.jsx)(z,{checked:E,disabled:D!==null,onCheckedChange:O,"data-testid":`remote-desktop-audio-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Play host audio`}),D&&(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:D})]})}),(0,$.jsx)(B,{}),(0,$.jsx)(z,{checked:k,disabled:A!==null&&!k,onCheckedChange:U,"data-testid":`remote-desktop-privacy-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Privacy mode`}),(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:A??(ce?`Blocks the host's keyboard and mouse, and blanks its screen`:`Blocks the host's keyboard and mouse (its screen stays on)`)})]})}),(0,$.jsx)(B,{}),(0,$.jsxs)(R,{onSelect:q,"data-testid":`remote-desktop-screenshot`,children:[(0,$.jsx)(i,{className:`size-3.5`}),` Save screenshot`]}),K&&(0,$.jsx)(R,{onSelect:ue,"data-testid":`remote-desktop-record`,children:W?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{className:`size-3.5 text-red-500`}),` Stop recording · `,be(G)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-3.5`}),` Start recording`]})})]})]}),k&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>U(!1),title:`Privacy mode is on — click to release the host`,"aria-label":`Turn privacy mode off`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-amber-500/85 px-1.5 text-[10px] font-medium text-black hover:bg-amber-400`,"data-testid":`remote-desktop-privacy-indicator`,children:[(0,$.jsx)(d,{className:`size-3`}),` Host locked`]}),W&&(0,$.jsxs)(`button`,{type:`button`,onClick:ue,title:`Stop recording`,"aria-label":`Stop recording`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-red-600/80 px-1.5 text-[10px] font-medium tabular-nums text-white hover:bg-red-600`,"data-testid":`remote-desktop-recording-indicator`,children:[(0,$.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-white`}),be(G)]}),(0,$.jsx)(`button`,{type:`button`,onClick:ge,"aria-label":`Toggle stats overlay`,"aria-pressed":me,title:`Quality monitor`,className:ie(ve,me&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,$.jsx)(a,{className:`size-3.5`})})]})}function be(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t>0?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function xe({scale:e,onSet:t}){let[n,r]=(0,X.useState)(null),i=(0,X.useRef)(null),a=w(Math.round(ee(e)*100)),o=n??a,l=g(o);(0,X.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let u=e=>{r(e),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r(null),t(e/100)},300)},d=e=>t=>{t.preventDefault(),u(w(o+e*1))},f=`flex size-6 shrink-0 items-center justify-center rounded hover:bg-accent disabled:opacity-40`;return(0,$.jsx)(`div`,{className:`px-2 py-1.5`,"data-testid":`remote-desktop-zoom-row`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(-1),disabled:o<=5,"aria-label":`Decrease`,children:(0,$.jsx)(s,{className:`size-3.5`})}),(0,$.jsxs)(`span`,{className:`relative flex-1 py-2.5`,children:[(0,$.jsx)(`input`,{type:`range`,min:0,max:1,step:1/(S-5),value:l,"aria-label":`Scale`,"aria-valuetext":`${o}%`,"data-testid":`remote-desktop-zoom-slider`,onKeyDown:e=>e.stopPropagation(),onChange:e=>u(b(ne(Number(e.target.value)))),className:`h-1 w-full cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`pointer-events-none absolute top-0 -translate-x-1/2 rounded bg-primary px-1.5 text-[10px] leading-4 tabular-nums text-primary-foreground`,style:{left:`${l*100}%`},"data-testid":`remote-desktop-zoom-value`,children:[o,`%`]})]}),(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(1),disabled:o>=S,"aria-label":`Increase`,children:(0,$.jsx)(c,{className:`size-3.5`})})]})})}var Se=400;function Ce({open:e,onOpenChange:t,percent:n,fps:r,more:i,onSetMore:a,onCommit:o,frameSize:s}){let[c,l]=(0,X.useState)(n),[u,d]=(0,X.useState)(r),f=(0,X.useRef)(null);(0,X.useEffect)(()=>{e&&(l(n),d(r))},[e,n,r]),(0,X.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=i?_:100,m=(e,t)=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>o(e,t),Se)},h=e=>{let t=C(e,i);l(t),m(t,u)},g=e=>{let t=v(e);d(t),m(c,t)},y=e=>{a(e);let t=C(c,e);t!==c&&(l(t),m(t,u))},b=x(c,s.width,s.height);return(0,$.jsx)(A,{open:e,onOpenChange:t,children:(0,$.jsxs)(D,{className:`sm:max-w-md`,"data-testid":`remote-desktop-custom-quality-dialog`,children:[(0,$.jsxs)(se,{children:[(0,$.jsx)(O,{children:`Custom image quality`}),(0,$.jsx)(k,{children:s.width>0?`${c}% of the base rate for ${s.width}×${s.height} — about ${(b/1e3).toFixed(1)} Mbit/s`:`Waiting for the first frame`})]}),(0,$.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:10,max:p,step:1,value:Math.min(c,p),onChange:e=>h(Number(e.target.value)),"aria-label":`Bitrate`,"data-testid":`remote-desktop-custom-bitrate`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:[c,`%`]}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`Bitrate`}),(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>y(e.target.checked),"data-testid":`remote-desktop-custom-more`,className:`size-3.5 accent-primary`}),`More`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:5,max:120,step:1,value:u,onChange:e=>g(Number(e.target.value)),"aria-label":`FPS`,"data-testid":`remote-desktop-custom-fps`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsx)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:u}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`FPS`}),(0,$.jsx)(`span`,{className:`w-[4.25rem] shrink-0`,"aria-hidden":!0})]})]}),(0,$.jsx)(E,{children:(0,$.jsx)(oe,{onClick:()=>t(!1),children:`Close`})})]})})}function we({id:e}){let t=ae(e=>e.close),n=(0,X.useCallback)(()=>t(e),[t,e]);return(0,$.jsx)(U,{onCancel:n,children:(0,$.jsx)(W,{onCancel:n,children:(0,$.jsx)(Te,{})})})}function Te(){let e=(0,X.useRef)(null),t=fe(),{connState:n,errorMessage:r,decoderStatus:i,decoderErrorMessage:a,sendMessage:s,reconnect:c,getFrameCount:u,getTotalBytes:d,frameSize:f,quality:p,setQuality:m,setCustomQuality:g,showCursor:_,setShowCursor:v,codec:y,setCodec:b,audioOn:x,setAudioOn:S,getAudioTracks:ee,privacyOn:C,privacyError:te,setPrivacyOn:w,hostModeId:ne,hostOriginalModeId:re,resolutionError:ae,setHostMode:oe,pendingHostClipboard:se,clearHostClipboard:E,sendClipboard:D,requestHostClipboard:O}=pe(e,{displayId:t.displayId}),k=T(e=>e.remoteDesktopStatsVisible),A=T(e=>e.toggleRemoteDesktopStatsVisible),j=T(e=>e.remoteDesktopViewStyle),M=T(e=>e.remoteDesktopCustomScale),N=T(e=>e.setRemoteDesktopViewStyle),P=T(e=>e.setRemoteDesktopCustomScale),F=T(e=>e.remoteDesktopClipboardSync),I=T(e=>e.remoteDesktopQuality),L=T(e=>e.remoteDesktopCustomQualityPercent),R=T(e=>e.remoteDesktopCustomFps),z=T(e=>e.remoteDesktopCustomQualityMore),B=T(e=>e.setRemoteDesktopCustomQualityMore),[V,H]=(0,X.useState)(!1),U=T(e=>e.setRemoteDesktopClipboardSync),{caps:W}=ce(!1),[le,K]=(0,X.useState)(!1),de=(0,X.useMemo)(()=>F?{onPasteText:(e,t)=>{K(!0),D(e,!0,t)},onCopyCombo:O}:void 0,[F,D,O]);Z(e,s,n===`streaming`,de);let q=ue(e,ee),J=h(j,M,f),he=i===`unsupported`?a:n===`error`?r:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,$.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,$.jsx)(`div`,{className:ie(`flex h-full w-full`,J?`overflow-auto`:`overflow-hidden`),children:(0,$.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,"data-view-style":j,className:ie(`m-auto outline-none`,!J&&`max-h-full max-w-full`),style:J?{width:J.width,height:J.height}:void 0})}),(0,$.jsx)(me,{canvasRef:e,getFrameCount:u,getTotalBytes:d}),(0,$.jsx)(ye,{displays:t.displays,currentDisplayId:t.current?.id,onSelectDisplay:t.select,quality:p,qualityChoice:I,onSetQuality:m,onOpenCustomQuality:()=>H(!0),codecs:W?.encoders??[],codec:y,onSetCodec:b,hostModes:W?.resolutions?.modes??[],hostModeId:ne,hostOriginalModeId:re,onSetHostMode:oe,canResizeHost:W?.inputReady??!1,resolutionError:ae,viewStyle:j,customScale:M,onSetViewStyle:N,onSetCustomScale:P,showCursor:_,onSetShowCursor:v,audioOn:x,audioReason:W&&!W.audio.available?W.audio.reason:null,onSetAudioOn:S,privacyOn:C,privacyReason:te??(W&&!W.privacy.available?W.privacy.reason:null),privacyCanBlank:W?.privacy?.canBlank??!1,onSetPrivacyOn:w,recording:q.recording,recordingElapsedSec:q.elapsedSec,recordingSupported:q.supported,onToggleRecording:q.toggle,onScreenshot:()=>void G(e.current),clipboardEnabled:F,onSetClipboardEnabled:U,statsVisible:k,onToggleStats:A}),(0,$.jsx)(ge,{pendingText:se,onDismiss:E,missingToolAction:le&&W&&!W.clipboard.available?W.clipboard.action:null,onDismissMissingTool:()=>K(!1)}),(0,$.jsx)(Ce,{open:V,onOpenChange:H,percent:L,fps:R,more:z,onSetMore:B,onCommit:g,frameSize:f}),he&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,$.jsx)(o,{className:`size-6 opacity-70`}),(0,$.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:he}),(n===`error`||n===`closed`)&&i!==`unsupported`&&(0,$.jsxs)(`button`,{onClick:c,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,$.jsx)(l,{className:`size-3.5`}),` Reconnect`]})]})]})}export{we as default};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{En as r,Gt as i,Nt as a,On as o,Tn as s,Zn as c,or as l,pr as u,ut as d,xr as f,z as p}from"./icons-CO_II6D-.js";import"./api-client-F5Zi1sR0.js";import{C as m,a as h,c as g,d as _,f as v,i as y,l as b,m as x,n as S,o as ee,p as C,r as te,s as w,t as T,u as ne,w as re}from"./settings-store-3jIBB8gx.js";import{n as ie}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./panel-store-DrSH3Nhp.js";import{t as ae}from"./window-store-B4cbZ5rr.js";import"./project-store-CCimwgGF.js";import{t as oe}from"./button-CsmGH5xa.js";import{a as se,i as E,n as D,o as O,r as k,t as A}from"./dialog-z8PLkL8n.js";import"./ws-auth-J3hw0Mhc.js";import{Cn as j,Dn as M,En as N,On as P,Sn as F,Tn as I,Z as ce,_n as L,bn as R,vn as z,wn as B,xn as V,yn as H}from"./index-D41mthBS.js";import"./run-in-terminal-Cdn9PaAl.js";import{n as U,t as W}from"./remote-desktop-readiness-gate-CqnG8BlK.js";import{a as G,c as le,h as K,i as ue,l as de,m as q,n as fe,o as J,p as pe,r as me,s as he,t as ge,u as Y}from"./remote-desktop-clipboard-notice-C6tt5SDH.js";var X=e(t(),1);function Z(e,t,n,r){let i=(0,X.useCallback)((n,r,i,a)=>{let o=e.current;if(!o)return;let{xFrac:s,yFrac:c}=Y(n,r,o.getBoundingClientRect());t({type:`pointer`,xFrac:s,yFrac:c,button:i,down:a})},[e,t]);(0,X.useEffect)(()=>{let a=e.current;if(!a||!n)return;let o=e=>e===0?`left`:e===2?`right`:null,s=()=>t({type:`releaseAll`}),c=null,l=0,u=()=>{l=0,c&&=(i(c.x,c.y,null,null),null)},d=()=>{l&&=(cancelAnimationFrame(l),0),c&&=(i(c.x,c.y,null,null),null)},f=e=>{e.preventDefault(),a.setPointerCapture(e.pointerId),a.focus(),d(),i(e.clientX,e.clientY,o(e.button),!0)},p=e=>{c={x:e.clientX,y:e.clientY},l||=requestAnimationFrame(u)},m=e=>{d(),i(e.clientX,e.clientY,o(e.button),!1)},h=e=>e.preventDefault(),g=!1,_=e=>{if(r&&K(e)){g=e.shiftKey;return}e.preventDefault(),t({type:`key`,code:e.code,down:!0}),r&&q(e)&&r.onCopyCombo()},v=e=>{r&&K(e)||(e.preventDefault(),t({type:`key`,code:e.code,down:!1}))},y=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`);t&&r?.onPasteText(t,g),g=!1},b=()=>{document.hidden&&s()};return a.tabIndex=0,a.addEventListener(`pointerdown`,f),a.addEventListener(`pointermove`,p),a.addEventListener(`pointerup`,m),a.addEventListener(`contextmenu`,h),a.addEventListener(`keydown`,_),a.addEventListener(`keyup`,v),a.addEventListener(`paste`,y),a.addEventListener(`blur`,s),document.addEventListener(`visibilitychange`,b),()=>{l&&cancelAnimationFrame(l),a.removeEventListener(`pointerdown`,f),a.removeEventListener(`pointermove`,p),a.removeEventListener(`pointerup`,m),a.removeEventListener(`contextmenu`,h),a.removeEventListener(`keydown`,_),a.removeEventListener(`keyup`,v),a.removeEventListener(`blur`,s),document.removeEventListener(`visibilitychange`,b)}},[e,n,i,t,r])}var Q={h264_nvenc:`NVIDIA NVENC`,h264_qsv:`Intel QuickSync`,h264_vaapi:`VAAPI (GPU)`,h264_amf:`AMD AMF`,h264_videotoolbox:`Apple VideoToolbox`,libx264:`Software (x264)`};function _e(e){return Object.hasOwn(Q,e)?Q[e]:e}var $=n(),ve=`flex size-7 shrink-0 items-center justify-center rounded bg-black/40 text-white/70 outline-none hover:bg-black/60 hover:text-white data-[state=open]:bg-black/70 data-[state=open]:text-white`;function ye({displays:e,currentDisplayId:t,onSelectDisplay:n,quality:o,qualityChoice:s,onSetQuality:c,onOpenCustomQuality:l,codecs:h,codec:g,onSetCodec:_,hostModes:v,hostModeId:b,hostOriginalModeId:x,onSetHostMode:S,canResizeHost:ee,resolutionError:C,viewStyle:w,customScale:T,onSetViewStyle:ne,onSetCustomScale:ae,showCursor:oe,onSetShowCursor:se,audioOn:E,audioReason:D,onSetAudioOn:O,privacyOn:k,privacyReason:A,privacyCanBlank:ce,onSetPrivacyOn:U,recording:W,recordingElapsedSec:G,recordingSupported:K,onToggleRecording:ue,onScreenshot:q,clipboardEnabled:fe,onSetClipboardEnabled:pe,statsVisible:me,onToggleStats:ge}){let Y=(0,X.useMemo)(()=>le(v),[v]),Z=(0,X.useMemo)(()=>he(),[]),Q=(0,X.useMemo)(()=>J(v,Z,b),[v,Z,b]),ye=!!(x&&x!==b),Se=t??e.find(e=>e.primary)?.id??e[0]?.id??``;return(0,$.jsxs)(`div`,{className:`absolute right-1 top-1 z-40 flex items-center gap-1`,"data-testid":`remote-desktop-toolbar`,children:[e.length>1&&(0,$.jsxs)(L,{children:[(0,$.jsx)(P,{className:ve,"aria-label":`Display`,title:`Display`,children:(0,$.jsx)(r,{className:`size-3.5`})}),(0,$.jsxs)(H,{align:`end`,className:`w-64`,children:[(0,$.jsx)(V,{children:`Display`}),(0,$.jsx)(F,{value:Se,onValueChange:n,children:e.map(e=>(0,$.jsxs)(j,{value:e.id,"data-testid":`remote-desktop-display-${e.id}`,children:[e.label,e.primary?` (main)`:``,` · `,e.width,`×`,e.height]},e.id))})]})]}),(0,$.jsxs)(L,{children:[(0,$.jsx)(P,{className:ve,"aria-label":`Display settings`,title:`Display settings`,"data-testid":`remote-desktop-settings-trigger`,children:(0,$.jsx)(u,{className:`size-3.5`})}),(0,$.jsxs)(H,{align:`end`,className:`w-64`,children:[(0,$.jsx)(V,{children:`Scale`}),(0,$.jsx)(F,{value:w,onValueChange:e=>ne(e),children:y.map(e=>(0,$.jsx)(j,{value:e,"data-testid":`remote-desktop-view-style-${e}`,children:te[e]},e))}),w===`custom`&&(0,$.jsx)(xe,{scale:T,onSet:ae}),(0,$.jsx)(B,{}),(0,$.jsxs)(I,{children:[(0,$.jsxs)(M,{"data-testid":`remote-desktop-quality-submenu`,children:[`Image quality`,o.held<1&&(0,$.jsxs)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,"data-testid":`remote-desktop-quality-held`,children:[Math.round(o.held*100),`% — link limited`]})]}),(0,$.jsx)(N,{className:`w-56`,children:(0,$.jsxs)(F,{value:s,onValueChange:e=>e===`custom`?l():c(e),children:[re.map(e=>(0,$.jsx)(j,{value:e,"data-testid":`remote-desktop-quality-${e}`,children:m[e].label},e)),(0,$.jsx)(j,{value:`custom`,"data-testid":`remote-desktop-quality-custom`,children:`Custom…`})]})})]}),h.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(M,{"data-testid":`remote-desktop-codec-submenu`,children:`Codec`}),(0,$.jsx)(N,{className:`w-56`,children:(0,$.jsxs)(F,{value:g??`auto`,onValueChange:e=>_(e===`auto`?null:e),children:[(0,$.jsxs)(j,{value:`auto`,children:[`Auto · `,_e(h[0])]}),h.map(e=>(0,$.jsx)(j,{value:e,"data-testid":`remote-desktop-codec-${e}`,children:_e(e)},e))]})})]}),ee&&Y.length>1&&(0,$.jsxs)(I,{children:[(0,$.jsx)(M,{"data-testid":`remote-desktop-resolution-submenu`,children:`Resolution`}),(0,$.jsxs)(N,{className:`max-h-80 w-56 overflow-y-auto`,children:[ye&&x&&(0,$.jsx)(R,{onSelect:()=>S(x),"data-testid":`remote-desktop-resolution-original`,children:`Original`}),Q&&(0,$.jsxs)(R,{onSelect:()=>S(Q.id),"data-testid":`remote-desktop-resolution-fit-local`,children:[`Fit local `,Q.width,`×`,Q.height]}),(ye||Q)&&(0,$.jsx)(B,{}),(0,$.jsx)(F,{value:b??Y.find(e=>e.current)?.id??``,onValueChange:S,children:Y.map(e=>(0,$.jsxs)(j,{value:e.id,"data-testid":`remote-desktop-resolution-${e.width}x${e.height}`,children:[de(e),e.preferred&&(0,$.jsx)(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:`native`})]},e.id))}),C&&(0,$.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] leading-tight text-destructive`,children:C})]})]}),(0,$.jsx)(B,{}),(0,$.jsx)(z,{checked:oe,onCheckedChange:se,"data-testid":`remote-desktop-show-cursor`,children:`Show remote cursor`}),(0,$.jsx)(z,{checked:fe,onCheckedChange:pe,"data-testid":`remote-desktop-clipboard-toggle`,children:`Sync clipboard`}),(0,$.jsx)(z,{checked:E,disabled:D!==null,onCheckedChange:O,"data-testid":`remote-desktop-audio-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Play host audio`}),D&&(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:D})]})}),(0,$.jsx)(B,{}),(0,$.jsx)(z,{checked:k,disabled:A!==null&&!k,onCheckedChange:U,"data-testid":`remote-desktop-privacy-toggle`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Privacy mode`}),(0,$.jsx)(`span`,{className:`text-[10px] leading-tight text-muted-foreground`,children:A??(ce?`Blocks the host's keyboard and mouse, and blanks its screen`:`Blocks the host's keyboard and mouse (its screen stays on)`)})]})}),(0,$.jsx)(B,{}),(0,$.jsxs)(R,{onSelect:q,"data-testid":`remote-desktop-screenshot`,children:[(0,$.jsx)(i,{className:`size-3.5`}),` Save screenshot`]}),K&&(0,$.jsx)(R,{onSelect:ue,"data-testid":`remote-desktop-record`,children:W?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{className:`size-3.5 text-red-500`}),` Stop recording · `,be(G)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-3.5`}),` Start recording`]})})]})]}),k&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>U(!1),title:`Privacy mode is on — click to release the host`,"aria-label":`Turn privacy mode off`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-amber-500/85 px-1.5 text-[10px] font-medium text-black hover:bg-amber-400`,"data-testid":`remote-desktop-privacy-indicator`,children:[(0,$.jsx)(d,{className:`size-3`}),` Host locked`]}),W&&(0,$.jsxs)(`button`,{type:`button`,onClick:ue,title:`Stop recording`,"aria-label":`Stop recording`,className:`flex h-7 shrink-0 items-center gap-1 rounded bg-red-600/80 px-1.5 text-[10px] font-medium tabular-nums text-white hover:bg-red-600`,"data-testid":`remote-desktop-recording-indicator`,children:[(0,$.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-white`}),be(G)]}),(0,$.jsx)(`button`,{type:`button`,onClick:ge,"aria-label":`Toggle stats overlay`,"aria-pressed":me,title:`Quality monitor`,className:ie(ve,me&&`bg-primary/70 text-primary-foreground hover:bg-primary/80`),children:(0,$.jsx)(a,{className:`size-3.5`})})]})}function be(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=String(e%60).padStart(2,`0`);return t>0?`${t}:${String(n).padStart(2,`0`)}:${r}`:`${n}:${r}`}function xe({scale:e,onSet:t}){let[n,r]=(0,X.useState)(null),i=(0,X.useRef)(null),a=w(Math.round(ee(e)*100)),o=n??a,l=g(o);(0,X.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let u=e=>{r(e),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r(null),t(e/100)},300)},d=e=>t=>{t.preventDefault(),u(w(o+e*1))},f=`flex size-6 shrink-0 items-center justify-center rounded hover:bg-accent disabled:opacity-40`;return(0,$.jsx)(`div`,{className:`px-2 py-1.5`,"data-testid":`remote-desktop-zoom-row`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(-1),disabled:o<=5,"aria-label":`Decrease`,children:(0,$.jsx)(s,{className:`size-3.5`})}),(0,$.jsxs)(`span`,{className:`relative flex-1 py-2.5`,children:[(0,$.jsx)(`input`,{type:`range`,min:0,max:1,step:1/(S-5),value:l,"aria-label":`Scale`,"aria-valuetext":`${o}%`,"data-testid":`remote-desktop-zoom-slider`,onKeyDown:e=>e.stopPropagation(),onChange:e=>u(b(ne(Number(e.target.value)))),className:`h-1 w-full cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`pointer-events-none absolute top-0 -translate-x-1/2 rounded bg-primary px-1.5 text-[10px] leading-4 tabular-nums text-primary-foreground`,style:{left:`${l*100}%`},"data-testid":`remote-desktop-zoom-value`,children:[o,`%`]})]}),(0,$.jsx)(`button`,{type:`button`,className:f,onClick:d(1),disabled:o>=S,"aria-label":`Increase`,children:(0,$.jsx)(c,{className:`size-3.5`})})]})})}var Se=400;function Ce({open:e,onOpenChange:t,percent:n,fps:r,more:i,onSetMore:a,onCommit:o,frameSize:s}){let[c,l]=(0,X.useState)(n),[u,d]=(0,X.useState)(r),f=(0,X.useRef)(null);(0,X.useEffect)(()=>{e&&(l(n),d(r))},[e,n,r]),(0,X.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=i?_:100,m=(e,t)=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>o(e,t),Se)},h=e=>{let t=C(e,i);l(t),m(t,u)},g=e=>{let t=v(e);d(t),m(c,t)},y=e=>{a(e);let t=C(c,e);t!==c&&(l(t),m(t,u))},b=x(c,s.width,s.height);return(0,$.jsx)(A,{open:e,onOpenChange:t,children:(0,$.jsxs)(D,{className:`sm:max-w-md`,"data-testid":`remote-desktop-custom-quality-dialog`,children:[(0,$.jsxs)(se,{children:[(0,$.jsx)(O,{children:`Custom image quality`}),(0,$.jsx)(k,{children:s.width>0?`${c}% of the base rate for ${s.width}×${s.height} — about ${(b/1e3).toFixed(1)} Mbit/s`:`Waiting for the first frame`})]}),(0,$.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:10,max:p,step:1,value:Math.min(c,p),onChange:e=>h(Number(e.target.value)),"aria-label":`Bitrate`,"data-testid":`remote-desktop-custom-bitrate`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsxs)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:[c,`%`]}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`Bitrate`}),(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>y(e.target.checked),"data-testid":`remote-desktop-custom-more`,className:`size-3.5 accent-primary`}),`More`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`input`,{type:`range`,min:5,max:120,step:1,value:u,onChange:e=>g(Number(e.target.value)),"aria-label":`FPS`,"data-testid":`remote-desktop-custom-fps`,className:`h-1 min-w-0 flex-1 cursor-pointer appearance-none rounded bg-accent accent-primary`}),(0,$.jsx)(`span`,{className:`w-14 text-right text-xs tabular-nums`,children:u}),(0,$.jsx)(`span`,{className:`w-14 text-xs text-muted-foreground`,children:`FPS`}),(0,$.jsx)(`span`,{className:`w-[4.25rem] shrink-0`,"aria-hidden":!0})]})]}),(0,$.jsx)(E,{children:(0,$.jsx)(oe,{onClick:()=>t(!1),children:`Close`})})]})})}function we({id:e}){let t=ae(e=>e.close),n=(0,X.useCallback)(()=>t(e),[t,e]);return(0,$.jsx)(U,{onCancel:n,children:(0,$.jsx)(W,{onCancel:n,children:(0,$.jsx)(Te,{})})})}function Te(){let e=(0,X.useRef)(null),t=fe(),{connState:n,errorMessage:r,decoderStatus:i,decoderErrorMessage:a,sendMessage:s,reconnect:c,getFrameCount:u,getTotalBytes:d,frameSize:f,quality:p,setQuality:m,setCustomQuality:g,showCursor:_,setShowCursor:v,codec:y,setCodec:b,audioOn:x,setAudioOn:S,getAudioTracks:ee,privacyOn:C,privacyError:te,setPrivacyOn:w,hostModeId:ne,hostOriginalModeId:re,resolutionError:ae,setHostMode:oe,pendingHostClipboard:se,clearHostClipboard:E,sendClipboard:D,requestHostClipboard:O}=pe(e,{displayId:t.displayId}),k=T(e=>e.remoteDesktopStatsVisible),A=T(e=>e.toggleRemoteDesktopStatsVisible),j=T(e=>e.remoteDesktopViewStyle),M=T(e=>e.remoteDesktopCustomScale),N=T(e=>e.setRemoteDesktopViewStyle),P=T(e=>e.setRemoteDesktopCustomScale),F=T(e=>e.remoteDesktopClipboardSync),I=T(e=>e.remoteDesktopQuality),L=T(e=>e.remoteDesktopCustomQualityPercent),R=T(e=>e.remoteDesktopCustomFps),z=T(e=>e.remoteDesktopCustomQualityMore),B=T(e=>e.setRemoteDesktopCustomQualityMore),[V,H]=(0,X.useState)(!1),U=T(e=>e.setRemoteDesktopClipboardSync),{caps:W}=ce(!1),[le,K]=(0,X.useState)(!1),de=(0,X.useMemo)(()=>F?{onPasteText:(e,t)=>{K(!0),D(e,!0,t)},onCopyCombo:O}:void 0,[F,D,O]);Z(e,s,n===`streaming`,de);let q=ue(e,ee),J=h(j,M,f),he=i===`unsupported`?a:n===`error`?r:n===`closed`?`Disconnected`:n===`connecting`?`Connecting…`:null;return(0,$.jsxs)(`div`,{className:`relative flex h-full w-full items-center justify-center bg-black`,"data-testid":`remote-desktop-window`,"data-conn-state":n,children:[(0,$.jsx)(`div`,{className:ie(`flex h-full w-full`,J?`overflow-auto`:`overflow-hidden`),children:(0,$.jsx)(`canvas`,{ref:e,"data-testid":`remote-desktop-canvas`,"data-view-style":j,className:ie(`m-auto outline-none`,!J&&`max-h-full max-w-full`),style:J?{width:J.width,height:J.height}:void 0})}),(0,$.jsx)(me,{canvasRef:e,getFrameCount:u,getTotalBytes:d}),(0,$.jsx)(ye,{displays:t.displays,currentDisplayId:t.current?.id,onSelectDisplay:t.select,quality:p,qualityChoice:I,onSetQuality:m,onOpenCustomQuality:()=>H(!0),codecs:W?.encoders??[],codec:y,onSetCodec:b,hostModes:W?.resolutions?.modes??[],hostModeId:ne,hostOriginalModeId:re,onSetHostMode:oe,canResizeHost:W?.inputReady??!1,resolutionError:ae,viewStyle:j,customScale:M,onSetViewStyle:N,onSetCustomScale:P,showCursor:_,onSetShowCursor:v,audioOn:x,audioReason:W&&!W.audio.available?W.audio.reason:null,onSetAudioOn:S,privacyOn:C,privacyReason:te??(W&&!W.privacy.available?W.privacy.reason:null),privacyCanBlank:W?.privacy?.canBlank??!1,onSetPrivacyOn:w,recording:q.recording,recordingElapsedSec:q.elapsedSec,recordingSupported:q.supported,onToggleRecording:q.toggle,onScreenshot:()=>void G(e.current),clipboardEnabled:F,onSetClipboardEnabled:U,statsVisible:k,onToggleStats:A}),(0,$.jsx)(ge,{pendingText:se,onDismiss:E,missingToolAction:le&&W&&!W.clipboard.available?W.clipboard.action:null,onDismissMissingTool:()=>K(!1)}),(0,$.jsx)(Ce,{open:V,onOpenChange:H,percent:L,fps:R,more:z,onSetMore:B,onCommit:g,frameSize:f}),he&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/70 text-sm text-white`,children:[(0,$.jsx)(o,{className:`size-6 opacity-70`}),(0,$.jsx)(`span`,{className:`max-w-sm text-center px-4`,children:he}),(n===`error`||n===`closed`)&&i!==`unsupported`&&(0,$.jsxs)(`button`,{onClick:c,className:`flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 hover:bg-white/20`,children:[(0,$.jsx)(l,{className:`size-3.5`}),` Reconnect`]})]})]})}export{we as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{Mr as r,O as i,Qn as a,S as o,Wn as s,Yn as c,Zn as l,j as u}from"./icons-CO_II6D-.js";import{O as d,r as f}from"./api-client-F5Zi1sR0.js";import{n as p}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-CH1mvCwA.js";import{n as m}from"./use-is-mobile-CkO33jqU.js";import{t as h}from"./button-CsmGH5xa.js";import{a as ee,n as g,o as _,t as v}from"./dialog-z8PLkL8n.js";import{t as te}from"./mobile-bottom-sheet-CLic9ovp.js";import"./use-visual-viewport-C307OVeV.js";import{t as y}from"./input-CP31LZnN.js";import{t as b}from"./scroll-area-Dp-P38kg.js";import{Ct as x,St as S,an as C,bt as w,mn as T,on as E,sn as D,un as O,vt as k,xt as A,yt as j}from"./index-DQCw6d-2.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await f.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await f.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:p(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[o,l]=(0,M.useState)(!1),[m,h]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(T,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>l(!o),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[o?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(E,{children:[(0,I.jsxs)(D,{onClick:async()=>{try{let t=await f.post(`/api/schedules/${e.id}/run-now`);d.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),l(!0),h(e=>e+1)}catch(e){d.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(c,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(D,{onClick:async()=>{try{await f.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){d.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(a,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(D,{onClick:t,children:[(0,I.jsx)(s,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(O,{}),(0,I.jsxs)(D,{variant:`destructive`,onClick:async()=>{try{await f.del(`/api/schedules/${e.id}`),d.success(`Schedule deleted`),n()}catch(e){d.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(r,{className:`size-3.5`}),` Delete`]})]})]}),o&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},m)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=m(),[a,o]=(0,M.useState)(()=>$(t)),[s,c]=(0,M.useState)([]),[l,u]=(0,M.useState)(!1),[d,p]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),p(null),f.get(`/api/projects`).then(c).catch(()=>c([])))},[e,t]);let C=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),T=(e,t)=>o(n=>({...n,[e]:t})),E=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(y,{value:a.name,onChange:e=>T(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(y,{value:a.cron_expr,onChange:e=>T(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:C?`Next: ${C.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(k,{value:a.project_path,onValueChange:e=>T(`project_path`,e),children:[(0,I.jsx)(A,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(S,{placeholder:`Select project`})}),(0,I.jsx)(j,{children:s.map(e=>(0,I.jsx)(w,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>T(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(k,{value:a.permission_mode,onValueChange:e=>T(`permission_mode`,e),children:[(0,I.jsx)(A,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(S,{})}),(0,I.jsx)(j,{children:le.map(e=>(0,I.jsx)(w,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(y,{type:`number`,min:1,value:a.max_turns,onChange:e=>T(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(y,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>T(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(x,{checked:a.enabled,onCheckedChange:e=>T(`enabled`,e)})]}),d&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:d}),(0,I.jsx)(h,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){p(`Name, project, and prompt are required`);return}if(!C){p(`Invalid cron expression`);return}u(!0),p(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await f.patch(`/api/schedules/${t.id}`,e):await f.post(`/api/schedules`,e),r(),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(!1)}},disabled:l,className:`w-full min-h-11 cursor-pointer`,children:l?`Saving…`:t?`Save changes`:`Create schedule`})]}),D=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(te,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:D}),(0,I.jsx)(b,{className:`flex-1 min-h-0 px-3 pb-3`,children:E})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(g,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(_,{className:`text-sm`,children:D})}),E]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),c=()=>{s(null),i(!0)},u=e=>{s(e),i(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>u(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{Mr as r,O as i,Qn as a,S as o,Wn as s,Yn as c,Zn as l,j as u}from"./icons-CO_II6D-.js";import{O as d,r as f}from"./api-client-F5Zi1sR0.js";import{n as p}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-CH1mvCwA.js";import{n as m}from"./use-is-mobile-CkO33jqU.js";import{t as h}from"./button-CsmGH5xa.js";import{a as ee,n as g,o as _,t as v}from"./dialog-z8PLkL8n.js";import{t as te}from"./mobile-bottom-sheet-CLic9ovp.js";import"./use-visual-viewport-C307OVeV.js";import{t as y}from"./input-CP31LZnN.js";import{t as b}from"./scroll-area-Dp-P38kg.js";import{Ct as x,St as S,an as C,bt as w,mn as T,on as E,sn as D,un as O,vt as k,xt as A,yt as j}from"./index-D41mthBS.js";var M=e(t(),1),N=1e4;function P(){let[e,t]=(0,M.useState)([]),[n,r]=(0,M.useState)(!0),i=(0,M.useCallback)(async()=>{try{t(await f.get(`/api/schedules`))}catch{}finally{r(!1)}},[]);return(0,M.useEffect)(()=>{i();let e=setInterval(()=>{document.visibilityState===`visible`&&i()},N);return()=>clearInterval(e)},[i]),{schedules:e,loading:n,refetch:i}}function F(e){let[t,n]=(0,M.useState)([]),[r,i]=(0,M.useState)(!1),a=(0,M.useCallback)(async()=>{if(e!=null){i(!0);try{n(await f.get(`/api/schedules/${e}/runs?limit=20`))}catch{n([])}finally{i(!1)}}},[e]);return(0,M.useEffect)(()=>{a()},[a]),{runs:t,loading:r,refetch:a}}var I=n(),ne={done:`bg-success/10 text-success`,error:`bg-error/10 text-error`,running:`bg-warning/10 text-warning`,skipped:`bg-muted text-muted-foreground`};function re({scheduleId:e}){let{runs:t,loading:n}=F(e);return n&&t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`Loading runs…`}):t.length===0?(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground py-1`,children:`No runs yet.`}):(0,I.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,I.jsx)(ie,{run:e},e.id))})}function L(e){return new Date(e.includes(`T`)?e:e.replace(` `,`T`)+`Z`)}function ie({run:e}){let[t,n]=(0,M.useState)(!1),r=!!(e.output_truncated||e.error),i=e.ended_at?`${Math.round((L(e.ended_at).getTime()-L(e.started_at).getTime())/1e3)}s`:`…`;return(0,I.jsxs)(`div`,{className:`rounded border border-border text-[11px]`,children:[(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r&&n(!t),className:p(`w-full flex items-center gap-2 px-2 py-2 min-h-11 text-left`,r&&`cursor-pointer hover:bg-accent/30`),children:[(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 font-medium shrink-0`,ne[e.status]),children:e.status}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate flex-1`,children:[L(e.started_at).toLocaleString(),` · `,i,e.cost_usd!=null&&` · $${e.cost_usd.toFixed(4)}`,e.context_window_pct!=null&&` · ctx ${e.context_window_pct}%`]})]}),t&&(0,I.jsxs)(`div`,{className:`px-2 pb-2 space-y-1`,children:[e.error&&(0,I.jsx)(`p`,{className:`text-error break-all`,children:e.error}),e.output_truncated&&(0,I.jsx)(`pre`,{className:`overflow-auto max-h-96 whitespace-pre-wrap break-all text-muted-foreground font-mono text-[10px]`,children:e.output_truncated})]})]})}function ae({schedule:e,onEdit:t,onChanged:n}){let[o,l]=(0,M.useState)(!1),[m,h]=(0,M.useState)(0);return(0,I.jsxs)(`div`,{className:`rounded-lg border border-border`,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(T,{asChild:!0,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>l(!o),className:`w-full flex items-center gap-2 px-2.5 py-2.5 min-h-11 text-left cursor-pointer hover:bg-accent/30`,children:[o?(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`}):(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.name}),(0,I.jsxs)(`p`,{className:`text-[11px] text-muted-foreground truncate`,children:[(0,I.jsx)(`span`,{className:`font-mono`,children:e.cron_expr}),` · `,e.next_fire_at&&e.enabled?`next ${new Date(e.next_fire_at).toLocaleString()}`:`—`]})]}),(0,I.jsx)(`span`,{className:p(`rounded px-1.5 py-0.5 text-[10px] font-medium shrink-0`,e.enabled?`bg-success/10 text-success`:`bg-muted text-muted-foreground`),children:e.enabled?`Enabled`:`Disabled`})]})}),(0,I.jsxs)(E,{children:[(0,I.jsxs)(D,{onClick:async()=>{try{let t=await f.post(`/api/schedules/${e.id}/run-now`);d.success(`Run #${t.runId} started${t.wasRunning?` (previous run still active)`:``}`),l(!0),h(e=>e+1)}catch(e){d.error(e instanceof Error?e.message:`Run failed`)}},children:[(0,I.jsx)(c,{className:`size-3.5`}),` Run now`]}),(0,I.jsxs)(D,{onClick:async()=>{try{await f.patch(`/api/schedules/${e.id}`,{enabled:!e.enabled}),n()}catch(e){d.error(e instanceof Error?e.message:`Update failed`)}},children:[(0,I.jsx)(a,{className:`size-3.5`}),` `,e.enabled?`Disable`:`Enable`]}),(0,I.jsxs)(D,{onClick:t,children:[(0,I.jsx)(s,{className:`size-3.5`}),` Edit`]}),(0,I.jsx)(O,{}),(0,I.jsxs)(D,{variant:`destructive`,onClick:async()=>{try{await f.del(`/api/schedules/${e.id}`),d.success(`Schedule deleted`),n()}catch(e){d.error(e instanceof Error?e.message:`Delete failed`)}},children:[(0,I.jsx)(r,{className:`size-3.5`}),` Delete`]})]})]}),o&&(0,I.jsxs)(`div`,{className:`px-2.5 pb-2.5 space-y-1.5`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground break-all line-clamp-3`,children:e.prompt}),(0,I.jsx)(re,{scheduleId:e.id},m)]})]})}function R(e,t,n,r,i,a,o,s){return R.fromTZ(R.tp(e,t,n,r,i,a,o),s)}R.fromTZISO=(e,t,n)=>R.fromTZ(B(e,t),n),R.fromTZ=function(e,t){let n=new Date(Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)),r=z(e.tz,n),i=new Date(n.getTime()-r),a=z(e.tz,i);if(a-r===0)return i;{let r=new Date(n.getTime()-a),o=z(e.tz,r);if(o-a===0||!t&&o-a>0)return r;if(t)throw Error(`Invalid date passed to fromTZ()`);return i}},R.toTZ=function(e,t){let n=e.toLocaleString(`en-US`,{timeZone:t}).replace(/[\u202f]/,` `),r=new Date(n);return{y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),tz:t}},R.tp=(e,t,n,r,i,a,o)=>({y:e,m:t,d:n,h:r,i,s:a,tz:o});function z(e,t=new Date){let n=t.toLocaleString(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).split(` `).slice(-1)[0],r=t.toLocaleString(`en-US`).replace(/[\u202f]/,` `);return Date.parse(`${r} GMT`)-Date.parse(`${r} ${n}`)}function B(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`minitz: Invalid ISO8601 passed to parser.`);let r=e.substring(9);return e.includes(`Z`)||r.includes(`-`)||r.includes(`+`)?R.tp(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):R.tp(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}R.minitz=R;var V=32,H=31|V,U=[1,2,4,8,16],W=class{pattern;timezone;second;minute;hour;day;month;dayOfWeek;lastDayOfMonth;starDOM;starDOW;constructor(e,t){this.pattern=e,this.timezone=t,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.lastDayOfMonth=!1,this.starDOM=!1,this.starDOW=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.replace(/\s+/g,` `).split(` `);if(e.length<5||e.length>6)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five or six space separated parts are required.`);if(e.length===5&&e.unshift(`0`),e[3].indexOf(`L`)>=0&&(e[3]=e[3].replace(`L`,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.replaceAlphaDays(e[5])),e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0){let t=new q(new Date,this.timezone).getDate(!0);e[0]=e[0].replace(`?`,t.getSeconds().toString()),e[1]=e[1].replace(`?`,t.getMinutes().toString()),e[2]=e[2].replace(`?`,t.getHours().toString()),this.starDOM||(e[3]=e[3].replace(`?`,t.getDate().toString())),e[4]=e[4].replace(`?`,(t.getMonth()+1).toString()),this.starDOW||(e[5]=e[5].replace(`?`,t.getDay().toString()))}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1),this.partToArray(`dayOfWeek`,e[5],0,H),this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth;if(t===``&&!a)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let o=t.split(`,`);if(o.length>1)for(let t=0;t<o.length;t++)this.partToArray(e,o[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===5?/[^/*0-9,\-#L]+/:/[^/*0-9,-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=parseInt(i[0],10)+n;if(isNaN(a))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,a,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`&&(t<0||t>=12))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t);this[e][t]=n}handleRangeWithStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);if(isNaN(l))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(u))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(isNaN(d))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(d===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(d>this[t].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[t].length+`)`);if(l>u)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}return[n,r]}handleRange(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;if(isNaN(o))throw TypeError(`CronPattern: Syntax error, illegal lower range (NaN)`);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal upper range (NaN)`);if(o>s)throw TypeError(`CronPattern: From value is larger than to value: '`+e+`'`);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);a[0]===``&&(a[0]=`*`);let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);if(isNaN(s))throw TypeError(`CronPattern: Syntax error, illegal stepping: (NaN)`);if(s===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(s>this[t].length)throw TypeError(`CronPattern: Syntax error, max steps for part is (`+this[t].length+`)`);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();return t===`@yearly`||t===`@annually`?`0 0 1 1 *`:t===`@monthly`?`0 0 1 * *`:t===`@weekly`?`0 0 * * 0`:t===`@daily`?`0 0 * * *`:t===`@hourly`?`0 * * * *`:e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|V;else if(t===H)this.dayOfWeek[e]=H;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|U[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},G=[31,28,31,30,31,30,31,31,30,31,30,31],K=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],q=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date)if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`);else if(t===void 0)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&H&&U[a-1]&r)return!0;if(r&V){let r=new Date(Date.UTC(e,t+1,0)).getUTCDate();for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0)if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else{let t=R.toTZ(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.day>G[this.month]||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}else return!1}fromString(e){if(typeof this.tz==`number`){let t=R.fromTZISO(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(R.fromTZISO(e,this.tz))}findNext(e,t,n,r){let i=this[t],a;n.lastDayOfMonth&&(a=this.month===1?new Date(Date.UTC(this.year,this.month+1,0,0,0,0,0)).getUTCDate():G[this.month]);let o=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0;for(let s=this[t]+r;s<n[t].length;s++){let c=n[t][s];if(t===`day`&&n.lastDayOfMonth&&s-r==a&&(c=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(o+(s-r-1))%7];if(t&&t&H)t=this.isNthWeekdayOfMonth(this.year,this.month,s-r,t)?1:0;else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);e.legacyMode&&!n.starDOM?c||=t:c&&=t}if(c)return this[t]=s-r,i===this[t]?1:2}return 3}recurse(e,t,n){let r=this.findNext(t,K[n][0],e,K[n][2]);if(r>1){let i=n+1;for(;i<K.length;)this[K[i][0]]=-K[i][2],i++;if(r===3)return this[K[n][1]]++,this[K[n][0]]=-K[n][2],this.apply(),this.recurse(e,t,0);if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=K.length?this:this.year>=3e3?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):R.fromTZ(R.tp(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}};function oe(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode=e.legacyMode===void 0?!0:e.legacyMode,e.paused=e.paused===void 0?!1:e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch===void 0?!1:e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.unref=e.unref===void 0?!1:e.unref,e.startAt&&=new q(e.startAt,e.timezone),e.stopAt&&=new q(e.stopAt,e.timezone),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);return e}function J(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function se(e){return J(e)}function ce(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var Y=30*1e3,X=[],Z=class{name;options;_states;fn;constructor(e,t,n){let r,i;if(J(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(J(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=oe(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new W(`* * * * *`)},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new q(e,this.options.timezone||this.options.utcOffset):this._states.pattern=new W(e,this.options.timezone),this.name){if(X.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);X.push(this)}return i!==void 0&&se(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?t.getDate(!1):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=[],r=t||this._states.currentRun||void 0;for(;e--&&(r=this.nextRun(r));)n.push(r);return n}getPattern(){return this._states.pattern?this._states.pattern.pattern:void 0}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof q||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new q(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=X.indexOf(this);e>=0&&X.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>Y&&(t=Y),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&ce(this._states.currentTimeout),this)}async _trigger(e){if(this._states.blocking=!0,this._states.currentRun=new q(void 0,this.options.timezone||this.options.utcOffset),this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){J(this.options.catch)&&this.options.catch(e,this)}else this.fn!==void 0&&await this.fn(this,this.options.context);this._states.previousRun=new q(e,this.options.timezone||this.options.utcOffset),this._states.blocking=!1}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&J(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new q(e,this.options.timezone||this.options.utcOffset),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new q(e,this.options.timezone||this.options.utcOffset);return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_calculatePreviousRun(e,t){let n=new q(void 0,this.options.timezone||this.options.utcOffset),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new q(r,this.options.timezone||this.options.utcOffset).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}},le=[`bypassPermissions`,`acceptEdits`,`default`,`plan`];function ue({open:e,schedule:t,onClose:n,onSaved:r}){let i=m(),[a,o]=(0,M.useState)(()=>$(t)),[s,c]=(0,M.useState)([]),[l,u]=(0,M.useState)(!1),[d,p]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(o($(t)),p(null),f.get(`/api/projects`).then(c).catch(()=>c([])))},[e,t]);let C=(0,M.useMemo)(()=>{try{return new Z(a.cron_expr).nextRuns(3).map(e=>e.toLocaleString())}catch{return null}},[a.cron_expr]),T=(e,t)=>o(n=>({...n,[e]:t})),E=(0,I.jsxs)(`div`,{className:`space-y-3 px-1`,children:[(0,I.jsx)(Q,{label:`Name`,children:(0,I.jsx)(y,{value:a.name,onChange:e=>T(`name`,e.target.value),placeholder:`Morning PR review`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsxs)(Q,{label:`Cron expression (local timezone)`,children:[(0,I.jsx)(y,{value:a.cron_expr,onChange:e=>T(`cron_expr`,e.target.value),placeholder:`0 7 * * *`,className:`h-11 md:h-9 text-xs font-mono`}),(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:C?`Next: ${C.join(` · `)}`:`—`})]}),(0,I.jsx)(Q,{label:`Project`,children:(0,I.jsxs)(k,{value:a.project_path,onValueChange:e=>T(`project_path`,e),children:[(0,I.jsx)(A,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(S,{placeholder:`Select project`})}),(0,I.jsx)(j,{children:s.map(e=>(0,I.jsx)(w,{value:e.path,children:e.name},e.path))})]})}),(0,I.jsx)(Q,{label:`Prompt (do not embed secrets)`,children:(0,I.jsx)(`textarea`,{value:a.prompt,onChange:e=>T(`prompt`,e.target.value),placeholder:`Check open PRs and summarize. If nothing to do, finish immediately.`,rows:4,className:`w-full rounded-md border border-input bg-transparent px-3 py-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50 resize-y`})}),(0,I.jsxs)(Q,{label:`Permission mode`,children:[(0,I.jsxs)(k,{value:a.permission_mode,onValueChange:e=>T(`permission_mode`,e),children:[(0,I.jsx)(A,{className:`w-full min-h-11 md:min-h-9 text-xs`,children:(0,I.jsx)(S,{})}),(0,I.jsx)(j,{children:le.map(e=>(0,I.jsx)(w,{value:e,children:e},e))})]}),a.permission_mode===`bypassPermissions`&&(0,I.jsx)(`p`,{className:`text-[11px] text-warning`,children:`⚠ Unattended writes — agent can modify code and run commands`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,I.jsx)(Q,{label:`Max turns (optional)`,children:(0,I.jsx)(y,{type:`number`,min:1,value:a.max_turns,onChange:e=>T(`max_turns`,e.target.value),placeholder:`∞`,className:`h-11 md:h-9 text-xs`})}),(0,I.jsx)(Q,{label:`Timeout (ms)`,children:(0,I.jsx)(y,{type:`number`,min:1e4,value:a.timeout_ms,onChange:e=>T(`timeout_ms`,e.target.value),className:`h-11 md:h-9 text-xs`})})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between min-h-11`,children:[(0,I.jsx)(`span`,{className:`text-xs font-medium`,children:`Enabled`}),(0,I.jsx)(x,{checked:a.enabled,onCheckedChange:e=>T(`enabled`,e)})]}),d&&(0,I.jsx)(`p`,{className:`text-[11px] text-error`,children:d}),(0,I.jsx)(h,{onClick:async()=>{if(!a.name.trim()||!a.project_path||!a.prompt.trim()){p(`Name, project, and prompt are required`);return}if(!C){p(`Invalid cron expression`);return}u(!0),p(null);try{let e={name:a.name.trim(),cron_expr:a.cron_expr,project_path:a.project_path,prompt:a.prompt,permission_mode:a.permission_mode,max_turns:a.max_turns===``?null:Number(a.max_turns),timeout_ms:Number(a.timeout_ms)||18e5,enabled:a.enabled};t?await f.patch(`/api/schedules/${t.id}`,e):await f.post(`/api/schedules`,e),r(),n()}catch(e){p(e instanceof Error?e.message:String(e))}finally{u(!1)}},disabled:l,className:`w-full min-h-11 cursor-pointer`,children:l?`Saving…`:t?`Save changes`:`Create schedule`})]}),D=t?`Edit: ${t.name}`:`New schedule`;return i?(0,I.jsxs)(te,{open:e,onClose:n,className:`max-h-[85vh] flex flex-col`,children:[(0,I.jsx)(`p`,{className:`text-sm font-semibold text-center pb-2`,children:D}),(0,I.jsx)(b,{className:`flex-1 min-h-0 px-3 pb-3`,children:E})]}):(0,I.jsx)(v,{open:e,onOpenChange:e=>!e&&n(),children:(0,I.jsxs)(g,{className:`max-w-md max-h-[85vh] overflow-y-auto`,children:[(0,I.jsx)(ee,{children:(0,I.jsx)(_,{className:`text-sm`,children:D})}),E]})})}function Q({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]})}function $(e){return{name:e?.name??``,cron_expr:e?.cron_expr??`0 7 * * *`,project_path:e?.project_path??``,prompt:e?.prompt??``,permission_mode:e?.permission_mode??`bypassPermissions`,max_turns:e?.max_turns==null?``:String(e.max_turns),timeout_ms:String(e?.timeout_ms??18e5),enabled:e?!!e.enabled:!0}}function de(){let{schedules:e,loading:t,refetch:n}=P(),[r,i]=(0,M.useState)(!1),[a,s]=(0,M.useState)(null),c=()=>{s(null),i(!0)},u=e=>{s(e),i(!0)};return(0,I.jsxs)(`div`,{className:`space-y-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Periodically wake Claude to work on a project unattended.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 md:min-h-8 text-xs gap-1 cursor-pointer shrink-0`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add`]})]}),t&&e.length===0?(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:`Loading…`}):e.length===0?(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,I.jsx)(o,{className:`size-8 text-muted-foreground/50`}),(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No schedules yet. Add one to run Claude periodically.`}),(0,I.jsxs)(h,{size:`sm`,onClick:c,className:`min-h-11 text-xs gap-1 cursor-pointer`,children:[(0,I.jsx)(l,{className:`size-3.5`}),` Add schedule`]})]}):(0,I.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,I.jsx)(ae,{schedule:e,onEdit:()=>u(e),onChanged:n},e.id))}),(0,I.jsx)(ue,{open:r,schedule:a,onClose:()=>i(!1),onSaved:n})]})}export{de as SchedulesSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{ur as r}from"./icons-CO_II6D-.js";import{O as i,a,r as o}from"./api-client-F5Zi1sR0.js";import{n as s}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-CH1mvCwA.js";import{n as c}from"./use-is-mobile-CkO33jqU.js";import{t as l}from"./button-CsmGH5xa.js";import{a as u,n as d,o as f,t as p}from"./dialog-z8PLkL8n.js";import{t as m}from"./mobile-bottom-sheet-CLic9ovp.js";import"./use-visual-viewport-C307OVeV.js";import{an as h,mn as g,on as _,sn as v,un as y}from"./index-DQCw6d-2.js";import{r as b}from"./format-bytes-DZ8bW_uF.js";import{r as x}from"./process-row-format-Dbs_tAZ2.js";import{r as ee,t as S}from"./sortable-header-IH47XuRI.js";var C=e(t(),1),w=[`start`,`stop`,`restart`,`enable`,`disable`],T=3e3;async function te(e,t,n){let r=a(),i={"Content-Type":`application/json`,"X-PPM-Request":`1`};r&&(i.Authorization=`Bearer ${r}`);let o=await fetch(`/api/system/services/${e}/${encodeURIComponent(t)}/${n}`,{method:`POST`,headers:i,body:`{}`}),s;try{s=await o.json()}catch{throw Error(o.ok?`Empty response from server`:`Server error (HTTP ${o.status})`)}if(s.ok===!1)throw Error(s.error??`HTTP ${o.status}`);return s.data}function E(e,t){return o.get(`/api/system/services/${e}/${encodeURIComponent(t)}`)}function ne(e){let[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(null),a=(0,C.useRef)(!1),s=(0,C.useRef)(!0),c=(0,C.useCallback)(async()=>{if(!a.current){a.current=!0;try{let e=await o.get(`/api/system/services`);if(!s.current)return;n(e),i(null)}catch(e){s.current&&i(e instanceof Error?e.message:`Could not list services`)}finally{a.current=!1}}},[]);return(0,C.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,C.useEffect)(()=>{if(!e)return;c();let t=setInterval(()=>void c(),T);return()=>clearInterval(t)},[e,c]),{snapshot:t,error:r,loading:t===null&&r===null,refresh:c}}var D=[`all`,`running`,`failed`,`enabled`];function O(e,t){switch(t){case`running`:return e.running;case`failed`:return e.failed;case`enabled`:return e.enabled;default:return!0}}function k(e,t){let n=t.trim().toLowerCase();return n?e.unit.toLowerCase().includes(n)||e.description.toLowerCase().includes(n):!0}function A(e,t){let n=e=>e.failed?0:e.running?1:2,r=n(e)-n(t);return r===0?e.unit.localeCompare(t.unit):r}function j(e,t,n,r){return e.filter(e=>e.scope===t&&O(e,n)&&k(e,r)).sort(A)}function M(e,t){let n=t?e.filter(e=>e.scope===t):e;return{total:n.length,running:n.filter(e=>e.running).length,failed:n.filter(e=>e.failed).length}}function N(e){return e.failed?`failed`:e.running?`running`:e.activeState===`activating`||e.activeState===`deactivating`||e.activeState===`reloading`?`busy`:`idle`}function P(e){let t=`${e.activeState} (${e.subState})`;return e.unitFileState?`${t} · ${e.unitFileState}`:t}var F=[{key:`name`,label:`Name`,width:null,from:`base`,align:`left`},{key:`pid`,label:`PID`,width:56,from:`@3xl`,align:`right`},{key:`cpu`,label:`CPU`,width:56,from:`@2xl`,align:`right`},{key:`ram`,label:`Memory`,width:72,from:`@2xl`,align:`right`},{key:`swap`,label:`Swap`,width:72,from:`@3xl`,align:`right`},{key:`disk`,label:`Drive`,width:112,from:`@4xl`,align:`right`},{key:`gpu`,label:`GPU`,width:56,from:`@4xl`,align:`right`},{key:`gpuMem`,label:`GPU Memory`,width:80,from:`@4xl`,align:`right`}],I=[`base`,`@2xl`,`@3xl`,`@4xl`],L={base:``,"@2xl":`hidden @2xl:block`,"@3xl":`hidden @3xl:block`,"@4xl":`hidden @4xl:block`};function R(e){return L[e.from]}function re(e){let t=I.indexOf(e);return F.filter(e=>I.indexOf(e.from)<=t)}function z(e){return re(e).map(e=>e.width===null?`minmax(0,1fr)`:`${e.width}px`).join(` `)}var B=[`grid gap-2 grid-cols-[var(--svc-cols-base)]`,`@2xl:grid-cols-[var(--svc-cols-2xl)]`,`@3xl:grid-cols-[var(--svc-cols-3xl)]`,`@4xl:grid-cols-[var(--svc-cols-4xl)]`].join(` `);function V(){return{"--svc-cols-base":z(`base`),"--svc-cols-2xl":z(`@2xl`),"--svc-cols-3xl":z(`@3xl`),"--svc-cols-4xl":z(`@4xl`)}}var H=n(),U={failed:`bg-error`,running:`bg-success`,busy:`bg-warning animate-pulse`,idle:`bg-text-subtle/40`},W={start:`Start`,stop:`Stop`,restart:`Restart`,enable:`Enable at boot`,disable:`Disable at boot`},G=[`stop`,`disable`],K=Object.fromEntries(F.map(e=>[e.key,R(e)])),q=e=>e===void 0?`—`:b(e),J=(e,t)=>e===void 0?`—`:`${e.toFixed(t)}%`;function Y({column:e,children:t}){return(0,H.jsx)(`span`,{className:s(`text-right text-[11px] tabular-nums text-text-subtle truncate`,K[e]),children:t})}function ie({service:e,resources:t,onOpen:n,onAction:r}){let i=N(e),a=w.filter(t=>e.refused?.[t]===void 0),o=w.map(t=>e.refused?.[t]).find(Boolean);return(0,H.jsxs)(h,{children:[(0,H.jsx)(g,{asChild:!0,children:(0,H.jsx)(`div`,{className:`select-none`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e),"data-testid":`sysmon-service-row`,"data-unit":e.unit,"data-tone":i,"data-cpu":t?.cpu,"data-ram-mb":t?.ramMB,className:s(`w-full min-h-11 px-3 py-2 items-center text-left hover:bg-surface-hover transition-colors`,B),children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,H.jsx)(`span`,{className:s(`size-2 rounded-full shrink-0`,U[i]),"aria-hidden":!0}),(0,H.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(`span`,{className:`text-sm truncate`,children:e.unit}),e.enabled&&(0,H.jsx)(`span`,{className:`shrink-0 text-[10px] px-1 py-px rounded bg-surface-hover text-text-subtle`,children:`enabled`})]}),(0,H.jsx)(`span`,{className:`block text-[11px] text-text-subtle truncate`,children:e.description||P(e)})]})]}),(0,H.jsx)(Y,{column:`pid`,children:e.mainPid??`—`}),(0,H.jsx)(Y,{column:`cpu`,children:J(t?.cpu,1)}),(0,H.jsx)(Y,{column:`ram`,children:q(t?.ramMB)}),(0,H.jsx)(Y,{column:`swap`,children:q(t?.swapMB)}),(0,H.jsx)(Y,{column:`disk`,children:x(t?.diskReadBps,t?.diskWriteBps)}),(0,H.jsx)(Y,{column:`gpu`,children:J(t?.gpuPct,0)}),(0,H.jsx)(Y,{column:`gpuMem`,children:q(t?.gpuMemMB)})]})})}),(0,H.jsxs)(_,{children:[a.map(t=>(0,H.jsx)(v,{variant:G.includes(t)?`destructive`:void 0,onSelect:()=>r(e,t),children:W[t]},t)),a.length>0&&(0,H.jsx)(y,{}),(0,H.jsx)(v,{onSelect:()=>n(e),children:`Details and log`}),o&&(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-text-subtle max-w-64`,children:o})]})]})}function ae({sortKey:e,sortDir:t,onSort:n}){return(0,H.jsx)(`div`,{role:`row`,"data-testid":`sysmon-services-header`,className:s(`sticky top-0 z-10 px-3 bg-background border-b border-border text-[11px] text-text-subtle`,B),children:F.map(r=>(0,H.jsx)(S,{label:r.label,field:r.key,activeKey:e,activeDir:t,onClick:n,align:r.align,testId:`sysmon-services-sort-${r.key}`,className:s(`px-0`,R(r))},r.key))})}function oe(e,t){if(!(e===void 0&&t===void 0))return(e??0)+(t??0)}function X(e,t){let n=e.resources;switch(t){case`pid`:return e.service.mainPid??void 0;case`cpu`:return n?.cpu;case`ram`:return n?.ramMB;case`swap`:return n?.swapMB;case`disk`:return oe(n?.diskReadBps,n?.diskWriteBps);case`gpu`:return n?.gpuPct;case`gpuMem`:return n?.gpuMemMB}}function se(e,t,n){return t===null?[...e].sort((e,t)=>A(e.service,t.service)):t===`name`?[...e].sort((e,t)=>{let r=e.service.unit.localeCompare(t.service.unit);return n===`asc`?r:-r}):[...e].sort((e,r)=>{let i=X(e,t),a=X(r,t);return i===void 0&&a===void 0?e.service.unit.localeCompare(r.service.unit):i===void 0?1:a===void 0?-1:i===a?e.service.unit.localeCompare(r.service.unit):n===`asc`?i-a:a-i})}function Z(e,t){return t===void 0?e:(e??0)+t}function ce(e){let t=new Map;for(let n of e){if(!n.unitKey)continue;let e=t.get(n.unitKey)??{count:0,cpu:0,ramMB:0};e.count+=1,e.cpu+=n.cpu,e.ramMB+=n.ramMB,e.swapMB=Z(e.swapMB,n.swapMB),e.diskReadBps=Z(e.diskReadBps,n.diskReadBps),e.diskWriteBps=Z(e.diskWriteBps,n.diskWriteBps),e.gpuPct=Z(e.gpuPct,n.gpuPct),e.gpuMemMB=Z(e.gpuMemMB,n.gpuMemMB),t.set(n.unitKey,e)}for(let e of t.values())e.cpu=Math.round(e.cpu*10)/10,e.ramMB=Math.round(e.ramMB*10)/10,e.gpuPct!==void 0&&(e.gpuPct=Math.min(100,Math.round(e.gpuPct*10)/10));return t}function le(e){return`${e.scope}:${e.unit}`}var ue=Object.freeze({count:0,cpu:0,ramMB:0,swapMB:0,diskReadBps:0,diskWriteBps:0,gpuPct:0,gpuMemMB:0}),de=[`.service`,`.scope`];function Q(e,t){return t?t.get(le(e))||(e.subState===`running`&&de.some(t=>e.unit.endsWith(t))?void 0:ue):void 0}function fe({target:e,onClose:t}){let n=c(),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null);if((0,C.useEffect)(()=>{if(!e){i(null),o(null);return}let t=!0;return i(null),o(null),E(e.scope,e.unit).then(e=>{t&&i(e)}).catch(e=>{t&&o(e instanceof Error?e.message:`Could not read the unit`)}),()=>{t=!1}},[e]),!e)return null;let s=(0,H.jsxs)(`div`,{className:`space-y-3`,"data-testid":`sysmon-service-details`,"data-unit":e.unit,children:[(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:r?.description||e.description||P(e)}),(0,H.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-xs`,children:[(0,H.jsx)($,{label:`State`,value:P(r??e)}),(0,H.jsx)($,{label:`Main PID`,value:(r??e).mainPid??`—`}),(0,H.jsx)($,{label:`User`,value:r?.user??`—`}),(0,H.jsx)($,{label:`Group`,value:r?.group??`—`}),(0,H.jsx)($,{label:`Scope`,value:e.scope}),(0,H.jsx)($,{label:`Unit file`,value:r?.fragmentPath??`—`})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`h4`,{className:`text-xs font-medium text-text-secondary`,children:`Log (this boot)`}),(0,H.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-hover/40 max-h-64 overflow-y-auto p-2`,children:[a&&(0,H.jsx)(`p`,{className:`text-xs text-error`,children:a}),!a&&r===null&&(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Reading the journal…`}),r?.logs.length===0&&(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`No entries this boot.`}),r?.logs.map((e,t)=>(0,H.jsxs)(`p`,{className:`text-[11px] font-mono whitespace-pre-wrap break-words`,children:[(0,H.jsxs)(`span`,{className:`text-text-subtle`,children:[new Date(e.ts).toLocaleTimeString(),` `]}),e.message]},`${e.ts}-${t}`))]})]})]});return n?(0,H.jsx)(m,{open:!0,onClose:t,children:(0,H.jsxs)(`div`,{className:`px-4 pb-4 space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold break-all`,children:e.unit}),s]})}):(0,H.jsx)(p,{open:!0,onOpenChange:e=>!e&&t(),children:(0,H.jsxs)(d,{className:`sm:max-w-2xl`,children:[(0,H.jsx)(u,{children:(0,H.jsx)(f,{className:`break-all`,children:e.unit})}),s]})})}function $({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`dt`,{className:`text-text-subtle`,children:e}),(0,H.jsx)(`dd`,{className:`truncate`,title:String(t),children:t})]})}var pe=[`stop`,`restart`,`disable`];function me(e){return pe.includes(e)}var he={stop:{title:`Stop service`,body:e=>`Stop ${e}? Anything depending on it stops too.`,cta:`Stop`},restart:{title:`Restart service`,body:e=>`Restart ${e}? It will be briefly unavailable.`,cta:`Restart`},disable:{title:`Disable at boot`,body:e=>`${e} will no longer start at boot. It keeps running now.`,cta:`Disable`}};function ge({pending:e,onConfirm:t,onCancel:n}){let r=c();if(!e)return null;let i=he[e.action];if(!i)return null;let a=(0,H.jsxs)(`div`,{className:`space-y-4`,"data-testid":`sysmon-service-confirm`,"data-action":e.action,children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:i.body(e.service.unit)}),(0,H.jsxs)(`p`,{className:`text-xs text-text-subtle`,children:[e.service.scope===`system`?`System service`:`User service`,e.service.mainPid!==null&&` · pid ${e.service.mainPid}`]}),(0,H.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,H.jsx)(l,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,H.jsx)(l,{variant:`destructive`,autoFocus:!1,onClick:()=>t(e),"data-testid":`sysmon-service-confirm-ok`,className:`min-h-11`,children:i.cta})]})]});return r?(0,H.jsx)(m,{open:!0,onClose:n,children:(0,H.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:i.title}),a]})}):(0,H.jsx)(p,{open:!0,onOpenChange:e=>!e&&n(),children:(0,H.jsxs)(d,{children:[(0,H.jsx)(u,{children:(0,H.jsx)(f,{children:i.title})}),a]})})}var _e=[`system`,`user`],ve={system:`System`,user:`User`},ye={all:`All`,running:`Running`,failed:`Failed`,enabled:`Enabled`};function be({active:e,metrics:t}){let{snapshot:n,error:a,loading:o,refresh:c}=ne(e),[l,u]=(0,C.useState)(`system`),[d,f]=(0,C.useState)(`all`),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(`desc`),[y,b]=(0,C.useState)(null),[x,S]=(0,C.useState)(null),w=n?.services??[],T=(0,C.useMemo)(()=>j(w,l,d,p),[w,l,d,p]),E=(0,C.useMemo)(()=>M(w,l),[w,l]),O=(0,C.useMemo)(()=>t?.processes.length?ce(t.processes):null,[t]),k=(0,C.useMemo)(()=>se(T.map(e=>({service:e,resources:Q(e,O)})),h,_),[T,O,h,_]),A=(0,C.useCallback)(e=>{let[t,n]=ee(h,_,e);g(t),v(n)},[h,_]),N=(0,C.useCallback)(async({service:e,action:t})=>{S(null);try{await te(e.scope,e.unit,t),i.success(`${e.unit}: ${t} done`),await c()}catch(n){i.error(n instanceof Error?n.message:`Could not ${t} ${e.unit}`)}},[c]),P=(0,C.useCallback)((e,t)=>{me(t)?S({service:e,action:t}):N({service:e,action:t})},[N]);return n&&!n.supported?(0,H.jsxs)(`div`,{className:`p-4 text-sm text-text-subtle`,"data-testid":`sysmon-services`,children:[`This host has no service manager PPM can read.`,n.warnings.map((e,t)=>(0,H.jsx)(`p`,{className:`mt-1 text-xs`,children:e},t))]}):(0,H.jsxs)(`div`,{className:`h-full flex flex-col min-h-0 @container`,style:V(),"data-testid":`sysmon-services`,"data-row-count":k.length,"data-sort-key":h??`default`,"data-sort-dir":_,children:[(0,H.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[(0,H.jsx)(`div`,{className:`flex items-center`,role:`tablist`,children:_e.map(e=>(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===e,onClick:()=>u(e),"data-testid":`sysmon-services-scope-${e}`,className:s(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,l===e?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:ve[e]},e))}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-2`,children:[(0,H.jsxs)(`div`,{className:`relative flex-1 min-w-[140px]`,children:[(0,H.jsx)(r,{className:`absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-text-subtle`}),(0,H.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:`Search services`,"aria-label":`Search services`,"data-testid":`sysmon-service-search`,className:`w-full min-h-11 md:min-h-8 pl-7 pr-2 text-sm rounded-md border border-border bg-transparent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})]}),D.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-pressed":d===e,"data-testid":`sysmon-service-filter-${e}`,className:s(`min-h-11 md:min-h-8 px-3 text-xs rounded-md border transition-colors`,d===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-surface-hover`),children:ye[e]},e))]}),(0,H.jsxs)(`p`,{className:`px-3 pb-2 text-[11px] text-text-subtle`,children:[E.total,` units · `,E.running,` running`,E.failed>0&&(0,H.jsxs)(`span`,{className:`text-error`,children:[` · `,E.failed,` failed`]})]})]}),n&&n.warnings.length>0&&(0,H.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0`,children:n.warnings.map((e,t)=>(0,H.jsx)(`div`,{children:e},t))}),(0,H.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:[(0,H.jsx)(ae,{sortKey:h,sortDir:_,onSort:A}),(0,H.jsxs)(`div`,{className:`divide-y divide-border`,children:[o&&(0,H.jsx)(`p`,{className:`p-4 text-sm text-text-subtle`,children:`Listing units…`}),a&&(0,H.jsx)(`p`,{className:`p-4 text-sm text-error`,children:a}),!o&&!a&&k.length===0&&(0,H.jsx)(`p`,{className:`p-4 text-sm text-text-subtle`,children:`No units match.`}),k.map(({service:e,resources:t})=>(0,H.jsx)(ie,{service:e,resources:t,onOpen:b,onAction:P},`${e.scope}:${e.unit}`))]})]}),(0,H.jsx)(fe,{target:y,onClose:()=>b(null)}),(0,H.jsx)(ge,{pending:x,onConfirm:e=>void N(e),onCancel:()=>S(null)})]})}export{be as ServicesPanel};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import{ur as r}from"./icons-CO_II6D-.js";import{O as i,a,r as o}from"./api-client-F5Zi1sR0.js";import{n as s}from"./utils-btZ8C8-R.js";import"./portal-container-context-NFSuymMu.js";import"./context-menu-CH1mvCwA.js";import{n as c}from"./use-is-mobile-CkO33jqU.js";import{t as l}from"./button-CsmGH5xa.js";import{a as u,n as d,o as f,t as p}from"./dialog-z8PLkL8n.js";import{t as m}from"./mobile-bottom-sheet-CLic9ovp.js";import"./use-visual-viewport-C307OVeV.js";import{an as h,mn as g,on as _,sn as v,un as y}from"./index-D41mthBS.js";import{r as b}from"./format-bytes-DZ8bW_uF.js";import{r as x}from"./process-row-format-Dbs_tAZ2.js";import{r as ee,t as S}from"./sortable-header-IH47XuRI.js";var C=e(t(),1),w=[`start`,`stop`,`restart`,`enable`,`disable`],T=3e3;async function te(e,t,n){let r=a(),i={"Content-Type":`application/json`,"X-PPM-Request":`1`};r&&(i.Authorization=`Bearer ${r}`);let o=await fetch(`/api/system/services/${e}/${encodeURIComponent(t)}/${n}`,{method:`POST`,headers:i,body:`{}`}),s;try{s=await o.json()}catch{throw Error(o.ok?`Empty response from server`:`Server error (HTTP ${o.status})`)}if(s.ok===!1)throw Error(s.error??`HTTP ${o.status}`);return s.data}function E(e,t){return o.get(`/api/system/services/${e}/${encodeURIComponent(t)}`)}function ne(e){let[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(null),a=(0,C.useRef)(!1),s=(0,C.useRef)(!0),c=(0,C.useCallback)(async()=>{if(!a.current){a.current=!0;try{let e=await o.get(`/api/system/services`);if(!s.current)return;n(e),i(null)}catch(e){s.current&&i(e instanceof Error?e.message:`Could not list services`)}finally{a.current=!1}}},[]);return(0,C.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,C.useEffect)(()=>{if(!e)return;c();let t=setInterval(()=>void c(),T);return()=>clearInterval(t)},[e,c]),{snapshot:t,error:r,loading:t===null&&r===null,refresh:c}}var D=[`all`,`running`,`failed`,`enabled`];function O(e,t){switch(t){case`running`:return e.running;case`failed`:return e.failed;case`enabled`:return e.enabled;default:return!0}}function k(e,t){let n=t.trim().toLowerCase();return n?e.unit.toLowerCase().includes(n)||e.description.toLowerCase().includes(n):!0}function A(e,t){let n=e=>e.failed?0:e.running?1:2,r=n(e)-n(t);return r===0?e.unit.localeCompare(t.unit):r}function j(e,t,n,r){return e.filter(e=>e.scope===t&&O(e,n)&&k(e,r)).sort(A)}function M(e,t){let n=t?e.filter(e=>e.scope===t):e;return{total:n.length,running:n.filter(e=>e.running).length,failed:n.filter(e=>e.failed).length}}function N(e){return e.failed?`failed`:e.running?`running`:e.activeState===`activating`||e.activeState===`deactivating`||e.activeState===`reloading`?`busy`:`idle`}function P(e){let t=`${e.activeState} (${e.subState})`;return e.unitFileState?`${t} · ${e.unitFileState}`:t}var F=[{key:`name`,label:`Name`,width:null,from:`base`,align:`left`},{key:`pid`,label:`PID`,width:56,from:`@3xl`,align:`right`},{key:`cpu`,label:`CPU`,width:56,from:`@2xl`,align:`right`},{key:`ram`,label:`Memory`,width:72,from:`@2xl`,align:`right`},{key:`swap`,label:`Swap`,width:72,from:`@3xl`,align:`right`},{key:`disk`,label:`Drive`,width:112,from:`@4xl`,align:`right`},{key:`gpu`,label:`GPU`,width:56,from:`@4xl`,align:`right`},{key:`gpuMem`,label:`GPU Memory`,width:80,from:`@4xl`,align:`right`}],I=[`base`,`@2xl`,`@3xl`,`@4xl`],L={base:``,"@2xl":`hidden @2xl:block`,"@3xl":`hidden @3xl:block`,"@4xl":`hidden @4xl:block`};function R(e){return L[e.from]}function re(e){let t=I.indexOf(e);return F.filter(e=>I.indexOf(e.from)<=t)}function z(e){return re(e).map(e=>e.width===null?`minmax(0,1fr)`:`${e.width}px`).join(` `)}var B=[`grid gap-2 grid-cols-[var(--svc-cols-base)]`,`@2xl:grid-cols-[var(--svc-cols-2xl)]`,`@3xl:grid-cols-[var(--svc-cols-3xl)]`,`@4xl:grid-cols-[var(--svc-cols-4xl)]`].join(` `);function V(){return{"--svc-cols-base":z(`base`),"--svc-cols-2xl":z(`@2xl`),"--svc-cols-3xl":z(`@3xl`),"--svc-cols-4xl":z(`@4xl`)}}var H=n(),U={failed:`bg-error`,running:`bg-success`,busy:`bg-warning animate-pulse`,idle:`bg-text-subtle/40`},W={start:`Start`,stop:`Stop`,restart:`Restart`,enable:`Enable at boot`,disable:`Disable at boot`},G=[`stop`,`disable`],K=Object.fromEntries(F.map(e=>[e.key,R(e)])),q=e=>e===void 0?`—`:b(e),J=(e,t)=>e===void 0?`—`:`${e.toFixed(t)}%`;function Y({column:e,children:t}){return(0,H.jsx)(`span`,{className:s(`text-right text-[11px] tabular-nums text-text-subtle truncate`,K[e]),children:t})}function ie({service:e,resources:t,onOpen:n,onAction:r}){let i=N(e),a=w.filter(t=>e.refused?.[t]===void 0),o=w.map(t=>e.refused?.[t]).find(Boolean);return(0,H.jsxs)(h,{children:[(0,H.jsx)(g,{asChild:!0,children:(0,H.jsx)(`div`,{className:`select-none`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e),"data-testid":`sysmon-service-row`,"data-unit":e.unit,"data-tone":i,"data-cpu":t?.cpu,"data-ram-mb":t?.ramMB,className:s(`w-full min-h-11 px-3 py-2 items-center text-left hover:bg-surface-hover transition-colors`,B),children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 min-w-0`,children:[(0,H.jsx)(`span`,{className:s(`size-2 rounded-full shrink-0`,U[i]),"aria-hidden":!0}),(0,H.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(`span`,{className:`text-sm truncate`,children:e.unit}),e.enabled&&(0,H.jsx)(`span`,{className:`shrink-0 text-[10px] px-1 py-px rounded bg-surface-hover text-text-subtle`,children:`enabled`})]}),(0,H.jsx)(`span`,{className:`block text-[11px] text-text-subtle truncate`,children:e.description||P(e)})]})]}),(0,H.jsx)(Y,{column:`pid`,children:e.mainPid??`—`}),(0,H.jsx)(Y,{column:`cpu`,children:J(t?.cpu,1)}),(0,H.jsx)(Y,{column:`ram`,children:q(t?.ramMB)}),(0,H.jsx)(Y,{column:`swap`,children:q(t?.swapMB)}),(0,H.jsx)(Y,{column:`disk`,children:x(t?.diskReadBps,t?.diskWriteBps)}),(0,H.jsx)(Y,{column:`gpu`,children:J(t?.gpuPct,0)}),(0,H.jsx)(Y,{column:`gpuMem`,children:q(t?.gpuMemMB)})]})})}),(0,H.jsxs)(_,{children:[a.map(t=>(0,H.jsx)(v,{variant:G.includes(t)?`destructive`:void 0,onSelect:()=>r(e,t),children:W[t]},t)),a.length>0&&(0,H.jsx)(y,{}),(0,H.jsx)(v,{onSelect:()=>n(e),children:`Details and log`}),o&&(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-text-subtle max-w-64`,children:o})]})]})}function ae({sortKey:e,sortDir:t,onSort:n}){return(0,H.jsx)(`div`,{role:`row`,"data-testid":`sysmon-services-header`,className:s(`sticky top-0 z-10 px-3 bg-background border-b border-border text-[11px] text-text-subtle`,B),children:F.map(r=>(0,H.jsx)(S,{label:r.label,field:r.key,activeKey:e,activeDir:t,onClick:n,align:r.align,testId:`sysmon-services-sort-${r.key}`,className:s(`px-0`,R(r))},r.key))})}function oe(e,t){if(!(e===void 0&&t===void 0))return(e??0)+(t??0)}function X(e,t){let n=e.resources;switch(t){case`pid`:return e.service.mainPid??void 0;case`cpu`:return n?.cpu;case`ram`:return n?.ramMB;case`swap`:return n?.swapMB;case`disk`:return oe(n?.diskReadBps,n?.diskWriteBps);case`gpu`:return n?.gpuPct;case`gpuMem`:return n?.gpuMemMB}}function se(e,t,n){return t===null?[...e].sort((e,t)=>A(e.service,t.service)):t===`name`?[...e].sort((e,t)=>{let r=e.service.unit.localeCompare(t.service.unit);return n===`asc`?r:-r}):[...e].sort((e,r)=>{let i=X(e,t),a=X(r,t);return i===void 0&&a===void 0?e.service.unit.localeCompare(r.service.unit):i===void 0?1:a===void 0?-1:i===a?e.service.unit.localeCompare(r.service.unit):n===`asc`?i-a:a-i})}function Z(e,t){return t===void 0?e:(e??0)+t}function ce(e){let t=new Map;for(let n of e){if(!n.unitKey)continue;let e=t.get(n.unitKey)??{count:0,cpu:0,ramMB:0};e.count+=1,e.cpu+=n.cpu,e.ramMB+=n.ramMB,e.swapMB=Z(e.swapMB,n.swapMB),e.diskReadBps=Z(e.diskReadBps,n.diskReadBps),e.diskWriteBps=Z(e.diskWriteBps,n.diskWriteBps),e.gpuPct=Z(e.gpuPct,n.gpuPct),e.gpuMemMB=Z(e.gpuMemMB,n.gpuMemMB),t.set(n.unitKey,e)}for(let e of t.values())e.cpu=Math.round(e.cpu*10)/10,e.ramMB=Math.round(e.ramMB*10)/10,e.gpuPct!==void 0&&(e.gpuPct=Math.min(100,Math.round(e.gpuPct*10)/10));return t}function le(e){return`${e.scope}:${e.unit}`}var ue=Object.freeze({count:0,cpu:0,ramMB:0,swapMB:0,diskReadBps:0,diskWriteBps:0,gpuPct:0,gpuMemMB:0}),de=[`.service`,`.scope`];function Q(e,t){return t?t.get(le(e))||(e.subState===`running`&&de.some(t=>e.unit.endsWith(t))?void 0:ue):void 0}function fe({target:e,onClose:t}){let n=c(),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null);if((0,C.useEffect)(()=>{if(!e){i(null),o(null);return}let t=!0;return i(null),o(null),E(e.scope,e.unit).then(e=>{t&&i(e)}).catch(e=>{t&&o(e instanceof Error?e.message:`Could not read the unit`)}),()=>{t=!1}},[e]),!e)return null;let s=(0,H.jsxs)(`div`,{className:`space-y-3`,"data-testid":`sysmon-service-details`,"data-unit":e.unit,children:[(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:r?.description||e.description||P(e)}),(0,H.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-xs`,children:[(0,H.jsx)($,{label:`State`,value:P(r??e)}),(0,H.jsx)($,{label:`Main PID`,value:(r??e).mainPid??`—`}),(0,H.jsx)($,{label:`User`,value:r?.user??`—`}),(0,H.jsx)($,{label:`Group`,value:r?.group??`—`}),(0,H.jsx)($,{label:`Scope`,value:e.scope}),(0,H.jsx)($,{label:`Unit file`,value:r?.fragmentPath??`—`})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`h4`,{className:`text-xs font-medium text-text-secondary`,children:`Log (this boot)`}),(0,H.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-hover/40 max-h-64 overflow-y-auto p-2`,children:[a&&(0,H.jsx)(`p`,{className:`text-xs text-error`,children:a}),!a&&r===null&&(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Reading the journal…`}),r?.logs.length===0&&(0,H.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`No entries this boot.`}),r?.logs.map((e,t)=>(0,H.jsxs)(`p`,{className:`text-[11px] font-mono whitespace-pre-wrap break-words`,children:[(0,H.jsxs)(`span`,{className:`text-text-subtle`,children:[new Date(e.ts).toLocaleTimeString(),` `]}),e.message]},`${e.ts}-${t}`))]})]})]});return n?(0,H.jsx)(m,{open:!0,onClose:t,children:(0,H.jsxs)(`div`,{className:`px-4 pb-4 space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold break-all`,children:e.unit}),s]})}):(0,H.jsx)(p,{open:!0,onOpenChange:e=>!e&&t(),children:(0,H.jsxs)(d,{className:`sm:max-w-2xl`,children:[(0,H.jsx)(u,{children:(0,H.jsx)(f,{className:`break-all`,children:e.unit})}),s]})})}function $({label:e,value:t}){return(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`dt`,{className:`text-text-subtle`,children:e}),(0,H.jsx)(`dd`,{className:`truncate`,title:String(t),children:t})]})}var pe=[`stop`,`restart`,`disable`];function me(e){return pe.includes(e)}var he={stop:{title:`Stop service`,body:e=>`Stop ${e}? Anything depending on it stops too.`,cta:`Stop`},restart:{title:`Restart service`,body:e=>`Restart ${e}? It will be briefly unavailable.`,cta:`Restart`},disable:{title:`Disable at boot`,body:e=>`${e} will no longer start at boot. It keeps running now.`,cta:`Disable`}};function ge({pending:e,onConfirm:t,onCancel:n}){let r=c();if(!e)return null;let i=he[e.action];if(!i)return null;let a=(0,H.jsxs)(`div`,{className:`space-y-4`,"data-testid":`sysmon-service-confirm`,"data-action":e.action,children:[(0,H.jsx)(`p`,{className:`text-sm break-words`,children:i.body(e.service.unit)}),(0,H.jsxs)(`p`,{className:`text-xs text-text-subtle`,children:[e.service.scope===`system`?`System service`:`User service`,e.service.mainPid!==null&&` · pid ${e.service.mainPid}`]}),(0,H.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,H.jsx)(l,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,H.jsx)(l,{variant:`destructive`,autoFocus:!1,onClick:()=>t(e),"data-testid":`sysmon-service-confirm-ok`,className:`min-h-11`,children:i.cta})]})]});return r?(0,H.jsx)(m,{open:!0,onClose:n,children:(0,H.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:i.title}),a]})}):(0,H.jsx)(p,{open:!0,onOpenChange:e=>!e&&n(),children:(0,H.jsxs)(d,{children:[(0,H.jsx)(u,{children:(0,H.jsx)(f,{children:i.title})}),a]})})}var _e=[`system`,`user`],ve={system:`System`,user:`User`},ye={all:`All`,running:`Running`,failed:`Failed`,enabled:`Enabled`};function be({active:e,metrics:t}){let{snapshot:n,error:a,loading:o,refresh:c}=ne(e),[l,u]=(0,C.useState)(`system`),[d,f]=(0,C.useState)(`all`),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(null),[_,v]=(0,C.useState)(`desc`),[y,b]=(0,C.useState)(null),[x,S]=(0,C.useState)(null),w=n?.services??[],T=(0,C.useMemo)(()=>j(w,l,d,p),[w,l,d,p]),E=(0,C.useMemo)(()=>M(w,l),[w,l]),O=(0,C.useMemo)(()=>t?.processes.length?ce(t.processes):null,[t]),k=(0,C.useMemo)(()=>se(T.map(e=>({service:e,resources:Q(e,O)})),h,_),[T,O,h,_]),A=(0,C.useCallback)(e=>{let[t,n]=ee(h,_,e);g(t),v(n)},[h,_]),N=(0,C.useCallback)(async({service:e,action:t})=>{S(null);try{await te(e.scope,e.unit,t),i.success(`${e.unit}: ${t} done`),await c()}catch(n){i.error(n instanceof Error?n.message:`Could not ${t} ${e.unit}`)}},[c]),P=(0,C.useCallback)((e,t)=>{me(t)?S({service:e,action:t}):N({service:e,action:t})},[N]);return n&&!n.supported?(0,H.jsxs)(`div`,{className:`p-4 text-sm text-text-subtle`,"data-testid":`sysmon-services`,children:[`This host has no service manager PPM can read.`,n.warnings.map((e,t)=>(0,H.jsx)(`p`,{className:`mt-1 text-xs`,children:e},t))]}):(0,H.jsxs)(`div`,{className:`h-full flex flex-col min-h-0 @container`,style:V(),"data-testid":`sysmon-services`,"data-row-count":k.length,"data-sort-key":h??`default`,"data-sort-dir":_,children:[(0,H.jsxs)(`div`,{className:`shrink-0 border-b border-border`,children:[(0,H.jsx)(`div`,{className:`flex items-center`,role:`tablist`,children:_e.map(e=>(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===e,onClick:()=>u(e),"data-testid":`sysmon-services-scope-${e}`,className:s(`flex-1 md:flex-none min-h-11 px-4 text-sm font-medium transition-colors`,l===e?`text-text-primary border-b-2 border-primary -mb-px`:`text-text-subtle hover:text-text-secondary`),children:ve[e]},e))}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-2`,children:[(0,H.jsxs)(`div`,{className:`relative flex-1 min-w-[140px]`,children:[(0,H.jsx)(r,{className:`absolute left-2 top-1/2 -translate-y-1/2 size-3.5 text-text-subtle`}),(0,H.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:`Search services`,"aria-label":`Search services`,"data-testid":`sysmon-service-search`,className:`w-full min-h-11 md:min-h-8 pl-7 pr-2 text-sm rounded-md border border-border bg-transparent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`})]}),D.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-pressed":d===e,"data-testid":`sysmon-service-filter-${e}`,className:s(`min-h-11 md:min-h-8 px-3 text-xs rounded-md border transition-colors`,d===e?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-surface-hover`),children:ye[e]},e))]}),(0,H.jsxs)(`p`,{className:`px-3 pb-2 text-[11px] text-text-subtle`,children:[E.total,` units · `,E.running,` running`,E.failed>0&&(0,H.jsxs)(`span`,{className:`text-error`,children:[` · `,E.failed,` failed`]})]})]}),n&&n.warnings.length>0&&(0,H.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-warning bg-warning/10 border-b border-border shrink-0`,children:n.warnings.map((e,t)=>(0,H.jsx)(`div`,{children:e},t))}),(0,H.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:[(0,H.jsx)(ae,{sortKey:h,sortDir:_,onSort:A}),(0,H.jsxs)(`div`,{className:`divide-y divide-border`,children:[o&&(0,H.jsx)(`p`,{className:`p-4 text-sm text-text-subtle`,children:`Listing units…`}),a&&(0,H.jsx)(`p`,{className:`p-4 text-sm text-error`,children:a}),!o&&!a&&k.length===0&&(0,H.jsx)(`p`,{className:`p-4 text-sm text-text-subtle`,children:`No units match.`}),k.map(({service:e,resources:t})=>(0,H.jsx)(ie,{service:e,resources:t,onOpen:b,onAction:P},`${e.scope}:${e.unit}`))]})]}),(0,H.jsx)(fe,{target:y,onClose:()=>b(null)}),(0,H.jsx)(ge,{pending:x,onConfirm:e=>void N(e),onCancel:()=>S(null)})]})}export{be as ServicesPanel};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-
|
|
2
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{At as r,Ft as i,Ln as a,Qr as o,Qt as s,S as c,Zt as l,_ as u,j as d,l as f,ot as p,pr as m,tr as h,un as g,v as _,x as v,xn as y,y as b}from"./icons-CO_II6D-.js";import{t as x}from"./preload-helper-BEFjQwLd.js";import{n as S}from"./utils-btZ8C8-R.js";import{t as C}from"./button-CsmGH5xa.js";import{t as w}from"./scroll-area-Dp-P38kg.js";import{t as T}from"./separator-B0xYRplF.js";var E=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],D=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:m},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:a},{id:`language-servers`,group:`core`,label:`Language Servers`,subtitle:`Completions and go to definition, per language`,icon:o},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:_},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:l},{id:`voice`,group:`ai`,label:`Voice Input`,subtitle:`Speech to text for the chat box`,icon:y},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:b},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:u},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:v},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:h},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:i},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:c},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:s},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:r},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:p}];function O(e){return typeof e==`string`&&D.some(t=>t.id===e)}function k(e){return D.find(t=>t.id===e)}function A(e){return D.filter(t=>t.group===e)}var j=n();function M({active:e,onSelect:t}){return(0,j.jsx)(w,{className:`h-full`,children:(0,j.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:E.map(n=>{let r=A(n.id);return r.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,j.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,j.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:S(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,j.jsx)(r,{className:S(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,j.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function N({onSelect:e}){return(0,j.jsx)(w,{className:`h-full`,children:(0,j.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:E.map(t=>{let n=A(t.id);return n.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,j.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,j.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,j.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,j.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,j.jsx)(d,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var P=e(t(),1),F={general:(0,P.lazy)(()=>x(()=>import(`./general-settings-section-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/general-settings-section-Dm0NPoo2.js","assets/rolldown-runtime-C5c2KzVm.js","assets/index-D41mthBS.js","assets/preload-helper-BEFjQwLd.js","assets/vendor-ui-P9Ym7hCv.js","assets/vendor-markdown-QKPNiWEd.js","assets/button-CsmGH5xa.js","assets/utils-btZ8C8-R.js","assets/createLucideIcon-DBXq3G0e.js","assets/api-client-F5Zi1sR0.js","assets/react-CzUPVyyG.js","assets/panel-store-DrSH3Nhp.js","assets/window-store-B4cbZ5rr.js","assets/project-store-CCimwgGF.js","assets/settings-store-3jIBB8gx.js","assets/file-store-DCU7_YyB.js","assets/window-pip-registry-dxrBFfkP.js","assets/onboarding-quick-orientation-WLKI95GY.js","assets/dialog-z8PLkL8n.js","assets/portal-container-context-NFSuymMu.js","assets/icons-CO_II6D-.js","assets/use-is-mobile-CkO33jqU.js","assets/format-file-meta-B0ZpqzSM.js","assets/fs-api-vF_bQoeL.js","assets/context-menu-CH1mvCwA.js","assets/input-CP31LZnN.js","assets/mobile-bottom-sheet-CLic9ovp.js","assets/use-visual-viewport-C307OVeV.js","assets/scroll-area-Dp-P38kg.js","assets/chat-preparation-cache-DoS7sdal.js","assets/file-icons-Ed_yLyef.js","assets/format-date-Fd9tpNaw.js","assets/git-repo-store-CdoOpvmf.js","assets/ws-auth-J3hw0Mhc.js","assets/tab-store-CUPgQIQz.js","assets/apply-theme-aVoqSG0I.js","assets/resolve-theme-B87m6l4i.js","assets/index-BmsPSBtF.css","assets/onboarding-entry-DD3QSDiz.js","assets/separator-B0xYRplF.js","assets/appearance-settings-section-BCJK8_N6.js","assets/language-servers-section-DQH0qqem.js","assets/ai-settings-section-CF39jnOD.js","assets/ai-settings-section-Bmy9p9l-.js","assets/api-settings-BeINN5Dy.js","assets/accounts-settings-section-hxemqOZw.js","assets/codex-reset-credit-button-Xt1ttURe.js","assets/voice-settings-section-B7zMHsuz.js","assets/ppmbot-settings-section-BtKmsfqX.js","assets/notifications-settings-section-QeNYQwV1.js","assets/jira-watcher-section-C1vWzVZJ.js","assets/extension-manager-section-CsudP-cF.js","assets/proxy-settings-section-BAFgwYyD.js","assets/schedules-settings-section-BrsGPl6j.js","assets/keyboard-shortcuts-section-CDYzFVbt.js","assets/files-settings-section-C998uv6a.js","assets/query-audit-section-BybgiPsc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{At as r,Ft as i,Ln as a,Qr as o,Qt as s,S as c,Zt as l,_ as u,j as d,l as f,ot as p,pr as m,tr as h,un as g,v as _,x as v,xn as y,y as b}from"./icons-CO_II6D-.js";import{t as x}from"./preload-helper-BEFjQwLd.js";import{n as S}from"./utils-btZ8C8-R.js";import{t as C}from"./button-CsmGH5xa.js";import{t as w}from"./scroll-area-Dp-P38kg.js";import{t as T}from"./separator-B0xYRplF.js";var E=[{id:`core`,label:null},{id:`ai`,label:`AI & Accounts`},{id:`integrations`,label:`Integrations`},{id:`advanced`,label:`Advanced`}],D=[{id:`general`,group:`core`,label:`General`,subtitle:`Device name, password, version`,icon:m},{id:`appearance`,group:`core`,label:`Appearance`,subtitle:`Theme, tabs, explorer skin`,icon:a},{id:`language-servers`,group:`core`,label:`Language Servers`,subtitle:`Completions and go to definition, per language`,icon:o},{id:`ai-provider`,group:`ai`,label:`AI Provider`,subtitle:`Model, execution mode, limits`,icon:_},{id:`accounts`,group:`ai`,label:`Accounts`,subtitle:`Claude and Codex sign-ins, rotation`,icon:l},{id:`voice`,group:`ai`,label:`Voice Input`,subtitle:`Speech to text for the chat box`,icon:y},{id:`ppmbot`,group:`integrations`,label:`PPMBot`,subtitle:`Telegram AI bot`,icon:b},{id:`notifications`,group:`integrations`,label:`Notifications`,subtitle:`Push & Telegram alerts`,icon:u},{id:`jira`,group:`integrations`,label:`Jira Watcher`,subtitle:`Auto-debug Jira tickets`,icon:v},{id:`extensions`,group:`integrations`,label:`Extensions`,subtitle:`Install and manage extensions`,icon:h},{id:`proxy`,group:`integrations`,label:`API Proxy`,subtitle:`Expose accounts as Anthropic API`,icon:i},{id:`schedules`,group:`advanced`,label:`Scheduled Agents`,subtitle:`Run Claude on a cron schedule`,icon:c},{id:`shortcuts`,group:`advanced`,label:`Keyboard Shortcuts`,subtitle:`Customize key bindings`,icon:s},{id:`files`,group:`advanced`,label:`File Filters`,subtitle:`Exclude patterns, ignore files`,icon:r},{id:`query-audit`,group:`advanced`,label:`Query Audit Log`,subtitle:`SQL history retention and size`,icon:p}];function O(e){return typeof e==`string`&&D.some(t=>t.id===e)}function k(e){return D.find(t=>t.id===e)}function A(e){return D.filter(t=>t.group===e)}var j=n();function M({active:e,onSelect:t}){return(0,j.jsx)(w,{className:`h-full`,children:(0,j.jsx)(`nav`,{className:`p-2 space-y-4`,"aria-label":`Settings categories`,children:E.map(n=>{let r=A(n.id);return r.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[n.label&&(0,j.jsx)(`h3`,{className:`px-2 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:n.label}),r.map(n=>{let r=n.icon,i=n.id===e;return(0,j.jsxs)(`button`,{onClick:()=>t(n.id),"data-testid":`settings-rail-${n.id}`,"aria-current":i?`page`:void 0,className:S(`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-md text-left cursor-pointer transition-colors`,i?`bg-accent text-accent-foreground`:`hover:bg-accent/50 active:bg-accent`),children:[(0,j.jsx)(r,{className:S(`size-4 shrink-0`,i?`text-foreground`:`text-muted-foreground`)}),(0,j.jsx)(`span`,{className:`text-sm truncate`,children:n.label})]},n.id)})]},n.id)})})})}function N({onSelect:e}){return(0,j.jsx)(w,{className:`h-full`,children:(0,j.jsx)(`nav`,{className:`p-3 space-y-5`,"aria-label":`Settings categories`,children:E.map(t=>{let n=A(t.id);return n.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[t.label&&(0,j.jsx)(`h3`,{className:`px-1 pb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:t.label}),n.map(t=>{let n=t.icon;return(0,j.jsxs)(`button`,{onClick:()=>e(t.id),"data-testid":`settings-index-${t.id}`,className:`w-full flex items-center gap-3 px-2.5 py-3 rounded-lg text-left cursor-pointer group hover:bg-accent/50 active:bg-accent transition-colors`,children:[(0,j.jsx)(`div`,{className:`size-10 rounded-md bg-muted flex items-center justify-center shrink-0 group-hover:bg-accent`,children:(0,j.jsx)(n,{className:`size-4 text-muted-foreground`})}),(0,j.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.subtitle})]}),(0,j.jsx)(d,{className:`size-4 text-muted-foreground shrink-0`})]},t.id)})]},t.id)})})})}var P=e(t(),1),F={general:(0,P.lazy)(()=>x(()=>import(`./general-settings-section-Dm0NPoo2.js`).then(e=>({default:e.GeneralSettingsSection})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39]))),appearance:(0,P.lazy)(()=>x(()=>import(`./appearance-settings-section-BCJK8_N6.js`).then(e=>({default:e.AppearanceSettingsSection})),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39]))),"language-servers":(0,P.lazy)(()=>x(()=>import(`./language-servers-section-DQH0qqem.js`).then(e=>({default:e.LanguageServersSection})),__vite__mapDeps([41,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39]))),"ai-provider":(0,P.lazy)(()=>x(()=>import(`./ai-settings-section-CF39jnOD.js`).then(e=>({default:e.AISettingsSection})),__vite__mapDeps([42,4,1,5,6,7,9,11,10,12,13,14,3,43,2,8,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,44]))),accounts:(0,P.lazy)(()=>x(()=>import(`./accounts-settings-section-hxemqOZw.js`).then(e=>({default:e.AccountsSettingsSection})),__vite__mapDeps([45,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,46,44]))),voice:(0,P.lazy)(()=>x(()=>import(`./voice-settings-section-B7zMHsuz.js`).then(e=>({default:e.VoiceSettingsSection})),__vite__mapDeps([47,1,4,5,6,7,9,14,3,10,39,20]))),ppmbot:(0,P.lazy)(()=>x(()=>import(`./ppmbot-settings-section-BtKmsfqX.js`).then(e=>({default:e.PPMBotSettingsSection})),__vite__mapDeps([48,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39]))),notifications:(0,P.lazy)(()=>x(()=>import(`./notifications-settings-section-QeNYQwV1.js`).then(e=>({default:e.NotificationsSettingsSection})),__vite__mapDeps([49,4,1,5,39,7,20]))),jira:(0,P.lazy)(()=>x(()=>import(`./jira-watcher-section-C1vWzVZJ.js`).then(e=>({default:e.JiraWatcherSection})),__vite__mapDeps([50,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),extensions:(0,P.lazy)(()=>x(()=>import(`./extension-manager-section-CsudP-cF.js`).then(e=>({default:e.ExtensionManagerSection})),__vite__mapDeps([51,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),proxy:(0,P.lazy)(()=>x(()=>import(`./proxy-settings-section-BAFgwYyD.js`).then(e=>({default:e.ProxySettingsSection})),__vite__mapDeps([52,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,44]))),schedules:(0,P.lazy)(()=>x(()=>import(`./schedules-settings-section-BrsGPl6j.js`).then(e=>({default:e.SchedulesSettingsSection})),__vite__mapDeps([53,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),shortcuts:(0,P.lazy)(()=>x(()=>import(`./keyboard-shortcuts-section-CDYzFVbt.js`).then(e=>({default:e.KeyboardShortcutsSection})),__vite__mapDeps([54,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),files:(0,P.lazy)(()=>x(()=>import(`./files-settings-section-C998uv6a.js`).then(e=>({default:e.FilesSettingsSection})),__vite__mapDeps([55,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39]))),"query-audit":(0,P.lazy)(()=>x(()=>import(`./query-audit-section-BybgiPsc.js`).then(e=>({default:e.QueryAuditSection})),__vite__mapDeps([56,1,4,5,6,7,9,25,44,29,20])))};function I({category:e}){let t=F[e];return(0,j.jsx)(P.Suspense,{fallback:(0,j.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,j.jsx)(g,{className:`size-5 animate-spin text-muted-foreground`})}),children:(0,j.jsx)(t,{})})}function L({initialCategory:e,onCategoryChange:t}){let[n,r]=(0,P.useState)(e??`general`),[i,a]=(0,P.useState)(e===void 0),o=k(n),s=o.icon;function c(e){r(e),a(!1),t?.(e)}return(0,j.jsx)(`div`,{className:`@container h-full w-full`,"data-testid":`settings-window`,"data-category":n,children:(0,j.jsxs)(`div`,{className:`h-full w-full flex`,children:[(0,j.jsx)(`aside`,{className:`hidden @[640px]:flex @[640px]:flex-col w-[210px] shrink-0 border-r border-border min-h-0`,"data-testid":`settings-rail`,children:(0,j.jsx)(M,{active:n,onSelect:c})}),(0,j.jsxs)(`div`,{className:`relative flex-1 min-w-0`,children:[(0,j.jsxs)(`div`,{className:`h-full flex flex-col min-h-0`,children:[(0,j.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2 px-2 py-2.5 @[640px]:px-4`,children:[(0,j.jsx)(C,{variant:`ghost`,size:`icon`,"aria-label":`Back to settings list`,className:`size-9 shrink-0 cursor-pointer @[640px]:hidden`,onClick:()=>a(!0),children:(0,j.jsx)(f,{className:`size-4`})}),(0,j.jsx)(s,{className:`size-4 text-muted-foreground shrink-0`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold truncate`,"data-testid":`settings-pane-title`,children:o.label})]}),(0,j.jsx)(T,{}),(0,j.jsx)(w,{className:`flex-1 min-h-0`,children:(0,j.jsx)(`div`,{className:`p-4 pb-8`,children:(0,j.jsx)(I,{category:n})})})]}),i&&(0,j.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background flex flex-col min-h-0 @[640px]:hidden`,"data-testid":`settings-index`,children:[(0,j.jsx)(`div`,{className:`shrink-0 px-4 py-3`,children:(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Settings`})}),(0,j.jsx)(T,{}),(0,j.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,j.jsx)(N,{onSelect:c})})]})]})]})})}export{O as n,L as t};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import"./icons-CO_II6D-.js";import"./button-CsmGH5xa.js";import"./scroll-area-Dp-P38kg.js";import"./separator-B0xYRplF.js";import{n as t,t as n}from"./settings-body-
|
|
1
|
+
import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import"./icons-CO_II6D-.js";import"./button-CsmGH5xa.js";import"./scroll-area-Dp-P38kg.js";import"./separator-B0xYRplF.js";import{n as t,t as n}from"./settings-body-DJKHimA7.js";var r=e(),i=({metadata:e})=>(0,r.jsx)(n,{initialCategory:t(e?.category)?e.category:void 0});export{i as SettingsTab};
|
package/dist/web/assets/{settings-window-content-C6Od3qV7.js → settings-window-content-BMbDb3BQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import"./icons-CO_II6D-.js";import{t}from"./window-store-B4cbZ5rr.js";import"./button-CsmGH5xa.js";import"./scroll-area-Dp-P38kg.js";import"./separator-B0xYRplF.js";import{n,t as r}from"./settings-body-
|
|
1
|
+
import{S as e}from"./vendor-markdown-QKPNiWEd.js";import"./vendor-ui-P9Ym7hCv.js";import"./icons-CO_II6D-.js";import{t}from"./window-store-B4cbZ5rr.js";import"./button-CsmGH5xa.js";import"./scroll-area-Dp-P38kg.js";import"./separator-B0xYRplF.js";import{n,t as r}from"./settings-body-DJKHimA7.js";var i=e();function a({id:e,payload:a}){let o=t(e=>e.setPayload);return(0,i.jsx)(r,{initialCategory:n(a?.category)?a.category:void 0,onCategoryChange:t=>o(e,{category:t})})}export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{A as r,k as i}from"./index-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{C as t,S as n}from"./vendor-markdown-QKPNiWEd.js";import{A as r,k as i}from"./index-D41mthBS.js";import{t as a}from"./use-monaco-theme-08OELBic.js";import{a as o,i as s,r as c}from"./glide-data-grid-BuVHCdOY.js";var l=e(t(),1),u=n();function d({onExecute:e,loading:t,defaultValue:n=`SELECT * FROM `,schemaInfo:d,onSqlChange:f,persistedSql:p}){let[m,h]=(0,l.useState)(()=>p??n),g=(0,l.useRef)(!!p),_=(0,l.useRef)(null),v=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(e);b.current=e;let x=a();(0,l.useEffect)(()=>{if(!(!v.current||!d))return y.current?.dispose(),c(),y.current=v.current.languages.registerCompletionItemProvider(`sql`,s(v.current,d)),()=>{y.current?.dispose()}},[d]);let S=(0,l.useCallback)((e,t)=>{_.current=e,v.current=t,e.addAction({id:`run-query-at-cursor`,label:`Run Statement at Cursor`,keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.Enter],run:e=>{let t=e.getPosition();if(!t)return;let n=o(e.getValue(),t.lineNumber);n&&b.current(n)}}),d&&(y.current?.dispose(),y.current=t.languages.registerCompletionItemProvider(`sql`,s(t,d)))},[d]);return(0,l.useEffect)(()=>{g.current||h(n)},[n]),(0,u.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,u.jsx)(r,{beforeMount:i,height:`100%`,language:`sql`,theme:x,value:m,onChange:e=>{let t=e??``;h(t),g.current=!0,f?.(t)},onMount:S,options:{minimap:{enabled:!1},lineNumbers:`off`,scrollBeyondLastLine:!1,wordWrap:`on`,fontSize:12,tabSize:2,renderLineHighlight:`none`,overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{vertical:`auto`,horizontal:`auto`,verticalScrollbarSize:6,horizontalScrollbarSize:6},padding:{top:4,bottom:4},lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,fixedOverflowWidgets:!0}})})}export{d as t};
|
|
Binary file
|
|
Binary file
|