@hienlh/ppm 0.26.26 → 0.26.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (576) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/CLAUDE.md +2 -2
  3. package/assets/skills/ppm/SKILL.md +1 -1
  4. package/assets/skills/ppm/references/http-api.md +1 -1
  5. package/dist/web/assets/{accounts-settings-section-CHq3WVao.js → accounts-settings-section-D3_w2ePm.js} +1 -1
  6. package/dist/web/assets/accounts-settings-section-D3_w2ePm.js.br +0 -0
  7. package/dist/web/assets/accounts-settings-section-D3_w2ePm.js.gz +0 -0
  8. package/dist/web/assets/{agent-session-sheet-C0sgsTt9.js → agent-session-sheet-DYwZjQP7.js} +2 -2
  9. package/dist/web/assets/agent-session-sheet-DYwZjQP7.js.br +0 -0
  10. package/dist/web/assets/agent-session-sheet-DYwZjQP7.js.gz +0 -0
  11. package/dist/web/assets/{agent-session-window-content-CbrD8f8E.js → agent-session-window-content-D07cutjV.js} +1 -1
  12. package/dist/web/assets/agent-session-window-content-D07cutjV.js.br +0 -0
  13. package/dist/web/assets/agent-session-window-content-D07cutjV.js.gz +0 -0
  14. package/dist/web/assets/{ai-resource-editor-CjellqxA.js → ai-resource-editor--cO_JuHk.js} +1 -1
  15. package/dist/web/assets/ai-resource-editor--cO_JuHk.js.br +0 -0
  16. package/dist/web/assets/ai-resource-editor--cO_JuHk.js.gz +0 -0
  17. package/dist/web/assets/{ai-settings-section-CSRMdQ2S.js → ai-settings-section-Brn-aWB3.js} +1 -1
  18. package/dist/web/assets/ai-settings-section-Brn-aWB3.js.br +0 -0
  19. package/dist/web/assets/ai-settings-section-Brn-aWB3.js.gz +0 -0
  20. package/dist/web/assets/{ai-settings-section-Db9X6wec.js → ai-settings-section-CnyTPE3r.js} +1 -1
  21. package/dist/web/assets/ai-settings-section-CnyTPE3r.js.br +0 -0
  22. package/dist/web/assets/ai-settings-section-CnyTPE3r.js.gz +0 -0
  23. package/dist/web/assets/{android-tab-DG1-4oee.js → android-tab-Dh586Izw.js} +1 -1
  24. package/dist/web/assets/android-tab-Dh586Izw.js.br +0 -0
  25. package/dist/web/assets/android-tab-Dh586Izw.js.gz +0 -0
  26. package/dist/web/assets/{antigravity-usage-view-C9gPFRb5.js → antigravity-usage-view-B3nS0dXF.js} +1 -1
  27. package/dist/web/assets/antigravity-usage-view-B3nS0dXF.js.br +0 -0
  28. package/dist/web/assets/antigravity-usage-view-B3nS0dXF.js.gz +0 -0
  29. package/dist/web/assets/{appearance-settings-section-By5gIwBb.js → appearance-settings-section-DTLHddyX.js} +1 -1
  30. package/dist/web/assets/appearance-settings-section-DTLHddyX.js.br +0 -0
  31. package/dist/web/assets/appearance-settings-section-DTLHddyX.js.gz +0 -0
  32. package/dist/web/assets/{apps-panel-D7fUCDns.js → apps-panel-CkgEPDcf.js} +1 -1
  33. package/dist/web/assets/apps-panel-CkgEPDcf.js.br +0 -0
  34. package/dist/web/assets/apps-panel-CkgEPDcf.js.gz +0 -0
  35. package/dist/web/assets/{assistant-settings-section-D2XmOMHN.js → assistant-settings-section-DRfpX0tI.js} +1 -1
  36. package/dist/web/assets/assistant-settings-section-DRfpX0tI.js.br +0 -0
  37. package/dist/web/assets/assistant-settings-section-DRfpX0tI.js.gz +0 -0
  38. package/dist/web/assets/{assistant-tab-BFarx_Ed.js → assistant-tab-DQ3og-MK.js} +1 -1
  39. package/dist/web/assets/assistant-tab-DQ3og-MK.js.br +0 -0
  40. package/dist/web/assets/assistant-tab-DQ3og-MK.js.gz +0 -0
  41. package/dist/web/assets/{branch-review-tab-DdIk8GqJ.js → branch-review-tab-C3yGKHTd.js} +1 -1
  42. package/dist/web/assets/branch-review-tab-C3yGKHTd.js.br +0 -0
  43. package/dist/web/assets/branch-review-tab-C3yGKHTd.js.gz +0 -0
  44. package/dist/web/assets/{build-message-with-attachments-Dsq01VRu.js → build-message-with-attachments-Co6REDSl.js} +1 -1
  45. package/dist/web/assets/build-message-with-attachments-Co6REDSl.js.br +0 -0
  46. package/dist/web/assets/build-message-with-attachments-Co6REDSl.js.gz +0 -0
  47. package/dist/web/assets/{chat-tab-CvA7BVJ4.js → chat-tab-C3w-wc2n.js} +1 -1
  48. package/dist/web/assets/chat-tab-C3w-wc2n.js.br +0 -0
  49. package/dist/web/assets/chat-tab-C3w-wc2n.js.gz +0 -0
  50. package/dist/web/assets/chat-tab-JRu__VsV.js +16 -0
  51. package/dist/web/assets/chat-tab-JRu__VsV.js.br +0 -0
  52. package/dist/web/assets/chat-tab-JRu__VsV.js.gz +0 -0
  53. package/dist/web/assets/{code-editor-DtOD5q9b.js → code-editor-H7RVivX2.js} +4 -4
  54. package/dist/web/assets/code-editor-H7RVivX2.js.br +0 -0
  55. package/dist/web/assets/code-editor-H7RVivX2.js.gz +0 -0
  56. package/dist/web/assets/{conflict-editor-Dj4BkpPf.js → conflict-editor-ga3hijb0.js} +1 -1
  57. package/dist/web/assets/conflict-editor-ga3hijb0.js.br +0 -0
  58. package/dist/web/assets/conflict-editor-ga3hijb0.js.gz +0 -0
  59. package/dist/web/assets/{connection-form-tab-Dk7r5Mtu.js → connection-form-tab-D_zOAzNd.js} +1 -1
  60. package/dist/web/assets/connection-form-tab-D_zOAzNd.js.br +0 -0
  61. package/dist/web/assets/{connection-form-tab-Dk7r5Mtu.js.gz → connection-form-tab-D_zOAzNd.js.gz} +0 -0
  62. package/dist/web/assets/{csv-preview-Dgmt5iQZ.js → csv-preview-AZ34W-Mh.js} +1 -1
  63. package/dist/web/assets/csv-preview-AZ34W-Mh.js.br +0 -0
  64. package/dist/web/assets/csv-preview-AZ34W-Mh.js.gz +0 -0
  65. package/dist/web/assets/{database-drivers-section-DSbxYtMp.js → database-drivers-section-CrqeJq7u.js} +1 -1
  66. package/dist/web/assets/database-drivers-section-CrqeJq7u.js.br +0 -0
  67. package/dist/web/assets/database-drivers-section-CrqeJq7u.js.gz +0 -0
  68. package/dist/web/assets/{db-tab-parts-CWVmqUJa.js → db-tab-parts-_IP72jRK.js} +1 -1
  69. package/dist/web/assets/db-tab-parts-_IP72jRK.js.br +0 -0
  70. package/dist/web/assets/db-tab-parts-_IP72jRK.js.gz +0 -0
  71. package/dist/web/assets/{design-settings-section-CnWSH_2N.js → design-settings-section-BtV8M47M.js} +1 -1
  72. package/dist/web/assets/design-settings-section-BtV8M47M.js.br +0 -0
  73. package/dist/web/assets/design-settings-section-BtV8M47M.js.gz +0 -0
  74. package/dist/web/assets/{design-tab-DiqcX1dI.js → design-tab-T7fULsYK.js} +1 -1
  75. package/dist/web/assets/design-tab-T7fULsYK.js.br +0 -0
  76. package/dist/web/assets/design-tab-T7fULsYK.js.gz +0 -0
  77. package/dist/web/assets/{designs-sidebar-panel-DeE4Jcpo.js → designs-sidebar-panel-DSmsYAGy.js} +1 -1
  78. package/dist/web/assets/designs-sidebar-panel-DSmsYAGy.js.br +0 -0
  79. package/dist/web/assets/designs-sidebar-panel-DSmsYAGy.js.gz +0 -0
  80. package/dist/web/assets/{diff-viewer-6O_OSt5v.js → diff-viewer-tQfd7lY-.js} +1 -1
  81. package/dist/web/assets/diff-viewer-tQfd7lY-.js.br +0 -0
  82. package/dist/web/assets/diff-viewer-tQfd7lY-.js.gz +0 -0
  83. package/dist/web/assets/{docx-preview-CLWVH9aX.js → docx-preview-B0Z5AIva.js} +1 -1
  84. package/dist/web/assets/docx-preview-B0Z5AIva.js.br +0 -0
  85. package/dist/web/assets/docx-preview-B0Z5AIva.js.gz +0 -0
  86. package/dist/web/assets/{editor-dialog-DFix0Lrm.js → editor-dialog-CS7gfskk.js} +1 -1
  87. package/dist/web/assets/{editor-dialog-DFix0Lrm.js.br → editor-dialog-CS7gfskk.js.br} +0 -0
  88. package/dist/web/assets/editor-dialog-CS7gfskk.js.gz +0 -0
  89. package/dist/web/assets/{editor-language-service-BxWCC26X.js → editor-language-service-COewJHSy.js} +1 -1
  90. package/dist/web/assets/editor-language-service-COewJHSy.js.br +0 -0
  91. package/dist/web/assets/editor-language-service-COewJHSy.js.gz +0 -0
  92. package/dist/web/assets/{explorer-body-D0CQnNgj.js → explorer-body-C84sjy1L.js} +1 -1
  93. package/dist/web/assets/explorer-body-C84sjy1L.js.br +0 -0
  94. package/dist/web/assets/explorer-body-C84sjy1L.js.gz +0 -0
  95. package/dist/web/assets/{explorer-window-content-DPLxcaoz.js → explorer-window-content-lf8LzExx.js} +1 -1
  96. package/dist/web/assets/explorer-window-content-lf8LzExx.js.br +0 -0
  97. package/dist/web/assets/explorer-window-content-lf8LzExx.js.gz +0 -0
  98. package/dist/web/assets/{extension-manager-section-BWPlMBS4.js → extension-manager-section-CZEzquNp.js} +1 -1
  99. package/dist/web/assets/extension-manager-section-CZEzquNp.js.br +0 -0
  100. package/dist/web/assets/extension-manager-section-CZEzquNp.js.gz +0 -0
  101. package/dist/web/assets/{extension-webview-D5IPLnq8.js → extension-webview-BHrLFzXj.js} +1 -1
  102. package/dist/web/assets/extension-webview-BHrLFzXj.js.br +0 -0
  103. package/dist/web/assets/extension-webview-BHrLFzXj.js.gz +0 -0
  104. package/dist/web/assets/file-store-DvNGR1CA.js +1 -0
  105. package/dist/web/assets/file-store-DvNGR1CA.js.br +0 -0
  106. package/dist/web/assets/file-store-DvNGR1CA.js.gz +0 -0
  107. package/dist/web/assets/{files-settings-section-MR-8W7DJ.js → files-settings-section-BlUeoibH.js} +1 -1
  108. package/dist/web/assets/files-settings-section-BlUeoibH.js.br +0 -0
  109. package/dist/web/assets/files-settings-section-BlUeoibH.js.gz +0 -0
  110. package/dist/web/assets/{general-settings-section-CEl3ciuP.js → general-settings-section-DhI6sUM3.js} +1 -1
  111. package/dist/web/assets/general-settings-section-DhI6sUM3.js.br +0 -0
  112. package/dist/web/assets/general-settings-section-DhI6sUM3.js.gz +0 -0
  113. package/dist/web/assets/{git-log-panel-DBfy0HRE.js → git-log-panel-CDss_FRo.js} +1 -1
  114. package/dist/web/assets/git-log-panel-CDss_FRo.js.br +0 -0
  115. package/dist/web/assets/git-log-panel-CDss_FRo.js.gz +0 -0
  116. package/dist/web/assets/{git-review-tab-C1V1CZAt.js → git-review-tab-Dq0n4l6O.js} +1 -1
  117. package/dist/web/assets/git-review-tab-Dq0n4l6O.js.br +0 -0
  118. package/dist/web/assets/git-review-tab-Dq0n4l6O.js.gz +0 -0
  119. package/dist/web/assets/{glide-data-grid-D84U-1qn.js → glide-data-grid-j8rWvpbY.js} +1 -1
  120. package/dist/web/assets/glide-data-grid-j8rWvpbY.js.br +0 -0
  121. package/dist/web/assets/{glide-data-grid-D84U-1qn.js.gz → glide-data-grid-j8rWvpbY.js.gz} +0 -0
  122. package/dist/web/assets/{grid-save-dialog-D9q2lcrq.js → grid-save-dialog-uxoRmuGo.js} +1 -1
  123. package/dist/web/assets/grid-save-dialog-uxoRmuGo.js.br +0 -0
  124. package/dist/web/assets/grid-save-dialog-uxoRmuGo.js.gz +0 -0
  125. package/dist/web/assets/{group-chat-tab-Bl0ECmSY.js → group-chat-tab-CuR5xrEo.js} +1 -1
  126. package/dist/web/assets/group-chat-tab-CuR5xrEo.js.br +0 -0
  127. package/dist/web/assets/group-chat-tab-CuR5xrEo.js.gz +0 -0
  128. package/dist/web/assets/{impexp-tab-BgGbQxzM.js → impexp-tab-KSdMfwa0.js} +1 -1
  129. package/dist/web/assets/impexp-tab-KSdMfwa0.js.br +0 -0
  130. package/dist/web/assets/impexp-tab-KSdMfwa0.js.gz +0 -0
  131. package/dist/web/assets/index-0VrQhdqv.css +1 -0
  132. package/dist/web/assets/index-0VrQhdqv.css.br +0 -0
  133. package/dist/web/assets/index-0VrQhdqv.css.gz +0 -0
  134. package/dist/web/assets/index-CwW8jYaQ.js +61 -0
  135. package/dist/web/assets/index-CwW8jYaQ.js.br +0 -0
  136. package/dist/web/assets/index-CwW8jYaQ.js.gz +0 -0
  137. package/dist/web/assets/{jira-watcher-section-ButbXGom.js → jira-watcher-section-Bwmios6B.js} +1 -1
  138. package/dist/web/assets/{keybindings-store-csigJZE3.js → keybindings-store-cNyx7joi.js} +1 -1
  139. package/dist/web/assets/{keyboard-shortcuts-section-BWvBH4ZU.js → keyboard-shortcuts-section-Dj3JImAF.js} +1 -1
  140. package/dist/web/assets/keyboard-shortcuts-section-Dj3JImAF.js.br +0 -0
  141. package/dist/web/assets/keyboard-shortcuts-section-Dj3JImAF.js.gz +0 -0
  142. package/dist/web/assets/{language-servers-section-DnehfNOm.js → language-servers-section-CefYgT1u.js} +2 -2
  143. package/dist/web/assets/language-servers-section-CefYgT1u.js.br +0 -0
  144. package/dist/web/assets/language-servers-section-CefYgT1u.js.gz +0 -0
  145. package/dist/web/assets/{logs-app-BlFJdAK9.js → logs-app-BXRv_zvF.js} +1 -1
  146. package/dist/web/assets/logs-app-BXRv_zvF.js.br +0 -0
  147. package/dist/web/assets/logs-app-BXRv_zvF.js.gz +0 -0
  148. package/dist/web/assets/{logs-tab-LAVt-dDa.js → logs-tab-Bj0QRW79.js} +1 -1
  149. package/dist/web/assets/{logs-window-content-Dfswr7eH.js → logs-window-content-BLmlGYHL.js} +1 -1
  150. package/dist/web/assets/{lsp-client-CHfLLcaF.js → lsp-client-DVXWoea-.js} +1 -1
  151. package/dist/web/assets/lsp-client-DVXWoea-.js.br +0 -0
  152. package/dist/web/assets/lsp-client-DVXWoea-.js.gz +0 -0
  153. package/dist/web/assets/{markdown-renderer-CSFnCZ8K.js → markdown-renderer-DWtBXkPO.js} +1 -1
  154. package/dist/web/assets/markdown-renderer-DWtBXkPO.js.br +0 -0
  155. package/dist/web/assets/markdown-renderer-DWtBXkPO.js.gz +0 -0
  156. package/dist/web/assets/{markdown-renderer-DksvADDz.js → markdown-renderer-P026cp3s.js} +1 -1
  157. package/dist/web/assets/markdown-renderer-P026cp3s.js.br +0 -0
  158. package/dist/web/assets/markdown-renderer-P026cp3s.js.gz +0 -0
  159. package/dist/web/assets/{mobile-explorer-sheet-B5sLjLZs.js → mobile-explorer-sheet-B9HZDsEs.js} +1 -1
  160. package/dist/web/assets/mobile-explorer-sheet-B9HZDsEs.js.br +0 -0
  161. package/dist/web/assets/mobile-explorer-sheet-B9HZDsEs.js.gz +0 -0
  162. package/dist/web/assets/{monaco-diff-editor-CXo44_VI.js → monaco-diff-editor-B8ArCEIw.js} +1 -1
  163. package/dist/web/assets/{new-design-dialog-_GiCQMy2.js → new-design-dialog-oIiyRrhh.js} +1 -1
  164. package/dist/web/assets/new-design-dialog-oIiyRrhh.js.br +0 -0
  165. package/dist/web/assets/new-design-dialog-oIiyRrhh.js.gz +0 -0
  166. package/dist/web/assets/{notifications-settings-section-D8irgdCE.js → notifications-settings-section-BkcKbTgz.js} +1 -1
  167. package/dist/web/assets/notifications-settings-section-BkcKbTgz.js.br +0 -0
  168. package/dist/web/assets/notifications-settings-section-BkcKbTgz.js.gz +0 -0
  169. package/dist/web/assets/{onboarding-entry-DzhsgvnY.js → onboarding-entry-DiyOOJFf.js} +1 -1
  170. package/dist/web/assets/{onboarding-entry-DzhsgvnY.js.br → onboarding-entry-DiyOOJFf.js.br} +0 -0
  171. package/dist/web/assets/onboarding-entry-DiyOOJFf.js.gz +0 -0
  172. package/dist/web/assets/{open-manager-chat-CNVW5U1C.js → open-manager-chat-D6UohARN.js} +1 -1
  173. package/dist/web/assets/{open-manager-chat-CNVW5U1C.js.br → open-manager-chat-D6UohARN.js.br} +0 -0
  174. package/dist/web/assets/open-manager-chat-D6UohARN.js.gz +0 -0
  175. package/dist/web/assets/{open-manager-chat-Bkb2PmYu.js → open-manager-chat-nL69R9PI.js} +1 -1
  176. package/dist/web/assets/open-manager-chat-nL69R9PI.js.br +0 -0
  177. package/dist/web/assets/open-manager-chat-nL69R9PI.js.gz +0 -0
  178. package/dist/web/assets/{problems-panel-DZCBTTK0.js → problems-panel-oyuU0uxS.js} +1 -1
  179. package/dist/web/assets/problems-panel-oyuU0uxS.js.br +0 -0
  180. package/dist/web/assets/problems-panel-oyuU0uxS.js.gz +0 -0
  181. package/dist/web/assets/{process-table-oLXQ1Mj2.js → process-table-BsR2ECwi.js} +1 -1
  182. package/dist/web/assets/process-table-BsR2ECwi.js.br +0 -0
  183. package/dist/web/assets/process-table-BsR2ECwi.js.gz +0 -0
  184. package/dist/web/assets/{proxy-settings-section-D88d-YqC.js → proxy-settings-section-Q1kpZeaT.js} +1 -1
  185. package/dist/web/assets/proxy-settings-section-Q1kpZeaT.js.br +0 -0
  186. package/dist/web/assets/proxy-settings-section-Q1kpZeaT.js.gz +0 -0
  187. package/dist/web/assets/{query-tab-D3UWqL_c.js → query-tab-Bx-Jp2_d.js} +1 -1
  188. package/dist/web/assets/query-tab-Bx-Jp2_d.js.br +0 -0
  189. package/dist/web/assets/query-tab-Bx-Jp2_d.js.gz +0 -0
  190. package/dist/web/assets/{release-notes-window-content-DBGd9q2f.js → release-notes-window-content-B6xYuiZK.js} +1 -1
  191. package/dist/web/assets/{remote-access-settings-section-lDOBuTcD.js → remote-access-settings-section-C1QRH2ow.js} +1 -1
  192. package/dist/web/assets/remote-access-settings-section-C1QRH2ow.js.br +0 -0
  193. package/dist/web/assets/remote-access-settings-section-C1QRH2ow.js.gz +0 -0
  194. package/dist/web/assets/{remote-desktop-clipboard-notice-C8lLPqSE.js → remote-desktop-clipboard-notice-DdINcOEY.js} +1 -1
  195. package/dist/web/assets/remote-desktop-clipboard-notice-DdINcOEY.js.br +0 -0
  196. package/dist/web/assets/remote-desktop-clipboard-notice-DdINcOEY.js.gz +0 -0
  197. package/dist/web/assets/{remote-desktop-mobile-sheet-1X9nMYdk.js → remote-desktop-mobile-sheet-BlEM8AcD.js} +2 -2
  198. package/dist/web/assets/remote-desktop-mobile-sheet-BlEM8AcD.js.br +0 -0
  199. package/dist/web/assets/remote-desktop-mobile-sheet-BlEM8AcD.js.gz +0 -0
  200. package/dist/web/assets/{remote-desktop-mobile-view-DXlyxMuT.js → remote-desktop-mobile-view-GvyV8wyb.js} +1 -1
  201. package/dist/web/assets/remote-desktop-mobile-view-GvyV8wyb.js.br +0 -0
  202. package/dist/web/assets/remote-desktop-mobile-view-GvyV8wyb.js.gz +0 -0
  203. package/dist/web/assets/{remote-desktop-readiness-gate-CapsSTlz.js → remote-desktop-readiness-gate-BSpv6mQ-.js} +1 -1
  204. package/dist/web/assets/remote-desktop-readiness-gate-BSpv6mQ-.js.br +0 -0
  205. package/dist/web/assets/remote-desktop-readiness-gate-BSpv6mQ-.js.gz +0 -0
  206. package/dist/web/assets/{remote-desktop-window-content-CmASOSoo.js → remote-desktop-window-content-Iup6SCK3.js} +1 -1
  207. package/dist/web/assets/remote-desktop-window-content-Iup6SCK3.js.br +0 -0
  208. package/dist/web/assets/remote-desktop-window-content-Iup6SCK3.js.gz +0 -0
  209. package/dist/web/assets/{rename-object-dialog-CFhoU1ti.js → rename-object-dialog-Bn8F5g-i.js} +1 -1
  210. package/dist/web/assets/rename-object-dialog-Bn8F5g-i.js.br +0 -0
  211. package/dist/web/assets/rename-object-dialog-Bn8F5g-i.js.gz +0 -0
  212. package/dist/web/assets/{reveal-task-in-sidebar-Dz0tH8vo.js → reveal-task-in-sidebar-f_-2Az7U.js} +1 -1
  213. package/dist/web/assets/{review-address-setup-CHbOBPtn.js → review-address-setup-2XE_wU5y.js} +1 -1
  214. package/dist/web/assets/review-address-setup-2XE_wU5y.js.br +0 -0
  215. package/dist/web/assets/review-address-setup-2XE_wU5y.js.gz +0 -0
  216. package/dist/web/assets/{review-code-Ek4TK-FX.js → review-code-gFAi1VYM.js} +1 -1
  217. package/dist/web/assets/review-code-gFAi1VYM.js.br +0 -0
  218. package/dist/web/assets/review-code-gFAi1VYM.js.gz +0 -0
  219. package/dist/web/assets/{save-as-dialog-m00iZElW.js → save-as-dialog-BQDZtrUf.js} +1 -1
  220. package/dist/web/assets/save-as-dialog-BQDZtrUf.js.br +0 -0
  221. package/dist/web/assets/save-as-dialog-BQDZtrUf.js.gz +0 -0
  222. package/dist/web/assets/{schedule-form-BDbZLG_F.js → schedule-form-DiuMU_nt.js} +3 -3
  223. package/dist/web/assets/schedule-form-DiuMU_nt.js.br +0 -0
  224. package/dist/web/assets/schedule-form-DiuMU_nt.js.gz +0 -0
  225. package/dist/web/assets/{schedule-script-editor-BC7_nlsE.js → schedule-script-editor-28peB9iT.js} +1 -1
  226. package/dist/web/assets/schedule-script-editor-28peB9iT.js.br +0 -0
  227. package/dist/web/assets/schedule-script-editor-28peB9iT.js.gz +0 -0
  228. package/dist/web/assets/{schedules-app-C6IdZ1hz.js → schedules-app-NT6c01VK.js} +1 -1
  229. package/dist/web/assets/schedules-app-NT6c01VK.js.br +0 -0
  230. package/dist/web/assets/schedules-app-NT6c01VK.js.gz +0 -0
  231. package/dist/web/assets/{schedules-settings-section-Dhc_ZbMP.js → schedules-settings-section-Dq56Aq9t.js} +3 -3
  232. package/dist/web/assets/schedules-settings-section-Dq56Aq9t.js.br +0 -0
  233. package/dist/web/assets/schedules-settings-section-Dq56Aq9t.js.gz +0 -0
  234. package/dist/web/assets/{schedules-tab-NMvWV7xN.js → schedules-tab-CKo3Zsj6.js} +1 -1
  235. package/dist/web/assets/schedules-tab-CKo3Zsj6.js.br +0 -0
  236. package/dist/web/assets/schedules-tab-CKo3Zsj6.js.gz +0 -0
  237. package/dist/web/assets/{schedules-ui-DaSldyoD.js → schedules-ui-Ct6leygy.js} +1 -1
  238. package/dist/web/assets/schedules-ui-Ct6leygy.js.br +0 -0
  239. package/dist/web/assets/schedules-ui-Ct6leygy.js.gz +0 -0
  240. package/dist/web/assets/{schedules-window-content-MseZLBpK.js → schedules-window-content-C589_OKf.js} +1 -1
  241. package/dist/web/assets/schedules-window-content-C589_OKf.js.br +0 -0
  242. package/dist/web/assets/schedules-window-content-C589_OKf.js.gz +0 -0
  243. package/dist/web/assets/{session-review-tab-BEPMJynS.js → session-review-tab-CkGq1u-8.js} +1 -1
  244. package/dist/web/assets/session-review-tab-CkGq1u-8.js.br +0 -0
  245. package/dist/web/assets/session-review-tab-CkGq1u-8.js.gz +0 -0
  246. package/dist/web/assets/{settings-body-D2e_RbI4.js → settings-body-BqZQAys_.js} +1 -1
  247. package/dist/web/assets/settings-body-BqZQAys_.js.br +0 -0
  248. package/dist/web/assets/settings-body-BqZQAys_.js.gz +0 -0
  249. package/dist/web/assets/{settings-rows-B6puQ-Vk.js → settings-rows-Bb4STWcn.js} +1 -1
  250. package/dist/web/assets/settings-rows-Bb4STWcn.js.br +0 -0
  251. package/dist/web/assets/settings-rows-Bb4STWcn.js.gz +0 -0
  252. package/dist/web/assets/{settings-section-content-DPyAAu71.js → settings-section-content-DX_GdFMc.js} +1 -1
  253. package/dist/web/assets/{settings-section-content-Mzy53zFZ.js → settings-section-content-Di0LahcQ.js} +2 -2
  254. package/dist/web/assets/settings-section-content-Di0LahcQ.js.br +0 -0
  255. package/dist/web/assets/settings-section-content-Di0LahcQ.js.gz +0 -0
  256. package/dist/web/assets/{settings-tab-DFgGmabd.js → settings-tab-DX0h-GYd.js} +1 -1
  257. package/dist/web/assets/{settings-window-content-C9IxMJOD.js → settings-window-content-CEQNeSdk.js} +1 -1
  258. package/dist/web/assets/{sql-object-tab-DXiJqm1Y.js → sql-object-tab-DJXb0lpf.js} +1 -1
  259. package/dist/web/assets/sql-object-tab-DJXb0lpf.js.br +0 -0
  260. package/dist/web/assets/sql-object-tab-DJXb0lpf.js.gz +0 -0
  261. package/dist/web/assets/{sqlite-viewer-BoqlcTq3.js → sqlite-viewer-hs32HxsR.js} +1 -1
  262. package/dist/web/assets/sqlite-viewer-hs32HxsR.js.br +0 -0
  263. package/dist/web/assets/sqlite-viewer-hs32HxsR.js.gz +0 -0
  264. package/dist/web/assets/{storage-settings-section-BSzvRWfE.js → storage-settings-section-CPUJt1fa.js} +1 -1
  265. package/dist/web/assets/storage-settings-section-CPUJt1fa.js.br +0 -0
  266. package/dist/web/assets/storage-settings-section-CPUJt1fa.js.gz +0 -0
  267. package/dist/web/assets/{structure-save-dialog-DmAOFSGl.js → structure-save-dialog-DanBkCiV.js} +1 -1
  268. package/dist/web/assets/structure-save-dialog-DanBkCiV.js.br +0 -0
  269. package/dist/web/assets/structure-save-dialog-DanBkCiV.js.gz +0 -0
  270. package/dist/web/assets/{structure-tab-Cj2T4GOA.js → structure-tab-C5CeA6ix.js} +1 -1
  271. package/dist/web/assets/structure-tab-C5CeA6ix.js.br +0 -0
  272. package/dist/web/assets/structure-tab-C5CeA6ix.js.gz +0 -0
  273. package/dist/web/assets/{system-monitor-body-ryEXCvyT.js → system-monitor-body-zvJUsvO9.js} +2 -2
  274. package/dist/web/assets/system-monitor-body-zvJUsvO9.js.br +0 -0
  275. package/dist/web/assets/system-monitor-body-zvJUsvO9.js.gz +0 -0
  276. package/dist/web/assets/{system-monitor-tab-DcNzbPgb.js → system-monitor-tab-BEmD7cX5.js} +1 -1
  277. package/dist/web/assets/{system-monitor-window-content-CpFLui4-.js → system-monitor-window-content-DghMx4JN.js} +1 -1
  278. package/dist/web/assets/{tab-host-window-content-CD92R8Dj.js → tab-host-window-content-BkrRvAg-.js} +1 -1
  279. package/dist/web/assets/{tab-host-window-content-CD92R8Dj.js.br → tab-host-window-content-BkrRvAg-.js.br} +0 -0
  280. package/dist/web/assets/tab-host-window-content-BkrRvAg-.js.gz +0 -0
  281. package/dist/web/assets/{table-tab-zoEhA_cF.js → table-tab-DaOD-uvL.js} +1 -1
  282. package/dist/web/assets/table-tab-DaOD-uvL.js.br +0 -0
  283. package/dist/web/assets/table-tab-DaOD-uvL.js.gz +0 -0
  284. package/dist/web/assets/{task-detail-mobile-40HLTUnk.js → task-detail-mobile-BmXfCLrx.js} +1 -1
  285. package/dist/web/assets/task-detail-mobile-BmXfCLrx.js.br +0 -0
  286. package/dist/web/assets/task-detail-mobile-BmXfCLrx.js.gz +0 -0
  287. package/dist/web/assets/{task-sheet-Tbk7O-Ak.js → task-sheet-B5pIWo1Q.js} +1 -1
  288. package/dist/web/assets/task-sheet-B5pIWo1Q.js.br +0 -0
  289. package/dist/web/assets/task-sheet-B5pIWo1Q.js.gz +0 -0
  290. package/dist/web/assets/{task-status-grid-D4UX5sy_.js → task-status-grid-D-GhknFi.js} +1 -1
  291. package/dist/web/assets/task-status-grid-D-GhknFi.js.br +0 -0
  292. package/dist/web/assets/task-status-grid-D-GhknFi.js.gz +0 -0
  293. package/dist/web/assets/{task-tab-CrW-DqBd.js → task-tab-CK7aG2Ec.js} +1 -1
  294. package/dist/web/assets/task-tab-CK7aG2Ec.js.br +0 -0
  295. package/dist/web/assets/task-tab-CK7aG2Ec.js.gz +0 -0
  296. package/dist/web/assets/{tasks-sidebar-panel-D3opTyDQ.js → tasks-sidebar-panel-D51n4uTs.js} +1 -1
  297. package/dist/web/assets/tasks-sidebar-panel-D51n4uTs.js.br +0 -0
  298. package/dist/web/assets/tasks-sidebar-panel-D51n4uTs.js.gz +0 -0
  299. package/dist/web/assets/{telegram-bot-token-field-CP_XKOOb.js → telegram-bot-token-field-Cn2tYIPN.js} +1 -1
  300. package/dist/web/assets/telegram-bot-token-field-Cn2tYIPN.js.br +0 -0
  301. package/dist/web/assets/telegram-bot-token-field-Cn2tYIPN.js.gz +0 -0
  302. package/dist/web/assets/{terminal-tab-eVtopKuS.js → terminal-tab-Cn7mR-ju.js} +1 -1
  303. package/dist/web/assets/terminal-tab-Cn7mR-ju.js.br +0 -0
  304. package/dist/web/assets/terminal-tab-Cn7mR-ju.js.gz +0 -0
  305. package/dist/web/assets/{tool-cards-CqkbtQmV.js → tool-cards-BsbretjX.js} +3 -3
  306. package/dist/web/assets/tool-cards-BsbretjX.js.br +0 -0
  307. package/dist/web/assets/tool-cards-BsbretjX.js.gz +0 -0
  308. package/dist/web/assets/{tools-settings-section-ym2uDafc.js → tools-settings-section-VR1kAUqP.js} +1 -1
  309. package/dist/web/assets/tools-settings-section-VR1kAUqP.js.br +0 -0
  310. package/dist/web/assets/tools-settings-section-VR1kAUqP.js.gz +0 -0
  311. package/dist/web/assets/{use-db-read-MivtTKTM.js → use-db-read-DQ9NNFO5.js} +1 -1
  312. package/dist/web/assets/{use-db-read-MivtTKTM.js.br → use-db-read-DQ9NNFO5.js.br} +0 -0
  313. package/dist/web/assets/use-db-read-DQ9NNFO5.js.gz +0 -0
  314. package/dist/web/assets/{use-inline-blame-qDX6zmzH.js → use-inline-blame-D3icIZN5.js} +1 -1
  315. package/dist/web/assets/use-inline-blame-D3icIZN5.js.br +0 -0
  316. package/dist/web/assets/use-inline-blame-D3icIZN5.js.gz +0 -0
  317. package/dist/web/assets/{use-lsp-BdHI4aa8.js → use-lsp-B_rWeV_U.js} +1 -1
  318. package/dist/web/assets/use-lsp-B_rWeV_U.js.br +0 -0
  319. package/dist/web/assets/use-lsp-B_rWeV_U.js.gz +0 -0
  320. package/dist/web/assets/{use-monaco-theme-B4sZXOJo.js → use-monaco-theme-yVbWyiD5.js} +1 -1
  321. package/dist/web/assets/{use-process-kill-B7kifhe_.js → use-process-kill-DnsJehPH.js} +1 -1
  322. package/dist/web/assets/use-process-kill-DnsJehPH.js.br +0 -0
  323. package/dist/web/assets/use-process-kill-DnsJehPH.js.gz +0 -0
  324. package/dist/web/assets/{use-sql-schema-info-w7C5brXk.js → use-sql-schema-info-BVycXVe5.js} +1 -1
  325. package/dist/web/assets/use-sql-schema-info-BVycXVe5.js.br +0 -0
  326. package/dist/web/assets/use-sql-schema-info-BVycXVe5.js.gz +0 -0
  327. package/dist/web/assets/{use-websocket-DsX1l-DK.js → use-websocket-C_m-8l_F.js} +1 -1
  328. package/dist/web/assets/{vault-settings-section-B0oWe-n2.js → vault-settings-section-AmzR65kD.js} +1 -1
  329. package/dist/web/assets/vault-settings-section-AmzR65kD.js.br +0 -0
  330. package/dist/web/assets/vault-settings-section-AmzR65kD.js.gz +0 -0
  331. package/dist/web/assets/{voice-settings-section-DNNYOnyl.js → voice-settings-section-BRp23eqt.js} +1 -1
  332. package/dist/web/assets/voice-settings-section-BRp23eqt.js.br +0 -0
  333. package/dist/web/assets/voice-settings-section-BRp23eqt.js.gz +0 -0
  334. package/dist/web/assets/{web-preview-tab-CvP7EV4g.js → web-preview-tab-4RG8fhNU.js} +1 -1
  335. package/dist/web/assets/web-preview-tab-4RG8fhNU.js.br +0 -0
  336. package/dist/web/assets/web-preview-tab-4RG8fhNU.js.gz +0 -0
  337. package/dist/web/assets/{xlsx-preview-EuM_t7JD.js → xlsx-preview-BtWDXYin.js} +1 -1
  338. package/dist/web/assets/xlsx-preview-BtWDXYin.js.br +0 -0
  339. package/dist/web/assets/xlsx-preview-BtWDXYin.js.gz +0 -0
  340. package/dist/web/index.html +4 -4
  341. package/dist/web/index.html.br +0 -0
  342. package/dist/web/index.html.gz +0 -0
  343. package/dist/web/sw.js +1 -1
  344. package/dist/web/sw.js.br +0 -0
  345. package/dist/web/sw.js.gz +0 -0
  346. package/package.json +1 -1
  347. package/src/index.ts +5 -1
  348. package/src/server/routes/files.ts +7 -3
  349. package/src/services/file-filter.service.ts +1 -1
  350. package/src/services/file-glob.ts +1 -1
  351. package/src/services/file-index/file-index-runner.ts +178 -84
  352. package/src/services/file-index/file-index-walk-process.ts +70 -0
  353. package/src/services/file-index/file-index-worker.ts +22 -50
  354. package/src/services/file-index/index-search.ts +1 -1
  355. package/src/services/file-index/index-walk.ts +143 -41
  356. package/src/services/file-list-index.service.ts +32 -6
  357. package/src/shared/file-index-limits.ts +1 -1
  358. package/src/types/project.ts +2 -0
  359. package/src/web/components/chat/chat-tab.tsx +12 -3
  360. package/src/web/components/chat/footer-popover.tsx +5 -3
  361. package/src/web/components/layout/command-palette-truncated-notice.tsx +29 -0
  362. package/src/web/components/layout/command-palette.tsx +6 -0
  363. package/src/web/hooks/use-scroll-edge-fades.ts +72 -0
  364. package/src/web/stores/file-store.ts +10 -2
  365. package/src/web/styles/globals.css +30 -0
  366. package/dist/web/assets/accounts-settings-section-CHq3WVao.js.br +0 -0
  367. package/dist/web/assets/accounts-settings-section-CHq3WVao.js.gz +0 -0
  368. package/dist/web/assets/agent-session-sheet-C0sgsTt9.js.br +0 -0
  369. package/dist/web/assets/agent-session-sheet-C0sgsTt9.js.gz +0 -0
  370. package/dist/web/assets/agent-session-window-content-CbrD8f8E.js.br +0 -0
  371. package/dist/web/assets/agent-session-window-content-CbrD8f8E.js.gz +0 -0
  372. package/dist/web/assets/ai-resource-editor-CjellqxA.js.br +0 -0
  373. package/dist/web/assets/ai-resource-editor-CjellqxA.js.gz +0 -0
  374. package/dist/web/assets/ai-settings-section-CSRMdQ2S.js.br +0 -0
  375. package/dist/web/assets/ai-settings-section-CSRMdQ2S.js.gz +0 -0
  376. package/dist/web/assets/ai-settings-section-Db9X6wec.js.br +0 -0
  377. package/dist/web/assets/ai-settings-section-Db9X6wec.js.gz +0 -0
  378. package/dist/web/assets/android-tab-DG1-4oee.js.br +0 -0
  379. package/dist/web/assets/android-tab-DG1-4oee.js.gz +0 -0
  380. package/dist/web/assets/antigravity-usage-view-C9gPFRb5.js.br +0 -0
  381. package/dist/web/assets/antigravity-usage-view-C9gPFRb5.js.gz +0 -0
  382. package/dist/web/assets/appearance-settings-section-By5gIwBb.js.br +0 -0
  383. package/dist/web/assets/appearance-settings-section-By5gIwBb.js.gz +0 -0
  384. package/dist/web/assets/apps-panel-D7fUCDns.js.br +0 -0
  385. package/dist/web/assets/apps-panel-D7fUCDns.js.gz +0 -0
  386. package/dist/web/assets/assistant-settings-section-D2XmOMHN.js.br +0 -0
  387. package/dist/web/assets/assistant-settings-section-D2XmOMHN.js.gz +0 -0
  388. package/dist/web/assets/assistant-tab-BFarx_Ed.js.br +0 -0
  389. package/dist/web/assets/assistant-tab-BFarx_Ed.js.gz +0 -0
  390. package/dist/web/assets/branch-review-tab-DdIk8GqJ.js.br +0 -0
  391. package/dist/web/assets/branch-review-tab-DdIk8GqJ.js.gz +0 -0
  392. package/dist/web/assets/build-message-with-attachments-Dsq01VRu.js.br +0 -0
  393. package/dist/web/assets/build-message-with-attachments-Dsq01VRu.js.gz +0 -0
  394. package/dist/web/assets/chat-tab-CAE9EaFD.js +0 -16
  395. package/dist/web/assets/chat-tab-CAE9EaFD.js.br +0 -0
  396. package/dist/web/assets/chat-tab-CAE9EaFD.js.gz +0 -0
  397. package/dist/web/assets/chat-tab-CvA7BVJ4.js.br +0 -0
  398. package/dist/web/assets/chat-tab-CvA7BVJ4.js.gz +0 -0
  399. package/dist/web/assets/code-editor-DtOD5q9b.js.br +0 -0
  400. package/dist/web/assets/code-editor-DtOD5q9b.js.gz +0 -0
  401. package/dist/web/assets/conflict-editor-Dj4BkpPf.js.br +0 -0
  402. package/dist/web/assets/conflict-editor-Dj4BkpPf.js.gz +0 -0
  403. package/dist/web/assets/connection-form-tab-Dk7r5Mtu.js.br +0 -0
  404. package/dist/web/assets/csv-preview-Dgmt5iQZ.js.br +0 -0
  405. package/dist/web/assets/csv-preview-Dgmt5iQZ.js.gz +0 -0
  406. package/dist/web/assets/database-drivers-section-DSbxYtMp.js.br +0 -0
  407. package/dist/web/assets/database-drivers-section-DSbxYtMp.js.gz +0 -0
  408. package/dist/web/assets/db-tab-parts-CWVmqUJa.js.br +0 -0
  409. package/dist/web/assets/db-tab-parts-CWVmqUJa.js.gz +0 -0
  410. package/dist/web/assets/design-settings-section-CnWSH_2N.js.br +0 -0
  411. package/dist/web/assets/design-settings-section-CnWSH_2N.js.gz +0 -0
  412. package/dist/web/assets/design-tab-DiqcX1dI.js.br +0 -0
  413. package/dist/web/assets/design-tab-DiqcX1dI.js.gz +0 -0
  414. package/dist/web/assets/designs-sidebar-panel-DeE4Jcpo.js.br +0 -0
  415. package/dist/web/assets/designs-sidebar-panel-DeE4Jcpo.js.gz +0 -0
  416. package/dist/web/assets/diff-viewer-6O_OSt5v.js.br +0 -0
  417. package/dist/web/assets/diff-viewer-6O_OSt5v.js.gz +0 -0
  418. package/dist/web/assets/docx-preview-CLWVH9aX.js.br +0 -0
  419. package/dist/web/assets/docx-preview-CLWVH9aX.js.gz +0 -0
  420. package/dist/web/assets/editor-dialog-DFix0Lrm.js.gz +0 -0
  421. package/dist/web/assets/editor-language-service-BxWCC26X.js.br +0 -0
  422. package/dist/web/assets/editor-language-service-BxWCC26X.js.gz +0 -0
  423. package/dist/web/assets/explorer-body-D0CQnNgj.js.br +0 -0
  424. package/dist/web/assets/explorer-body-D0CQnNgj.js.gz +0 -0
  425. package/dist/web/assets/explorer-window-content-DPLxcaoz.js.br +0 -0
  426. package/dist/web/assets/explorer-window-content-DPLxcaoz.js.gz +0 -0
  427. package/dist/web/assets/extension-manager-section-BWPlMBS4.js.br +0 -0
  428. package/dist/web/assets/extension-manager-section-BWPlMBS4.js.gz +0 -0
  429. package/dist/web/assets/extension-webview-D5IPLnq8.js.br +0 -0
  430. package/dist/web/assets/extension-webview-D5IPLnq8.js.gz +0 -0
  431. package/dist/web/assets/file-store-KmDlwUZn.js +0 -1
  432. package/dist/web/assets/file-store-KmDlwUZn.js.br +0 -0
  433. package/dist/web/assets/file-store-KmDlwUZn.js.gz +0 -0
  434. package/dist/web/assets/files-settings-section-MR-8W7DJ.js.br +0 -0
  435. package/dist/web/assets/files-settings-section-MR-8W7DJ.js.gz +0 -0
  436. package/dist/web/assets/general-settings-section-CEl3ciuP.js.br +0 -0
  437. package/dist/web/assets/general-settings-section-CEl3ciuP.js.gz +0 -0
  438. package/dist/web/assets/git-log-panel-DBfy0HRE.js.br +0 -0
  439. package/dist/web/assets/git-log-panel-DBfy0HRE.js.gz +0 -0
  440. package/dist/web/assets/git-review-tab-C1V1CZAt.js.br +0 -0
  441. package/dist/web/assets/git-review-tab-C1V1CZAt.js.gz +0 -0
  442. package/dist/web/assets/glide-data-grid-D84U-1qn.js.br +0 -0
  443. package/dist/web/assets/grid-save-dialog-D9q2lcrq.js.br +0 -0
  444. package/dist/web/assets/grid-save-dialog-D9q2lcrq.js.gz +0 -0
  445. package/dist/web/assets/group-chat-tab-Bl0ECmSY.js.br +0 -0
  446. package/dist/web/assets/group-chat-tab-Bl0ECmSY.js.gz +0 -0
  447. package/dist/web/assets/impexp-tab-BgGbQxzM.js.br +0 -0
  448. package/dist/web/assets/impexp-tab-BgGbQxzM.js.gz +0 -0
  449. package/dist/web/assets/index-CXjsAVvH.js +0 -61
  450. package/dist/web/assets/index-CXjsAVvH.js.br +0 -0
  451. package/dist/web/assets/index-CXjsAVvH.js.gz +0 -0
  452. package/dist/web/assets/index-NLV9BOl2.css +0 -1
  453. package/dist/web/assets/index-NLV9BOl2.css.br +0 -0
  454. package/dist/web/assets/index-NLV9BOl2.css.gz +0 -0
  455. package/dist/web/assets/keyboard-shortcuts-section-BWvBH4ZU.js.br +0 -0
  456. package/dist/web/assets/keyboard-shortcuts-section-BWvBH4ZU.js.gz +0 -0
  457. package/dist/web/assets/language-servers-section-DnehfNOm.js.br +0 -0
  458. package/dist/web/assets/language-servers-section-DnehfNOm.js.gz +0 -0
  459. package/dist/web/assets/logs-app-BlFJdAK9.js.br +0 -0
  460. package/dist/web/assets/logs-app-BlFJdAK9.js.gz +0 -0
  461. package/dist/web/assets/lsp-client-CHfLLcaF.js.br +0 -0
  462. package/dist/web/assets/lsp-client-CHfLLcaF.js.gz +0 -0
  463. package/dist/web/assets/markdown-renderer-CSFnCZ8K.js.br +0 -0
  464. package/dist/web/assets/markdown-renderer-CSFnCZ8K.js.gz +0 -0
  465. package/dist/web/assets/markdown-renderer-DksvADDz.js.br +0 -0
  466. package/dist/web/assets/markdown-renderer-DksvADDz.js.gz +0 -0
  467. package/dist/web/assets/mobile-explorer-sheet-B5sLjLZs.js.br +0 -0
  468. package/dist/web/assets/mobile-explorer-sheet-B5sLjLZs.js.gz +0 -0
  469. package/dist/web/assets/new-design-dialog-_GiCQMy2.js.br +0 -0
  470. package/dist/web/assets/new-design-dialog-_GiCQMy2.js.gz +0 -0
  471. package/dist/web/assets/notifications-settings-section-D8irgdCE.js.br +0 -0
  472. package/dist/web/assets/notifications-settings-section-D8irgdCE.js.gz +0 -0
  473. package/dist/web/assets/onboarding-entry-DzhsgvnY.js.gz +0 -0
  474. package/dist/web/assets/open-manager-chat-Bkb2PmYu.js.br +0 -0
  475. package/dist/web/assets/open-manager-chat-Bkb2PmYu.js.gz +0 -0
  476. package/dist/web/assets/open-manager-chat-CNVW5U1C.js.gz +0 -0
  477. package/dist/web/assets/problems-panel-DZCBTTK0.js.br +0 -0
  478. package/dist/web/assets/problems-panel-DZCBTTK0.js.gz +0 -0
  479. package/dist/web/assets/process-table-oLXQ1Mj2.js.br +0 -0
  480. package/dist/web/assets/process-table-oLXQ1Mj2.js.gz +0 -0
  481. package/dist/web/assets/proxy-settings-section-D88d-YqC.js.br +0 -0
  482. package/dist/web/assets/proxy-settings-section-D88d-YqC.js.gz +0 -0
  483. package/dist/web/assets/query-tab-D3UWqL_c.js.br +0 -0
  484. package/dist/web/assets/query-tab-D3UWqL_c.js.gz +0 -0
  485. package/dist/web/assets/remote-access-settings-section-lDOBuTcD.js.br +0 -0
  486. package/dist/web/assets/remote-access-settings-section-lDOBuTcD.js.gz +0 -0
  487. package/dist/web/assets/remote-desktop-clipboard-notice-C8lLPqSE.js.br +0 -0
  488. package/dist/web/assets/remote-desktop-clipboard-notice-C8lLPqSE.js.gz +0 -0
  489. package/dist/web/assets/remote-desktop-mobile-sheet-1X9nMYdk.js.br +0 -0
  490. package/dist/web/assets/remote-desktop-mobile-sheet-1X9nMYdk.js.gz +0 -0
  491. package/dist/web/assets/remote-desktop-mobile-view-DXlyxMuT.js.br +0 -0
  492. package/dist/web/assets/remote-desktop-mobile-view-DXlyxMuT.js.gz +0 -0
  493. package/dist/web/assets/remote-desktop-readiness-gate-CapsSTlz.js.br +0 -0
  494. package/dist/web/assets/remote-desktop-readiness-gate-CapsSTlz.js.gz +0 -0
  495. package/dist/web/assets/remote-desktop-window-content-CmASOSoo.js.br +0 -0
  496. package/dist/web/assets/remote-desktop-window-content-CmASOSoo.js.gz +0 -0
  497. package/dist/web/assets/rename-object-dialog-CFhoU1ti.js.br +0 -0
  498. package/dist/web/assets/rename-object-dialog-CFhoU1ti.js.gz +0 -0
  499. package/dist/web/assets/review-address-setup-CHbOBPtn.js.br +0 -0
  500. package/dist/web/assets/review-address-setup-CHbOBPtn.js.gz +0 -0
  501. package/dist/web/assets/review-code-Ek4TK-FX.js.br +0 -0
  502. package/dist/web/assets/review-code-Ek4TK-FX.js.gz +0 -0
  503. package/dist/web/assets/save-as-dialog-m00iZElW.js.br +0 -0
  504. package/dist/web/assets/save-as-dialog-m00iZElW.js.gz +0 -0
  505. package/dist/web/assets/schedule-form-BDbZLG_F.js.br +0 -0
  506. package/dist/web/assets/schedule-form-BDbZLG_F.js.gz +0 -0
  507. package/dist/web/assets/schedule-script-editor-BC7_nlsE.js.br +0 -0
  508. package/dist/web/assets/schedule-script-editor-BC7_nlsE.js.gz +0 -0
  509. package/dist/web/assets/schedules-app-C6IdZ1hz.js.br +0 -0
  510. package/dist/web/assets/schedules-app-C6IdZ1hz.js.gz +0 -0
  511. package/dist/web/assets/schedules-settings-section-Dhc_ZbMP.js.br +0 -0
  512. package/dist/web/assets/schedules-settings-section-Dhc_ZbMP.js.gz +0 -0
  513. package/dist/web/assets/schedules-tab-NMvWV7xN.js.br +0 -0
  514. package/dist/web/assets/schedules-tab-NMvWV7xN.js.gz +0 -0
  515. package/dist/web/assets/schedules-ui-DaSldyoD.js.br +0 -0
  516. package/dist/web/assets/schedules-ui-DaSldyoD.js.gz +0 -0
  517. package/dist/web/assets/schedules-window-content-MseZLBpK.js.br +0 -0
  518. package/dist/web/assets/schedules-window-content-MseZLBpK.js.gz +0 -0
  519. package/dist/web/assets/session-review-tab-BEPMJynS.js.br +0 -0
  520. package/dist/web/assets/session-review-tab-BEPMJynS.js.gz +0 -0
  521. package/dist/web/assets/settings-body-D2e_RbI4.js.br +0 -0
  522. package/dist/web/assets/settings-body-D2e_RbI4.js.gz +0 -0
  523. package/dist/web/assets/settings-rows-B6puQ-Vk.js.br +0 -0
  524. package/dist/web/assets/settings-rows-B6puQ-Vk.js.gz +0 -0
  525. package/dist/web/assets/settings-section-content-Mzy53zFZ.js.br +0 -0
  526. package/dist/web/assets/settings-section-content-Mzy53zFZ.js.gz +0 -0
  527. package/dist/web/assets/sql-object-tab-DXiJqm1Y.js.br +0 -0
  528. package/dist/web/assets/sql-object-tab-DXiJqm1Y.js.gz +0 -0
  529. package/dist/web/assets/sqlite-viewer-BoqlcTq3.js.br +0 -0
  530. package/dist/web/assets/sqlite-viewer-BoqlcTq3.js.gz +0 -0
  531. package/dist/web/assets/storage-settings-section-BSzvRWfE.js.br +0 -0
  532. package/dist/web/assets/storage-settings-section-BSzvRWfE.js.gz +0 -0
  533. package/dist/web/assets/structure-save-dialog-DmAOFSGl.js.br +0 -0
  534. package/dist/web/assets/structure-save-dialog-DmAOFSGl.js.gz +0 -0
  535. package/dist/web/assets/structure-tab-Cj2T4GOA.js.br +0 -0
  536. package/dist/web/assets/structure-tab-Cj2T4GOA.js.gz +0 -0
  537. package/dist/web/assets/system-monitor-body-ryEXCvyT.js.br +0 -0
  538. package/dist/web/assets/system-monitor-body-ryEXCvyT.js.gz +0 -0
  539. package/dist/web/assets/tab-host-window-content-CD92R8Dj.js.gz +0 -0
  540. package/dist/web/assets/table-tab-zoEhA_cF.js.br +0 -0
  541. package/dist/web/assets/table-tab-zoEhA_cF.js.gz +0 -0
  542. package/dist/web/assets/task-detail-mobile-40HLTUnk.js.br +0 -0
  543. package/dist/web/assets/task-detail-mobile-40HLTUnk.js.gz +0 -0
  544. package/dist/web/assets/task-sheet-Tbk7O-Ak.js.br +0 -0
  545. package/dist/web/assets/task-sheet-Tbk7O-Ak.js.gz +0 -0
  546. package/dist/web/assets/task-status-grid-D4UX5sy_.js.br +0 -0
  547. package/dist/web/assets/task-status-grid-D4UX5sy_.js.gz +0 -0
  548. package/dist/web/assets/task-tab-CrW-DqBd.js.br +0 -0
  549. package/dist/web/assets/task-tab-CrW-DqBd.js.gz +0 -0
  550. package/dist/web/assets/tasks-sidebar-panel-D3opTyDQ.js.br +0 -0
  551. package/dist/web/assets/tasks-sidebar-panel-D3opTyDQ.js.gz +0 -0
  552. package/dist/web/assets/telegram-bot-token-field-CP_XKOOb.js.br +0 -0
  553. package/dist/web/assets/telegram-bot-token-field-CP_XKOOb.js.gz +0 -0
  554. package/dist/web/assets/terminal-tab-eVtopKuS.js.br +0 -0
  555. package/dist/web/assets/terminal-tab-eVtopKuS.js.gz +0 -0
  556. package/dist/web/assets/tool-cards-CqkbtQmV.js.br +0 -0
  557. package/dist/web/assets/tool-cards-CqkbtQmV.js.gz +0 -0
  558. package/dist/web/assets/tools-settings-section-ym2uDafc.js.br +0 -0
  559. package/dist/web/assets/tools-settings-section-ym2uDafc.js.gz +0 -0
  560. package/dist/web/assets/use-db-read-MivtTKTM.js.gz +0 -0
  561. package/dist/web/assets/use-inline-blame-qDX6zmzH.js.br +0 -0
  562. package/dist/web/assets/use-inline-blame-qDX6zmzH.js.gz +0 -0
  563. package/dist/web/assets/use-lsp-BdHI4aa8.js.br +0 -0
  564. package/dist/web/assets/use-lsp-BdHI4aa8.js.gz +0 -0
  565. package/dist/web/assets/use-process-kill-B7kifhe_.js.br +0 -0
  566. package/dist/web/assets/use-process-kill-B7kifhe_.js.gz +0 -0
  567. package/dist/web/assets/use-sql-schema-info-w7C5brXk.js.br +0 -0
  568. package/dist/web/assets/use-sql-schema-info-w7C5brXk.js.gz +0 -0
  569. package/dist/web/assets/vault-settings-section-B0oWe-n2.js.br +0 -0
  570. package/dist/web/assets/vault-settings-section-B0oWe-n2.js.gz +0 -0
  571. package/dist/web/assets/voice-settings-section-DNNYOnyl.js.br +0 -0
  572. package/dist/web/assets/voice-settings-section-DNNYOnyl.js.gz +0 -0
  573. package/dist/web/assets/web-preview-tab-CvP7EV4g.js.br +0 -0
  574. package/dist/web/assets/web-preview-tab-CvP7EV4g.js.gz +0 -0
  575. package/dist/web/assets/xlsx-preview-EuM_t7JD.js.br +0 -0
  576. package/dist/web/assets/xlsx-preview-EuM_t7JD.js.gz +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.26.27] - 2026-11-22
