@hienlh/ppm 0.26.25 → 0.26.26
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 +16 -0
- package/CLAUDE.md +1 -0
- package/assets/skills/ppm/SKILL.md +1 -1
- package/assets/skills/ppm/references/cli-reference.md +1 -1
- package/assets/skills/ppm/references/http-api.md +1 -1
- package/dist/web/assets/{accounts-settings-section-C3D3rsFc.js → accounts-settings-section-CHq3WVao.js} +1 -1
- package/dist/web/assets/accounts-settings-section-CHq3WVao.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-CHq3WVao.js.gz +0 -0
- package/dist/web/assets/{agent-session-sheet-DLDOXcKE.js → agent-session-sheet-C0sgsTt9.js} +2 -2
- package/dist/web/assets/agent-session-sheet-C0sgsTt9.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-C0sgsTt9.js.gz +0 -0
- package/dist/web/assets/{agent-session-window-content-BGuwxE19.js → agent-session-window-content-CbrD8f8E.js} +1 -1
- package/dist/web/assets/agent-session-window-content-CbrD8f8E.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-CbrD8f8E.js.gz +0 -0
- package/dist/web/assets/{ai-resource-editor-DT-26Rdp.js → ai-resource-editor-CjellqxA.js} +1 -1
- package/dist/web/assets/ai-resource-editor-CjellqxA.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-CjellqxA.js.gz +0 -0
- package/dist/web/assets/{ai-settings-section-BsoV8DFp.js → ai-settings-section-CSRMdQ2S.js} +1 -1
- package/dist/web/assets/ai-settings-section-CSRMdQ2S.js.br +0 -0
- package/dist/web/assets/ai-settings-section-CSRMdQ2S.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-Db9X6wec.js +1 -0
- package/dist/web/assets/ai-settings-section-Db9X6wec.js.br +0 -0
- package/dist/web/assets/ai-settings-section-Db9X6wec.js.gz +0 -0
- package/dist/web/assets/{android-tab-3HjRSoW_.js → android-tab-DG1-4oee.js} +1 -1
- package/dist/web/assets/android-tab-DG1-4oee.js.br +0 -0
- package/dist/web/assets/android-tab-DG1-4oee.js.gz +0 -0
- package/dist/web/assets/{antigravity-usage-view-CE1g-eZl.js → antigravity-usage-view-C9gPFRb5.js} +1 -1
- package/dist/web/assets/antigravity-usage-view-C9gPFRb5.js.br +0 -0
- package/dist/web/assets/antigravity-usage-view-C9gPFRb5.js.gz +0 -0
- package/dist/web/assets/{appearance-settings-section-CJG4qHvE.js → appearance-settings-section-By5gIwBb.js} +1 -1
- package/dist/web/assets/appearance-settings-section-By5gIwBb.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-By5gIwBb.js.gz +0 -0
- package/dist/web/assets/{apps-panel-B4jbxAe_.js → apps-panel-D7fUCDns.js} +1 -1
- package/dist/web/assets/apps-panel-D7fUCDns.js.br +0 -0
- package/dist/web/assets/apps-panel-D7fUCDns.js.gz +0 -0
- package/dist/web/assets/{assistant-settings-section-Di5jjuKn.js → assistant-settings-section-D2XmOMHN.js} +1 -1
- package/dist/web/assets/assistant-settings-section-D2XmOMHN.js.br +0 -0
- package/dist/web/assets/assistant-settings-section-D2XmOMHN.js.gz +0 -0
- package/dist/web/assets/{assistant-tab-D2Wwkel7.js → assistant-tab-BFarx_Ed.js} +1 -1
- package/dist/web/assets/assistant-tab-BFarx_Ed.js.br +0 -0
- package/dist/web/assets/assistant-tab-BFarx_Ed.js.gz +0 -0
- package/dist/web/assets/{branch-review-tab-DetdGBW0.js → branch-review-tab-DdIk8GqJ.js} +1 -1
- package/dist/web/assets/branch-review-tab-DdIk8GqJ.js.br +0 -0
- package/dist/web/assets/branch-review-tab-DdIk8GqJ.js.gz +0 -0
- package/dist/web/assets/{chat-tab-DgA92PM1.js → chat-tab-CAE9EaFD.js} +3 -3
- package/dist/web/assets/chat-tab-CAE9EaFD.js.br +0 -0
- package/dist/web/assets/chat-tab-CAE9EaFD.js.gz +0 -0
- package/dist/web/assets/{chat-tab-uk6z9nF_.js → chat-tab-CvA7BVJ4.js} +1 -1
- package/dist/web/assets/chat-tab-CvA7BVJ4.js.br +0 -0
- package/dist/web/assets/chat-tab-CvA7BVJ4.js.gz +0 -0
- package/dist/web/assets/{code-editor-D88i7jW3.js → code-editor-DtOD5q9b.js} +4 -4
- package/dist/web/assets/code-editor-DtOD5q9b.js.br +0 -0
- package/dist/web/assets/code-editor-DtOD5q9b.js.gz +0 -0
- package/dist/web/assets/{conflict-editor-DmK-qOnp.js → conflict-editor-Dj4BkpPf.js} +1 -1
- package/dist/web/assets/conflict-editor-Dj4BkpPf.js.br +0 -0
- package/dist/web/assets/conflict-editor-Dj4BkpPf.js.gz +0 -0
- package/dist/web/assets/{connection-form-tab-BRtP0dOS.js → connection-form-tab-Dk7r5Mtu.js} +1 -1
- package/dist/web/assets/connection-form-tab-Dk7r5Mtu.js.br +0 -0
- package/dist/web/assets/connection-form-tab-Dk7r5Mtu.js.gz +0 -0
- package/dist/web/assets/{csv-preview-CvJiaQvt.js → csv-preview-Dgmt5iQZ.js} +1 -1
- package/dist/web/assets/csv-preview-Dgmt5iQZ.js.br +0 -0
- package/dist/web/assets/csv-preview-Dgmt5iQZ.js.gz +0 -0
- package/dist/web/assets/{database-drivers-section-Bbw7LpNB.js → database-drivers-section-DSbxYtMp.js} +1 -1
- package/dist/web/assets/database-drivers-section-DSbxYtMp.js.br +0 -0
- package/dist/web/assets/database-drivers-section-DSbxYtMp.js.gz +0 -0
- package/dist/web/assets/{db-tab-parts-DZB-gBVo.js → db-tab-parts-CWVmqUJa.js} +1 -1
- package/dist/web/assets/db-tab-parts-CWVmqUJa.js.br +0 -0
- package/dist/web/assets/db-tab-parts-CWVmqUJa.js.gz +0 -0
- package/dist/web/assets/{design-settings-section-BPzrBXBF.js → design-settings-section-CnWSH_2N.js} +1 -1
- package/dist/web/assets/design-settings-section-CnWSH_2N.js.br +0 -0
- package/dist/web/assets/design-settings-section-CnWSH_2N.js.gz +0 -0
- package/dist/web/assets/{design-tab-CZsssg4U.js → design-tab-DiqcX1dI.js} +1 -1
- package/dist/web/assets/design-tab-DiqcX1dI.js.br +0 -0
- package/dist/web/assets/design-tab-DiqcX1dI.js.gz +0 -0
- package/dist/web/assets/{designs-sidebar-panel-BUe18lf3.js → designs-sidebar-panel-DeE4Jcpo.js} +1 -1
- package/dist/web/assets/designs-sidebar-panel-DeE4Jcpo.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-DeE4Jcpo.js.gz +0 -0
- package/dist/web/assets/{diff-viewer-CP37xrCa.js → diff-viewer-6O_OSt5v.js} +1 -1
- package/dist/web/assets/diff-viewer-6O_OSt5v.js.br +0 -0
- package/dist/web/assets/diff-viewer-6O_OSt5v.js.gz +0 -0
- package/dist/web/assets/{docx-preview-bdsOmavD.js → docx-preview-CLWVH9aX.js} +1 -1
- package/dist/web/assets/docx-preview-CLWVH9aX.js.br +0 -0
- package/dist/web/assets/docx-preview-CLWVH9aX.js.gz +0 -0
- package/dist/web/assets/{editor-dialog-CutBoEjk.js → editor-dialog-DFix0Lrm.js} +1 -1
- package/dist/web/assets/editor-dialog-DFix0Lrm.js.br +0 -0
- package/dist/web/assets/editor-dialog-DFix0Lrm.js.gz +0 -0
- package/dist/web/assets/{editor-language-service-CvWIXOhc.js → editor-language-service-BxWCC26X.js} +1 -1
- package/dist/web/assets/editor-language-service-BxWCC26X.js.br +0 -0
- package/dist/web/assets/editor-language-service-BxWCC26X.js.gz +0 -0
- package/dist/web/assets/{explorer-body-CQmBBXfv.js → explorer-body-D0CQnNgj.js} +1 -1
- package/dist/web/assets/explorer-body-D0CQnNgj.js.br +0 -0
- package/dist/web/assets/explorer-body-D0CQnNgj.js.gz +0 -0
- package/dist/web/assets/{explorer-window-content-CLjCoNbm.js → explorer-window-content-DPLxcaoz.js} +1 -1
- package/dist/web/assets/explorer-window-content-DPLxcaoz.js.br +0 -0
- package/dist/web/assets/explorer-window-content-DPLxcaoz.js.gz +0 -0
- package/dist/web/assets/{extension-manager-section-DdYQKLbO.js → extension-manager-section-BWPlMBS4.js} +1 -1
- package/dist/web/assets/extension-manager-section-BWPlMBS4.js.br +0 -0
- package/dist/web/assets/extension-manager-section-BWPlMBS4.js.gz +0 -0
- package/dist/web/assets/{extension-webview-DK9hh2Y0.js → extension-webview-D5IPLnq8.js} +1 -1
- package/dist/web/assets/extension-webview-D5IPLnq8.js.br +0 -0
- package/dist/web/assets/extension-webview-D5IPLnq8.js.gz +0 -0
- package/dist/web/assets/{files-settings-section-8cUNHAuu.js → files-settings-section-MR-8W7DJ.js} +1 -1
- package/dist/web/assets/files-settings-section-MR-8W7DJ.js.br +0 -0
- package/dist/web/assets/files-settings-section-MR-8W7DJ.js.gz +0 -0
- package/dist/web/assets/{general-settings-section-D7vmzQJb.js → general-settings-section-CEl3ciuP.js} +1 -1
- package/dist/web/assets/general-settings-section-CEl3ciuP.js.br +0 -0
- package/dist/web/assets/general-settings-section-CEl3ciuP.js.gz +0 -0
- package/dist/web/assets/{git-log-panel-BSaunxeG.js → git-log-panel-DBfy0HRE.js} +1 -1
- package/dist/web/assets/git-log-panel-DBfy0HRE.js.br +0 -0
- package/dist/web/assets/git-log-panel-DBfy0HRE.js.gz +0 -0
- package/dist/web/assets/{git-review-tab-DIVcQU2d.js → git-review-tab-C1V1CZAt.js} +1 -1
- package/dist/web/assets/git-review-tab-C1V1CZAt.js.br +0 -0
- package/dist/web/assets/git-review-tab-C1V1CZAt.js.gz +0 -0
- package/dist/web/assets/{glide-data-grid-DSFI7lj5.js → glide-data-grid-D84U-1qn.js} +1 -1
- package/dist/web/assets/glide-data-grid-D84U-1qn.js.br +0 -0
- package/dist/web/assets/glide-data-grid-D84U-1qn.js.gz +0 -0
- package/dist/web/assets/{grid-save-dialog-CZJ8CGwa.js → grid-save-dialog-D9q2lcrq.js} +1 -1
- package/dist/web/assets/grid-save-dialog-D9q2lcrq.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-D9q2lcrq.js.gz +0 -0
- package/dist/web/assets/{group-chat-tab-DFeXDRvD.js → group-chat-tab-Bl0ECmSY.js} +1 -1
- package/dist/web/assets/group-chat-tab-Bl0ECmSY.js.br +0 -0
- package/dist/web/assets/group-chat-tab-Bl0ECmSY.js.gz +0 -0
- package/dist/web/assets/{impexp-tab-BDexxZ-D.js → impexp-tab-BgGbQxzM.js} +1 -1
- package/dist/web/assets/impexp-tab-BgGbQxzM.js.br +0 -0
- package/dist/web/assets/impexp-tab-BgGbQxzM.js.gz +0 -0
- package/dist/web/assets/{index-hkWEyYns.js → index-CXjsAVvH.js} +5 -5
- package/dist/web/assets/index-CXjsAVvH.js.br +0 -0
- package/dist/web/assets/index-CXjsAVvH.js.gz +0 -0
- package/dist/web/assets/{jira-watcher-section-BQsk6Meh.js → jira-watcher-section-ButbXGom.js} +1 -1
- package/dist/web/assets/{keybindings-store-BOeSz2cZ.js → keybindings-store-csigJZE3.js} +1 -1
- package/dist/web/assets/{keyboard-shortcuts-section-Cmj42EhF.js → keyboard-shortcuts-section-BWvBH4ZU.js} +1 -1
- package/dist/web/assets/keyboard-shortcuts-section-BWvBH4ZU.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-BWvBH4ZU.js.gz +0 -0
- package/dist/web/assets/{language-servers-section-Brh3-9ue.js → language-servers-section-DnehfNOm.js} +2 -2
- package/dist/web/assets/language-servers-section-DnehfNOm.js.br +0 -0
- package/dist/web/assets/language-servers-section-DnehfNOm.js.gz +0 -0
- package/dist/web/assets/{logs-app-C10T12Nn.js → logs-app-BlFJdAK9.js} +1 -1
- package/dist/web/assets/logs-app-BlFJdAK9.js.br +0 -0
- package/dist/web/assets/{logs-app-C10T12Nn.js.gz → logs-app-BlFJdAK9.js.gz} +0 -0
- package/dist/web/assets/{logs-tab-CQ6JE1PH.js → logs-tab-LAVt-dDa.js} +1 -1
- package/dist/web/assets/{logs-window-content-BZeunJPF.js → logs-window-content-Dfswr7eH.js} +1 -1
- package/dist/web/assets/{lsp-client-DWUEmZTw.js → lsp-client-CHfLLcaF.js} +1 -1
- package/dist/web/assets/lsp-client-CHfLLcaF.js.br +0 -0
- package/dist/web/assets/lsp-client-CHfLLcaF.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-R5P0d4vU.js → markdown-renderer-CSFnCZ8K.js} +1 -1
- package/dist/web/assets/markdown-renderer-CSFnCZ8K.js.br +0 -0
- package/dist/web/assets/markdown-renderer-CSFnCZ8K.js.gz +0 -0
- package/dist/web/assets/{markdown-renderer-CJIFwRyF.js → markdown-renderer-DksvADDz.js} +1 -1
- package/dist/web/assets/markdown-renderer-DksvADDz.js.br +0 -0
- package/dist/web/assets/markdown-renderer-DksvADDz.js.gz +0 -0
- package/dist/web/assets/{mobile-explorer-sheet-IG9QzF6l.js → mobile-explorer-sheet-B5sLjLZs.js} +1 -1
- package/dist/web/assets/mobile-explorer-sheet-B5sLjLZs.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-B5sLjLZs.js.gz +0 -0
- package/dist/web/assets/{monaco-diff-editor-DHjtaEX2.js → monaco-diff-editor-CXo44_VI.js} +1 -1
- package/dist/web/assets/{new-design-dialog-jBSJbk9e.js → new-design-dialog-_GiCQMy2.js} +1 -1
- package/dist/web/assets/new-design-dialog-_GiCQMy2.js.br +0 -0
- package/dist/web/assets/new-design-dialog-_GiCQMy2.js.gz +0 -0
- package/dist/web/assets/notification-settings-BJjDdN0W.js +1 -0
- package/dist/web/assets/notification-settings-BJjDdN0W.js.br +0 -0
- package/dist/web/assets/notification-settings-BJjDdN0W.js.gz +0 -0
- package/dist/web/assets/{notifications-settings-section-BXuOARiv.js → notifications-settings-section-D8irgdCE.js} +1 -1
- package/dist/web/assets/notifications-settings-section-D8irgdCE.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-D8irgdCE.js.gz +0 -0
- package/dist/web/assets/{onboarding-entry-BKevZSkh.js → onboarding-entry-DzhsgvnY.js} +1 -1
- package/dist/web/assets/onboarding-entry-DzhsgvnY.js.br +0 -0
- package/dist/web/assets/onboarding-entry-DzhsgvnY.js.gz +0 -0
- package/dist/web/assets/{open-manager-chat-gmviInoL.js → open-manager-chat-Bkb2PmYu.js} +1 -1
- package/dist/web/assets/open-manager-chat-Bkb2PmYu.js.br +0 -0
- package/dist/web/assets/open-manager-chat-Bkb2PmYu.js.gz +0 -0
- package/dist/web/assets/{open-manager-chat-CzGWRVmq.js → open-manager-chat-CNVW5U1C.js} +1 -1
- package/dist/web/assets/open-manager-chat-CNVW5U1C.js.br +0 -0
- package/dist/web/assets/open-manager-chat-CNVW5U1C.js.gz +0 -0
- package/dist/web/assets/{problems-panel-El3QJIV6.js → problems-panel-DZCBTTK0.js} +1 -1
- package/dist/web/assets/problems-panel-DZCBTTK0.js.br +0 -0
- package/dist/web/assets/problems-panel-DZCBTTK0.js.gz +0 -0
- package/dist/web/assets/{process-table-BqXICQFQ.js → process-table-oLXQ1Mj2.js} +1 -1
- package/dist/web/assets/process-table-oLXQ1Mj2.js.br +0 -0
- package/dist/web/assets/process-table-oLXQ1Mj2.js.gz +0 -0
- package/dist/web/assets/{proxy-settings-section-m-6EeVHv.js → proxy-settings-section-D88d-YqC.js} +1 -1
- package/dist/web/assets/proxy-settings-section-D88d-YqC.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-D88d-YqC.js.gz +0 -0
- package/dist/web/assets/{query-tab-GB_U7IeW.js → query-tab-D3UWqL_c.js} +1 -1
- package/dist/web/assets/query-tab-D3UWqL_c.js.br +0 -0
- package/dist/web/assets/query-tab-D3UWqL_c.js.gz +0 -0
- package/dist/web/assets/{release-notes-window-content-CwUQhgZ_.js → release-notes-window-content-DBGd9q2f.js} +1 -1
- package/dist/web/assets/{remote-access-settings-section-XCqpwwga.js → remote-access-settings-section-lDOBuTcD.js} +1 -1
- package/dist/web/assets/remote-access-settings-section-lDOBuTcD.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-lDOBuTcD.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-clipboard-notice-Dv9WhBL3.js → remote-desktop-clipboard-notice-C8lLPqSE.js} +1 -1
- package/dist/web/assets/remote-desktop-clipboard-notice-C8lLPqSE.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-C8lLPqSE.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-sheet-mucuAaLY.js → remote-desktop-mobile-sheet-1X9nMYdk.js} +2 -2
- package/dist/web/assets/remote-desktop-mobile-sheet-1X9nMYdk.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-1X9nMYdk.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-mobile-view-Cj1MLaFm.js → remote-desktop-mobile-view-DXlyxMuT.js} +1 -1
- package/dist/web/assets/remote-desktop-mobile-view-DXlyxMuT.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-DXlyxMuT.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-readiness-gate-NsbB_MYU.js → remote-desktop-readiness-gate-CapsSTlz.js} +1 -1
- package/dist/web/assets/remote-desktop-readiness-gate-CapsSTlz.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-CapsSTlz.js.gz +0 -0
- package/dist/web/assets/{remote-desktop-window-content-BhLPmsZd.js → remote-desktop-window-content-CmASOSoo.js} +1 -1
- package/dist/web/assets/remote-desktop-window-content-CmASOSoo.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-CmASOSoo.js.gz +0 -0
- package/dist/web/assets/{rename-object-dialog-BGHpYZhK.js → rename-object-dialog-CFhoU1ti.js} +1 -1
- package/dist/web/assets/rename-object-dialog-CFhoU1ti.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-CFhoU1ti.js.gz +0 -0
- package/dist/web/assets/{reveal-task-in-sidebar-kgQ18Zdo.js → reveal-task-in-sidebar-Dz0tH8vo.js} +1 -1
- package/dist/web/assets/{review-address-setup-iMXqLLGl.js → review-address-setup-CHbOBPtn.js} +1 -1
- package/dist/web/assets/review-address-setup-CHbOBPtn.js.br +0 -0
- package/dist/web/assets/review-address-setup-CHbOBPtn.js.gz +0 -0
- package/dist/web/assets/{review-code-DHxs5cqr.js → review-code-Ek4TK-FX.js} +1 -1
- package/dist/web/assets/review-code-Ek4TK-FX.js.br +0 -0
- package/dist/web/assets/review-code-Ek4TK-FX.js.gz +0 -0
- package/dist/web/assets/{save-as-dialog-Djahsc1T.js → save-as-dialog-m00iZElW.js} +1 -1
- package/dist/web/assets/save-as-dialog-m00iZElW.js.br +0 -0
- package/dist/web/assets/save-as-dialog-m00iZElW.js.gz +0 -0
- package/dist/web/assets/{schedule-form-BL62-9bF.js → schedule-form-BDbZLG_F.js} +3 -3
- package/dist/web/assets/schedule-form-BDbZLG_F.js.br +0 -0
- package/dist/web/assets/schedule-form-BDbZLG_F.js.gz +0 -0
- package/dist/web/assets/{schedule-script-editor-CkJnUiR4.js → schedule-script-editor-BC7_nlsE.js} +1 -1
- package/dist/web/assets/schedule-script-editor-BC7_nlsE.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-BC7_nlsE.js.gz +0 -0
- package/dist/web/assets/{schedules-app-C9_n1L6K.js → schedules-app-C6IdZ1hz.js} +1 -1
- package/dist/web/assets/schedules-app-C6IdZ1hz.js.br +0 -0
- package/dist/web/assets/schedules-app-C6IdZ1hz.js.gz +0 -0
- package/dist/web/assets/{schedules-settings-section-CI_0jYgG.js → schedules-settings-section-Dhc_ZbMP.js} +3 -3
- package/dist/web/assets/schedules-settings-section-Dhc_ZbMP.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-Dhc_ZbMP.js.gz +0 -0
- package/dist/web/assets/{schedules-tab-BvYAcvO_.js → schedules-tab-NMvWV7xN.js} +1 -1
- package/dist/web/assets/schedules-tab-NMvWV7xN.js.br +0 -0
- package/dist/web/assets/schedules-tab-NMvWV7xN.js.gz +0 -0
- package/dist/web/assets/{schedules-ui-Bj4uM71z.js → schedules-ui-DaSldyoD.js} +1 -1
- package/dist/web/assets/schedules-ui-DaSldyoD.js.br +0 -0
- package/dist/web/assets/schedules-ui-DaSldyoD.js.gz +0 -0
- package/dist/web/assets/{schedules-window-content-fn4dXnW0.js → schedules-window-content-MseZLBpK.js} +1 -1
- package/dist/web/assets/schedules-window-content-MseZLBpK.js.br +0 -0
- package/dist/web/assets/schedules-window-content-MseZLBpK.js.gz +0 -0
- package/dist/web/assets/{session-review-tab-DSEjqKaO.js → session-review-tab-BEPMJynS.js} +1 -1
- package/dist/web/assets/session-review-tab-BEPMJynS.js.br +0 -0
- package/dist/web/assets/session-review-tab-BEPMJynS.js.gz +0 -0
- package/dist/web/assets/{settings-body-Bx7lXh_W.js → settings-body-D2e_RbI4.js} +1 -1
- package/dist/web/assets/settings-body-D2e_RbI4.js.br +0 -0
- package/dist/web/assets/settings-body-D2e_RbI4.js.gz +0 -0
- package/dist/web/assets/{settings-rows-6kYZSWYo.js → settings-rows-B6puQ-Vk.js} +1 -1
- package/dist/web/assets/settings-rows-B6puQ-Vk.js.br +0 -0
- package/dist/web/assets/settings-rows-B6puQ-Vk.js.gz +0 -0
- package/dist/web/assets/{settings-section-content-BHSM6JLt.js → settings-section-content-DPyAAu71.js} +1 -1
- package/dist/web/assets/{settings-section-content-Ch4UlUlz.js → settings-section-content-Mzy53zFZ.js} +2 -2
- package/dist/web/assets/settings-section-content-Mzy53zFZ.js.br +0 -0
- package/dist/web/assets/settings-section-content-Mzy53zFZ.js.gz +0 -0
- package/dist/web/assets/{settings-tab-C33ydIbT.js → settings-tab-DFgGmabd.js} +1 -1
- package/dist/web/assets/{settings-window-content-B6xiTov9.js → settings-window-content-C9IxMJOD.js} +1 -1
- package/dist/web/assets/{sql-object-tab-DF68oD4Y.js → sql-object-tab-DXiJqm1Y.js} +1 -1
- package/dist/web/assets/sql-object-tab-DXiJqm1Y.js.br +0 -0
- package/dist/web/assets/sql-object-tab-DXiJqm1Y.js.gz +0 -0
- package/dist/web/assets/{sqlite-viewer-C53FYUW7.js → sqlite-viewer-BoqlcTq3.js} +1 -1
- package/dist/web/assets/sqlite-viewer-BoqlcTq3.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-BoqlcTq3.js.gz +0 -0
- package/dist/web/assets/{storage-settings-section-DHccXTed.js → storage-settings-section-BSzvRWfE.js} +1 -1
- package/dist/web/assets/storage-settings-section-BSzvRWfE.js.br +0 -0
- package/dist/web/assets/storage-settings-section-BSzvRWfE.js.gz +0 -0
- package/dist/web/assets/{structure-save-dialog-ByyfWBQ3.js → structure-save-dialog-DmAOFSGl.js} +1 -1
- package/dist/web/assets/structure-save-dialog-DmAOFSGl.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-DmAOFSGl.js.gz +0 -0
- package/dist/web/assets/{structure-tab-DbFGcN7I.js → structure-tab-Cj2T4GOA.js} +1 -1
- package/dist/web/assets/structure-tab-Cj2T4GOA.js.br +0 -0
- package/dist/web/assets/structure-tab-Cj2T4GOA.js.gz +0 -0
- package/dist/web/assets/{system-monitor-body-BxBWIZfo.js → system-monitor-body-ryEXCvyT.js} +2 -2
- package/dist/web/assets/system-monitor-body-ryEXCvyT.js.br +0 -0
- package/dist/web/assets/system-monitor-body-ryEXCvyT.js.gz +0 -0
- package/dist/web/assets/{system-monitor-tab-DxKpeIaE.js → system-monitor-tab-DcNzbPgb.js} +1 -1
- package/dist/web/assets/{system-monitor-window-content-DAY6eSK7.js → system-monitor-window-content-CpFLui4-.js} +1 -1
- package/dist/web/assets/{tab-host-window-content-xvl32Qm6.js → tab-host-window-content-CD92R8Dj.js} +1 -1
- package/dist/web/assets/tab-host-window-content-CD92R8Dj.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-CD92R8Dj.js.gz +0 -0
- package/dist/web/assets/{table-tab-u-7eOEjr.js → table-tab-zoEhA_cF.js} +1 -1
- package/dist/web/assets/table-tab-zoEhA_cF.js.br +0 -0
- package/dist/web/assets/table-tab-zoEhA_cF.js.gz +0 -0
- package/dist/web/assets/{task-detail-mobile-dMcVIoRs.js → task-detail-mobile-40HLTUnk.js} +1 -1
- package/dist/web/assets/task-detail-mobile-40HLTUnk.js.br +0 -0
- package/dist/web/assets/task-detail-mobile-40HLTUnk.js.gz +0 -0
- package/dist/web/assets/{task-sheet-BpL6w5FD.js → task-sheet-Tbk7O-Ak.js} +1 -1
- package/dist/web/assets/task-sheet-Tbk7O-Ak.js.br +0 -0
- package/dist/web/assets/task-sheet-Tbk7O-Ak.js.gz +0 -0
- package/dist/web/assets/{task-status-grid-Bt-UFG9Y.js → task-status-grid-D4UX5sy_.js} +1 -1
- package/dist/web/assets/task-status-grid-D4UX5sy_.js.br +0 -0
- package/dist/web/assets/task-status-grid-D4UX5sy_.js.gz +0 -0
- package/dist/web/assets/{task-tab-Bx3UftQY.js → task-tab-CrW-DqBd.js} +1 -1
- package/dist/web/assets/task-tab-CrW-DqBd.js.br +0 -0
- package/dist/web/assets/task-tab-CrW-DqBd.js.gz +0 -0
- package/dist/web/assets/{tasks-sidebar-panel-DopLJjgy.js → tasks-sidebar-panel-D3opTyDQ.js} +1 -1
- package/dist/web/assets/tasks-sidebar-panel-D3opTyDQ.js.br +0 -0
- package/dist/web/assets/tasks-sidebar-panel-D3opTyDQ.js.gz +0 -0
- package/dist/web/assets/{telegram-bot-token-field-DRkuw4nN.js → telegram-bot-token-field-CP_XKOOb.js} +1 -1
- package/dist/web/assets/telegram-bot-token-field-CP_XKOOb.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-CP_XKOOb.js.gz +0 -0
- package/dist/web/assets/{terminal-tab-CYGksYRc.js → terminal-tab-eVtopKuS.js} +1 -1
- package/dist/web/assets/terminal-tab-eVtopKuS.js.br +0 -0
- package/dist/web/assets/terminal-tab-eVtopKuS.js.gz +0 -0
- package/dist/web/assets/{tool-cards-ChRYIgbI.js → tool-cards-CqkbtQmV.js} +3 -3
- package/dist/web/assets/tool-cards-CqkbtQmV.js.br +0 -0
- package/dist/web/assets/tool-cards-CqkbtQmV.js.gz +0 -0
- package/dist/web/assets/{tools-settings-section-CgK3FQoK.js → tools-settings-section-ym2uDafc.js} +1 -1
- package/dist/web/assets/tools-settings-section-ym2uDafc.js.br +0 -0
- package/dist/web/assets/tools-settings-section-ym2uDafc.js.gz +0 -0
- package/dist/web/assets/{use-db-read-DhCLiECm.js → use-db-read-MivtTKTM.js} +1 -1
- package/dist/web/assets/use-db-read-MivtTKTM.js.br +0 -0
- package/dist/web/assets/use-db-read-MivtTKTM.js.gz +0 -0
- package/dist/web/assets/{use-inline-blame-BM3xEWhp.js → use-inline-blame-qDX6zmzH.js} +1 -1
- package/dist/web/assets/use-inline-blame-qDX6zmzH.js.br +0 -0
- package/dist/web/assets/use-inline-blame-qDX6zmzH.js.gz +0 -0
- package/dist/web/assets/{use-lsp-DbU39GP7.js → use-lsp-BdHI4aa8.js} +1 -1
- package/dist/web/assets/use-lsp-BdHI4aa8.js.br +0 -0
- package/dist/web/assets/use-lsp-BdHI4aa8.js.gz +0 -0
- package/dist/web/assets/{use-monaco-theme-B2WpajeO.js → use-monaco-theme-B4sZXOJo.js} +1 -1
- package/dist/web/assets/{use-process-kill-9NhJJrf6.js → use-process-kill-B7kifhe_.js} +1 -1
- package/dist/web/assets/use-process-kill-B7kifhe_.js.br +0 -0
- package/dist/web/assets/use-process-kill-B7kifhe_.js.gz +0 -0
- package/dist/web/assets/{use-sql-schema-info-C11TKahK.js → use-sql-schema-info-w7C5brXk.js} +1 -1
- package/dist/web/assets/use-sql-schema-info-w7C5brXk.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-w7C5brXk.js.gz +0 -0
- package/dist/web/assets/{use-websocket-B5u-9Nte.js → use-websocket-DsX1l-DK.js} +1 -1
- package/dist/web/assets/{vault-settings-section-CcruoXwN.js → vault-settings-section-B0oWe-n2.js} +1 -1
- package/dist/web/assets/vault-settings-section-B0oWe-n2.js.br +0 -0
- package/dist/web/assets/vault-settings-section-B0oWe-n2.js.gz +0 -0
- package/dist/web/assets/{voice-settings-section-DBQVSx2W.js → voice-settings-section-DNNYOnyl.js} +1 -1
- package/dist/web/assets/voice-settings-section-DNNYOnyl.js.br +0 -0
- package/dist/web/assets/voice-settings-section-DNNYOnyl.js.gz +0 -0
- package/dist/web/assets/{web-preview-tab-DKosRbHw.js → web-preview-tab-CvP7EV4g.js} +1 -1
- package/dist/web/assets/web-preview-tab-CvP7EV4g.js.br +0 -0
- package/dist/web/assets/web-preview-tab-CvP7EV4g.js.gz +0 -0
- package/dist/web/assets/{xlsx-preview-DCBVVwtB.js → xlsx-preview-EuM_t7JD.js} +1 -1
- package/dist/web/assets/xlsx-preview-EuM_t7JD.js.br +0 -0
- package/dist/web/assets/xlsx-preview-EuM_t7JD.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/cli/commands/restart.ts +8 -5
- package/src/cli/commands/stop.ts +14 -2
- package/src/cli/utils/ai-setting-write.ts +3 -0
- package/src/index.ts +6 -1
- package/src/providers/claude-agent-sdk-query-options.ts +36 -5
- package/src/providers/claude-agent-sdk.ts +24 -3
- package/src/providers/claude-warm-spare.ts +3 -0
- package/src/server/index.ts +42 -6
- package/src/server/routes/settings.ts +15 -0
- package/src/server/ws/chat.ts +52 -2
- package/src/services/autostart-generator.ts +23 -4
- package/src/services/autostart-register.ts +16 -1
- package/src/services/cli-leftover-reaper.ts +84 -0
- package/src/services/config-write-guard.ts +10 -0
- package/src/services/memory-diagnostics-spawns.ts +7 -0
- package/src/services/memory-guard/heavy-command-gate.ts +317 -0
- package/src/services/memory-guard/idle-subprocess-release.ts +47 -0
- package/src/services/memory-guard/low-memory-alert.ts +56 -0
- package/src/services/memory-guard/memory-guard.service.ts +85 -0
- package/src/services/memory-pulse.ts +129 -0
- package/src/services/memory-watchdog.ts +60 -2
- package/src/services/notification.service.ts +1 -1
- package/src/services/restart-news/previous-run-death.ts +208 -0
- package/src/services/restart-news/restart-news-text.ts +1 -0
- package/src/services/restart-news/supervisor-start-reason.ts +14 -1
- package/src/services/supervisor-memory-guard.ts +68 -0
- package/src/services/supervisor-state.ts +6 -1
- package/src/services/supervisor-watchdog/ensure-supervisor-decision.ts +98 -0
- package/src/services/supervisor-watchdog/ensure-supervisor.ts +149 -0
- package/src/services/supervisor-watchdog/leftover-recovery.ts +46 -0
- package/src/services/supervisor-watchdog/recorded-pid.ts +53 -0
- package/src/services/supervisor.ts +141 -16
- package/src/services/system-commit.ts +69 -0
- package/src/shared/memory-guard.ts +53 -0
- package/src/shared/notification-settings.ts +4 -3
- package/src/shared/restart-news.ts +4 -2
- package/src/types/config.ts +9 -0
- package/src/web/components/settings/ai-settings-section.tsx +10 -0
- package/src/web/components/settings/memory-guard-settings.tsx +78 -0
- package/src/web/lib/api-settings.ts +3 -0
- package/dist/web/assets/accounts-settings-section-C3D3rsFc.js.br +0 -0
- package/dist/web/assets/accounts-settings-section-C3D3rsFc.js.gz +0 -0
- package/dist/web/assets/agent-session-sheet-DLDOXcKE.js.br +0 -0
- package/dist/web/assets/agent-session-sheet-DLDOXcKE.js.gz +0 -0
- package/dist/web/assets/agent-session-window-content-BGuwxE19.js.br +0 -0
- package/dist/web/assets/agent-session-window-content-BGuwxE19.js.gz +0 -0
- package/dist/web/assets/ai-resource-editor-DT-26Rdp.js.br +0 -0
- package/dist/web/assets/ai-resource-editor-DT-26Rdp.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-BsoV8DFp.js.br +0 -0
- package/dist/web/assets/ai-settings-section-BsoV8DFp.js.gz +0 -0
- package/dist/web/assets/ai-settings-section-C9A9ic78.js +0 -1
- package/dist/web/assets/ai-settings-section-C9A9ic78.js.br +0 -0
- package/dist/web/assets/ai-settings-section-C9A9ic78.js.gz +0 -0
- package/dist/web/assets/android-tab-3HjRSoW_.js.br +0 -0
- package/dist/web/assets/android-tab-3HjRSoW_.js.gz +0 -0
- package/dist/web/assets/antigravity-usage-view-CE1g-eZl.js.br +0 -0
- package/dist/web/assets/antigravity-usage-view-CE1g-eZl.js.gz +0 -0
- package/dist/web/assets/appearance-settings-section-CJG4qHvE.js.br +0 -0
- package/dist/web/assets/appearance-settings-section-CJG4qHvE.js.gz +0 -0
- package/dist/web/assets/apps-panel-B4jbxAe_.js.br +0 -0
- package/dist/web/assets/apps-panel-B4jbxAe_.js.gz +0 -0
- package/dist/web/assets/assistant-settings-section-Di5jjuKn.js.br +0 -0
- package/dist/web/assets/assistant-settings-section-Di5jjuKn.js.gz +0 -0
- package/dist/web/assets/assistant-tab-D2Wwkel7.js.br +0 -0
- package/dist/web/assets/assistant-tab-D2Wwkel7.js.gz +0 -0
- package/dist/web/assets/branch-review-tab-DetdGBW0.js.br +0 -0
- package/dist/web/assets/branch-review-tab-DetdGBW0.js.gz +0 -0
- package/dist/web/assets/chat-tab-DgA92PM1.js.br +0 -0
- package/dist/web/assets/chat-tab-DgA92PM1.js.gz +0 -0
- package/dist/web/assets/chat-tab-uk6z9nF_.js.br +0 -0
- package/dist/web/assets/chat-tab-uk6z9nF_.js.gz +0 -0
- package/dist/web/assets/code-editor-D88i7jW3.js.br +0 -0
- package/dist/web/assets/code-editor-D88i7jW3.js.gz +0 -0
- package/dist/web/assets/conflict-editor-DmK-qOnp.js.br +0 -0
- package/dist/web/assets/conflict-editor-DmK-qOnp.js.gz +0 -0
- package/dist/web/assets/connection-form-tab-BRtP0dOS.js.br +0 -0
- package/dist/web/assets/connection-form-tab-BRtP0dOS.js.gz +0 -0
- package/dist/web/assets/csv-preview-CvJiaQvt.js.br +0 -0
- package/dist/web/assets/csv-preview-CvJiaQvt.js.gz +0 -0
- package/dist/web/assets/database-drivers-section-Bbw7LpNB.js.br +0 -0
- package/dist/web/assets/database-drivers-section-Bbw7LpNB.js.gz +0 -0
- package/dist/web/assets/db-tab-parts-DZB-gBVo.js.br +0 -0
- package/dist/web/assets/db-tab-parts-DZB-gBVo.js.gz +0 -0
- package/dist/web/assets/design-settings-section-BPzrBXBF.js.br +0 -0
- package/dist/web/assets/design-settings-section-BPzrBXBF.js.gz +0 -0
- package/dist/web/assets/design-tab-CZsssg4U.js.br +0 -0
- package/dist/web/assets/design-tab-CZsssg4U.js.gz +0 -0
- package/dist/web/assets/designs-sidebar-panel-BUe18lf3.js.br +0 -0
- package/dist/web/assets/designs-sidebar-panel-BUe18lf3.js.gz +0 -0
- package/dist/web/assets/diff-viewer-CP37xrCa.js.br +0 -0
- package/dist/web/assets/diff-viewer-CP37xrCa.js.gz +0 -0
- package/dist/web/assets/docx-preview-bdsOmavD.js.br +0 -0
- package/dist/web/assets/docx-preview-bdsOmavD.js.gz +0 -0
- package/dist/web/assets/editor-dialog-CutBoEjk.js.br +0 -0
- package/dist/web/assets/editor-dialog-CutBoEjk.js.gz +0 -0
- package/dist/web/assets/editor-language-service-CvWIXOhc.js.br +0 -0
- package/dist/web/assets/editor-language-service-CvWIXOhc.js.gz +0 -0
- package/dist/web/assets/explorer-body-CQmBBXfv.js.br +0 -0
- package/dist/web/assets/explorer-body-CQmBBXfv.js.gz +0 -0
- package/dist/web/assets/explorer-window-content-CLjCoNbm.js.br +0 -0
- package/dist/web/assets/explorer-window-content-CLjCoNbm.js.gz +0 -0
- package/dist/web/assets/extension-manager-section-DdYQKLbO.js.br +0 -0
- package/dist/web/assets/extension-manager-section-DdYQKLbO.js.gz +0 -0
- package/dist/web/assets/extension-webview-DK9hh2Y0.js.br +0 -0
- package/dist/web/assets/extension-webview-DK9hh2Y0.js.gz +0 -0
- package/dist/web/assets/files-settings-section-8cUNHAuu.js.br +0 -0
- package/dist/web/assets/files-settings-section-8cUNHAuu.js.gz +0 -0
- package/dist/web/assets/general-settings-section-D7vmzQJb.js.br +0 -0
- package/dist/web/assets/general-settings-section-D7vmzQJb.js.gz +0 -0
- package/dist/web/assets/git-log-panel-BSaunxeG.js.br +0 -0
- package/dist/web/assets/git-log-panel-BSaunxeG.js.gz +0 -0
- package/dist/web/assets/git-review-tab-DIVcQU2d.js.br +0 -0
- package/dist/web/assets/git-review-tab-DIVcQU2d.js.gz +0 -0
- package/dist/web/assets/glide-data-grid-DSFI7lj5.js.br +0 -0
- package/dist/web/assets/glide-data-grid-DSFI7lj5.js.gz +0 -0
- package/dist/web/assets/grid-save-dialog-CZJ8CGwa.js.br +0 -0
- package/dist/web/assets/grid-save-dialog-CZJ8CGwa.js.gz +0 -0
- package/dist/web/assets/group-chat-tab-DFeXDRvD.js.br +0 -0
- package/dist/web/assets/group-chat-tab-DFeXDRvD.js.gz +0 -0
- package/dist/web/assets/impexp-tab-BDexxZ-D.js.br +0 -0
- package/dist/web/assets/impexp-tab-BDexxZ-D.js.gz +0 -0
- package/dist/web/assets/index-hkWEyYns.js.br +0 -0
- package/dist/web/assets/index-hkWEyYns.js.gz +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-Cmj42EhF.js.br +0 -0
- package/dist/web/assets/keyboard-shortcuts-section-Cmj42EhF.js.gz +0 -0
- package/dist/web/assets/language-servers-section-Brh3-9ue.js.br +0 -0
- package/dist/web/assets/language-servers-section-Brh3-9ue.js.gz +0 -0
- package/dist/web/assets/logs-app-C10T12Nn.js.br +0 -0
- package/dist/web/assets/lsp-client-DWUEmZTw.js.br +0 -0
- package/dist/web/assets/lsp-client-DWUEmZTw.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-CJIFwRyF.js.br +0 -0
- package/dist/web/assets/markdown-renderer-CJIFwRyF.js.gz +0 -0
- package/dist/web/assets/markdown-renderer-R5P0d4vU.js.br +0 -0
- package/dist/web/assets/markdown-renderer-R5P0d4vU.js.gz +0 -0
- package/dist/web/assets/mobile-explorer-sheet-IG9QzF6l.js.br +0 -0
- package/dist/web/assets/mobile-explorer-sheet-IG9QzF6l.js.gz +0 -0
- package/dist/web/assets/new-design-dialog-jBSJbk9e.js.br +0 -0
- package/dist/web/assets/new-design-dialog-jBSJbk9e.js.gz +0 -0
- package/dist/web/assets/notification-settings-DPwVHqce.js +0 -1
- package/dist/web/assets/notification-settings-DPwVHqce.js.br +0 -0
- package/dist/web/assets/notification-settings-DPwVHqce.js.gz +0 -0
- package/dist/web/assets/notifications-settings-section-BXuOARiv.js.br +0 -0
- package/dist/web/assets/notifications-settings-section-BXuOARiv.js.gz +0 -0
- package/dist/web/assets/onboarding-entry-BKevZSkh.js.br +0 -0
- package/dist/web/assets/onboarding-entry-BKevZSkh.js.gz +0 -0
- package/dist/web/assets/open-manager-chat-CzGWRVmq.js.br +0 -2
- package/dist/web/assets/open-manager-chat-CzGWRVmq.js.gz +0 -0
- package/dist/web/assets/open-manager-chat-gmviInoL.js.br +0 -0
- package/dist/web/assets/open-manager-chat-gmviInoL.js.gz +0 -0
- package/dist/web/assets/problems-panel-El3QJIV6.js.br +0 -0
- package/dist/web/assets/problems-panel-El3QJIV6.js.gz +0 -0
- package/dist/web/assets/process-table-BqXICQFQ.js.br +0 -0
- package/dist/web/assets/process-table-BqXICQFQ.js.gz +0 -0
- package/dist/web/assets/proxy-settings-section-m-6EeVHv.js.br +0 -0
- package/dist/web/assets/proxy-settings-section-m-6EeVHv.js.gz +0 -0
- package/dist/web/assets/query-tab-GB_U7IeW.js.br +0 -0
- package/dist/web/assets/query-tab-GB_U7IeW.js.gz +0 -0
- package/dist/web/assets/remote-access-settings-section-XCqpwwga.js.br +0 -0
- package/dist/web/assets/remote-access-settings-section-XCqpwwga.js.gz +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-Dv9WhBL3.js.br +0 -0
- package/dist/web/assets/remote-desktop-clipboard-notice-Dv9WhBL3.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-mucuAaLY.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-sheet-mucuAaLY.js.gz +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-Cj1MLaFm.js.br +0 -0
- package/dist/web/assets/remote-desktop-mobile-view-Cj1MLaFm.js.gz +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-NsbB_MYU.js.br +0 -0
- package/dist/web/assets/remote-desktop-readiness-gate-NsbB_MYU.js.gz +0 -0
- package/dist/web/assets/remote-desktop-window-content-BhLPmsZd.js.br +0 -0
- package/dist/web/assets/remote-desktop-window-content-BhLPmsZd.js.gz +0 -0
- package/dist/web/assets/rename-object-dialog-BGHpYZhK.js.br +0 -0
- package/dist/web/assets/rename-object-dialog-BGHpYZhK.js.gz +0 -0
- package/dist/web/assets/review-address-setup-iMXqLLGl.js.br +0 -0
- package/dist/web/assets/review-address-setup-iMXqLLGl.js.gz +0 -0
- package/dist/web/assets/review-code-DHxs5cqr.js.br +0 -0
- package/dist/web/assets/review-code-DHxs5cqr.js.gz +0 -0
- package/dist/web/assets/save-as-dialog-Djahsc1T.js.br +0 -0
- package/dist/web/assets/save-as-dialog-Djahsc1T.js.gz +0 -0
- package/dist/web/assets/schedule-form-BL62-9bF.js.br +0 -0
- package/dist/web/assets/schedule-form-BL62-9bF.js.gz +0 -0
- package/dist/web/assets/schedule-script-editor-CkJnUiR4.js.br +0 -0
- package/dist/web/assets/schedule-script-editor-CkJnUiR4.js.gz +0 -0
- package/dist/web/assets/schedules-app-C9_n1L6K.js.br +0 -0
- package/dist/web/assets/schedules-app-C9_n1L6K.js.gz +0 -0
- package/dist/web/assets/schedules-settings-section-CI_0jYgG.js.br +0 -0
- package/dist/web/assets/schedules-settings-section-CI_0jYgG.js.gz +0 -0
- package/dist/web/assets/schedules-tab-BvYAcvO_.js.br +0 -0
- package/dist/web/assets/schedules-tab-BvYAcvO_.js.gz +0 -0
- package/dist/web/assets/schedules-ui-Bj4uM71z.js.br +0 -0
- package/dist/web/assets/schedules-ui-Bj4uM71z.js.gz +0 -0
- package/dist/web/assets/schedules-window-content-fn4dXnW0.js.br +0 -0
- package/dist/web/assets/schedules-window-content-fn4dXnW0.js.gz +0 -0
- package/dist/web/assets/session-review-tab-DSEjqKaO.js.br +0 -0
- package/dist/web/assets/session-review-tab-DSEjqKaO.js.gz +0 -0
- package/dist/web/assets/settings-body-Bx7lXh_W.js.br +0 -0
- package/dist/web/assets/settings-body-Bx7lXh_W.js.gz +0 -0
- package/dist/web/assets/settings-rows-6kYZSWYo.js.br +0 -0
- package/dist/web/assets/settings-rows-6kYZSWYo.js.gz +0 -0
- package/dist/web/assets/settings-section-content-Ch4UlUlz.js.br +0 -0
- package/dist/web/assets/settings-section-content-Ch4UlUlz.js.gz +0 -0
- package/dist/web/assets/sql-object-tab-DF68oD4Y.js.br +0 -0
- package/dist/web/assets/sql-object-tab-DF68oD4Y.js.gz +0 -0
- package/dist/web/assets/sqlite-viewer-C53FYUW7.js.br +0 -0
- package/dist/web/assets/sqlite-viewer-C53FYUW7.js.gz +0 -0
- package/dist/web/assets/storage-settings-section-DHccXTed.js.br +0 -0
- package/dist/web/assets/storage-settings-section-DHccXTed.js.gz +0 -0
- package/dist/web/assets/structure-save-dialog-ByyfWBQ3.js.br +0 -0
- package/dist/web/assets/structure-save-dialog-ByyfWBQ3.js.gz +0 -0
- package/dist/web/assets/structure-tab-DbFGcN7I.js.br +0 -0
- package/dist/web/assets/structure-tab-DbFGcN7I.js.gz +0 -0
- package/dist/web/assets/system-monitor-body-BxBWIZfo.js.br +0 -0
- package/dist/web/assets/system-monitor-body-BxBWIZfo.js.gz +0 -0
- package/dist/web/assets/tab-host-window-content-xvl32Qm6.js.br +0 -0
- package/dist/web/assets/tab-host-window-content-xvl32Qm6.js.gz +0 -0
- package/dist/web/assets/table-tab-u-7eOEjr.js.br +0 -0
- package/dist/web/assets/table-tab-u-7eOEjr.js.gz +0 -0
- package/dist/web/assets/task-detail-mobile-dMcVIoRs.js.br +0 -0
- package/dist/web/assets/task-detail-mobile-dMcVIoRs.js.gz +0 -0
- package/dist/web/assets/task-sheet-BpL6w5FD.js.br +0 -0
- package/dist/web/assets/task-sheet-BpL6w5FD.js.gz +0 -0
- package/dist/web/assets/task-status-grid-Bt-UFG9Y.js.br +0 -0
- package/dist/web/assets/task-status-grid-Bt-UFG9Y.js.gz +0 -0
- package/dist/web/assets/task-tab-Bx3UftQY.js.br +0 -0
- package/dist/web/assets/task-tab-Bx3UftQY.js.gz +0 -0
- package/dist/web/assets/tasks-sidebar-panel-DopLJjgy.js.br +0 -0
- package/dist/web/assets/tasks-sidebar-panel-DopLJjgy.js.gz +0 -0
- package/dist/web/assets/telegram-bot-token-field-DRkuw4nN.js.br +0 -0
- package/dist/web/assets/telegram-bot-token-field-DRkuw4nN.js.gz +0 -0
- package/dist/web/assets/terminal-tab-CYGksYRc.js.br +0 -0
- package/dist/web/assets/terminal-tab-CYGksYRc.js.gz +0 -0
- package/dist/web/assets/tool-cards-ChRYIgbI.js.br +0 -0
- package/dist/web/assets/tool-cards-ChRYIgbI.js.gz +0 -0
- package/dist/web/assets/tools-settings-section-CgK3FQoK.js.br +0 -0
- package/dist/web/assets/tools-settings-section-CgK3FQoK.js.gz +0 -0
- package/dist/web/assets/use-db-read-DhCLiECm.js.br +0 -0
- package/dist/web/assets/use-db-read-DhCLiECm.js.gz +0 -0
- package/dist/web/assets/use-inline-blame-BM3xEWhp.js.br +0 -0
- package/dist/web/assets/use-inline-blame-BM3xEWhp.js.gz +0 -0
- package/dist/web/assets/use-lsp-DbU39GP7.js.br +0 -0
- package/dist/web/assets/use-lsp-DbU39GP7.js.gz +0 -0
- package/dist/web/assets/use-process-kill-9NhJJrf6.js.br +0 -0
- package/dist/web/assets/use-process-kill-9NhJJrf6.js.gz +0 -0
- package/dist/web/assets/use-sql-schema-info-C11TKahK.js.br +0 -0
- package/dist/web/assets/use-sql-schema-info-C11TKahK.js.gz +0 -0
- package/dist/web/assets/vault-settings-section-CcruoXwN.js.br +0 -0
- package/dist/web/assets/vault-settings-section-CcruoXwN.js.gz +0 -0
- package/dist/web/assets/voice-settings-section-DBQVSx2W.js.br +0 -0
- package/dist/web/assets/voice-settings-section-DBQVSx2W.js.gz +0 -0
- package/dist/web/assets/web-preview-tab-DKosRbHw.js.br +0 -0
- package/dist/web/assets/web-preview-tab-DKosRbHw.js.gz +0 -0
- package/dist/web/assets/xlsx-preview-DCBVVwtB.js.br +0 -0
- package/dist/web/assets/xlsx-preview-DCBVVwtB.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.26.26] - 2026-11-21
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **PPM comes back by itself after running out of memory (Windows)**: the autostart task checks every 2 minutes, waits for memory to free up, restarts PPM and says "out of memory" when that is what killed it; it gives up with a notification after 5 starts in 30 minutes and leaves a `ppm stop --kill` alone.
|
|
8
|
+
- **Low memory notification**: under 15 GB free it names the chat whose processes grew fastest and what PPM released; a second one goes out under 10 GB.
|
|
9
|
+
- **Quiet chats give their memory back**: a chat idle for 60 minutes between turns releases its Claude process and the MCP servers under it, and under 10 GB free the longest-quiet ones go first.
|
|
10
|
+
- **Heavy commands wait their turn**: a chat's test run, type check, build or e2e is refused while memory is low and waits (up to 5 minutes) while another heavy job runs on the machine.
|
|
11
|
+
- **The three memory thresholds (15 / 10 GB, 60 minutes) are in Settings → AI Provider.**
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **A supervisor restart keeps the tunnel and its URL**: a new supervisor adopts the previous one's tunnel and edge, and `ppm start`/`ppm restart` no longer kill a live tunnel left behind.
|
|
16
|
+
- **Health checks do not kill a PPM that is only paging** while the machine is out of memory.
|
|
17
|
+
- **A pid reused after a reboot is no longer mistaken for PPM's own** (Windows Fast Startup), so start-up neither kills a stranger nor refuses to start.
|
|
18
|
+
|
|
3
19
|
## [0.26.25] - 2026-11-21
|
|
4
20
|
|
|
5
21
|
### Fixed
|
package/CLAUDE.md
CHANGED
|
@@ -362,6 +362,7 @@ Before planning or implementing a new feature, read `docs/project-roadmap.md` to
|
|
|
362
362
|
- A pid names its Services row through `serviceKeyFromCgroup` in `system-services/app-cgroup-linux.ts`, which answers `"<scope>:<unit>"`. Three traps, all silent: the **innermost** unit wins (a user service nests under `user@1000.service`, so the outer one would put every desktop process on one row); living under `/user.slice/` does **not** make a unit a user one (`session-2.scope` and `user@1000.service` are both system units); and the scope is part of the key because `dbus-broker.service` exists in **both** scopes on an ordinary desktop. The Services page then sums the tick's own process rows in the browser (`services/service-resources.ts`) rather than recomputing rates in the services route, which has no counter state and would give one process two different figures on two pages of one window. A fourth trap lives on that side: a unit with no rows is only an em dash if it OUGHT to have processes, and neither `ActiveState` nor `SubState` answers that alone — systemd calls a mount `active (mounted)`, a finished oneshot `active (exited)` and a **listening socket `running`**, so going by the first dashed 97 of this host's 222 rows and going by the second still dashed 14. `resourcesFor` requires `SubState === "running"` **and** a `.service`/`.scope` unit, because a socket's processes live in the service it activates and its own `MainPID` is empty.
|
|
363
363
|
- **`os.cpus()` cannot express a core that is blocked on I/O**, and the failure is a *confident wrong number* rather than a gap: libuv's Linux `uv_cpu_info` reads the `iowait`, `softirq` and `steal` columns of `/proc/stat` into a throwaway, so a core parked in iowait reports a tiny total delta with no idle in it and `(total-idle)/total` comes out **100%** — one bar of the Overview per-core strip drew solid red, every tick, for a thread that was 3% busy behind a 191 MB/s write. `cpu-memory-collector.ts` samples `/proc/stat` itself (`parseProcStatCores`) and keeps `os.cpus()` as the off-Linux fallback; iowait is folded into not-busy the way `top` and Mission Center both have it, and softirq is counted as kernel time rather than dropped from the total. Do **not** also add `guest`/`guest_nice`: the kernel already counts them inside `user`/`nice`, so summing them deflates every percentage on a host running VMs. The whole-machine `total` hid this — one core's 6-jiffy window barely moves a sum over 24 — so verify per-core figures against `/proc/stat` directly, never against the total.
|
|
364
364
|
- The contract everywhere here is **`undefined` = cannot measure**, and the UI renders that as an em dash. Never substitute `0`: "this GPU has no dedicated memory" and "this GPU has 0 MB of memory" are different claims, and `tests/unit/web/overview-gpu-card-vram.test.tsx` pins the difference.
|
|
365
|
+
- Memory guard and self-restart (after 20/11/2026, when a chat's jest exhausted Windows' commit and the server and supervisor died in the same second with no log line): `system-commit.ts` reads free commit (Windows commit charge over FFI; Linux `MemAvailable` + free swap). The server's watchdog writes its last readings to `memory-pulse/<server pid>.json` (`memory-pulse.ts`, every 15 s under the warn threshold), and `memory-guard/` acts on each: `idle-subprocess-release.ts` + `releaseQuietSubprocesses` in `ws/chat.ts` release quiet chats' CLIs (tab open or not), `low-memory-alert.ts` sends the `memory` notification, and `heavy-command-gate.ts` holds a heavy shell command in the Claude PreToolUse hook (`buildToolHooks`' `heavyGate`) under the block threshold or while another heavy job runs anywhere on the machine. On Windows a released CLI's MCP servers are ended by `cli-leftover-reaper.ts` (pid + start time). The supervisor waits out an out-of-memory exit (`supervisor-memory-guard.ts`), and a supervisor that finds its predecessor dead names why (`restart-news/previous-run-death.ts`, kind `oom`) and adopts its live edge and tunnel; `ppm restart`/`start` no longer kill them (`supervisor-watchdog/leftover-recovery.ts`). Windows' autostart task runs `__ensure_supervisor__` at logon and every 2 minutes (`supervisor-watchdog/`), re-registered by the supervisor when `autostart.json`'s `taskVersion` is older. Thresholds `ai.memory_warn_free_gb` (15), `ai.memory_block_free_gb` (10), `ai.idle_cli_release_minutes` (60) in Settings → AI Provider (`src/shared/memory-guard.ts`)
|
|
365
366
|
- `src/services/db-backup/` — verified `VACUUM INTO` snapshots of `ppm.db` (hourly + at start + before every migration), GFS retention, `ppm backup` / `ppm restore`
|
|
366
367
|
- `src/services/chat-session-processes/` — stops what a chat left running: each command of a chat's Claude CLI runs in a `ppmcmd-*.scope` under `app-ppmchat-<instance>-<session>.slice`, a sweep every minute stops what idle sessions left behind (never a live command or MCP server), deleting a chat stops its whole slice. Setting in Settings → AI Provider
|
|
367
368
|
- `src/services/schedules-overview.ts` + `src/shared/schedule-attention.ts` + `src/web/components/schedules/` — the Schedules window: every schedule of every project from the rail's footer (a tile in the phone drawer), its count of runs in the next 24 h and red dot for a failed, stuck, paused or long-waiting one (Dismiss stores the problem's key in `schedules.attention_dismissed`). `GET /api/schedules` answers overviews (newest run, project, `effective_permission_mode` — a reminder runs in its chat's mode, never the row's unused column — and task); one shared browser list in `src/web/stores/schedules-overview-store.ts`. Task reminders are session schedules a task owns (`schedules.task_id`, `src/services/task-reminders/`, `POST /api/tasks/:id/reminders`), deleted when the task closes. Docs `docs/architecture/schedules.md` → The Schedules window, Task reminders; e2e `tests/e2e/schedules-rail-e2e.mjs`
|
|
@@ -83,4 +83,4 @@ This skill covers the `ppm` CLI, its HTTP API, and its config DB. It does **not*
|
|
|
83
83
|
- Third-party extensions (inspect via `ppm ext list`).
|
|
84
84
|
- The Claude Agent SDK internals (separate skill).
|
|
85
85
|
|
|
86
|
-
<!-- Generated for PPM v0.26.
|
|
86
|
+
<!-- Generated for PPM v0.26.26 at build time. Re-run `ppm export skill --install` to refresh. -->
|
|
@@ -1622,7 +1622,7 @@ Show the events, the delay and the channels
|
|
|
1622
1622
|
|
|
1623
1623
|
### `ppm notify set`
|
|
1624
1624
|
|
|
1625
|
-
Switch an event (done, approval_request, question, collab_approval, schedule, schedule_created, jira, design_review, extension) or a channel (telegram, ntfy) on or off
|
|
1625
|
+
Switch an event (done, approval_request, question, collab_approval, schedule, schedule_created, jira, design_review, extension, memory) or a channel (telegram, ntfy) on or off
|
|
1626
1626
|
|
|
1627
1627
|
**Usage:** `ppm notify set [options] <event> <state>`
|
|
1628
1628
|
|
|
@@ -898,4 +898,4 @@ Authenticate with `?token=<token>` (see Authentication).
|
|
|
898
898
|
- `/ws/android`
|
|
899
899
|
- `/ws/project/<project>/<type>/<id>` — `<type>`: `terminal`, `chat`, `group`, `lsp` (for `chat`, `<id>` is the session id)
|
|
900
900
|
|
|
901
|
-
<!-- Generated from src/server/routes/ for PPM v0.26.
|
|
901
|
+
<!-- Generated from src/server/routes/ for PPM v0.26.26 -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{At as r,Er as i,Sn as a,Xr as o,Y as s,gr as c,gt as l,ht as u,lr as d,pi as f,ti as p,un as m,ut as h,vr as g,wn as _}from"./icons-CpR5Vw3J.js";import{a as v,r as y}from"./api-client-DSCscZEd.js";import{n as b}from"./utils-DMiycH3O.js";import"./portal-container-context-C84rlnJ6.js";import{i as x,n as S,t as C}from"./tooltip-CECVgROB.js";import{t as w}from"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import{n as T}from"./use-is-mobile-CrfIt67b.js";import{r as E,t as D}from"./button-CtdEWN7U.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./dialog-BWXzvHlC.js";import"./chat-preparation-cache-D6KJ1ZMi.js";import"./provider-logos-zWlJBGXd.js";import{t as P}from"./provider-selector-CpYLloT9.js";import{r as F}from"./clipboard-DQuoK2EM.js";import{t as I}from"./input-CCVoN0-P.js";import"./control-size-CT_5bmhe.js";import{S as L,a as ee,b as R,g as z,h as te,m as ne,o as re,r as B,v as ie,y as V}from"./api-settings-QpHmzgdx.js";import{Ar as H,Gn as ae,Jn as oe,Kn as U,Wn as W,Yn as G,qn as se}from"./index-hkWEyYns.js";import{C as K,E as q,O as ce,S as le,_ as J,a as ue,b as Y,c as X,d as de,g as fe,h as pe,i as me,j as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce,w as we,x as Te,y as Ee}from"./antigravity-usage-view-CE1g-eZl.js";var Z=e(t(),1),Q=n(),De=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Oe=Array.from({length:24},(e,t)=>t);function ke(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function Ae(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function je(e){return Oe.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function Me(e){return e===0?`bg-surface-elevated`:e<.3?`bg-success/30`:e<.5?`bg-success/60`:e<.7?`bg-warning/50`:e<.9?`bg-warning/80`:`bg-error/80`}function Ne(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function Pe({accountId:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(!0),[o,s]=(0,Z.useState)(`5h`);(0,Z.useEffect)(()=>{i(!0),ne(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let c=(0,Z.useMemo)(()=>t?ke(t,o):null,[t,o]),l=(0,Z.useMemo)(()=>c?Ae(c):[],[c]),u=(0,Z.useMemo)(()=>c?je(c):[],[c]),d=Math.max(...l,.01);if(Math.max(...u,.01),r)return(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,Q.jsx)(a,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,Q.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let f=t.length,p=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,Q.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,Q.jsx)(`button`,{onClick:()=>s(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${o===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,Q.jsx)(`button`,{onClick:()=>s(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${o===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,Q.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,o===`5h`?`5-hour`:`weekly`,` limit usage over `,p,`d (`,f,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:De.map((e,t)=>{let n=l[t]??0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,Q.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Ne(n)}`,style:{width:`${Math.round(n/d*100)}%`}})}),(0,Q.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,Q.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:Oe.map(e=>{let t=u[e]??0;return(0,Q.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,Q.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${Me(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,Q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),c&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[De.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,Q.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),Oe.map(n=>{let r=c[t][n];return(0,Q.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${Me(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,Q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,Q.jsx)(`span`,{className:`w-4 shrink-0`}),Oe.map(e=>(0,Q.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,Q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,Q.jsx)(`span`,{children:`Low`}),(0,Q.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,Q.jsx)(`span`,{children:`High`}),(0,Q.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,Q.jsx)(`span`,{children:`No data`})]})]})}function Fe({profile:e,accountId:t,onClose:n}){let r=[[`Name`,e.account?.display_name],[`Email`,e.account?.email],[`Org`,e.organization?.name],[`Type`,e.organization?.organization_type],[`Tier`,e.organization?.rate_limit_tier],[`Status`,e.organization?.subscription_status]];return(0,Q.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,Q.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,Q.jsx)(f,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,Q.jsxs)(`span`,{className:`contents`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,Q.jsx)(Pe,{accountId:t})]})}function Ie({display:e,onConfirm:t,onCancel:n}){let r=T(),i=(0,Q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`The stored token is deleted from this machine. Any export you already made keeps working.`}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,Q.jsx)(D,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,Q.jsx)(D,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,Q.jsx)(w,{open:!0,onClose:n,children:(0,Q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,Q.jsx)(N,{open:!0,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,Q.jsx)(O,{children:(0,Q.jsx)(j,{className:`text-sm`,children:`Remove account`})}),i]})})}var Le=80;function Re({current:e,onSave:t,onCancel:n}){let r=T(),[i,o]=(0,Z.useState)(e),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),d=i.trim(),f=!!d&&d!==e&&!s,p=async()=>{if(f){c(!0),u(null);try{await t(d)}catch(e){u(e.message||`Could not rename the account`),c(!1)}}},m=()=>{s||n()},h=(0,Q.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,Q.jsx)(I,{autoFocus:!0,value:i,maxLength:Le,onChange:e=>o(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),l&&(0,Q.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:l}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,Q.jsx)(D,{type:`button`,variant:`outline`,onClick:m,disabled:s,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,Q.jsxs)(D,{type:`submit`,disabled:!f,className:`min-h-11 md:min-h-9`,children:[s&&(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,Q.jsx)(w,{open:!0,onClose:m,children:(0,Q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),h]})}):(0,Q.jsx)(N,{open:!0,onOpenChange:e=>{e||m()},children:(0,Q.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,Q.jsx)(O,{children:(0,Q.jsx)(j,{className:`text-sm`,children:`Rename account`})}),h]})})}function ze(e){return(e?.grants??[]).reduce((e,t)=>e+t.resetsLeft,0)}var Be={session:`5-hour reset`,fable:`Fable reset`,full:`full reset`,weekly:`weekly reset`},$=(e,t=!1)=>t?Be[e][0].toUpperCase()+Be[e].slice(1):Be[e],Ve={five_hour:`5-hour limit`,seven_day:`weekly limit`,seven_day_opus:`Opus weekly limit`,seven_day_sonnet:`Sonnet weekly limit`},He=(e,t)=>e.clears.includes(t)||t===`seven_day`&&e.givesBackWeekly;function Ue(e,t,n=Date.now()){let r=!!t.cooldownUntil&&Date.parse(t.cooldownUntil)>n;if(e.usableNow&&!e.paused&&e.resetsLeft>0&&!r)return null;if(e.paused)return`it is paused`;if(e.resetsLeft===0)return`none left`;switch(e.unavailableReason??(r?`cooldown`:void 0)??e.blocking.map(e=>({five_hour:`blocked_five_hour`,seven_day:`blocked_seven_day`,seven_day_opus:`blocked_opus`,seven_day_sonnet:`blocked_sonnet`})[e]).find(Boolean)??(e.blocking.length?`blocked_other`:void 0)??(t.atLimit&&!t.exhausted.some(t=>He(e,t))?`cannot_clear`:void 0)??(e.useRequiresLimit?`needs_limit`:`unavailable`)){case`cooldown`:return`a reset was just used, try again in a minute`;case`blocked_five_hour`:return`can't be used while you're at your ${Ve.five_hour}`;case`blocked_seven_day`:return`can't be used while you're at your ${Ve.seven_day}`;case`blocked_opus`:return`can't be used while you're at your ${Ve.seven_day_opus}`;case`blocked_sonnet`:return`can't be used while you're at your ${Ve.seven_day_sonnet}`;case`blocked_other`:return`can't be used while you're at another limit it doesn't refill`;case`cannot_clear`:return`doesn't refill the limit you've reached`;case`needs_limit`:return`usable once you reach a limit it refills`;default:return`can't be used right now`}}function We(e){let t=new Set;e.givesBackWeekly&&t.add(`Fable`);for(let n of e.clears)n===`five_hour`?t.add(`5-hour`):n===`seven_day`?t.add(`weekly`):n===`seven_day_overage_included`?t.add(e.givesBackWeekly?`Fable`:`weekly`):n===`seven_day_opus`?t.add(`Opus weekly`):n===`seven_day_sonnet`&&t.add(`Sonnet weekly`);let n=[...t],r=n.pop();return r?n.length?`${n.join(`, `)} and ${r} limits`:`${r} limit`:`limits`}function Ge(e,t){if(t.exhausted.some(t=>He(e,t)))return null;let n=$(e.kind),r=null;for(let t of e.clears){let n=e.percentUsed[t];n!==void 0&&(r===null||n>r.used)&&(r={limit:t,used:n})}let i=r&&Ve[r.limit];return r&&i&&r.used<100?`You still have ${100-r.used}% of your ${i} left. Use your ${n} anyway?`:`You haven't reached a limit yet. Use your ${n} anyway?`}function Ke(e,t,n={}){let r=n.kind?$(n.kind):`reset`;switch(t){case`reset`:return`${e}: ${n.kind===`fable`?`Fable reset used. What Fable used is back in your weekly limit`:n.kind===`session`?`5-hour limit reset`:n.kind===`weekly`?`Weekly limits reset`:`Limits reset`}.${n.weeklyResetsAt?` Your weekly reset day stays ${new Date(n.weeklyResetsAt).toLocaleString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}.`:``}${typeof n.resetsLeft==`number`?` ${n.resetsLeft===0?`No`:n.resetsLeft} ${r}${n.resetsLeft===1?``:`s`} left.`:``}`;case`already_used`:return`${e}: that ${r} had already been used.`;case`not_limited`:return`${e}: nothing needed resetting, so the ${r} was kept.`;case`cooldown`:return`${e}: a reset was used moments ago. Nothing was used; try again in a minute.`;case`ineligible`:return`${e}: Anthropic no longer offers this account limit resets. Nothing was used.`;case`rate_limited`:return`${e}: Anthropic is turning requests away for now. Nothing was used; try again in a minute.`;case`auth_error`:return`${e}: Anthropic refused the account's sign-in. Nothing was used; sign in again and retry.`;case`unavailable`:return n.reason===`reset_unconfirmed`||n.reason===`stamp_indeterminate`?`${e}: couldn't confirm the reset went through. If the limits are not refilled in a moment, try again.`:`${e}: couldn't reset the limits${n.reason?` (${n.reason.replace(/_/g,` `)})`:``}. Nothing was used; try again in a moment.`;default:return`${e}: couldn't tell whether the reset went through. Check the limits in a moment before trying again.`}}function qe(e){let t=e.givesBackWeekly?` and gives back what Fable used of your weekly limit. It doesn't reset your whole week`:``;return`Refills your ${We(e)}${t}. Your weekly reset day stays the same.`}function Je(e){let t=new Map;for(let n of e){let e=`${n.kind}|${n.endsAt??``}`,r=t.get(e)??{kind:n.kind,count:0,endsAt:n.endsAt};r.count+=n.resetsLeft,t.set(e,r)}return[...t].map(([e,t])=>({key:e,title:(0,Q.jsxs)(Q.Fragment,{children:[$(t.kind,!0),t.count>1&&(0,Q.jsxs)(`span`,{className:`text-text-subtle`,children:[` ×`,t.count]})]}),expiresAt:t.endsAt}))}function Ye({account:e,resets:t,onDone:n}){let[r,i]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u=(t?.grants??[]).filter(e=>e.resetsLeft>0);if(!t||!u.length)return(0,Q.jsx)(K,{count:0,lines:[],usable:!1,onOpen:()=>{}});let d=e=>Ue(e,t),f=()=>{c||(i(!1),s(null))};async function p(t){l(!0);try{let r=await y.post(`/api/accounts/${e.id}/limit-reset`,{grantId:t.id});n(Ke(e.label,r.result,r))}catch(e){n(e.message||`Could not use the reset`)}finally{l(!1),i(!1),s(null)}}let m=(0,Q.jsx)(`div`,{className:`space-y-2`,"data-testid":`claude-limit-resets`,children:u.map(e=>(0,Q.jsx)(le,{testId:`claude-reset-${e.id}`,title:(0,Q.jsxs)(Q.Fragment,{children:[$(e.kind,!0),e.resetsLeft>1&&(0,Q.jsxs)(`span`,{className:`text-text-subtle font-normal`,children:[` ×`,e.resetsLeft]})]}),detail:qe(e),expiresAt:e.endsAt,action:`Reset for free`,blockedReason:d(e),onUse:()=>s(e)},e.id))}),h=o&&(()=>{let n=$(o.kind),r=Ge(o,t);return(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-testid":`claude-limit-reset-confirm`,children:[(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Use `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,n,`?`]}),(0,Q.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,Q.jsx)(`li`,{children:qe(o)}),r&&(0,Q.jsx)(`li`,{className:`text-warning`,children:r}),(0,Q.jsxs)(`li`,{children:[o.resetsLeft>1?`${o.resetsLeft} of this kind left`:`The only one of this kind`,o.endsAt?`, use by ${q(o.endsAt)}`:``,`.`]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>s(null),disabled:c,className:`h-7 max-md:h-[26px]`,children:`Keep it`}),(0,Q.jsxs)(D,{onClick:()=>void p(o),disabled:c,className:`h-7 max-md:h-[26px] gap-1.5`,children:[c?(0,Q.jsx)(a,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),`Yes, use my `,n]})]})]})})(),_=ze(t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{count:_,lines:Je(u),usable:u.some(e=>!d(e)),onOpen:()=>i(!0)}),r&&(0,Q.jsx)(we,{title:o?`Use a ${$(o.kind)}?`:`Limit resets · ${_} available`,onClose:f,children:h||m})]})}function Xe(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function Ze({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:i}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,Z.useState)(new Set),[l,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(!1),[m,g]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1);e&&!x&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),S(!0)),!e&&x&&S(!1);function C(){t(!1),d(``),p(!1),g(!1)}async function w(e){if(s.size===0)return;b(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=v();r&&(n.Authorization=`Bearer ${r}`);let a=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:f,refreshBeforeExport:m})});if(!a.ok){let e=await a.json();throw Error(e.error??`Export failed: ${a.status}`)}let o=await a.text();e&&await F(o)?i?.(`Backup copied to clipboard!`):(Xe(o),i?.(`Backup downloaded.`)),C()}catch{}b(!1)}let T=s.size>0&&!y;return(0,Q.jsx)(N,{open:e,onOpenChange:e=>{e||C()},children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(_,{className:`size-3.5`}),` Export Accounts`]}),(0,Q.jsx)(M,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,Q.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===o.length?new Set:new Set(o.map(e=>e.id))),children:s.size===o.length?`Deselect all`:`Select all`})]}),o.length===0?(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,Q.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:s.has(e.id),onChange:t=>{let n=new Set(s);t.target.checked?n.add(e.id):n.delete(e.id),c(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(H,{className:`text-xs`,children:[`Password `,(0,Q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,Q.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>d(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>p(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:m,onChange:e=>g(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,Q.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):m?(0,Q.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,Q.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,Q.jsxs)(k,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:C,children:`Cancel`}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!0),children:[(0,Q.jsx)(h,{className:`size-3 mr-1`}),` Copy`]}),(0,Q.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!1),children:y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Qe({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null);function f(){t(!1),i(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await te({data:r.trim(),password:o.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,Q.jsx)(N,{open:e,onOpenChange:e=>{e||f()},children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(_,{className:`size-3.5`}),` Import Accounts`]}),(0,Q.jsx)(M,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{className:`text-xs`,children:`Backup data`}),(0,Q.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(H,{className:`text-xs`,children:[`Password `,(0,Q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,Q.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:o,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,Q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,Q.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var $e=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function et(e){return $e?.addEventListener(`change`,e),()=>$e?.removeEventListener(`change`,e)}function tt(){return $e?.matches??!0}function nt(){let[e,t]=(0,Z.useState)(null),[n,r]=(0,Z.useState)(!0);return(0,Z.useEffect)(()=>{r(!0),re().then(t).finally(()=>r(!1))},[]),n?(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,Q.jsxs)(W,{value:e.strategy,onValueChange:async e=>{t(await L({strategy:e}))},children:[(0,Q.jsx)(se,{className:`w-full h-9 text-xs`,children:(0,Q.jsx)(oe,{})}),(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(U,{value:`round-robin`,children:`Round-robin`}),(0,Q.jsx)(U,{value:`fill-first`,children:`Fill-first`}),(0,Q.jsx)(U,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,Q.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,Q.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await L({maxRetry:n}))}}),(0,Q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,Q.jsx)(G,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await L({cooldownEnabled:e}))}})]}),(0,Q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Park a failing account (rate limit / usage limit / auth error) until it recovers. Off: accounts stay selectable — rotation still skips accounts already ≥95% on the 5-hour limit.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,Q.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function rt({open:e,onOpenChange:t}){let n=(0,Z.useSyncExternalStore)(et,tt);return e?n?(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,Q.jsx)(O,{children:(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-2`,children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation & Retry`]})}),(0,Q.jsx)(nt,{})]})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,Q.jsxs)(`div`,{className:b(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,Q.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,Q.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,Q.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation & Retry`]}),(0,Q.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,Q.jsx)(f,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,Q.jsx)(nt,{})})]})]}):null}var it=E(`inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground shadow`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground shadow`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function at({className:e,variant:t,...n}){return(0,Q.jsx)(`div`,{className:b(it({variant:t}),e),...n})}function ot(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function st({accounts:e}){let[t,n]=(0,Z.useState)([]),[r,i]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(new Map),u=e.filter(e=>e.hasRefreshToken);async function d(){if(u.length!==0){i(!0);try{let e=await V(u.map(e=>e.id),o);n(t=>[...t,{round:t.length+1,time:new Date().toLocaleTimeString(),includeRefresh:o,items:e}])}catch{}i(!1)}}async function f(e,t){l(t=>new Map(t).set(e,{loading:!0}));try{let n=await R(t);l(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){l(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function p(e,t){return[{key:`r${e.round}-pre-${t.id}`,label:`Pre-export`,token:t.preExportTokenFull,preview:t.preExportToken,expires:t.preExportExpires},{key:`r${e.round}-exp-${t.id}`,label:`Exported`,token:t.exportedTokenFull,preview:t.exportedToken,expires:t.exportedExpires},{key:`r${e.round}-post-${t.id}`,label:`Post-export`,token:t.postExportTokenFull,preview:t.postExportToken,expires:t.postExportExpires}]}function m(){for(let e of t)for(let t of e.items)for(let n of p(e,t))n.token&&f(n.key,n.token)}return(0,Q.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every run appends a round. Earlier rounds are kept so tokens can be compared across runs.`}),u.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(G,{id:`sim-include-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,Q.jsx)(H,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,Q.jsx)(D,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void d(),children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:m,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,Q.jsx)(at,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,Q.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,Q.jsx)(at,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),p(e,t).map(e=>{let t=c.get(e.key);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,Q.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,Q.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:ot(e.expires)}),e.token?(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void f(e.key,e.token),children:t?.loading?(0,Q.jsx)(a,{className:`size-3 animate-spin`}):`Test`}):(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,Q.jsx)(`span`,{className:`text-[10px] font-medium shrink-0 ${t.status?.startsWith(`valid`)?`text-success`:`text-error`}`,children:t.status})]},e.key)})]},`r${e.round}-${t.id}`))]},e.round))]})]})}function ct(e){let t=Math.floor(Date.now()/1e3),n=Math.floor(Math.abs(e-t)/60);return e>t?`${n}m left`:`expired ${n}m ago`}function lt({open:e,onOpenChange:t,accounts:n}){let[i,o]=(0,Z.useState)(new Map),[s,c]=(0,Z.useState)(!1);async function l(e){o(t=>new Map(t).set(e,{loading:!0}));try{let t=await ie(e,s);o(n=>new Map(n).set(e,{loading:!1,result:t}))}catch(t){o(n=>new Map(n).set(e,{loading:!1,error:t.message}))}}function u(){for(let e of n.filter(e=>e.expiresAt!==null))l(e.id)}return(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,Q.jsx)(M,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(G,{id:`token-test-refresh`,checked:s,onCheckedChange:c,className:`cursor-pointer`}),(0,Q.jsx)(H,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:u,children:`Test all`})]})]}),n.length===0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,Q.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ct(e.expiresAt)})]}),(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void l(e.id),children:t?.loading?(0,Q.jsx)(a,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,Q.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,Q.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,Q.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,Q.jsx)(st,{accounts:n})]}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function ut(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:o,refreshing:s,flashIds:c,reload:l}=fe(),[f,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(null),[E,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(void 0);function j(e){l(),e&&h(e)}async function M(e,t){_(e);try{await z(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){h(e.message)}_(null),l()}async function N(){if(v){try{await B(v.id),h(`Account "${v.display}" removed.`),l()}catch(e){h(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){b&&(await z(b.id,{label:e}),x(null),h(`Account renamed to "${e}".`),l())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(ve,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void l(),refreshing:s,disabled:o,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),O(`add`)},children:[(0,Q.jsx)(d,{className:`size-4`}),` Add account`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{T(null),O(`export`)},children:[(0,Q.jsx)(u,{className:`size-4`}),` Export`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`import`),children:[(0,Q.jsx)(p,{className:`size-4`}),` Import`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`rotation`),children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`token-test`),children:[(0,Q.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,Q.jsx)(xe,{message:f,onDismiss:()=>h(null)}),(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,ce(new Date(I).getTime())]})]}),o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,Q.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,Q.jsx)(me,{children:e.map(e=>(0,Q.jsx)(be,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:g===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>x({id:e,current:t}),onExport:e=>{T(e),O(`export`)},onViewProfile:(e,t)=>C({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),O(`add`)},flash:c.has(e.accountId),resetCreditAction:(0,Q.jsx)(Ye,{account:{id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)},resets:e.usage.limitResets,onDone:e=>{h(e),l()}})},e.accountId))})]}),S&&(0,Q.jsx)(Fe,{profile:S.profile,accountId:S.accountId,onClose:()=>C(null)}),v&&(0,Q.jsx)(Ie,{display:v.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),b&&(0,Q.jsx)(Re,{current:b.current,onSave:P,onCancel:()=>x(null)}),(0,Q.jsx)(Te,{open:E===`add`,onOpenChange:e=>{O(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:k}),(0,Q.jsx)(Ze,{open:E===`export`,onOpenChange:e=>{O(e?`export`:null),e||T(null)},accounts:t,preselectId:w,onMessage:h}),(0,Q.jsx)(Qe,{open:E===`import`,onOpenChange:e=>O(e?`import`:null),onSuccess:j}),(0,Q.jsx)(rt,{open:E===`rotation`,onOpenChange:e=>O(e?`rotation`:null)}),(0,Q.jsx)(lt,{open:E===`token-test`,onOpenChange:e=>O(e?`token-test`:null),accounts:t})]})}function dt({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:i,onExport:o,onImport:s,error:c}){let l=(0,Z.useRef)(null),d=e===`export`;return(0,Q.jsx)(N,{open:e!==null,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(_,{className:`size-4`}),` `,d?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:d?`Writes a password-encrypted file containing each account's login.`:`Reads a backup file. The password must be the one it was exported with.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,Q.jsx)(I,{id:`codex-backup-password`,type:`password`,placeholder:d?`Choose a password`:`Password used for the export`,value:n,onChange:e=>r(e.target.value),className:`text-xs`,autoComplete:d?`new-password`:`current-password`}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),c&&(0,Q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:c}),(0,Q.jsx)(`input`,{ref:l,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsxs)(D,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||i,onClick:()=>d?o():l.current?.click(),children:[i?(0,Q.jsx)(a,{className:`size-3.5 animate-spin`}):d?(0,Q.jsx)(u,{className:`size-3.5`}):(0,Q.jsx)(p,{className:`size-3.5`}),d?`Download backup`:`Choose file`]})]})]})})}var ft=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function pt({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`text-sm`,children:`Codex Rotation`}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:ft.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function mt(e){return e==null?null:Math.round(e*100)}function ht({usage:e}){let t=e.session==null&&e.weekly==null;return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,Q.jsx)(Ce,{label:`5-Hour Session`,pct:mt(e.fiveHour),reset:he(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,Q.jsx)(Ce,{label:`Weekly`,pct:mt(e.sevenDay),reset:he(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function gt(e){let t=e=>Math.round((e??0)*100)>=100;return t(e.session?.utilization)||t(e.weekly?.utilization)}var _t={reset:e=>`${e}: limits reset to 0%. The weekly reset date now counts from your next use.`,nothingToReset:e=>`${e}: nothing needed resetting, so the reset was kept.`,noCredit:e=>`${e} has no free reset left.`,alreadyRedeemed:e=>`${e}: that reset had already been used.`},vt=`Usable once a limit is reached: a reset moves the weekly reset date, so spending one earlier wastes what is left of the window.`;function yt(e){return e.credits?.length?e.credits:Array.from({length:e.available},(t,n)=>n===0?{id:e.nextCreditId,title:e.title,expiresAt:e.nextExpiresAt}:{title:e.title})}function bt({account:e,usage:t,onDone:n}){let[r,i]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u=t.resetCredits;if(!u||u.available===0)return(0,Q.jsx)(K,{count:0,lines:[],usable:!1,onOpen:()=>{}});let d=yt(u),f=gt(t),p=()=>{c||(i(!1),s(null))};async function m(t){l(!0);try{let r=await y.post(`/api/codex-accounts/${e.id}/reset-credit`,t.id?{creditId:t.id}:{});n(_t[r.outcome]?.(e.label)??`${e.label}: ${r.outcome}`)}catch(e){n(e.message||`Could not use the reset`)}finally{l(!1),i(!1),s(null)}}let h=t.weekly?.resetsAt?q(t.weekly.resetsAt):null,_=o&&(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-testid":`codex-reset-credit-confirm`,children:[(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Use 1 of `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,u.available,` free reset`,u.available===1?``:`s`,`?`]}),(0,Q.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,Q.jsxs)(`li`,{children:[o.title??`Full reset`,`: the 5-hour and weekly usage go back to 0% now.`]}),(0,Q.jsxs)(`li`,{children:[`The weekly reset date moves: the next one is about 7 days after you continue using Codex`,h?`, not ${h} as now`:``,`. You do not also get that one.`]}),o.expiresAt&&(0,Q.jsxs)(`li`,{children:[`This reset expires `,q(o.expiresAt),`.`]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>s(null),disabled:c,className:`h-7 max-md:h-[26px]`,children:`Keep it`}),(0,Q.jsxs)(D,{onClick:()=>void m(o),disabled:c,className:`h-7 max-md:h-[26px] gap-1.5`,children:[c?(0,Q.jsx)(a,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),`Use reset`]})]})]});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{count:u.available,lines:d.map((e,t)=>({key:e.id??String(t),title:e.title??`Full reset`,expiresAt:e.expiresAt})),usable:f,onOpen:()=>i(!0)}),r&&(0,Q.jsx)(we,{title:o?`Use a free reset`:`Free resets · ${u.available} available`,onClose:p,children:_||(0,Q.jsxs)(`div`,{className:`space-y-2`,"data-testid":`codex-reset-credits`,children:[!f&&(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:vt}),d.map((e,t)=>(0,Q.jsx)(le,{title:e.title??`Full reset`,detail:`Resets the 5-hour and weekly usage to 0%. The weekly reset date then counts from your next use.`,expiresAt:e.expiresAt,action:`Use reset`,blockedReason:f?null:!0,onUse:()=>s(e)},e.id??t))]})})]})}var xt=1440*60*1e3,St=7,Ct=5;function wt(e,t=Date.now()){if(!e||e.windowHours!==168)return null;let n=new Date(e.resetsAt).getTime();if(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=n-St*xt;if(t<r)return null;let i=Math.min(St-1,Math.floor((t-r)/xt)),a=0;for(let e=0;e<=i;e++){let t=new Date(r+e*xt).getUTCDay();t!==0&&t!==6&&a++}let o=a/Ct;return{day:a,cap:o,used:e.utilization,blocked:e.utilization>=o}}function Tt(){let[e,t]=(0,Z.useState)(null),n=Ee(()=>t(null)),[r,c]=(0,Z.useState)(null);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(ve,{description:(0,Q.jsxs)(Q.Fragment,{children:[`Each Codex account keeps its own login (`,(0,Q.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,Q.jsx)(d,{className:`size-4`}),` Add account`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,Q.jsx)(u,{className:`size-4`}),` Export`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,Q.jsx)(p,{className:`size-4`}),` Import`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation`]})]})}),(0,Q.jsx)(xe,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,Q.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,Q.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,Q.jsx)(me,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,Q.jsxs)(ue,{dense:!0,className:`flex flex-col min-w-[300px] shrink-0 snap-start${e.signedOut?` opacity-60`:``}`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,Q.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`Codex rejected this account's login (revoked or expired), so no turn can run on it and it is skipped. The usage shown is the last reading. Click to sign in again — the account keeps its settings and chats.`,onClick:e.type===`chatgpt`?()=>c(e):void 0,children:`Sign in again`}),(0,Q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),pe(e.planType)&&(0,Q.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:pe(e.planType)}),(0,Q.jsx)(G,{checked:e.status!==`disabled`,onCheckedChange:()=>void n.toggle(e.id,e.status??`active`),disabled:n.toggling.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void n.remove(e.id),"aria-label":`Remove account`,className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,Q.jsx)(o,{className:`size-4`})})}),(0,Q.jsx)(S,{side:`top`,children:`Remove account`})]})]}),(0,Q.jsx)(ht,{usage:t}),t.session==null&&(()=>{let r=wt(t.weekly);return r?(0,Q.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${e.dailyGuardEnabled&&r.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,Q.jsx)(`span`,{children:`Daily guard`}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,Q.jsx)(s,{className:`size-3.5`})})}),(0,Q.jsx)(S,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays. Turn it off any time to use the remaining quota freely.`})]})]}),(0,Q.jsx)(`p`,{className:`text-[10px] tabular-nums ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-subtle`}`,children:e.dailyGuardEnabled&&r.blocked?`${Math.round(r.used*100)}% used / ${Math.round(r.cap*100)}% daily cap. New turns paused.`:`Weekday ${r.day}/5, ${Math.round(r.cap*100)}% daily cap`})]}),(0,Q.jsxs)(`span`,{className:`hidden`,title:`Weekday ${r.day}/5: hold weekly usage at or below ${Math.round(r.cap*100)}% to last until reset.`,children:[`Daily guard `,e.dailyGuardEnabled?`· Weekday ${r.day}/5 cap ${Math.round(r.cap*100)}%`:``]}),(0,Q.jsx)(G,{checked:!!e.dailyGuardEnabled,onCheckedChange:()=>void n.toggleDailyGuard(e.id,!!e.dailyGuardEnabled),disabled:n.toggling.has(e.id),"aria-label":e.dailyGuardEnabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}):null})(),(0,Q.jsx)(`div`,{className:`mt-auto`,children:(0,Q.jsx)(bt,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})})]},e.id)})})]}),(0,Q.jsx)(Y,{open:e===`add`,onOpenChange:e=>{e||n.cancelLogin(),t(e?`add`:null)},label:n.label,onLabelChange:n.setLabel,apiKey:n.apiKey,onApiKeyChange:n.setApiKey,adding:n.adding,onAddApiKey:()=>void n.addApiKey(),deviceWaiting:n.deviceWaiting,onStartDevice:()=>void n.startDevice(),device:n.device,browser:n.browser,onStartBrowser:()=>void n.startBrowser(),loginStarting:n.loginStarting,callbackUrl:n.callbackUrl,onCallbackUrlChange:n.setCallbackUrl,submittingCallback:n.submittingCallback,onSubmitCallback:()=>void n.submitCallback(),error:n.err}),(0,Q.jsx)(dt,{mode:e===`export`?`export`:e===`import`?`import`:null,onOpenChange:e=>{e||t(null)},password:n.backupPassword,onPasswordChange:n.setBackupPassword,busy:n.exporting||n.importing,onExport:()=>void n.doExport(),onImport:e=>void n.doImport(e),error:n.err}),r&&(0,Q.jsx)(J,{account:r,onClose:()=>c(null),onDone:()=>void n.load()}),(0,Q.jsx)(pt,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var Et=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function Dt(e){return e==null?null:Math.round(e*100)}function Ot(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)(`round-robin`),[s,u]=(0,Z.useState)({}),[f,p]=(0,Z.useState)(!0),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(new Set),[E,P]=(0,Z.useState)(null),[F,L]=(0,Z.useState)(null),[ee,R]=(0,Z.useState)(``),[z,te]=(0,Z.useState)(null),[ne,re]=(0,Z.useState)(!1),[B,ie]=(0,Z.useState)(``),[V,ae]=(0,Z.useState)(!1),[oe,U]=(0,Z.useState)(null),W=(0,Z.useRef)(0),se=(0,Z.useRef)(!1),K=(0,Z.useRef)(!1),q=(0,Z.useRef)(null),le=(0,Z.useRef)(null),J=(0,Z.useCallback)(async()=>{p(!0),v(null);try{let e=await y.get(`/api/antigravity-accounts`);t(e.accounts),r(e.strategy),u(await y.get(`/api/antigravity-accounts/usage`))}catch(e){v(e.message)}finally{p(!1)}},[]);(0,Z.useEffect)(()=>{J()},[J]);let Y=(0,Z.useCallback)(()=>{W.current+=1,se.current=!1,K.current=!1,le.current?.(),le.current=null;let e=q.current;q.current=null,e&&y.del(`/api/antigravity-accounts/login/${e}`).catch(()=>{})},[]);(0,Z.useEffect)(()=>Y,[Y]);let X=(0,Z.useCallback)(()=>{Y(),te(null),re(!1),ie(``),ae(!1)},[Y]),de=(0,Z.useCallback)(()=>{X(),U(null),R(``),L(null),P(null)},[X]),fe=(0,Z.useCallback)(e=>{let t=Date.now()+61e4,n=!1,r;le.current=()=>{n=!0,clearTimeout(r)};let i=async()=>{if(n)return;let a=null;try{a=await y.get(`/api/antigravity-accounts/login/${e}/status`)}catch{}if(!n){if(a?.state===`done`){q.current=null,X(),U(null),R(``),L(null),P(null),g(`Antigravity Google account connected.`),await J();return}if(a?.state===`error`||Date.now()>t){q.current=null,X(),U(a?.state===`error`?a.error??`Login failed.`:`Login timed out.`);return}r=setTimeout(i,2e3)}};i()},[J,X]),pe=(0,Z.useCallback)(async e=>{if(se.current||q.current||K.current)return;se.current=!0;let t=++W.current;re(!0),U(null);try{let n=await y.post(`/api/antigravity-accounts/login`,{...ee.trim()?{label:ee.trim()}:{},...e?{accountId:e.id}:{}});if(t!==W.current){y.del(`/api/antigravity-accounts/login/${n.id}`).catch(()=>{});return}q.current=n.id,te(n),fe(n.id)}catch(e){t===W.current&&U(e.message)}finally{t===W.current&&(se.current=!1,re(!1))}},[ee,fe]),ge=(0,Z.useCallback)(async()=>{if(!z||!B.trim()||K.current)return;let e=W.current;K.current=!0,ae(!0),U(null);try{let t=await y.post(`/api/antigravity-accounts/login/${z.id}/callback`,{code:B.trim()});if(e!==W.current)return;if(t?.state===`error`){q.current=null,X(),U(t.error??`Login failed.`);return}if(t?.state!==`done`)return;q.current=null,X(),R(``),L(null),P(null),g(`Antigravity Google account connected.`),await J()}catch(t){e===W.current&&(q.current=null,X(),U(t.message))}finally{e===W.current&&(K.current=!1,ae(!1))}},[z,B,J,X]),ye=(0,Z.useCallback)(async(e,n)=>{T(t=>new Set(t).add(e)),v(null);try{let r=n===`disabled`?`active`:`disabled`;await y.patch(`/api/antigravity-accounts/${e}`,{status:r}),t(t=>t.map(t=>t.id===e?{...t,status:r}:t))}catch(e){v(e.message)}finally{T(t=>{let n=new Set(t);return n.delete(e),n})}},[]),be=(0,Z.useCallback)(async e=>{v(null);try{await y.del(`/api/antigravity-accounts/${e}`),t(t=>t.filter(t=>t.id!==e))}catch(e){v(e.message)}},[]),we=(0,Z.useCallback)(async e=>{v(null);try{await y.put(`/api/antigravity-accounts/strategy`,{strategy:e}),r(e)}catch(e){v(e.message)}},[]),Te=(0,Z.useCallback)(e=>{L(e),R(e.label),P(`add`)},[]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(ve,{description:(0,Q.jsxs)(Q.Fragment,{children:[`Each Antigravity account keeps its own Google OAuth login (`,(0,Q.jsx)(`code`,{children:`~/.ppm/antigravity-accounts`}),`) alongside your local IDE login (`,(0,Q.jsx)(`code`,{children:`~/.gemini`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void J(),refreshing:f,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{L(null),R(``),P(`add`)},children:[(0,Q.jsx)(d,{className:`size-4`}),` Add account`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>P(`rotation`),children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation`]})]})}),(0,Q.jsx)(xe,{message:h??_,onDismiss:()=>{g(null),v(null)}}),(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Antigravity Accounts`}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.replace(`-`,` `)})]}),f&&e.length===0?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,Q.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Antigravity accounts yet.`}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Click `,(0,Q.jsx)(`strong`,{children:`Add account`}),` to sign in with Google, or start Antigravity Desktop to auto-detect your local account.`]})]}):(0,Q.jsx)(me,{children:e.map(e=>{let t=Se(s[e.id]??{}),n=t.session==null&&t.weekly==null&&(!t.weeklyScoped||t.weeklyScoped.length===0),r=e.id===`default`;return(0,Q.jsxs)(ue,{dense:!0,className:`min-w-[320px] shrink-0 snap-start`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.label}),e.email&&e.email!==e.label&&(0,Q.jsx)(`div`,{className:`text-[11px] text-text-subtle truncate`,children:e.email})]}),(0,Q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:r?`~/.gemini`:`Google`}),e.planType&&(0,Q.jsx)(`span`,{className:`text-[10px] font-medium text-primary bg-primary/10 border border-primary/20 rounded px-1.5 py-0.5 shrink-0`,children:e.planType}),(0,Q.jsx)(G,{checked:e.status!==`disabled`,onCheckedChange:()=>void ye(e.id,e.status),disabled:w.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),!r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>Te(e),"aria-label":`Sign in again`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors shrink-0`,children:(0,Q.jsx)(c,{className:`size-3.5`})})}),(0,Q.jsx)(S,{side:`top`,children:`Sign in again`})]}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void be(e.id),"aria-label":`Remove account`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,Q.jsx)(o,{className:`size-4`})})}),(0,Q.jsx)(S,{side:`top`,children:`Remove account`})]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(n||t.session!=null)&&(0,Q.jsx)(Ce,{label:`Gemini · 5-Hour Session`,pct:Dt(t.fiveHour),reset:he(t.session),resetsAt:t.session?.resetsAt}),(n||t.weekly!=null)&&(0,Q.jsx)(Ce,{label:`Gemini · Weekly`,pct:Dt(t.sevenDay),reset:he(t.weekly),resetsAt:t.weekly?.resetsAt}),t.weeklyScoped?.map(e=>(0,Q.jsx)(Ce,{label:e.label,pct:Dt(e.utilization),reset:he(e),resetsAt:e.resetsAt},e.label))]}),t.lastFetchedAt&&_e(t.lastFetchedAt)&&(0,Q.jsxs)(`p`,{className:`text-[10px] text-warning`,children:[`Last read `,ce(Date.parse(t.lastFetchedAt)),`. Neither agy nor the Antigravity app has answered since.`]})]},e.id)})})]}),(0,Q.jsx)(N,{open:E===`add`,onOpenChange:e=>{e||de()},children:(0,Q.jsxs)(A,{className:`sm:max-w-md max-h-[90dvh] overflow-y-auto`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`text-sm`,children:F?`Sign in again — ${F.label}`:`Add Antigravity Account`}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:F?`Sign in with Google to refresh this account's OAuth credentials.`:`Sign in with a Google account using Antigravity's OAuth PKCE flow. Each account is stored in its own isolated directory.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[!F&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{htmlFor:`agy-label`,className:`text-xs`,children:`Label (optional)`}),(0,Q.jsx)(I,{id:`agy-label`,placeholder:`e.g. Personal, Work, Shopee 2`,value:ee,onChange:e=>R(e.target.value),disabled:ne||V,className:`text-xs`})]}),(0,Q.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium`,children:`Google OAuth Sign-In`}),z?(0,Q.jsxs)(`div`,{className:`space-y-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`a`,{href:z.authUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 font-medium text-primary hover:underline`,children:[(0,Q.jsx)(l,{className:`size-3.5`}),` Open Google Sign-In page`]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{X(),U(null)},disabled:V,className:`text-[11px] text-muted-foreground hover:text-foreground underline cursor-pointer`,children:`Start over`})]}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground leading-relaxed`,children:[`1. Open the link above and sign in with your Google account.`,(0,Q.jsx)(`br`,{}),`2. Copy the authorization code (or the full callback URL) shown after signing in and paste it below:`]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{htmlFor:`agy-auth-code`,className:`text-xs`,children:`Authorization Code or Callback URL`}),(0,Q.jsx)(I,{id:`agy-auth-code`,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:`4/0A... or https://antigravity.google/oauth-callback?code=...`,value:B,onChange:e=>ie(e.target.value),disabled:V,className:`text-xs font-mono`})]}),(0,Q.jsxs)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void ge(),disabled:!B.trim()||V,children:[V&&(0,Q.jsx)(a,{className:`size-3.5 animate-spin`}),`Verify & Save Account`]})]}):(0,Q.jsx)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void pe(F),disabled:ne,children:ne?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Generating Google sign-in link...`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-4`}),` Sign in with Google`]})})]})]}),oe&&(0,Q.jsx)(`div`,{role:`alert`,className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:oe}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:de,children:`Cancel`})})]})}),(0,Q.jsx)(N,{open:E===`rotation`,onOpenChange:e=>P(e?`rotation`:null),children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`text-sm`,children:`Antigravity Rotation`}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your enabled Antigravity accounts.`})]}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:Et.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void we(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>P(null),children:`Done`})})]})})]})}var kt=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`},{id:`antigravity`,label:`Antigravity`}];function At(){let[e,t]=(0,Z.useState)(null),[n,r]=(0,Z.useState)(()=>ge()),[i,o]=(0,Z.useState)(n?.provider??`claude`),s=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=()=>{let e=ge();e&&(o(e.provider),r(e))};return window.addEventListener(de,e),()=>window.removeEventListener(de,e)},[]),(0,Z.useEffect)(()=>{if(n)return ye(()=>s.current,n.accountId)},[n]),(0,Z.useEffect)(()=>{let e=!1;return ee().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let c=kt.filter(t=>t.id===`claude`||e?.has(t.id)),l=c.length>1;return(0,Q.jsxs)(`div`,{ref:s,className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":i,children:[l&&(0,Q.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:c.map(e=>(0,Q.jsxs)(`button`,{onClick:()=>o(e.id),"data-testid":`accounts-tab-${e.id}`,"aria-current":i===e.id?`page`:void 0,className:`flex items-center gap-1.5 px-3 py-2 text-xs rounded-t transition-colors cursor-pointer ${i===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,Q.jsx)(P,{providerId:e.id}),e.label]},e.id))}),e===null&&!l&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),i===`claude`?(0,Q.jsx)(ut,{}):i===`codex`?(0,Q.jsx)(Tt,{}):(0,Q.jsx)(Ot,{})]})}export{At as AccountsSettingsSection};
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{At as r,Er as i,Sn as a,Xr as o,Y as s,gr as c,gt as l,ht as u,lr as d,pi as f,ti as p,un as m,ut as h,vr as g,wn as _}from"./icons-CpR5Vw3J.js";import{a as v,r as y}from"./api-client-DSCscZEd.js";import{n as b}from"./utils-DMiycH3O.js";import"./portal-container-context-C84rlnJ6.js";import{i as x,n as S,t as C}from"./tooltip-CECVgROB.js";import{t as w}from"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import{n as T}from"./use-is-mobile-CrfIt67b.js";import{r as E,t as D}from"./button-CtdEWN7U.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./dialog-BWXzvHlC.js";import"./chat-preparation-cache-D6KJ1ZMi.js";import"./provider-logos-zWlJBGXd.js";import{t as P}from"./provider-selector-CpYLloT9.js";import{r as F}from"./clipboard-DQuoK2EM.js";import{t as I}from"./input-CCVoN0-P.js";import"./control-size-CT_5bmhe.js";import{S as L,a as ee,b as R,g as z,h as te,m as ne,o as re,r as B,v as ie,y as V}from"./api-settings-QpHmzgdx.js";import{Ar as H,Gn as ae,Jn as oe,Kn as U,Wn as W,Yn as G,qn as se}from"./index-CXjsAVvH.js";import{C as K,E as q,O as ce,S as le,_ as J,a as ue,b as Y,c as X,d as de,g as fe,h as pe,i as me,j as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce,w as we,x as Te,y as Ee}from"./antigravity-usage-view-C9gPFRb5.js";var Z=e(t(),1),Q=n(),De=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Oe=Array.from({length:24},(e,t)=>t);function ke(e,t){let n=Array.from({length:7},()=>Array.from({length:24},()=>({sum:0,count:0,avg:0})));for(let r of e){let e=t===`5h`?r.five_hour_util:r.weekly_util;if(e==null)continue;let i=new Date(r.recorded_at+(r.recorded_at.endsWith(`Z`)?``:`Z`)),a=(i.getDay()+6)%7,o=i.getHours();n[a][o].sum+=e,n[a][o].count+=1}for(let e of n)for(let t of e)t.avg=t.count>0?t.sum/t.count:0;return n}function Ae(e){return e.map(e=>{let t=e.reduce((e,t)=>e+t.sum,0),n=e.reduce((e,t)=>e+t.count,0);return n>0?t/n:0})}function je(e){return Oe.map(t=>{let n=0,r=0;for(let i of e)n+=i[t].sum,r+=i[t].count;return r>0?n/r:0})}function Me(e){return e===0?`bg-surface-elevated`:e<.3?`bg-success/30`:e<.5?`bg-success/60`:e<.7?`bg-warning/50`:e<.9?`bg-warning/80`:`bg-error/80`}function Ne(e){return e<.3?`bg-success`:e<.7?`bg-warning`:`bg-error`}function Pe({accountId:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(!0),[o,s]=(0,Z.useState)(`5h`);(0,Z.useEffect)(()=>{i(!0),ne(e).then(n).catch(()=>n([])).finally(()=>i(!1))},[e]);let c=(0,Z.useMemo)(()=>t?ke(t,o):null,[t,o]),l=(0,Z.useMemo)(()=>c?Ae(c):[],[c]),u=(0,Z.useMemo)(()=>c?je(c):[],[c]),d=Math.max(...l,.01);if(Math.max(...u,.01),r)return(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,Q.jsx)(a,{className:`size-3 animate-spin text-text-subtle`})});if(!t||t.length===0)return(0,Q.jsx)(`div`,{className:`text-[10px] text-text-subtle py-2 text-center`,children:`No usage history yet`});let f=t.length,p=new Set(t.map(e=>new Date(e.recorded_at+(e.recorded_at.endsWith(`Z`)?``:`Z`)).toDateString())).size;return(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-medium text-text-subtle`,children:`Usage Pattern (7d)`}),(0,Q.jsxs)(`div`,{className:`flex gap-0.5 text-[9px]`,children:[(0,Q.jsx)(`button`,{onClick:()=>s(`5h`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${o===`5h`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`5-hour rolling window limit — resets every 5 hours`,children:`5h`}),(0,Q.jsx)(`button`,{onClick:()=>s(`weekly`),className:`px-1.5 py-0.5 rounded cursor-pointer transition-colors ${o===`weekly`?`bg-primary/15 text-primary`:`text-text-subtle hover:text-text-secondary`}`,title:`Weekly limit — resets every 7 days`,children:`Wk`})]})]}),(0,Q.jsxs)(`p`,{className:`text-[9px] text-text-subtle leading-tight`,children:[`Avg `,o===`5h`?`5-hour`:`weekly`,` limit usage over `,p,`d (`,f,` samples). Higher % = closer to rate limit. Hover cells for details.`]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by day of week`}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px] mt-0.5`,children:De.map((e,t)=>{let n=l[t]??0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-[8px] text-text-subtle w-5 shrink-0 text-right tabular-nums`,children:e}),(0,Q.jsx)(`div`,{className:`flex-1 h-2.5 bg-surface-elevated rounded-sm overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-sm transition-all ${Ne(n)}`,style:{width:`${Math.round(n/d*100)}%`}})}),(0,Q.jsxs)(`span`,{className:`text-[8px] text-text-subtle w-6 shrink-0 text-right tabular-nums`,children:[Math.round(n*100),`%`]})]},e)})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Avg usage by hour (0h-23h)`}),(0,Q.jsx)(`div`,{className:`flex gap-[1px] mt-0.5`,children:Oe.map(e=>{let t=u[e]??0;return(0,Q.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-[1px]`,children:[(0,Q.jsx)(`div`,{className:`w-full aspect-square rounded-[2px] ${Me(t)}`,title:`${e}:00 — avg ${Math.round(t*100)}% usage`}),e%6==0&&(0,Q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})]},e)})})]}),c&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`text-[9px] text-text-subtle`,children:`Day x Hour heatmap`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-[1px] mt-0.5`,children:[De.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,Q.jsx)(`span`,{className:`text-[7px] text-text-subtle w-4 shrink-0 text-right`,children:e.charAt(0)}),Oe.map(n=>{let r=c[t][n];return(0,Q.jsx)(`div`,{className:`flex-1 aspect-square rounded-[1px] ${Me(r.avg)}`,title:`${e} ${n}:00 — ${r.count>0?`avg ${Math.round(r.avg*100)}% (${r.count} samples)`:`no data`}`},n)})]},e)),(0,Q.jsxs)(`div`,{className:`flex items-center gap-[1px]`,children:[(0,Q.jsx)(`span`,{className:`w-4 shrink-0`}),Oe.map(e=>(0,Q.jsx)(`div`,{className:`flex-1 text-center`,children:e%6==0&&(0,Q.jsx)(`span`,{className:`text-[7px] text-text-subtle tabular-nums`,children:e})},e))]})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[8px] text-text-subtle`,children:[(0,Q.jsx)(`span`,{children:`Low`}),(0,Q.jsxs)(`div`,{className:`flex gap-[2px]`,children:[(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/30`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-success/60`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/50`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-warning/80`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-error/80`})]}),(0,Q.jsx)(`span`,{children:`High`}),(0,Q.jsx)(`span`,{className:`ml-1`,children:`|`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-[1px] bg-surface-elevated border border-border/30`}),(0,Q.jsx)(`span`,{children:`No data`})]})]})}function Fe({profile:e,accountId:t,onClose:n}){let r=[[`Name`,e.account?.display_name],[`Email`,e.account?.email],[`Org`,e.organization?.name],[`Type`,e.organization?.organization_type],[`Tier`,e.organization?.rate_limit_tier],[`Status`,e.organization?.subscription_status]];return(0,Q.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3`,"data-testid":`account-profile-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Profile`}),(0,Q.jsx)(`button`,{className:`p-2 text-muted-foreground hover:text-foreground cursor-pointer`,onClick:n,"aria-label":`Close profile`,children:(0,Q.jsx)(f,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-[80px_1fr] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t?(0,Q.jsxs)(`span`,{className:`contents`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`span`,{className:`break-all`,children:t})]},e):null)}),(0,Q.jsx)(Pe,{accountId:t})]})}function Ie({display:e,onConfirm:t,onCancel:n}){let r=T(),i=(0,Q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`account-delete-confirm`,children:[(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Remove `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e}),`?`]}),(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`The stored token is deleted from this machine. Any export you already made keeps working.`}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-2`,children:[(0,Q.jsx)(D,{variant:`outline`,onClick:n,className:`min-h-11`,children:`Cancel`}),(0,Q.jsx)(D,{variant:`destructive`,autoFocus:!1,onClick:t,className:`min-h-11`,children:`Remove account`})]})]});return r?(0,Q.jsx)(w,{open:!0,onClose:n,children:(0,Q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Remove account`}),i]})}):(0,Q.jsx)(N,{open:!0,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,Q.jsx)(O,{children:(0,Q.jsx)(j,{className:`text-sm`,children:`Remove account`})}),i]})})}var Le=80;function Re({current:e,onSave:t,onCancel:n}){let r=T(),[i,o]=(0,Z.useState)(e),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),d=i.trim(),f=!!d&&d!==e&&!s,p=async()=>{if(f){c(!0),u(null);try{await t(d)}catch(e){u(e.message||`Could not rename the account`),c(!1)}}},m=()=>{s||n()},h=(0,Q.jsxs)(`form`,{className:`space-y-4`,"data-testid":`account-rename-dialog`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,Q.jsx)(I,{autoFocus:!0,value:i,maxLength:Le,onChange:e=>o(e.target.value),placeholder:`e.g. Personal, Work`,"aria-label":`Account name`,className:`min-h-11 text-sm md:min-h-9`}),l&&(0,Q.jsx)(`p`,{className:`text-xs text-error`,role:`alert`,children:l}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end`,children:[(0,Q.jsx)(D,{type:`button`,variant:`outline`,onClick:m,disabled:s,className:`min-h-11 md:min-h-9`,children:`Cancel`}),(0,Q.jsxs)(D,{type:`submit`,disabled:!f,className:`min-h-11 md:min-h-9`,children:[s&&(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Save`]})]})]});return r?(0,Q.jsx)(w,{open:!0,onClose:m,children:(0,Q.jsxs)(`div`,{className:`px-4 pb-4`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold mb-3`,children:`Rename account`}),h]})}):(0,Q.jsx)(N,{open:!0,onOpenChange:e=>{e||m()},children:(0,Q.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,Q.jsx)(O,{children:(0,Q.jsx)(j,{className:`text-sm`,children:`Rename account`})}),h]})})}function ze(e){return(e?.grants??[]).reduce((e,t)=>e+t.resetsLeft,0)}var Be={session:`5-hour reset`,fable:`Fable reset`,full:`full reset`,weekly:`weekly reset`},$=(e,t=!1)=>t?Be[e][0].toUpperCase()+Be[e].slice(1):Be[e],Ve={five_hour:`5-hour limit`,seven_day:`weekly limit`,seven_day_opus:`Opus weekly limit`,seven_day_sonnet:`Sonnet weekly limit`},He=(e,t)=>e.clears.includes(t)||t===`seven_day`&&e.givesBackWeekly;function Ue(e,t,n=Date.now()){let r=!!t.cooldownUntil&&Date.parse(t.cooldownUntil)>n;if(e.usableNow&&!e.paused&&e.resetsLeft>0&&!r)return null;if(e.paused)return`it is paused`;if(e.resetsLeft===0)return`none left`;switch(e.unavailableReason??(r?`cooldown`:void 0)??e.blocking.map(e=>({five_hour:`blocked_five_hour`,seven_day:`blocked_seven_day`,seven_day_opus:`blocked_opus`,seven_day_sonnet:`blocked_sonnet`})[e]).find(Boolean)??(e.blocking.length?`blocked_other`:void 0)??(t.atLimit&&!t.exhausted.some(t=>He(e,t))?`cannot_clear`:void 0)??(e.useRequiresLimit?`needs_limit`:`unavailable`)){case`cooldown`:return`a reset was just used, try again in a minute`;case`blocked_five_hour`:return`can't be used while you're at your ${Ve.five_hour}`;case`blocked_seven_day`:return`can't be used while you're at your ${Ve.seven_day}`;case`blocked_opus`:return`can't be used while you're at your ${Ve.seven_day_opus}`;case`blocked_sonnet`:return`can't be used while you're at your ${Ve.seven_day_sonnet}`;case`blocked_other`:return`can't be used while you're at another limit it doesn't refill`;case`cannot_clear`:return`doesn't refill the limit you've reached`;case`needs_limit`:return`usable once you reach a limit it refills`;default:return`can't be used right now`}}function We(e){let t=new Set;e.givesBackWeekly&&t.add(`Fable`);for(let n of e.clears)n===`five_hour`?t.add(`5-hour`):n===`seven_day`?t.add(`weekly`):n===`seven_day_overage_included`?t.add(e.givesBackWeekly?`Fable`:`weekly`):n===`seven_day_opus`?t.add(`Opus weekly`):n===`seven_day_sonnet`&&t.add(`Sonnet weekly`);let n=[...t],r=n.pop();return r?n.length?`${n.join(`, `)} and ${r} limits`:`${r} limit`:`limits`}function Ge(e,t){if(t.exhausted.some(t=>He(e,t)))return null;let n=$(e.kind),r=null;for(let t of e.clears){let n=e.percentUsed[t];n!==void 0&&(r===null||n>r.used)&&(r={limit:t,used:n})}let i=r&&Ve[r.limit];return r&&i&&r.used<100?`You still have ${100-r.used}% of your ${i} left. Use your ${n} anyway?`:`You haven't reached a limit yet. Use your ${n} anyway?`}function Ke(e,t,n={}){let r=n.kind?$(n.kind):`reset`;switch(t){case`reset`:return`${e}: ${n.kind===`fable`?`Fable reset used. What Fable used is back in your weekly limit`:n.kind===`session`?`5-hour limit reset`:n.kind===`weekly`?`Weekly limits reset`:`Limits reset`}.${n.weeklyResetsAt?` Your weekly reset day stays ${new Date(n.weeklyResetsAt).toLocaleString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}.`:``}${typeof n.resetsLeft==`number`?` ${n.resetsLeft===0?`No`:n.resetsLeft} ${r}${n.resetsLeft===1?``:`s`} left.`:``}`;case`already_used`:return`${e}: that ${r} had already been used.`;case`not_limited`:return`${e}: nothing needed resetting, so the ${r} was kept.`;case`cooldown`:return`${e}: a reset was used moments ago. Nothing was used; try again in a minute.`;case`ineligible`:return`${e}: Anthropic no longer offers this account limit resets. Nothing was used.`;case`rate_limited`:return`${e}: Anthropic is turning requests away for now. Nothing was used; try again in a minute.`;case`auth_error`:return`${e}: Anthropic refused the account's sign-in. Nothing was used; sign in again and retry.`;case`unavailable`:return n.reason===`reset_unconfirmed`||n.reason===`stamp_indeterminate`?`${e}: couldn't confirm the reset went through. If the limits are not refilled in a moment, try again.`:`${e}: couldn't reset the limits${n.reason?` (${n.reason.replace(/_/g,` `)})`:``}. Nothing was used; try again in a moment.`;default:return`${e}: couldn't tell whether the reset went through. Check the limits in a moment before trying again.`}}function qe(e){let t=e.givesBackWeekly?` and gives back what Fable used of your weekly limit. It doesn't reset your whole week`:``;return`Refills your ${We(e)}${t}. Your weekly reset day stays the same.`}function Je(e){let t=new Map;for(let n of e){let e=`${n.kind}|${n.endsAt??``}`,r=t.get(e)??{kind:n.kind,count:0,endsAt:n.endsAt};r.count+=n.resetsLeft,t.set(e,r)}return[...t].map(([e,t])=>({key:e,title:(0,Q.jsxs)(Q.Fragment,{children:[$(t.kind,!0),t.count>1&&(0,Q.jsxs)(`span`,{className:`text-text-subtle`,children:[` ×`,t.count]})]}),expiresAt:t.endsAt}))}function Ye({account:e,resets:t,onDone:n}){let[r,i]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u=(t?.grants??[]).filter(e=>e.resetsLeft>0);if(!t||!u.length)return(0,Q.jsx)(K,{count:0,lines:[],usable:!1,onOpen:()=>{}});let d=e=>Ue(e,t),f=()=>{c||(i(!1),s(null))};async function p(t){l(!0);try{let r=await y.post(`/api/accounts/${e.id}/limit-reset`,{grantId:t.id});n(Ke(e.label,r.result,r))}catch(e){n(e.message||`Could not use the reset`)}finally{l(!1),i(!1),s(null)}}let m=(0,Q.jsx)(`div`,{className:`space-y-2`,"data-testid":`claude-limit-resets`,children:u.map(e=>(0,Q.jsx)(le,{testId:`claude-reset-${e.id}`,title:(0,Q.jsxs)(Q.Fragment,{children:[$(e.kind,!0),e.resetsLeft>1&&(0,Q.jsxs)(`span`,{className:`text-text-subtle font-normal`,children:[` ×`,e.resetsLeft]})]}),detail:qe(e),expiresAt:e.endsAt,action:`Reset for free`,blockedReason:d(e),onUse:()=>s(e)},e.id))}),h=o&&(()=>{let n=$(o.kind),r=Ge(o,t);return(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-testid":`claude-limit-reset-confirm`,children:[(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Use `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,n,`?`]}),(0,Q.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,Q.jsx)(`li`,{children:qe(o)}),r&&(0,Q.jsx)(`li`,{className:`text-warning`,children:r}),(0,Q.jsxs)(`li`,{children:[o.resetsLeft>1?`${o.resetsLeft} of this kind left`:`The only one of this kind`,o.endsAt?`, use by ${q(o.endsAt)}`:``,`.`]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>s(null),disabled:c,className:`h-7 max-md:h-[26px]`,children:`Keep it`}),(0,Q.jsxs)(D,{onClick:()=>void p(o),disabled:c,className:`h-7 max-md:h-[26px] gap-1.5`,children:[c?(0,Q.jsx)(a,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),`Yes, use my `,n]})]})]})})(),_=ze(t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{count:_,lines:Je(u),usable:u.some(e=>!d(e)),onOpen:()=>i(!0)}),r&&(0,Q.jsx)(we,{title:o?`Use a ${$(o.kind)}?`:`Limit resets · ${_} available`,onClose:f,children:h||m})]})}function Xe(e){let t=new Blob([e],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`ppm-accounts-backup.json`,n.click(),URL.revokeObjectURL(n.href)}function Ze({open:e,onOpenChange:t,accounts:n,preselectId:r,onMessage:i}){let o=n.filter(e=>e.hasRefreshToken),[s,c]=(0,Z.useState)(new Set),[l,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(!1),[m,g]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1);e&&!x&&(c(r?new Set([r]):new Set(o.map(e=>e.id))),S(!0)),!e&&x&&S(!1);function C(){t(!1),d(``),p(!1),g(!1)}async function w(e){if(s.size===0)return;b(!0);let t=l.trim()||`ppm-hienlh`;try{let n={"Content-Type":`application/json`},r=v();r&&(n.Authorization=`Bearer ${r}`);let a=await fetch(`/api/accounts/export`,{method:`POST`,headers:n,body:JSON.stringify({password:t,accountIds:[...s],includeRefreshToken:f,refreshBeforeExport:m})});if(!a.ok){let e=await a.json();throw Error(e.error??`Export failed: ${a.status}`)}let o=await a.text();e&&await F(o)?i?.(`Backup copied to clipboard!`):(Xe(o),i?.(`Backup downloaded.`)),C()}catch{}b(!1)}let T=s.size>0&&!y;return(0,Q.jsx)(N,{open:e,onOpenChange:e=>{e||C()},children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(_,{className:`size-3.5`}),` Export Accounts`]}),(0,Q.jsx)(M,{className:`text-xs`,children:`Select accounts and set a password to protect the backup.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Accounts to export`}),(0,Q.jsx)(`button`,{className:`text-[10px] text-primary hover:underline cursor-pointer`,onClick:()=>c(s.size===o.length?new Set:new Set(o.map(e=>e.id))),children:s.size===o.length?`Deselect all`:`Select all`})]}),o.length===0?(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground p-2 border rounded`,children:`No exportable accounts.`}):(0,Q.jsx)(`div`,{className:`max-h-36 overflow-y-auto space-y-1 border rounded p-2`,children:o.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-${e.id}`,checked:s.has(e.id),onChange:t=>{let n=new Set(s);t.target.checked?n.add(e.id):n.delete(e.id),c(n)},className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-${e.id}`,className:`text-xs cursor-pointer truncate`,children:e.label??e.email??e.id.slice(0,8)})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(H,{className:`text-xs`,children:[`Password `,(0,Q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,Q.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:l,onChange:e=>d(e.target.value),className:`text-xs h-8`,autoComplete:`new-password`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-full`,checked:f,onChange:e=>p(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-full`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens (full transfer)`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,id:`exp-refresh`,checked:m,onChange:e=>g(e.target.checked),className:`size-3.5 accent-primary cursor-pointer`}),(0,Q.jsx)(`label`,{htmlFor:`exp-refresh`,className:`text-[11px] cursor-pointer`,children:`Refresh tokens before export`})]}),f?(0,Q.jsxs)(`div`,{className:`rounded-md border border-error/30 bg-error/5 p-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-error`,children:`Full transfer — source accounts will expire`}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Refresh tokens included. Source machine expires in ~1h after target refreshes.`})]}):m?(0,Q.jsx)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2.5`,children:(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-warning`,children:`Refresh before export — invalidates previous shares`})}):(0,Q.jsx)(`div`,{className:`rounded-md border border-success/30 bg-success/5 p-2.5`,children:(0,Q.jsx)(`p`,{className:`text-[10px] font-medium text-success`,children:`Share current token (safe)`})}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Encrypted with AES-256-GCM + scrypt.`})]}),(0,Q.jsxs)(k,{className:`gap-1.5 flex-col sm:flex-row`,children:[(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:C,children:`Cancel`}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!0),children:[(0,Q.jsx)(h,{className:`size-3 mr-1`}),` Copy`]}),(0,Q.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!T,onClick:()=>w(!1),children:y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`size-3 mr-1`}),` Download`]})})]})]})})}function Qe({open:e,onOpenChange:t,onSuccess:n}){let[r,i]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null);function f(){t(!1),i(``),s(``),d(null)}async function p(){if(r.trim()){l(!0),d(null);try{let e=await te({data:r.trim(),password:o.trim()||`ppm-hienlh`});f(),n(`Imported ${e.imported} account(s)`)}catch(e){d(e.message||`Import failed`)}l(!1)}}return(0,Q.jsx)(N,{open:e,onOpenChange:e=>{e||f()},children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(_,{className:`size-3.5`}),` Import Accounts`]}),(0,Q.jsx)(M,{className:`text-xs`,children:`Paste backup data and enter the export password. Imported accounts are temporary (~1h).`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{className:`text-xs`,children:`Backup data`}),(0,Q.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`Paste backup JSON here...`,rows:4,className:`w-full text-xs p-2 rounded border border-border bg-background font-mono resize-none focus:outline-none focus:ring-1 focus:ring-primary`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(H,{className:`text-xs`,children:[`Password `,(0,Q.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,Q.jsx)(I,{type:`password`,placeholder:`Leave empty for default`,value:o,onChange:e=>s(e.target.value),className:`text-xs h-8`,autoComplete:`current-password`})]})]}),u&&(0,Q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:u}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs h-7 cursor-pointer`,onClick:f,children:`Cancel`}),(0,Q.jsx)(D,{size:`sm`,className:`text-xs h-7 cursor-pointer`,disabled:!r.trim()||c,onClick:p,children:c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-3 animate-spin mr-1`}),` Importing...`]}):`Import`})]})]})})}var $e=typeof window<`u`?window.matchMedia(`(min-width: 768px)`):null;function et(e){return $e?.addEventListener(`change`,e),()=>$e?.removeEventListener(`change`,e)}function tt(){return $e?.matches??!0}function nt(){let[e,t]=(0,Z.useState)(null),[n,r]=(0,Z.useState)(!0);return(0,Z.useEffect)(()=>{r(!0),re().then(t).finally(()=>r(!1))},[]),n?(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Loading...`}):e?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Rotation Strategy`}),(0,Q.jsxs)(W,{value:e.strategy,onValueChange:async e=>{t(await L({strategy:e}))},children:[(0,Q.jsx)(se,{className:`w-full h-9 text-xs`,children:(0,Q.jsx)(oe,{})}),(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(U,{value:`round-robin`,children:`Round-robin`}),(0,Q.jsx)(U,{value:`fill-first`,children:`Fill-first`}),(0,Q.jsx)(U,{value:`lowest-usage`,children:`Lowest usage`})]})]}),(0,Q.jsxs)(`p`,{className:`text-[10px] text-text-subtle`,children:[e.strategy===`round-robin`&&`Cycles through accounts evenly`,e.strategy===`fill-first`&&`Uses one account until its limit, then moves on`,e.strategy===`lowest-usage`&&`Picks the account with the lowest current usage`]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Max Retry`}),(0,Q.jsx)(`input`,{type:`number`,min:0,value:e.maxRetry,className:`w-full h-9 text-xs border rounded-md px-3 bg-background`,onChange:async e=>{let n=parseInt(e.target.value,10);!isNaN(n)&&n>=0&&t(await L({maxRetry:n}))}}),(0,Q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`How many accounts to try on failure. 0 = try all available accounts.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5 border-t border-border pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`label`,{className:`text-xs font-medium text-text-primary`,children:`Cooldown parking`}),(0,Q.jsx)(G,{checked:e.cooldownEnabled,onCheckedChange:async e=>{t(await L({cooldownEnabled:e}))}})]}),(0,Q.jsx)(`p`,{className:`text-[10px] text-text-subtle`,children:`Park a failing account (rate limit / usage limit / auth error) until it recovers. Off: accounts stay selectable — rotation still skips accounts already ≥95% on the 5-hour limit.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs border-t border-border pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-text-subtle`,children:`Active accounts`}),(0,Q.jsx)(`span`,{className:`font-medium text-text-primary`,children:e.activeCount})]})]}):(0,Q.jsx)(`p`,{className:`text-xs text-text-subtle py-4 text-center`,children:`Failed to load settings`})}function rt({open:e,onOpenChange:t}){let n=(0,Z.useSyncExternalStore)(et,tt);return e?n?(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-sm`,children:[(0,Q.jsx)(O,{children:(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-2`,children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation & Retry`]})}),(0,Q.jsx)(nt,{})]})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`fixed inset-0 z-50 transition-opacity duration-200 opacity-100`,onClick:()=>t(!1),style:{backgroundColor:`rgba(0,0,0,0.5)`}}),(0,Q.jsxs)(`div`,{className:b(`fixed bottom-0 left-0 right-0 z-50 bg-background rounded-t-2xl border-t border-border shadow-2xl`,`transition-transform duration-300 ease-out max-h-[85vh] overflow-y-auto`,`translate-y-0`),children:[(0,Q.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,Q.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-border`})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,Q.jsxs)(`span`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation & Retry`]}),(0,Q.jsx)(`button`,{onClick:()=>t(!1),className:`flex items-center justify-center size-7 rounded-md hover:bg-surface-elevated transition-colors`,children:(0,Q.jsx)(f,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`px-4 py-4 pb-8`,children:(0,Q.jsx)(nt,{})})]})]}):null}var it=E(`inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground shadow`,secondary:`border-transparent bg-secondary text-secondary-foreground`,destructive:`border-transparent bg-destructive text-destructive-foreground shadow`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function at({className:e,variant:t,...n}){return(0,Q.jsx)(`div`,{className:b(it({variant:t}),e),...n})}function ot(e){let t=Math.floor(Date.now()/1e3);return e>t?`${Math.floor((e-t)/60)}m`:`exp`}function st({accounts:e}){let[t,n]=(0,Z.useState)([]),[r,i]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(new Map),u=e.filter(e=>e.hasRefreshToken);async function d(){if(u.length!==0){i(!0);try{let e=await V(u.map(e=>e.id),o);n(t=>[...t,{round:t.length+1,time:new Date().toLocaleTimeString(),includeRefresh:o,items:e}])}catch{}i(!1)}}async function f(e,t){l(t=>new Map(t).set(e,{loading:!0}));try{let n=await R(t);l(t=>new Map(t).set(e,{loading:!1,...n}))}catch(t){l(n=>new Map(n).set(e,{loading:!1,status:`error`,error:t.message}))}}function p(e,t){return[{key:`r${e.round}-pre-${t.id}`,label:`Pre-export`,token:t.preExportTokenFull,preview:t.preExportToken,expires:t.preExportExpires},{key:`r${e.round}-exp-${t.id}`,label:`Exported`,token:t.exportedTokenFull,preview:t.exportedToken,expires:t.exportedExpires},{key:`r${e.round}-post-${t.id}`,label:`Post-export`,token:t.postExportTokenFull,preview:t.postExportToken,expires:t.postExportExpires}]}function m(){for(let e of t)for(let t of e.items)for(let n of p(e,t))n.token&&f(n.key,n.token)}return(0,Q.jsxs)(`section`,{className:`border-t pt-4 space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:`Simulate export`}),t.length>0&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[t.length,` round(s)`]})]}),(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Every run appends a round. Earlier rounds are kept so tokens can be compared across runs.`}),u.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No OAuth account with a refresh token to export.`}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(G,{id:`sim-include-refresh`,checked:o,onCheckedChange:s,className:`cursor-pointer`}),(0,Q.jsx)(H,{htmlFor:`sim-include-refresh`,className:`text-[11px] cursor-pointer`,children:`Include refresh tokens`})]}),(0,Q.jsx)(D,{size:`sm`,className:`h-7 text-xs cursor-pointer`,disabled:r,onClick:()=>void d(),children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-3 animate-spin mr-1`}),` Exporting...`]}):`Run export #${t.length+1}`})]}),t.length>0&&(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`w-full h-7 text-[11px] cursor-pointer`,onClick:m,children:[`Test all tokens (`,t.reduce((e,t)=>e+t.items.length*3,0),`)`]}),t.map(e=>(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`p`,{className:`text-xs font-medium text-primary`,children:[`Round #`,e.round]}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.time}),(0,Q.jsx)(at,{variant:e.includeRefresh?`destructive`:`secondary`,className:`text-[9px] px-1 py-0`,children:e.includeRefresh?`with refresh`:`access only`})]}),e.items.map(t=>(0,Q.jsxs)(`div`,{className:`p-2 rounded-lg border bg-card space-y-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-medium`,children:t.label??t.email??t.id.slice(0,8)}),t.tokenChanged&&(0,Q.jsx)(at,{variant:`secondary`,className:`text-[9px] px-1 py-0`,children:`DB token changed`})]}),p(e,t).map(e=>{let t=c.get(e.key);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,Q.jsx)(`span`,{className:`w-20 shrink-0 text-muted-foreground text-[10px]`,children:e.label}),(0,Q.jsx)(`code`,{className:`flex-1 truncate font-mono text-[10px] bg-muted px-1 rounded`,children:e.preview??`N/A`}),e.expires&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:ot(e.expires)}),e.token?(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`h-6 text-[10px] px-1.5 cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void f(e.key,e.token),children:t?.loading?(0,Q.jsx)(a,{className:`size-3 animate-spin`}):`Test`}):(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`-`}),t&&!t.loading&&(0,Q.jsx)(`span`,{className:`text-[10px] font-medium shrink-0 ${t.status?.startsWith(`valid`)?`text-success`:`text-error`}`,children:t.status})]},e.key)})]},`r${e.round}-${t.id}`))]},e.round))]})]})}function ct(e){let t=Math.floor(Date.now()/1e3),n=Math.floor(Math.abs(e-t)/60);return e>t?`${n}m left`:`expired ${n}m ago`}function lt({open:e,onOpenChange:t,accounts:n}){let[i,o]=(0,Z.useState)(new Map),[s,c]=(0,Z.useState)(!1);async function l(e){o(t=>new Map(t).set(e,{loading:!0}));try{let t=await ie(e,s);o(n=>new Map(n).set(e,{loading:!1,result:t}))}catch(t){o(n=>new Map(n).set(e,{loading:!1,error:t.message}))}}function u(){for(let e of n.filter(e=>e.expiresAt!==null))l(e.id)}return(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-xl max-h-[85vh] flex flex-col`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(r,{className:`size-4`}),` Token Test`]}),(0,Q.jsx)(M,{className:`text-xs`,children:`Probe stored tokens for validity. Nothing is modified.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-4 overflow-y-auto flex-1 pr-1`,children:[(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:`Current tokens`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(G,{id:`token-test-refresh`,checked:s,onCheckedChange:c,className:`cursor-pointer`}),(0,Q.jsx)(H,{htmlFor:`token-test-refresh`,className:`text-[11px] cursor-pointer`,children:`Also test refresh`})]}),(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer`,onClick:u,children:`Test all`})]})]}),n.length===0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No accounts to test.`}),(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=i.get(e.id),n=t?.result?.accessToken.status;return(0,Q.jsxs)(`div`,{className:`p-2 rounded border bg-card space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`text-xs font-medium truncate block`,children:e.label??e.email??e.id.slice(0,8)}),e.expiresAt&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ct(e.expiresAt)})]}),(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`h-7 text-xs cursor-pointer shrink-0`,disabled:t?.loading,onClick:()=>void l(e.id),children:t?.loading?(0,Q.jsx)(a,{className:`size-3 animate-spin`}):`Test`})]}),t&&!t.loading&&(0,Q.jsxs)(`div`,{className:`text-[11px] pl-2 border-l-2 border-muted`,children:[t.error&&(0,Q.jsx)(`p`,{className:`text-error`,children:t.error}),n&&(0,Q.jsxs)(`span`,{className:n.startsWith(`valid`)?`text-success`:`text-error`,children:[n,t.result?.accessToken.code?` (${t.result.accessToken.code})`:``]})]})]},e.id)})})]}),(0,Q.jsx)(st,{accounts:n})]}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Close`})})]})})}function ut(){let{usages:e,accounts:t,activeAccountId:n,initialLoading:o,refreshing:s,flashIds:c,reload:l}=fe(),[f,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(null),[E,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(void 0);function j(e){l(),e&&h(e)}async function M(e,t){_(e);try{await z(e,{status:t===`disabled`?`active`:`disabled`})}catch(e){h(e.message)}_(null),l()}async function N(){if(v){try{await B(v.id),h(`Account "${v.display}" removed.`),l()}catch(e){h(`Failed to remove: ${e.message}`)}y(null)}}async function P(e){b&&(await z(b.id,{label:e}),x(null),h(`Account renamed to "${e}".`),l())}let F=new Map(t.map(e=>[e.id,e])),I=e[0]?.usage.lastFetchedAt;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(ve,{description:`Connect multiple Claude accounts. PPM rotates between them automatically to avoid rate limits.`,onRefresh:()=>void l(),refreshing:s,disabled:o,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{A(void 0),O(`add`)},children:[(0,Q.jsx)(d,{className:`size-4`}),` Add account`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>{T(null),O(`export`)},children:[(0,Q.jsx)(u,{className:`size-4`}),` Export`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`import`),children:[(0,Q.jsx)(p,{className:`size-4`}),` Import`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`rotation`),children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>O(`token-test`),children:[(0,Q.jsx)(r,{className:`size-4`}),` Token test`]})]})}),(0,Q.jsx)(xe,{message:f,onDismiss:()=>h(null)}),(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Accounts`}),I&&(0,Q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`usage `,ce(new Date(I).getTime())]})]}),o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,Q.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No accounts connected yet.`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add one to start using PPM.`})]}):(0,Q.jsx)(me,{children:e.map(e=>(0,Q.jsx)(be,{layout:`strip`,entry:e,isActive:e.accountId===n,accountInfo:F.get(e.accountId),onToggle:M,toggling:g===e.accountId,onDelete:(e,t)=>y({id:e,display:t}),onRename:(e,t)=>x({id:e,current:t}),onExport:e=>{T(e),O(`export`)},onViewProfile:(e,t)=>C({profile:e,accountId:t}),onReauth:()=>{A({id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)}),O(`add`)},flash:c.has(e.accountId),resetCreditAction:(0,Q.jsx)(Ye,{account:{id:e.accountId,label:e.accountLabel??e.accountId.slice(0,8)},resets:e.usage.limitResets,onDone:e=>{h(e),l()}})},e.accountId))})]}),S&&(0,Q.jsx)(Fe,{profile:S.profile,accountId:S.accountId,onClose:()=>C(null)}),v&&(0,Q.jsx)(Ie,{display:v.display,onConfirm:()=>void N(),onCancel:()=>y(null)}),b&&(0,Q.jsx)(Re,{current:b.current,onSave:P,onCancel:()=>x(null)}),(0,Q.jsx)(Te,{open:E===`add`,onOpenChange:e=>{O(e?`add`:null),e||A(void 0)},onSuccess:j,signInAgainFor:k}),(0,Q.jsx)(Ze,{open:E===`export`,onOpenChange:e=>{O(e?`export`:null),e||T(null)},accounts:t,preselectId:w,onMessage:h}),(0,Q.jsx)(Qe,{open:E===`import`,onOpenChange:e=>O(e?`import`:null),onSuccess:j}),(0,Q.jsx)(rt,{open:E===`rotation`,onOpenChange:e=>O(e?`rotation`:null)}),(0,Q.jsx)(lt,{open:E===`token-test`,onOpenChange:e=>O(e?`token-test`:null),accounts:t})]})}function dt({mode:e,onOpenChange:t,password:n,onPasswordChange:r,busy:i,onExport:o,onImport:s,error:c}){let l=(0,Z.useRef)(null),d=e===`export`;return(0,Q.jsx)(N,{open:e!==null,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsxs)(j,{className:`text-sm flex items-center gap-1.5`,children:[(0,Q.jsx)(_,{className:`size-4`}),` `,d?`Export Codex Accounts`:`Import Codex Accounts`]}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:d?`Writes a password-encrypted file containing each account's login.`:`Reads a backup file. The password must be the one it was exported with.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{htmlFor:`codex-backup-password`,className:`text-xs`,children:`Password`}),(0,Q.jsx)(I,{id:`codex-backup-password`,type:`password`,placeholder:d?`Choose a password`:`Password used for the export`,value:n,onChange:e=>r(e.target.value),className:`text-xs`,autoComplete:d?`new-password`:`current-password`}),(0,Q.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A backup holds full logins — keep the file and its password together.`})]}),c&&(0,Q.jsx)(`div`,{className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:c}),(0,Q.jsx)(`input`,{ref:l,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&s(t)}}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsxs)(D,{size:`sm`,className:`text-xs cursor-pointer gap-1.5`,disabled:!n.trim()||i,onClick:()=>d?o():l.current?.click(),children:[i?(0,Q.jsx)(a,{className:`size-3.5 animate-spin`}):d?(0,Q.jsx)(u,{className:`size-3.5`}):(0,Q.jsx)(p,{className:`size-3.5`}),d?`Download backup`:`Choose file`]})]})]})})}var ft=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function pt({open:e,onOpenChange:t,strategy:n,onChange:r}){return(0,Q.jsx)(N,{open:e,onOpenChange:t,children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`text-sm`,children:`Codex Rotation`}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your Codex accounts.`})]}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:ft.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>t(!1),children:`Done`})})]})})}function mt(e){return e==null?null:Math.round(e*100)}function ht({usage:e}){let t=e.session==null&&e.weekly==null;return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(t||e.session!=null)&&(0,Q.jsx)(Ce,{label:`5-Hour Session`,pct:mt(e.fiveHour),reset:he(e.session),resetsAt:e.session?.resetsAt}),(t||e.weekly!=null)&&(0,Q.jsx)(Ce,{label:`Weekly`,pct:mt(e.sevenDay),reset:he(e.weekly),resetsAt:e.weekly?.resetsAt})]})}function gt(e){let t=e=>Math.round((e??0)*100)>=100;return t(e.session?.utilization)||t(e.weekly?.utilization)}var _t={reset:e=>`${e}: limits reset to 0%. The weekly reset date now counts from your next use.`,nothingToReset:e=>`${e}: nothing needed resetting, so the reset was kept.`,noCredit:e=>`${e} has no free reset left.`,alreadyRedeemed:e=>`${e}: that reset had already been used.`},vt=`Usable once a limit is reached: a reset moves the weekly reset date, so spending one earlier wastes what is left of the window.`;function yt(e){return e.credits?.length?e.credits:Array.from({length:e.available},(t,n)=>n===0?{id:e.nextCreditId,title:e.title,expiresAt:e.nextExpiresAt}:{title:e.title})}function bt({account:e,usage:t,onDone:n}){let[r,i]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u=t.resetCredits;if(!u||u.available===0)return(0,Q.jsx)(K,{count:0,lines:[],usable:!1,onOpen:()=>{}});let d=yt(u),f=gt(t),p=()=>{c||(i(!1),s(null))};async function m(t){l(!0);try{let r=await y.post(`/api/codex-accounts/${e.id}/reset-credit`,t.id?{creditId:t.id}:{});n(_t[r.outcome]?.(e.label)??`${e.label}: ${r.outcome}`)}catch(e){n(e.message||`Could not use the reset`)}finally{l(!1),i(!1),s(null)}}let h=t.weekly?.resetsAt?q(t.weekly.resetsAt):null,_=o&&(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-testid":`codex-reset-credit-confirm`,children:[(0,Q.jsxs)(`p`,{className:`text-sm`,children:[`Use 1 of `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label}),`'s `,u.available,` free reset`,u.available===1?``:`s`,`?`]}),(0,Q.jsxs)(`ul`,{className:`text-xs text-text-secondary space-y-1.5 list-disc pl-4`,children:[(0,Q.jsxs)(`li`,{children:[o.title??`Full reset`,`: the 5-hour and weekly usage go back to 0% now.`]}),(0,Q.jsxs)(`li`,{children:[`The weekly reset date moves: the next one is about 7 days after you continue using Codex`,h?`, not ${h} as now`:``,`. You do not also get that one.`]}),o.expiresAt&&(0,Q.jsxs)(`li`,{children:[`This reset expires `,q(o.expiresAt),`.`]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse md:flex-row gap-2 md:justify-end pt-1`,children:[(0,Q.jsx)(D,{variant:`outline`,onClick:()=>s(null),disabled:c,className:`h-7 max-md:h-[26px]`,children:`Keep it`}),(0,Q.jsxs)(D,{onClick:()=>void m(o),disabled:c,className:`h-7 max-md:h-[26px] gap-1.5`,children:[c?(0,Q.jsx)(a,{className:`size-4 animate-spin`}):(0,Q.jsx)(g,{className:`size-4`}),`Use reset`]})]})]});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{count:u.available,lines:d.map((e,t)=>({key:e.id??String(t),title:e.title??`Full reset`,expiresAt:e.expiresAt})),usable:f,onOpen:()=>i(!0)}),r&&(0,Q.jsx)(we,{title:o?`Use a free reset`:`Free resets · ${u.available} available`,onClose:p,children:_||(0,Q.jsxs)(`div`,{className:`space-y-2`,"data-testid":`codex-reset-credits`,children:[!f&&(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:vt}),d.map((e,t)=>(0,Q.jsx)(le,{title:e.title??`Full reset`,detail:`Resets the 5-hour and weekly usage to 0%. The weekly reset date then counts from your next use.`,expiresAt:e.expiresAt,action:`Use reset`,blockedReason:f?null:!0,onUse:()=>s(e)},e.id??t))]})})]})}var xt=1440*60*1e3,St=7,Ct=5;function wt(e,t=Date.now()){if(!e||e.windowHours!==168)return null;let n=new Date(e.resetsAt).getTime();if(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)return null;let r=n-St*xt;if(t<r)return null;let i=Math.min(St-1,Math.floor((t-r)/xt)),a=0;for(let e=0;e<=i;e++){let t=new Date(r+e*xt).getUTCDay();t!==0&&t!==6&&a++}let o=a/Ct;return{day:a,cap:o,used:e.utilization,blocked:e.utilization>=o}}function Tt(){let[e,t]=(0,Z.useState)(null),n=Ee(()=>t(null)),[r,c]=(0,Z.useState)(null);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(ve,{description:(0,Q.jsxs)(Q.Fragment,{children:[`Each Codex account keeps its own login (`,(0,Q.jsx)(`code`,{children:`CODEX_HOME`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void n.load(),refreshing:n.loading,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`add`),children:[(0,Q.jsx)(d,{className:`size-4`}),` Add account`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`export`),children:[(0,Q.jsx)(u,{className:`size-4`}),` Export`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`import`),children:[(0,Q.jsx)(p,{className:`size-4`}),` Import`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>t(`rotation`),children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation`]})]})}),(0,Q.jsx)(xe,{message:n.msg??n.err,onDismiss:()=>{n.setMsg(null),n.setErr(null)}}),(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Codex Accounts`}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.strategy.replace(`-`,` `)})]}),n.loading&&n.accounts.length===0?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Loading accounts...`]}):n.accounts.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,Q.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Codex accounts yet.`}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Chats use your default `,(0,Q.jsx)(`code`,{children:`~/.codex`}),` login until you add one.`]})]}):(0,Q.jsx)(me,{children:n.accounts.map(e=>{let t=n.usages[e.id]??{};return(0,Q.jsxs)(ue,{dense:!0,className:`flex flex-col min-w-[300px] shrink-0 snap-start${e.signedOut?` opacity-60`:``}`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium truncate flex-1 min-w-0`,children:e.label}),e.signedOut&&(0,Q.jsx)(X,{className:`text-[10px] text-error shrink-0 font-medium`,hint:`Codex rejected this account's login (revoked or expired), so no turn can run on it and it is skipped. The usage shown is the last reading. Click to sign in again — the account keeps its settings and chats.`,onClick:e.type===`chatgpt`?()=>c(e):void 0,children:`Sign in again`}),(0,Q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:e.type}),pe(e.planType)&&(0,Q.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:pe(e.planType)}),(0,Q.jsx)(G,{checked:e.status!==`disabled`,onCheckedChange:()=>void n.toggle(e.id,e.status??`active`),disabled:n.toggling.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void n.remove(e.id),"aria-label":`Remove account`,className:`p-2 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,Q.jsx)(o,{className:`size-4`})})}),(0,Q.jsx)(S,{side:`top`,children:`Remove account`})]})]}),(0,Q.jsx)(ht,{usage:t}),t.session==null&&(()=>{let r=wt(t.weekly);return r?(0,Q.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-3 rounded-md border px-2.5 py-1.5 ${e.dailyGuardEnabled&&r.blocked?`border-error/40 bg-error/5`:`border-border/50 bg-surface/40`}`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-secondary`}`,children:[(0,Q.jsx)(`span`,{children:`Daily guard`}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`About Daily guard`,className:`text-text-subtle hover:text-text-primary cursor-help`,children:(0,Q.jsx)(s,{className:`size-3.5`})})}),(0,Q.jsx)(S,{side:`top`,className:`max-w-64 text-xs leading-relaxed`,children:`Spreads the weekly quota across five weekdays, adding 20% per weekday. Weekend slots keep the previous cap; unused allowance carries forward. Daily slots start at the reset time and use UTC weekdays. Turn it off any time to use the remaining quota freely.`})]})]}),(0,Q.jsx)(`p`,{className:`text-[10px] tabular-nums ${e.dailyGuardEnabled&&r.blocked?`text-error`:`text-text-subtle`}`,children:e.dailyGuardEnabled&&r.blocked?`${Math.round(r.used*100)}% used / ${Math.round(r.cap*100)}% daily cap. New turns paused.`:`Weekday ${r.day}/5, ${Math.round(r.cap*100)}% daily cap`})]}),(0,Q.jsxs)(`span`,{className:`hidden`,title:`Weekday ${r.day}/5: hold weekly usage at or below ${Math.round(r.cap*100)}% to last until reset.`,children:[`Daily guard `,e.dailyGuardEnabled?`· Weekday ${r.day}/5 cap ${Math.round(r.cap*100)}%`:``]}),(0,Q.jsx)(G,{checked:!!e.dailyGuardEnabled,onCheckedChange:()=>void n.toggleDailyGuard(e.id,!!e.dailyGuardEnabled),disabled:n.toggling.has(e.id),"aria-label":e.dailyGuardEnabled?`Disable Daily guard`:`Enable Daily guard`,className:`cursor-pointer shrink-0`})]}):null})(),(0,Q.jsx)(`div`,{className:`mt-auto`,children:(0,Q.jsx)(bt,{account:e,usage:t,onDone:e=>{n.setMsg(e),n.load()}})})]},e.id)})})]}),(0,Q.jsx)(Y,{open:e===`add`,onOpenChange:e=>{e||n.cancelLogin(),t(e?`add`:null)},label:n.label,onLabelChange:n.setLabel,apiKey:n.apiKey,onApiKeyChange:n.setApiKey,adding:n.adding,onAddApiKey:()=>void n.addApiKey(),deviceWaiting:n.deviceWaiting,onStartDevice:()=>void n.startDevice(),device:n.device,browser:n.browser,onStartBrowser:()=>void n.startBrowser(),loginStarting:n.loginStarting,callbackUrl:n.callbackUrl,onCallbackUrlChange:n.setCallbackUrl,submittingCallback:n.submittingCallback,onSubmitCallback:()=>void n.submitCallback(),error:n.err}),(0,Q.jsx)(dt,{mode:e===`export`?`export`:e===`import`?`import`:null,onOpenChange:e=>{e||t(null)},password:n.backupPassword,onPasswordChange:n.setBackupPassword,busy:n.exporting||n.importing,onExport:()=>void n.doExport(),onImport:e=>void n.doImport(e),error:n.err}),r&&(0,Q.jsx)(J,{account:r,onClose:()=>c(null),onDone:()=>void n.load()}),(0,Q.jsx)(pt,{open:e===`rotation`,onOpenChange:e=>t(e?`rotation`:null),strategy:n.strategy,onChange:e=>void n.changeStrategy(e)})]})}var Et=[{value:`round-robin`,label:`Round-robin`,hint:`Take the next account each time.`},{value:`fill-first`,label:`Fill-first`,hint:`Stay on one account until it runs out.`},{value:`lowest-usage`,label:`Lowest usage`,hint:`Pick whichever has the most left.`}];function Dt(e){return e==null?null:Math.round(e*100)}function Ot(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)(`round-robin`),[s,u]=(0,Z.useState)({}),[f,p]=(0,Z.useState)(!0),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(new Set),[E,P]=(0,Z.useState)(null),[F,L]=(0,Z.useState)(null),[ee,R]=(0,Z.useState)(``),[z,te]=(0,Z.useState)(null),[ne,re]=(0,Z.useState)(!1),[B,ie]=(0,Z.useState)(``),[V,ae]=(0,Z.useState)(!1),[oe,U]=(0,Z.useState)(null),W=(0,Z.useRef)(0),se=(0,Z.useRef)(!1),K=(0,Z.useRef)(!1),q=(0,Z.useRef)(null),le=(0,Z.useRef)(null),J=(0,Z.useCallback)(async()=>{p(!0),v(null);try{let e=await y.get(`/api/antigravity-accounts`);t(e.accounts),r(e.strategy),u(await y.get(`/api/antigravity-accounts/usage`))}catch(e){v(e.message)}finally{p(!1)}},[]);(0,Z.useEffect)(()=>{J()},[J]);let Y=(0,Z.useCallback)(()=>{W.current+=1,se.current=!1,K.current=!1,le.current?.(),le.current=null;let e=q.current;q.current=null,e&&y.del(`/api/antigravity-accounts/login/${e}`).catch(()=>{})},[]);(0,Z.useEffect)(()=>Y,[Y]);let X=(0,Z.useCallback)(()=>{Y(),te(null),re(!1),ie(``),ae(!1)},[Y]),de=(0,Z.useCallback)(()=>{X(),U(null),R(``),L(null),P(null)},[X]),fe=(0,Z.useCallback)(e=>{let t=Date.now()+61e4,n=!1,r;le.current=()=>{n=!0,clearTimeout(r)};let i=async()=>{if(n)return;let a=null;try{a=await y.get(`/api/antigravity-accounts/login/${e}/status`)}catch{}if(!n){if(a?.state===`done`){q.current=null,X(),U(null),R(``),L(null),P(null),g(`Antigravity Google account connected.`),await J();return}if(a?.state===`error`||Date.now()>t){q.current=null,X(),U(a?.state===`error`?a.error??`Login failed.`:`Login timed out.`);return}r=setTimeout(i,2e3)}};i()},[J,X]),pe=(0,Z.useCallback)(async e=>{if(se.current||q.current||K.current)return;se.current=!0;let t=++W.current;re(!0),U(null);try{let n=await y.post(`/api/antigravity-accounts/login`,{...ee.trim()?{label:ee.trim()}:{},...e?{accountId:e.id}:{}});if(t!==W.current){y.del(`/api/antigravity-accounts/login/${n.id}`).catch(()=>{});return}q.current=n.id,te(n),fe(n.id)}catch(e){t===W.current&&U(e.message)}finally{t===W.current&&(se.current=!1,re(!1))}},[ee,fe]),ge=(0,Z.useCallback)(async()=>{if(!z||!B.trim()||K.current)return;let e=W.current;K.current=!0,ae(!0),U(null);try{let t=await y.post(`/api/antigravity-accounts/login/${z.id}/callback`,{code:B.trim()});if(e!==W.current)return;if(t?.state===`error`){q.current=null,X(),U(t.error??`Login failed.`);return}if(t?.state!==`done`)return;q.current=null,X(),R(``),L(null),P(null),g(`Antigravity Google account connected.`),await J()}catch(t){e===W.current&&(q.current=null,X(),U(t.message))}finally{e===W.current&&(K.current=!1,ae(!1))}},[z,B,J,X]),ye=(0,Z.useCallback)(async(e,n)=>{T(t=>new Set(t).add(e)),v(null);try{let r=n===`disabled`?`active`:`disabled`;await y.patch(`/api/antigravity-accounts/${e}`,{status:r}),t(t=>t.map(t=>t.id===e?{...t,status:r}:t))}catch(e){v(e.message)}finally{T(t=>{let n=new Set(t);return n.delete(e),n})}},[]),be=(0,Z.useCallback)(async e=>{v(null);try{await y.del(`/api/antigravity-accounts/${e}`),t(t=>t.filter(t=>t.id!==e))}catch(e){v(e.message)}},[]),we=(0,Z.useCallback)(async e=>{v(null);try{await y.put(`/api/antigravity-accounts/strategy`,{strategy:e}),r(e)}catch(e){v(e.message)}},[]),Te=(0,Z.useCallback)(e=>{L(e),R(e.label),P(`add`)},[]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(ve,{description:(0,Q.jsxs)(Q.Fragment,{children:[`Each Antigravity account keeps its own Google OAuth login (`,(0,Q.jsx)(`code`,{children:`~/.ppm/antigravity-accounts`}),`) alongside your local IDE login (`,(0,Q.jsx)(`code`,{children:`~/.gemini`}),`). One is picked per chat by the rotation setting.`]}),onRefresh:()=>void J(),refreshing:f,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(D,{size:`sm`,className:`cursor-pointer gap-1.5`,onClick:()=>{L(null),R(``),P(`add`)},children:[(0,Q.jsx)(d,{className:`size-4`}),` Add account`]}),(0,Q.jsxs)(D,{size:`sm`,variant:`outline`,className:`cursor-pointer gap-1.5`,onClick:()=>P(`rotation`),children:[(0,Q.jsx)(i,{className:`size-4`}),` Rotation`]})]})}),(0,Q.jsx)(xe,{message:h??_,onDismiss:()=>{g(null),v(null)}}),(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:`Antigravity Accounts`}),(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground capitalize`,children:n.replace(`-`,` `)})]}),f&&e.length===0?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Loading accounts...`]}):e.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,Q.jsx)(m,{className:`size-5 text-muted-foreground`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Antigravity accounts yet.`}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Click `,(0,Q.jsx)(`strong`,{children:`Add account`}),` to sign in with Google, or start Antigravity Desktop to auto-detect your local account.`]})]}):(0,Q.jsx)(me,{children:e.map(e=>{let t=Se(s[e.id]??{}),n=t.session==null&&t.weekly==null&&(!t.weeklyScoped||t.weeklyScoped.length===0),r=e.id===`default`;return(0,Q.jsxs)(ue,{dense:!0,className:`min-w-[320px] shrink-0 snap-start`,"data-testid":`account-card`,"data-account-id":e.id,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium truncate`,children:e.label}),e.email&&e.email!==e.label&&(0,Q.jsx)(`div`,{className:`text-[11px] text-text-subtle truncate`,children:e.email})]}),(0,Q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-text-subtle border border-border rounded px-1 shrink-0`,children:r?`~/.gemini`:`Google`}),e.planType&&(0,Q.jsx)(`span`,{className:`text-[10px] font-medium text-primary bg-primary/10 border border-primary/20 rounded px-1.5 py-0.5 shrink-0`,children:e.planType}),(0,Q.jsx)(G,{checked:e.status!==`disabled`,onCheckedChange:()=>void ye(e.id,e.status),disabled:w.has(e.id),"aria-label":e.status===`disabled`?`Enable account`:`Disable account`,className:`cursor-pointer shrink-0`}),!r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>Te(e),"aria-label":`Sign in again`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-foreground hover:bg-surface-elevated transition-colors shrink-0`,children:(0,Q.jsx)(c,{className:`size-3.5`})})}),(0,Q.jsx)(S,{side:`top`,children:`Sign in again`})]}),(0,Q.jsxs)(C,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void be(e.id),"aria-label":`Remove account`,className:`p-1.5 rounded cursor-pointer text-text-subtle hover:text-error hover:bg-surface-elevated transition-colors shrink-0`,children:(0,Q.jsx)(o,{className:`size-4`})})}),(0,Q.jsx)(S,{side:`top`,children:`Remove account`})]})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(n||t.session!=null)&&(0,Q.jsx)(Ce,{label:`Gemini · 5-Hour Session`,pct:Dt(t.fiveHour),reset:he(t.session),resetsAt:t.session?.resetsAt}),(n||t.weekly!=null)&&(0,Q.jsx)(Ce,{label:`Gemini · Weekly`,pct:Dt(t.sevenDay),reset:he(t.weekly),resetsAt:t.weekly?.resetsAt}),t.weeklyScoped?.map(e=>(0,Q.jsx)(Ce,{label:e.label,pct:Dt(e.utilization),reset:he(e),resetsAt:e.resetsAt},e.label))]}),t.lastFetchedAt&&_e(t.lastFetchedAt)&&(0,Q.jsxs)(`p`,{className:`text-[10px] text-warning`,children:[`Last read `,ce(Date.parse(t.lastFetchedAt)),`. Neither agy nor the Antigravity app has answered since.`]})]},e.id)})})]}),(0,Q.jsx)(N,{open:E===`add`,onOpenChange:e=>{e||de()},children:(0,Q.jsxs)(A,{className:`sm:max-w-md max-h-[90dvh] overflow-y-auto`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`text-sm`,children:F?`Sign in again — ${F.label}`:`Add Antigravity Account`}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:F?`Sign in with Google to refresh this account's OAuth credentials.`:`Sign in with a Google account using Antigravity's OAuth PKCE flow. Each account is stored in its own isolated directory.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[!F&&(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{htmlFor:`agy-label`,className:`text-xs`,children:`Label (optional)`}),(0,Q.jsx)(I,{id:`agy-label`,placeholder:`e.g. Personal, Work, Shopee 2`,value:ee,onChange:e=>R(e.target.value),disabled:ne||V,className:`text-xs`})]}),(0,Q.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2.5`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] font-medium`,children:`Google OAuth Sign-In`}),z?(0,Q.jsxs)(`div`,{className:`space-y-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`a`,{href:z.authUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 font-medium text-primary hover:underline`,children:[(0,Q.jsx)(l,{className:`size-3.5`}),` Open Google Sign-In page`]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{X(),U(null)},disabled:V,className:`text-[11px] text-muted-foreground hover:text-foreground underline cursor-pointer`,children:`Start over`})]}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground leading-relaxed`,children:[`1. Open the link above and sign in with your Google account.`,(0,Q.jsx)(`br`,{}),`2. Copy the authorization code (or the full callback URL) shown after signing in and paste it below:`]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(H,{htmlFor:`agy-auth-code`,className:`text-xs`,children:`Authorization Code or Callback URL`}),(0,Q.jsx)(I,{id:`agy-auth-code`,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:`4/0A... or https://antigravity.google/oauth-callback?code=...`,value:B,onChange:e=>ie(e.target.value),disabled:V,className:`text-xs font-mono`})]}),(0,Q.jsxs)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void ge(),disabled:!B.trim()||V,children:[V&&(0,Q.jsx)(a,{className:`size-3.5 animate-spin`}),`Verify & Save Account`]})]}):(0,Q.jsx)(D,{size:`sm`,className:`w-full cursor-pointer gap-1.5`,onClick:()=>void pe(F),disabled:ne,children:ne?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{className:`size-4 animate-spin`}),` Generating Google sign-in link...`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-4`}),` Sign in with Google`]})})]})]}),oe&&(0,Q.jsx)(`div`,{role:`alert`,className:`text-[11px] p-2 rounded bg-error/10 text-error`,children:oe}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:de,children:`Cancel`})})]})}),(0,Q.jsx)(N,{open:E===`rotation`,onOpenChange:e=>P(e?`rotation`:null),children:(0,Q.jsxs)(A,{className:`sm:max-w-md`,children:[(0,Q.jsxs)(O,{children:[(0,Q.jsx)(j,{className:`text-sm`,children:`Antigravity Rotation`}),(0,Q.jsx)(M,{className:`text-xs leading-relaxed`,children:`How a new chat chooses among your enabled Antigravity accounts.`})]}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:Et.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>void we(e.value),"aria-current":n===e.value?`true`:void 0,className:b(`w-full text-left rounded-md border px-3 py-2.5 min-h-11 cursor-pointer transition-colors`,n===e.value?`border-primary bg-primary/10`:`border-border hover:bg-accent/50 active:bg-accent`),children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:e.label}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint})]},e.value))}),(0,Q.jsx)(k,{children:(0,Q.jsx)(D,{size:`sm`,variant:`outline`,className:`text-xs cursor-pointer`,onClick:()=>P(null),children:`Done`})})]})})]})}var kt=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`},{id:`antigravity`,label:`Antigravity`}];function At(){let[e,t]=(0,Z.useState)(null),[n,r]=(0,Z.useState)(()=>ge()),[i,o]=(0,Z.useState)(n?.provider??`claude`),s=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=()=>{let e=ge();e&&(o(e.provider),r(e))};return window.addEventListener(de,e),()=>window.removeEventListener(de,e)},[]),(0,Z.useEffect)(()=>{if(n)return ye(()=>s.current,n.accountId)},[n]),(0,Z.useEffect)(()=>{let e=!1;return ee().then(n=>{e||t(new Set(Object.keys(n.providers??{})))}).catch(()=>{e||t(new Set([`claude`]))}),()=>{e=!0}},[]);let c=kt.filter(t=>t.id===`claude`||e?.has(t.id)),l=c.length>1;return(0,Q.jsxs)(`div`,{ref:s,className:`space-y-4`,"data-testid":`accounts-pane`,"data-provider":i,children:[l&&(0,Q.jsx)(`div`,{className:`flex gap-1 border-b border-border/50`,children:c.map(e=>(0,Q.jsxs)(`button`,{onClick:()=>o(e.id),"data-testid":`accounts-tab-${e.id}`,"aria-current":i===e.id?`page`:void 0,className:`flex items-center gap-1.5 px-3 py-2 text-xs rounded-t transition-colors cursor-pointer ${i===e.id?`text-primary border-b-2 border-primary font-medium`:`text-text-subtle hover:text-text-secondary`}`,children:[(0,Q.jsx)(P,{providerId:e.id}),e.label]},e.id))}),e===null&&!l&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`size-3 animate-spin`}),` Checking configured providers...`]}),i===`claude`?(0,Q.jsx)(ut,{}):i===`codex`?(0,Q.jsx)(Tt,{}):(0,Q.jsx)(Ot,{})]})}export{At as AccountsSettingsSection};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-
|
|
2
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{pi as r}from"./icons-CpR5Vw3J.js";import{t as i}from"./preload-helper-uTix4PVD.js";import"./portal-container-context-C84rlnJ6.js";import{t as a}from"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import{t as o}from"./agent-session-sheet-store-BmiPCAkK.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-CbrD8f8E.js","assets/rolldown-runtime-C5c2KzVm.js","assets/vendor-ui-BQzUk4nq.js","assets/vendor-markdown-26eoXJk7.js","assets/button-CtdEWN7U.js","assets/utils-DMiycH3O.js","assets/libesm-DI_Tqx-0.js","assets/api-client-DSCscZEd.js","assets/open-ppm-tab-DtzJpJ3j.js","assets/settings-store-C8OGZwk3.js","assets/preload-helper-uTix4PVD.js","assets/react-BH62_kP1.js","assets/settings-events-BzBnHQWJ.js","assets/window-store-B_dGEBYm.js","assets/minimal-mode-DDuML1Oi.js","assets/file-browser-locate-BXtCNBm5.js","assets/use-explorer-open-state-xgkY0uH0.js","assets/use-is-mobile-CrfIt67b.js","assets/panel-store-D-yxAgT2.js","assets/session-list-sync-triggers-_I5gGBSe.js","assets/project-store-BaGmhKos.js","assets/project-framework-store-vI8djw4a.js","assets/vault-Q5oPy0h3.js","assets/open-assistant-B51EiM9k.js","assets/patch-tab-metadata-ux7PjnQA.js","assets/assistant-settings-tab-store-COShiyDn.js","assets/settings-categories-CF3Lu87s.js","assets/icons-CpR5Vw3J.js","assets/open-settings-B0FgHOUH.js","assets/tab-store-BZte1Bk4.js","assets/design-tab-metadata-o2TAAwEt.js","assets/chat-jump-store-BzDl2wpf.js","assets/vault-focus-store-BYABW4-C.js","assets/assistant-managers-DBFW4Vy_.js","assets/assistant-persona-CiWkGBFh.js","assets/assistant-settings-changes-client-CtWla7rL.js","assets/assistant-settings-api-DvAT6QKt.js","assets/tool-cards-CqkbtQmV.js","assets/index-CXjsAVvH.js","assets/createLucideIcon-nOpXneg9.js","assets/extension-icons-BSSI8zJe.js","assets/git-commit-horizontal-BJpjDb3H.js","assets/assistant-settings-BjX95t8Q.js","assets/assistant-digest-XqNJJf0c.js","assets/assistant-settings-dialog-DRQUTgxd.js","assets/feature-intros-ChY01Oi8.js","assets/session-collab-zjo6GNuD.js","assets/dialog-BWXzvHlC.js","assets/portal-container-context-C84rlnJ6.js","assets/mobile-bottom-sheet-C78UMLrn.js","assets/use-visual-viewport-tMLO63yY.js","assets/open-db-tabs-DZdSzKCD.js","assets/explorer-model-CMB2DLaE.js","assets/db-connection-config-DKVbmtru.js","assets/db-types-C1hMYmOv.js","assets/db-sidebar-reveal-C4tnK4SQ.js","assets/db-drivers-BIKN5HLb.js","assets/impexp-state-HsrqffES.js","assets/design-canvas-check-DahR87XO.js","assets/model-thinking-selector-helpers-Ii9MVjOq.js","assets/input-CCVoN0-P.js","assets/file-store-KmDlwUZn.js","assets/slash-command-picker-xIZbJS-p.js","assets/build-message-with-attachments-Dsq01VRu.js","assets/task-format-CrsdnUCC.js","assets/open-task-ziHSumpL.js","assets/use-manager-chats-7IXu1wX5.js","assets/open-chat-session-CdMiLwep.js","assets/open-chat-in-window-CZaKKuqs.js","assets/clipboard-DQuoK2EM.js","assets/ppm-tools-BqcIuull.js","assets/db-ai-tools-aywtaAlI.js","assets/split-sql-statements-DuAvbMlH.js","assets/tab-open-protocol-2j23y-fq.js","assets/user-message-parse-DnnkRdRT.js","assets/voice-message-DbyzMM-l.js","assets/set-manager-chat-dialog-CZm1uMTC.js","assets/provider-selector-CpYLloT9.js","assets/chat-preparation-cache-D6KJ1ZMi.js","assets/provider-logos-zWlJBGXd.js","assets/use-coarse-long-press-r69G14r1.js","assets/task-chip-peek-DHnIY0Tk.js","assets/task-links-card-DWc_jyX6.js","assets/dropdown-menu-DMZtzfk5.js","assets/radio-dot-UO7SfziL.js","assets/control-size-CT_5bmhe.js","assets/adaptive-context-menu-BY4ki-EE.js","assets/start-ellipsis-BQ0FJowG.js","assets/tooltip-CECVgROB.js","assets/api-settings-QpHmzgdx.js","assets/format-date-E9rSy4Po.js","assets/image-gallery-_m7xPIfe.js","assets/session-collab-client-DyKRYudE.js","assets/send-to-chat-BJ_Ychvo.js","assets/notification-store-hHQ6I1WT.js","assets/unsaved-grid-rows-store-DKZSxIbb.js","assets/sql-identifiers-D62yiJWh.js","assets/db-explorer-store-C7GIVWvY.js","assets/format-file-meta-B4qeznFu.js","assets/fs-api-COsHlRxJ.js","assets/scroll-area-DKwnCaCu.js","assets/use-git-repo-BjCnSkJ0.js","assets/git-repo-store-BCgyxqGc.js","assets/use-schedules-b8L8CH0W.js","assets/file-icons-wTYRmxJu.js","assets/global-ws-channel-C7BkbuOy.js","assets/ws-auth-BoXvat-e.js","assets/streaming-store-Dq4AjFuk.js","assets/apply-theme-BeLRfsSu.js","assets/resolve-theme-BHAgAaFk.js","assets/index-NLV9BOl2.css","assets/vault-tool-call-DZB6P-R4.js","assets/agent-session-sheet-store-BmiPCAkK.js","assets/image-preview-geometry-Cf-jUOA8.js","assets/markdown-context-99uxMEnW.js","assets/use-blob-url-C4KR9-lQ.js","assets/html-preview-loads-C539nMOs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{pi as r}from"./icons-CpR5Vw3J.js";import{t as i}from"./preload-helper-uTix4PVD.js";import"./portal-container-context-C84rlnJ6.js";import{t as a}from"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import{t as o}from"./agent-session-sheet-store-BmiPCAkK.js";var s=e(t(),1),c=n(),l=(0,s.lazy)(()=>i(()=>import(`./agent-session-window-content-CbrD8f8E.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116])));function u(){let e=o(e=>e.payload),t=o(e=>e.close);return e?(0,c.jsxs)(a,{open:!0,onClose:t,zIndex:45,className:`flex h-[var(--sheet-vh)] flex-col p-0`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,c.jsx)(`span`,{className:`truncate text-sm font-medium text-text-primary`,children:e.title??`Agent session`}),(0,c.jsx)(`button`,{type:`button`,onClick:t,className:`ml-auto flex size-11 items-center justify-center rounded text-text-secondary hover:text-text-primary`,"aria-label":`Close`,children:(0,c.jsx)(r,{className:`size-5`})})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`p-4 text-sm text-text-2`,children:`Loading…`}),children:(0,c.jsx)(l,{id:`sheet-${e.sessionId}`,payload:e})})})]}):null}export{u as AgentSessionSheet};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./settings-store-C8OGZwk3.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{F as r,R as i,Sn as a}from"./icons-CpR5Vw3J.js";import{y as o}from"./api-client-DSCscZEd.js";import{n as s}from"./utils-DMiycH3O.js";import"./portal-container-context-C84rlnJ6.js";import"./window-store-B_dGEBYm.js";import"./panel-store-D-yxAgT2.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./tab-store-BZte1Bk4.js";import"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import{n as c}from"./use-coarse-long-press-r69G14r1.js";import"./chat-jump-store-BzDl2wpf.js";import"./use-is-mobile-CrfIt67b.js";import"./settings-categories-CF3Lu87s.js";import"./open-settings-B0FgHOUH.js";import"./patch-tab-metadata-ux7PjnQA.js";import"./open-assistant-B51EiM9k.js";import"./open-ppm-tab-DtzJpJ3j.js";import"./vault-Q5oPy0h3.js";import"./assistant-settings-tab-store-COShiyDn.js";import"./vault-focus-store-BYABW4-C.js";import"./file-browser-locate-BXtCNBm5.js";import"./use-explorer-open-state-xgkY0uH0.js";import"./open-chat-session-CdMiLwep.js";import"./open-chat-in-window-CZaKKuqs.js";import"./session-collab-client-DyKRYudE.js";import"./session-collab-zjo6GNuD.js";import"./assistant-managers-DBFW4Vy_.js";import"./use-manager-chats-7IXu1wX5.js";import"./radio-dot-UO7SfziL.js";import"./notification-store-hHQ6I1WT.js";import"./button-CtdEWN7U.js";import"./chat-preparation-cache-D6KJ1ZMi.js";import"./provider-logos-zWlJBGXd.js";import"./provider-selector-CpYLloT9.js";import"./file-store-KmDlwUZn.js";import"./streaming-store-Dq4AjFuk.js";import"./open-task-ziHSumpL.js";import"./dropdown-menu-DMZtzfk5.js";import"./fs-api-COsHlRxJ.js";import"./task-format-CrsdnUCC.js";import"./assistant-persona-CiWkGBFh.js";import"./assistant-settings-api-DvAT6QKt.js";import{n as l,r as u}from"./global-ws-channel-C7BkbuOy.js";import"./task-chip-peek-DHnIY0Tk.js";import"./image-gallery-_m7xPIfe.js";import"./design-canvas-check-DahR87XO.js";import"./tab-open-protocol-2j23y-fq.js";import"./task-links-card-DWc_jyX6.js";import{a as d,i as f,t as p,v as m}from"./tool-cards-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./settings-store-C8OGZwk3.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{F as r,R as i,Sn as a}from"./icons-CpR5Vw3J.js";import{y as o}from"./api-client-DSCscZEd.js";import{n as s}from"./utils-DMiycH3O.js";import"./portal-container-context-C84rlnJ6.js";import"./window-store-B_dGEBYm.js";import"./panel-store-D-yxAgT2.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./tab-store-BZte1Bk4.js";import"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import{n as c}from"./use-coarse-long-press-r69G14r1.js";import"./chat-jump-store-BzDl2wpf.js";import"./use-is-mobile-CrfIt67b.js";import"./settings-categories-CF3Lu87s.js";import"./open-settings-B0FgHOUH.js";import"./patch-tab-metadata-ux7PjnQA.js";import"./open-assistant-B51EiM9k.js";import"./open-ppm-tab-DtzJpJ3j.js";import"./vault-Q5oPy0h3.js";import"./assistant-settings-tab-store-COShiyDn.js";import"./vault-focus-store-BYABW4-C.js";import"./file-browser-locate-BXtCNBm5.js";import"./use-explorer-open-state-xgkY0uH0.js";import"./open-chat-session-CdMiLwep.js";import"./open-chat-in-window-CZaKKuqs.js";import"./session-collab-client-DyKRYudE.js";import"./session-collab-zjo6GNuD.js";import"./assistant-managers-DBFW4Vy_.js";import"./use-manager-chats-7IXu1wX5.js";import"./radio-dot-UO7SfziL.js";import"./notification-store-hHQ6I1WT.js";import"./button-CtdEWN7U.js";import"./chat-preparation-cache-D6KJ1ZMi.js";import"./provider-logos-zWlJBGXd.js";import"./provider-selector-CpYLloT9.js";import"./file-store-KmDlwUZn.js";import"./streaming-store-Dq4AjFuk.js";import"./open-task-ziHSumpL.js";import"./dropdown-menu-DMZtzfk5.js";import"./fs-api-COsHlRxJ.js";import"./task-format-CrsdnUCC.js";import"./assistant-persona-CiWkGBFh.js";import"./assistant-settings-api-DvAT6QKt.js";import{n as l,r as u}from"./global-ws-channel-C7BkbuOy.js";import"./task-chip-peek-DHnIY0Tk.js";import"./image-gallery-_m7xPIfe.js";import"./design-canvas-check-DahR87XO.js";import"./tab-open-protocol-2j23y-fq.js";import"./task-links-card-DWc_jyX6.js";import{a as d,i as f,t as p,v as m}from"./tool-cards-CqkbtQmV.js";import"./libesm-DI_Tqx-0.js";import{t as h}from"./markdown-context-99uxMEnW.js";import"./vault-tool-call-DZB6P-R4.js";import"./use-blob-url-C4KR9-lQ.js";import"./assistant-settings-changes-client-CtWla7rL.js";import"./agent-session-sheet-store-BmiPCAkK.js";var g=e(t(),1),_=2e3;function v(e,t){let n=t.reset?[]:e.slice();for(let{ev:e,ts:r,k:i,replace:a}of t.events){let t=n.findIndex(e=>e.k===i);if(t!==-1){a&&(n[t]={k:i,ts:r,ev:e});continue}let o=n.length;for(;o>0&&n[o-1].ts>r;)o--;n.splice(o,0,{k:i,ts:r,ev:e})}return n.length>2e3?n.slice(n.length-_):n}function y(){return`ats-${Math.random().toString(36).slice(2,10)}`}function b(e){let{projectName:t,providerId:n,sessionId:r,source:i,fallbackEvents:a}=e,[o,s]=(0,g.useState)([]),[c,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(!0),[_,b]=(0,g.useState)(null);(0,g.useEffect)(()=>{let e=y(),a=[],o;s([]),d(!1),p(!1),h(!0),b(null);let c=()=>{u(JSON.stringify({type:`agent-transcript:subscribe`,subId:e,projectName:t,providerId:n,sessionId:r,source:i,...o?{cursor:o}:{}}))},f=t=>{let n=t.detail;n.subId===e&&(a=v(a,n),o=n.cursor,s(a),d(n.available),p(n.running),h(!1),b(null))},m=t=>{let n=t.detail;n.subId===e&&(d(!1),h(!1),b(n.code))};window.addEventListener(`agent-transcript:events`,f),window.addEventListener(`agent-transcript:error`,m);let g=l(c);return c(),()=>{window.removeEventListener(`agent-transcript:events`,f),window.removeEventListener(`agent-transcript:error`,m),g(),u(JSON.stringify({type:`agent-transcript:unsubscribe`,subId:e}))}},[JSON.stringify([t,n,r,i])]);let x=(0,g.useMemo)(()=>o.map(e=>e.ev),[o]);return{events:c?x:a??[],available:c,running:f,loading:m,error:_}}var x=n();function S(e){return e.filter(e=>e.type===`tool_use`).length}function C({status:e}){return e===`loading`?null:e===`running`?(0,x.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-primary shrink-0`,children:[(0,x.jsx)(a,{className:`size-2.5 animate-spin`}),` running`]}):e===`failed`?(0,x.jsx)(`span`,{className:`text-[10px] text-error shrink-0`,children:`failed`}):(0,x.jsx)(`span`,{className:`text-[10px] text-success shrink-0`,children:`done`})}function w({payload:e}){let t=e??{},n=t.sessionId?f(t.sessionId,t.source):``,l=d(e=>n?e.entries[n]:void 0),{events:u,available:_,running:v,loading:y,error:w}=b({projectName:t.projectName,providerId:t.providerId,sessionId:t.sessionId,source:t.source,fallbackEvents:l}),[T,E]=(0,g.useState)(!1),D=c(),O=(0,g.useMemo)(()=>S(u),[u]),k=u[u.length-1],A=!v&&!!k&&k.type===`tool_result`&&!!k.isError,j=y?`loading`:v?`running`:A?`failed`:`done`;return(0,x.jsx)(h.Provider,{value:o(t.projectName),children:(0,x.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 bg-surface @container`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/30 shrink-0`,children:[(0,x.jsx)(`span`,{className:`truncate text-xs font-medium`,children:t.title??`Agent session`}),u.length>0&&(0,x.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:m(O)}),(0,x.jsx)(C,{status:j}),!_&&!y&&(0,x.jsx)(`span`,{className:`ml-auto text-[10px] text-text-subtle shrink-0`,title:`No live transcript for this session — showing steps already held in memory`,children:`offline`})]}),!!t.prompt&&(0,x.jsxs)(`div`,{className:`border-b border-border/30 shrink-0`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>E(e=>!e),className:s(`flex w-full items-center gap-1.5 px-3 py-1.5 text-[11px] text-text-subtle hover:text-foreground`,D?`min-h-[44px]`:`min-h-[28px]`),children:[T?(0,x.jsx)(r,{className:`size-3`}):(0,x.jsx)(i,{className:`size-3`}),`Prompt`]}),T&&(0,x.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-text-secondary whitespace-pre-wrap select-text`,children:t.prompt})]}),y&&u.length===0?(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-text-subtle`,children:[(0,x.jsx)(a,{className:`size-3 animate-spin`}),`Loading session…`]}):u.length===0?(0,x.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-text-subtle px-4 text-center`,children:w?`Could not load this session`:`No recorded steps`}):(0,x.jsx)(p,{events:u,projectName:t.projectName,variant:`window`,className:`flex-1 min-h-0 overflow-y-auto px-3 py-2 space-y-1`})]})})}export{w as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./settings-store-C8OGZwk3.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{$r as r,Sn as i,br as a,r as o,wn as s}from"./icons-CpR5Vw3J.js";import{j as c}from"./api-client-DSCscZEd.js";import{n as l}from"./utils-DMiycH3O.js";import{Bn as u,Hn as d,J as f,Un as p,Vn as m,q as h,zn as g}from"./index-
|
|
1
|
+
import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./settings-store-C8OGZwk3.js";import{D as t,E as n}from"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import{$r as r,Sn as i,br as a,r as o,wn as s}from"./icons-CpR5Vw3J.js";import{j as c}from"./api-client-DSCscZEd.js";import{n as l}from"./utils-DMiycH3O.js";import{Bn as u,Hn as d,J as f,Un as p,Vn as m,q as h,zn as g}from"./index-CXjsAVvH.js";import{t as _}from"./use-monaco-theme-B4sZXOJo.js";var v=e(t(),1),y=n();function b({metadata:e}){let t=e?.filePath,n=e?.name,l=e?.resourceType??`skill`,b=e?.scope??`user`,S=e?.readOnly===!0,C=e?.shadowed===!0,w=e?.shadowedBy,T=e?.project??``,[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!0),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(!1),I=_(),L=(0,v.useRef)(``),R=E!==O;(0,v.useEffect)(()=>{let e=!1;return j(!0),N(null),d(t,T).then(t=>{e||(D(t.content),k(t.content),L.current=t.content)}).catch(t=>{e||N(t.message)}).finally(()=>{e||j(!1)}),()=>{e=!0}},[t,T]);let z=(0,v.useCallback)(async()=>{if(S||P)return;let e=L.current;if(e!==O){F(!0);try{await p(t,e,T),k(e),D(e),c.success(`Saved`),m.getState().reload()}catch(e){c.error(e.message)}finally{F(!1)}}},[t,T,O,S,P]);(0,v.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[z]);let B=u[l];return(0,y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[(0,y.jsx)(B,{className:`size-4 text-text-subtle`}),(0,y.jsx)(`span`,{className:`text-sm font-semibold`,children:n}),(0,y.jsx)(g,{scope:b}),R&&!S&&(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-primary`,title:`Unsaved changes`}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsxs)(`span`,{className:`hidden sm:block text-[11px] text-text-subtle`,children:[l,` · markdown`]}),!S&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`button`,{onClick:()=>D(O),disabled:!R||P,className:`flex items-center gap-1 rounded px-2 py-1 text-xs text-text-secondary hover:bg-surface-elevated disabled:opacity-40`,children:[(0,y.jsx)(r,{className:`size-3.5`}),` Revert`]}),(0,y.jsxs)(`button`,{onClick:()=>void z(),disabled:!R||P,className:`flex items-center gap-1 rounded bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-40`,children:[P?(0,y.jsx)(i,{className:`size-3.5 animate-spin`}):(0,y.jsx)(a,{className:`size-3.5`}),` Save`]})]})]}),S&&(0,y.jsx)(x,{icon:s,tone:`muted`,children:`Bundled resource — read-only. Duplicate it (from the AI Resources panel) to make an editable copy.`}),C&&w&&(0,y.jsxs)(x,{icon:o,tone:`warn`,children:[`This `,l,` is overridden by another “`,w.name,`” from a higher-priority source (`,w.source,`). It is currently inactive.`]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1`,children:A?(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,y.jsx)(i,{className:`size-5 animate-spin text-primary`})}):M?(0,y.jsx)(`div`,{className:`p-6 text-center text-sm text-destructive`,children:M}):(0,y.jsx)(f,{beforeMount:h,height:`100%`,language:`markdown`,theme:I,value:E,onChange:e=>{let t=e??``;L.current=t,D(t)},options:{readOnly:S,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,lineNumbers:`on`}})})]})}function x({icon:e,tone:t,children:n}){return(0,y.jsxs)(`div`,{className:l(`flex items-start gap-2 px-3 py-2 text-[12px] shrink-0 border-b border-border`,t===`warn`?`bg-amber-500/10 text-amber-300`:`bg-surface-elevated text-text-secondary`),children:[(0,y.jsx)(e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,y.jsx)(`span`,{children:n})]})}export{b as AiResourceEditor};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./settings-store-C8OGZwk3.js";import"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import"./icons-CpR5Vw3J.js";import"./api-client-DSCscZEd.js";import"./portal-container-context-C84rlnJ6.js";import"./window-store-B_dGEBYm.js";import"./panel-store-D-yxAgT2.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./tab-store-BZte1Bk4.js";import"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import"./use-is-mobile-CrfIt67b.js";import"./settings-categories-CF3Lu87s.js";import"./open-settings-B0FgHOUH.js";import"./button-CtdEWN7U.js";import"./dialog-BWXzvHlC.js";import"./chat-preparation-cache-D6KJ1ZMi.js";import"./provider-logos-zWlJBGXd.js";import"./provider-selector-CpYLloT9.js";import"./input-CCVoN0-P.js";import"./model-thinking-selector-helpers-Ii9MVjOq.js";import"./api-settings-QpHmzgdx.js";import{t as e}from"./ai-settings-section-
|
|
1
|
+
import"./settings-store-C8OGZwk3.js";import"./vendor-markdown-26eoXJk7.js";import"./vendor-ui-BQzUk4nq.js";import"./icons-CpR5Vw3J.js";import"./api-client-DSCscZEd.js";import"./portal-container-context-C84rlnJ6.js";import"./window-store-B_dGEBYm.js";import"./panel-store-D-yxAgT2.js";import"./project-store-BaGmhKos.js";import"./project-framework-store-vI8djw4a.js";import"./session-list-sync-triggers-_I5gGBSe.js";import"./tab-store-BZte1Bk4.js";import"./mobile-bottom-sheet-C78UMLrn.js";import"./use-visual-viewport-tMLO63yY.js";import"./use-is-mobile-CrfIt67b.js";import"./settings-categories-CF3Lu87s.js";import"./open-settings-B0FgHOUH.js";import"./button-CtdEWN7U.js";import"./dialog-BWXzvHlC.js";import"./chat-preparation-cache-D6KJ1ZMi.js";import"./provider-logos-zWlJBGXd.js";import"./provider-selector-CpYLloT9.js";import"./input-CCVoN0-P.js";import"./model-thinking-selector-helpers-Ii9MVjOq.js";import"./api-settings-QpHmzgdx.js";import{t as e}from"./ai-settings-section-Db9X6wec.js";export{e as AISettingsSection};
|
|
Binary file
|
|
Binary file
|