4
+
5
+ ### Fixed
6
+
7
+ - **Huge projects no longer bloat the server's memory**: the file index is walked in a short-lived child process and searched on one worker per project, so a folder with hundreds of checkouts stops growing PPM by gigabytes.
8
+ - **A file list cut at 300k entries keeps the shallow files**, and the command palette says when the list was cut, with a link to File Filters.
9
+ - **The chat footer's left chips scroll sideways when they overflow** a narrow pane, with faded edges, instead of the last chip being cut off.
10
+
3
11
  ## [0.26.26] - 2026-11-21
4
12
 
5
13
  ### Added
package/CLAUDE.md CHANGED
@@ -85,7 +85,7 @@ Related: `configService.save()`/`set()` throw when `load()` has not run, because
85
85
  - **SDK .env poisoning**: Projects with `ANTHROPIC_API_KEY` in `.env` break SDK tool execution. Provider neutralizes these vars. See `docs/lessons-learned.md`.
86
86
  - **A CLI write finds its server through `server-endpoint.<db>.<pid>.json`, never `.server-port`; with no live server it writes directly**: every server publishes that file into its PPM folder (`server-endpoint-file.ts`), and `ppm-server-client.ts` picks the live one for the command's database (`PPM_INSTANCE_ID` when several share it), proves it with the token-free `/api/cli/hello` HMAC before sending the token, and prints `→ PPM <profile> (<db>) at 127.0.0.1:<port>` on stderr. Only when no server provably holds the database (no live endpoint file, no supervisor of that profile, nothing on the port) does a command write the database itself, after saying so; a server it cannot verify is a refusal. Two consequences: a running PPM older than this publishes no file, so CLI writes are refused until it restarts; and a test or script that starts a server of its own must call `publishServerEndpoint` or the CLI will not see it (`tests/helpers/cli-*-scratch-server-main.ts`, `tests/e2e/fixtures/assistant-cli-server.ts`). Every "refused from an AI chat" in the CLI is advisory — it reads `PPM_AI_CHAT`, which any shell can drop; the shell card, the tool cards and the route rules are the controls (`docs/architecture/ai-chat-and-providers.md` → Assistant → CLI through the server).
87
87
  - **File watching**: never `fs.watch(dir, { recursive: true })` on a project root — on Linux that is one inotify watch per subdirectory, `node_modules` included (it once cost 359k watches). Ignored dirs must be pruned at registration time via `src/services/file-watcher/watch-tree.ts`.
88
- - **A file change marks the flat file index stale, and must never make a request walk the project**: `buildIndex` used to walk with `readdirSync` on the main thread while every change dropped the cache and the explorer refetched `/files/index` 300 ms later. nxsys-workspace (181k entries, 22 MB of JSON) is a 6.2 s walk, so a session writing test artefacts into it kept the event loop stopped back to back until the supervisor's health check (5 s timeout, three strikes) killed the server — and every Claude session under it. Now the walk yields every 256 entries on `setTimeout(0)` (`setImmediate` costs 0.002 ms a yield against 1.09 ms, but starved HTTP to a 16 ms p50 against 1.4 ms), a stale list is rebuilt behind the one held, a request waits for that rebuild at most `REBUILD_GRACE_MS` (1 s — enough that an ordinary project answers fresh and a file just created is in the palette on its first open), and `files:index-changed` goes out only when the rebuilt paths differ. The browser does not refetch on a change either: `file:changed` and `files:index-changed` set `indexStale`, and `ensureIndex` refreshes when the palette, the compare picker or the @-picker opens. Two traps. A rebuild runs only when a request asks for one, so a change landing mid-walk is walked again only if a request saw it (`rewalk`) — rebuilding on a timer would keep a core busy for as long as a session keeps writing. And a first walk that no longer stops the server can outlast **Bun.serve's default 10 s idle timeout** (14 s on a busy scratch server), which cuts the request off with the list nearly built; the route calls `server.timeout(req, 30)` through `c.env`, the server `app.fetch(req, server)` passed.
88
+ - **A file change marks the flat file index stale, and must never make a request walk the project**: `buildIndex` used to walk with `readdirSync` on the main thread while every change dropped the cache and the explorer refetched `/files/index` 300 ms later. nxsys-workspace (181k entries, 22 MB of JSON) is a 6.2 s walk, so a session writing test artefacts into it kept the event loop stopped back to back until the supervisor's health check (5 s timeout, three strikes) killed the server — and every Claude session under it. Now the walk yields every 256 entries on `setTimeout(0)` (`setImmediate` costs 0.002 ms a yield against 1.09 ms, but starved HTTP to a 16 ms p50 against 1.4 ms), a stale list is rebuilt behind the one held, a request waits for that rebuild at most `REBUILD_GRACE_MS` (1 s — enough that an ordinary project answers fresh and a file just created is in the palette on its first open), and `files:index-changed` goes out only when the rebuilt paths differ. The browser does not refetch on a change either: `file:changed` and `files:index-changed` set `indexStale`, and `ensureIndex` refreshes when the palette, the compare picker or the @-picker opens. Two traps. A rebuild runs only when a request asks for one, so a change landing mid-walk is walked again only if a request saw it (`rewalk`) — rebuilding on a timer would keep a core busy for as long as a session keeps writing. And a first walk that no longer stops the server can outlast **Bun.serve's default 10 s idle timeout** (14 s on a busy scratch server), which cuts the request off with the list nearly built; the route calls `server.timeout(req, 30)` through `c.env`, the server `app.fetch(req, server)` passed. Third trap, memory: a walk leaves its thread's heap far bigger than the list, and a long-lived index worker never gave that back — a folder of 355 worktree checkouts (1.17M entries) left the server at 3-5 GB private with a 250 MB JS heap, the "native" figure in `[mem]` warnings. Terminating the worker gave it back (2.5 GB → 0.8 GB) but is no fix on Windows: every terminated Bun Worker leaks ~29 MB (Bun 1.3.12; 40 empty workers, +1.15 GB), so a worker per walk grew the server 40 MB a walk. So every walk runs in a child process (`<bin> __file_index_walk__`, routed by `src/index.ts`; `bun run file-index-walk-process.ts` from source) with its request on the command line — not stdin, which a busy parent cannot feed — and the build back on stdout; a list searched on the server lives on one search worker per project for the server's life, re-seeded per build and never replaced; a walk stops at `MAX_INDEX_ENTRIES` (300k) keeping the shallow entries — it walks breadth-first and sorts back into depth-first order, because a depth-first cut spent every slot on `.tmp/` (307k entries of scratch checkouts, sorting first) and listed none of the project's code — and `/files/index` then sends `truncated`, which the palette shows with a link to File Filters; a list of 50k+ entries is never serialised whole or gzipped (the route answers `tooLarge`; its `json` is a sample) and is walked again only on a request, at most every `max(5 min, 10 × its walk)`, never per change.
89
89
  - **Project Claude settings**: a project's `.claude/settings.local.json` is never loaded into a chat — `CLAUDE_SETTING_SOURCES` lists `user` and `project` only. Its deny rules would hide tools even under `bypassPermissions` and its `env` can move the chat onto another API key, and the empty `settings` PPM also passes cancels neither, so the source list is the guard. It keeps out that one file only: the project's own `.claude/settings.json` is loaded and can deny tools and set `env` just the same.
90
90
  - **Transcript images live in two places**: the base64 payload sits at `message.content[].content[]` inside a tool result, but Claude Code also writes an image-shaped record at the top-level `toolUseResult` field carrying no payload. An assertion like "no `"type":"image"` remains" must be scoped to the former, or it fails against correct code.
91
91
  - **Plugin items are named by location, not frontmatter**: Claude Code registers a plugin's skills and commands as `<plugin>:<path>` (`ak-engineer:ak-debug`) and only honours the frontmatter `name` for agents. Kits that self-namespace instead — AgentKit ships `name: ak:debug` — publish a name nothing can resolve. `slash-discovery` mirrors that rule and keeps the declared name as an alias; `src/server/ws/chat.ts` rewrites the alias to the canonical name before the message reaches the SDK.
@@ -346,7 +346,7 @@ Before planning or implementing a new feature, read `docs/project-roadmap.md` to
346
346
  - `src/web/hooks/use-chat.ts` — Frontend chat state management
347
347
  - `src/services/config.service.ts` — Config from SQLite (`~/.ppm/ppm.db`)
348
348
  - `src/cli/utils/ppm-server-client.ts` + `src/services/server-endpoint-file.ts` — how a `ppm` command reaches the running PPM that holds its database: the server writes `server-endpoint.<db>.<pid>.json` (0600) where it listens, `server-discovery.ts` picks the live one (`--instance` / `PPM_INSTANCE_ID` among several), `cli-hello-proof.ts` + `routes/cli-hello.ts` prove it before the token is sent, and `serverRequest` calls its routes (`ServerDownError` → the command may write directly, after a notice; `ServerRefusedError` → it may not). The profile is picked before the first subcommand (`profile-argv.ts`, `apply-cli-profile.ts`); which commands go through a server is `src/services/assistant/ppm-cli-routing.ts` (`server` or `direct-allowed`, a test places every command), and the Assistant's `ppm_cli_reference` header (`ppm-cli-reference.ts`) explains all of it to the model. Shell environments carry `PPM_PROFILE`/`PPM_INSTANCE_ID` from `ppm-instance-env.ts`, plus `assistantShellEnv()` in an Assistant session. e2e `tests/e2e/assistant-cli-through-server-e2e.mjs`
349
- - Chat footer — under the conversation, after the turn-stop and MCP sign-in bars: one context row then the composer, no rules between them (`chat-tab.tsx`). Left of the row: `activity-chip.tsx` (running agents and linked sessions in one chip, a popover with Agents/Sessions tabs: `use-running-agents.ts`, `linked-sessions-panel.tsx`; unlinking is the synced UI pref `unlinkedSessions`, rules in `src/shared/linked-session-unlinks.ts`, also validated by `/api/settings/ui-prefs`), `session-changes-chip.tsx`, `connection-chip.tsx` (the reconnect stages of `use-reconnect-indicator.ts`; the composer placeholder follows them); right: `chat-footer-tools.tsx`, one chip-shaped group (`FOOTER_CLUSTER`) — a labelled ring per usage window (`UsageWindow` in `usage-meters.tsx`; the divider after it is rendered in the same branch, so it can never stand alone before History), History (`chat-history-panel.tsx`) and the ··· menu (`chat-more-menu.tsx`, Switch account in `switch-account-view.tsx` over `src/web/lib/chat-account-switch.ts` + `src/web/hooks/use-switch-accounts.ts`). Every chip opens `footer-popover.tsx` (a bottom sheet below `md`), positioned against the row — chip wrappers must not be `relative`, or the left zone's clip cuts the popover. Shared chip classes in `footer-chip.ts`; motion classes `footer-*` in `globals.css`. The composer (`message-input.tsx`) is the textarea over one bar; the provider is chosen inside the model chip (`ProviderChoiceRow`). The `/` and `@` pickers (`slash-command-picker.tsx` + `slash-command-picker-row.tsx`, `file-picker.tsx`, shared parts in `composer-picker-parts.tsx`) float above the composer from a zero-height `relative` box in `chat-tab.tsx`, over the context row; the footer is `z-index: 20` (`globals.css`) so they and the footer popovers cover the conversation's scroll buttons (z-10). e2e `node tests/e2e/chat-footer-e2e.mjs` (fixture `tests/e2e/fixtures/chat-footer-server.ts`)
349
+ - Chat footer — under the conversation, after the turn-stop and MCP sign-in bars: one context row then the composer, no rules between them (`chat-tab.tsx`). Left of the row: `activity-chip.tsx` (running agents and linked sessions in one chip, a popover with Agents/Sessions tabs: `use-running-agents.ts`, `linked-sessions-panel.tsx`; unlinking is the synced UI pref `unlinkedSessions`, rules in `src/shared/linked-session-unlinks.ts`, also validated by `/api/settings/ui-prefs`), `session-changes-chip.tsx`, `connection-chip.tsx` (the reconnect stages of `use-reconnect-indicator.ts`; the composer placeholder follows them); right: `chat-footer-tools.tsx`, one chip-shaped group (`FOOTER_CLUSTER`) — a labelled ring per usage window (`UsageWindow` in `usage-meters.tsx`; the divider after it is rendered in the same branch, so it can never stand alone before History), History (`chat-history-panel.tsx`) and the ··· menu (`chat-more-menu.tsx`, Switch account in `switch-account-view.tsx` over `src/web/lib/chat-account-switch.ts` + `src/web/hooks/use-switch-accounts.ts`). Every chip opens `footer-popover.tsx` (a bottom sheet below `md`), positioned against the row — chip wrappers must not be `relative`, or the left zone's clip cuts the popover. The left zone (`data-footer-chips`) scrolls sideways when the chips overflow and fades its hidden side with a mask (`useScrollEdgeFades`, `.footer-chips` in `globals.css`); no containing block escapes a mask, so `.footer-chips:has([data-footer-popover])` lifts it while a popover is open. Shared chip classes in `footer-chip.ts`; motion classes `footer-*` in `globals.css`. The composer (`message-input.tsx`) is the textarea over one bar; the provider is chosen inside the model chip (`ProviderChoiceRow`). The `/` and `@` pickers (`slash-command-picker.tsx` + `slash-command-picker-row.tsx`, `file-picker.tsx`, shared parts in `composer-picker-parts.tsx`) float above the composer from a zero-height `relative` box in `chat-tab.tsx`, over the context row; the footer is `z-index: 20` (`globals.css`) so they and the footer popovers cover the conversation's scroll buttons (z-10). e2e `node tests/e2e/chat-footer-e2e.mjs` (fixture `tests/e2e/fixtures/chat-footer-server.ts`)
350
350
  - `src/web/components/floating-window/` — Desktop window manager (drag/resize/z-band/persistence), OS-agnostic
351
351
  - `src/web/components/os-explorer/` — OS File Explorer window body: views (List/Icons/Column), skins, mobile sheet, actions, drag-and-drop
352
352
  - `src/web/components/settings/` — Settings as its own window kind (`settings-window-content.tsx`) and, below `md` where the window layer does not render, a tab (`settings-tab.tsx`); both mount one `settings-body.tsx`, which picks split-vs-stacked from its OWN width via `@container` — never `useIsMobile()`, because a narrow sidebar is not a phone. Tree in `settings-categories.ts`, id→pane map in `settings-section-content.tsx`, viewport routing in `open-settings.ts` (plain function: the global keybinding handler is not a component). `accounts/` is the single home for account management, one sub-tab per configured provider (Claude + Codex; the tab only shows when that provider is in `ai.providers`). Every provider pane is built from the same parts — `accounts-pane-header.tsx` (header + message strip + `AccountCardShell`) and `account-bucket-row.tsx` (`AccountUsageBar`) — and puts every action behind a dialog, so the sub-tabs cannot drift into different designs again — the chat footer's usage ring and Switch account view and AI Provider’s Codex tab only display, pick and link here. e2e `tests/e2e/settings-window-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.26 at build time. Re-run `ppm export skill --install` to refresh. -->
86
+ <!-- Generated for PPM v0.26.27 at build time. Re-run `ppm export skill --install` to refresh. -->
@@ -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.26 -->
901
+ <!-- Generated from src/server/routes/ for PPM v0.26.27 -->
@@ -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-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};
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-CwW8jYaQ.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-B3nS0dXF.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,2 +1,2 @@
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};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/agent-session-window-content-D07cutjV.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-BsbretjX.js","assets/index-CwW8jYaQ.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-DvNGR1CA.js","assets/slash-command-picker-xIZbJS-p.js","assets/build-message-with-attachments-Co6REDSl.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-0VrQhdqv.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-D07cutjV.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};
@@ -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-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};
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-DvNGR1CA.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-BsbretjX.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};
@@ -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-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};
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-CwW8jYaQ.js";import{t as _}from"./use-monaco-theme-yVbWyiD5.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};
@@ -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-Db9X6wec.js";export{e as AISettingsSection};
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-CnyTPE3r.js";export{e as AISettingsSection};